{"modulePath":"github.com/hostinger/api-cli","version":"v1.2.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package api\n\n## Functions\n\n```go\nfunc Request() client.ClientWithResponsesInterface\n```\n\n## Types\n\n```go\ntype OAuthService struct {\n\t// contains filtered or unexported fields\n}\n```\nOAuthService obtains and maintains a bearer token via the OAuth flow. The zero value is not usable; construct one with NewOAuthService.\n\n```go\nfunc NewOAuthService() (*OAuthService, error)\n```\nNewOAuthService builds a service with the default issuer (overridable via the HOSTINGER\\_OAUTH\\_ISSUER env var) and the standard on-disk credentials path.\n\n```go\nfunc (s *OAuthService) Login(ctx context.Context) (string, error)\n```\nLogin runs the full interactive PKCE flow regardless of cache state.\n\n```go\nfunc (s *OAuthService) Logout(ctx context.Context) error\n```\nLogout best-effort revokes the access token and wipes local tokens, keeping the registered client\\_id so a later login can skip dynamic registration.\n\n```go\nfunc (s *OAuthService) Reauthenticate(ctx context.Context) (string, error)\n```\nReauthenticate forces a fresh token, bypassing the cached-token fast path. It mirrors Token's refresh-then-login fallback and is meant for the reactive 401 recovery path, where the cached token is already known to be dead.\n\n```go\nfunc (s *OAuthService) Refresh(ctx context.Context) (string, error)\n```\nRefresh exchanges the stored refresh token for a fresh access token.\n\n```go\nfunc (s *OAuthService) Token(ctx context.Context) (string, error)\n```\nToken returns a usable access token: the cached one if still valid, otherwise a proactive refresh, otherwise a full interactive login.\n\n","path":"github.com/hostinger/api-cli/api","name":"api","synopsis":"","isRedistributable":true}
