api

package
v1.52.1-0...-9b21a15 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package api contains definitions for using the premiumize.me API

Index

Constants

View Source
const (
	ItemTypeFolder = "folder"
	ItemTypeFile   = "file"
)

Item Types

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountInfoResponse

type AccountInfoResponse struct {
	Response
	CustomerID   string  `json:"customer_id,omitempty"`
	LimitUsed    float64 `json:"limit_used,omitempty"` // fraction 0..1 of download traffic limit
	PremiumUntil int64   `json:"premium_until,omitempty"`
	SpaceUsed    float64 `json:"space_used,omitempty"`
}

AccountInfoResponse is the response to account/info

type Breadcrumb struct {
	ID       string `json:"id,omitempty"`
	Name     string `json:"name,omitempty"`
	ParentID string `json:"parent_id,omitempty"`
}

Breadcrumb is part the breadcrumb trail for a file or folder. It is returned as part of folder/list if required

type FolderCreateResponse

type FolderCreateResponse struct {
	Response
	ID string `json:"id,omitempty"`
}

FolderCreateResponse is the response to folder/create

type FolderListResponse

type FolderListResponse struct {
	Response
	Content  []Item `json:"content"`
	Name     string `json:"name,omitempty"`
	ParentID string `json:"parent_id,omitempty"`
}

FolderListResponse is the response to folder/list

type FolderUploadinfoResponse

type FolderUploadinfoResponse struct {
	Response
	Token string `json:"token,omitempty"`
	URL   string `json:"url,omitempty"`
}

FolderUploadinfoResponse is the response to folder/uploadinfo

type Item

type Item struct {
	Breadcrumbs     []Breadcrumb `json:"breadcrumbs"`
	CreatedAt       int64        `json:"created_at,omitempty"`
	ID              string       `json:"id"`
	Link            string       `json:"link,omitempty"`
	Name            string       `json:"name"`
	Size            int64        `json:"size,omitempty"`
	StreamLink      string       `json:"stream_link,omitempty"`
	Type            string       `json:"type"`
	TranscodeStatus string       `json:"transcode_status"`
	IP              string       `json:"ip"`
	MimeType        string       `json:"mime_type"`
}

Item refers to a file or folder

type Response

type Response struct {
	Message string `json:"message,omitempty"`
	Status  string `json:"status"`
}

Response is returned by all messages and embedded in the structures below

func (*Response) AsErr

func (e *Response) AsErr() error

AsErr checks the status and returns an err if bad or nil if good

func (*Response) Error

func (e *Response) Error() string

Error satisfies the error interface

Jump to

Keyboard shortcuts

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