dropbox

package
v0.0.0-...-de3975b Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthenticationEndpoint = "https://api.dropbox.com"
	ContentUploadEndpoint  = "https://content.dropboxapi.com"
)
View Source
const (
	ResponseTypeCode  = "code"
	ResponseTypeToken = "token"
)
View Source
const (
	TokenAccessTypeOffline = "offline"
	TokenAccessTypeOline   = "online"
)
View Source
const (
	GrantTypeAuthorizationCode = "authorization_code"
	GrantTypeRefreshToken      = "refresh_token"
)
View Source
const (
	WriteModeAdd       = "add"
	WriteModeOverwrite = "overwrite"
	WriteModeUpdate    = "update"
)
View Source
const ServiceAPIVersion = "2"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Credentials *Credentials
	HTTPClient  HTTPClient
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) (*Client, error)

func (*Client) CredentialsPath

func (c *Client) CredentialsPath() string

func (*Client) FilesUpload

func (c *Client) FilesUpload(params *FilesUploadInput) (*FilesUploadOutput, error)

func (*Client) OAuth2Token

func (c *Client) OAuth2Token(params *OAuth2TokenInput) (*OAuth2TokenOutput, error)

type Credentials

type Credentials struct {
	AppKey       string `toml:"dropbox-app-key"`
	AppSecret    string `toml:"dropbox-app-secret"`
	AccessToken  string `toml:"dropbox-access-token"`
	RefreshToken string `toml:"dropox-refresh-token"`
}

type CredentialsResolver

type CredentialsResolver struct {
	// contains filtered or unexported fields
}

type EnvResolver

type EnvResolver struct {
	// contains filtered or unexported fields
}

type FileResolver

type FileResolver struct {
	// contains filtered or unexported fields
}

type FilesUploadInput

type FilesUploadInput struct {
	Body      io.Reader
	UploadArg *UploadArg
}

type FilesUploadOutput

type FilesUploadOutput struct {
	ClientModified time.Time `json:"client_modified"`
	ContentHash    string    `json:"content_hash"`
	FileLockInfo   struct {
		Created        time.Time `json:"created"`
		IsLockholder   bool      `json:"is_lockholder"`
		LockholderName string    `json:"lockholder_name"`
	} `json:"file_lock_info"`
	HasExplicitSharedMembers bool   `json:"has_explicit_shared_members"`
	ID                       string `json:"id"`
	IsDownloadable           bool   `json:"is_downloadable"`
	Name                     string `json:"name"`
	PathDisplay              string `json:"path_display"`
	PathLower                string `json:"path_lower"`
	PropertyGroups           []struct {
		Fields []struct {
			Name  string `json:"name"`
			Value string `json:"value"`
		} `json:"fields"`
		TemplateID string `json:"template_id"`
	} `json:"property_groups"`
	Rev            string    `json:"rev"`
	ServerModified time.Time `json:"server_modified"`
	SharingInfo    struct {
		ModifiedBy           string `json:"modified_by"`
		ParentSharedFolderID string `json:"parent_shared_folder_id"`
		ReadOnly             bool   `json:"read_only"`
	} `json:"sharing_info"`
	Size int `json:"size"`
}

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

type OAuth2TokenInput

type OAuth2TokenInput struct {
	Code              string `schema:"code,omitempty"`
	CodeChallenge     string `schema:"code_challenge,omitempty"`
	CodeVerifier      string `schema:"code_verifier,omitempty"`
	ExpirationMinutes string `schema:"expiration_minutes,omitempty"`
	GrantType         string `schema:"grant_type,omitempty"`
	RedirectURI       string `schema:"redirect_uri,omitempty"`
	RefreshToken      string `schema:"refresh_token,omitempty"`
	Scope             string `schema:"scope,omitempty"`
}

type OAuth2TokenOutput

type OAuth2TokenOutput struct {
	AccountID    string `json:"account_id"`
	AccessToken  string `json:"access_token"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	Scope        string `json:"scope"`
	TokenType    string `json:"token_type"`
	UID          string `json:"uid"`
}

type Option

type Option func(*Client)

func WithCredentialsPath

func WithCredentialsPath(path string) Option

func WithHTTPClient

func WithHTTPClient(cli HTTPClient) Option

type Resolver

type Resolver interface {
	// contains filtered or unexported methods
}

type UploadArg

type UploadArg struct {
	Autorename     bool   `json:"auto_rename,omitempty"`
	ClientModified string `json:"client_modified,omitempty"`
	ContentHash    string `json:"content_hash,omitempty"`
	Mode           string `json:"mode"`
	Mute           bool   `json:"mute"`
	Path           string `json:"path"`
	StrictConflict bool   `json:"strict_conflict,omitempty"`
}

Jump to

Keyboard shortcuts

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