Provides a factory function for constructing go-gh REST client options with repository-standard defaults.
The githubapi package is a thin adapter over the github.com/cli/go-gh/v2/pkg/api library. Its sole responsibility is to produce an api.ClientOptions value pre-populated with the repository's default HTTP timeout (constants.DefaultHTTPClientTimeout), so callers do not have to remember to set this timeout themselves.
| Function | Signature | Description |
|---|---|---|
ClientOptions |
func(host, authToken string) api.ClientOptions |
Returns go-gh REST client options with the repository default timeout applied |
func ClientOptions(host, authToken string) api.ClientOptionsReturns an api.ClientOptions struct suitable for passing to api.NewRESTClient or api.NewGraphQLClient.
Behavioral contract:
- MUST set
Hostto the providedhostvalue. - MUST set
AuthTokento the providedauthTokenvalue. - MUST set
Timeouttoconstants.DefaultHTTPClientTimeout.
import (
"github.com/cli/go-gh/v2/pkg/api"
"github.com/github/gh-aw/pkg/githubapi"
)
opts := githubapi.ClientOptions("github.com", token)
client, err := api.NewRESTClient(opts)Internal:
github.com/github/gh-aw/pkg/constants— suppliesDefaultHTTPClientTimeout
External:
github.com/cli/go-gh/v2/pkg/api— defines theClientOptionsstruct
This specification is automatically maintained by the spec-extractor workflow.
