api

package
v1.73.1-bclone Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package api provides types used by the Terabox API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrIsNum

func ErrIsNum(err error, numbers ...int) bool

ErrIsNum checking is provided error is Terabox error. Can be a multiple error codes for one error

func Num2Err

func Num2Err(number int) error

Num2Err convert error number to error presence

Types

type ErrorAPI

type ErrorAPI struct {
	ErrNumber int `json:"errno"`
}

ErrorAPI - Terabox API error

func (ErrorAPI) Err

func (err ErrorAPI) Err() error

Err return the error if number of error not 0, otherwise nil

func (ErrorAPI) Error

func (err ErrorAPI) Error() string

Error is Error Interface implementation

func (ErrorAPI) ErrorNumber

func (err ErrorAPI) ErrorNumber() int

ErrorNumber return Terabox error number

type ErrorInterface

type ErrorInterface interface {
	ErrorNumber() int
	Error() string
	Err() error
}

ErrorInterface universal Error Interface

type Item

type Item struct {
	ID                 uint64 `json:"fs_id"` // The file ID; the unique identification of the file in the cloud
	Name               string `json:"server_filename"`
	Path               string `json:"path"`
	MD5                string `json:"md5"`
	Size               int64  `json:"size"`
	Category           int    `json:"category"` // File type: 1: video; 2: audio; 3: image; 4: document; 5: application; 6: others; 7: seed
	Isdir              int    `json:"isdir"`
	Share              int    `json:"share"`           // if share > 0,the file is shared
	ServerCreateTime   int64  `json:"server_ctime"`    // The server-side creation time of the file [unix timestamp]
	ServerModifiedTime int64  `json:"server_mtime"`    // The server-side modification time of the file [unix timestamp]
	DownloadLink       string `json:"dlink,omitempty"` // Download link for Item Info response, not awailable for list
}

Item information

type OperationalItem

type OperationalItem struct {
	Path        string `json:"path"`
	Destination string `json:"dest,omitempty"`
	NewName     string `json:"newname,omitempty"`
	OnDuplicate string `json:"ondup,omitempty"` // foor copy or move, can be `overwrite`, `newcopy` - will add `(1)` to filename
}

OperationalItem operation on Item

type ResponseCreate

type ResponseCreate struct {
	ErrorAPI
	MD5  string `json:"md5"`
	Size int64  `json:"size"`
	Name string `json:"filename"`
}

ResponseCreate file creation result

type ResponseDefault

type ResponseDefault struct {
	ErrorAPI
}

ResponseDefault - check only error

type ResponseDownload

type ResponseDownload struct {
	ErrorAPI
	DownloadLink []struct {
		ID  string `json:"fs_id"`
		URL string `json:"dlink"`
	} `json:"dlink"`
	FileInfo struct {
		Size int64  `json:"size"`
		Name string `json:"filename"`
	} `json:"file_info"`
}

ResponseDownload contain Download link

type ResponseFileLocateUpload

type ResponseFileLocateUpload struct {
	ErrorAPI
	Host string `json:"host"`
}

ResponseFileLocateUpload host for file uploading

type ResponseHomeInfo

type ResponseHomeInfo struct {
	ErrorAPI
	Data struct {
		Sign1     string `json:"sign1"`
		Sign3     string `json:"sign3"`
		Timestamp int64  `json:"timestamp"`
	} `json:"data"`
}

ResponseHomeInfo download file sign

type ResponseItemInfo

type ResponseItemInfo struct {
	ErrorAPI
	List []*struct {
		ErrorAPI
		Item
	} `json:"info"`
}

ResponseItemInfo - data or dir information

type ResponseList

type ResponseList struct {
	ErrorAPI
	List []*Item `json:"list"`
}

ResponseList - list dir information

type ResponseOperational

type ResponseOperational struct {
	ErrorAPI
	Info []struct {
		ErrorAPI
		Path string `json:"path"`
	} `json:"info"`
}

ResponseOperational result of operation on Item

type ResponsePrecreate

type ResponsePrecreate struct {
	ErrorAPI
	UploadID  string  `json:"uploadid"`
	Type      int     `json:"return_type"`
	Path      string  `json:"path"`
	BlockList []int64 `json:"block_list"`
}

ResponsePrecreate params of created file

type ResponseQuota

type ResponseQuota struct {
	ErrorAPI
	Total      int64 `json:"total"`
	Used       int64 `json:"used"`
	Free       int64 `json:"free"`
	Expire     bool  `json:"expire"`
	SboxUsed   int64 `json:"sbox_used"`
	ServerTime int64 `json:"server_time"`
}

ResponseQuota storage info

type ResponseUploadedChunk

type ResponseUploadedChunk struct {
	UploadID string `json:"uploadid"`
	PartSeq  int    `json:"partseq"`
	MD5      string `json:"md5"`
}

ResponseUploadedChunk information about uploaded chunk

type ResponseUser

type ResponseUser struct {
	ErrorAPI
	Data struct {
		MemberInfo struct {
			IsVIP int64 `json:"is_vip"`
		} `json:"member_info"`
	} `json:"data"`
}

ResponseUser check user VIP status

Jump to

Keyboard shortcuts

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