dropboxclient

package module
v0.0.0-...-e8dbd66 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: MIT Imports: 10 Imported by: 0

README

go-dropboxclient

Go Dropbox client.

GoDoc

Install

go get github.com/koofr/go-dropboxclient

Test

DROPBOX_ACCESS_TOKEN=mock DROPBOX_USE_MOCK=true go test ./...

Documentation

Index

Constants

View Source
const (
	DropboxClientModifiedFormat = "2006-01-02T15:04:05Z07"
)
View Source
const MetadataDeleted = "deleted"
View Source
const MetadataFile = "file"
View Source
const MetadataFolder = "folder"
View Source
const SpaceAllocationIndividual = "individual"
View Source
const SpaceAllocationTeam = "team"
View Source
const WriteModeAdd = "add"
View Source
const WriteModeOverwrite = "overwrite"
View Source
const WriteModeUpdate = "update"

Variables

This section is empty.

Functions

This section is empty.

Types

type CommitInfo

type CommitInfo struct {
	Path           string     `json:"path"`
	Mode           *WriteMode `json:"mode"`
	Autorename     bool       `json:"autorename"`
	ClientModified *string    `json:"client_modified,omitempty"`
	Mute           bool       `json:"mute"`
}

type CreateFolderArg

type CreateFolderArg struct {
	Path string `json:"path"`
}

type DeleteArg

type DeleteArg struct {
	Path string `json:"path"`
}

type DownloadArg

type DownloadArg struct {
	Path string `json:"path"`
}

type DownloadV1

type DownloadV1 struct {
	ContentLength int64
	ETag          string
	Reader        io.ReadCloser
}

type Dropbox

type Dropbox struct {
	ApiHTTPClient     *httpclient.HTTPClient
	ContentHTTPClient *httpclient.HTTPClient
}

func NewDropbox

func NewDropbox(accessToken string) (dropbox *Dropbox)

func (*Dropbox) ApiRequest

func (c *Dropbox) ApiRequest(req *httpclient.RequestData) (res *http.Response, err error)

func (*Dropbox) ContentRequest

func (c *Dropbox) ContentRequest(req *httpclient.RequestData) (res *http.Response, err error)

func (*Dropbox) Copy

func (c *Dropbox) Copy(ctx context.Context, arg *RelocationArg) (result *Metadata, err error)

func (*Dropbox) CreateFolder

func (c *Dropbox) CreateFolder(ctx context.Context, arg *CreateFolderArg) (result *Metadata, err error)

func (*Dropbox) Delete

func (c *Dropbox) Delete(ctx context.Context, arg *DeleteArg) (result *Metadata, err error)

func (*Dropbox) Download

func (c *Dropbox) Download(ctx context.Context, arg *DownloadArg, span *ioutils.FileSpan) (reader io.ReadCloser, result *Metadata, err error)

func (*Dropbox) GetMetadata

func (c *Dropbox) GetMetadata(ctx context.Context, arg *GetMetadataArg) (result *Metadata, err error)

func (*Dropbox) GetSpaceUsage

func (c *Dropbox) GetSpaceUsage(ctx context.Context) (result *SpaceUsage, err error)

func (*Dropbox) HandleError

func (c *Dropbox) HandleError(err error) error

func (*Dropbox) ListFolder

func (c *Dropbox) ListFolder(ctx context.Context, arg *ListFolderArg) (result *ListFolderResult, err error)

func (*Dropbox) ListFolderContinue

func (c *Dropbox) ListFolderContinue(ctx context.Context, arg *ListFolderContinueArg) (result *ListFolderResult, err error)

func (*Dropbox) Move

func (c *Dropbox) Move(ctx context.Context, arg *RelocationArg) (result *Metadata, err error)

func (*Dropbox) Request

func (c *Dropbox) Request(client *httpclient.HTTPClient, req *httpclient.RequestData) (res *http.Response, err error)

func (*Dropbox) UploadSessionAppend

func (c *Dropbox) UploadSessionAppend(ctx context.Context, arg *UploadSessionCursor, reader io.Reader) (err error)

func (*Dropbox) UploadSessionFinish

func (c *Dropbox) UploadSessionFinish(ctx context.Context, arg *UploadSessionFinishArg) (res *Metadata, err error)

func (*Dropbox) UploadSessionStart

func (c *Dropbox) UploadSessionStart(ctx context.Context, reader io.Reader) (res *UploadSessionStartResult, err error)

type DropboxError

type DropboxError struct {
	ErrorSummary    string              `json:"error_summary"`
	Err             DropboxErrorDetails `json:"error"`
	HttpClientError *httpclient.InvalidStatusError
}

func IsDropboxError

func IsDropboxError(err error) (dropboxErr *DropboxError, ok bool)

func (*DropboxError) Error

func (e *DropboxError) Error() string

type DropboxErrorDetails

type DropboxErrorDetails struct {
	Tag        string       `json:".tag"`
	Path       *LookupError `json:"path"`
	PathLookup *LookupError `json:"path_lookup"`
}

type GetMetadataArg

type GetMetadataArg struct {
	Path             string `json:"path"`
	IncludeMediaInfo bool   `json:"include_media_info"`
}

type ListFolderArg

type ListFolderArg struct {
	Path             string `json:"path"`
	Recursive        bool   `json:"recursive"`
	IncludeMediaInfo bool   `json:"include_media_info"`
	IncludeDeleted   bool   `json:"include_deleted"`
}

type ListFolderContinueArg

type ListFolderContinueArg struct {
	Cursor string `json:"cursor"`
}

type ListFolderResult

type ListFolderResult struct {
	Entries []*Metadata `json:"entries"`
	Cursor  string      `json:"cursor"`
	HasMore bool        `json:"has_more"`
}

type LookupError

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

type Metadata

type Metadata struct {
	Tag            string    `json:".tag"`
	Name           string    `json:"name"`
	PathLower      string    `json:"path_lower"`
	ClientModified time.Time `json:"client_modified"`
	ServerModified time.Time `json:"server_modified"`
	Rev            string    `json:"rev"`
	Size           int64     `json:"size"`
	Id             string    `json:"id"`

	ETag          string
	ContentLength int64
}

type RelocationArg

type RelocationArg struct {
	FromPath string `json:"from_path"`
	ToPath   string `json:"to_path"`
}

type SpaceAllocation

type SpaceAllocation struct {
	Tag       string `json:".tag"`
	Used      int64  `json:"used"`
	Allocated int64  `json:"allocated"`
}

type SpaceUsage

type SpaceUsage struct {
	Used       int64            `json:"used"`
	Allocation *SpaceAllocation `json:"allocation"`
}

type UploadSessionCursor

type UploadSessionCursor struct {
	SessionId string `json:"session_id"`
	Offset    int64  `json:"offset"`
}

type UploadSessionFinishArg

type UploadSessionFinishArg struct {
	Cursor *UploadSessionCursor `json:"cursor"`
	Commit *CommitInfo          `json:"commit"`
}

type UploadSessionStartResult

type UploadSessionStartResult struct {
	SessionId string `json:"session_id"`
}

type WriteMode

type WriteMode struct {
	Tag    string `json:".tag"`
	Update string `json:"update,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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