{"modulePath":"github.com/HUSTSecLab/criticality_score","version":"v0.0.1-alpha","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package githubapi\n\n## Constants\n\n```go\nconst DefaultGraphQLEndpoint = \"https://api.github.com/graphql\"\n```\nDefaultGraphQLEndpoint is the default URL for the GitHub GraphQL API.\n\n## Variables\n\n```go\nvar (\n\t// ErrGraphQLNotFound is an error used to test when GitHub GraphQL query\n\t// returns a single error with the type \"NOT_FOUND\".\n\t//\n\t// It should be used with errors.Is.\n\tErrGraphQLNotFound = errors.New(\"GraphQL resource not found\")\n\n\t// ErrGraphQLForbidden is an error used to test when GitHub GraphQL query\n\t// returns a single error with the type \"FORBIDDEN\".\n\t//\n\t// It should be used with errors.Is.\n\tErrGraphQLForbidden = errors.New(\"GraphQL access forbidden\")\n)\n```\n\n## Functions\n\n```go\nfunc BatchQuery[T any](ctx context.Context, c *Client, queries map[string]string) (map[string]T, error)\n```\nBatchQuery can be used to batch a set of requests together to GitHub's GraphQL API.\n\nThe queries must be for objects represented by type T. T should be a struct to work correctly.\n\n```go\nfunc ErrorResponseStatusCode(err error) int\n```\nErrorResponseStatusCode will unwrap a github.ErrorResponse and return the status code inside.\n\nIf the error is nil, or not an ErrorResponse it will return a status code of 0.\n\n```go\nfunc NewRetryRoundTripper(rt http.RoundTripper, logger *zap.Logger) http.RoundTripper\n```\n\n## Types\n\n```go\ntype Client struct {\n\t// contains filtered or unexported fields\n}\n```\nClient provides simple access to GitHub's REST and GraphQL APIs.\n\n```go\nfunc NewClient(client *http.Client) *Client\n```\nNewClient creates a new instances of Client.\n\n```go\nfunc (c *Client) GraphQL() *graphql.Client\n```\nGraphQL returns a client for communicating with GitHub's GraphQL API.\n\n```go\nfunc (c *Client) Rest() *github.Client\n```\nRest returns a client for communicating with GitHub's REST API.\n\n```go\ntype GitTimestamp struct{ time.Time }\n```\n\n```go\ntype GraphQLError struct {\n\tMessage   string\n\tType      string // GitHub specific GraphQL error field\n\tLocations []struct {\n\t\tLine   int\n\t\tColumn int\n\t}\n}\n```\nGraphQLError stores the error result from a GitHub GraphQL query.\n\n```go\ntype GraphQLErrors struct {\n\t// contains filtered or unexported fields\n}\n```\nGraphQLErrors wraps all the errors returned by a GraphQL response.\n\n```go\nfunc (e *GraphQLErrors) Error() string\n```\nError implements error interface.\n\n```go\nfunc (e *GraphQLErrors) Errors() []GraphQLError\n```\nErrors returns a slice with each Error returned by the GraphQL API.\n\n```go\nfunc (e *GraphQLErrors) HasType(t string) bool\n```\nHasType returns true if one of the errors matches the supplied type.\n\n```go\nfunc (e *GraphQLErrors) Is(target error) bool\n```\nIs implements the errors.Is interface.\n\n","path":"github.com/HUSTSecLab/criticality_score/internal/githubapi","name":"githubapi","synopsis":"","isRedistributable":true}
