Documentation
¶
Index ¶
- Constants
- func NewClient(ctx context.Context, options ...Option) (*http.Client, error)
- type AuthCredentials
- type BaseHttpClient
- type BasicAuth
- type BearerAuth
- type CreateJWTConfig
- type DoOption
- type ErrorResponse
- type HttpClient
- type NoAuth
- type OAuth2ClientCredentials
- type OAuth2JWT
- type OAuth2RefreshToken
- type Option
- type RequestOption
- type Transport
- type WrapperResponse
Constants ¶
View Source
const ContentType = "Content-Type"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthCredentials ¶ added in v0.1.23
type BaseHttpClient ¶ added in v0.1.24
func NewBaseHttpClient ¶ added in v0.1.25
func NewBaseHttpClient(httpClient *http.Client) *BaseHttpClient
func (*BaseHttpClient) NewRequest ¶ added in v0.1.24
func (c *BaseHttpClient) NewRequest(ctx context.Context, method string, url *url.URL, options ...RequestOption) (*http.Request, error)
type BasicAuth ¶ added in v0.1.23
func NewBasicAuth ¶ added in v0.1.23
type BearerAuth ¶ added in v0.1.23
type BearerAuth struct {
Token string
}
func NewBearerAuth ¶ added in v0.1.23
func NewBearerAuth(token string) *BearerAuth
type CreateJWTConfig ¶ added in v0.1.23
type DoOption ¶ added in v0.1.24
type DoOption func(resp *WrapperResponse) error
func WithErrorResponse ¶ added in v0.1.27
func WithErrorResponse(resource ErrorResponse) DoOption
func WithJSONResponse ¶ added in v0.1.24
func WithJSONResponse(response interface{}) DoOption
func WithRatelimitData ¶ added in v0.1.27
func WithRatelimitData(resource *v2.RateLimitDescription) DoOption
func WithResponse ¶ added in v0.1.32
func WithResponse(response interface{}) DoOption
func WithXMLResponse ¶ added in v0.1.28
func WithXMLResponse(response interface{}) DoOption
type ErrorResponse ¶ added in v0.1.27
type ErrorResponse interface {
Message() string
}
type HttpClient ¶ added in v0.1.24
type OAuth2ClientCredentials ¶ added in v0.1.23
type OAuth2ClientCredentials struct {
// contains filtered or unexported fields
}
func NewOAuth2ClientCredentials ¶ added in v0.1.23
func NewOAuth2ClientCredentials(clientId, clientSecret string, tokenURL *url.URL, scopes []string) *OAuth2ClientCredentials
type OAuth2JWT ¶ added in v0.1.23
type OAuth2JWT struct { Credentials []byte Scopes []string CreateJWTConfig CreateJWTConfig }
func NewOAuth2JWT ¶ added in v0.1.23
func NewOAuth2JWT(credentials []byte, scopes []string, createfn CreateJWTConfig) *OAuth2JWT
type OAuth2RefreshToken ¶ added in v0.1.34
type OAuth2RefreshToken struct {
// contains filtered or unexported fields
}
func NewOAuth2RefreshToken ¶ added in v0.1.34
func NewOAuth2RefreshToken(clientID, clientSecret, redirectURI, tokenURL, accessToken, refreshToken string, scopes []string) *OAuth2RefreshToken
type Option ¶
type Option interface {
Apply(*Transport)
}
func WithLogger ¶
WithLogger sets a logger options to the transport layer.
func WithTLSClientConfig ¶
WithTLSClientConfig returns an Option that sets the TLS client configuration. `tlsConfig` is a structure that is used to configure a TLS client or server.
func WithUserAgent ¶
WithUserAgent sets a user agent option to the transport layer.
type RequestOption ¶ added in v0.1.24
type RequestOption func() (io.ReadWriter, map[string]string, error)
func WithAcceptJSONHeader ¶ added in v0.1.24
func WithAcceptJSONHeader() RequestOption
func WithAcceptXMLHeader ¶ added in v0.1.28
func WithAcceptXMLHeader() RequestOption
func WithContentTypeJSONHeader ¶ added in v0.1.24
func WithContentTypeJSONHeader() RequestOption
func WithHeader ¶ added in v0.1.33
func WithHeader(key, value string) RequestOption
func WithJSONBody ¶ added in v0.1.24
func WithJSONBody(body interface{}) RequestOption
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
func NewTransport ¶
NewTransport creates a new Transport, applies the options, and then cycles the transport.
Click to show internal directories.
Click to hide internal directories.