From 1d4bb7ceb0cef79d68df0bacc913b01e40e6ddd6 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Wed, 5 Feb 2020 22:03:19 +0100 Subject: migrate to go modules --- vendor/github.com/shurcooL/githubv4/.travis.yml | 16 - vendor/github.com/shurcooL/githubv4/LICENSE | 21 - vendor/github.com/shurcooL/githubv4/README.md | 408 -------- vendor/github.com/shurcooL/githubv4/doc.go | 13 - vendor/github.com/shurcooL/githubv4/enum.go | 795 --------------- vendor/github.com/shurcooL/githubv4/gen.go | 193 ---- vendor/github.com/shurcooL/githubv4/githubv4.go | 56 -- vendor/github.com/shurcooL/githubv4/input.go | 1051 -------------------- vendor/github.com/shurcooL/githubv4/scalar.go | 139 --- vendor/github.com/shurcooL/go/browser/LICENSE | 27 - vendor/github.com/shurcooL/go/ctxhttp/ctxhttp.go | 78 -- vendor/github.com/shurcooL/graphql/.travis.yml | 16 - vendor/github.com/shurcooL/graphql/LICENSE | 21 - vendor/github.com/shurcooL/graphql/README.md | 293 ------ vendor/github.com/shurcooL/graphql/doc.go | 11 - vendor/github.com/shurcooL/graphql/graphql.go | 119 --- vendor/github.com/shurcooL/graphql/ident/ident.go | 240 ----- .../shurcooL/graphql/internal/jsonutil/graphql.go | 308 ------ vendor/github.com/shurcooL/graphql/query.go | 131 --- vendor/github.com/shurcooL/graphql/scalar.go | 51 - vendor/github.com/shurcooL/httpfs/filter/filter.go | 133 --- .../github.com/shurcooL/httpfs/filter/filters.go | 26 - vendor/github.com/shurcooL/httpfs/vfsutil/file.go | 21 - .../github.com/shurcooL/httpfs/vfsutil/vfsutil.go | 39 - vendor/github.com/shurcooL/httpfs/vfsutil/walk.go | 146 --- vendor/github.com/shurcooL/vfsgen/.travis.yml | 16 - vendor/github.com/shurcooL/vfsgen/CONTRIBUTING.md | 10 - vendor/github.com/shurcooL/vfsgen/LICENSE | 21 - vendor/github.com/shurcooL/vfsgen/README.md | 201 ---- vendor/github.com/shurcooL/vfsgen/commentwriter.go | 45 - vendor/github.com/shurcooL/vfsgen/doc.go | 15 - vendor/github.com/shurcooL/vfsgen/generator.go | 485 --------- vendor/github.com/shurcooL/vfsgen/options.go | 45 - vendor/github.com/shurcooL/vfsgen/stringwriter.go | 27 - 34 files changed, 5217 deletions(-) delete mode 100644 vendor/github.com/shurcooL/githubv4/.travis.yml delete mode 100644 vendor/github.com/shurcooL/githubv4/LICENSE delete mode 100644 vendor/github.com/shurcooL/githubv4/README.md delete mode 100644 vendor/github.com/shurcooL/githubv4/doc.go delete mode 100644 vendor/github.com/shurcooL/githubv4/enum.go delete mode 100644 vendor/github.com/shurcooL/githubv4/gen.go delete mode 100644 vendor/github.com/shurcooL/githubv4/githubv4.go delete mode 100644 vendor/github.com/shurcooL/githubv4/input.go delete mode 100644 vendor/github.com/shurcooL/githubv4/scalar.go delete mode 100644 vendor/github.com/shurcooL/go/browser/LICENSE delete mode 100644 vendor/github.com/shurcooL/go/ctxhttp/ctxhttp.go delete mode 100644 vendor/github.com/shurcooL/graphql/.travis.yml delete mode 100644 vendor/github.com/shurcooL/graphql/LICENSE delete mode 100644 vendor/github.com/shurcooL/graphql/README.md delete mode 100644 vendor/github.com/shurcooL/graphql/doc.go delete mode 100644 vendor/github.com/shurcooL/graphql/graphql.go delete mode 100644 vendor/github.com/shurcooL/graphql/ident/ident.go delete mode 100644 vendor/github.com/shurcooL/graphql/internal/jsonutil/graphql.go delete mode 100644 vendor/github.com/shurcooL/graphql/query.go delete mode 100644 vendor/github.com/shurcooL/graphql/scalar.go delete mode 100644 vendor/github.com/shurcooL/httpfs/filter/filter.go delete mode 100644 vendor/github.com/shurcooL/httpfs/filter/filters.go delete mode 100644 vendor/github.com/shurcooL/httpfs/vfsutil/file.go delete mode 100644 vendor/github.com/shurcooL/httpfs/vfsutil/vfsutil.go delete mode 100644 vendor/github.com/shurcooL/httpfs/vfsutil/walk.go delete mode 100644 vendor/github.com/shurcooL/vfsgen/.travis.yml delete mode 100644 vendor/github.com/shurcooL/vfsgen/CONTRIBUTING.md delete mode 100644 vendor/github.com/shurcooL/vfsgen/LICENSE delete mode 100644 vendor/github.com/shurcooL/vfsgen/README.md delete mode 100644 vendor/github.com/shurcooL/vfsgen/commentwriter.go delete mode 100644 vendor/github.com/shurcooL/vfsgen/doc.go delete mode 100644 vendor/github.com/shurcooL/vfsgen/generator.go delete mode 100644 vendor/github.com/shurcooL/vfsgen/options.go delete mode 100644 vendor/github.com/shurcooL/vfsgen/stringwriter.go (limited to 'vendor/github.com/shurcooL') diff --git a/vendor/github.com/shurcooL/githubv4/.travis.yml b/vendor/github.com/shurcooL/githubv4/.travis.yml deleted file mode 100644 index 437c57db..00000000 --- a/vendor/github.com/shurcooL/githubv4/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -sudo: false -language: go -go: - - 1.x - - master -matrix: - allow_failures: - - go: master - fast_finish: true -install: - - # Do nothing. This is needed to prevent default install action "go get -t -v ./..." from happening here (we want it to happen inside script step). -script: - - go get -t -v ./... - - diff -u <(echo -n) <(gofmt -d -s .) - - go vet ./... - - go test -v -race ./... diff --git a/vendor/github.com/shurcooL/githubv4/LICENSE b/vendor/github.com/shurcooL/githubv4/LICENSE deleted file mode 100644 index ca4c7764..00000000 --- a/vendor/github.com/shurcooL/githubv4/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 Dmitri Shuralyov - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/shurcooL/githubv4/README.md b/vendor/github.com/shurcooL/githubv4/README.md deleted file mode 100644 index 319a6428..00000000 --- a/vendor/github.com/shurcooL/githubv4/README.md +++ /dev/null @@ -1,408 +0,0 @@ -githubv4 -======== - -[![Build Status](https://travis-ci.org/shurcooL/githubv4.svg?branch=master)](https://travis-ci.org/shurcooL/githubv4) [![GoDoc](https://godoc.org/github.com/shurcooL/githubv4?status.svg)](https://godoc.org/github.com/shurcooL/githubv4) - -Package `githubv4` is a client library for accessing GitHub GraphQL API v4 (https://developer.github.com/v4/). - -If you're looking for a client library for GitHub REST API v3, the recommended package is [`github.com/google/go-github/github`](https://godoc.org/github.com/google/go-github/github). - -**Status:** In research and development. The API will change when opportunities for improvement are discovered; it is not yet frozen. - -Focus ------ - -- Friendly, simple and powerful API. -- Correctness, high performance and efficiency. -- Support all of GitHub GraphQL API v4 via code generation from schema. - -Installation ------------- - -`githubv4` requires Go version 1.8 or later. - -```bash -go get -u github.com/shurcooL/githubv4 -``` - -Usage ------ - -### Authentication - -GitHub GraphQL API v4 [requires authentication](https://developer.github.com/v4/guides/forming-calls/#authenticating-with-graphql). The `githubv4` package does not directly handle authentication. Instead, when creating a new client, you're expected to pass an `http.Client` that performs authentication. The easiest and recommended way to do this is to use the [`golang.org/x/oauth2`](https://golang.org/x/oauth2) package. You'll need an OAuth token from GitHub (for example, a [personal API token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/)) with the right scopes. Then: - -```Go -import "golang.org/x/oauth2" - -func main() { - src := oauth2.StaticTokenSource( - &oauth2.Token{AccessToken: os.Getenv("GITHUB_TOKEN")}, - ) - httpClient := oauth2.NewClient(context.Background(), src) - - client := githubv4.NewClient(httpClient) - // Use client... -} -``` - -### Simple Query - -To make a query, you need to define a Go type that corresponds to the GitHub GraphQL schema, and contains the fields you're interested in querying. You can look up the GitHub GraphQL schema at https://developer.github.com/v4/query/. - -For example, to make the following GraphQL query: - -```GraphQL -query { - viewer { - login - createdAt - } -} -``` - -You can define this variable: - -```Go -var query struct { - Viewer struct { - Login githubv4.String - CreatedAt githubv4.DateTime - } -} -``` - -Then call `client.Query`, passing a pointer to it: - -```Go -err := client.Query(context.Background(), &query, nil) -if err != nil { - // Handle error. -} -fmt.Println(" Login:", query.Viewer.Login) -fmt.Println("CreatedAt:", query.Viewer.CreatedAt) - -// Output: -// Login: gopher -// CreatedAt: 2017-05-26 21:17:14 +0000 UTC -``` - -### Scalar Types - -For each scalar in the GitHub GraphQL schema listed at https://developer.github.com/v4/scalar/, there is a corresponding Go type in package `githubv4`. - -You can use these types when writing queries: - -```Go -var query struct { - Viewer struct { - Login githubv4.String - CreatedAt githubv4.DateTime - IsBountyHunter githubv4.Boolean - BioHTML githubv4.HTML - WebsiteURL githubv4.URI - } -} -// Call client.Query() and use results in query... -``` - -However, depending on how you're planning to use the results of your query, it's often more convenient to use other Go types. - -The `encoding/json` rules are used for converting individual JSON-encoded fields from a GraphQL response into Go values. See https://godoc.org/encoding/json#Unmarshal for details. The [`json.Unmarshaler`](https://godoc.org/encoding/json#Unmarshaler) interface is respected. - -That means you can simplify the earlier query by using predeclared Go types: - -```Go -// import "time" - -var query struct { - Viewer struct { - Login string // E.g., "gopher". - CreatedAt time.Time // E.g., time.Date(2017, 5, 26, 21, 17, 14, 0, time.UTC). - IsBountyHunter bool // E.g., true. - BioHTML string // E.g., `I am learning GraphQL!`. - WebsiteURL string // E.g., "https://golang.org". - } -} -// Call client.Query() and use results in query... -``` - -The [`DateTime`](https://developer.github.com/v4/scalar/datetime/) scalar is described as "an ISO-8601 encoded UTC date string". If you wanted to fetch in that form without parsing it into a `time.Time`, you can use the `string` type. For example, this would work: - -```Go -// import "html/template" - -type MyBoolean bool - -var query struct { - Viewer struct { - Login string // E.g., "gopher". - CreatedAt string // E.g., "2017-05-26T21:17:14Z". - IsBountyHunter MyBoolean // E.g., MyBoolean(true). - BioHTML template.HTML // E.g., template.HTML(`I am learning GraphQL!`). - WebsiteURL template.URL // E.g., template.URL("https://golang.org"). - } -} -// Call client.Query() and use results in query... -``` - -### Arguments and Variables - -Often, you'll want to specify arguments on some fields. You can use the `graphql` struct field tag for this. - -For example, to make the following GraphQL query: - -```GraphQL -{ - repository(owner: "octocat", name: "Hello-World") { - description - } -} -``` - -You can define this variable: - -```Go -var q struct { - Repository struct { - Description string - } `graphql:"repository(owner: \"octocat\", name: \"Hello-World\")"` -} -``` - -Then call `client.Query`: - -```Go -err := client.Query(context.Background(), &q, nil) -if err != nil { - // Handle error. -} -fmt.Println(q.Repository.Description) - -// Output: -// My first repository on GitHub! -``` - -However, that'll only work if the arguments are constant and known in advance. Otherwise, you will need to make use of variables. Replace the constants in the struct field tag with variable names: - -```Go -// fetchRepoDescription fetches description of repo with owner and name. -func fetchRepoDescription(ctx context.Context, owner, name string) (string, error) { - var q struct { - Repository struct { - Description string - } `graphql:"repository(owner: $owner, name: $name)"` - } -``` - -When sending variables to GraphQL, you need to use exact types that match GraphQL scalar types, otherwise the GraphQL server will return an error. - -So, define a `variables` map with their values that are converted to GraphQL scalar types: - -```Go - variables := map[string]interface{}{ - "owner": githubv4.String(owner), - "name": githubv4.String(name), - } -``` - -Finally, call `client.Query` providing `variables`: - -```Go - err := client.Query(ctx, &q, variables) - return q.Repository.Description, err -} -``` - -### Inline Fragments - -Some GraphQL queries contain inline fragments. You can use the `graphql` struct field tag to express them. - -For example, to make the following GraphQL query: - -```GraphQL -{ - repositoryOwner(login: "github") { - login - ... on Organization { - description - } - ... on User { - bio - } - } -} -``` - -You can define this variable: - -```Go -var q struct { - RepositoryOwner struct { - Login string - Organization struct { - Description string - } `graphql:"... on Organization"` - User struct { - Bio string - } `graphql:"... on User"` - } `graphql:"repositoryOwner(login: \"github\")"` -} -``` - -Alternatively, you can define the struct types corresponding to inline fragments, and use them as embedded fields in your query: - -```Go -type ( - OrganizationFragment struct { - Description string - } - UserFragment struct { - Bio string - } -) - -var q struct { - RepositoryOwner struct { - Login string - OrganizationFragment `graphql:"... on Organization"` - UserFragment `graphql:"... on User"` - } `graphql:"repositoryOwner(login: \"github\")"` -} -``` - -Then call `client.Query`: - -```Go -err := client.Query(context.Background(), &q, nil) -if err != nil { - // Handle error. -} -fmt.Println(q.RepositoryOwner.Login) -fmt.Println(q.RepositoryOwner.Description) -fmt.Println(q.RepositoryOwner.Bio) - -// Output: -// github -// How people build software. -// -``` - -### Pagination - -Imagine you wanted to get a complete list of comments in an issue, and not just the first 10 or so. To do that, you'll need to perform multiple queries and use pagination information. For example: - -```Go -type comment struct { - Body string - Author struct { - Login string - AvatarURL string `graphql:"avatarUrl(size: 72)"` - } - ViewerCanReact bool -} -var q struct { - Repository struct { - Issue struct { - Comments struct { - Nodes []comment - PageInfo struct { - EndCursor githubv4.String - HasNextPage bool - } - } `graphql:"comments(first: 100, after: $commentsCursor)"` // 100 per page. - } `graphql:"issue(number: $issueNumber)"` - } `graphql:"repository(owner: $repositoryOwner, name: $repositoryName)"` -} -variables := map[string]interface{}{ - "repositoryOwner": githubv4.String(owner), - "repositoryName": githubv4.String(name), - "issueNumber": githubv4.Int(issue), - "commentsCursor": (*githubv4.String)(nil), // Null after argument to get first page. -} - -// Get comments from all pages. -var allComments []comment -for { - err := s.clQL.Query(ctx, &q, variables) - if err != nil { - return err - } - allComments = append(allComments, q.Repository.Issue.Comments.Nodes...) - if !q.Repository.Issue.Comments.PageInfo.HasNextPage { - break - } - variables["commentsCursor"] = githubv4.NewString(q.Repository.Issue.Comments.PageInfo.EndCursor) -} -``` - -There is more than one way to perform pagination. Consider additional fields inside [`PageInfo`](https://developer.github.com/v4/object/pageinfo/) object. - -### Mutations - -Mutations often require information that you can only find out by performing a query first. Let's suppose you've already done that. - -For example, to make the following GraphQL mutation: - -```GraphQL -mutation($input: AddReactionInput!) { - addReaction(input: $input) { - reaction { - content - } - subject { - id - } - } -} -variables { - "input": { - "subjectId": "MDU6SXNzdWUyMTc5NTQ0OTc=", - "content": "HOORAY" - } -} -``` - -You can define: - -```Go -var m struct { - AddReaction struct { - Reaction struct { - Content githubv4.ReactionContent - } - Subject struct { - ID githubv4.ID - } - } `graphql:"addReaction(input: $input)"` -} -input := githubv4.AddReactionInput{ - SubjectID: targetIssue.ID, // ID of the target issue from a previous query. - Content: githubv4.ReactionContentHooray, -} -``` - -Then call `client.Mutate`: - -```Go -err := client.Mutate(context.Background(), &m, input, nil) -if err != nil { - // Handle error. -} -fmt.Printf("Added a %v reaction to subject with ID %#v!\n", m.AddReaction.Reaction.Content, m.AddReaction.Subject.ID) - -// Output: -// Added a HOORAY reaction to subject with ID "MDU6SXNzdWUyMTc5NTQ0OTc="! -``` - -Directories ------------ - -| Path | Synopsis | -|-------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------| -| [example/githubv4dev](https://godoc.org/github.com/shurcooL/githubv4/example/githubv4dev) | githubv4dev is a test program currently being used for developing githubv4 package. | - -License -------- - -- [MIT License](LICENSE) diff --git a/vendor/github.com/shurcooL/githubv4/doc.go b/vendor/github.com/shurcooL/githubv4/doc.go deleted file mode 100644 index 0ce1a508..00000000 --- a/vendor/github.com/shurcooL/githubv4/doc.go +++ /dev/null @@ -1,13 +0,0 @@ -// Package githubv4 is a client library for accessing GitHub -// GraphQL API v4 (https://developer.github.com/v4/). -// -// If you're looking for a client library for GitHub REST API v3, -// the recommended package is github.com/google/go-github/github. -// -// Status: In active early research and development. The API will change when -// opportunities for improvement are discovered; it is not yet frozen. -// -// For now, see README for more details. -package githubv4 // import "github.com/shurcooL/githubv4" - -//go:generate go run gen.go diff --git a/vendor/github.com/shurcooL/githubv4/enum.go b/vendor/github.com/shurcooL/githubv4/enum.go deleted file mode 100644 index 0ab92800..00000000 --- a/vendor/github.com/shurcooL/githubv4/enum.go +++ /dev/null @@ -1,795 +0,0 @@ -// Code generated by gen.go; DO NOT EDIT. - -package githubv4 - -// CollaboratorAffiliation represents collaborators affiliation level with a subject. -type CollaboratorAffiliation string - -// Collaborators affiliation level with a subject. -const ( - CollaboratorAffiliationOutside CollaboratorAffiliation = "OUTSIDE" // All outside collaborators of an organization-owned subject. - CollaboratorAffiliationDirect CollaboratorAffiliation = "DIRECT" // All collaborators with permissions to an organization-owned subject, regardless of organization membership status. - CollaboratorAffiliationAll CollaboratorAffiliation = "ALL" // All collaborators the authenticated user can see. -) - -// CommentAuthorAssociation represents a comment author association with repository. -type CommentAuthorAssociation string - -// A comment author association with repository. -const ( - CommentAuthorAssociationMember CommentAuthorAssociation = "MEMBER" // Author is a member of the organization that owns the repository. - CommentAuthorAssociationOwner CommentAuthorAssociation = "OWNER" // Author is the owner of the repository. - CommentAuthorAssociationCollaborator CommentAuthorAssociation = "COLLABORATOR" // Author has been invited to collaborate on the repository. - CommentAuthorAssociationContributor CommentAuthorAssociation = "CONTRIBUTOR" // Author has previously committed to the repository. - CommentAuthorAssociationFirstTimeContributor CommentAuthorAssociation = "FIRST_TIME_CONTRIBUTOR" // Author has not previously committed to the repository. - CommentAuthorAssociationFirstTimer CommentAuthorAssociation = "FIRST_TIMER" // Author has not previously committed to GitHub. - CommentAuthorAssociationNone CommentAuthorAssociation = "NONE" // Author has no association with the repository. -) - -// CommentCannotUpdateReason represents the possible errors that will prevent a user from updating a comment. -type CommentCannotUpdateReason string - -// The possible errors that will prevent a user from updating a comment. -const ( - CommentCannotUpdateReasonInsufficientAccess CommentCannotUpdateReason = "INSUFFICIENT_ACCESS" // You must be the author or have write access to this repository to update this comment. - CommentCannotUpdateReasonLocked CommentCannotUpdateReason = "LOCKED" // Unable to create comment because issue is locked. - CommentCannotUpdateReasonLoginRequired CommentCannotUpdateReason = "LOGIN_REQUIRED" // You must be logged in to update this comment. - CommentCannotUpdateReasonMaintenance CommentCannotUpdateReason = "MAINTENANCE" // Repository is under maintenance. - CommentCannotUpdateReasonVerifiedEmailRequired CommentCannotUpdateReason = "VERIFIED_EMAIL_REQUIRED" // At least one email address must be verified to update this comment. - CommentCannotUpdateReasonDenied CommentCannotUpdateReason = "DENIED" // You cannot update this comment. -) - -// CommitContributionOrderField represents properties by which commit contribution connections can be ordered. -type CommitContributionOrderField string - -// Properties by which commit contribution connections can be ordered. -const ( - CommitContributionOrderFieldOccurredAt CommitContributionOrderField = "OCCURRED_AT" // Order commit contributions by when they were made. - CommitContributionOrderFieldCommitCount CommitContributionOrderField = "COMMIT_COUNT" // Order commit contributions by how many commits they represent. -) - -// ContributionOrderField represents properties by which contribution connections can be ordered. -type ContributionOrderField string - -// Properties by which contribution connections can be ordered. -const ( - ContributionOrderFieldOccurredAt ContributionOrderField = "OCCURRED_AT" // Order contributions by when they were made. -) - -// DefaultRepositoryPermissionField represents the possible default permissions for repositories. -type DefaultRepositoryPermissionField string - -// The possible default permissions for repositories. -const ( - DefaultRepositoryPermissionFieldNone DefaultRepositoryPermissionField = "NONE" // No access. - DefaultRepositoryPermissionFieldRead DefaultRepositoryPermissionField = "READ" // Can read repos by default. - DefaultRepositoryPermissionFieldWrite DefaultRepositoryPermissionField = "WRITE" // Can read and write repos by default. - DefaultRepositoryPermissionFieldAdmin DefaultRepositoryPermissionField = "ADMIN" // Can read, write, and administrate repos by default. -) - -// DeploymentOrderField represents properties by which deployment connections can be ordered. -type DeploymentOrderField string - -// Properties by which deployment connections can be ordered. -const ( - DeploymentOrderFieldCreatedAt DeploymentOrderField = "CREATED_AT" // Order collection by creation time. -) - -// DeploymentState represents the possible states in which a deployment can be. -type DeploymentState string - -// The possible states in which a deployment can be. -const ( - DeploymentStateAbandoned DeploymentState = "ABANDONED" // The pending deployment was not updated after 30 minutes. - DeploymentStateActive DeploymentState = "ACTIVE" // The deployment is currently active. - DeploymentStateDestroyed DeploymentState = "DESTROYED" // An inactive transient deployment. - DeploymentStateError DeploymentState = "ERROR" // The deployment experienced an error. - DeploymentStateFailure DeploymentState = "FAILURE" // The deployment has failed. - DeploymentStateInactive DeploymentState = "INACTIVE" // The deployment is inactive. - DeploymentStatePending DeploymentState = "PENDING" // The deployment is pending. - DeploymentStateQueued DeploymentState = "QUEUED" // The deployment has queued. - DeploymentStateInProgress DeploymentState = "IN_PROGRESS" // The deployment is in progress. -) - -// DeploymentStatusState represents the possible states for a deployment status. -type DeploymentStatusState string - -// The possible states for a deployment status. -const ( - DeploymentStatusStatePending DeploymentStatusState = "PENDING" // The deployment is pending. - DeploymentStatusStateSuccess DeploymentStatusState = "SUCCESS" // The deployment was successful. - DeploymentStatusStateFailure DeploymentStatusState = "FAILURE" // The deployment has failed. - DeploymentStatusStateInactive DeploymentStatusState = "INACTIVE" // The deployment is inactive. - DeploymentStatusStateError DeploymentStatusState = "ERROR" // The deployment experienced an error. - DeploymentStatusStateQueued DeploymentStatusState = "QUEUED" // The deployment is queued. - DeploymentStatusStateInProgress DeploymentStatusState = "IN_PROGRESS" // The deployment is in progress. -) - -// GistOrderField represents properties by which gist connections can be ordered. -type GistOrderField string - -// Properties by which gist connections can be ordered. -const ( - GistOrderFieldCreatedAt GistOrderField = "CREATED_AT" // Order gists by creation time. - GistOrderFieldUpdatedAt GistOrderField = "UPDATED_AT" // Order gists by update time. - GistOrderFieldPushedAt GistOrderField = "PUSHED_AT" // Order gists by push time. -) - -// GistPrivacy represents the privacy of a Gist. -type GistPrivacy string - -// The privacy of a Gist. -const ( - GistPrivacyPublic GistPrivacy = "PUBLIC" // Public. - GistPrivacySecret GistPrivacy = "SECRET" // Secret. - GistPrivacyAll GistPrivacy = "ALL" // Gists that are public and secret. -) - -// GitSignatureState represents the state of a Git signature. -type GitSignatureState string - -// The state of a Git signature. -const ( - GitSignatureStateValid GitSignatureState = "VALID" // Valid signature and verified by GitHub. - GitSignatureStateInvalid GitSignatureState = "INVALID" // Invalid signature. - GitSignatureStateMalformedSig GitSignatureState = "MALFORMED_SIG" // Malformed signature. - GitSignatureStateUnknownKey GitSignatureState = "UNKNOWN_KEY" // Key used for signing not known to GitHub. - GitSignatureStateBadEmail GitSignatureState = "BAD_EMAIL" // Invalid email used for signing. - GitSignatureStateUnverifiedEmail GitSignatureState = "UNVERIFIED_EMAIL" // Email used for signing unverified on GitHub. - GitSignatureStateNoUser GitSignatureState = "NO_USER" // Email used for signing not known to GitHub. - GitSignatureStateUnknownSigType GitSignatureState = "UNKNOWN_SIG_TYPE" // Unknown signature type. - GitSignatureStateUnsigned GitSignatureState = "UNSIGNED" // Unsigned. - GitSignatureStateGpgverifyUnavailable GitSignatureState = "GPGVERIFY_UNAVAILABLE" // Internal error - the GPG verification service is unavailable at the moment. - GitSignatureStateGpgverifyError GitSignatureState = "GPGVERIFY_ERROR" // Internal error - the GPG verification service misbehaved. - GitSignatureStateNotSigningKey GitSignatureState = "NOT_SIGNING_KEY" // The usage flags for the key that signed this don't allow signing. - GitSignatureStateExpiredKey GitSignatureState = "EXPIRED_KEY" // Signing key expired. - GitSignatureStateOcspPending GitSignatureState = "OCSP_PENDING" // Valid signature, pending certificate revocation checking. - GitSignatureStateOcspError GitSignatureState = "OCSP_ERROR" // Valid siganture, though certificate revocation check failed. - GitSignatureStateBadCert GitSignatureState = "BAD_CERT" // The signing certificate or its chain could not be verified. - GitSignatureStateOcspRevoked GitSignatureState = "OCSP_REVOKED" // One or more certificates in chain has been revoked. -) - -// IdentityProviderConfigurationState represents the possible states in which authentication can be configured with an identity provider. -type IdentityProviderConfigurationState string - -// The possible states in which authentication can be configured with an identity provider. -const ( - IdentityProviderConfigurationStateEnforced IdentityProviderConfigurationState = "ENFORCED" // Authentication with an identity provider is configured and enforced. - IdentityProviderConfigurationStateConfigured IdentityProviderConfigurationState = "CONFIGURED" // Authentication with an identity provider is configured but not enforced. - IdentityProviderConfigurationStateUnconfigured IdentityProviderConfigurationState = "UNCONFIGURED" // Authentication with an identity provider is not configured. -) - -// IssueOrderField represents properties by which issue connections can be ordered. -type IssueOrderField string - -// Properties by which issue connections can be ordered. -const ( - IssueOrderFieldCreatedAt IssueOrderField = "CREATED_AT" // Order issues by creation time. - IssueOrderFieldUpdatedAt IssueOrderField = "UPDATED_AT" // Order issues by update time. - IssueOrderFieldComments IssueOrderField = "COMMENTS" // Order issues by comment count. -) - -// IssuePubSubTopic represents the possible PubSub channels for an issue. -type IssuePubSubTopic string - -// The possible PubSub channels for an issue. -const ( - IssuePubSubTopicUpdated IssuePubSubTopic = "UPDATED" // The channel ID for observing issue updates. - IssuePubSubTopicMarkasread IssuePubSubTopic = "MARKASREAD" // The channel ID for marking an issue as read. - IssuePubSubTopicTimeline IssuePubSubTopic = "TIMELINE" // The channel ID for updating items on the issue timeline. - IssuePubSubTopicState IssuePubSubTopic = "STATE" // The channel ID for observing issue state updates. -) - -// IssueState represents the possible states of an issue. -type IssueState string - -// The possible states of an issue. -const ( - IssueStateOpen IssueState = "OPEN" // An issue that is still open. - IssueStateClosed IssueState = "CLOSED" // An issue that has been closed. -) - -// IssueTimelineItemsItemType represents the possible item types found in a timeline. -type IssueTimelineItemsItemType string - -// The possible item types found in a timeline. -const ( - IssueTimelineItemsItemTypeIssueComment IssueTimelineItemsItemType = "ISSUE_COMMENT" // Represents a comment on an Issue. - IssueTimelineItemsItemTypeCrossReferencedEvent IssueTimelineItemsItemType = "CROSS_REFERENCED_EVENT" // Represents a mention made by one issue or pull request to another. - IssueTimelineItemsItemTypeAddedToProjectEvent IssueTimelineItemsItemType = "ADDED_TO_PROJECT_EVENT" // Represents a 'added_to_project' event on a given issue or pull request. - IssueTimelineItemsItemTypeAssignedEvent IssueTimelineItemsItemType = "ASSIGNED_EVENT" // Represents an 'assigned' event on any assignable object. - IssueTimelineItemsItemTypeClosedEvent IssueTimelineItemsItemType = "CLOSED_EVENT" // Represents a 'closed' event on any `Closable`. - IssueTimelineItemsItemTypeCommentDeletedEvent IssueTimelineItemsItemType = "COMMENT_DELETED_EVENT" // Represents a 'comment_deleted' event on a given issue or pull request. - IssueTimelineItemsItemTypeConvertedNoteToIssueEvent IssueTimelineItemsItemType = "CONVERTED_NOTE_TO_ISSUE_EVENT" // Represents a 'converted_note_to_issue' event on a given issue or pull request. - IssueTimelineItemsItemTypeDemilestonedEvent IssueTimelineItemsItemType = "DEMILESTONED_EVENT" // Represents a 'demilestoned' event on a given issue or pull request. - IssueTimelineItemsItemTypeLabeledEvent IssueTimelineItemsItemType = "LABELED_EVENT" // Represents a 'labeled' event on a given issue or pull request. - IssueTimelineItemsItemTypeLockedEvent IssueTimelineItemsItemType = "LOCKED_EVENT" // Represents a 'locked' event on a given issue or pull request. - IssueTimelineItemsItemTypeMentionedEvent IssueTimelineItemsItemType = "MENTIONED_EVENT" // Represents a 'mentioned' event on a given issue or pull request. - IssueTimelineItemsItemTypeMilestonedEvent IssueTimelineItemsItemType = "MILESTONED_EVENT" // Represents a 'milestoned' event on a given issue or pull request. - IssueTimelineItemsItemTypeMovedColumnsInProjectEvent IssueTimelineItemsItemType = "MOVED_COLUMNS_IN_PROJECT_EVENT" // Represents a 'moved_columns_in_project' event on a given issue or pull request. - IssueTimelineItemsItemTypePinnedEvent IssueTimelineItemsItemType = "PINNED_EVENT" // Represents a 'pinned' event on a given issue or pull request. - IssueTimelineItemsItemTypeReferencedEvent IssueTimelineItemsItemType = "REFERENCED_EVENT" // Represents a 'referenced' event on a given `ReferencedSubject`. - IssueTimelineItemsItemTypeRemovedFromProjectEvent IssueTimelineItemsItemType = "REMOVED_FROM_PROJECT_EVENT" // Represents a 'removed_from_project' event on a given issue or pull request. - IssueTimelineItemsItemTypeRenamedTitleEvent IssueTimelineItemsItemType = "RENAMED_TITLE_EVENT" // Represents a 'renamed' event on a given issue or pull request. - IssueTimelineItemsItemTypeReopenedEvent IssueTimelineItemsItemType = "REOPENED_EVENT" // Represents a 'reopened' event on any `Closable`. - IssueTimelineItemsItemTypeSubscribedEvent IssueTimelineItemsItemType = "SUBSCRIBED_EVENT" // Represents a 'subscribed' event on a given `Subscribable`. - IssueTimelineItemsItemTypeTransferredEvent IssueTimelineItemsItemType = "TRANSFERRED_EVENT" // Represents a 'transferred' event on a given issue or pull request. - IssueTimelineItemsItemTypeUnassignedEvent IssueTimelineItemsItemType = "UNASSIGNED_EVENT" // Represents an 'unassigned' event on any assignable object. - IssueTimelineItemsItemTypeUnlabeledEvent IssueTimelineItemsItemType = "UNLABELED_EVENT" // Represents an 'unlabeled' event on a given issue or pull request. - IssueTimelineItemsItemTypeUnlockedEvent IssueTimelineItemsItemType = "UNLOCKED_EVENT" // Represents an 'unlocked' event on a given issue or pull request. - IssueTimelineItemsItemTypeUserBlockedEvent IssueTimelineItemsItemType = "USER_BLOCKED_EVENT" // Represents a 'user_blocked' event on a given user. - IssueTimelineItemsItemTypeUnpinnedEvent IssueTimelineItemsItemType = "UNPINNED_EVENT" // Represents an 'unpinned' event on a given issue or pull request. - IssueTimelineItemsItemTypeUnsubscribedEvent IssueTimelineItemsItemType = "UNSUBSCRIBED_EVENT" // Represents an 'unsubscribed' event on a given `Subscribable`. -) - -// LanguageOrderField represents properties by which language connections can be ordered. -type LanguageOrderField string - -// Properties by which language connections can be ordered. -const ( - LanguageOrderFieldSize LanguageOrderField = "SIZE" // Order languages by the size of all files containing the language. -) - -// LockReason represents the possible reasons that an issue or pull request was locked. -type LockReason string - -// The possible reasons that an issue or pull request was locked. -const ( - LockReasonOffTopic LockReason = "OFF_TOPIC" // The issue or pull request was locked because the conversation was off-topic. - LockReasonTooHeated LockReason = "TOO_HEATED" // The issue or pull request was locked because the conversation was too heated. - LockReasonResolved LockReason = "RESOLVED" // The issue or pull request was locked because the conversation was resolved. - LockReasonSpam LockReason = "SPAM" // The issue or pull request was locked because the conversation was spam. -) - -// MergeableState represents whether or not a PullRequest can be merged. -type MergeableState string - -// Whether or not a PullRequest can be merged. -const ( - MergeableStateMergeable MergeableState = "MERGEABLE" // The pull request can be merged. - MergeableStateConflicting MergeableState = "CONFLICTING" // The pull request cannot be merged due to merge conflicts. - MergeableStateUnknown MergeableState = "UNKNOWN" // The mergeability of the pull request is still being calculated. -) - -// MilestoneOrderField represents properties by which milestone connections can be ordered. -type MilestoneOrderField string - -// Properties by which milestone connections can be ordered. -const ( - MilestoneOrderFieldDueDate MilestoneOrderField = "DUE_DATE" // Order milestones by when they are due. - MilestoneOrderFieldCreatedAt MilestoneOrderField = "CREATED_AT" // Order milestones by when they were created. - MilestoneOrderFieldUpdatedAt MilestoneOrderField = "UPDATED_AT" // Order milestones by when they were last updated. - MilestoneOrderFieldNumber MilestoneOrderField = "NUMBER" // Order milestones by their number. -) - -// MilestoneState represents the possible states of a milestone. -type MilestoneState string - -// The possible states of a milestone. -const ( - MilestoneStateOpen MilestoneState = "OPEN" // A milestone that is still open. - MilestoneStateClosed MilestoneState = "CLOSED" // A milestone that has been closed. -) - -// OrderDirection represents possible directions in which to order a list of items when provided an `orderBy` argument. -type OrderDirection string - -// Possible directions in which to order a list of items when provided an `orderBy` argument. -const ( - OrderDirectionAsc OrderDirection = "ASC" // Specifies an ascending order for a given `orderBy` argument. - OrderDirectionDesc OrderDirection = "DESC" // Specifies a descending order for a given `orderBy` argument. -) - -// OrganizationInvitationRole represents the possible organization invitation roles. -type OrganizationInvitationRole string - -// The possible organization invitation roles. -const ( - OrganizationInvitationRoleDirectMember OrganizationInvitationRole = "DIRECT_MEMBER" // The user is invited to be a direct member of the organization. - OrganizationInvitationRoleAdmin OrganizationInvitationRole = "ADMIN" // The user is invited to be an admin of the organization. - OrganizationInvitationRoleBillingManager OrganizationInvitationRole = "BILLING_MANAGER" // The user is invited to be a billing manager of the organization. - OrganizationInvitationRoleReinstate OrganizationInvitationRole = "REINSTATE" // The user's previous role will be reinstated. -) - -// OrganizationInvitationType represents the possible organization invitation types. -type OrganizationInvitationType string - -// The possible organization invitation types. -const ( - OrganizationInvitationTypeUser OrganizationInvitationType = "USER" // The invitation was to an existing user. - OrganizationInvitationTypeEmail OrganizationInvitationType = "EMAIL" // The invitation was to an email address. -) - -// OrganizationMemberRole represents the possible roles within an organization for its members. -type OrganizationMemberRole string - -// The possible roles within an organization for its members. -const ( - OrganizationMemberRoleMember OrganizationMemberRole = "MEMBER" // The user is a member of the organization. - OrganizationMemberRoleAdmin OrganizationMemberRole = "ADMIN" // The user is an administrator of the organization. -) - -// PinnableItemType represents represents items that can be pinned to a profile page or dashboard. -type PinnableItemType string - -// Represents items that can be pinned to a profile page or dashboard. -const ( - PinnableItemTypeRepository PinnableItemType = "REPOSITORY" // A repository. - PinnableItemTypeGist PinnableItemType = "GIST" // A gist. - PinnableItemTypeIssue PinnableItemType = "ISSUE" // An issue. -) - -// ProjectCardArchivedState represents the possible archived states of a project card. -type ProjectCardArchivedState string - -// The possible archived states of a project card. -const ( - ProjectCardArchivedStateArchived ProjectCardArchivedState = "ARCHIVED" // A project card that is archived. - ProjectCardArchivedStateNotArchived ProjectCardArchivedState = "NOT_ARCHIVED" // A project card that is not archived. -) - -// ProjectCardState represents various content states of a ProjectCard. -type ProjectCardState string - -// Various content states of a ProjectCard. -const ( - ProjectCardStateContentOnly ProjectCardState = "CONTENT_ONLY" // The card has content only. - ProjectCardStateNoteOnly ProjectCardState = "NOTE_ONLY" // The card has a note only. - ProjectCardStateRedacted ProjectCardState = "REDACTED" // The card is redacted. -) - -// ProjectColumnPurpose represents the semantic purpose of the column - todo, in progress, or done. -type ProjectColumnPurpose string - -// The semantic purpose of the column - todo, in progress, or done. -const ( - ProjectColumnPurposeTodo ProjectColumnPurpose = "TODO" // The column contains cards still to be worked on. - ProjectColumnPurposeInProgress ProjectColumnPurpose = "IN_PROGRESS" // The column contains cards which are currently being worked on. - ProjectColumnPurposeDone ProjectColumnPurpose = "DONE" // The column contains cards which are complete. -) - -// ProjectOrderField represents properties by which project connections can be ordered. -type ProjectOrderField string - -// Properties by which project connections can be ordered. -const ( - ProjectOrderFieldCreatedAt ProjectOrderField = "CREATED_AT" // Order projects by creation time. - ProjectOrderFieldUpdatedAt ProjectOrderField = "UPDATED_AT" // Order projects by update time. - ProjectOrderFieldName ProjectOrderField = "NAME" // Order projects by name. -) - -// ProjectState represents state of the project; either 'open' or 'closed'. -type ProjectState string - -// State of the project; either 'open' or 'closed'. -const ( - ProjectStateOpen ProjectState = "OPEN" // The project is open. - ProjectStateClosed ProjectState = "CLOSED" // The project is closed. -) - -// PullRequestOrderField represents properties by which pull_requests connections can be ordered. -type PullRequestOrderField string - -// Properties by which pull_requests connections can be ordered. -const ( - PullRequestOrderFieldCreatedAt PullRequestOrderField = "CREATED_AT" // Order pull_requests by creation time. - PullRequestOrderFieldUpdatedAt PullRequestOrderField = "UPDATED_AT" // Order pull_requests by update time. -) - -// PullRequestPubSubTopic represents the possible PubSub channels for a pull request. -type PullRequestPubSubTopic string - -// The possible PubSub channels for a pull request. -const ( - PullRequestPubSubTopicUpdated PullRequestPubSubTopic = "UPDATED" // The channel ID for observing pull request updates. - PullRequestPubSubTopicMarkasread PullRequestPubSubTopic = "MARKASREAD" // The channel ID for marking an pull request as read. - PullRequestPubSubTopicHeadRef PullRequestPubSubTopic = "HEAD_REF" // The channel ID for observing head ref updates. - PullRequestPubSubTopicTimeline PullRequestPubSubTopic = "TIMELINE" // The channel ID for updating items on the pull request timeline. - PullRequestPubSubTopicState PullRequestPubSubTopic = "STATE" // The channel ID for observing pull request state updates. -) - -// PullRequestReviewCommentState represents the possible states of a pull request review comment. -type PullRequestReviewCommentState string - -// The possible states of a pull request review comment. -const ( - PullRequestReviewCommentStatePending PullRequestReviewCommentState = "PENDING" // A comment that is part of a pending review. - PullRequestReviewCommentStateSubmitted PullRequestReviewCommentState = "SUBMITTED" // A comment that is part of a submitted review. -) - -// PullRequestReviewEvent represents the possible events to perform on a pull request review. -type PullRequestReviewEvent string - -// The possible events to perform on a pull request review. -const ( - PullRequestReviewEventComment PullRequestReviewEvent = "COMMENT" // Submit general feedback without explicit approval. - PullRequestReviewEventApprove PullRequestReviewEvent = "APPROVE" // Submit feedback and approve merging these changes. - PullRequestReviewEventRequestChanges PullRequestReviewEvent = "REQUEST_CHANGES" // Submit feedback that must be addressed before merging. - PullRequestReviewEventDismiss PullRequestReviewEvent = "DISMISS" // Dismiss review so it now longer effects merging. -) - -// PullRequestReviewState represents the possible states of a pull request review. -type PullRequestReviewState string - -// The possible states of a pull request review. -const ( - PullRequestReviewStatePending PullRequestReviewState = "PENDING" // A review that has not yet been submitted. - PullRequestReviewStateCommented PullRequestReviewState = "COMMENTED" // An informational review. - PullRequestReviewStateApproved PullRequestReviewState = "APPROVED" // A review allowing the pull request to merge. - PullRequestReviewStateChangesRequested PullRequestReviewState = "CHANGES_REQUESTED" // A review blocking the pull request from merging. - PullRequestReviewStateDismissed PullRequestReviewState = "DISMISSED" // A review that has been dismissed. -) - -// PullRequestState represents the possible states of a pull request. -type PullRequestState string - -// The possible states of a pull request. -const ( - PullRequestStateOpen PullRequestState = "OPEN" // A pull request that is still open. - PullRequestStateClosed PullRequestState = "CLOSED" // A pull request that has been closed without being merged. - PullRequestStateMerged PullRequestState = "MERGED" // A pull request that has been closed by being merged. -) - -// PullRequestTimelineItemsItemType represents the possible item types found in a timeline. -type PullRequestTimelineItemsItemType string - -// The possible item types found in a timeline. -const ( - PullRequestTimelineItemsItemTypePullRequestCommit PullRequestTimelineItemsItemType = "PULL_REQUEST_COMMIT" // Represents a Git commit part of a pull request. - PullRequestTimelineItemsItemTypePullRequestCommitCommentThread PullRequestTimelineItemsItemType = "PULL_REQUEST_COMMIT_COMMENT_THREAD" // Represents a commit comment thread part of a pull request. - PullRequestTimelineItemsItemTypePullRequestReview PullRequestTimelineItemsItemType = "PULL_REQUEST_REVIEW" // A review object for a given pull request. - PullRequestTimelineItemsItemTypePullRequestReviewThread PullRequestTimelineItemsItemType = "PULL_REQUEST_REVIEW_THREAD" // A threaded list of comments for a given pull request. - PullRequestTimelineItemsItemTypePullRequestRevisionMarker PullRequestTimelineItemsItemType = "PULL_REQUEST_REVISION_MARKER" // Represents the latest point in the pull request timeline for which the viewer has seen the pull request's commits. - PullRequestTimelineItemsItemTypeBaseRefChangedEvent PullRequestTimelineItemsItemType = "BASE_REF_CHANGED_EVENT" // Represents a 'base_ref_changed' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeBaseRefForcePushedEvent PullRequestTimelineItemsItemType = "BASE_REF_FORCE_PUSHED_EVENT" // Represents a 'base_ref_force_pushed' event on a given pull request. - PullRequestTimelineItemsItemTypeDeployedEvent PullRequestTimelineItemsItemType = "DEPLOYED_EVENT" // Represents a 'deployed' event on a given pull request. - PullRequestTimelineItemsItemTypeDeploymentEnvironmentChangedEvent PullRequestTimelineItemsItemType = "DEPLOYMENT_ENVIRONMENT_CHANGED_EVENT" // Represents a 'deployment_environment_changed' event on a given pull request. - PullRequestTimelineItemsItemTypeHeadRefDeletedEvent PullRequestTimelineItemsItemType = "HEAD_REF_DELETED_EVENT" // Represents a 'head_ref_deleted' event on a given pull request. - PullRequestTimelineItemsItemTypeHeadRefForcePushedEvent PullRequestTimelineItemsItemType = "HEAD_REF_FORCE_PUSHED_EVENT" // Represents a 'head_ref_force_pushed' event on a given pull request. - PullRequestTimelineItemsItemTypeHeadRefRestoredEvent PullRequestTimelineItemsItemType = "HEAD_REF_RESTORED_EVENT" // Represents a 'head_ref_restored' event on a given pull request. - PullRequestTimelineItemsItemTypeMergedEvent PullRequestTimelineItemsItemType = "MERGED_EVENT" // Represents a 'merged' event on a given pull request. - PullRequestTimelineItemsItemTypeReviewDismissedEvent PullRequestTimelineItemsItemType = "REVIEW_DISMISSED_EVENT" // Represents a 'review_dismissed' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeReviewRequestedEvent PullRequestTimelineItemsItemType = "REVIEW_REQUESTED_EVENT" // Represents an 'review_requested' event on a given pull request. - PullRequestTimelineItemsItemTypeReviewRequestRemovedEvent PullRequestTimelineItemsItemType = "REVIEW_REQUEST_REMOVED_EVENT" // Represents an 'review_request_removed' event on a given pull request. - PullRequestTimelineItemsItemTypeIssueComment PullRequestTimelineItemsItemType = "ISSUE_COMMENT" // Represents a comment on an Issue. - PullRequestTimelineItemsItemTypeCrossReferencedEvent PullRequestTimelineItemsItemType = "CROSS_REFERENCED_EVENT" // Represents a mention made by one issue or pull request to another. - PullRequestTimelineItemsItemTypeAddedToProjectEvent PullRequestTimelineItemsItemType = "ADDED_TO_PROJECT_EVENT" // Represents a 'added_to_project' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeAssignedEvent PullRequestTimelineItemsItemType = "ASSIGNED_EVENT" // Represents an 'assigned' event on any assignable object. - PullRequestTimelineItemsItemTypeClosedEvent PullRequestTimelineItemsItemType = "CLOSED_EVENT" // Represents a 'closed' event on any `Closable`. - PullRequestTimelineItemsItemTypeCommentDeletedEvent PullRequestTimelineItemsItemType = "COMMENT_DELETED_EVENT" // Represents a 'comment_deleted' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeConvertedNoteToIssueEvent PullRequestTimelineItemsItemType = "CONVERTED_NOTE_TO_ISSUE_EVENT" // Represents a 'converted_note_to_issue' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeDemilestonedEvent PullRequestTimelineItemsItemType = "DEMILESTONED_EVENT" // Represents a 'demilestoned' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeLabeledEvent PullRequestTimelineItemsItemType = "LABELED_EVENT" // Represents a 'labeled' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeLockedEvent PullRequestTimelineItemsItemType = "LOCKED_EVENT" // Represents a 'locked' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeMentionedEvent PullRequestTimelineItemsItemType = "MENTIONED_EVENT" // Represents a 'mentioned' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeMilestonedEvent PullRequestTimelineItemsItemType = "MILESTONED_EVENT" // Represents a 'milestoned' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeMovedColumnsInProjectEvent PullRequestTimelineItemsItemType = "MOVED_COLUMNS_IN_PROJECT_EVENT" // Represents a 'moved_columns_in_project' event on a given issue or pull request. - PullRequestTimelineItemsItemTypePinnedEvent PullRequestTimelineItemsItemType = "PINNED_EVENT" // Represents a 'pinned' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeReferencedEvent PullRequestTimelineItemsItemType = "REFERENCED_EVENT" // Represents a 'referenced' event on a given `ReferencedSubject`. - PullRequestTimelineItemsItemTypeRemovedFromProjectEvent PullRequestTimelineItemsItemType = "REMOVED_FROM_PROJECT_EVENT" // Represents a 'removed_from_project' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeRenamedTitleEvent PullRequestTimelineItemsItemType = "RENAMED_TITLE_EVENT" // Represents a 'renamed' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeReopenedEvent PullRequestTimelineItemsItemType = "REOPENED_EVENT" // Represents a 'reopened' event on any `Closable`. - PullRequestTimelineItemsItemTypeSubscribedEvent PullRequestTimelineItemsItemType = "SUBSCRIBED_EVENT" // Represents a 'subscribed' event on a given `Subscribable`. - PullRequestTimelineItemsItemTypeTransferredEvent PullRequestTimelineItemsItemType = "TRANSFERRED_EVENT" // Represents a 'transferred' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeUnassignedEvent PullRequestTimelineItemsItemType = "UNASSIGNED_EVENT" // Represents an 'unassigned' event on any assignable object. - PullRequestTimelineItemsItemTypeUnlabeledEvent PullRequestTimelineItemsItemType = "UNLABELED_EVENT" // Represents an 'unlabeled' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeUnlockedEvent PullRequestTimelineItemsItemType = "UNLOCKED_EVENT" // Represents an 'unlocked' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeUserBlockedEvent PullRequestTimelineItemsItemType = "USER_BLOCKED_EVENT" // Represents a 'user_blocked' event on a given user. - PullRequestTimelineItemsItemTypeUnpinnedEvent PullRequestTimelineItemsItemType = "UNPINNED_EVENT" // Represents an 'unpinned' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeUnsubscribedEvent PullRequestTimelineItemsItemType = "UNSUBSCRIBED_EVENT" // Represents an 'unsubscribed' event on a given `Subscribable`. -) - -// ReactionContent represents emojis that can be attached to Issues, Pull Requests and Comments. -type ReactionContent string - -// Emojis that can be attached to Issues, Pull Requests and Comments. -const ( - ReactionContentThumbsUp ReactionContent = "THUMBS_UP" // Represents the 👍 emoji. - ReactionContentThumbsDown ReactionContent = "THUMBS_DOWN" // Represents the 👎 emoji. - ReactionContentLaugh ReactionContent = "LAUGH" // Represents the 😄 emoji. - ReactionContentHooray ReactionContent = "HOORAY" // Represents the 🎉 emoji. - ReactionContentConfused ReactionContent = "CONFUSED" // Represents the 😕 emoji. - ReactionContentHeart ReactionContent = "HEART" // Represents the ❤️ emoji. - ReactionContentRocket ReactionContent = "ROCKET" // Represents the 🚀 emoji. - ReactionContentEyes ReactionContent = "EYES" // Represents the 👀 emoji. -) - -// ReactionOrderField represents a list of fields that reactions can be ordered by. -type ReactionOrderField string - -// A list of fields that reactions can be ordered by. -const ( - ReactionOrderFieldCreatedAt ReactionOrderField = "CREATED_AT" // Allows ordering a list of reactions by when they were created. -) - -// RefOrderField represents properties by which ref connections can be ordered. -type RefOrderField string - -// Properties by which ref connections can be ordered. -const ( - RefOrderFieldTagCommitDate RefOrderField = "TAG_COMMIT_DATE" // Order refs by underlying commit date if the ref prefix is refs/tags/. - RefOrderFieldAlphabetical RefOrderField = "ALPHABETICAL" // Order refs by their alphanumeric name. -) - -// ReleaseOrderField represents properties by which release connections can be ordered. -type ReleaseOrderField string - -// Properties by which release connections can be ordered. -const ( - ReleaseOrderFieldCreatedAt ReleaseOrderField = "CREATED_AT" // Order releases by creation time. - ReleaseOrderFieldName ReleaseOrderField = "NAME" // Order releases alphabetically by name. -) - -// ReportedContentClassifiers represents the reasons a piece of content can be reported or minimized. -type ReportedContentClassifiers string - -// The reasons a piece of content can be reported or minimized. -const ( - ReportedContentClassifiersSpam ReportedContentClassifiers = "SPAM" // A spammy piece of content. - ReportedContentClassifiersAbuse ReportedContentClassifiers = "ABUSE" // An abusive or harassing piece of content. - ReportedContentClassifiersOffTopic ReportedContentClassifiers = "OFF_TOPIC" // An irrelevant piece of content. - ReportedContentClassifiersOutdated ReportedContentClassifiers = "OUTDATED" // An outdated piece of content. - ReportedContentClassifiersResolved ReportedContentClassifiers = "RESOLVED" // The content has been resolved. -) - -// RepositoryAffiliation represents the affiliation of a user to a repository. -type RepositoryAffiliation string - -// The affiliation of a user to a repository. -const ( - RepositoryAffiliationOwner RepositoryAffiliation = "OWNER" // Repositories that are owned by the authenticated user. - RepositoryAffiliationCollaborator RepositoryAffiliation = "COLLABORATOR" // Repositories that the user has been added to as a collaborator. - RepositoryAffiliationOrganizationMember RepositoryAffiliation = "ORGANIZATION_MEMBER" // Repositories that the user has access to through being a member of an organization. This includes every repository on every team that the user is on. -) - -// RepositoryCollaboratorAffiliation represents the affiliation type between collaborator and repository. -type RepositoryCollaboratorAffiliation string - -// The affiliation type between collaborator and repository. -const ( - RepositoryCollaboratorAffiliationAll RepositoryCollaboratorAffiliation = "ALL" // All collaborators of the repository. - RepositoryCollaboratorAffiliationOutside RepositoryCollaboratorAffiliation = "OUTSIDE" // All outside collaborators of an organization-owned repository. -) - -// RepositoryContributionType represents the reason a repository is listed as 'contributed'. -type RepositoryContributionType string - -// The reason a repository is listed as 'contributed'. -const ( - RepositoryContributionTypeCommit RepositoryContributionType = "COMMIT" // Created a commit. - RepositoryContributionTypeIssue RepositoryContributionType = "ISSUE" // Created an issue. - RepositoryContributionTypePullRequest RepositoryContributionType = "PULL_REQUEST" // Created a pull request. - RepositoryContributionTypeRepository RepositoryContributionType = "REPOSITORY" // Created the repository. - RepositoryContributionTypePullRequestReview RepositoryContributionType = "PULL_REQUEST_REVIEW" // Reviewed a pull request. -) - -// RepositoryLockReason represents the possible reasons a given repository could be in a locked state. -type RepositoryLockReason string - -// The possible reasons a given repository could be in a locked state. -const ( - RepositoryLockReasonMoving RepositoryLockReason = "MOVING" // The repository is locked due to a move. - RepositoryLockReasonBilling RepositoryLockReason = "BILLING" // The repository is locked due to a billing related reason. - RepositoryLockReasonRename RepositoryLockReason = "RENAME" // The repository is locked due to a rename. - RepositoryLockReasonMigrating RepositoryLockReason = "MIGRATING" // The repository is locked due to a migration. -) - -// RepositoryOrderField represents properties by which repository connections can be ordered. -type RepositoryOrderField string - -// Properties by which repository connections can be ordered. -const ( - RepositoryOrderFieldCreatedAt RepositoryOrderField = "CREATED_AT" // Order repositories by creation time. - RepositoryOrderFieldUpdatedAt RepositoryOrderField = "UPDATED_AT" // Order repositories by update time. - RepositoryOrderFieldPushedAt RepositoryOrderField = "PUSHED_AT" // Order repositories by push time. - RepositoryOrderFieldName RepositoryOrderField = "NAME" // Order repositories by name. - RepositoryOrderFieldStargazers RepositoryOrderField = "STARGAZERS" // Order repositories by number of stargazers. -) - -// RepositoryPermission represents the access level to a repository. -type RepositoryPermission string - -// The access level to a repository. -const ( - RepositoryPermissionAdmin RepositoryPermission = "ADMIN" // Can read, clone, and push to this repository. Can also manage issues, pull requests, and repository settings, including adding collaborators. - RepositoryPermissionMaintain RepositoryPermission = "MAINTAIN" // Can read, clone, and push to this repository. They can also manage issues, pull requests, and some repository settings. - RepositoryPermissionWrite RepositoryPermission = "WRITE" // Can read, clone, and push to this repository. Can also manage issues and pull requests. - RepositoryPermissionTriage RepositoryPermission = "TRIAGE" // Can read and clone this repository. Can also manage issues and pull requests. - RepositoryPermissionRead RepositoryPermission = "READ" // Can read and clone this repository. Can also open and comment on issues and pull requests. -) - -// RepositoryPrivacy represents the privacy of a repository. -type RepositoryPrivacy string - -// The privacy of a repository. -const ( - RepositoryPrivacyPublic RepositoryPrivacy = "PUBLIC" // Public. - RepositoryPrivacyPrivate RepositoryPrivacy = "PRIVATE" // Private. -) - -// SearchType represents represents the individual results of a search. -type SearchType string - -// Represents the individual results of a search. -const ( - SearchTypeIssue SearchType = "ISSUE" // Returns results matching issues in repositories. - SearchTypeRepository SearchType = "REPOSITORY" // Returns results matching repositories. - SearchTypeUser SearchType = "USER" // Returns results matching users and organizations on GitHub. -) - -// SecurityAdvisoryEcosystem represents the possible ecosystems of a security vulnerability's package. -type SecurityAdvisoryEcosystem string - -// The possible ecosystems of a security vulnerability's package. -const ( - SecurityAdvisoryEcosystemRubygems SecurityAdvisoryEcosystem = "RUBYGEMS" // Ruby gems hosted at RubyGems.org. - SecurityAdvisoryEcosystemNpm SecurityAdvisoryEcosystem = "NPM" // JavaScript packages hosted at npmjs.com. - SecurityAdvisoryEcosystemPip SecurityAdvisoryEcosystem = "PIP" // Python packages hosted at PyPI.org. - SecurityAdvisoryEcosystemMaven SecurityAdvisoryEcosystem = "MAVEN" // Java artifacts hosted at the Maven central repository. - SecurityAdvisoryEcosystemNuget SecurityAdvisoryEcosystem = "NUGET" // .NET packages hosted at the NuGet Gallery. -) - -// SecurityAdvisoryIdentifierType represents identifier formats available for advisories. -type SecurityAdvisoryIdentifierType string - -// Identifier formats available for advisories. -const ( - SecurityAdvisoryIdentifierTypeCve SecurityAdvisoryIdentifierType = "CVE" // Common Vulnerabilities and Exposures Identifier. - SecurityAdvisoryIdentifierTypeGhsa SecurityAdvisoryIdentifierType = "GHSA" // GitHub Security Advisory ID. -) - -// SecurityAdvisoryOrderField represents properties by which security advisory connections can be ordered. -type SecurityAdvisoryOrderField string - -// Properties by which security advisory connections can be ordered. -const ( - SecurityAdvisoryOrderFieldPublishedAt SecurityAdvisoryOrderField = "PUBLISHED_AT" // Order advisories by publication time. - SecurityAdvisoryOrderFieldUpdatedAt SecurityAdvisoryOrderField = "UPDATED_AT" // Order advisories by update time. -) - -// SecurityAdvisorySeverity represents severity of the vulnerability. -type SecurityAdvisorySeverity string - -// Severity of the vulnerability. -const ( - SecurityAdvisorySeverityLow SecurityAdvisorySeverity = "LOW" // Low. - SecurityAdvisorySeverityModerate SecurityAdvisorySeverity = "MODERATE" // Moderate. - SecurityAdvisorySeverityHigh SecurityAdvisorySeverity = "HIGH" // High. - SecurityAdvisorySeverityCritical SecurityAdvisorySeverity = "CRITICAL" // Critical. -) - -// SecurityVulnerabilityOrderField represents properties by which security vulnerability connections can be ordered. -type SecurityVulnerabilityOrderField string - -// Properties by which security vulnerability connections can be ordered. -const ( - SecurityVulnerabilityOrderFieldUpdatedAt SecurityVulnerabilityOrderField = "UPDATED_AT" // Order vulnerability by update time. -) - -// StarOrderField represents properties by which star connections can be ordered. -type StarOrderField string - -// Properties by which star connections can be ordered. -const ( - StarOrderFieldStarredAt StarOrderField = "STARRED_AT" // Allows ordering a list of stars by when they were created. -) - -// StatusState represents the possible commit status states. -type StatusState string - -// The possible commit status states. -const ( - StatusStateExpected StatusState = "EXPECTED" // Status is expected. - StatusStateError StatusState = "ERROR" // Status is errored. - StatusStateFailure StatusState = "FAILURE" // Status is failing. - StatusStatePending StatusState = "PENDING" // Status is pending. - StatusStateSuccess StatusState = "SUCCESS" // Status is successful. -) - -// SubscriptionState represents the possible states of a subscription. -type SubscriptionState string - -// The possible states of a subscription. -const ( - SubscriptionStateUnsubscribed SubscriptionState = "UNSUBSCRIBED" // The User is only notified when participating or @mentioned. - SubscriptionStateSubscribed SubscriptionState = "SUBSCRIBED" // The User is notified of all conversations. - SubscriptionStateIgnored SubscriptionState = "IGNORED" // The User is never notified. -) - -// TeamMemberOrderField represents properties by which team member connections can be ordered. -type TeamMemberOrderField string - -// Properties by which team member connections can be ordered. -const ( - TeamMemberOrderFieldLogin TeamMemberOrderField = "LOGIN" // Order team members by login. - TeamMemberOrderFieldCreatedAt TeamMemberOrderField = "CREATED_AT" // Order team members by creation time. -) - -// TeamMemberRole represents the possible team member roles; either 'maintainer' or 'member'. -type TeamMemberRole string - -// The possible team member roles; either 'maintainer' or 'member'. -const ( - TeamMemberRoleMaintainer TeamMemberRole = "MAINTAINER" // A team maintainer has permission to add and remove team members. - TeamMemberRoleMember TeamMemberRole = "MEMBER" // A team member has no administrative permissions on the team. -) - -// TeamMembershipType represents defines which types of team members are included in the returned list. Can be one of IMMEDIATE, CHILD_TEAM or ALL. -type TeamMembershipType string - -// Defines which types of team members are included in the returned list. Can be one of IMMEDIATE, CHILD_TEAM or ALL. -const ( - TeamMembershipTypeImmediate TeamMembershipType = "IMMEDIATE" // Includes only immediate members of the team. - TeamMembershipTypeChildTeam TeamMembershipType = "CHILD_TEAM" // Includes only child team members for the team. - TeamMembershipTypeAll TeamMembershipType = "ALL" // Includes immediate and child team members for the team. -) - -// TeamOrderField represents properties by which team connections can be ordered. -type TeamOrderField string - -// Properties by which team connections can be ordered. -const ( - TeamOrderFieldName TeamOrderField = "NAME" // Allows ordering a list of teams by name. -) - -// TeamPrivacy represents the possible team privacy values. -type TeamPrivacy string - -// The possible team privacy values. -const ( - TeamPrivacySecret TeamPrivacy = "SECRET" // A secret team can only be seen by its members. - TeamPrivacyVisible TeamPrivacy = "VISIBLE" // A visible team can be seen and @mentioned by every member of the organization. -) - -// TeamRepositoryOrderField represents properties by which team repository connections can be ordered. -type TeamRepositoryOrderField string - -// Properties by which team repository connections can be ordered. -const ( - TeamRepositoryOrderFieldCreatedAt TeamRepositoryOrderField = "CREATED_AT" // Order repositories by creation time. - TeamRepositoryOrderFieldUpdatedAt TeamRepositoryOrderField = "UPDATED_AT" // Order repositories by update time. - TeamRepositoryOrderFieldPushedAt TeamRepositoryOrderField = "PUSHED_AT" // Order repositories by push time. - TeamRepositoryOrderFieldName TeamRepositoryOrderField = "NAME" // Order repositories by name. - TeamRepositoryOrderFieldPermission TeamRepositoryOrderField = "PERMISSION" // Order repositories by permission. - TeamRepositoryOrderFieldStargazers TeamRepositoryOrderField = "STARGAZERS" // Order repositories by number of stargazers. -) - -// TeamRole represents the role of a user on a team. -type TeamRole string - -// The role of a user on a team. -const ( - TeamRoleAdmin TeamRole = "ADMIN" // User has admin rights on the team. - TeamRoleMember TeamRole = "MEMBER" // User is a member of the team. -) - -// TopicSuggestionDeclineReason represents reason that the suggested topic is declined. -type TopicSuggestionDeclineReason string - -// Reason that the suggested topic is declined. -const ( - TopicSuggestionDeclineReasonNotRelevant TopicSuggestionDeclineReason = "NOT_RELEVANT" // The suggested topic is not relevant to the repository. - TopicSuggestionDeclineReasonTooSpecific TopicSuggestionDeclineReason = "TOO_SPECIFIC" // The suggested topic is too specific for the repository (e.g. #ruby-on-rails-version-4-2-1). - TopicSuggestionDeclineReasonPersonalPreference TopicSuggestionDeclineReason = "PERSONAL_PREFERENCE" // The viewer does not like the suggested topic. - TopicSuggestionDeclineReasonTooGeneral TopicSuggestionDeclineReason = "TOO_GENERAL" // The suggested topic is too general for the repository. -) - -// UserBlockDuration represents the possible durations that a user can be blocked for. -type UserBlockDuration string - -// The possible durations that a user can be blocked for. -const ( - UserBlockDurationOneDay UserBlockDuration = "ONE_DAY" // The user was blocked for 1 day. - UserBlockDurationThreeDays UserBlockDuration = "THREE_DAYS" // The user was blocked for 3 days. - UserBlockDurationOneWeek UserBlockDuration = "ONE_WEEK" // The user was blocked for 7 days. - UserBlockDurationOneMonth UserBlockDuration = "ONE_MONTH" // The user was blocked for 30 days. - UserBlockDurationPermanent UserBlockDuration = "PERMANENT" // The user was blocked permanently. -) - -// UserStatusOrderField represents properties by which user status connections can be ordered. -type UserStatusOrderField string - -// Properties by which user status connections can be ordered. -const ( - UserStatusOrderFieldUpdatedAt UserStatusOrderField = "UPDATED_AT" // Order user statuses by when they were updated. -) diff --git a/vendor/github.com/shurcooL/githubv4/gen.go b/vendor/github.com/shurcooL/githubv4/gen.go deleted file mode 100644 index 628ce57b..00000000 --- a/vendor/github.com/shurcooL/githubv4/gen.go +++ /dev/null @@ -1,193 +0,0 @@ -// +build ignore - -package main - -import ( - "bytes" - "encoding/json" - "flag" - "fmt" - "go/format" - "io/ioutil" - "log" - "net/http" - "os" - "sort" - "strconv" - "strings" - "text/template" - - "github.com/shurcooL/graphql/ident" -) - -func main() { - flag.Parse() - - err := run() - if err != nil { - log.Fatalln(err) - } -} - -func run() error { - githubToken, ok := os.LookupEnv("GITHUB_TOKEN") - if !ok { - return fmt.Errorf("GITHUB_TOKEN environment variable not set") - } - schema, err := loadSchema(githubToken) - if err != nil { - return err - } - - for filename, t := range templates { - var buf bytes.Buffer - err := t.Execute(&buf, schema) - if err != nil { - return err - } - out, err := format.Source(buf.Bytes()) - if err != nil { - log.Println(err) - out = []byte("// gofmt error: " + err.Error() + "\n\n" + buf.String()) - } - fmt.Println("writing", filename) - err = ioutil.WriteFile(filename, out, 0644) - if err != nil { - return err - } - } - - return nil -} - -func loadSchema(githubToken string) (schema interface{}, err error) { - req, err := http.NewRequest("GET", "https://api.github.com/graphql", nil) - if err != nil { - return nil, err - } - req.Header.Set("Authorization", "bearer "+githubToken) - resp, err := http.DefaultClient.Do(req) - if err != nil { - return nil, err - } - defer resp.Body.Close() - err = json.NewDecoder(resp.Body).Decode(&schema) - return schema, err -} - -// Filename -> Template. -var templates = map[string]*template.Template{ - "enum.go": t(`// Code generated by gen.go; DO NOT EDIT. - -package githubv4 -{{range .data.__schema.types | sortByName}}{{if and (eq .kind "ENUM") (not (internal .name))}} -{{template "enum" .}} -{{end}}{{end}} - - -{{- define "enum" -}} -// {{.name}} {{.description | clean | endSentence}} -type {{.name}} string - -// {{.description | clean | fullSentence}} -const ({{range .enumValues}} - {{$.name}}{{.name | enumIdentifier}} {{$.name}} = {{.name | quote}} // {{.description | clean | fullSentence}}{{end}} -) -{{- end -}} -`), - - "input.go": t(`// Code generated by gen.go; DO NOT EDIT. - -package githubv4 - -// Input represents one of the Input structs: -// -// {{join (inputObjects .data.__schema.types) ", "}}. -type Input interface{} -{{range .data.__schema.types | sortByName}}{{if eq .kind "INPUT_OBJECT"}} -{{template "inputObject" .}} -{{end}}{{end}} - - -{{- define "inputObject" -}} -// {{.name}} {{.description | clean | endSentence}} -type {{.name}} struct {{"{"}}{{range .inputFields}}{{if eq .type.kind "NON_NULL"}} - // {{.description | clean | fullSentence}} (Required.) - {{.name | identifier}} {{.type | type}} ` + "`" + `json:"{{.name}}"` + "`" + `{{end}}{{end}} -{{range .inputFields}}{{if ne .type.kind "NON_NULL"}} - // {{.description | clean | fullSentence}} (Optional.) - {{.name | identifier}} {{.type | type}} ` + "`" + `json:"{{.name}},omitempty"` + "`" + `{{end}}{{end}} -} -{{- end -}} -`), -} - -func t(text string) *template.Template { - // typeString returns a string representation of GraphQL type t. - var typeString func(t map[string]interface{}) string - typeString = func(t map[string]interface{}) string { - switch t["kind"] { - case "NON_NULL": - s := typeString(t["ofType"].(map[string]interface{})) - if !strings.HasPrefix(s, "*") { - panic(fmt.Errorf("nullable type %q doesn't begin with '*'", s)) - } - return s[1:] // Strip star from nullable type to make it non-null. - case "LIST": - return "*[]" + typeString(t["ofType"].(map[string]interface{})) - default: - return "*" + t["name"].(string) - } - } - - return template.Must(template.New("").Funcs(template.FuncMap{ - "internal": func(s string) bool { return strings.HasPrefix(s, "__") }, - "quote": strconv.Quote, - "join": strings.Join, - "sortByName": func(types []interface{}) []interface{} { - sort.Slice(types, func(i, j int) bool { - ni := types[i].(map[string]interface{})["name"].(string) - nj := types[j].(map[string]interface{})["name"].(string) - return ni < nj - }) - return types - }, - "inputObjects": func(types []interface{}) []string { - var names []string - for _, t := range types { - t := t.(map[string]interface{}) - if t["kind"].(string) != "INPUT_OBJECT" { - continue - } - names = append(names, t["name"].(string)) - } - sort.Strings(names) - return names - }, - "identifier": func(name string) string { return ident.ParseLowerCamelCase(name).ToMixedCaps() }, - "enumIdentifier": func(name string) string { return ident.ParseScreamingSnakeCase(name).ToMixedCaps() }, - "type": typeString, - "clean": func(s string) string { return strings.Join(strings.Fields(s), " ") }, - "endSentence": func(s string) string { - s = strings.ToLower(s[0:1]) + s[1:] - switch { - default: - s = "represents " + s - case strings.HasPrefix(s, "autogenerated "): - s = "is an " + s - case strings.HasPrefix(s, "specifies "): - // Do nothing. - } - if !strings.HasSuffix(s, ".") { - s += "." - } - return s - }, - "fullSentence": func(s string) string { - if !strings.HasSuffix(s, ".") { - s += "." - } - return s - }, - }).Parse(text)) -} diff --git a/vendor/github.com/shurcooL/githubv4/githubv4.go b/vendor/github.com/shurcooL/githubv4/githubv4.go deleted file mode 100644 index 3a544bf2..00000000 --- a/vendor/github.com/shurcooL/githubv4/githubv4.go +++ /dev/null @@ -1,56 +0,0 @@ -package githubv4 - -import ( - "context" - "net/http" - - "github.com/shurcooL/graphql" -) - -// Client is a GitHub GraphQL API v4 client. -type Client struct { - client *graphql.Client -} - -// NewClient creates a new GitHub GraphQL API v4 client with the provided http.Client. -// If httpClient is nil, then http.DefaultClient is used. -// -// Note that GitHub GraphQL API v4 requires authentication, so -// the provided http.Client is expected to take care of that. -func NewClient(httpClient *http.Client) *Client { - return &Client{ - client: graphql.NewClient("https://api.github.com/graphql", httpClient), - } -} - -// NewEnterpriseClient creates a new GitHub GraphQL API v4 client for the GitHub Enterprise -// instance with the specified GraphQL endpoint URL, using the provided http.Client. -// If httpClient is nil, then http.DefaultClient is used. -// -// Note that GitHub GraphQL API v4 requires authentication, so -// the provided http.Client is expected to take care of that. -func NewEnterpriseClient(url string, httpClient *http.Client) *Client { - return &Client{ - client: graphql.NewClient(url, httpClient), - } -} - -// Query executes a single GraphQL query request, -// with a query derived from q, populating the response into it. -// q should be a pointer to struct that corresponds to the GitHub GraphQL schema. -func (c *Client) Query(ctx context.Context, q interface{}, variables map[string]interface{}) error { - return c.client.Query(ctx, q, variables) -} - -// Mutate executes a single GraphQL mutation request, -// with a mutation derived from m, populating the response into it. -// m should be a pointer to struct that corresponds to the GitHub GraphQL schema. -// Provided input will be set as a variable named "input". -func (c *Client) Mutate(ctx context.Context, m interface{}, input Input, variables map[string]interface{}) error { - if variables == nil { - variables = map[string]interface{}{"input": input} - } else { - variables["input"] = input - } - return c.client.Mutate(ctx, m, variables) -} diff --git a/vendor/github.com/shurcooL/githubv4/input.go b/vendor/github.com/shurcooL/githubv4/input.go deleted file mode 100644 index da00e3b3..00000000 --- a/vendor/github.com/shurcooL/githubv4/input.go +++ /dev/null @@ -1,1051 +0,0 @@ -// Code generated by gen.go; DO NOT EDIT. - -package githubv4 - -// Input represents one of the Input structs: -// -// AcceptTopicSuggestionInput, AddAssigneesToAssignableInput, AddCommentInput, AddLabelsToLabelableInput, AddProjectCardInput, AddProjectColumnInput, AddPullRequestReviewCommentInput, AddPullRequestReviewInput, AddReactionInput, AddStarInput, ChangeUserStatusInput, ClearLabelsFromLabelableInput, CloneProjectInput, CloseIssueInput, ClosePullRequestInput, CommitAuthor, CommitContributionOrder, ContributionOrder, ConvertProjectCardNoteToIssueInput, CreateBranchProtectionRuleInput, CreateContentAttachmentInput, CreateIssueInput, CreateProjectInput, CreatePullRequestInput, DeclineTopicSuggestionInput, DeleteBranchProtectionRuleInput, DeleteIssueCommentInput, DeleteIssueInput, DeleteProjectCardInput, DeleteProjectColumnInput, DeleteProjectInput, DeletePullRequestReviewCommentInput, DeletePullRequestReviewInput, DeploymentOrder, DismissPullRequestReviewInput, DraftPullRequestReviewComment, GistOrder, ImportProjectInput, IssueFilters, IssueOrder, LanguageOrder, LockLockableInput, MergePullRequestInput, MilestoneOrder, MinimizeCommentInput, MoveProjectCardInput, MoveProjectColumnInput, PinIssueInput, ProjectCardImport, ProjectColumnImport, ProjectOrder, PullRequestOrder, ReactionOrder, RefOrder, ReleaseOrder, RemoveAssigneesFromAssignableInput, RemoveLabelsFromLabelableInput, RemoveOutsideCollaboratorInput, RemoveReactionInput, RemoveStarInput, ReopenIssueInput, ReopenPullRequestInput, RepositoryOrder, RequestReviewsInput, ResolveReviewThreadInput, SecurityAdvisoryIdentifierFilter, SecurityAdvisoryOrder, SecurityVulnerabilityOrder, StarOrder, SubmitPullRequestReviewInput, TeamMemberOrder, TeamOrder, TeamRepositoryOrder, UnlockLockableInput, UnmarkIssueAsDuplicateInput, UnminimizeCommentInput, UnpinIssueInput, UnresolveReviewThreadInput, UpdateBranchProtectionRuleInput, UpdateIssueCommentInput, UpdateIssueInput, UpdateProjectCardInput, UpdateProjectColumnInput, UpdateProjectInput, UpdatePullRequestInput, UpdatePullRequestReviewCommentInput, UpdatePullRequestReviewInput, UpdateSubscriptionInput, UpdateTopicsInput, UserStatusOrder. -type Input interface{} - -// AcceptTopicSuggestionInput is an autogenerated input type of AcceptTopicSuggestion. -type AcceptTopicSuggestionInput struct { - // The Node ID of the repository. (Required.) - RepositoryID ID `json:"repositoryId"` - // The name of the suggested topic. (Required.) - Name String `json:"name"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// AddAssigneesToAssignableInput is an autogenerated input type of AddAssigneesToAssignable. -type AddAssigneesToAssignableInput struct { - // The id of the assignable object to add assignees to. (Required.) - AssignableID ID `json:"assignableId"` - // The id of users to add as assignees. (Required.) - AssigneeIDs []ID `json:"assigneeIds"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// AddCommentInput is an autogenerated input type of AddComment. -type AddCommentInput struct { - // The Node ID of the subject to modify. (Required.) - SubjectID ID `json:"subjectId"` - // The contents of the comment. (Required.) - Body String `json:"body"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// AddLabelsToLabelableInput is an autogenerated input type of AddLabelsToLabelable. -type AddLabelsToLabelableInput struct { - // The id of the labelable object to add labels to. (Required.) - LabelableID ID `json:"labelableId"` - // The ids of the labels to add. (Required.) - LabelIDs []ID `json:"labelIds"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// AddProjectCardInput is an autogenerated input type of AddProjectCard. -type AddProjectCardInput struct { - // The Node ID of the ProjectColumn. (Required.) - ProjectColumnID ID `json:"projectColumnId"` - - // The content of the card. Must be a member of the ProjectCardItem union. (Optional.) - ContentID *ID `json:"contentId,omitempty"` - // The note on the card. (Optional.) - Note *String `json:"note,omitempty"` - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// AddProjectColumnInput is an autogenerated input type of AddProjectColumn. -type AddProjectColumnInput struct { - // The Node ID of the project. (Required.) - ProjectID ID `json:"projectId"` - // The name of the column. (Required.) - Name String `json:"name"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// AddPullRequestReviewCommentInput is an autogenerated input type of AddPullRequestReviewComment. -type AddPullRequestReviewCommentInput struct { - // The Node ID of the review to modify. (Required.) - PullRequestReviewID ID `json:"pullRequestReviewId"` - // The text of the comment. (Required.) - Body String `json:"body"` - - // The SHA of the commit to comment on. (Optional.) - CommitOID *GitObjectID `json:"commitOID,omitempty"` - // The relative path of the file to comment on. (Optional.) - Path *String `json:"path,omitempty"` - // The line index in the diff to comment on. (Optional.) - Position *Int `json:"position,omitempty"` - // The comment id to reply to. (Optional.) - InReplyTo *ID `json:"inReplyTo,omitempty"` - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// AddPullRequestReviewInput is an autogenerated input type of AddPullRequestReview. -type AddPullRequestReviewInput struct { - // The Node ID of the pull request to modify. (Required.) - PullRequestID ID `json:"pullRequestId"` - - // The commit OID the review pertains to. (Optional.) - CommitOID *GitObjectID `json:"commitOID,omitempty"` - // The contents of the review body comment. (Optional.) - Body *String `json:"body,omitempty"` - // The event to perform on the pull request review. (Optional.) - Event *PullRequestReviewEvent `json:"event,omitempty"` - // The review line comments. (Optional.) - Comments *[]*DraftPullRequestReviewComment `json:"comments,omitempty"` - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// AddReactionInput is an autogenerated input type of AddReaction. -type AddReactionInput struct { - // The Node ID of the subject to modify. (Required.) - SubjectID ID `json:"subjectId"` - // The name of the emoji to react with. (Required.) - Content ReactionContent `json:"content"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// AddStarInput is an autogenerated input type of AddStar. -type AddStarInput struct { - // The Starrable ID to star. (Required.) - StarrableID ID `json:"starrableId"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// ChangeUserStatusInput is an autogenerated input type of ChangeUserStatus. -type ChangeUserStatusInput struct { - - // The emoji to represent your status. Can either be a native Unicode emoji or an emoji name with colons, e.g., :grinning:. (Optional.) - Emoji *String `json:"emoji,omitempty"` - // A short description of your current status. (Optional.) - Message *String `json:"message,omitempty"` - // The ID of the organization whose members will be allowed to see the status. If omitted, the status will be publicly visible. (Optional.) - OrganizationID *ID `json:"organizationId,omitempty"` - // Whether this status should indicate you are not fully available on GitHub, e.g., you are away. (Optional.) - LimitedAvailability *Boolean `json:"limitedAvailability,omitempty"` - // If set, the user status will not be shown after this date. (Optional.) - ExpiresAt *DateTime `json:"expiresAt,omitempty"` - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// ClearLabelsFromLabelableInput is an autogenerated input type of ClearLabelsFromLabelable. -type ClearLabelsFromLabelableInput struct { - // The id of the labelable object to clear the labels from. (Required.) - LabelableID ID `json:"labelableId"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// CloneProjectInput is an autogenerated input type of CloneProject. -type CloneProjectInput struct { - // The owner ID to create the project under. (Required.) - TargetOwnerID ID `json:"targetOwnerId"` - // The source project to clone. (Required.) - SourceID ID `json:"sourceId"` - // Whether or not to clone the source project's workflows. (Required.) - IncludeWorkflows Boolean `json:"includeWorkflows"` - // The name of the project. (Required.) - Name String `json:"name"` - - // The description of the project. (Optional.) - Body *String `json:"body,omitempty"` - // The visibility of the project, defaults to false (private). (Optional.) - Public *Boolean `json:"public,omitempty"` - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// CloseIssueInput is an autogenerated input type of CloseIssue. -type CloseIssueInput struct { - // ID of the issue to be closed. (Required.) - IssueID ID `json:"issueId"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// ClosePullRequestInput is an autogenerated input type of ClosePullRequest. -type ClosePullRequestInput struct { - // ID of the pull request to be closed. (Required.) - PullRequestID ID `json:"pullRequestId"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// CommitAuthor specifies an author for filtering Git commits. -type CommitAuthor struct { - - // ID of a User to filter by. If non-null, only commits authored by this user will be returned. This field takes precedence over emails. (Optional.) - ID *ID `json:"id,omitempty"` - // Email addresses to filter by. Commits authored by any of the specified email addresses will be returned. (Optional.) - Emails *[]String `json:"emails,omitempty"` -} - -// CommitContributionOrder represents ordering options for commit contribution connections. -type CommitContributionOrder struct { - // The field by which to order commit contributions. (Required.) - Field CommitContributionOrderField `json:"field"` - // The ordering direction. (Required.) - Direction OrderDirection `json:"direction"` -} - -// ContributionOrder represents ordering options for contribution connections. -type ContributionOrder struct { - // The field by which to order contributions. (Required.) - Field ContributionOrderField `json:"field"` - // The ordering direction. (Required.) - Direction OrderDirection `json:"direction"` -} - -// ConvertProjectCardNoteToIssueInput is an autogenerated input type of ConvertProjectCardNoteToIssue. -type ConvertProjectCardNoteToIssueInput struct { - // The ProjectCard ID to convert. (Required.) - ProjectCardID ID `json:"projectCardId"` - // The ID of the repository to create the issue in. (Required.) - RepositoryID ID `json:"repositoryId"` - - // The title of the newly created issue. Defaults to the card's note text. (Optional.) - Title *String `json:"title,omitempty"` - // The body of the newly created issue. (Optional.) - Body *String `json:"body,omitempty"` - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// CreateBranchProtectionRuleInput is an autogenerated input type of CreateBranchProtectionRule. -type CreateBranchProtectionRuleInput struct { - // The global relay id of the repository in which a new branch protection rule should be created in. (Required.) - RepositoryID ID `json:"repositoryId"` - // The glob-like pattern used to determine matching branches. (Required.) - Pattern String `json:"pattern"` - - // Are approving reviews required to update matching branches. (Optional.) - RequiresApprovingReviews *Boolean `json:"requiresApprovingReviews,omitempty"` - // Number of approving reviews required to update matching branches. (Optional.) - RequiredApprovingReviewCount *Int `json:"requiredApprovingReviewCount,omitempty"` - // Are commits required to be signed. (Optional.) - RequiresCommitSignatures *Boolean `json:"requiresCommitSignatures,omitempty"` - // Can admins overwrite branch protection. (Optional.) - IsAdminEnforced *Boolean `json:"isAdminEnforced,omitempty"` - // Are status checks required to update matching branches. (Optional.) - RequiresStatusChecks *Boolean `json:"requiresStatusChecks,omitempty"` - // Are branches required to be up to date before merging. (Optional.) - RequiresStrictStatusChecks *Boolean `json:"requiresStrictStatusChecks,omitempty"` - // Are reviews from code owners required to update matching branches. (Optional.) - RequiresCodeOwnerReviews *Boolean `json:"requiresCodeOwnerReviews,omitempty"` - // Will new commits pushed to matching branches dismiss pull request review approvals. (Optional.) - DismissesStaleReviews *Boolean `json:"dismissesStaleReviews,omitempty"` - // Is dismissal of pull request reviews restricted. (Optional.) - RestrictsReviewDismissals *Boolean `json:"restrictsReviewDismissals,omitempty"` - // A list of User or Team IDs allowed to dismiss reviews on pull requests targeting matching branches. (Optional.) - ReviewDismissalActorIDs *[]ID `json:"reviewDismissalActorIds,omitempty"` - // Is pushing to matching branches restricted. (Optional.) - RestrictsPushes *Boolean `json:"restrictsPushes,omitempty"` - // A list of User or Team IDs allowed to push to matching branches. (Optional.) - PushActorIDs *[]ID `json:"pushActorIds,omitempty"` - // List of required status check contexts that must pass for commits to be accepted to matching branches. (Optional.) - RequiredStatusCheckContexts *[]String `json:"requiredStatusCheckContexts,omitempty"` - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// CreateContentAttachmentInput is an autogenerated input type of CreateContentAttachment. -type CreateContentAttachmentInput struct { - // The node ID of the content_reference. (Required.) - ContentReferenceID ID `json:"contentReferenceId"` - // The title of the content attachment. (Required.) - Title String `json:"title"` - // The body of the content attachment, which may contain markdown. (Required.) - Body String `json:"body"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// CreateIssueInput is an autogenerated input type of CreateIssue. -type CreateIssueInput struct { - // The Node ID of the repository. (Required.) - RepositoryID ID `json:"repositoryId"` - // The title for the issue. (Required.) - Title String `json:"title"` - - // The body for the issue description. (Optional.) - Body *String `json:"body,omitempty"` - // The Node ID for the user assignee for this issue. (Optional.) - AssigneeIDs *[]ID `json:"assigneeIds,omitempty"` - // The Node ID of the milestone for this issue. (Optional.) - MilestoneID *ID `json:"milestoneId,omitempty"` - // An array of Node IDs of labels for this issue. (Optional.) - LabelIDs *[]ID `json:"labelIds,omitempty"` - // An array of Node IDs for projects associated with this issue. (Optional.) - ProjectIDs *[]ID `json:"projectIds,omitempty"` - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// CreateProjectInput is an autogenerated input type of CreateProject. -type CreateProjectInput struct { - // The owner ID to create the project under. (Required.) - OwnerID ID `json:"ownerId"` - // The name of project. (Required.) - Name String `json:"name"` - - // The description of project. (Optional.) - Body *String `json:"body,omitempty"` - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// CreatePullRequestInput is an autogenerated input type of CreatePullRequest. -type CreatePullRequestInput struct { - // The Node ID of the repository. (Required.) - RepositoryID ID `json:"repositoryId"` - // The name of the branch you want your changes pulled into. This should be an existing branch on the current repository. You cannot update the base branch on a pull request to point to another repository. (Required.) - BaseRefName String `json:"baseRefName"` - // The name of the branch where your changes are implemented. For cross-repository pull requests in the same network, namespace `head_ref_name` with a user like this: `username:branch`. (Required.) - HeadRefName String `json:"headRefName"` - // The title of the pull request. (Required.) - Title String `json:"title"` - - // The contents of the pull request. (Optional.) - Body *String `json:"body,omitempty"` - // Indicates whether maintainers can modify the pull request. (Optional.) - MaintainerCanModify *Boolean `json:"maintainerCanModify,omitempty"` - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// DeclineTopicSuggestionInput is an autogenerated input type of DeclineTopicSuggestion. -type DeclineTopicSuggestionInput struct { - // The Node ID of the repository. (Required.) - RepositoryID ID `json:"repositoryId"` - // The name of the suggested topic. (Required.) - Name String `json:"name"` - // The reason why the suggested topic is declined. (Required.) - Reason TopicSuggestionDeclineReason `json:"reason"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// DeleteBranchProtectionRuleInput is an autogenerated input type of DeleteBranchProtectionRule. -type DeleteBranchProtectionRuleInput struct { - // The global relay id of the branch protection rule to be deleted. (Required.) - BranchProtectionRuleID ID `json:"branchProtectionRuleId"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// DeleteIssueCommentInput is an autogenerated input type of DeleteIssueComment. -type DeleteIssueCommentInput struct { - // The ID of the comment to delete. (Required.) - ID ID `json:"id"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// DeleteIssueInput is an autogenerated input type of DeleteIssue. -type DeleteIssueInput struct { - // The ID of the issue to delete. (Required.) - IssueID ID `json:"issueId"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// DeleteProjectCardInput is an autogenerated input type of DeleteProjectCard. -type DeleteProjectCardInput struct { - // The id of the card to delete. (Required.) - CardID ID `json:"cardId"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// DeleteProjectColumnInput is an autogenerated input type of DeleteProjectColumn. -type DeleteProjectColumnInput struct { - // The id of the column to delete. (Required.) - ColumnID ID `json:"columnId"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// DeleteProjectInput is an autogenerated input type of DeleteProject. -type DeleteProjectInput struct { - // The Project ID to update. (Required.) - ProjectID ID `json:"projectId"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// DeletePullRequestReviewCommentInput is an autogenerated input type of DeletePullRequestReviewComment. -type DeletePullRequestReviewCommentInput struct { - // The ID of the comment to delete. (Required.) - ID ID `json:"id"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// DeletePullRequestReviewInput is an autogenerated input type of DeletePullRequestReview. -type DeletePullRequestReviewInput struct { - // The Node ID of the pull request review to delete. (Required.) - PullRequestReviewID ID `json:"pullRequestReviewId"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// DeploymentOrder represents ordering options for deployment connections. -type DeploymentOrder struct { - // The field to order deployments by. (Required.) - Field DeploymentOrderField `json:"field"` - // The ordering direction. (Required.) - Direction OrderDirection `json:"direction"` -} - -// DismissPullRequestReviewInput is an autogenerated input type of DismissPullRequestReview. -type DismissPullRequestReviewInput struct { - // The Node ID of the pull request review to modify. (Required.) - PullRequestReviewID ID `json:"pullRequestReviewId"` - // The contents of the pull request review dismissal message. (Required.) - Message String `json:"message"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// DraftPullRequestReviewComment specifies a review comment to be left with a Pull Request Review. -type DraftPullRequestReviewComment struct { - // Path to the file being commented on. (Required.) - Path String `json:"path"` - // Position in the file to leave a comment on. (Required.) - Position Int `json:"position"` - // Body of the comment to leave. (Required.) - Body String `json:"body"` -} - -// GistOrder represents ordering options for gist connections. -type GistOrder struct { - // The field to order repositories by. (Required.) - Field GistOrderField `json:"field"` - // The ordering direction. (Required.) - Direction OrderDirection `json:"direction"` -} - -// ImportProjectInput is an autogenerated input type of ImportProject. -type ImportProjectInput struct { - // The name of the Organization or User to create the Project under. (Required.) - OwnerName String `json:"ownerName"` - // The name of Project. (Required.) - Name String `json:"name"` - // A list of columns containing issues and pull requests. (Required.) - ColumnImports []ProjectColumnImport `json:"columnImports"` - - // The description of Project. (Optional.) - Body *String `json:"body,omitempty"` - // Whether the Project is public or not. (Optional.) - Public *Boolean `json:"public,omitempty"` - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// IssueFilters represents ways in which to filter lists of issues. -type IssueFilters struct { - - // List issues assigned to given name. Pass in `null` for issues with no assigned user, and `*` for issues assigned to any user. (Optional.) - Assignee *String `json:"assignee,omitempty"` - // List issues created by given name. (Optional.) - CreatedBy *String `json:"createdBy,omitempty"` - // List issues where the list of label names exist on the issue. (Optional.) - Labels *[]String `json:"labels,omitempty"` - // List issues where the given name is mentioned in the issue. (Optional.) - Mentioned *String `json:"mentioned,omitempty"` - // List issues by given milestone argument. If an string representation of an integer is passed, it should refer to a milestone by its number field. Pass in `null` for issues with no milestone, and `*` for issues that are assigned to any milestone. (Optional.) - Milestone *String `json:"milestone,omitempty"` - // List issues that have been updated at or after the given date. (Optional.) - Since *DateTime `json:"since,omitempty"` - // List issues filtered by the list of states given. (Optional.) - States *[]IssueState `json:"states,omitempty"` - // List issues subscribed to by viewer. (Optional.) - ViewerSubscribed *Boolean `json:"viewerSubscribed,omitempty"` -} - -// IssueOrder represents ways in which lists of issues can be ordered upon return. -type IssueOrder struct { - // The field in which to order issues by. (Required.) - Field IssueOrderField `json:"field"` - // The direction in which to order issues by the specified field. (Required.) - Direction OrderDirection `json:"direction"` -} - -// LanguageOrder represents ordering options for language connections. -type LanguageOrder struct { - // The field to order languages by. (Required.) - Field LanguageOrderField `json:"field"` - // The ordering direction. (Required.) - Direction OrderDirection `json:"direction"` -} - -// LockLockableInput is an autogenerated input type of LockLockable. -type LockLockableInput struct { - // ID of the issue or pull request to be locked. (Required.) - LockableID ID `json:"lockableId"` - - // A reason for why the issue or pull request will be locked. (Optional.) - LockReason *LockReason `json:"lockReason,omitempty"` - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// MergePullRequestInput is an autogenerated input type of MergePullRequest. -type MergePullRequestInput struct { - // ID of the pull request to be merged. (Required.) - PullRequestID ID `json:"pullRequestId"` - - // Commit headline to use for the merge commit; if omitted, a default message will be used. (Optional.) - CommitHeadline *String `json:"commitHeadline,omitempty"` - // Commit body to use for the merge commit; if omitted, a default message will be used. (Optional.) - CommitBody *String `json:"commitBody,omitempty"` - // OID that the pull request head ref must match to allow merge; if omitted, no check is performed. (Optional.) - ExpectedHeadOid *GitObjectID `json:"expectedHeadOid,omitempty"` - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// MilestoneOrder represents ordering options for milestone connections. -type MilestoneOrder struct { - // The field to order milestones by. (Required.) - Field MilestoneOrderField `json:"field"` - // The ordering direction. (Required.) - Direction OrderDirection `json:"direction"` -} - -// MinimizeCommentInput is an autogenerated input type of MinimizeComment. -type MinimizeCommentInput struct { - // The Node ID of the subject to modify. (Required.) - SubjectID ID `json:"subjectId"` - // The classification of comment. (Required.) - Classifier ReportedContentClassifiers `json:"classifier"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// MoveProjectCardInput is an autogenerated input type of MoveProjectCard. -type MoveProjectCardInput struct { - // The id of the card to move. (Required.) - CardID ID `json:"cardId"` - // The id of the column to move it into. (Required.) - ColumnID ID `json:"columnId"` - - // Place the new card after the card with this id. Pass null to place it at the top. (Optional.) - AfterCardID *ID `json:"afterCardId,omitempty"` - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// MoveProjectColumnInput is an autogenerated input type of MoveProjectColumn. -type MoveProjectColumnInput struct { - // The id of the column to move. (Required.) - ColumnID ID `json:"columnId"` - - // Place the new column after the column with this id. Pass null to place it at the front. (Optional.) - AfterColumnID *ID `json:"afterColumnId,omitempty"` - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// PinIssueInput is an autogenerated input type of PinIssue. -type PinIssueInput struct { - // The ID of the issue to be pinned. (Required.) - IssueID ID `json:"issueId"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// ProjectCardImport represents an issue or PR and its owning repository to be used in a project card. -type ProjectCardImport struct { - // Repository name with owner (owner/repository). (Required.) - Repository String `json:"repository"` - // The issue or pull request number. (Required.) - Number Int `json:"number"` -} - -// ProjectColumnImport represents a project column and a list of its issues and PRs. -type ProjectColumnImport struct { - // The name of the column. (Required.) - ColumnName String `json:"columnName"` - // The position of the column, starting from 0. (Required.) - Position Int `json:"position"` - - // A list of issues and pull requests in the column. (Optional.) - Issues *[]ProjectCardImport `json:"issues,omitempty"` -} - -// ProjectOrder represents ways in which lists of projects can be ordered upon return. -type ProjectOrder struct { - // The field in which to order projects by. (Required.) - Field ProjectOrderField `json:"field"` - // The direction in which to order projects by the specified field. (Required.) - Direction OrderDirection `json:"direction"` -} - -// PullRequestOrder represents ways in which lists of issues can be ordered upon return. -type PullRequestOrder struct { - // The field in which to order pull requests by. (Required.) - Field PullRequestOrderField `json:"field"` - // The direction in which to order pull requests by the specified field. (Required.) - Direction OrderDirection `json:"direction"` -} - -// ReactionOrder represents ways in which lists of reactions can be ordered upon return. -type ReactionOrder struct { - // The field in which to order reactions by. (Required.) - Field ReactionOrderField `json:"field"` - // The direction in which to order reactions by the specified field. (Required.) - Direction OrderDirection `json:"direction"` -} - -// RefOrder represents ways in which lists of git refs can be ordered upon return. -type RefOrder struct { - // The field in which to order refs by. (Required.) - Field RefOrderField `json:"field"` - // The direction in which to order refs by the specified field. (Required.) - Direction OrderDirection `json:"direction"` -} - -// ReleaseOrder represents ways in which lists of releases can be ordered upon return. -type ReleaseOrder struct { - // The field in which to order releases by. (Required.) - Field ReleaseOrderField `json:"field"` - // The direction in which to order releases by the specified field. (Required.) - Direction OrderDirection `json:"direction"` -} - -// RemoveAssigneesFromAssignableInput is an autogenerated input type of RemoveAssigneesFromAssignable. -type RemoveAssigneesFromAssignableInput struct { - // The id of the assignable object to remove assignees from. (Required.) - AssignableID ID `json:"assignableId"` - // The id of users to remove as assignees. (Required.) - AssigneeIDs []ID `json:"assigneeIds"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// RemoveLabelsFromLabelableInput is an autogenerated input type of RemoveLabelsFromLabelable. -type RemoveLabelsFromLabelableInput struct { - // The id of the Labelable to remove labels from. (Required.) - LabelableID ID `json:"labelableId"` - // The ids of labels to remove. (Required.) - LabelIDs []ID `json:"labelIds"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// RemoveOutsideCollaboratorInput is an autogenerated input type of RemoveOutsideCollaborator. -type RemoveOutsideCollaboratorInput struct { - // The ID of the outside collaborator to remove. (Required.) - UserID ID `json:"userId"` - // The ID of the organization to remove the outside collaborator from. (Required.) - OrganizationID ID `json:"organizationId"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// RemoveReactionInput is an autogenerated input type of RemoveReaction. -type RemoveReactionInput struct { - // The Node ID of the subject to modify. (Required.) - SubjectID ID `json:"subjectId"` - // The name of the emoji reaction to remove. (Required.) - Content ReactionContent `json:"content"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// RemoveStarInput is an autogenerated input type of RemoveStar. -type RemoveStarInput struct { - // The Starrable ID to unstar. (Required.) - StarrableID ID `json:"starrableId"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// ReopenIssueInput is an autogenerated input type of ReopenIssue. -type ReopenIssueInput struct { - // ID of the issue to be opened. (Required.) - IssueID ID `json:"issueId"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// ReopenPullRequestInput is an autogenerated input type of ReopenPullRequest. -type ReopenPullRequestInput struct { - // ID of the pull request to be reopened. (Required.) - PullRequestID ID `json:"pullRequestId"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// RepositoryOrder represents ordering options for repository connections. -type RepositoryOrder struct { - // The field to order repositories by. (Required.) - Field RepositoryOrderField `json:"field"` - // The ordering direction. (Required.) - Direction OrderDirection `json:"direction"` -} - -// RequestReviewsInput is an autogenerated input type of RequestReviews. -type RequestReviewsInput struct { - // The Node ID of the pull request to modify. (Required.) - PullRequestID ID `json:"pullRequestId"` - - // The Node IDs of the user to request. (Optional.) - UserIDs *[]ID `json:"userIds,omitempty"` - // The Node IDs of the team to request. (Optional.) - TeamIDs *[]ID `json:"teamIds,omitempty"` - // Add users to the set rather than replace. (Optional.) - Union *Boolean `json:"union,omitempty"` - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// ResolveReviewThreadInput is an autogenerated input type of ResolveReviewThread. -type ResolveReviewThreadInput struct { - // The ID of the thread to resolve. (Required.) - ThreadID ID `json:"threadId"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// SecurityAdvisoryIdentifierFilter represents an advisory identifier to filter results on. -type SecurityAdvisoryIdentifierFilter struct { - // The identifier type. (Required.) - Type SecurityAdvisoryIdentifierType `json:"type"` - // The identifier string. Supports exact or partial matching. (Required.) - Value String `json:"value"` -} - -// SecurityAdvisoryOrder represents ordering options for security advisory connections. -type SecurityAdvisoryOrder struct { - // The field to order security advisories by. (Required.) - Field SecurityAdvisoryOrderField `json:"field"` - // The ordering direction. (Required.) - Direction OrderDirection `json:"direction"` -} - -// SecurityVulnerabilityOrder represents ordering options for security vulnerability connections. -type SecurityVulnerabilityOrder struct { - // The field to order security vulnerabilities by. (Required.) - Field SecurityVulnerabilityOrderField `json:"field"` - // The ordering direction. (Required.) - Direction OrderDirection `json:"direction"` -} - -// StarOrder represents ways in which star connections can be ordered. -type StarOrder struct { - // The field in which to order nodes by. (Required.) - Field StarOrderField `json:"field"` - // The direction in which to order nodes. (Required.) - Direction OrderDirection `json:"direction"` -} - -// SubmitPullRequestReviewInput is an autogenerated input type of SubmitPullRequestReview. -type SubmitPullRequestReviewInput struct { - // The Pull Request Review ID to submit. (Required.) - PullRequestReviewID ID `json:"pullRequestReviewId"` - // The event to send to the Pull Request Review. (Required.) - Event PullRequestReviewEvent `json:"event"` - - // The text field to set on the Pull Request Review. (Optional.) - Body *String `json:"body,omitempty"` - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// TeamMemberOrder represents ordering options for team member connections. -type TeamMemberOrder struct { - // The field to order team members by. (Required.) - Field TeamMemberOrderField `json:"field"` - // The ordering direction. (Required.) - Direction OrderDirection `json:"direction"` -} - -// TeamOrder represents ways in which team connections can be ordered. -type TeamOrder struct { - // The field in which to order nodes by. (Required.) - Field TeamOrderField `json:"field"` - // The direction in which to order nodes. (Required.) - Direction OrderDirection `json:"direction"` -} - -// TeamRepositoryOrder represents ordering options for team repository connections. -type TeamRepositoryOrder struct { - // The field to order repositories by. (Required.) - Field TeamRepositoryOrderField `json:"field"` - // The ordering direction. (Required.) - Direction OrderDirection `json:"direction"` -} - -// UnlockLockableInput is an autogenerated input type of UnlockLockable. -type UnlockLockableInput struct { - // ID of the issue or pull request to be unlocked. (Required.) - LockableID ID `json:"lockableId"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// UnmarkIssueAsDuplicateInput is an autogenerated input type of UnmarkIssueAsDuplicate. -type UnmarkIssueAsDuplicateInput struct { - // ID of the issue or pull request currently marked as a duplicate. (Required.) - DuplicateID ID `json:"duplicateId"` - // ID of the issue or pull request currently considered canonical/authoritative/original. (Required.) - CanonicalID ID `json:"canonicalId"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// UnminimizeCommentInput is an autogenerated input type of UnminimizeComment. -type UnminimizeCommentInput struct { - // The Node ID of the subject to modify. (Required.) - SubjectID ID `json:"subjectId"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// UnpinIssueInput is an autogenerated input type of UnpinIssue. -type UnpinIssueInput struct { - // The ID of the issue to be unpinned. (Required.) - IssueID ID `json:"issueId"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// UnresolveReviewThreadInput is an autogenerated input type of UnresolveReviewThread. -type UnresolveReviewThreadInput struct { - // The ID of the thread to unresolve. (Required.) - ThreadID ID `json:"threadId"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// UpdateBranchProtectionRuleInput is an autogenerated input type of UpdateBranchProtectionRule. -type UpdateBranchProtectionRuleInput struct { - // The global relay id of the branch protection rule to be updated. (Required.) - BranchProtectionRuleID ID `json:"branchProtectionRuleId"` - - // The glob-like pattern used to determine matching branches. (Optional.) - Pattern *String `json:"pattern,omitempty"` - // Are approving reviews required to update matching branches. (Optional.) - RequiresApprovingReviews *Boolean `json:"requiresApprovingReviews,omitempty"` - // Number of approving reviews required to update matching branches. (Optional.) - RequiredApprovingReviewCount *Int `json:"requiredApprovingReviewCount,omitempty"` - // Are commits required to be signed. (Optional.) - RequiresCommitSignatures *Boolean `json:"requiresCommitSignatures,omitempty"` - // Can admins overwrite branch protection. (Optional.) - IsAdminEnforced *Boolean `json:"isAdminEnforced,omitempty"` - // Are status checks required to update matching branches. (Optional.) - RequiresStatusChecks *Boolean `json:"requiresStatusChecks,omitempty"` - // Are branches required to be up to date before merging. (Optional.) - RequiresStrictStatusChecks *Boolean `json:"requiresStrictStatusChecks,omitempty"` - // Are reviews from code owners required to update matching branches. (Optional.) - RequiresCodeOwnerReviews *Boolean `json:"requiresCodeOwnerReviews,omitempty"` - // Will new commits pushed to matching branches dismiss pull request review approvals. (Optional.) - DismissesStaleReviews *Boolean `json:"dismissesStaleReviews,omitempty"` - // Is dismissal of pull request reviews restricted. (Optional.) - RestrictsReviewDismissals *Boolean `json:"restrictsReviewDismissals,omitempty"` - // A list of User or Team IDs allowed to dismiss reviews on pull requests targeting matching branches. (Optional.) - ReviewDismissalActorIDs *[]ID `json:"reviewDismissalActorIds,omitempty"` - // Is pushing to matching branches restricted. (Optional.) - RestrictsPushes *Boolean `json:"restrictsPushes,omitempty"` - // A list of User or Team IDs allowed to push to matching branches. (Optional.) - PushActorIDs *[]ID `json:"pushActorIds,omitempty"` - // List of required status check contexts that must pass for commits to be accepted to matching branches. (Optional.) - RequiredStatusCheckContexts *[]String `json:"requiredStatusCheckContexts,omitempty"` - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// UpdateIssueCommentInput is an autogenerated input type of UpdateIssueComment. -type UpdateIssueCommentInput struct { - // The ID of the IssueComment to modify. (Required.) - ID ID `json:"id"` - // The updated text of the comment. (Required.) - Body String `json:"body"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// UpdateIssueInput is an autogenerated input type of UpdateIssue. -type UpdateIssueInput struct { - // The ID of the Issue to modify. (Required.) - ID ID `json:"id"` - - // The title for the issue. (Optional.) - Title *String `json:"title,omitempty"` - // The body for the issue description. (Optional.) - Body *String `json:"body,omitempty"` - // An array of Node IDs of users for this issue. (Optional.) - AssigneeIDs *[]ID `json:"assigneeIds,omitempty"` - // The Node ID of the milestone for this issue. (Optional.) - MilestoneID *ID `json:"milestoneId,omitempty"` - // An array of Node IDs of labels for this issue. (Optional.) - LabelIDs *[]ID `json:"labelIds,omitempty"` - // The desired issue state. (Optional.) - State *IssueState `json:"state,omitempty"` - // An array of Node IDs for projects associated with this issue. (Optional.) - ProjectIDs *[]ID `json:"projectIds,omitempty"` - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// UpdateProjectCardInput is an autogenerated input type of UpdateProjectCard. -type UpdateProjectCardInput struct { - // The ProjectCard ID to update. (Required.) - ProjectCardID ID `json:"projectCardId"` - - // Whether or not the ProjectCard should be archived. (Optional.) - IsArchived *Boolean `json:"isArchived,omitempty"` - // The note of ProjectCard. (Optional.) - Note *String `json:"note,omitempty"` - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// UpdateProjectColumnInput is an autogenerated input type of UpdateProjectColumn. -type UpdateProjectColumnInput struct { - // The ProjectColumn ID to update. (Required.) - ProjectColumnID ID `json:"projectColumnId"` - // The name of project column. (Required.) - Name String `json:"name"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// UpdateProjectInput is an autogenerated input type of UpdateProject. -type UpdateProjectInput struct { - // The Project ID to update. (Required.) - ProjectID ID `json:"projectId"` - - // The name of project. (Optional.) - Name *String `json:"name,omitempty"` - // The description of project. (Optional.) - Body *String `json:"body,omitempty"` - // Whether the project is open or closed. (Optional.) - State *ProjectState `json:"state,omitempty"` - // Whether the project is public or not. (Optional.) - Public *Boolean `json:"public,omitempty"` - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// UpdatePullRequestInput is an autogenerated input type of UpdatePullRequest. -type UpdatePullRequestInput struct { - // The Node ID of the pull request. (Required.) - PullRequestID ID `json:"pullRequestId"` - - // The name of the branch you want your changes pulled into. This should be an existing branch on the current repository. (Optional.) - BaseRefName *String `json:"baseRefName,omitempty"` - // The title of the pull request. (Optional.) - Title *String `json:"title,omitempty"` - // The contents of the pull request. (Optional.) - Body *String `json:"body,omitempty"` - // Indicates whether maintainers can modify the pull request. (Optional.) - MaintainerCanModify *Boolean `json:"maintainerCanModify,omitempty"` - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// UpdatePullRequestReviewCommentInput is an autogenerated input type of UpdatePullRequestReviewComment. -type UpdatePullRequestReviewCommentInput struct { - // The Node ID of the comment to modify. (Required.) - PullRequestReviewCommentID ID `json:"pullRequestReviewCommentId"` - // The text of the comment. (Required.) - Body String `json:"body"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// UpdatePullRequestReviewInput is an autogenerated input type of UpdatePullRequestReview. -type UpdatePullRequestReviewInput struct { - // The Node ID of the pull request review to modify. (Required.) - PullRequestReviewID ID `json:"pullRequestReviewId"` - // The contents of the pull request review body. (Required.) - Body String `json:"body"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// UpdateSubscriptionInput is an autogenerated input type of UpdateSubscription. -type UpdateSubscriptionInput struct { - // The Node ID of the subscribable object to modify. (Required.) - SubscribableID ID `json:"subscribableId"` - // The new state of the subscription. (Required.) - State SubscriptionState `json:"state"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// UpdateTopicsInput is an autogenerated input type of UpdateTopics. -type UpdateTopicsInput struct { - // The Node ID of the repository. (Required.) - RepositoryID ID `json:"repositoryId"` - // An array of topic names. (Required.) - TopicNames []String `json:"topicNames"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - -// UserStatusOrder represents ordering options for user status connections. -type UserStatusOrder struct { - // The field to order user statuses by. (Required.) - Field UserStatusOrderField `json:"field"` - // The ordering direction. (Required.) - Direction OrderDirection `json:"direction"` -} diff --git a/vendor/github.com/shurcooL/githubv4/scalar.go b/vendor/github.com/shurcooL/githubv4/scalar.go deleted file mode 100644 index 56a39530..00000000 --- a/vendor/github.com/shurcooL/githubv4/scalar.go +++ /dev/null @@ -1,139 +0,0 @@ -package githubv4 - -import ( - "crypto/x509" - "encoding/json" - "fmt" - "net/url" - "time" - - "github.com/shurcooL/graphql" -) - -// Note: These custom types are meant to be used in queries for now. -// But the plan is to switch to using native Go types (string, int, bool, time.Time, etc.). -// See https://github.com/shurcooL/githubv4/issues/9 for details. -// -// These custom types currently provide documentation, and their use -// is required for sending outbound queries. However, native Go types -// can be used for unmarshaling. Once https://github.com/shurcooL/githubv4/issues/9 -// is resolved, native Go types can completely replace these. - -type ( - // Boolean represents true or false values. - Boolean graphql.Boolean - - // Date is an ISO-8601 encoded date. - Date struct{ time.Time } - - // DateTime is an ISO-8601 encoded UTC date. - DateTime struct{ time.Time } - - // Float represents signed double-precision fractional values as - // specified by IEEE 754. - Float graphql.Float - - // GitObjectID is a Git object ID. For example, - // "912ec1990bd09f8fc128c3fa6b59105085aabc03". - GitObjectID string - - // GitTimestamp is an ISO-8601 encoded date. - // Unlike the DateTime type, GitTimestamp is not converted in UTC. - GitTimestamp struct{ time.Time } - - // HTML is a string containing HTML code. - HTML string - - // ID represents a unique identifier that is Base64 obfuscated. It - // is often used to refetch an object or as key for a cache. The ID - // type appears in a JSON response as a String; however, it is not - // intended to be human-readable. When expected as an input type, - // any string (such as "VXNlci0xMA==") or integer (such as 4) input - // value will be accepted as an ID. - ID graphql.ID - - // Int represents non-fractional signed whole numeric values. - // Int can represent values between -(2^31) and 2^31 - 1. - Int graphql.Int - - // String represents textual data as UTF-8 character sequences. - // This type is most often used by GraphQL to represent free-form - // human-readable text. - String graphql.String - - // URI is an RFC 3986, RFC 3987, and RFC 6570 (level 4) compliant URI. - URI struct{ *url.URL } - - // X509Certificate is a valid x509 certificate. - X509Certificate struct{ *x509.Certificate } -) - -// MarshalJSON implements the json.Marshaler interface. -// The URI is a quoted string. -func (u URI) MarshalJSON() ([]byte, error) { - return json.Marshal(u.String()) -} - -// UnmarshalJSON implements the json.Unmarshaler interface. -// The URI is expected to be a quoted string. -func (u *URI) UnmarshalJSON(data []byte) error { - // Ignore null, like in the main JSON package. - if string(data) == "null" { - return nil - } - var s string - err := json.Unmarshal(data, &s) - if err != nil { - return err - } - u.URL, err = url.Parse(s) - return err -} - -// MarshalJSON implements the json.Marshaler interface. -func (x X509Certificate) MarshalJSON() ([]byte, error) { - // TODO: Implement. - return nil, fmt.Errorf("X509Certificate.MarshalJSON: not implemented") -} - -// UnmarshalJSON implements the json.Unmarshaler interface. -func (x *X509Certificate) UnmarshalJSON(data []byte) error { - // TODO: Implement. - return fmt.Errorf("X509Certificate.UnmarshalJSON: not implemented") -} - -// NewBoolean is a helper to make a new *Boolean. -func NewBoolean(v Boolean) *Boolean { return &v } - -// NewDate is a helper to make a new *Date. -func NewDate(v Date) *Date { return &v } - -// NewDateTime is a helper to make a new *DateTime. -func NewDateTime(v DateTime) *DateTime { return &v } - -// NewFloat is a helper to make a new *Float. -func NewFloat(v Float) *Float { return &v } - -// NewGitObjectID is a helper to make a new *GitObjectID. -func NewGitObjectID(v GitObjectID) *GitObjectID { return &v } - -// NewGitTimestamp is a helper to make a new *GitTimestamp. -func NewGitTimestamp(v GitTimestamp) *GitTimestamp { return &v } - -// NewHTML is a helper to make a new *HTML. -func NewHTML(v HTML) *HTML { return &v } - -// NewID is a helper to make a new *ID. -func NewID(v ID) *ID { return &v } - -// NewInt is a helper to make a new *Int. -func NewInt(v Int) *Int { return &v } - -// NewString is a helper to make a new *String. -func NewString(v String) *String { return &v } - -// NewURI is a helper to make a new *URI. -func NewURI(v URI) *URI { return &v } - -// NewX509Certificate is a helper to make a new *X509Certificate. -func NewX509Certificate(v X509Certificate) *X509Certificate { return &v } diff --git a/vendor/github.com/shurcooL/go/browser/LICENSE b/vendor/github.com/shurcooL/go/browser/LICENSE deleted file mode 100644 index 6a66aea5..00000000 --- a/vendor/github.com/shurcooL/go/browser/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/shurcooL/go/ctxhttp/ctxhttp.go b/vendor/github.com/shurcooL/go/ctxhttp/ctxhttp.go deleted file mode 100644 index 3cf40a26..00000000 --- a/vendor/github.com/shurcooL/go/ctxhttp/ctxhttp.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.7 - -// Package ctxhttp provides helper functions for performing context-aware HTTP requests. -// -// It's a copy of "golang.org/x/net/context/ctxhttp" with pre-1.7 support dropped, -// and "golang.org/x/net/context" import replaced with "context". -// It exists temporarily until "golang.org/x/net/context/ctxhttp" is updated, -// which will happen "in a couple releases" according to https://golang.org/cl/24620. -package ctxhttp - -import ( - "context" - "io" - "net/http" - "net/url" - "strings" -) - -// Do sends an HTTP request with the provided http.Client and returns -// an HTTP response. -// -// If the client is nil, http.DefaultClient is used. -// -// The provided ctx must be non-nil. If it is canceled or times out, -// ctx.Err() will be returned. -func Do(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error) { - if client == nil { - client = http.DefaultClient - } - resp, err := client.Do(req.WithContext(ctx)) - // If we got an error, and the context has been canceled, - // the context's error is probably more useful. - if err != nil { - select { - case <-ctx.Done(): - err = ctx.Err() - default: - } - } - return resp, err -} - -// Get issues a GET request via the Do function. -func Get(ctx context.Context, client *http.Client, url string) (*http.Response, error) { - req, err := http.NewRequest("GET", url, nil) - if err != nil { - return nil, err - } - return Do(ctx, client, req) -} - -// Head issues a HEAD request via the Do function. -func Head(ctx context.Context, client *http.Client, url string) (*http.Response, error) { - req, err := http.NewRequest("HEAD", url, nil) - if err != nil { - return nil, err - } - return Do(ctx, client, req) -} - -// Post issues a POST request via the Do function. -func Post(ctx context.Context, client *http.Client, url string, bodyType string, body io.Reader) (*http.Response, error) { - req, err := http.NewRequest("POST", url, body) - if err != nil { - return nil, err - } - req.Header.Set("Content-Type", bodyType) - return Do(ctx, client, req) -} - -// PostForm issues a POST request via the Do function. -func PostForm(ctx context.Context, client *http.Client, url string, data url.Values) (*http.Response, error) { - return Post(ctx, client, url, "application/x-www-form-urlencoded", strings.NewReader(data.Encode())) -} diff --git a/vendor/github.com/shurcooL/graphql/.travis.yml b/vendor/github.com/shurcooL/graphql/.travis.yml deleted file mode 100644 index 93b1fcdb..00000000 --- a/vendor/github.com/shurcooL/graphql/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -sudo: false -language: go -go: - - 1.x - - master -matrix: - allow_failures: - - go: master - fast_finish: true -install: - - # Do nothing. This is needed to prevent default install action "go get -t -v ./..." from happening here (we want it to happen inside script step). -script: - - go get -t -v ./... - - diff -u <(echo -n) <(gofmt -d -s .) - - go tool vet . - - go test -v -race ./... diff --git a/vendor/github.com/shurcooL/graphql/LICENSE b/vendor/github.com/shurcooL/graphql/LICENSE deleted file mode 100644 index ca4c7764..00000000 --- a/vendor/github.com/shurcooL/graphql/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 Dmitri Shuralyov - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/shurcooL/graphql/README.md b/vendor/github.com/shurcooL/graphql/README.md deleted file mode 100644 index 6fa03bd4..00000000 --- a/vendor/github.com/shurcooL/graphql/README.md +++ /dev/null @@ -1,293 +0,0 @@ -graphql -======= - -[![Build Status](https://travis-ci.org/shurcooL/graphql.svg?branch=master)](https://travis-ci.org/shurcooL/graphql) [![GoDoc](https://godoc.org/github.com/shurcooL/graphql?status.svg)](https://godoc.org/github.com/shurcooL/graphql) - -Package `graphql` provides a GraphQL client implementation. - -For more information, see package [`github.com/shurcooL/githubv4`](https://github.com/shurcooL/githubv4), which is a specialized version targeting GitHub GraphQL API v4. That package is driving the feature development. - -**Status:** In active early research and development. The API will change when opportunities for improvement are discovered; it is not yet frozen. - -Installation ------------- - -`graphql` requires Go version 1.8 or later. - -```bash -go get -u github.com/shurcooL/graphql -``` - -Usage ------ - -Construct a GraphQL client, specifying the GraphQL server URL. Then, you can use it to make GraphQL queries and mutations. - -```Go -client := graphql.NewClient("https://example.com/graphql", nil) -// Use client... -``` - -### Authentication - -Some GraphQL servers may require authentication. The `graphql` package does not directly handle authentication. Instead, when creating a new client, you're expected to pass an `http.Client` that performs authentication. The easiest and recommended way to do this is to use the [`golang.org/x/oauth2`](https://golang.org/x/oauth2) package. You'll need an OAuth token with the right scopes. Then: - -```Go -import "golang.org/x/oauth2" - -func main() { - src := oauth2.StaticTokenSource( - &oauth2.Token{AccessToken: os.Getenv("GRAPHQL_TOKEN")}, - ) - httpClient := oauth2.NewClient(context.Background(), src) - - client := graphql.NewClient("https://example.com/graphql", httpClient) - // Use client... -``` - -### Simple Query - -To make a GraphQL query, you need to define a corresponding Go type. - -For example, to make the following GraphQL query: - -```GraphQL -query { - me { - name - } -} -``` - -You can define this variable: - -```Go -var query struct { - Me struct { - Name graphql.String - } -} -``` - -Then call `client.Query`, passing a pointer to it: - -```Go -err := client.Query(context.Background(), &query, nil) -if err != nil { - // Handle error. -} -fmt.Println(query.Me.Name) - -// Output: Luke Skywalker -``` - -### Arguments and Variables - -Often, you'll want to specify arguments on some fields. You can use the `graphql` struct field tag for this. - -For example, to make the following GraphQL query: - -```GraphQL -{ - human(id: "1000") { - name - height(unit: METER) - } -} -``` - -You can define this variable: - -```Go -var q struct { - Human struct { - Name graphql.String - Height graphql.Float `graphql:"height(unit: METER)"` - } `graphql:"human(id: \"1000\")"` -} -``` - -Then call `client.Query`: - -```Go -err := client.Query(context.Background(), &q, nil) -if err != nil { - // Handle error. -} -fmt.Println(q.Human.Name) -fmt.Println(q.Human.Height) - -// Output: -// Luke Skywalker -// 1.72 -``` - -However, that'll only work if the arguments are constant and known in advance. Otherwise, you will need to make use of variables. Replace the constants in the struct field tag with variable names: - -```Go -var q struct { - Human struct { - Name graphql.String - Height graphql.Float `graphql:"height(unit: $unit)"` - } `graphql:"human(id: $id)"` -} -``` - -Then, define a `variables` map with their values: - -```Go -variables := map[string]interface{}{ - "id": graphql.ID(id), - "unit": starwars.LengthUnit("METER"), -} -``` - -Finally, call `client.Query` providing `variables`: - -```Go -err := client.Query(context.Background(), &q, variables) -if err != nil { - // Handle error. -} -``` - -### Inline Fragments - -Some GraphQL queries contain inline fragments. You can use the `graphql` struct field tag to express them. - -For example, to make the following GraphQL query: - -```GraphQL -{ - hero(episode: "JEDI") { - name - ... on Droid { - primaryFunction - } - ... on Human { - height - } - } -} -``` - -You can define this variable: - -```Go -var q struct { - Hero struct { - Name graphql.String - Droid struct { - PrimaryFunction graphql.String - } `graphql:"... on Droid"` - Human struct { - Height graphql.Float - } `graphql:"... on Human"` - } `graphql:"hero(episode: \"JEDI\")"` -} -``` - -Alternatively, you can define the struct types corresponding to inline fragments, and use them as embedded fields in your query: - -```Go -type ( - DroidFragment struct { - PrimaryFunction graphql.String - } - HumanFragment struct { - Height graphql.Float - } -) - -var q struct { - Hero struct { - Name graphql.String - DroidFragment `graphql:"... on Droid"` - HumanFragment `graphql:"... on Human"` - } `graphql:"hero(episode: \"JEDI\")"` -} -``` - -Then call `client.Query`: - -```Go -err := client.Query(context.Background(), &q, nil) -if err != nil { - // Handle error. -} -fmt.Println(q.Hero.Name) -fmt.Println(q.Hero.PrimaryFunction) -fmt.Println(q.Hero.Height) - -// Output: -// R2-D2 -// Astromech -// 0 -``` - -### Mutations - -Mutations often require information that you can only find out by performing a query first. Let's suppose you've already done that. - -For example, to make the following GraphQL mutation: - -```GraphQL -mutation($ep: Episode!, $review: ReviewInput!) { - createReview(episode: $ep, review: $review) { - stars - commentary - } -} -variables { - "ep": "JEDI", - "review": { - "stars": 5, - "commentary": "This is a great movie!" - } -} -``` - -You can define: - -```Go -var m struct { - CreateReview struct { - Stars graphql.Int - Commentary graphql.String - } `graphql:"createReview(episode: $ep, review: $review)"` -} -variables := map[string]interface{}{ - "ep": starwars.Episode("JEDI"), - "review": starwars.ReviewInput{ - Stars: graphql.Int(5), - Commentary: graphql.String("This is a great movie!"), - }, -} -``` - -Then call `client.Mutate`: - -```Go -err := client.Mutate(context.Background(), &m, variables) -if err != nil { - // Handle error. -} -fmt.Printf("Created a %v star review: %v\n", m.CreateReview.Stars, m.CreateReview.Commentary) - -// Output: -// Created a 5 star review: This is a great movie! -``` - -Directories ------------ - -| Path | Synopsis | -|----------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------| -| [example/graphqldev](https://godoc.org/github.com/shurcooL/graphql/example/graphqldev) | graphqldev is a test program currently being used for developing graphql package. | -| [ident](https://godoc.org/github.com/shurcooL/graphql/ident) | Package ident provides functions for parsing and converting identifier names between various naming convention. | -| [internal/jsonutil](https://godoc.org/github.com/shurcooL/graphql/internal/jsonutil) | Package jsonutil provides a function for decoding JSON into a GraphQL query data structure. | - -License -------- - -- [MIT License](LICENSE) diff --git a/vendor/github.com/shurcooL/graphql/doc.go b/vendor/github.com/shurcooL/graphql/doc.go deleted file mode 100644 index 69ec4e03..00000000 --- a/vendor/github.com/shurcooL/graphql/doc.go +++ /dev/null @@ -1,11 +0,0 @@ -// Package graphql provides a GraphQL client implementation. -// -// For more information, see package github.com/shurcooL/githubv4, -// which is a specialized version targeting GitHub GraphQL API v4. -// That package is driving the feature development. -// -// Status: In active early research and development. The API will change when -// opportunities for improvement are discovered; it is not yet frozen. -// -// For now, see README for more details. -package graphql // import "github.com/shurcooL/graphql" diff --git a/vendor/github.com/shurcooL/graphql/graphql.go b/vendor/github.com/shurcooL/graphql/graphql.go deleted file mode 100644 index f2c5b54f..00000000 --- a/vendor/github.com/shurcooL/graphql/graphql.go +++ /dev/null @@ -1,119 +0,0 @@ -package graphql - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "net/http" - - "github.com/shurcooL/go/ctxhttp" - "github.com/shurcooL/graphql/internal/jsonutil" -) - -// Client is a GraphQL client. -type Client struct { - url string // GraphQL server URL. - httpClient *http.Client -} - -// NewClient creates a GraphQL client targeting the specified GraphQL server URL. -// If httpClient is nil, then http.DefaultClient is used. -func NewClient(url string, httpClient *http.Client) *Client { - if httpClient == nil { - httpClient = http.DefaultClient - } - return &Client{ - url: url, - httpClient: httpClient, - } -} - -// Query executes a single GraphQL query request, -// with a query derived from q, populating the response into it. -// q should be a pointer to struct that corresponds to the GraphQL schema. -func (c *Client) Query(ctx context.Context, q interface{}, variables map[string]interface{}) error { - return c.do(ctx, queryOperation, q, variables) -} - -// Mutate executes a single GraphQL mutation request, -// with a mutation derived from m, populating the response into it. -// m should be a pointer to struct that corresponds to the GraphQL schema. -func (c *Client) Mutate(ctx context.Context, m interface{}, variables map[string]interface{}) error { - return c.do(ctx, mutationOperation, m, variables) -} - -// do executes a single GraphQL operation. -func (c *Client) do(ctx context.Context, op operationType, v interface{}, variables map[string]interface{}) error { - var query string - switch op { - case queryOperation: - query = constructQuery(v, variables) - case mutationOperation: - query = constructMutation(v, variables) - } - in := struct { - Query string `json:"query"` - Variables map[string]interface{} `json:"variables,omitempty"` - }{ - Query: query, - Variables: variables, - } - var buf bytes.Buffer - err := json.NewEncoder(&buf).Encode(in) - if err != nil { - return err - } - resp, err := ctxhttp.Post(ctx, c.httpClient, c.url, "application/json", &buf) - if err != nil { - return err - } - defer resp.Body.Close() - if resp.StatusCode != http.StatusOK { - return fmt.Errorf("unexpected status: %v", resp.Status) - } - var out struct { - Data *json.RawMessage - Errors errors - //Extensions interface{} // Unused. - } - err = json.NewDecoder(resp.Body).Decode(&out) - if err != nil { - return err - } - if out.Data != nil { - err := jsonutil.UnmarshalGraphQL(*out.Data, v) - if err != nil { - return err - } - } - if len(out.Errors) > 0 { - return out.Errors - } - return nil -} - -// errors represents the "errors" array in a response from a GraphQL server. -// If returned via error interface, the slice is expected to contain at least 1 element. -// -// Specification: https://facebook.github.io/graphql/#sec-Errors. -type errors []struct { - Message string - Locations []struct { - Line int - Column int - } -} - -// Error implements error interface. -func (e errors) Error() string { - return e[0].Message -} - -type operationType uint8 - -const ( - queryOperation operationType = iota - mutationOperation - //subscriptionOperation // Unused. -) diff --git a/vendor/github.com/shurcooL/graphql/ident/ident.go b/vendor/github.com/shurcooL/graphql/ident/ident.go deleted file mode 100644 index 29e498ed..00000000 --- a/vendor/github.com/shurcooL/graphql/ident/ident.go +++ /dev/null @@ -1,240 +0,0 @@ -// Package ident provides functions for parsing and converting identifier names -// between various naming convention. It has support for MixedCaps, lowerCamelCase, -// and SCREAMING_SNAKE_CASE naming conventions. -package ident - -import ( - "strings" - "unicode" - "unicode/utf8" -) - -// ParseMixedCaps parses a MixedCaps identifier name. -// -// E.g., "ClientMutationID" -> {"Client", "Mutation", "ID"}. -func ParseMixedCaps(name string) Name { - var words Name - - // Split name at any lower -> Upper or Upper -> Upper,lower transitions. - // Check each word for initialisms. - runes := []rune(name) - w, i := 0, 0 // Index of start of word, scan. - for i+1 <= len(runes) { - eow := false // Whether we hit the end of a word. - if i+1 == len(runes) { - eow = true - } else if unicode.IsLower(runes[i]) && unicode.IsUpper(runes[i+1]) { - // lower -> Upper. - eow = true - } else if i+2 < len(runes) && unicode.IsUpper(runes[i]) && unicode.IsUpper(runes[i+1]) && unicode.IsLower(runes[i+2]) { - // Upper -> Upper,lower. End of acronym, followed by a word. - eow = true - - if string(runes[i:i+3]) == "IDs" { // Special case, plural form of ID initialism. - eow = false - } - } - i++ - if !eow { - continue - } - - // [w, i) is a word. - word := string(runes[w:i]) - if initialism, ok := isInitialism(word); ok { - words = append(words, initialism) - } else if i1, i2, ok := isTwoInitialisms(word); ok { - words = append(words, i1, i2) - } else { - words = append(words, word) - } - w = i - } - return words -} - -// ParseLowerCamelCase parses a lowerCamelCase identifier name. -// -// E.g., "clientMutationId" -> {"client", "Mutation", "Id"}. -func ParseLowerCamelCase(name string) Name { - var words Name - - // Split name at any Upper letters. - runes := []rune(name) - w, i := 0, 0 // Index of start of word, scan. - for i+1 <= len(runes) { - eow := false // Whether we hit the end of a word. - if i+1 == len(runes) { - eow = true - } else if unicode.IsUpper(runes[i+1]) { - // Upper letter. - eow = true - } - i++ - if !eow { - continue - } - - // [w, i) is a word. - words = append(words, string(runes[w:i])) - w = i - } - return words -} - -// ParseScreamingSnakeCase parses a SCREAMING_SNAKE_CASE identifier name. -// -// E.g., "CLIENT_MUTATION_ID" -> {"CLIENT", "MUTATION", "ID"}. -func ParseScreamingSnakeCase(name string) Name { - var words Name - - // Split name at '_' characters. - runes := []rune(name) - w, i := 0, 0 // Index of start of word, scan. - for i+1 <= len(runes) { - eow := false // Whether we hit the end of a word. - if i+1 == len(runes) { - eow = true - } else if runes[i+1] == '_' { - // Underscore. - eow = true - } - i++ - if !eow { - continue - } - - // [w, i) is a word. - words = append(words, string(runes[w:i])) - if i < len(runes) && runes[i] == '_' { - // Skip underscore. - i++ - } - w = i - } - return words -} - -// Name is an identifier name, broken up into individual words. -type Name []string - -// ToMixedCaps expresses identifer name in MixedCaps naming convention. -// -// E.g., "ClientMutationID". -func (n Name) ToMixedCaps() string { - for i, word := range n { - if strings.EqualFold(word, "IDs") { // Special case, plural form of ID initialism. - n[i] = "IDs" - continue - } - if initialism, ok := isInitialism(word); ok { - n[i] = initialism - continue - } - if brand, ok := isBrand(word); ok { - n[i] = brand - continue - } - r, size := utf8.DecodeRuneInString(word) - n[i] = string(unicode.ToUpper(r)) + strings.ToLower(word[size:]) - } - return strings.Join(n, "") -} - -// ToLowerCamelCase expresses identifer name in lowerCamelCase naming convention. -// -// E.g., "clientMutationId". -func (n Name) ToLowerCamelCase() string { - for i, word := range n { - if i == 0 { - n[i] = strings.ToLower(word) - continue - } - r, size := utf8.DecodeRuneInString(word) - n[i] = string(unicode.ToUpper(r)) + strings.ToLower(word[size:]) - } - return strings.Join(n, "") -} - -// isInitialism reports whether word is an initialism. -func isInitialism(word string) (string, bool) { - initialism := strings.ToUpper(word) - _, ok := initialisms[initialism] - return initialism, ok -} - -// isTwoInitialisms reports whether word is two initialisms. -func isTwoInitialisms(word string) (string, string, bool) { - word = strings.ToUpper(word) - for i := 2; i <= len(word)-2; i++ { // Shortest initialism is 2 characters long. - _, ok1 := initialisms[word[:i]] - _, ok2 := initialisms[word[i:]] - if ok1 && ok2 { - return word[:i], word[i:], true - } - } - return "", "", false -} - -// initialisms is the set of initialisms in the MixedCaps naming convention. -// Only add entries that are highly unlikely to be non-initialisms. -// For instance, "ID" is fine (Freudian code is rare), but "AND" is not. -var initialisms = map[string]struct{}{ - // These are the common initialisms from golint. Keep them in sync - // with https://gotools.org/github.com/golang/lint#commonInitialisms. - "ACL": {}, - "API": {}, - "ASCII": {}, - "CPU": {}, - "CSS": {}, - "DNS": {}, - "EOF": {}, - "GUID": {}, - "HTML": {}, - "HTTP": {}, - "HTTPS": {}, - "ID": {}, - "IP": {}, - "JSON": {}, - "LHS": {}, - "QPS": {}, - "RAM": {}, - "RHS": {}, - "RPC": {}, - "SLA": {}, - "SMTP": {}, - "SQL": {}, - "SSH": {}, - "TCP": {}, - "TLS": {}, - "TTL": {}, - "UDP": {}, - "UI": {}, - "UID": {}, - "UUID": {}, - "URI": {}, - "URL": {}, - "UTF8": {}, - "VM": {}, - "XML": {}, - "XMPP": {}, - "XSRF": {}, - "XSS": {}, - - // Additional common initialisms. - "RSS": {}, -} - -// isBrand reports whether word is a brand. -func isBrand(word string) (string, bool) { - brand, ok := brands[strings.ToLower(word)] - return brand, ok -} - -// brands is the map of brands in the MixedCaps naming convention; -// see https://dmitri.shuralyov.com/idiomatic-go#for-brands-or-words-with-more-than-1-capital-letter-lowercase-all-letters. -// Key is the lower case version of the brand, value is the canonical brand spelling. -// Only add entries that are highly unlikely to be non-brands. -var brands = map[string]string{ - "github": "GitHub", -} diff --git a/vendor/github.com/shurcooL/graphql/internal/jsonutil/graphql.go b/vendor/github.com/shurcooL/graphql/internal/jsonutil/graphql.go deleted file mode 100644 index 9e75791d..00000000 --- a/vendor/github.com/shurcooL/graphql/internal/jsonutil/graphql.go +++ /dev/null @@ -1,308 +0,0 @@ -// Package jsonutil provides a function for decoding JSON -// into a GraphQL query data structure. -package jsonutil - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "io" - "reflect" - "strings" -) - -// UnmarshalGraphQL parses the JSON-encoded GraphQL response data and stores -// the result in the GraphQL query data structure pointed to by v. -// -// The implementation is created on top of the JSON tokenizer available -// in "encoding/json".Decoder. -func UnmarshalGraphQL(data []byte, v interface{}) error { - dec := json.NewDecoder(bytes.NewReader(data)) - dec.UseNumber() - err := (&decoder{tokenizer: dec}).Decode(v) - if err != nil { - return err - } - tok, err := dec.Token() - switch err { - case io.EOF: - // Expect to get io.EOF. There shouldn't be any more - // tokens left after we've decoded v successfully. - return nil - case nil: - return fmt.Errorf("invalid token '%v' after top-level value", tok) - default: - return err - } -} - -// decoder is a JSON decoder that performs custom unmarshaling behavior -// for GraphQL query data structures. It's implemented on top of a JSON tokenizer. -type decoder struct { - tokenizer interface { - Token() (json.Token, error) - } - - // Stack of what part of input JSON we're in the middle of - objects, arrays. - parseState []json.Delim - - // Stacks of values where to unmarshal. - // The top of each stack is the reflect.Value where to unmarshal next JSON value. - // - // The reason there's more than one stack is because we might be unmarshaling - // a single JSON value into multiple GraphQL fragments or embedded structs, so - // we keep track of them all. - vs [][]reflect.Value -} - -// Decode decodes a single JSON value from d.tokenizer into v. -func (d *decoder) Decode(v interface{}) error { - rv := reflect.ValueOf(v) - if rv.Kind() != reflect.Ptr { - return fmt.Errorf("cannot decode into non-pointer %T", v) - } - d.vs = [][]reflect.Value{{rv.Elem()}} - return d.decode() -} - -// decode decodes a single JSON value from d.tokenizer into d.vs. -func (d *decoder) decode() error { - // The loop invariant is that the top of each d.vs stack - // is where we try to unmarshal the next JSON value we see. - for len(d.vs) > 0 { - tok, err := d.tokenizer.Token() - if err == io.EOF { - return errors.New("unexpected end of JSON input") - } else if err != nil { - return err - } - - switch { - - // Are we inside an object and seeing next key (rather than end of object)? - case d.state() == '{' && tok != json.Delim('}'): - key, ok := tok.(string) - if !ok { - return errors.New("unexpected non-key in JSON input") - } - someFieldExist := false - for i := range d.vs { - v := d.vs[i][len(d.vs[i])-1] - if v.Kind() == reflect.Ptr { - v = v.Elem() - } - var f reflect.Value - if v.Kind() == reflect.Struct { - f = fieldByGraphQLName(v, key) - if f.IsValid() { - someFieldExist = true - } - } - d.vs[i] = append(d.vs[i], f) - } - if !someFieldExist { - return fmt.Errorf("struct field for %s doesn't exist in any of %v places to unmarshal", key, len(d.vs)) - } - - // We've just consumed the current token, which was the key. - // Read the next token, which should be the value, and let the rest of code process it. - tok, err = d.tokenizer.Token() - if err == io.EOF { - return errors.New("unexpected end of JSON input") - } else if err != nil { - return err - } - - // Are we inside an array and seeing next value (rather than end of array)? - case d.state() == '[' && tok != json.Delim(']'): - someSliceExist := false - for i := range d.vs { - v := d.vs[i][len(d.vs[i])-1] - if v.Kind() == reflect.Ptr { - v = v.Elem() - } - var f reflect.Value - if v.Kind() == reflect.Slice { - v.Set(reflect.Append(v, reflect.Zero(v.Type().Elem()))) // v = append(v, T). - f = v.Index(v.Len() - 1) - someSliceExist = true - } - d.vs[i] = append(d.vs[i], f) - } - if !someSliceExist { - return fmt.Errorf("slice doesn't exist in any of %v places to unmarshal", len(d.vs)) - } - } - - switch tok := tok.(type) { - case string, json.Number, bool, nil: - // Value. - - for i := range d.vs { - v := d.vs[i][len(d.vs[i])-1] - if !v.IsValid() { - continue - } - err := unmarshalValue(tok, v) - if err != nil { - return err - } - } - d.popAllVs() - - case json.Delim: - switch tok { - case '{': - // Start of object. - - d.pushState(tok) - - frontier := make([]reflect.Value, len(d.vs)) // Places to look for GraphQL fragments/embedded structs. - for i := range d.vs { - v := d.vs[i][len(d.vs[i])-1] - frontier[i] = v - // TODO: Do this recursively or not? Add a test case if needed. - if v.Kind() == reflect.Ptr && v.IsNil() { - v.Set(reflect.New(v.Type().Elem())) // v = new(T). - } - } - // Find GraphQL fragments/embedded structs recursively, adding to frontier - // as new ones are discovered and exploring them further. - for len(frontier) > 0 { - v := frontier[0] - frontier = frontier[1:] - if v.Kind() == reflect.Ptr { - v = v.Elem() - } - if v.Kind() != reflect.Struct { - continue - } - for i := 0; i < v.NumField(); i++ { - if isGraphQLFragment(v.Type().Field(i)) || v.Type().Field(i).Anonymous { - // Add GraphQL fragment or embedded struct. - d.vs = append(d.vs, []reflect.Value{v.Field(i)}) - frontier = append(frontier, v.Field(i)) - } - } - } - case '[': - // Start of array. - - d.pushState(tok) - - for i := range d.vs { - v := d.vs[i][len(d.vs[i])-1] - // TODO: Confirm this is needed, write a test case. - //if v.Kind() == reflect.Ptr && v.IsNil() { - // v.Set(reflect.New(v.Type().Elem())) // v = new(T). - //} - - // Reset slice to empty (in case it had non-zero initial value). - if v.Kind() == reflect.Ptr { - v = v.Elem() - } - if v.Kind() != reflect.Slice { - continue - } - v.Set(reflect.MakeSlice(v.Type(), 0, 0)) // v = make(T, 0, 0). - } - case '}', ']': - // End of object or array. - d.popAllVs() - d.popState() - default: - return errors.New("unexpected delimiter in JSON input") - } - default: - return errors.New("unexpected token in JSON input") - } - } - return nil -} - -// pushState pushes a new parse state s onto the stack. -func (d *decoder) pushState(s json.Delim) { - d.parseState = append(d.parseState, s) -} - -// popState pops a parse state (already obtained) off the stack. -// The stack must be non-empty. -func (d *decoder) popState() { - d.parseState = d.parseState[:len(d.parseState)-1] -} - -// state reports the parse state on top of stack, or 0 if empty. -func (d *decoder) state() json.Delim { - if len(d.parseState) == 0 { - return 0 - } - return d.parseState[len(d.parseState)-1] -} - -// popAllVs pops from all d.vs stacks, keeping only non-empty ones. -func (d *decoder) popAllVs() { - var nonEmpty [][]reflect.Value - for i := range d.vs { - d.vs[i] = d.vs[i][:len(d.vs[i])-1] - if len(d.vs[i]) > 0 { - nonEmpty = append(nonEmpty, d.vs[i]) - } - } - d.vs = nonEmpty -} - -// fieldByGraphQLName returns a struct field of struct v that matches GraphQL name, -// or invalid reflect.Value if none found. -func fieldByGraphQLName(v reflect.Value, name string) reflect.Value { - for i := 0; i < v.NumField(); i++ { - if hasGraphQLName(v.Type().Field(i), name) { - return v.Field(i) - } - } - return reflect.Value{} -} - -// hasGraphQLName reports whether struct field f has GraphQL name. -func hasGraphQLName(f reflect.StructField, name string) bool { - value, ok := f.Tag.Lookup("graphql") - if !ok { - // TODO: caseconv package is relatively slow. Optimize it, then consider using it here. - //return caseconv.MixedCapsToLowerCamelCase(f.Name) == name - return strings.EqualFold(f.Name, name) - } - value = strings.TrimSpace(value) // TODO: Parse better. - if strings.HasPrefix(value, "...") { - // GraphQL fragment. It doesn't have a name. - return false - } - if i := strings.Index(value, "("); i != -1 { - value = value[:i] - } - if i := strings.Index(value, ":"); i != -1 { - value = value[:i] - } - return strings.TrimSpace(value) == name -} - -// isGraphQLFragment reports whether struct field f is a GraphQL fragment. -func isGraphQLFragment(f reflect.StructField) bool { - value, ok := f.Tag.Lookup("graphql") - if !ok { - return false - } - value = strings.TrimSpace(value) // TODO: Parse better. - return strings.HasPrefix(value, "...") -} - -// unmarshalValue unmarshals JSON value into v. -func unmarshalValue(value json.Token, v reflect.Value) error { - b, err := json.Marshal(value) // TODO: Short-circuit (if profiling says it's worth it). - if err != nil { - return err - } - if !v.CanAddr() { - return fmt.Errorf("value %v is not addressable", v) - } - return json.Unmarshal(b, v.Addr().Interface()) -} diff --git a/vendor/github.com/shurcooL/graphql/query.go b/vendor/github.com/shurcooL/graphql/query.go deleted file mode 100644 index e10b7718..00000000 --- a/vendor/github.com/shurcooL/graphql/query.go +++ /dev/null @@ -1,131 +0,0 @@ -package graphql - -import ( - "bytes" - "encoding/json" - "io" - "reflect" - "sort" - - "github.com/shurcooL/graphql/ident" -) - -func constructQuery(v interface{}, variables map[string]interface{}) string { - query := query(v) - if len(variables) > 0 { - return "query(" + queryArguments(variables) + ")" + query - } - return query -} - -func constructMutation(v interface{}, variables map[string]interface{}) string { - query := query(v) - if len(variables) > 0 { - return "mutation(" + queryArguments(variables) + ")" + query - } - return "mutation" + query -} - -// queryArguments constructs a minified arguments string for variables. -// -// E.g., map[string]interface{}{"a": Int(123), "b": NewBoolean(true)} -> "$a:Int!$b:Boolean". -func queryArguments(variables map[string]interface{}) string { - // Sort keys in order to produce deterministic output for testing purposes. - // TODO: If tests can be made to work with non-deterministic output, then no need to sort. - keys := make([]string, 0, len(variables)) - for k := range variables { - keys = append(keys, k) - } - sort.Strings(keys) - - var buf bytes.Buffer - for _, k := range keys { - io.WriteString(&buf, "$") - io.WriteString(&buf, k) - io.WriteString(&buf, ":") - writeArgumentType(&buf, reflect.TypeOf(variables[k]), true) - // Don't insert a comma here. - // Commas in GraphQL are insignificant, and we want minified output. - // See https://facebook.github.io/graphql/October2016/#sec-Insignificant-Commas. - } - return buf.String() -} - -// writeArgumentType writes a minified GraphQL type for t to w. -// value indicates whether t is a value (required) type or pointer (optional) type. -// If value is true, then "!" is written at the end of t. -func writeArgumentType(w io.Writer, t reflect.Type, value bool) { - if t.Kind() == reflect.Ptr { - // Pointer is an optional type, so no "!" at the end of the pointer's underlying type. - writeArgumentType(w, t.Elem(), false) - return - } - - switch t.Kind() { - case reflect.Slice, reflect.Array: - // List. E.g., "[Int]". - io.WriteString(w, "[") - writeArgumentType(w, t.Elem(), true) - io.WriteString(w, "]") - default: - // Named type. E.g., "Int". - name := t.Name() - if name == "string" { // HACK: Workaround for https://github.com/shurcooL/githubv4/issues/12. - name = "ID" - } - io.WriteString(w, name) - } - - if value { - // Value is a required type, so add "!" to the end. - io.WriteString(w, "!") - } -} - -// query uses writeQuery to recursively construct -// a minified query string from the provided struct v. -// -// E.g., struct{Foo Int, BarBaz *Boolean} -> "{foo,barBaz}". -func query(v interface{}) string { - var buf bytes.Buffer - writeQuery(&buf, reflect.TypeOf(v), false) - return buf.String() -} - -// writeQuery writes a minified query for t to w. -// If inline is true, the struct fields of t are inlined into parent struct. -func writeQuery(w io.Writer, t reflect.Type, inline bool) { - switch t.Kind() { - case reflect.Ptr, reflect.Slice: - writeQuery(w, t.Elem(), false) - case reflect.Struct: - // If the type implements json.Unmarshaler, it's a scalar. Don't expand it. - if reflect.PtrTo(t).Implements(jsonUnmarshaler) { - return - } - if !inline { - io.WriteString(w, "{") - } - for i := 0; i < t.NumField(); i++ { - if i != 0 { - io.WriteString(w, ",") - } - f := t.Field(i) - value, ok := f.Tag.Lookup("graphql") - inlineField := f.Anonymous && !ok - if !inlineField { - if ok { - io.WriteString(w, value) - } else { - io.WriteString(w, ident.ParseMixedCaps(f.Name).ToLowerCamelCase()) - } - } - writeQuery(w, f.Type, inlineField) - } - if !inline { - io.WriteString(w, "}") - } - } -} - -var jsonUnmarshaler = reflect.TypeOf((*json.Unmarshaler)(nil)).Elem() diff --git a/vendor/github.com/shurcooL/graphql/scalar.go b/vendor/github.com/shurcooL/graphql/scalar.go deleted file mode 100644 index 0f7ceea5..00000000 --- a/vendor/github.com/shurcooL/graphql/scalar.go +++ /dev/null @@ -1,51 +0,0 @@ -package graphql - -// Note: These custom types are meant to be used in queries for now. -// But the plan is to switch to using native Go types (string, int, bool, time.Time, etc.). -// See https://github.com/shurcooL/githubv4/issues/9 for details. -// -// These custom types currently provide documentation, and their use -// is required for sending outbound queries. However, native Go types -// can be used for unmarshaling. Once https://github.com/shurcooL/githubv4/issues/9 -// is resolved, native Go types can completely replace these. - -type ( - // Boolean represents true or false values. - Boolean bool - - // Float represents signed double-precision fractional values as - // specified by IEEE 754. - Float float64 - - // ID represents a unique identifier that is Base64 obfuscated. It - // is often used to refetch an object or as key for a cache. The ID - // type appears in a JSON response as a String; however, it is not - // intended to be human-readable. When expected as an input type, - // any string (such as "VXNlci0xMA==") or integer (such as 4) input - // value will be accepted as an ID. - ID interface{} - - // Int represents non-fractional signed whole numeric values. - // Int can represent values between -(2^31) and 2^31 - 1. - Int int32 - - // String represents textual data as UTF-8 character sequences. - // This type is most often used by GraphQL to represent free-form - // human-readable text. - String string -) - -// NewBoolean is a helper to make a new *Boolean. -func NewBoolean(v Boolean) *Boolean { return &v } - -// NewFloat is a helper to make a new *Float. -func NewFloat(v Float) *Float { return &v } - -// NewID is a helper to make a new *ID. -func NewID(v ID) *ID { return &v } - -// NewInt is a helper to make a new *Int. -func NewInt(v Int) *Int { return &v } - -// NewString is a helper to make a new *String. -func NewString(v String) *String { return &v } diff --git a/vendor/github.com/shurcooL/httpfs/filter/filter.go b/vendor/github.com/shurcooL/httpfs/filter/filter.go deleted file mode 100644 index 6f03e597..00000000 --- a/vendor/github.com/shurcooL/httpfs/filter/filter.go +++ /dev/null @@ -1,133 +0,0 @@ -// Package filter offers an http.FileSystem wrapper with the ability to keep or skip files. -package filter - -import ( - "fmt" - "io" - "net/http" - "os" - pathpkg "path" - "time" -) - -// Func is a selection function which is provided two arguments, -// its '/'-separated cleaned rooted absolute path (i.e., it always begins with "/"), -// and the os.FileInfo of the considered file. -// -// The path is cleaned via pathpkg.Clean("/" + path). -// -// For example, if the considered file is named "a" and it's inside a directory "dir", -// then the value of path will be "/dir/a". -type Func func(path string, fi os.FileInfo) bool - -// Keep returns a filesystem that contains only those entries in source for which -// keep returns true. -func Keep(source http.FileSystem, keep Func) http.FileSystem { - return &filterFS{source: source, keep: keep} -} - -// Skip returns a filesystem that contains everything in source, except entries -// for which skip returns true. -func Skip(source http.FileSystem, skip Func) http.FileSystem { - keep := func(path string, fi os.FileInfo) bool { - return !skip(path, fi) - } - return &filterFS{source: source, keep: keep} -} - -type filterFS struct { - source http.FileSystem - keep Func // Keep entries that keep returns true for. -} - -func (fs *filterFS) Open(path string) (http.File, error) { - f, err := fs.source.Open(path) - if err != nil { - return nil, err - } - - fi, err := f.Stat() - if err != nil { - f.Close() - return nil, err - } - - if !fs.keep(clean(path), fi) { - // Skip. - f.Close() - return nil, &os.PathError{Op: "open", Path: path, Err: os.ErrNotExist} - } - - if !fi.IsDir() { - return f, nil - } - defer f.Close() - - fis, err := f.Readdir(0) - if err != nil { - return nil, err - } - - var entries []os.FileInfo - for _, fi := range fis { - if !fs.keep(clean(pathpkg.Join(path, fi.Name())), fi) { - // Skip. - continue - } - entries = append(entries, fi) - } - - return &dir{ - name: fi.Name(), - entries: entries, - modTime: fi.ModTime(), - }, nil -} - -// clean turns a potentially relative path into an absolute one. -// -// This is needed to normalize path parameter for selection function. -func clean(path string) string { - return pathpkg.Clean("/" + path) -} - -// dir is an opened dir instance. -type dir struct { - name string - modTime time.Time - entries []os.FileInfo - pos int // Position within entries for Seek and Readdir. -} - -func (d *dir) Read([]byte) (int, error) { - return 0, fmt.Errorf("cannot Read from directory %s", d.name) -} -func (d *dir) Close() error { return nil } -func (d *dir) Stat() (os.FileInfo, error) { return d, nil } - -func (d *dir) Name() string { return d.name } -func (d *dir) Size() int64 { return 0 } -func (d *dir) Mode() os.FileMode { return 0755 | os.ModeDir } -func (d *dir) ModTime() time.Time { return d.modTime } -func (d *dir) IsDir() bool { return true } -func (d *dir) Sys() interface{} { return nil } - -func (d *dir) Seek(offset int64, whence int) (int64, error) { - if offset == 0 && whence == io.SeekStart { - d.pos = 0 - return 0, nil - } - return 0, fmt.Errorf("unsupported Seek in directory %s", d.name) -} - -func (d *dir) Readdir(count int) ([]os.FileInfo, error) { - if d.pos >= len(d.entries) && count > 0 { - return nil, io.EOF - } - if count <= 0 || count > len(d.entries)-d.pos { - count = len(d.entries) - d.pos - } - e := d.entries[d.pos : d.pos+count] - d.pos += count - return e, nil -} diff --git a/vendor/github.com/shurcooL/httpfs/filter/filters.go b/vendor/github.com/shurcooL/httpfs/filter/filters.go deleted file mode 100644 index a20edaf4..00000000 --- a/vendor/github.com/shurcooL/httpfs/filter/filters.go +++ /dev/null @@ -1,26 +0,0 @@ -package filter - -import ( - "os" - pathpkg "path" -) - -// FilesWithExtensions returns a filter func that selects files (but not directories) -// that have any of the given extensions. For example: -// -// filter.FilesWithExtensions(".go", ".html") -// -// Would select both .go and .html files. It would not select any directories. -func FilesWithExtensions(exts ...string) Func { - return func(path string, fi os.FileInfo) bool { - if fi.IsDir() { - return false - } - for _, ext := range exts { - if pathpkg.Ext(path) == ext { - return true - } - } - return false - } -} diff --git a/vendor/github.com/shurcooL/httpfs/vfsutil/file.go b/vendor/github.com/shurcooL/httpfs/vfsutil/file.go deleted file mode 100644 index 4cb0dada..00000000 --- a/vendor/github.com/shurcooL/httpfs/vfsutil/file.go +++ /dev/null @@ -1,21 +0,0 @@ -package vfsutil - -import ( - "net/http" - "os" -) - -// File implements http.FileSystem using the native file system restricted to a -// specific file served at root. -// -// While the FileSystem.Open method takes '/'-separated paths, a File's string -// value is a filename on the native file system, not a URL, so it is separated -// by filepath.Separator, which isn't necessarily '/'. -type File string - -func (f File) Open(name string) (http.File, error) { - if name != "/" { - return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist} - } - return os.Open(string(f)) -} diff --git a/vendor/github.com/shurcooL/httpfs/vfsutil/vfsutil.go b/vendor/github.com/shurcooL/httpfs/vfsutil/vfsutil.go deleted file mode 100644 index df071d11..00000000 --- a/vendor/github.com/shurcooL/httpfs/vfsutil/vfsutil.go +++ /dev/null @@ -1,39 +0,0 @@ -// Package vfsutil implements some I/O utility functions for http.FileSystem. -package vfsutil - -import ( - "io/ioutil" - "net/http" - "os" -) - -// ReadDir reads the contents of the directory associated with file and -// returns a slice of FileInfo values in directory order. -func ReadDir(fs http.FileSystem, name string) ([]os.FileInfo, error) { - f, err := fs.Open(name) - if err != nil { - return nil, err - } - defer f.Close() - return f.Readdir(0) -} - -// Stat returns the FileInfo structure describing file. -func Stat(fs http.FileSystem, name string) (os.FileInfo, error) { - f, err := fs.Open(name) - if err != nil { - return nil, err - } - defer f.Close() - return f.Stat() -} - -// ReadFile reads the file named by path from fs and returns the contents. -func ReadFile(fs http.FileSystem, path string) ([]byte, error) { - rc, err := fs.Open(path) - if err != nil { - return nil, err - } - defer rc.Close() - return ioutil.ReadAll(rc) -} diff --git a/vendor/github.com/shurcooL/httpfs/vfsutil/walk.go b/vendor/github.com/shurcooL/httpfs/vfsutil/walk.go deleted file mode 100644 index f256bbec..00000000 --- a/vendor/github.com/shurcooL/httpfs/vfsutil/walk.go +++ /dev/null @@ -1,146 +0,0 @@ -package vfsutil - -import ( - "io" - "net/http" - "os" - pathpkg "path" - "path/filepath" - "sort" -) - -// Walk walks the filesystem rooted at root, calling walkFn for each file or -// directory in the filesystem, including root. All errors that arise visiting files -// and directories are filtered by walkFn. The files are walked in lexical -// order. -func Walk(fs http.FileSystem, root string, walkFn filepath.WalkFunc) error { - info, err := Stat(fs, root) - if err != nil { - return walkFn(root, nil, err) - } - return walk(fs, root, info, walkFn) -} - -// readDirNames reads the directory named by dirname and returns -// a sorted list of directory entries. -func readDirNames(fs http.FileSystem, dirname string) ([]string, error) { - fis, err := ReadDir(fs, dirname) - if err != nil { - return nil, err - } - names := make([]string, len(fis)) - for i := range fis { - names[i] = fis[i].Name() - } - sort.Strings(names) - return names, nil -} - -// walk recursively descends path, calling walkFn. -func walk(fs http.FileSystem, path string, info os.FileInfo, walkFn filepath.WalkFunc) error { - err := walkFn(path, info, nil) - if err != nil { - if info.IsDir() && err == filepath.SkipDir { - return nil - } - return err - } - - if !info.IsDir() { - return nil - } - - names, err := readDirNames(fs, path) - if err != nil { - return walkFn(path, info, err) - } - - for _, name := range names { - filename := pathpkg.Join(path, name) - fileInfo, err := Stat(fs, filename) - if err != nil { - if err := walkFn(filename, fileInfo, err); err != nil && err != filepath.SkipDir { - return err - } - } else { - err = walk(fs, filename, fileInfo, walkFn) - if err != nil { - if !fileInfo.IsDir() || err != filepath.SkipDir { - return err - } - } - } - } - return nil -} - -// WalkFilesFunc is the type of the function called for each file or directory visited by WalkFiles. -// It's like filepath.WalkFunc, except it provides an additional ReadSeeker parameter for file being visited. -type WalkFilesFunc func(path string, info os.FileInfo, rs io.ReadSeeker, err error) error - -// WalkFiles walks the filesystem rooted at root, calling walkFn for each file or -// directory in the filesystem, including root. In addition to FileInfo, it passes an -// ReadSeeker to walkFn for each file it visits. -func WalkFiles(fs http.FileSystem, root string, walkFn WalkFilesFunc) error { - file, info, err := openStat(fs, root) - if err != nil { - return walkFn(root, nil, nil, err) - } - return walkFiles(fs, root, info, file, walkFn) -} - -// walkFiles recursively descends path, calling walkFn. -// It closes the input file after it's done with it, so the caller shouldn't. -func walkFiles(fs http.FileSystem, path string, info os.FileInfo, file http.File, walkFn WalkFilesFunc) error { - err := walkFn(path, info, file, nil) - file.Close() - if err != nil { - if info.IsDir() && err == filepath.SkipDir { - return nil - } - return err - } - - if !info.IsDir() { - return nil - } - - names, err := readDirNames(fs, path) - if err != nil { - return walkFn(path, info, nil, err) - } - - for _, name := range names { - filename := pathpkg.Join(path, name) - file, fileInfo, err := openStat(fs, filename) - if err != nil { - if err := walkFn(filename, nil, nil, err); err != nil && err != filepath.SkipDir { - return err - } - } else { - err = walkFiles(fs, filename, fileInfo, file, walkFn) - // file is closed by walkFiles, so we don't need to close it here. - if err != nil { - if !fileInfo.IsDir() || err != filepath.SkipDir { - return err - } - } - } - } - return nil -} - -// openStat performs Open and Stat and returns results, or first error encountered. -// The caller is responsible for closing the returned file when done. -func openStat(fs http.FileSystem, name string) (http.File, os.FileInfo, error) { - f, err := fs.Open(name) - if err != nil { - return nil, nil, err - } - fi, err := f.Stat() - if err != nil { - f.Close() - return nil, nil, err - } - return f, fi, nil -} diff --git a/vendor/github.com/shurcooL/vfsgen/.travis.yml b/vendor/github.com/shurcooL/vfsgen/.travis.yml deleted file mode 100644 index 93b1fcdb..00000000 --- a/vendor/github.com/shurcooL/vfsgen/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -sudo: false -language: go -go: - - 1.x - - master -matrix: - allow_failures: - - go: master - fast_finish: true -install: - - # Do nothing. This is needed to prevent default install action "go get -t -v ./..." from happening here (we want it to happen inside script step). -script: - - go get -t -v ./... - - diff -u <(echo -n) <(gofmt -d -s .) - - go tool vet . - - go test -v -race ./... diff --git a/vendor/github.com/shurcooL/vfsgen/CONTRIBUTING.md b/vendor/github.com/shurcooL/vfsgen/CONTRIBUTING.md deleted file mode 100644 index 6127ddce..00000000 --- a/vendor/github.com/shurcooL/vfsgen/CONTRIBUTING.md +++ /dev/null @@ -1,10 +0,0 @@ -Contributing -============ - -vfsgen is open source, thanks for considering contributing! - -Please note that vfsgen aims to be simple and minimalistic, with as little to configure as possible. If you'd like to remove or simplify code (while having tests continue to pass), fix bugs, or improve code (e.g., add missing error checking, etc.), PRs and issues are welcome. - -However, if you'd like to add new functionality that increases complexity or scope, please make an issue and discuss your proposal first. I'm unlikely to accept such changes outright. It might be that your request is already a part of other similar packages, or it might fit in their scope better. See [Comparison and Alternatives](https://github.com/shurcooL/vfsgen/tree/README-alternatives-and-comparison-section#comparison) sections. - -Thank you! diff --git a/vendor/github.com/shurcooL/vfsgen/LICENSE b/vendor/github.com/shurcooL/vfsgen/LICENSE deleted file mode 100644 index c35c17af..00000000 --- a/vendor/github.com/shurcooL/vfsgen/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2015 Dmitri Shuralyov - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/shurcooL/vfsgen/README.md b/vendor/github.com/shurcooL/vfsgen/README.md deleted file mode 100644 index 659a0a03..00000000 --- a/vendor/github.com/shurcooL/vfsgen/README.md +++ /dev/null @@ -1,201 +0,0 @@ -vfsgen -====== - -[![Build Status](https://travis-ci.org/shurcooL/vfsgen.svg?branch=master)](https://travis-ci.org/shurcooL/vfsgen) [![GoDoc](https://godoc.org/github.com/shurcooL/vfsgen?status.svg)](https://godoc.org/github.com/shurcooL/vfsgen) - -Package vfsgen takes an http.FileSystem (likely at `go generate` time) and -generates Go code that statically implements the provided http.FileSystem. - -Features: - -- Efficient generated code without unneccessary overhead. - -- Uses gzip compression internally (selectively, only for files that compress well). - -- Enables direct access to internal gzip compressed bytes via an optional interface. - -- Outputs `gofmt`ed Go code. - -Installation ------------- - -```bash -go get -u github.com/shurcooL/vfsgen -``` - -Usage ------ - -Package `vfsgen` is a Go code generator library. It has a `Generate` function that takes an input filesystem (as a [`http.FileSystem`](https://godoc.org/net/http#FileSystem) type), and generates a Go code file that statically implements the contents of the input filesystem. - -For example, we can use [`http.Dir`](https://godoc.org/net/http#Dir) as a `http.FileSystem` implementation that uses the contents of the `/path/to/assets` directory: - -```Go -var fs http.FileSystem = http.Dir("/path/to/assets") -``` - -Now, when you execute the following code: - -```Go -err := vfsgen.Generate(fs, vfsgen.Options{}) -if err != nil { - log.Fatalln(err) -} -``` - -An assets_vfsdata.go file will be generated in the current directory: - -```Go -// Code generated by vfsgen; DO NOT EDIT. - -package main - -import ... - -// assets statically implements the virtual filesystem provided to vfsgen.Generate. -var assets http.FileSystem = ... -``` - -Then, in your program, you can use `assets` as any other [`http.FileSystem`](https://godoc.org/net/http#FileSystem), for example: - -```Go -file, err := assets.Open("/some/file.txt") -if err != nil { - return err -} -defer file.Close() -``` - -```Go -http.Handle("/assets/", http.FileServer(assets)) -``` - -`vfsgen` can be more useful when combined with build tags and go generate directives. This is described below. - -### `go generate` Usage - -vfsgen is great to use with go generate directives. The code invoking `vfsgen.Generate` can go in an assets_generate.go file, which can then be invoked via "//go:generate go run assets_generate.go". The input virtual filesystem can read directly from disk, or it can be more involved. - -By using build tags, you can create a development mode where assets are loaded directly from disk via `http.Dir`, but then statically implemented for final releases. - -For example, suppose your source filesystem is defined in a package with import path "example.com/project/data" as: - -```Go -// +build dev - -package data - -import "net/http" - -// Assets contains project assets. -var Assets http.FileSystem = http.Dir("assets") -``` - -When built with the "dev" build tag, accessing `data.Assets` will read from disk directly via `http.Dir`. - -A generate helper file assets_generate.go can be invoked via "//go:generate go run -tags=dev assets_generate.go" directive: - -```Go -// +build ignore - -package main - -import ( - "log" - - "example.com/project/data" - "github.com/shurcooL/vfsgen" -) - -func main() { - err := vfsgen.Generate(data.Assets, vfsgen.Options{ - PackageName: "data", - BuildTags: "!dev", - VariableName: "Assets", - }) - if err != nil { - log.Fatalln(err) - } -} -``` - -Note that "dev" build tag is used to access the source filesystem, and the output file will contain "!dev" build tag. That way, the statically implemented version will be used during normal builds and `go get`, when custom builds tags are not specified. - -### `vfsgendev` Usage - -`vfsgendev` is a binary that can be used to replace the need for the assets_generate.go file. - -Make sure it's installed and available in your PATH. - -```bash -go get -u github.com/shurcooL/vfsgen/cmd/vfsgendev -``` - -Then the "//go:generate go run -tags=dev assets_generate.go" directive can be replaced with: - -``` -//go:generate vfsgendev -source="example.com/project/data".Assets -``` - -vfsgendev accesses the source variable using "dev" build tag, and generates an output file with "!dev" build tag. - -### Additional Embedded Information - -All compressed files implement [`httpgzip.GzipByter` interface](https://godoc.org/github.com/shurcooL/httpgzip#GzipByter) for efficient direct access to the internal compressed bytes: - -```Go -// GzipByter is implemented by compressed files for -// efficient direct access to the internal compressed bytes. -type GzipByter interface { - // GzipBytes returns gzip compressed contents of the file. - GzipBytes() []byte -} -``` - -Files that have been determined to not be worth gzip compressing (their compressed size is larger than original) implement [`httpgzip.NotWorthGzipCompressing` interface](https://godoc.org/github.com/shurcooL/httpgzip#NotWorthGzipCompressing): - -```Go -// NotWorthGzipCompressing is implemented by files that were determined -// not to be worth gzip compressing (the file size did not decrease as a result). -type NotWorthGzipCompressing interface { - // NotWorthGzipCompressing is a noop. It's implemented in order to indicate - // the file is not worth gzip compressing. - NotWorthGzipCompressing() -} -``` - -Comparison ----------- - -vfsgen aims to be conceptually simple to use. The [`http.FileSystem`](https://godoc.org/net/http#FileSystem) abstraction is central to vfsgen. It's used as both input for code generation, and as output in the generated code. - -That enables great flexibility through orthogonality, since helpers and wrappers can operate on `http.FileSystem` without knowing about vfsgen. If you want, you can perform pre-processing, minifying assets, merging folders, filtering out files and otherwise modifying input via generic `http.FileSystem` middleware. - -It avoids unneccessary overhead by merging what was previously done with two distinct packages into a single package. - -It strives to be the best in its class in terms of code quality and efficiency of generated code. However, if your use goals are different, there are other similar packages that may fit your needs better. - -### Alternatives - -- [`go-bindata`](https://github.com/jteeuwen/go-bindata) - Reads from disk, generates Go code that provides access to data via a [custom API](https://github.com/jteeuwen/go-bindata#accessing-an-asset). -- [`go-bindata-assetfs`](https://github.com/elazarl/go-bindata-assetfs) - Takes output of go-bindata and provides a wrapper that implements `http.FileSystem` interface (the same as what vfsgen outputs directly). -- [`becky`](https://github.com/tv42/becky) - Embeds assets as string literals in Go source. -- [`statik`](https://github.com/rakyll/statik) - Embeds a directory of static files to be accessed via `http.FileSystem` interface (sounds very similar to vfsgen); implementation sourced from [camlistore](https://camlistore.org). -- [`go.rice`](https://github.com/GeertJohan/go.rice) - Makes working with resources such as HTML, JS, CSS, images and templates very easy. -- [`esc`](https://github.com/mjibson/esc) - Embeds files into Go programs and provides `http.FileSystem` interfaces to them. -- [`staticfiles`](https://github.com/bouk/staticfiles) - Allows you to embed a directory of files into your Go binary. -- [`togo`](https://github.com/flazz/togo) - Generates a Go source file with a `[]byte` var containing the given file's contents. -- [`fileb0x`](https://github.com/UnnoTed/fileb0x) - Simple customizable tool to embed files in Go. -- [`embedfiles`](https://github.com/leighmcculloch/embedfiles) - Simple tool for embedding files in Go code as a map. -- [`packr`](https://github.com/gobuffalo/packr) - Simple solution for bundling static assets inside of Go binaries. -- [`rsrc`](https://github.com/akavel/rsrc) - Tool for embedding .ico & manifest resources in Go programs for Windows. - -Attribution ------------ - -This package was originally based on the excellent work by [@jteeuwen](https://github.com/jteeuwen) on [`go-bindata`](https://github.com/jteeuwen/go-bindata) and [@elazarl](https://github.com/elazarl) on [`go-bindata-assetfs`](https://github.com/elazarl/go-bindata-assetfs). - -License -------- - -- [MIT License](LICENSE) diff --git a/vendor/github.com/shurcooL/vfsgen/commentwriter.go b/vendor/github.com/shurcooL/vfsgen/commentwriter.go deleted file mode 100644 index b6847f52..00000000 --- a/vendor/github.com/shurcooL/vfsgen/commentwriter.go +++ /dev/null @@ -1,45 +0,0 @@ -package vfsgen - -import "io" - -// commentWriter writes a Go comment to the underlying io.Writer, -// using line comment form (//). -type commentWriter struct { - W io.Writer - wroteSlashes bool // Wrote "//" at the beginning of the current line. -} - -func (c *commentWriter) Write(p []byte) (int, error) { - var n int - for i, b := range p { - if !c.wroteSlashes { - s := "//" - if b != '\n' { - s = "// " - } - if _, err := io.WriteString(c.W, s); err != nil { - return n, err - } - c.wroteSlashes = true - } - n0, err := c.W.Write(p[i : i+1]) - n += n0 - if err != nil { - return n, err - } - if b == '\n' { - c.wroteSlashes = false - } - } - return len(p), nil -} - -func (c *commentWriter) Close() error { - if !c.wroteSlashes { - if _, err := io.WriteString(c.W, "//"); err != nil { - return err - } - c.wroteSlashes = true - } - return nil -} diff --git a/vendor/github.com/shurcooL/vfsgen/doc.go b/vendor/github.com/shurcooL/vfsgen/doc.go deleted file mode 100644 index 46f28504..00000000 --- a/vendor/github.com/shurcooL/vfsgen/doc.go +++ /dev/null @@ -1,15 +0,0 @@ -/* -Package vfsgen takes an http.FileSystem (likely at `go generate` time) and -generates Go code that statically implements the provided http.FileSystem. - -Features: - -- Efficient generated code without unneccessary overhead. - -- Uses gzip compression internally (selectively, only for files that compress well). - -- Enables direct access to internal gzip compressed bytes via an optional interface. - -- Outputs `gofmt`ed Go code. -*/ -package vfsgen diff --git a/vendor/github.com/shurcooL/vfsgen/generator.go b/vendor/github.com/shurcooL/vfsgen/generator.go deleted file mode 100644 index 5782693e..00000000 --- a/vendor/github.com/shurcooL/vfsgen/generator.go +++ /dev/null @@ -1,485 +0,0 @@ -package vfsgen - -import ( - "bytes" - "compress/gzip" - "errors" - "fmt" - "io" - "io/ioutil" - "net/http" - "os" - pathpkg "path" - "sort" - "strconv" - "text/template" - "time" - - "github.com/shurcooL/httpfs/vfsutil" -) - -// Generate Go code that statically implements input filesystem, -// write the output to a file specified in opt. -func Generate(input http.FileSystem, opt Options) error { - opt.fillMissing() - - // Use an in-memory buffer to generate the entire output. - buf := new(bytes.Buffer) - - err := t.ExecuteTemplate(buf, "Header", opt) - if err != nil { - return err - } - - var toc toc - err = findAndWriteFiles(buf, input, &toc) - if err != nil { - return err - } - - err = t.ExecuteTemplate(buf, "DirEntries", toc.dirs) - if err != nil { - return err - } - - err = t.ExecuteTemplate(buf, "Trailer", toc) - if err != nil { - return err - } - - // Write output file (all at once). - fmt.Println("writing", opt.Filename) - err = ioutil.WriteFile(opt.Filename, buf.Bytes(), 0644) - return err -} - -type toc struct { - dirs []*dirInfo - - HasCompressedFile bool // There's at least one compressedFile. - HasFile bool // There's at least one uncompressed file. -} - -// fileInfo is a definition of a file. -type fileInfo struct { - Path string - Name string - ModTime time.Time - UncompressedSize int64 -} - -// dirInfo is a definition of a directory. -type dirInfo struct { - Path string - Name string - ModTime time.Time - Entries []string -} - -// findAndWriteFiles recursively finds all the file paths in the given directory tree. -// They are added to the given map as keys. Values will be safe function names -// for each file, which will be used when generating the output code. -func findAndWriteFiles(buf *bytes.Buffer, fs http.FileSystem, toc *toc) error { - walkFn := func(path string, fi os.FileInfo, r io.ReadSeeker, err error) error { - if err != nil { - // Consider all errors reading the input filesystem as fatal. - return err - } - - switch fi.IsDir() { - case false: - file := &fileInfo{ - Path: path, - Name: pathpkg.Base(path), - ModTime: fi.ModTime().UTC(), - UncompressedSize: fi.Size(), - } - - marker := buf.Len() - - // Write CompressedFileInfo. - err = writeCompressedFileInfo(buf, file, r) - switch err { - default: - return err - case nil: - toc.HasCompressedFile = true - // If compressed file is not smaller than original, revert and write original file. - case errCompressedNotSmaller: - _, err = r.Seek(0, io.SeekStart) - if err != nil { - return err - } - - buf.Truncate(marker) - - // Write FileInfo. - err = writeFileInfo(buf, file, r) - if err != nil { - return err - } - toc.HasFile = true - } - case true: - entries, err := readDirPaths(fs, path) - if err != nil { - return err - } - - dir := &dirInfo{ - Path: path, - Name: pathpkg.Base(path), - ModTime: fi.ModTime().UTC(), - Entries: entries, - } - - toc.dirs = append(toc.dirs, dir) - - // Write DirInfo. - err = t.ExecuteTemplate(buf, "DirInfo", dir) - if err != nil { - return err - } - } - - return nil - } - - err := vfsutil.WalkFiles(fs, "/", walkFn) - return err -} - -// readDirPaths reads the directory named by dirname and returns -// a sorted list of directory paths. -func readDirPaths(fs http.FileSystem, dirname string) ([]string, error) { - fis, err := vfsutil.ReadDir(fs, dirname) - if err != nil { - return nil, err - } - paths := make([]string, len(fis)) - for i := range fis { - paths[i] = pathpkg.Join(dirname, fis[i].Name()) - } - sort.Strings(paths) - return paths, nil -} - -// writeCompressedFileInfo writes CompressedFileInfo. -// It returns errCompressedNotSmaller if compressed file is not smaller than original. -func writeCompressedFileInfo(w io.Writer, file *fileInfo, r io.Reader) error { - err := t.ExecuteTemplate(w, "CompressedFileInfo-Before", file) - if err != nil { - return err - } - sw := &stringWriter{Writer: w} - gw := gzip.NewWriter(sw) - _, err = io.Copy(gw, r) - if err != nil { - return err - } - err = gw.Close() - if err != nil { - return err - } - if sw.N >= file.UncompressedSize { - return errCompressedNotSmaller - } - err = t.ExecuteTemplate(w, "CompressedFileInfo-After", file) - return err -} - -var errCompressedNotSmaller = errors.New("compressed file is not smaller than original") - -// Write FileInfo. -func writeFileInfo(w io.Writer, file *fileInfo, r io.Reader) error { - err := t.ExecuteTemplate(w, "FileInfo-Before", file) - if err != nil { - return err - } - sw := &stringWriter{Writer: w} - _, err = io.Copy(sw, r) - if err != nil { - return err - } - err = t.ExecuteTemplate(w, "FileInfo-After", file) - return err -} - -var t = template.Must(template.New("").Funcs(template.FuncMap{ - "quote": strconv.Quote, - "comment": func(s string) (string, error) { - var buf bytes.Buffer - cw := &commentWriter{W: &buf} - _, err := io.WriteString(cw, s) - if err != nil { - return "", err - } - err = cw.Close() - return buf.String(), err - }, -}).Parse(`{{define "Header"}}// Code generated by vfsgen; DO NOT EDIT. - -{{with .BuildTags}}// +build {{.}} - -{{end}}package {{.PackageName}} - -import ( - "bytes" - "compress/gzip" - "fmt" - "io" - "io/ioutil" - "net/http" - "os" - pathpkg "path" - "time" -) - -{{comment .VariableComment}} -var {{.VariableName}} = func() http.FileSystem { - fs := vfsgen۰FS{ -{{end}} - - - -{{define "CompressedFileInfo-Before"}} {{quote .Path}}: &vfsgen۰CompressedFileInfo{ - name: {{quote .Name}}, - modTime: {{template "Time" .ModTime}}, - uncompressedSize: {{.UncompressedSize}}, -{{/* This blank line separating compressedContent is neccessary to prevent potential gofmt issues. See issue #19. */}} - compressedContent: []byte("{{end}}{{define "CompressedFileInfo-After"}}"), - }, -{{end}} - - - -{{define "FileInfo-Before"}} {{quote .Path}}: &vfsgen۰FileInfo{ - name: {{quote .Name}}, - modTime: {{template "Time" .ModTime}}, - content: []byte("{{end}}{{define "FileInfo-After"}}"), - }, -{{end}} - - - -{{define "DirInfo"}} {{quote .Path}}: &vfsgen۰DirInfo{ - name: {{quote .Name}}, - modTime: {{template "Time" .ModTime}}, - }, -{{end}} - - - -{{define "DirEntries"}} } -{{range .}}{{if .Entries}} fs[{{quote .Path}}].(*vfsgen۰DirInfo).entries = []os.FileInfo{{"{"}}{{range .Entries}} - fs[{{quote .}}].(os.FileInfo),{{end}} - } -{{end}}{{end}} - return fs -}() -{{end}} - - - -{{define "Trailer"}} -type vfsgen۰FS map[string]interface{} - -func (fs vfsgen۰FS) Open(path string) (http.File, error) { - path = pathpkg.Clean("/" + path) - f, ok := fs[path] - if !ok { - return nil, &os.PathError{Op: "open", Path: path, Err: os.ErrNotExist} - } - - switch f := f.(type) {{"{"}}{{if .HasCompressedFile}} - case *vfsgen۰CompressedFileInfo: - gr, err := gzip.NewReader(bytes.NewReader(f.compressedContent)) - if err != nil { - // This should never happen because we generate the gzip bytes such that they are always valid. - panic("unexpected error reading own gzip compressed bytes: " + err.Error()) - } - return &vfsgen۰CompressedFile{ - vfsgen۰CompressedFileInfo: f, - gr: gr, - }, nil{{end}}{{if .HasFile}} - case *vfsgen۰FileInfo: - return &vfsgen۰File{ - vfsgen۰FileInfo: f, - Reader: bytes.NewReader(f.content), - }, nil{{end}} - case *vfsgen۰DirInfo: - return &vfsgen۰Dir{ - vfsgen۰DirInfo: f, - }, nil - default: - // This should never happen because we generate only the above types. - panic(fmt.Sprintf("unexpected type %T", f)) - } -} -{{if .HasCompressedFile}} -// vfsgen۰CompressedFileInfo is a static definition of a gzip compressed file. -type vfsgen۰CompressedFileInfo struct { - name string - modTime time.Time - compressedContent []byte - uncompressedSize int64 -} - -func (f *vfsgen۰CompressedFileInfo) Readdir(count int) ([]os.FileInfo, error) { - return nil, fmt.Errorf("cannot Readdir from file %s", f.name) -} -func (f *vfsgen۰CompressedFileInfo) Stat() (os.FileInfo, error) { return f, nil } - -func (f *vfsgen۰CompressedFileInfo) GzipBytes() []byte { - return f.compressedContent -} - -func (f *vfsgen۰CompressedFileInfo) Name() string { return f.name } -func (f *vfsgen۰CompressedFileInfo) Size() int64 { return f.uncompressedSize } -func (f *vfsgen۰CompressedFileInfo) Mode() os.FileMode { return 0444 } -func (f *vfsgen۰CompressedFileInfo) ModTime() time.Time { return f.modTime } -func (f *vfsgen۰CompressedFileInfo) IsDir() bool { return false } -func (f *vfsgen۰CompressedFileInfo) Sys() interface{} { return nil } - -// vfsgen۰CompressedFile is an opened compressedFile instance. -type vfsgen۰CompressedFile struct { - *vfsgen۰CompressedFileInfo - gr *gzip.Reader - grPos int64 // Actual gr uncompressed position. - seekPos int64 // Seek uncompressed position. -} - -func (f *vfsgen۰CompressedFile) Read(p []byte) (n int, err error) { - if f.grPos > f.seekPos { - // Rewind to beginning. - err = f.gr.Reset(bytes.NewReader(f.compressedContent)) - if err != nil { - return 0, err - } - f.grPos = 0 - } - if f.grPos < f.seekPos { - // Fast-forward. - _, err = io.CopyN(ioutil.Discard, f.gr, f.seekPos-f.grPos) - if err != nil { - return 0, err - } - f.grPos = f.seekPos - } - n, err = f.gr.Read(p) - f.grPos += int64(n) - f.seekPos = f.grPos - return n, err -} -func (f *vfsgen۰CompressedFile) Seek(offset int64, whence int) (int64, error) { - switch whence { - case io.SeekStart: - f.seekPos = 0 + offset - case io.SeekCurrent: - f.seekPos += offset - case io.SeekEnd: - f.seekPos = f.uncompressedSize + offset - default: - panic(fmt.Errorf("invalid whence value: %v", whence)) - } - return f.seekPos, nil -} -func (f *vfsgen۰CompressedFile) Close() error { - return f.gr.Close() -} -{{else}} -// We already imported "compress/gzip" and "io/ioutil", but ended up not using them. Avoid unused import error. -var _ = gzip.Reader{} -var _ = ioutil.Discard -{{end}}{{if .HasFile}} -// vfsgen۰FileInfo is a static definition of an uncompressed file (because it's not worth gzip compressing). -type vfsgen۰FileInfo struct { - name string - modTime time.Time - content []byte -} - -func (f *vfsgen۰FileInfo) Readdir(count int) ([]os.FileInfo, error) { - return nil, fmt.Errorf("cannot Readdir from file %s", f.name) -} -func (f *vfsgen۰FileInfo) Stat() (os.FileInfo, error) { return f, nil } - -func (f *vfsgen۰FileInfo) NotWorthGzipCompressing() {} - -func (f *vfsgen۰FileInfo) Name() string { return f.name } -func (f *vfsgen۰FileInfo) Size() int64 { return int64(len(f.content)) } -func (f *vfsgen۰FileInfo) Mode() os.FileMode { return 0444 } -func (f *vfsgen۰FileInfo) ModTime() time.Time { return f.modTime } -func (f *vfsgen۰FileInfo) IsDir() bool { return false } -func (f *vfsgen۰FileInfo) Sys() interface{} { return nil } - -// vfsgen۰File is an opened file instance. -type vfsgen۰File struct { - *vfsgen۰FileInfo - *bytes.Reader -} - -func (f *vfsgen۰File) Close() error { - return nil -} -{{else if not .HasCompressedFile}} -// We already imported "bytes", but ended up not using it. Avoid unused import error. -var _ = bytes.Reader{} -{{end}} -// vfsgen۰DirInfo is a static definition of a directory. -type vfsgen۰DirInfo struct { - name string - modTime time.Time - entries []os.FileInfo -} - -func (d *vfsgen۰DirInfo) Read([]byte) (int, error) { - return 0, fmt.Errorf("cannot Read from directory %s", d.name) -} -func (d *vfsgen۰DirInfo) Close() error { return nil } -func (d *vfsgen۰DirInfo) Stat() (os.FileInfo, error) { return d, nil } - -func (d *vfsgen۰DirInfo) Name() string { return d.name } -func (d *vfsgen۰DirInfo) Size() int64 { return 0 } -func (d *vfsgen۰DirInfo) Mode() os.FileMode { return 0755 | os.ModeDir } -func (d *vfsgen۰DirInfo) ModTime() time.Time { return d.modTime } -func (d *vfsgen۰DirInfo) IsDir() bool { return true } -func (d *vfsgen۰DirInfo) Sys() interface{} { return nil } - -// vfsgen۰Dir is an opened dir instance. -type vfsgen۰Dir struct { - *vfsgen۰DirInfo - pos int // Position within entries for Seek and Readdir. -} - -func (d *vfsgen۰Dir) Seek(offset int64, whence int) (int64, error) { - if offset == 0 && whence == io.SeekStart { - d.pos = 0 - return 0, nil - } - return 0, fmt.Errorf("unsupported Seek in directory %s", d.name) -} - -func (d *vfsgen۰Dir) Readdir(count int) ([]os.FileInfo, error) { - if d.pos >= len(d.entries) && count > 0 { - return nil, io.EOF - } - if count <= 0 || count > len(d.entries)-d.pos { - count = len(d.entries) - d.pos - } - e := d.entries[d.pos : d.pos+count] - d.pos += count - return e, nil -} -{{end}} - - - -{{define "Time"}} -{{- if .IsZero -}} - time.Time{} -{{- else -}} - time.Date({{.Year}}, {{printf "%d" .Month}}, {{.Day}}, {{.Hour}}, {{.Minute}}, {{.Second}}, {{.Nanosecond}}, time.UTC) -{{- end -}} -{{end}} -`)) diff --git a/vendor/github.com/shurcooL/vfsgen/options.go b/vendor/github.com/shurcooL/vfsgen/options.go deleted file mode 100644 index d10d348e..00000000 --- a/vendor/github.com/shurcooL/vfsgen/options.go +++ /dev/null @@ -1,45 +0,0 @@ -package vfsgen - -import ( - "fmt" - "strings" -) - -// Options for vfsgen code generation. -type Options struct { - // Filename of the generated Go code output (including extension). - // If left empty, it defaults to "{{toLower .VariableName}}_vfsdata.go". - Filename string - - // PackageName is the name of the package in the generated code. - // If left empty, it defaults to "main". - PackageName string - - // BuildTags are the optional build tags in the generated code. - // The build tags syntax is specified by the go tool. - BuildTags string - - // VariableName is the name of the http.FileSystem variable in the generated code. - // If left empty, it defaults to "assets". - VariableName string - - // VariableComment is the comment of the http.FileSystem variable in the generated code. - // If left empty, it defaults to "{{.VariableName}} statically implements the virtual filesystem provided to vfsgen.". - VariableComment string -} - -// fillMissing sets default values for mandatory options that are left empty. -func (opt *Options) fillMissing() { - if opt.PackageName == "" { - opt.PackageName = "main" - } - if opt.VariableName == "" { - opt.VariableName = "assets" - } - if opt.Filename == "" { - opt.Filename = fmt.Sprintf("%s_vfsdata.go", strings.ToLower(opt.VariableName)) - } - if opt.VariableComment == "" { - opt.VariableComment = fmt.Sprintf("%s statically implements the virtual filesystem provided to vfsgen.", opt.VariableName) - } -} diff --git a/vendor/github.com/shurcooL/vfsgen/stringwriter.go b/vendor/github.com/shurcooL/vfsgen/stringwriter.go deleted file mode 100644 index a781efdc..00000000 --- a/vendor/github.com/shurcooL/vfsgen/stringwriter.go +++ /dev/null @@ -1,27 +0,0 @@ -package vfsgen - -import ( - "io" -) - -// stringWriter writes given bytes to underlying io.Writer as a Go interpreted string literal value, -// not including double quotes. It tracks the total number of bytes written. -type stringWriter struct { - io.Writer - N int64 // Total bytes written. -} - -func (sw *stringWriter) Write(p []byte) (n int, err error) { - const hex = "0123456789abcdef" - buf := []byte{'\\', 'x', 0, 0} - for _, b := range p { - buf[2], buf[3] = hex[b/16], hex[b%16] - _, err = sw.Writer.Write(buf) - if err != nil { - return n, err - } - n++ - sw.N++ - } - return n, nil -} -- cgit