{"modulePath":"github.com/hostinger/mail-api-cli","version":"v1.11.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package api\n\n## Functions\n\n```go\nfunc BaseURL() string\n```\nBaseURL returns the configured api\\_url, or the API's default base URL.\n\n```go\nfunc CommandError(err error) error\n```\nCommandError gives an API error from a raw call the exit code and hints the generated commands give theirs; other errors pass through.\n\n```go\nfunc CompletionRequest() client.ClientWithResponsesInterface\n```\nCompletionRequest returns an API client for shell completion: it uses the static token or an already stored OAuth sign-in, and never starts an interactive login.\n\n```go\nfunc Request() client.ClientWithResponsesInterface\n```\nRequest returns the API client for a command run. Without a static token it signs in through OAuth, opening the browser when needed.\n\n```go\nfunc SetDiagnostics(w io.Writer)\n```\nSetDiagnostics routes --verbose lines and the sign-in URL through w, so a command that redraws a live view can print them above it; nil is stderr.\n\n```go\nfunc UserAgent() string\n```\nUserAgent is the User-Agent header value of every API request.\n\n## Types\n\n```go\ntype Error struct {\n\tMethod string\n\tPath   string\n\tStatus int\n\tBody   []byte\n}\n```\n\n```go\nfunc (e *Error) Error() string\n```\n\n```go\ntype RawClient struct {\n\t// contains filtered or unexported fields\n}\n```\nRawClient calls API paths directly, configured like the typed client, so hand-written commands don't depend on generated method names.\n\n```go\nfunc NewRawClient(server string, doer client.HttpRequestDoer) *RawClient\n```\nNewRawClient has no authentication (tests).\n\n```go\nfunc Raw() *RawClient\n```\nRaw ignores --dry-run: hand-written commands look up the website, account or order with it before the request --dry-run prints, so those lookups are sent. Under --dry-run they use a token or a stored sign-in but never start a login, so a dry run without credentials fails at once instead of waiting on a browser.\n\n```go\nfunc (r *RawClient) JSON(ctx context.Context, method, path string, query url.Values, body any, out any) error\n```\nJSON decodes a 2xx response into out (may be nil); other statuses are \\*Error.\n\n","path":"github.com/hostinger/mail-api-cli/api","name":"api","synopsis":"","isRedistributable":true}
