@@ -40,9 +40,10 @@ var loading : Control
40
40
var session : HTTPClient = HTTPClient .new ()
41
41
var graphql_endpoint : String = "https://api.github.com/graphql"
42
42
var 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 } }' ,
44
44
'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 }}}}}} }' ,
45
45
'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 } } } } }}}} '
46
47
}
47
48
var header : PoolStringArray = ["Authorization: token " ]
48
49
var api_endpoints : Dictionary = {
@@ -217,7 +218,12 @@ func request_contributor_avatar(avatar_url : String, contributor_class : Contrib
217
218
218
219
func request_user_repositories () -> void :
219
220
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 "" ]
221
227
client .request (graphql_endpoint , UserData .header , true , HTTPClient .METHOD_POST , print_query (query ))
222
228
223
229
func request_user_repository (repository_owner : String , repository_name : String ) -> void :
0 commit comments