dropbox

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Host    string
	Version int
	Config  configInterface
}

Client for the Dropbox API interactions

func DefaultClient

func DefaultClient() (c Client, err error)

DefaultClient returns the client with the default config

func (c Client) CreateLink(filename string) (link Link, err error)

CreateLink handles the filename and returns the Link object

func (Client) Truncate

func (c Client) Truncate(filename string) (truncated string, err error)

Truncate removes the full dropbox path from the filename

type Config

type Config struct {
	DropboxPath string `json:"dropbox_path"`
	GifDir      string `json:"dropbox_gif_dir"`
	APIToken    string `json:"dropbox_api_token"`
	Path        string
	Loaded      bool
}

Config is the object to be used when working with Client

func NewConfig

func NewConfig() (d Config, err error)

NewConfig attempts to load an existing configuration

func (Config) DatabasePath

func (c Config) DatabasePath() string

DatabasePath provides the full path to the database file

func (Config) Environment

func (c Config) Environment() string

Environment returns the environment for the Config

func (Config) FullPath

func (c Config) FullPath() string

FullPath provides the full dropbox & gifs path

func (Config) GifsPath

func (c Config) GifsPath() string

GifsPath provides the full dropbox & gifs path

func (Config) LoadedPath

func (c Config) LoadedPath() string

LoadedPath provides the full path to the loaded config file

func (Config) Token

func (c Config) Token() string

Token returns the api token for use in API calls

func (Config) Valid

func (c Config) Valid() (ok bool)

Valid returns whether the config is valid

type Link struct {
	Tag            string          `json:".tag"`
	URL            string          `json:"url"`
	ID             string          `json:"id"`
	Name           string          `json:"name"`
	Path           string          `json:"path_lower"`
	Permissions    LinkPermissions `json:"link_permissions"`
	ClientModified string          `json:"client_modified"`
	ServerModified string          `json:"server_modified"`
	Revision       string          `json:"rev"`
	FileSize       int             `json:"size"`
	GifsDir        string
}

Link is the data that is provided from the Dropbox API

func (Link) Directory

func (l Link) Directory() string

Directory returns the directory path

func (Link) DropboxID

func (l Link) DropboxID() string

DropboxID Returns the Dropbox ID

func (Link) Markdown

func (l Link) Markdown() string

Markdown returns the embeddable markdown string

func (Link) RemotePath

func (l Link) RemotePath() string

RemotePath returns the "s/DROPBOX_HASH"

type LinkPermissions

type LinkPermissions struct {
	ResolvedVisibility  LinkTag `json:"resolved_visibility"`
	RequestedVisibility LinkTag `json:"requested_visibility"`
	CanRevoke           bool    `json:"can_revoke"`
}

LinkPermissions are the permissions that Dropbox as assigned

type LinkTag

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

LinkTag is a tag assgined to a link

Jump to

Keyboard shortcuts

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