dropbox

package
v6.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: MIT Imports: 11 Imported by: 33

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 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
	// 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

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

func (Config) WithNamespaceID added in v6.0.2

func (c Config) WithNamespaceID(nsID string) Config

Ergonomic methods to set namespace relative to which action should be taken

func (Config) WithRoot added in v6.0.2

func (c Config) WithRoot(nsID string) Config

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

func NewContext(c Config) Context

NewContext returns a new Context with the given Config.

func (*Context) Execute added in v6.0.2

func (c *Context) Execute(req Request, body io.Reader) ([]byte, io.ReadCloser, error)

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 Request added in v6.0.2

type Request struct {
	Host      string
	Namespace string
	Route     string
	Style     string
	Auth      string

	Arg          interface{}
	ExtraHeaders map[string]string
}

type SDKInternalError added in v6.0.2

type SDKInternalError struct {
	StatusCode int
	Content    string
}

func (SDKInternalError) Error added in v6.0.2

func (e SDKInternalError) Error() string

type Tagged

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

Tagged is used for tagged unions.

Directories

Path Synopsis
Package account : has no documentation (yet)
Package account : has no documentation (yet)
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 check : has no documentation (yet)
Package check : 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 openid : has no documentation (yet)
Package openid : has no documentation (yet)
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 secondary_emails : has no documentation (yet)
Package secondary_emails : has no documentation (yet)
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