dropbox

package
v5.6.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPHeaderSafeJSON

func HTTPHeaderSafeJSON(b []byte) string

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 HandleCommonAPIErrors

func HandleCommonAPIErrors(c Config, resp *http.Response, body []byte) error

HandleCommonAPIErrors handles common API errors

func OAuthEndpoint

func OAuthEndpoint(domain string) oauth2.Endpoint

OAuthEndpoint constructs an `oauth2.Endpoint` for the given domain

func Version

func Version() (string, string)

Version returns the current SDK version and API Spec version

Types

type APIError

type APIError struct {
	ErrorSummary string `json:"error_summary"`
}

APIError is the base type for endpoint-specific errors.

func (APIError) Error

func (e APIError) Error() string

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
	// 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, style string, namespace string, route string) map[string]string
	// No need to set -- for testing only
	URLGenerator func(hostType string, style string, namespace string, route string) string
}

Config contains parameters for configuring the SDK.

func (*Config) LogDebug

func (c *Config) LogDebug(format string, v ...interface{})

LogDebug emits a debug level SDK log if config's log level is at least LogDebug

func (*Config) LogInfo

func (c *Config) LogInfo(format string, v ...interface{})

LogInfo emits an info level SDK log if config's log level is at least LogInfo

type Context

type Context struct {
	Config          Config
	Client          *http.Client
	HeaderGenerator func(hostType string, style string, namespace string, route string) map[string]string
	URLGenerator    func(hostType string, style string, namespace string, route string) string
}

Context is the base client context used to implement per-namespace clients.

func NewContext

func NewContext(c Config) Context

NewContext returns a new Context with the given Config.

func (*Context) NewRequest

func (c *Context) NewRequest(
	hostType string,
	style string,
	authed bool,
	namespace string,
	route string,
	headers map[string]string,
	body io.Reader,
) (*http.Request, error)

NewRequest returns an appropriate Request object for the given namespace/route.

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 Tagged

type Tagged struct {
	Tag string `json:".tag"`
}

Tagged is used for tagged unions.

Directories

Path Synopsis
Package async : has no documentation (yet)
Package async : has no documentation (yet)
Package auth : has no documentation (yet)
Package auth : has no documentation (yet)
Package common : has no documentation (yet)
Package common : has no documentation (yet)
Package contacts : has no documentation (yet)
Package contacts : has no documentation (yet)
Package file_properties : This namespace contains helpers for property and template metadata endpoints.
Package file_properties : This namespace contains helpers for property and template metadata endpoints.
Package file_requests : This namespace contains endpoints and data types for file request operations.
Package file_requests : This namespace contains endpoints and data types for file request operations.
Package files : This namespace contains endpoints and data types for basic file operations.
Package files : This namespace contains endpoints and data types for basic file operations.
Package paper : This namespace contains endpoints and data types for managing docs and folders in Dropbox Paper.
Package paper : This namespace contains endpoints and data types for managing docs and folders in Dropbox Paper.
Package seen_state : has no documentation (yet)
Package seen_state : has no documentation (yet)
Package sharing : This namespace contains endpoints and data types for creating and managing shared links and shared folders.
Package sharing : This namespace contains endpoints and data types for creating and managing shared links and shared folders.
Package team : has no documentation (yet)
Package team : has no documentation (yet)
Package team_common : has no documentation (yet)
Package team_common : has no documentation (yet)
Package team_log : has no documentation (yet)
Package team_log : has no documentation (yet)
Package team_policies : has no documentation (yet)
Package team_policies : has no documentation (yet)
Package users : This namespace contains endpoints and data types for user management.
Package users : This namespace contains endpoints and data types for user management.
Package users_common : This namespace contains common data types used within the users namespace.
Package users_common : This namespace contains common data types used within the users namespace.

Jump to

Keyboard shortcuts

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