trying to figure out gh graphql schema

This commit is contained in:
mjgaughan 2023-10-25 23:38:14 -05:00
parent 0711641ab9
commit 7d0a0866c7
2 changed files with 50 additions and 0 deletions

View File

@ -1,5 +1,9 @@
import requests import requests
import datetime as dt import datetime as dt
import json
import os
key = os.environ.get('KKEXKEY')
def main(vcs, begin_date): def main(vcs, begin_date):
repo_uri=vcs[0] repo_uri=vcs[0]
@ -30,6 +34,19 @@ def parse_milestones(milestones, earliest_date):
count_of_milestones += 1 count_of_milestones += 1
return count_of_milestones return count_of_milestones
def get_discussion_gql():
#testing
url = "https://api.github.com/graphql"
x = {"query" : "query { repository(owner: 'beekeeper-studio', name: 'beekeeper-studio') { discussions(first: 10) {totalCount}}"}
data = json.dumps(x)
headers = {'content-type': 'application/json', 'Accept-Charset': 'UTF-8', 'Authorization': 'bearer ' + key}
r = requests.post(url=url, data=data, headers=headers)
print(r.content)
print(r.json())
if __name__ == "__main__":
get_discussion_gql()
''' '''
#using the github API to identify who is a collaborator on the project and who is just a contributor #using the github API to identify who is a collaborator on the project and who is just a contributor
def split_actors(repo_uri, actors_list): def split_actors(repo_uri, actors_list):

33
request.json Normal file
View File

@ -0,0 +1,33 @@
{
query {
repository(owner: "github", name: "some-repo") {
discussions(first: 10) {
# type: DiscussionConnection
totalCount # Int!
pageInfo {
# type: PageInfo (from the public schema)
startCursor
endCursor
hasNextPage
hasPreviousPage
}
edges {
# type: DiscussionEdge
cursor
node {
# type: Discussion
id
}
}
nodes {
# type: Discussion
id
}
}
}
}
}