Documentation
¶
Index ¶
- Constants
- Variables
- func ExchangeAuthCode(ctx context.Context, config *oauth2.Config, code string) (*oauth2.Token, error)
- func GetAuthURL(config *oauth2.Config) string
- func GetConfigDir() (string, error)
- func GetCredentialsPath() (string, error)
- func GetHTTPClient(ctx context.Context) (*http.Client, error)
- func GetOAuthConfig() (*oauth2.Config, error)
- func GetTokenPath() (string, error)
- func ShortenPath(path string) string
Constants ¶
const ( // ConfigDirName is the name of the configuration directory // Deprecated: Use config.DirName instead ConfigDirName = config.DirName // CredentialsFile is the name of the OAuth credentials file // Deprecated: Use config.CredentialsFile instead CredentialsFile = config.CredentialsFile // TokenFile is the name of the OAuth token file (fallback storage) // Deprecated: Use config.TokenFile instead TokenFile = config.TokenFile )
Re-export constants for backward compatibility
Variables ¶
var AllScopes = []string{ gmail.GmailReadonlyScope, calendar.CalendarReadonlyScope, people.ContactsReadonlyScope, drive.DriveReadonlyScope, }
AllScopes contains all OAuth scopes used by the application
Functions ¶
func ExchangeAuthCode ¶
func ExchangeAuthCode(ctx context.Context, config *oauth2.Config, code string) (*oauth2.Token, error)
ExchangeAuthCode exchanges an authorization code for a token
func GetAuthURL ¶
GetAuthURL returns the OAuth authorization URL for the given config
func GetConfigDir ¶
GetConfigDir returns the configuration directory path, creating it if needed. Deprecated: Use config.GetConfigDir() instead
func GetCredentialsPath ¶
GetCredentialsPath returns the full path to credentials.json Deprecated: Use config.GetCredentialsPath() instead
func GetHTTPClient ¶
GetHTTPClient returns an HTTP client with OAuth2 authentication. It retrieves tokens from keychain (preferred) or falls back to file storage. Returns an error if no token is found - caller should direct user to run 'gro init'.
func GetOAuthConfig ¶
GetOAuthConfig loads OAuth configuration from credentials file with all scopes
func GetTokenPath ¶
GetTokenPath returns the full path to token.json (fallback storage) Deprecated: Use config.GetTokenPath() instead
func ShortenPath ¶
ShortenPath replaces the home directory prefix with ~ for display purposes. Deprecated: Use config.ShortenPath() instead
Types ¶
This section is empty.