diff --git a/api/graphql/generated/generated.go b/api/graphql/generated/generated.go index a114638..8a355ca 100644 --- a/api/graphql/generated/generated.go +++ b/api/graphql/generated/generated.go @@ -141,6 +141,13 @@ type ComplexityRoot struct { PullRequest func(childComplexity int) int } + CodeOfConduct struct { + Body func(childComplexity int) int + Key func(childComplexity int) int + Name func(childComplexity int) int + URL func(childComplexity int) int + } + Commit struct { AbbreviatedOid func(childComplexity int) int AuthoredDate func(childComplexity int) int @@ -242,6 +249,15 @@ type ComplexityRoot struct { TotalCount func(childComplexity int) int } + GitHubMetadata struct { + GitHubServicesSha func(childComplexity int) int + GitIPAddresses func(childComplexity int) int + HookIPAddresses func(childComplexity int) int + ImporterIPAddresses func(childComplexity int) int + IsPasswordAuthenticationVerifiable func(childComplexity int) int + PagesIPAddresses func(childComplexity int) int + } + Issue struct { ActiveLockReason func(childComplexity int) int Assignees func(childComplexity int, first *int32, after *string) int @@ -360,8 +376,12 @@ type ComplexityRoot struct { } License struct { - Name func(childComplexity int) int - SpdxID func(childComplexity int) int + Body func(childComplexity int) int + Key func(childComplexity int) int + Name func(childComplexity int) int + Nickname func(childComplexity int) int + SpdxID func(childComplexity int) int + URL func(childComplexity int) int } LockLockablePayload struct { @@ -648,12 +668,17 @@ type ComplexityRoot struct { } Query struct { + CodeOfConduct func(childComplexity int, key string) int + CodesOfConduct func(childComplexity int) int + License func(childComplexity int, key string) int + Licenses func(childComplexity int) int + Meta func(childComplexity int) int Node func(childComplexity int, id string) int Nodes func(childComplexity int, ids []string) int - RateLimit func(childComplexity int) int - Repository func(childComplexity int, owner string, name string) int + RateLimit func(childComplexity int, dryRun *bool) int + Repository func(childComplexity int, owner string, name string, followRenames *bool) int RepositoryOwner func(childComplexity int, login string) int - Search func(childComplexity int, query string, typeArg SearchType, first *int32, after *string) int + Search func(childComplexity int, query string, typeArg SearchType, first *int32, after *string, last *int32, before *string) int User func(childComplexity int, login string) int Viewer func(childComplexity int) int } @@ -825,6 +850,8 @@ type ComplexityRoot struct { } SearchResultItemConnection struct { + CodeCount func(childComplexity int) int + DiscussionCount func(childComplexity int) int Edges func(childComplexity int) int IssueCount func(childComplexity int) int Nodes func(childComplexity int) int @@ -1120,14 +1147,19 @@ type PullRequestReviewThreadResolver interface { Comments(ctx context.Context, obj *gqlmodel.PullRequestReviewThread, first *int32, after *string) (*gqlmodel.PullRequestReviewCommentConnection, error) } type QueryResolver interface { - Repository(ctx context.Context, owner string, name string) (*gqlmodel.Repository, error) + Repository(ctx context.Context, owner string, name string, followRenames *bool) (*gqlmodel.Repository, error) Viewer(ctx context.Context) (*gqlmodel.User, error) User(ctx context.Context, login string) (*gqlmodel.User, error) RepositoryOwner(ctx context.Context, login string) (gqlmodel.RepositoryOwner, error) Node(ctx context.Context, id string) (Node, error) Nodes(ctx context.Context, ids []string) ([]Node, error) - RateLimit(ctx context.Context) (*gqlmodel.RateLimit, error) - Search(ctx context.Context, query string, typeArg SearchType, first *int32, after *string) (*SearchResultItemConnection, error) + RateLimit(ctx context.Context, dryRun *bool) (*gqlmodel.RateLimit, error) + Search(ctx context.Context, query string, typeArg SearchType, first *int32, after *string, last *int32, before *string) (*SearchResultItemConnection, error) + License(ctx context.Context, key string) (*gqlmodel.License, error) + Licenses(ctx context.Context) ([]*gqlmodel.License, error) + CodeOfConduct(ctx context.Context, key string) (*CodeOfConduct, error) + CodesOfConduct(ctx context.Context) ([]*CodeOfConduct, error) + Meta(ctx context.Context) (*GitHubMetadata, error) } type RepositoryResolver interface { ViewerPermission(ctx context.Context, obj *gqlmodel.Repository) (*gqlmodel.RepositoryPermission, error) @@ -1525,6 +1557,31 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.ClosePullRequestPayload.PullRequest(childComplexity), true + case "CodeOfConduct.body": + if e.ComplexityRoot.CodeOfConduct.Body == nil { + break + } + + return e.ComplexityRoot.CodeOfConduct.Body(childComplexity), true + case "CodeOfConduct.key": + if e.ComplexityRoot.CodeOfConduct.Key == nil { + break + } + + return e.ComplexityRoot.CodeOfConduct.Key(childComplexity), true + case "CodeOfConduct.name": + if e.ComplexityRoot.CodeOfConduct.Name == nil { + break + } + + return e.ComplexityRoot.CodeOfConduct.Name(childComplexity), true + case "CodeOfConduct.url": + if e.ComplexityRoot.CodeOfConduct.URL == nil { + break + } + + return e.ComplexityRoot.CodeOfConduct.URL(childComplexity), true + case "Commit.abbreviatedOid": if e.ComplexityRoot.Commit.AbbreviatedOid == nil { break @@ -1835,6 +1892,43 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.GitActorConnection.TotalCount(childComplexity), true + case "GitHubMetadata.gitHubServicesSha": + if e.ComplexityRoot.GitHubMetadata.GitHubServicesSha == nil { + break + } + + return e.ComplexityRoot.GitHubMetadata.GitHubServicesSha(childComplexity), true + case "GitHubMetadata.gitIpAddresses": + if e.ComplexityRoot.GitHubMetadata.GitIPAddresses == nil { + break + } + + return e.ComplexityRoot.GitHubMetadata.GitIPAddresses(childComplexity), true + case "GitHubMetadata.hookIpAddresses": + if e.ComplexityRoot.GitHubMetadata.HookIPAddresses == nil { + break + } + + return e.ComplexityRoot.GitHubMetadata.HookIPAddresses(childComplexity), true + case "GitHubMetadata.importerIpAddresses": + if e.ComplexityRoot.GitHubMetadata.ImporterIPAddresses == nil { + break + } + + return e.ComplexityRoot.GitHubMetadata.ImporterIPAddresses(childComplexity), true + case "GitHubMetadata.isPasswordAuthenticationVerifiable": + if e.ComplexityRoot.GitHubMetadata.IsPasswordAuthenticationVerifiable == nil { + break + } + + return e.ComplexityRoot.GitHubMetadata.IsPasswordAuthenticationVerifiable(childComplexity), true + case "GitHubMetadata.pagesIpAddresses": + if e.ComplexityRoot.GitHubMetadata.PagesIPAddresses == nil { + break + } + + return e.ComplexityRoot.GitHubMetadata.PagesIPAddresses(childComplexity), true + case "Issue.activeLockReason": if e.ComplexityRoot.Issue.ActiveLockReason == nil { break @@ -2319,18 +2413,42 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.LanguageEdge.Size(childComplexity), true + case "License.body": + if e.ComplexityRoot.License.Body == nil { + break + } + + return e.ComplexityRoot.License.Body(childComplexity), true + case "License.key": + if e.ComplexityRoot.License.Key == nil { + break + } + + return e.ComplexityRoot.License.Key(childComplexity), true case "License.name": if e.ComplexityRoot.License.Name == nil { break } return e.ComplexityRoot.License.Name(childComplexity), true + case "License.nickname": + if e.ComplexityRoot.License.Nickname == nil { + break + } + + return e.ComplexityRoot.License.Nickname(childComplexity), true case "License.spdxId": if e.ComplexityRoot.License.SpdxID == nil { break } return e.ComplexityRoot.License.SpdxID(childComplexity), true + case "License.url": + if e.ComplexityRoot.License.URL == nil { + break + } + + return e.ComplexityRoot.License.URL(childComplexity), true case "LockLockablePayload.actor": if e.ComplexityRoot.LockLockablePayload.Actor == nil { @@ -3837,6 +3955,47 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.PullRequestTemplate.Filename(childComplexity), true + case "Query.codeOfConduct": + if e.ComplexityRoot.Query.CodeOfConduct == nil { + break + } + + args, err := ec.field_Query_codeOfConduct_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.CodeOfConduct(childComplexity, args["key"].(string)), true + case "Query.codesOfConduct": + if e.ComplexityRoot.Query.CodesOfConduct == nil { + break + } + + return e.ComplexityRoot.Query.CodesOfConduct(childComplexity), true + + case "Query.license": + if e.ComplexityRoot.Query.License == nil { + break + } + + args, err := ec.field_Query_license_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.License(childComplexity, args["key"].(string)), true + case "Query.licenses": + if e.ComplexityRoot.Query.Licenses == nil { + break + } + + return e.ComplexityRoot.Query.Licenses(childComplexity), true + case "Query.meta": + if e.ComplexityRoot.Query.Meta == nil { + break + } + + return e.ComplexityRoot.Query.Meta(childComplexity), true case "Query.node": if e.ComplexityRoot.Query.Node == nil { break @@ -3864,7 +4023,12 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin break } - return e.ComplexityRoot.Query.RateLimit(childComplexity), true + args, err := ec.field_Query_rateLimit_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.RateLimit(childComplexity, args["dryRun"].(*bool)), true case "Query.repository": if e.ComplexityRoot.Query.Repository == nil { break @@ -3875,7 +4039,7 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return 0, false } - return e.ComplexityRoot.Query.Repository(childComplexity, args["owner"].(string), args["name"].(string)), true + return e.ComplexityRoot.Query.Repository(childComplexity, args["owner"].(string), args["name"].(string), args["followRenames"].(*bool)), true case "Query.repositoryOwner": if e.ComplexityRoot.Query.RepositoryOwner == nil { break @@ -3897,7 +4061,7 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return 0, false } - return e.ComplexityRoot.Query.Search(childComplexity, args["query"].(string), args["type"].(SearchType), args["first"].(*int32), args["after"].(*string)), true + return e.ComplexityRoot.Query.Search(childComplexity, args["query"].(string), args["type"].(SearchType), args["first"].(*int32), args["after"].(*string), args["last"].(*int32), args["before"].(*string)), true case "Query.user": if e.ComplexityRoot.Query.User == nil { break @@ -4639,6 +4803,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.ReviewRequestConnection.TotalCount(childComplexity), true + case "SearchResultItemConnection.codeCount": + if e.ComplexityRoot.SearchResultItemConnection.CodeCount == nil { + break + } + + return e.ComplexityRoot.SearchResultItemConnection.CodeCount(childComplexity), true + case "SearchResultItemConnection.discussionCount": + if e.ComplexityRoot.SearchResultItemConnection.DiscussionCount == nil { + break + } + + return e.ComplexityRoot.SearchResultItemConnection.DiscussionCount(childComplexity), true case "SearchResultItemConnection.edges": if e.ComplexityRoot.SearchResultItemConnection.Edges == nil { break @@ -7082,7 +7258,10 @@ interface Node { type Query { # repository looks up a single repository by its owner login and name. It is # null when the repository does not exist or the viewer cannot see it. - repository(owner: String!, name: String!): Repository + # followRenames asks the lookup to follow a repository that was renamed away + # from owner/name to its new path; Githome resolves the current name directly, + # so the argument is accepted for wire compatibility and has no effect. + repository(owner: String!, name: String!, followRenames: Boolean = true): Repository # viewer is the currently authenticated user. viewer: User! # user looks up a user by login. @@ -7097,10 +7276,26 @@ type Query { # null when the ID cannot be resolved or the viewer cannot see the object. nodes(ids: [ID!]!): [Node]! # rateLimit returns the current rate-limit state for the authenticated user. - rateLimit: RateLimit + # dryRun asks GitHub to compute the cost of the rest of the query without + # charging it; Githome reports the same live state either way. + rateLimit(dryRun: Boolean = false): RateLimit # search returns results matching a query string across repositories, issues, - # pull requests, and users. - search(query: String!, type: SearchType!, first: Int, after: String): SearchResultItemConnection! + # pull requests, and users. first/after page forward; last/before page + # backward. first must not exceed 100. + search(query: String!, type: SearchType!, first: Int, after: String, last: Int, before: String): SearchResultItemConnection! + # license looks up a single open-source license by its SPDX-derived key + # (e.g. "mit"). Returns null for an unknown key. + license(key: String!): License + # licenses lists the open-source licenses Githome can detect and offer. + licenses: [License]! + # codeOfConduct looks up a single code of conduct by its key (e.g. + # "contributor_covenant"). Returns null for an unknown key. + codeOfConduct(key: String!): CodeOfConduct + # codesOfConduct lists the codes of conduct Githome can offer. + codesOfConduct: [CodeOfConduct]! + # meta returns information about the running Githome instance, the analogue of + # GitHub's /meta endpoint. + meta: GitHubMetadata! } # Repository is a git repository. @@ -7277,8 +7472,45 @@ type Language { # License is an open-source license. type License { + # key is the lowercase identifier GitHub keys licenses by, e.g. "mit". + key: String! name: String! + # nickname is a short common name, e.g. "GNU GPLv3", null when there is none. + nickname: String + # spdxId is the SPDX short identifier, e.g. "MIT", null when the license has + # no SPDX id. spdxId: String + # url is the HTML page describing the license, null when none is published. + url: URI + # body is the full license text. It is empty for a license summary that + # carries no stored body. + body: String! +} + +# CodeOfConduct is a code of conduct a repository can adopt. +type CodeOfConduct { + # key is the lowercase identifier, e.g. "contributor_covenant". + key: String! + name: String! + # body is the full text, empty when only the summary is known. + body: String + # url is the HTML page for the code of conduct, null when none is published. + url: URI +} + +# GitHubMetadata describes the running instance, the analogue of /meta. A +# self-hosted Githome does not publish GitHub's hosted-service IP ranges, so the +# address lists come back empty. +type GitHubMetadata { + # gitHubServicesSha is the running build's commit SHA, empty when unknown. + gitHubServicesSha: GitObjectID! + # isPasswordAuthenticationVerifiable mirrors GitHub's flag; Githome accepts + # password auth, so it is true. + isPasswordAuthenticationVerifiable: Boolean! + gitIpAddresses: [String!] + hookIpAddresses: [String!] + importerIpAddresses: [String!] + pagesIpAddresses: [String!] } # User is a GitHub user account. @@ -7410,6 +7642,12 @@ type SearchResultItemConnection { repositoryCount: Int! userCount: Int! wikiCount: Int! + # codeCount is the number of code results; Githome does not index code + # search, so it is always 0. + codeCount: Int! + # discussionCount is the number of discussion results; Githome does not model + # discussions, so it is always 0. + discussionCount: Int! } # SearchResultItemEdge is one search result with its cursor. @@ -7683,6 +7921,20 @@ func (ec *executionContext) childFields_ClosePullRequestPayload(ctx context.Cont return nil, fmt.Errorf("no field named %q was found under type ClosePullRequestPayload", field.Name) } +func (ec *executionContext) childFields_CodeOfConduct(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "key": + return ec.fieldContext_CodeOfConduct_key(ctx, field) + case "name": + return ec.fieldContext_CodeOfConduct_name(ctx, field) + case "body": + return ec.fieldContext_CodeOfConduct_body(ctx, field) + case "url": + return ec.fieldContext_CodeOfConduct_url(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type CodeOfConduct", field.Name) +} + func (ec *executionContext) childFields_Commit(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": @@ -7885,6 +8137,24 @@ func (ec *executionContext) childFields_GitActorConnection(ctx context.Context, return nil, fmt.Errorf("no field named %q was found under type GitActorConnection", field.Name) } +func (ec *executionContext) childFields_GitHubMetadata(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "gitHubServicesSha": + return ec.fieldContext_GitHubMetadata_gitHubServicesSha(ctx, field) + case "isPasswordAuthenticationVerifiable": + return ec.fieldContext_GitHubMetadata_isPasswordAuthenticationVerifiable(ctx, field) + case "gitIpAddresses": + return ec.fieldContext_GitHubMetadata_gitIpAddresses(ctx, field) + case "hookIpAddresses": + return ec.fieldContext_GitHubMetadata_hookIpAddresses(ctx, field) + case "importerIpAddresses": + return ec.fieldContext_GitHubMetadata_importerIpAddresses(ctx, field) + case "pagesIpAddresses": + return ec.fieldContext_GitHubMetadata_pagesIpAddresses(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type GitHubMetadata", field.Name) +} + func (ec *executionContext) childFields_Issue(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": @@ -8121,10 +8391,18 @@ func (ec *executionContext) childFields_LanguageEdge(ctx context.Context, field func (ec *executionContext) childFields_License(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { + case "key": + return ec.fieldContext_License_key(ctx, field) case "name": return ec.fieldContext_License_name(ctx, field) + case "nickname": + return ec.fieldContext_License_nickname(ctx, field) case "spdxId": return ec.fieldContext_License_spdxId(ctx, field) + case "url": + return ec.fieldContext_License_url(ctx, field) + case "body": + return ec.fieldContext_License_body(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type License", field.Name) } @@ -8945,6 +9223,10 @@ func (ec *executionContext) childFields_SearchResultItemConnection(ctx context.C return ec.fieldContext_SearchResultItemConnection_userCount(ctx, field) case "wikiCount": return ec.fieldContext_SearchResultItemConnection_wikiCount(ctx, field) + case "codeCount": + return ec.fieldContext_SearchResultItemConnection_codeCount(ctx, field) + case "discussionCount": + return ec.fieldContext_SearchResultItemConnection_discussionCount(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type SearchResultItemConnection", field.Name) } @@ -10569,6 +10851,34 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs return args, nil } +func (ec *executionContext) field_Query_codeOfConduct_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "key", + func(ctx context.Context, v any) (string, error) { + return ec.unmarshalNString2string(ctx, v) + }) + if err != nil { + return nil, err + } + args["key"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_license_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "key", + func(ctx context.Context, v any) (string, error) { + return ec.unmarshalNString2string(ctx, v) + }) + if err != nil { + return nil, err + } + args["key"] = arg0 + return args, nil +} + func (ec *executionContext) field_Query_node_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -10597,6 +10907,20 @@ func (ec *executionContext) field_Query_nodes_args(ctx context.Context, rawArgs return args, nil } +func (ec *executionContext) field_Query_rateLimit_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "dryRun", + func(ctx context.Context, v any) (*bool, error) { + return ec.unmarshalOBoolean2ᚖbool(ctx, v) + }) + if err != nil { + return nil, err + } + args["dryRun"] = arg0 + return args, nil +} + func (ec *executionContext) field_Query_repositoryOwner_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -10630,6 +10954,14 @@ func (ec *executionContext) field_Query_repository_args(ctx context.Context, raw return nil, err } args["name"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "followRenames", + func(ctx context.Context, v any) (*bool, error) { + return ec.unmarshalOBoolean2ᚖbool(ctx, v) + }) + if err != nil { + return nil, err + } + args["followRenames"] = arg2 return args, nil } @@ -10668,6 +11000,22 @@ func (ec *executionContext) field_Query_search_args(ctx context.Context, rawArgs return nil, err } args["after"] = arg3 + arg4, err := graphql.ProcessArgField(ctx, rawArgs, "last", + func(ctx context.Context, v any) (*int32, error) { + return ec.unmarshalOInt2ᚖint32(ctx, v) + }) + if err != nil { + return nil, err + } + args["last"] = arg4 + arg5, err := graphql.ProcessArgField(ctx, rawArgs, "before", + func(ctx context.Context, v any) (*string, error) { + return ec.unmarshalOString2ᚖstring(ctx, v) + }) + if err != nil { + return nil, err + } + args["before"] = arg5 return args, nil } @@ -12660,6 +13008,98 @@ func (ec *executionContext) fieldContext_ClosePullRequestPayload_clientMutationI return graphql.NewScalarFieldContext("ClosePullRequestPayload", field, false, false, errors.New("field of type String does not have child fields")) } +func (ec *executionContext) _CodeOfConduct_key(ctx context.Context, field graphql.CollectedField, obj *CodeOfConduct) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CodeOfConduct_key(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Key, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_CodeOfConduct_key(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("CodeOfConduct", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _CodeOfConduct_name(ctx context.Context, field graphql.CollectedField, obj *CodeOfConduct) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CodeOfConduct_name(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Name, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_CodeOfConduct_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("CodeOfConduct", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _CodeOfConduct_body(ctx context.Context, field graphql.CollectedField, obj *CodeOfConduct) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CodeOfConduct_body(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Body, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_CodeOfConduct_body(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("CodeOfConduct", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _CodeOfConduct_url(ctx context.Context, field graphql.CollectedField, obj *CodeOfConduct) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_CodeOfConduct_url(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.URL, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *gqlmodel.URI) graphql.Marshaler { + return ec.marshalOURI2ᚖgithubᚗcomᚋtamndᚋgithomeᚋpresenterᚋgqlmodelᚐURI(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_CodeOfConduct_url(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("CodeOfConduct", field, false, false, errors.New("field of type URI does not have child fields")) +} + func (ec *executionContext) _Commit_id(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.Commit) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -13954,6 +14394,144 @@ func (ec *executionContext) fieldContext_GitActorConnection_totalCount(_ context return graphql.NewScalarFieldContext("GitActorConnection", field, false, false, errors.New("field of type Int does not have child fields")) } +func (ec *executionContext) _GitHubMetadata_gitHubServicesSha(ctx context.Context, field graphql.CollectedField, obj *GitHubMetadata) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_GitHubMetadata_gitHubServicesSha(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.GitHubServicesSha, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v gqlmodel.GitObjectID) graphql.Marshaler { + return ec.marshalNGitObjectID2githubᚗcomᚋtamndᚋgithomeᚋpresenterᚋgqlmodelᚐGitObjectID(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_GitHubMetadata_gitHubServicesSha(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("GitHubMetadata", field, false, false, errors.New("field of type GitObjectID does not have child fields")) +} + +func (ec *executionContext) _GitHubMetadata_isPasswordAuthenticationVerifiable(ctx context.Context, field graphql.CollectedField, obj *GitHubMetadata) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_GitHubMetadata_isPasswordAuthenticationVerifiable(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.IsPasswordAuthenticationVerifiable, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler { + return ec.marshalNBoolean2bool(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_GitHubMetadata_isPasswordAuthenticationVerifiable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("GitHubMetadata", field, false, false, errors.New("field of type Boolean does not have child fields")) +} + +func (ec *executionContext) _GitHubMetadata_gitIpAddresses(ctx context.Context, field graphql.CollectedField, obj *GitHubMetadata) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_GitHubMetadata_gitIpAddresses(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.GitIPAddresses, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []string) graphql.Marshaler { + return ec.marshalOString2ᚕstringᚄ(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_GitHubMetadata_gitIpAddresses(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("GitHubMetadata", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _GitHubMetadata_hookIpAddresses(ctx context.Context, field graphql.CollectedField, obj *GitHubMetadata) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_GitHubMetadata_hookIpAddresses(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.HookIPAddresses, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []string) graphql.Marshaler { + return ec.marshalOString2ᚕstringᚄ(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_GitHubMetadata_hookIpAddresses(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("GitHubMetadata", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _GitHubMetadata_importerIpAddresses(ctx context.Context, field graphql.CollectedField, obj *GitHubMetadata) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_GitHubMetadata_importerIpAddresses(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ImporterIPAddresses, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []string) graphql.Marshaler { + return ec.marshalOString2ᚕstringᚄ(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_GitHubMetadata_importerIpAddresses(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("GitHubMetadata", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _GitHubMetadata_pagesIpAddresses(ctx context.Context, field graphql.CollectedField, obj *GitHubMetadata) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_GitHubMetadata_pagesIpAddresses(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.PagesIPAddresses, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []string) graphql.Marshaler { + return ec.marshalOString2ᚕstringᚄ(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_GitHubMetadata_pagesIpAddresses(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("GitHubMetadata", field, false, false, errors.New("field of type String does not have child fields")) +} + func (ec *executionContext) _Issue_id(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.Issue) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -15952,6 +16530,29 @@ func (ec *executionContext) fieldContext_LanguageEdge_size(_ context.Context, fi return graphql.NewScalarFieldContext("LanguageEdge", field, false, false, errors.New("field of type Int does not have child fields")) } +func (ec *executionContext) _License_key(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.License) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_License_key(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Key, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_License_key(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("License", field, false, false, errors.New("field of type String does not have child fields")) +} + func (ec *executionContext) _License_name(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.License) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -15975,6 +16576,29 @@ func (ec *executionContext) fieldContext_License_name(_ context.Context, field g return graphql.NewScalarFieldContext("License", field, false, false, errors.New("field of type String does not have child fields")) } +func (ec *executionContext) _License_nickname(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.License) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_License_nickname(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Nickname, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_License_nickname(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("License", field, false, false, errors.New("field of type String does not have child fields")) +} + func (ec *executionContext) _License_spdxId(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.License) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -15998,6 +16622,52 @@ func (ec *executionContext) fieldContext_License_spdxId(_ context.Context, field return graphql.NewScalarFieldContext("License", field, false, false, errors.New("field of type String does not have child fields")) } +func (ec *executionContext) _License_url(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.License) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_License_url(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.URL, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *gqlmodel.URI) graphql.Marshaler { + return ec.marshalOURI2ᚖgithubᚗcomᚋtamndᚋgithomeᚋpresenterᚋgqlmodelᚐURI(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_License_url(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("License", field, false, false, errors.New("field of type URI does not have child fields")) +} + +func (ec *executionContext) _License_body(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.License) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_License_body(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Body, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_License_body(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("License", field, false, false, errors.New("field of type String does not have child fields")) +} + func (ec *executionContext) _LockLockablePayload_lockedRecord(ctx context.Context, field graphql.CollectedField, obj *LockLockablePayload) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -22154,7 +22824,7 @@ func (ec *executionContext) _Query_repository(ctx context.Context, field graphql }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) - return ec.Resolvers.Query().Repository(ctx, fc.Args["owner"].(string), fc.Args["name"].(string)) + return ec.Resolvers.Query().Repository(ctx, fc.Args["owner"].(string), fc.Args["name"].(string), fc.Args["followRenames"].(*bool)) }, nil, func(ctx context.Context, selections ast.SelectionSet, v *gqlmodel.Repository) graphql.Marshaler { @@ -22405,7 +23075,8 @@ func (ec *executionContext) _Query_rateLimit(ctx context.Context, field graphql. return ec.fieldContext_Query_rateLimit(ctx, field) }, func(ctx context.Context) (any, error) { - return ec.Resolvers.Query().RateLimit(ctx) + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().RateLimit(ctx, fc.Args["dryRun"].(*bool)) }, nil, func(ctx context.Context, selections ast.SelectionSet, v *gqlmodel.RateLimit) graphql.Marshaler { @@ -22415,7 +23086,7 @@ func (ec *executionContext) _Query_rateLimit(ctx context.Context, field graphql. false, ) } -func (ec *executionContext) fieldContext_Query_rateLimit(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_rateLimit(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, @@ -22425,6 +23096,17 @@ func (ec *executionContext) fieldContext_Query_rateLimit(_ context.Context, fiel return ec.childFields_RateLimit(ctx, field) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_rateLimit_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } @@ -22438,7 +23120,7 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) - return ec.Resolvers.Query().Search(ctx, fc.Args["query"].(string), fc.Args["type"].(SearchType), fc.Args["first"].(*int32), fc.Args["after"].(*string)) + return ec.Resolvers.Query().Search(ctx, fc.Args["query"].(string), fc.Args["type"].(SearchType), fc.Args["first"].(*int32), fc.Args["after"].(*string), fc.Args["last"].(*int32), fc.Args["before"].(*string)) }, nil, func(ctx context.Context, selections ast.SelectionSet, v *SearchResultItemConnection) graphql.Marshaler { @@ -22472,6 +23154,190 @@ func (ec *executionContext) fieldContext_Query_search(ctx context.Context, field return fc, nil } +func (ec *executionContext) _Query_license(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_license(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().License(ctx, fc.Args["key"].(string)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *gqlmodel.License) graphql.Marshaler { + return ec.marshalOLicense2ᚖgithubᚗcomᚋtamndᚋgithomeᚋpresenterᚋgqlmodelᚐLicense(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_Query_license(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_License(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_license_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_licenses(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_licenses(ctx, field) + }, + func(ctx context.Context) (any, error) { + return ec.Resolvers.Query().Licenses(ctx) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []*gqlmodel.License) graphql.Marshaler { + return ec.marshalNLicense2ᚕᚖgithubᚗcomᚋtamndᚋgithomeᚋpresenterᚋgqlmodelᚐLicense(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Query_licenses(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_License(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_codeOfConduct(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_codeOfConduct(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().CodeOfConduct(ctx, fc.Args["key"].(string)) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *CodeOfConduct) graphql.Marshaler { + return ec.marshalOCodeOfConduct2ᚖgithubᚗcomᚋtamndᚋgithomeᚋapiᚋgraphqlᚋgeneratedᚐCodeOfConduct(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_Query_codeOfConduct(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_CodeOfConduct(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_codeOfConduct_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_codesOfConduct(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_codesOfConduct(ctx, field) + }, + func(ctx context.Context) (any, error) { + return ec.Resolvers.Query().CodesOfConduct(ctx) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []*CodeOfConduct) graphql.Marshaler { + return ec.marshalNCodeOfConduct2ᚕᚖgithubᚗcomᚋtamndᚋgithomeᚋapiᚋgraphqlᚋgeneratedᚐCodeOfConduct(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Query_codesOfConduct(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_CodeOfConduct(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_meta(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_meta(ctx, field) + }, + func(ctx context.Context) (any, error) { + return ec.Resolvers.Query().Meta(ctx) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *GitHubMetadata) graphql.Marshaler { + return ec.marshalNGitHubMetadata2ᚖgithubᚗcomᚋtamndᚋgithomeᚋapiᚋgraphqlᚋgeneratedᚐGitHubMetadata(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Query_meta(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_GitHubMetadata(ctx, field) + }, + } + return fc, nil +} + func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -25675,6 +26541,52 @@ func (ec *executionContext) fieldContext_SearchResultItemConnection_wikiCount(_ return graphql.NewScalarFieldContext("SearchResultItemConnection", field, false, false, errors.New("field of type Int does not have child fields")) } +func (ec *executionContext) _SearchResultItemConnection_codeCount(ctx context.Context, field graphql.CollectedField, obj *SearchResultItemConnection) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_SearchResultItemConnection_codeCount(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.CodeCount, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int32) graphql.Marshaler { + return ec.marshalNInt2int32(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_SearchResultItemConnection_codeCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("SearchResultItemConnection", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _SearchResultItemConnection_discussionCount(ctx context.Context, field graphql.CollectedField, obj *SearchResultItemConnection) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_SearchResultItemConnection_discussionCount(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.DiscussionCount, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int32) graphql.Marshaler { + return ec.marshalNInt2int32(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_SearchResultItemConnection_discussionCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("SearchResultItemConnection", field, false, false, errors.New("field of type Int does not have child fields")) +} + func (ec *executionContext) _SearchResultItemEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *SearchResultItemEdge) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -32856,114 +33768,150 @@ func (ec *executionContext) _BranchProtectionRule(ctx context.Context, sel ast.S return out } -var checkRunImplementors = []string{"CheckRun", "StatusCheckRollupContext", "Node"} +var checkRunImplementors = []string{"CheckRun", "StatusCheckRollupContext", "Node"} + +func (ec *executionContext) _CheckRun(ctx context.Context, sel ast.SelectionSet, obj *gqlmodel.CheckRun) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, checkRunImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("CheckRun") + case "id": + out.Values[i] = ec._CheckRun_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "name": + out.Values[i] = ec._CheckRun_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "status": + out.Values[i] = ec._CheckRun_status(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "conclusion": + out.Values[i] = ec._CheckRun_conclusion(ctx, field, obj) + case "startedAt": + out.Values[i] = ec._CheckRun_startedAt(ctx, field, obj) + case "completedAt": + out.Values[i] = ec._CheckRun_completedAt(ctx, field, obj) + case "url": + out.Values[i] = ec._CheckRun_url(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "detailsUrl": + out.Values[i] = ec._CheckRun_detailsUrl(ctx, field, obj) + case "checkSuite": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._CheckRun_checkSuite(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "isRequired": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._CheckRun_isRequired(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var checkSuiteImplementors = []string{"CheckSuite"} -func (ec *executionContext) _CheckRun(ctx context.Context, sel ast.SelectionSet, obj *gqlmodel.CheckRun) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, checkRunImplementors) +func (ec *executionContext) _CheckSuite(ctx context.Context, sel ast.SelectionSet, obj *CheckSuite) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, checkSuiteImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("CheckRun") - case "id": - out.Values[i] = ec._CheckRun_id(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "name": - out.Values[i] = ec._CheckRun_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "status": - out.Values[i] = ec._CheckRun_status(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "conclusion": - out.Values[i] = ec._CheckRun_conclusion(ctx, field, obj) - case "startedAt": - out.Values[i] = ec._CheckRun_startedAt(ctx, field, obj) - case "completedAt": - out.Values[i] = ec._CheckRun_completedAt(ctx, field, obj) - case "url": - out.Values[i] = ec._CheckRun_url(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } - case "detailsUrl": - out.Values[i] = ec._CheckRun_detailsUrl(ctx, field, obj) - case "checkSuite": - field := field - - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._CheckRun_checkSuite(ctx, field, obj) - return res - } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue - } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "isRequired": - field := field - - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._CheckRun_isRequired(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } - return res - } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue - } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + out.Values[i] = graphql.MarshalString("CheckSuite") + case "workflowRun": + out.Values[i] = ec._CheckSuite_workflowRun(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -32987,19 +33935,21 @@ func (ec *executionContext) _CheckRun(ctx context.Context, sel ast.SelectionSet, return out } -var checkSuiteImplementors = []string{"CheckSuite"} +var closeIssuePayloadImplementors = []string{"CloseIssuePayload"} -func (ec *executionContext) _CheckSuite(ctx context.Context, sel ast.SelectionSet, obj *CheckSuite) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, checkSuiteImplementors) +func (ec *executionContext) _CloseIssuePayload(ctx context.Context, sel ast.SelectionSet, obj *CloseIssuePayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, closeIssuePayloadImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("CheckSuite") - case "workflowRun": - out.Values[i] = ec._CheckSuite_workflowRun(ctx, field, obj) + out.Values[i] = graphql.MarshalString("CloseIssuePayload") + case "issue": + out.Values[i] = ec._CloseIssuePayload_issue(ctx, field, obj) + case "clientMutationId": + out.Values[i] = ec._CloseIssuePayload_clientMutationId(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -33023,21 +33973,21 @@ func (ec *executionContext) _CheckSuite(ctx context.Context, sel ast.SelectionSe return out } -var closeIssuePayloadImplementors = []string{"CloseIssuePayload"} +var closePullRequestPayloadImplementors = []string{"ClosePullRequestPayload"} -func (ec *executionContext) _CloseIssuePayload(ctx context.Context, sel ast.SelectionSet, obj *CloseIssuePayload) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, closeIssuePayloadImplementors) +func (ec *executionContext) _ClosePullRequestPayload(ctx context.Context, sel ast.SelectionSet, obj *ClosePullRequestPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, closePullRequestPayloadImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("CloseIssuePayload") - case "issue": - out.Values[i] = ec._CloseIssuePayload_issue(ctx, field, obj) + out.Values[i] = graphql.MarshalString("ClosePullRequestPayload") + case "pullRequest": + out.Values[i] = ec._ClosePullRequestPayload_pullRequest(ctx, field, obj) case "clientMutationId": - out.Values[i] = ec._CloseIssuePayload_clientMutationId(ctx, field, obj) + out.Values[i] = ec._ClosePullRequestPayload_clientMutationId(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -33061,21 +34011,31 @@ func (ec *executionContext) _CloseIssuePayload(ctx context.Context, sel ast.Sele return out } -var closePullRequestPayloadImplementors = []string{"ClosePullRequestPayload"} +var codeOfConductImplementors = []string{"CodeOfConduct"} -func (ec *executionContext) _ClosePullRequestPayload(ctx context.Context, sel ast.SelectionSet, obj *ClosePullRequestPayload) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, closePullRequestPayloadImplementors) +func (ec *executionContext) _CodeOfConduct(ctx context.Context, sel ast.SelectionSet, obj *CodeOfConduct) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, codeOfConductImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("ClosePullRequestPayload") - case "pullRequest": - out.Values[i] = ec._ClosePullRequestPayload_pullRequest(ctx, field, obj) - case "clientMutationId": - out.Values[i] = ec._ClosePullRequestPayload_clientMutationId(ctx, field, obj) + out.Values[i] = graphql.MarshalString("CodeOfConduct") + case "key": + out.Values[i] = ec._CodeOfConduct_key(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec._CodeOfConduct_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "body": + out.Values[i] = ec._CodeOfConduct_body(ctx, field, obj) + case "url": + out.Values[i] = ec._CodeOfConduct_url(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -34126,6 +35086,58 @@ func (ec *executionContext) _GitActorConnection(ctx context.Context, sel ast.Sel return out } +var gitHubMetadataImplementors = []string{"GitHubMetadata"} + +func (ec *executionContext) _GitHubMetadata(ctx context.Context, sel ast.SelectionSet, obj *GitHubMetadata) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, gitHubMetadataImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("GitHubMetadata") + case "gitHubServicesSha": + out.Values[i] = ec._GitHubMetadata_gitHubServicesSha(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "isPasswordAuthenticationVerifiable": + out.Values[i] = ec._GitHubMetadata_isPasswordAuthenticationVerifiable(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "gitIpAddresses": + out.Values[i] = ec._GitHubMetadata_gitIpAddresses(ctx, field, obj) + case "hookIpAddresses": + out.Values[i] = ec._GitHubMetadata_hookIpAddresses(ctx, field, obj) + case "importerIpAddresses": + out.Values[i] = ec._GitHubMetadata_importerIpAddresses(ctx, field, obj) + case "pagesIpAddresses": + out.Values[i] = ec._GitHubMetadata_pagesIpAddresses(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferred), math.MaxInt32))) + + for label, dfs := range deferred { + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + var issueImplementors = []string{"Issue", "Node", "LabelableNode", "AssignableNode", "SearchResultItem"} func (ec *executionContext) _Issue(ctx context.Context, sel ast.SelectionSet, obj *gqlmodel.Issue) graphql.Marshaler { @@ -35257,13 +36269,27 @@ func (ec *executionContext) _License(ctx context.Context, sel ast.SelectionSet, switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("License") + case "key": + out.Values[i] = ec._License_key(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } case "name": out.Values[i] = ec._License_name(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } + case "nickname": + out.Values[i] = ec._License_nickname(ctx, field, obj) case "spdxId": out.Values[i] = ec._License_spdxId(ctx, field, obj) + case "url": + out.Values[i] = ec._License_url(ctx, field, obj) + case "body": + out.Values[i] = ec._License_body(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -37871,6 +38897,110 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "license": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_license(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "licenses": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_licenses(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "codeOfConduct": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_codeOfConduct(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "codesOfConduct": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_codesOfConduct(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "meta": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_meta(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "__type": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { @@ -39402,6 +40532,16 @@ func (ec *executionContext) _SearchResultItemConnection(ctx context.Context, sel if out.Values[i] == graphql.Null { out.Invalids++ } + case "codeCount": + out.Values[i] = ec._SearchResultItemConnection_codeCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "discussionCount": + out.Values[i] = ec._SearchResultItemConnection_discussionCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -41236,6 +42376,16 @@ func (ec *executionContext) unmarshalNClosePullRequestInput2githubᚗcomᚋtamnd return res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) marshalNCodeOfConduct2ᚕᚖgithubᚗcomᚋtamndᚋgithomeᚋapiᚋgraphqlᚋgeneratedᚐCodeOfConduct(ctx context.Context, sel ast.SelectionSet, v []*CodeOfConduct) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalOCodeOfConduct2ᚖgithubᚗcomᚋtamndᚋgithomeᚋapiᚋgraphqlᚋgeneratedᚐCodeOfConduct(ctx, sel, v[i]) + }) + + return ret +} + func (ec *executionContext) unmarshalNCommentAuthorAssociation2githubᚗcomᚋtamndᚋgithomeᚋpresenterᚋgqlmodelᚐCommentAuthorAssociation(ctx context.Context, v any) (gqlmodel.CommentAuthorAssociation, error) { tmp, err := graphql.UnmarshalString(v) res := gqlmodel.CommentAuthorAssociation(tmp) @@ -41371,6 +42521,20 @@ func (ec *executionContext) marshalNGitActorConnection2ᚖgithubᚗcomᚋtamnd return ec._GitActorConnection(ctx, sel, v) } +func (ec *executionContext) marshalNGitHubMetadata2githubᚗcomᚋtamndᚋgithomeᚋapiᚋgraphqlᚋgeneratedᚐGitHubMetadata(ctx context.Context, sel ast.SelectionSet, v GitHubMetadata) graphql.Marshaler { + return ec._GitHubMetadata(ctx, sel, &v) +} + +func (ec *executionContext) marshalNGitHubMetadata2ᚖgithubᚗcomᚋtamndᚋgithomeᚋapiᚋgraphqlᚋgeneratedᚐGitHubMetadata(ctx context.Context, sel ast.SelectionSet, v *GitHubMetadata) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._GitHubMetadata(ctx, sel, v) +} + func (ec *executionContext) unmarshalNGitObjectID2githubᚗcomᚋtamndᚋgithomeᚋpresenterᚋgqlmodelᚐGitObjectID(ctx context.Context, v any) (gqlmodel.GitObjectID, error) { var res gqlmodel.GitObjectID err := res.UnmarshalGQL(v) @@ -41574,6 +42738,16 @@ func (ec *executionContext) marshalNLanguageOrderField2githubᚗcomᚋtamndᚋgi return v } +func (ec *executionContext) marshalNLicense2ᚕᚖgithubᚗcomᚋtamndᚋgithomeᚋpresenterᚋgqlmodelᚐLicense(ctx context.Context, sel ast.SelectionSet, v []*gqlmodel.License) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalOLicense2ᚖgithubᚗcomᚋtamndᚋgithomeᚋpresenterᚋgqlmodelᚐLicense(ctx, sel, v[i]) + }) + + return ret +} + func (ec *executionContext) unmarshalNLockLockableInput2githubᚗcomᚋtamndᚋgithomeᚋapiᚋgraphqlᚋgeneratedᚐLockLockableInput(ctx context.Context, v any) (LockLockableInput, error) { res, err := ec.unmarshalInputLockLockableInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -42576,6 +43750,13 @@ func (ec *executionContext) marshalOClosePullRequestPayload2ᚖgithubᚗcomᚋta return ec._ClosePullRequestPayload(ctx, sel, v) } +func (ec *executionContext) marshalOCodeOfConduct2ᚖgithubᚗcomᚋtamndᚋgithomeᚋapiᚋgraphqlᚋgeneratedᚐCodeOfConduct(ctx context.Context, sel ast.SelectionSet, v *CodeOfConduct) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._CodeOfConduct(ctx, sel, v) +} + func (ec *executionContext) marshalOCommit2ᚕᚖgithubᚗcomᚋtamndᚋgithomeᚋpresenterᚋgqlmodelᚐCommit(ctx context.Context, sel ast.SelectionSet, v []*gqlmodel.Commit) graphql.Marshaler { if v == nil { return graphql.Null diff --git a/api/graphql/generated/models_gen.go b/api/graphql/generated/models_gen.go index 6a1ff01..134d450 100644 --- a/api/graphql/generated/models_gen.go +++ b/api/graphql/generated/models_gen.go @@ -177,6 +177,13 @@ type ClosePullRequestPayload struct { ClientMutationID *string `json:"clientMutationId,omitempty"` } +type CodeOfConduct struct { + Key string `json:"key"` + Name string `json:"name"` + Body *string `json:"body,omitempty"` + URL *gqlmodel.URI `json:"url,omitempty"` +} + type CommitConnection struct { Nodes []*gqlmodel.Commit `json:"nodes,omitempty"` PageInfo *gqlmodel.PageInfo `json:"pageInfo"` @@ -388,6 +395,15 @@ type GitActorConnection struct { TotalCount int32 `json:"totalCount"` } +type GitHubMetadata struct { + GitHubServicesSha gqlmodel.GitObjectID `json:"gitHubServicesSha"` + IsPasswordAuthenticationVerifiable bool `json:"isPasswordAuthenticationVerifiable"` + GitIPAddresses []string `json:"gitIpAddresses,omitempty"` + HookIPAddresses []string `json:"hookIpAddresses,omitempty"` + ImporterIPAddresses []string `json:"importerIpAddresses,omitempty"` + PagesIPAddresses []string `json:"pagesIpAddresses,omitempty"` +} + type IssueCommentEdge struct { Cursor string `json:"cursor"` Node *gqlmodel.IssueComment `json:"node,omitempty"` @@ -631,6 +647,8 @@ type SearchResultItemConnection struct { RepositoryCount int32 `json:"repositoryCount"` UserCount int32 `json:"userCount"` WikiCount int32 `json:"wikiCount"` + CodeCount int32 `json:"codeCount"` + DiscussionCount int32 `json:"discussionCount"` } type SearchResultItemEdge struct { diff --git a/api/graphql/repository_contract_test.go b/api/graphql/repository_contract_test.go index 958b193..89d2f5c 100644 --- a/api/graphql/repository_contract_test.go +++ b/api/graphql/repository_contract_test.go @@ -94,10 +94,12 @@ func graphqlServer(t *testing.T) (*httptest.Server, string) { t.Cleanup(authSvc.Close) repoSvc := domain.NewRepoService(st, gitStore) + issueSvc := domain.NewIssueService(st, repoSvc) h := graphqlapi.NewHandler(graphqlapi.Deps{ Auth: authSvc, Repos: repoSvc, - Issues: domain.NewIssueService(st, repoSvc), + Issues: issueSvc, + Search: domain.NewSearchService(st, repoSvc, issueSvc, gitStore), URLs: presenter.NewURLBuilder(graphqlURLs(t)), NodeFormat: nodeid.FormatNew, }) diff --git a/api/graphql/root_gaps_contract_test.go b/api/graphql/root_gaps_contract_test.go new file mode 100644 index 0000000..b39f595 --- /dev/null +++ b/api/graphql/root_gaps_contract_test.go @@ -0,0 +1,167 @@ +package graphql_test + +import ( + "encoding/json" + "testing" +) + +// TestRootStaticQueries covers R02-11: the root query serves license/licenses, +// codeOfConduct/codesOfConduct, and meta. Static-registry lookups return data +// for a known key and null for an unknown one. +func TestRootStaticQueries(t *testing.T) { + srv, token := graphqlServer(t) + + q := `query{ + mit: license(key: "mit"){ key name spdxId url body } + missing: license(key: "no-such-license"){ key } + licenses { key spdxId } + cc: codeOfConduct(key: "contributor_covenant"){ key name url } + ccMissing: codeOfConduct(key: "no-such-coc"){ key } + codesOfConduct { key name } + meta { gitHubServicesSha isPasswordAuthenticationVerifiable gitIpAddresses } + }` + got := post(t, srv, token, q, nil) + var env struct { + Data struct { + Mit *struct { + Key string `json:"key"` + Name string `json:"name"` + SpdxID *string `json:"spdxId"` + URL *string `json:"url"` + Body string `json:"body"` + } `json:"mit"` + Missing *struct{} `json:"missing"` + Licenses []struct { + Key string `json:"key"` + SpdxID *string `json:"spdxId"` + } `json:"licenses"` + Cc *struct { + Key string `json:"key"` + Name string `json:"name"` + } `json:"cc"` + CcMissing *struct{} `json:"ccMissing"` + CodesOfConduct []struct { + Key string `json:"key"` + } `json:"codesOfConduct"` + Meta struct { + GitHubServicesSha string `json:"gitHubServicesSha"` + IsPasswordAuthenticationVerifiable bool `json:"isPasswordAuthenticationVerifiable"` + GitIPAddresses []string `json:"gitIpAddresses"` + } `json:"meta"` + } `json:"data"` + Errors []struct { + Message string `json:"message"` + } `json:"errors"` + } + if err := json.Unmarshal(got, &env); err != nil { + t.Fatalf("unmarshal: %v, body %s", err, got) + } + if len(env.Errors) != 0 { + t.Fatalf("errors = %v, body %s", env.Errors, got) + } + d := env.Data + + if d.Mit == nil { + t.Fatalf("license(mit) = null, want the MIT license") + } + if d.Mit.Key != "mit" || d.Mit.SpdxID == nil || *d.Mit.SpdxID != "MIT" { + t.Errorf("license(mit) = %+v, want key mit / spdxId MIT", d.Mit) + } + if d.Missing != nil { + t.Errorf("license(unknown) = %+v, want null", d.Missing) + } + if len(d.Licenses) == 0 { + t.Errorf("licenses is empty, want the static registry") + } + if d.Cc == nil || d.Cc.Key != "contributor_covenant" { + t.Errorf("codeOfConduct(contributor_covenant) = %+v, want the Contributor Covenant", d.Cc) + } + if d.CcMissing != nil { + t.Errorf("codeOfConduct(unknown) = %+v, want null", d.CcMissing) + } + if len(d.CodesOfConduct) == 0 { + t.Errorf("codesOfConduct is empty, want the static registry") + } + if !d.Meta.IsPasswordAuthenticationVerifiable { + t.Errorf("meta.isPasswordAuthenticationVerifiable = false, want true") + } +} + +// TestSearchPageSizeError covers R02-11: search errors when the page size +// exceeds 100 rather than silently clamping, and accepts last/before for +// backward paging. The connection also exposes codeCount and discussionCount. +func TestSearchPageSizeError(t *testing.T) { + srv, token := graphqlServer(t) + + // first > 100 must surface an error, not a clamped result. + over := `query{ search(query: "hello", type: REPOSITORY, first: 200){ repositoryCount } }` + got := post(t, srv, token, over, nil) + var overEnv struct { + Errors []struct { + Message string `json:"message"` + } `json:"errors"` + } + if err := json.Unmarshal(got, &overEnv); err != nil { + t.Fatalf("unmarshal: %v, body %s", err, got) + } + if len(overEnv.Errors) == 0 { + t.Errorf("search(first: 200) returned no error, want a 'less than or equal to 100' error; body %s", got) + } + + // A valid search exposes the full count surface including codeCount and + // discussionCount, and accepts last/before without error. + ok := `query{ search(query: "hello", type: REPOSITORY, last: 10){ + repositoryCount issueCount userCount wikiCount codeCount discussionCount + } }` + got = post(t, srv, token, ok, nil) + var okEnv struct { + Data struct { + Search struct { + CodeCount int `json:"codeCount"` + DiscussionCount int `json:"discussionCount"` + } `json:"search"` + } `json:"data"` + Errors []struct { + Message string `json:"message"` + } `json:"errors"` + } + if err := json.Unmarshal(got, &okEnv); err != nil { + t.Fatalf("unmarshal: %v, body %s", err, got) + } + if len(okEnv.Errors) != 0 { + t.Fatalf("search(last: 10) errors = %v, body %s", okEnv.Errors, got) + } + if okEnv.Data.Search.CodeCount != 0 || okEnv.Data.Search.DiscussionCount != 0 { + t.Errorf("codeCount/discussionCount = %d/%d, want 0/0 (not indexed)", okEnv.Data.Search.CodeCount, okEnv.Data.Search.DiscussionCount) + } +} + +// TestRepositoryFollowRenames covers R02-11: the repository root field accepts +// the followRenames argument and resolves the repository the same way. +func TestRepositoryFollowRenames(t *testing.T) { + srv, token := graphqlServer(t) + + q := `query($owner:String!,$name:String!){ + repository(owner:$owner, name:$name, followRenames: true){ name } + }` + got := post(t, srv, token, q, map[string]any{"owner": "octocat", "name": "hello"}) + var env struct { + Data struct { + Repository *struct { + Name string `json:"name"` + } `json:"repository"` + } `json:"data"` + Errors []struct { + Message string `json:"message"` + } `json:"errors"` + } + if err := json.Unmarshal(got, &env); err != nil { + t.Fatalf("unmarshal: %v, body %s", err, got) + } + if len(env.Errors) != 0 { + t.Fatalf("errors = %v, body %s", env.Errors, got) + } + if env.Data.Repository == nil || env.Data.Repository.Name != "hello" { + t.Errorf("repository(followRenames:true) = %+v, want repo hello", env.Data.Repository) + } +} diff --git a/api/graphql/schema.resolvers.go b/api/graphql/schema.resolvers.go index 910e90c..5b0e837 100644 --- a/api/graphql/schema.resolvers.go +++ b/api/graphql/schema.resolvers.go @@ -24,7 +24,7 @@ import ( // A repository that does not exist or that the actor cannot see resolves to // null plus a NOT_FOUND error, the same answer in both cases so a private // repo's existence does not leak. -func (r *queryResolver) Repository(ctx context.Context, owner string, name string) (*gqlmodel.Repository, error) { +func (r *queryResolver) Repository(ctx context.Context, owner string, name string, followRenames *bool) (*gqlmodel.Repository, error) { actor := auth.ActorFrom(ctx) repo, err := r.Repos.GetRepo(ctx, actor.UserID, owner, name) if errors.Is(err, domain.ErrRepoNotFound) { @@ -127,7 +127,7 @@ func (r *queryResolver) Nodes(ctx context.Context, ids []string) ([]generated.No // node-count walk computes for the in-flight operation, charged against the // fixed hourly budget. Githome does not deduct from the budget across requests, // so used is this call's cost and remaining is the budget less that cost. -func (r *queryResolver) RateLimit(ctx context.Context) (*gqlmodel.RateLimit, error) { +func (r *queryResolver) RateLimit(ctx context.Context, dryRun *bool) (*gqlmodel.RateLimit, error) { nodeCount, cost := queryCost(ctx) return &gqlmodel.RateLimit{ Limit: rateLimitBudget, @@ -141,13 +141,25 @@ func (r *queryResolver) RateLimit(ctx context.Context) (*gqlmodel.RateLimit, err // Search is the resolver for the search field. It fans out to the domain search // service depending on the requested type. Only REPOSITORY and ISSUE are -// implemented today; other types return an empty connection. -func (r *queryResolver) Search(ctx context.Context, query string, typeArg generated.SearchType, first *int32, after *string) (*generated.SearchResultItemConnection, error) { +// implemented today; other types return an empty connection. first/after page +// forward, last/before backward; the page size must not exceed 100, matching +// GitHub, which errors rather than silently clamping. +func (r *queryResolver) Search(ctx context.Context, query string, typeArg generated.SearchType, first *int32, after *string, last *int32, before *string) (*generated.SearchResultItemConnection, error) { limit := int32(30) - if first != nil && *first > 0 { - limit = *first - if limit > 100 { - limit = 100 + if first != nil { + if *first > 100 { + return nil, errors.New("first must be less than or equal to 100") + } + if *first > 0 { + limit = *first + } + } + if last != nil { + if *last > 100 { + return nil, errors.New("last must be less than or equal to 100") + } + if *last > 0 { + limit = *last } } conn := &generated.SearchResultItemConnection{ @@ -201,6 +213,39 @@ func (r *queryResolver) Search(ctx context.Context, query string, typeArg genera return conn, nil } +// License is the resolver for the license field. It looks up a license in the +// static registry by its GitHub key; an unknown key resolves to null. +func (r *queryResolver) License(ctx context.Context, key string) (*gqlmodel.License, error) { + return licenseByKey(key), nil +} + +// Licenses is the resolver for the licenses field. It returns the static +// license registry in GitHub's picker order. +func (r *queryResolver) Licenses(ctx context.Context) ([]*gqlmodel.License, error) { + return staticLicenses, nil +} + +// CodeOfConduct is the resolver for the codeOfConduct field. It looks up a code +// of conduct in the static registry by key; an unknown key resolves to null. +func (r *queryResolver) CodeOfConduct(ctx context.Context, key string) (*generated.CodeOfConduct, error) { + return codeOfConductByKey(key), nil +} + +// CodesOfConduct is the resolver for the codesOfConduct field. +func (r *queryResolver) CodesOfConduct(ctx context.Context) ([]*generated.CodeOfConduct, error) { + return staticCodesOfConduct, nil +} + +// Meta is the resolver for the meta field. It reports the running instance's +// build version and that Githome accepts password auth. A self-hosted instance +// does not publish GitHub's hosted-service IP ranges, so those lists are empty. +func (r *queryResolver) Meta(ctx context.Context) (*generated.GitHubMetadata, error) { + return &generated.GitHubMetadata{ + GitHubServicesSha: gqlmodel.GitObjectID(""), + IsPasswordAuthenticationVerifiable: true, + }, nil +} + // ViewerPermission is the resolver for the viewerPermission field. The presenter // computes the permission when it renders the repository; return it as-is. It is // null for an anonymous viewer. diff --git a/api/graphql/schema/schema.graphql b/api/graphql/schema/schema.graphql index 7612520..94b7380 100644 --- a/api/graphql/schema/schema.graphql +++ b/api/graphql/schema/schema.graphql @@ -29,7 +29,10 @@ interface Node { type Query { # repository looks up a single repository by its owner login and name. It is # null when the repository does not exist or the viewer cannot see it. - repository(owner: String!, name: String!): Repository + # followRenames asks the lookup to follow a repository that was renamed away + # from owner/name to its new path; Githome resolves the current name directly, + # so the argument is accepted for wire compatibility and has no effect. + repository(owner: String!, name: String!, followRenames: Boolean = true): Repository # viewer is the currently authenticated user. viewer: User! # user looks up a user by login. @@ -44,10 +47,26 @@ type Query { # null when the ID cannot be resolved or the viewer cannot see the object. nodes(ids: [ID!]!): [Node]! # rateLimit returns the current rate-limit state for the authenticated user. - rateLimit: RateLimit + # dryRun asks GitHub to compute the cost of the rest of the query without + # charging it; Githome reports the same live state either way. + rateLimit(dryRun: Boolean = false): RateLimit # search returns results matching a query string across repositories, issues, - # pull requests, and users. - search(query: String!, type: SearchType!, first: Int, after: String): SearchResultItemConnection! + # pull requests, and users. first/after page forward; last/before page + # backward. first must not exceed 100. + search(query: String!, type: SearchType!, first: Int, after: String, last: Int, before: String): SearchResultItemConnection! + # license looks up a single open-source license by its SPDX-derived key + # (e.g. "mit"). Returns null for an unknown key. + license(key: String!): License + # licenses lists the open-source licenses Githome can detect and offer. + licenses: [License]! + # codeOfConduct looks up a single code of conduct by its key (e.g. + # "contributor_covenant"). Returns null for an unknown key. + codeOfConduct(key: String!): CodeOfConduct + # codesOfConduct lists the codes of conduct Githome can offer. + codesOfConduct: [CodeOfConduct]! + # meta returns information about the running Githome instance, the analogue of + # GitHub's /meta endpoint. + meta: GitHubMetadata! } # Repository is a git repository. @@ -224,8 +243,45 @@ type Language { # License is an open-source license. type License { + # key is the lowercase identifier GitHub keys licenses by, e.g. "mit". + key: String! name: String! + # nickname is a short common name, e.g. "GNU GPLv3", null when there is none. + nickname: String + # spdxId is the SPDX short identifier, e.g. "MIT", null when the license has + # no SPDX id. spdxId: String + # url is the HTML page describing the license, null when none is published. + url: URI + # body is the full license text. It is empty for a license summary that + # carries no stored body. + body: String! +} + +# CodeOfConduct is a code of conduct a repository can adopt. +type CodeOfConduct { + # key is the lowercase identifier, e.g. "contributor_covenant". + key: String! + name: String! + # body is the full text, empty when only the summary is known. + body: String + # url is the HTML page for the code of conduct, null when none is published. + url: URI +} + +# GitHubMetadata describes the running instance, the analogue of /meta. A +# self-hosted Githome does not publish GitHub's hosted-service IP ranges, so the +# address lists come back empty. +type GitHubMetadata { + # gitHubServicesSha is the running build's commit SHA, empty when unknown. + gitHubServicesSha: GitObjectID! + # isPasswordAuthenticationVerifiable mirrors GitHub's flag; Githome accepts + # password auth, so it is true. + isPasswordAuthenticationVerifiable: Boolean! + gitIpAddresses: [String!] + hookIpAddresses: [String!] + importerIpAddresses: [String!] + pagesIpAddresses: [String!] } # User is a GitHub user account. @@ -357,6 +413,12 @@ type SearchResultItemConnection { repositoryCount: Int! userCount: Int! wikiCount: Int! + # codeCount is the number of code results; Githome does not index code + # search, so it is always 0. + codeCount: Int! + # discussionCount is the number of discussion results; Githome does not model + # discussions, so it is always 0. + discussionCount: Int! } # SearchResultItemEdge is one search result with its cursor. diff --git a/api/graphql/static.go b/api/graphql/static.go new file mode 100644 index 0000000..c5a2018 --- /dev/null +++ b/api/graphql/static.go @@ -0,0 +1,64 @@ +package graphql + +import ( + "github.com/tamnd/githome/api/graphql/generated" + "github.com/tamnd/githome/presenter/gqlmodel" +) + +// strptr returns a pointer to s, the one-liner the static tables below need to +// fill the optional schema fields. +func strptr(s string) *string { return &s } + +// uriptr returns a pointer to a URI built from s. +func uriptr(s string) *gqlmodel.URI { + u := gqlmodel.URI(s) + return &u +} + +// staticLicenses is the set of open-source licenses Githome can name, keyed the +// way GitHub keys them (lowercase). The list mirrors GitHub's most commonly +// selected licenses; bodies are not stored, so License.body comes back empty +// (the summary is enough for the license picker and licenseInfo). The order is +// the order GitHub lists them in the license picker. +var staticLicenses = []*gqlmodel.License{ + {Key: "mit", Name: "MIT License", Nickname: nil, SpdxID: strptr("MIT"), URL: uriptr("https://opensource.org/licenses/MIT")}, + {Key: "apache-2.0", Name: "Apache License 2.0", SpdxID: strptr("Apache-2.0"), URL: uriptr("https://opensource.org/licenses/Apache-2.0")}, + {Key: "gpl-3.0", Name: "GNU General Public License v3.0", Nickname: strptr("GNU GPLv3"), SpdxID: strptr("GPL-3.0"), URL: uriptr("https://www.gnu.org/licenses/gpl-3.0")}, + {Key: "gpl-2.0", Name: "GNU General Public License v2.0", Nickname: strptr("GNU GPLv2"), SpdxID: strptr("GPL-2.0"), URL: uriptr("https://www.gnu.org/licenses/old-licenses/gpl-2.0")}, + {Key: "bsd-3-clause", Name: `BSD 3-Clause "New" or "Revised" License`, SpdxID: strptr("BSD-3-Clause"), URL: uriptr("https://opensource.org/licenses/BSD-3-Clause")}, + {Key: "bsd-2-clause", Name: `BSD 2-Clause "Simplified" License`, SpdxID: strptr("BSD-2-Clause"), URL: uriptr("https://opensource.org/licenses/BSD-2-Clause")}, + {Key: "mpl-2.0", Name: "Mozilla Public License 2.0", SpdxID: strptr("MPL-2.0"), URL: uriptr("https://opensource.org/licenses/MPL-2.0")}, + {Key: "lgpl-2.1", Name: "GNU Lesser General Public License v2.1", Nickname: strptr("GNU LGPLv2.1"), SpdxID: strptr("LGPL-2.1"), URL: uriptr("https://www.gnu.org/licenses/old-licenses/lgpl-2.1")}, + {Key: "agpl-3.0", Name: "GNU Affero General Public License v3.0", Nickname: strptr("GNU AGPLv3"), SpdxID: strptr("AGPL-3.0"), URL: uriptr("https://www.gnu.org/licenses/agpl-3.0")}, + {Key: "unlicense", Name: "The Unlicense", SpdxID: strptr("Unlicense"), URL: uriptr("https://unlicense.org/")}, +} + +// licenseByKey returns the static license for a GitHub license key, or nil when +// the key is unknown. +func licenseByKey(key string) *gqlmodel.License { + for _, l := range staticLicenses { + if l.Key == key { + return l + } + } + return nil +} + +// staticCodesOfConduct is the set of codes of conduct Githome can offer, keyed +// the way GitHub keys them. Bodies are not stored, so CodeOfConduct.body comes +// back null and the url points at the canonical published text. +var staticCodesOfConduct = []*generated.CodeOfConduct{ + {Key: "contributor_covenant", Name: "Contributor Covenant", URL: uriptr("https://www.contributor-covenant.org/version/2/1/code_of_conduct/")}, + {Key: "citizen_code_of_conduct", Name: "Citizen Code of Conduct", URL: uriptr("http://citizencodeofconduct.org/")}, +} + +// codeOfConductByKey returns the static code of conduct for a key, or nil when +// the key is unknown. +func codeOfConductByKey(key string) *generated.CodeOfConduct { + for _, c := range staticCodesOfConduct { + if c.Key == key { + return c + } + } + return nil +} diff --git a/presenter/gqlmodel/user.go b/presenter/gqlmodel/user.go index 4318a00..932d317 100644 --- a/presenter/gqlmodel/user.go +++ b/presenter/gqlmodel/user.go @@ -134,8 +134,12 @@ type Language struct { // License is an open-source license detected in a repository. type License struct { - Name string - SpdxID *string + Key string + Name string + Nickname *string + SpdxID *string + URL *URI + Body string } // RateLimit is the rate-limit state for the viewer.