Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAuthenticatedClient ¶
func GetAuthenticatedClient(ctx context.Context, ts *TokenStorage, cfg *config.Config) (*http.Client, error)
GetAuthenticatedClient configures and returns an HTTP client ready for making authenticated API calls. It manages the entire OAuth2 flow, including handling proxies, loading existing tokens, initiating a new web-based OAuth flow if necessary, and refreshing tokens.
Types ¶
type TokenStorage ¶
type TokenStorage struct { // Token holds the raw OAuth2 token data, including access and refresh tokens. Token any `json:"token"` // ProjectID is the Google Cloud Project ID associated with this token. ProjectID string `json:"project_id"` // Email is the email address of the authenticated user. Email string `json:"email"` // Auto indicates if the project ID was automatically selected. Auto bool `json:"auto"` // Checked indicates if the associated Cloud AI API has been verified as enabled. Checked bool `json:"checked"` }
TokenStorage defines the structure for storing OAuth2 token information, along with associated user and project details. This data is typically serialized to a JSON file for persistence.
Click to show internal directories.
Click to hide internal directories.