Documentation
¶
Overview ¶
Package githubapi holds the request conventions shared by every component that calls the GitHub API directly: the REST headers, pinned to one API version, and the GraphQL request and response envelope.
It is not a client. Callers keep their own *http.Client, with the API root resolved by platform/http.BaseURLTransport and auth set by a transport, and their own typed requests; this package only removes the parts every caller would otherwise repeat.
Index ¶
Constants ¶
const Version = "2026-03-10"
Version is the GitHub REST API version every REST request pins.
Variables ¶
This section is empty.
Functions ¶
func QueryGraphQL ¶
QueryGraphQL posts req to the client's /graphql and decodes the response's data into data. A non-200 reply is a *platform/http.StatusError, so error classifiers can read its code; a 200 reply that carries errors fails even when it also carries data. A null data leaves data untouched.
func SetRESTHeaders ¶
SetRESTHeaders sets the headers of a JSON request to the GitHub REST API. It has the signature platform/http.SendRequest takes for its setHeaders.
Types ¶
type GraphQLRequest ¶
type GraphQLRequest struct {
// Query is the GraphQL document.
Query string `json:"query"`
// Variables binds the query's variables by name.
Variables map[string]any `json:"variables"`
}
GraphQLRequest is the body of a request to the GitHub GraphQL API.