@@ -40,9 +40,10 @@ var loading : Control
4040var session : HTTPClient = HTTPClient .new ()
4141var graphql_endpoint : String = "https://api.github.com/graphql"
4242var graphql_queries : Dictionary = {
43- 'repositories' :'{user(login: "%s "){repositories(ownerAffiliations:%s , first:%d , orderBy: {field: NAME, direction: ASC} ){ nodes { diskUsage name owner { login } description url isFork isPrivate forkCount stargazerCount isInOrganization collaborators(affiliation: DIRECT, first: 100) { nodes {login name avatarUrl} } mentionableUsers(first: 100){ nodes{ login name avatarUrl } } defaultBranchRef { name } refs(refPrefix: "refs/heads/", first: 100){ nodes{ name target { ... on Commit { oid tree { oid } zipballUrl tarballUrl } } } } } } } }' ,
43+ 'repositories' :'{user(login: "%s "){repositories(ownerAffiliations:%s , first:%d , orderBy: {field: NAME, direction: ASC} ){ nodes { diskUsage name owner { login } description url isFork isPrivate forkCount stargazerCount isInOrganization collaborators(affiliation: DIRECT, first: 100) { nodes {login name avatarUrl} } mentionableUsers(first: 100){ nodes{ login name avatarUrl } } defaultBranchRef { name } refs(refPrefix: "refs/heads/", first: 100){ nodes{ name target { ... on Commit { oid tree { oid } zipballUrl tarballUrl } } } } } } %s } }' ,
4444 'repository' :'{user(login: "%s "){repository(name:"%s "){diskUsage name owner { login } description url isFork isPrivate forkCount stargazerCount isInOrganization collaborators(affiliation: DIRECT, first: 100) { nodes {login name avatarUrl} } mentionableUsers(first: 100){ nodes{ login name avatarUrl } } defaultBranchRef { name } refs(refPrefix: "refs/heads/", first: 100){ nodes{ name target { ... on Commit { oid tree { oid } zipballUrl tarballUrl }}}}}} }' ,
4545 'gists' :'{ user(login: "%s ") { gists(first: %s , orderBy: {field: PUSHED_AT, direction: DESC} , privacy: ALL) { nodes { owner { login } id description resourcePath name stargazerCount isPublic isFork files { encodedName encoding extension name size text } } } } }' ,
46+ 'organizations_repositories' :'organizations(first:10){nodes{repositories(first:100){nodes{diskUsage name owner { login } description url isFork isPrivate forkCount stargazerCount isInOrganization collaborators(affiliation: DIRECT, first: 100) { nodes {login name avatarUrl} } mentionableUsers(first: 100){ nodes{ login name avatarUrl } } defaultBranchRef { name } refs(refPrefix: "refs/heads/", first: 100){ nodes{ name target { ... on Commit { oid tree { oid } zipballUrl tarballUrl } } } } }}}} '
4647}
4748var header : PoolStringArray = ["Authorization: token " ]
4849var api_endpoints : Dictionary = {
@@ -217,7 +218,12 @@ func request_contributor_avatar(avatar_url : String, contributor_class : Contrib
217218
218219func request_user_repositories () -> void :
219220 requesting = REQUESTS .USER_REPOSITORIES
220- var query : String = graphql_queries .repositories % [UserData .USER .login ,PluginSettings .owner_affiliations , repositories_limit ]
221+ var owner_affiliations : Array = PluginSettings .owner_affiliations .duplicate (true )
222+ var is_org_member : bool = false
223+ if owner_affiliations .has ("ORGANIZATION_MEMBER" ):
224+ owner_affiliations .erase ("ORGANIZATION_MEMBER" )
225+ is_org_member = true
226+ var query : String = graphql_queries .repositories % [UserData .USER .login , owner_affiliations , repositories_limit , graphql_queries .organizations_repositories if is_org_member else "" ]
221227 client .request (graphql_endpoint , UserData .header , true , HTTPClient .METHOD_POST , print_query (query ))
222228
223229func request_user_repository (repository_owner : String , repository_name : String ) -> void :
0 commit comments