Max Powers
Max Powers

Reputation: 1179

GitHub api code_frequency what are all the return values

Just had a basic question regarding the GitHub rest API regarding the following API call /repos/{owner}/{repo}/stats/code_frequency In the documentation Here it stats that the following API call does the following Returns a weekly aggregate of the number of additions and deletions pushed to a repository. If you see the return value below I'm assuming the second element in the list is the additions and the third element is the deletions, show what is the first element in this list?

Returns

[
  [
    1302998400,
    1124,
    -435
  ]
]

Upvotes: 2

Views: 728

Answers (1)

Bertrand Martel
Bertrand Martel

Reputation: 45503

It seems the first value is the epoch time in seconds (number of seconds since 01/01/1970) (unix time / posix time)

[
  1622937600,
  556,
  -215
],
[
  1623542400,
  0,
  0
]

could be translated into:

{
    "date": "2020-06-06T00:00:00",
    "additions": 556,
    "deletions": -215 
},
{
    "date": "2020-06-13T00:00:00",
    "additions": 0,
    "deletions": 0 
}

But hh:MM:ss is always set to 00:00:00 since it's the same data used to create the graph in the code frequency tab on the Github UI (granularity is weekly)

Upvotes: 2

Related Questions