Documentation ¶
Index ¶
- Constants
- Variables
- func CheckExpiration(token string) (expired bool, err error)
- func Whoami(token string) (email string, expirationTime time.Time, err error)
- type APIError
- type Box
- type ClientEphemeralfiles
- func (c *ClientEphemeralfiles) DisableProgressBar()
- func (c *ClientEphemeralfiles) Download(uuidFile string, outputfile string) error
- func (c *ClientEphemeralfiles) DownloadEndpoint(uuidFile string) string
- func (c *ClientEphemeralfiles) Fetch() (FileList, error)
- func (c *ClientEphemeralfiles) FilesEndpoint() string
- func (c *ClientEphemeralfiles) GetBoxInfos() (*Box, error)
- func (c *ClientEphemeralfiles) Remove(uuidFileToRemove string) error
- func (c *ClientEphemeralfiles) SetEndpoint(endpoint string)
- func (c *ClientEphemeralfiles) SetHTTPClient(client *http.Client)
- func (c *ClientEphemeralfiles) Upload(fileToUpload string) error
- func (c *ClientEphemeralfiles) UploadEndpoint() string
- func (c *ClientEphemeralfiles) UploadWithProgressBar(fileToUpload string) error
- func (c *ClientEphemeralfiles) UploadWithoutProgressBar(fileToUpload string) error
- type File
- type FileList
Constants ¶
const DefaultAPIRequestTimeout = 5 * time.Second
const (
DefaultBarWidth = 50
)
Variables ¶
var ( ErrInvalidToken = errors.New("invalid token") Now func() time.Time // for testing purposes )
var (
ErrFileNotFound = errors.New("file not found")
)
Functions ¶
func CheckExpiration ¶
Types ¶
type ClientEphemeralfiles ¶
type ClientEphemeralfiles struct {
// contains filtered or unexported fields
}
ClientEphemeralfiles is the client to interact with the API
func (*ClientEphemeralfiles) DisableProgressBar ¶
func (c *ClientEphemeralfiles) DisableProgressBar()
func (*ClientEphemeralfiles) Download ¶
func (c *ClientEphemeralfiles) Download(uuidFile string, outputfile string) error
Download downloads a file from the server and saves it to the outputfile If the outputfile is empty, the file will be saved to the current directory with the same name as the file on the server (retrieving the name from the Content-Disposition header)
func (*ClientEphemeralfiles) DownloadEndpoint ¶
func (c *ClientEphemeralfiles) DownloadEndpoint(uuidFile string) string
func (*ClientEphemeralfiles) Fetch ¶
func (c *ClientEphemeralfiles) Fetch() (FileList, error)
Fetch retrieves the list of files from the server
func (*ClientEphemeralfiles) FilesEndpoint ¶
func (c *ClientEphemeralfiles) FilesEndpoint() string
FilesEndpoint returns the endpoint for the files
func (*ClientEphemeralfiles) GetBoxInfos ¶
func (c *ClientEphemeralfiles) GetBoxInfos() (*Box, error)
func (*ClientEphemeralfiles) Remove ¶
func (c *ClientEphemeralfiles) Remove(uuidFileToRemove string) error
Download downloads a file from the server and saves it to the outputfile If the outputfile is empty, the file will be saved to the current directory with the same name as the file on the server (retrieving the name from the Content-Disposition header)
func (*ClientEphemeralfiles) SetEndpoint ¶
func (c *ClientEphemeralfiles) SetEndpoint(endpoint string)
func (*ClientEphemeralfiles) SetHTTPClient ¶
func (c *ClientEphemeralfiles) SetHTTPClient(client *http.Client)
func (*ClientEphemeralfiles) Upload ¶
func (c *ClientEphemeralfiles) Upload(fileToUpload string) error
func (*ClientEphemeralfiles) UploadEndpoint ¶
func (c *ClientEphemeralfiles) UploadEndpoint() string
func (*ClientEphemeralfiles) UploadWithProgressBar ¶
func (c *ClientEphemeralfiles) UploadWithProgressBar(fileToUpload string) error
func (*ClientEphemeralfiles) UploadWithoutProgressBar ¶
func (c *ClientEphemeralfiles) UploadWithoutProgressBar(fileToUpload string) error
type File ¶
type File struct { Idfile string `json:"idfile"` FileName string `json:"filename"` Size int64 `json:"size"` UpdateDateBegin time.Time `json:"update_date_egin"` UpdateDateEnd time.Time `json:"update_date_end"` ExpirationDate time.Time `json:"expiration_date"` }
File is the struct that represents a file in the API