googleapi

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CircuitBreakerThreshold is the number of consecutive failures to open the circuit
	CircuitBreakerThreshold = 5
	// CircuitBreakerResetTime is how long to wait before attempting to close the circuit
	CircuitBreakerResetTime = 30 * time.Second
)
View Source
const (
	// MaxRateLimitRetries is the maximum number of retries on 429 responses.
	MaxRateLimitRetries = 3
	// RateLimitBaseDelay is the initial delay for rate limit exponential backoff.
	RateLimitBaseDelay = 1 * time.Second
	// Max5xxRetries is the maximum retries for server errors.
	Max5xxRetries = 1
	// ServerErrorRetryDelay is the delay before retrying on 5xx errors.
	ServerErrorRetryDelay = 1 * time.Second
)

Variables

This section is empty.

Functions

func IsAuthRequiredError added in v0.4.0

func IsAuthRequiredError(err error) bool

IsAuthRequiredError checks if the error is an auth required error

func IsCircuitBreakerError added in v0.4.0

func IsCircuitBreakerError(err error) bool

IsCircuitBreakerError checks if the error is a circuit breaker error

func IsNotFoundError added in v0.4.0

func IsNotFoundError(err error) bool

IsNotFoundError checks if the error is a not found error

func IsPermissionDeniedError added in v0.4.0

func IsPermissionDeniedError(err error) bool

IsPermissionDeniedError checks if the error is a permission denied error

func IsQuotaExceededError added in v0.4.0

func IsQuotaExceededError(err error) bool

IsQuotaExceededError checks if the error is a quota exceeded error

func IsRateLimitError added in v0.4.0

func IsRateLimitError(err error) bool

IsRateLimitError checks if the error is a rate limit error

func NewAppScript added in v0.11.0

func NewAppScript(ctx context.Context, email string) (*script.Service, error)

func NewCalendar

func NewCalendar(ctx context.Context, email string) (*calendar.Service, error)

func NewChat added in v0.8.0

func NewChat(ctx context.Context, email string) (*chat.Service, error)

func NewClassroom added in v0.7.0

func NewClassroom(ctx context.Context, email string) (*classroom.Service, error)

func NewCloudIdentityGroups added in v0.5.0

func NewCloudIdentityGroups(ctx context.Context, email string) (*cloudidentity.Service, error)

NewCloudIdentityGroups creates a Cloud Identity service for reading groups. This API allows non-admin users to list groups they belong to and view group members.

func NewDocs added in v0.5.0

func NewDocs(ctx context.Context, email string) (*docs.Service, error)

func NewDrive

func NewDrive(ctx context.Context, email string) (*drive.Service, error)

func NewForms added in v0.11.0

func NewForms(ctx context.Context, email string) (*forms.Service, error)

func NewGmail

func NewGmail(ctx context.Context, email string) (*gmail.Service, error)

func NewKeep added in v0.5.0

func NewKeep(ctx context.Context, email string) (*keep.Service, error)

func NewKeepWithServiceAccount added in v0.5.0

func NewKeepWithServiceAccount(ctx context.Context, serviceAccountPath, impersonateEmail string) (*keep.Service, error)

func NewPeopleContacts

func NewPeopleContacts(ctx context.Context, email string) (*people.Service, error)

func NewPeopleDirectory

func NewPeopleDirectory(ctx context.Context, email string) (*people.Service, error)

func NewPeopleOtherContacts

func NewPeopleOtherContacts(ctx context.Context, email string) (*people.Service, error)

func NewSheets added in v0.4.0

func NewSheets(ctx context.Context, email string) (*sheets.Service, error)

func NewSlides added in v0.10.0

func NewSlides(ctx context.Context, email string) (*slides.Service, error)

func NewTasks added in v0.2.0

func NewTasks(ctx context.Context, email string) (*tasks.Service, error)

Types

type AuthRequiredError

type AuthRequiredError struct {
	Service string
	Email   string
	Client  string
	Cause   error
}

func (*AuthRequiredError) Error

func (e *AuthRequiredError) Error() string

func (*AuthRequiredError) Unwrap

func (e *AuthRequiredError) Unwrap() error

type CircuitBreaker added in v0.4.0

type CircuitBreaker struct {
	// contains filtered or unexported fields
}

func NewCircuitBreaker added in v0.4.0

func NewCircuitBreaker() *CircuitBreaker

func (*CircuitBreaker) IsOpen added in v0.4.0

func (cb *CircuitBreaker) IsOpen() bool

func (*CircuitBreaker) RecordFailure added in v0.4.0

func (cb *CircuitBreaker) RecordFailure() bool

func (*CircuitBreaker) RecordSuccess added in v0.4.0

func (cb *CircuitBreaker) RecordSuccess()

func (*CircuitBreaker) State added in v0.4.0

func (cb *CircuitBreaker) State() string

type CircuitBreakerError added in v0.4.0

type CircuitBreakerError struct{}

CircuitBreakerError indicates the circuit breaker is open

func (*CircuitBreakerError) Error added in v0.4.0

func (e *CircuitBreakerError) Error() string

type NotFoundError added in v0.4.0

type NotFoundError struct {
	Resource string
	ID       string
}

NotFoundError indicates the requested resource was not found

func (*NotFoundError) Error added in v0.4.0

func (e *NotFoundError) Error() string

type PermissionDeniedError added in v0.4.0

type PermissionDeniedError struct {
	Resource string
	Action   string
}

PermissionDeniedError indicates insufficient permissions

func (*PermissionDeniedError) Error added in v0.4.0

func (e *PermissionDeniedError) Error() string

type QuotaExceededError added in v0.4.0

type QuotaExceededError struct {
	Resource string
}

QuotaExceededError indicates API quota was exceeded

func (*QuotaExceededError) Error added in v0.4.0

func (e *QuotaExceededError) Error() string

type RateLimitError added in v0.4.0

type RateLimitError struct {
	RetryAfter time.Duration
	Retries    int
}

RateLimitError indicates rate limit was exceeded

func (*RateLimitError) Error added in v0.4.0

func (e *RateLimitError) Error() string

type RetryTransport added in v0.4.0

type RetryTransport struct {
	Base           http.RoundTripper
	MaxRetries429  int
	MaxRetries5xx  int
	BaseDelay      time.Duration
	CircuitBreaker *CircuitBreaker
}

RetryTransport wraps an http.RoundTripper with retry logic for rate limits (429) and server errors (5xx).

func NewRetryTransport added in v0.4.0

func NewRetryTransport(base http.RoundTripper) *RetryTransport

NewRetryTransport creates a RetryTransport with sensible defaults.

func (*RetryTransport) RoundTrip added in v0.4.0

func (t *RetryTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper with retry logic.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL