Documentation
¶
Index ¶
- Constants
- func APIKeyFromEnv() string
- func CheckResponse(resp *http.Response) ([]byte, error)
- func DefaultADCCredentialsPath(goos, homeDir, appData string) string
- func DefaultCredentialsPath() string
- func IsBisectableDocumentError(err error) bool
- func NewADCHTTPClient(ctx context.Context, cfg AuthConfig) (*http.Client, error)
- func NewAuthenticatedHTTPClient(ctx context.Context, cfg AuthConfig) (*http.Client, string, error)
- func NormalizeDocName(name string) string
- func ParseRetryAfter(resp *http.Response) time.Duration
- func SleepContext(ctx context.Context, wait time.Duration) error
- type ADCCredentialsMetadata
- type APIError
- type AuthConfig
- type AuthMode
- type BatchGetResponse
- type Client
- type Document
- type DocumentChunk
- type QuotaProjectTransport
- type RateLimitError
- type TokenSourceFunc
- type Waiter
Constants ¶
View Source
const ( CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" DefaultV1BaseURL = "https://developerknowledge.googleapis.com/v1" DefaultHTTPTimeout = time.Minute )
Variables ¶
This section is empty.
Functions ¶
func APIKeyFromEnv ¶
func APIKeyFromEnv() string
func DefaultCredentialsPath ¶
func DefaultCredentialsPath() string
func NewADCHTTPClient ¶
func NormalizeDocName ¶
Types ¶
type ADCCredentialsMetadata ¶
type ADCCredentialsMetadata struct {
Type string `json:"type"`
QuotaProjectID string `json:"quota_project_id"`
}
func LoadADCCredentialsMetadata ¶
func LoadADCCredentialsMetadata(credentialsPath func() string) ADCCredentialsMetadata
func ResolveQuotaProjectID ¶
func ResolveQuotaProjectID(credentialsPath func() string) (string, ADCCredentialsMetadata)
type AuthConfig ¶
type AuthConfig struct {
Mode AuthMode
Timeout time.Duration
TokenSource TokenSourceFunc
CredentialsPath func() string
}
type BatchGetResponse ¶
type BatchGetResponse struct {
Documents []Document `json:"documents" yaml:"documents"`
}
type Client ¶
type Client struct {
BaseURL string
APIKey string
HTTPClient *http.Client
Context context.Context
Limiter Waiter
Verbose bool
VerboseWriter io.Writer
// MaxRetries is the number of additional attempts after the first request.
MaxRetries int
}
func (*Client) BatchGetDocuments ¶
func (*Client) DoAPIRequest ¶
type Document ¶
type Document struct {
Name string `json:"name" yaml:"name"`
URI string `json:"uri" yaml:"uri"`
Content string `json:"content,omitempty" yaml:"content,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
DataSource string `json:"dataSource,omitempty" yaml:"data_source,omitempty"`
Title string `json:"title,omitempty" yaml:"title,omitempty"`
UpdateTime string `json:"updateTime,omitempty" yaml:"update_time,omitempty"`
View string `json:"view,omitempty" yaml:"view,omitempty"`
}
type DocumentChunk ¶
type QuotaProjectTransport ¶
type QuotaProjectTransport struct {
Base http.RoundTripper
Project string
}
type RateLimitError ¶
func (*RateLimitError) Error ¶
func (e *RateLimitError) Error() string
type TokenSourceFunc ¶
var DefaultTokenSource TokenSourceFunc = func(ctx context.Context, scopes ...string) (oauth2.TokenSource, error) { return google.DefaultTokenSource(ctx, scopes...) }
Click to show internal directories.
Click to hide internal directories.