Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPHeaderSafeJSON ¶
HTTPHeaderSafeJSON encode the JSON passed in b []byte passed in in a way that is suitable for HTTP headers.
See: https://www.dropbox.com/developers/reference/json-encoding
func OAuthEndpoint ¶
OAuthEndpoint constructs an `oauth2.Endpoint` for the given domain
Types ¶
type APIError ¶
type APIError struct {
ErrorSummary string `json:"error_summary"`
}
APIError is the base type for endpoint-specific errors.
type Config ¶
type Config struct { // OAuth2 access token Token string // Logging level for SDK generated logs LogLevel LogLevel // Logging target for verbose SDK logging Logger *log.Logger // Used with APIs that support operations as another user AsMemberID string // Used with APIs that support operations as an admin AsAdminID string // Path relative to which action should be taken PathRoot string // No need to set -- for testing only Domain string // No need to set -- for testing only Client *http.Client // No need to set -- for testing only HeaderGenerator func(hostType string, namespace string, route string) map[string]string // No need to set -- for testing only URLGenerator func(hostType string, namespace string, route string) string }
Config contains parameters for configuring the SDK.
func (*Config) LogDebug ¶
LogDebug emits a debug level SDK log if config's log level is at least LogDebug
func (*Config) LogInfo ¶
LogInfo emits an info level SDK log if config's log level is at least LogInfo
func (Config) WithNamespaceID ¶
Ergonomic methods to set namespace relative to which action should be taken
type Context ¶
type Context struct { Config Config Client *http.Client NoAuthClient *http.Client HeaderGenerator func(hostType string, namespace string, route string) map[string]string URLGenerator func(hostType string, namespace string, route string) string }
Context is the base client context used to implement per-namespace clients.
func NewContext ¶
NewContext returns a new Context with the given Config.
type LogLevel ¶
type LogLevel uint
LogLevel defines a type that can set the desired level of logging the SDK will generate.
const ( // LogOff will disable all SDK logging. This is the default log level LogOff LogLevel = iota * (1 << 8) // LogDebug will enable detailed SDK debug logs. It will log requests (including arguments), // response and body contents. LogDebug // LogInfo will log SDK request (not including arguments) and responses. LogInfo )
type SDKInternalError ¶
func (SDKInternalError) Error ¶
func (e SDKInternalError) Error() string