openload

package
v0.0.0-...-7994615 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2019 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 AccountInfoResponse

type AccountInfoResponse struct {
	Extid       string      `json:"extid"`
	Email       string      `json:"email"`
	SignupAt    string      `json:"signup_at"`
	StorageLeft int         `json:"storage_left"`
	StorageUsed interface{} `json:"storage_used"`
	Traffic     struct {
		Left    int `json:"left"`
		Used24H int `json:"used_24h"`
	} `json:"traffic"`
	Balance interface{} `json:"balance"`
}

AccountInfoResponse represents account info response.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents openload api client.

func New

func New(login, key string, httpClient *http.Client) *Client

New creates new openload client an returns a reference. httpClient is optional pass nil if not needed. httpClient might be passed to override default httpClient example override reqeusts timeout. https://golang.org/pkg/net/http/#Client

func (*Client) AccountInfo

func (c *Client) AccountInfo() (*AccountInfoResponse, error)

AccountInfo requests logged-in account info And returns AccountInfo object holding infos. https://openload.co/api#accountinfos

func (*Client) ConvertFile

func (c *Client) ConvertFile(fileID string) (ConvertFileResponse, error)

ConvertFile asks openload to convert media file. Usually conversions settings should be set in the UI https://openload.co/account#conversionsettings https://openload.co/api#convertingfiles

func (*Client) DeleteFile

func (c *Client) DeleteFile(fileID string) (DeleteFileResponse, error)

DeleteFile deletes existing file. https://openload.co/api#file-delete

func (c *Client) DownloadLink(fileID string, ticket string, captchaResponse string) (*DownloadLinkResponse, error)

DownloadLink requests direct download link for a specific file This step must be executed after getting ticket and captcha response From previous step (DownloadTicket). ticket can be optained from DownloadTicket response captcha is optinal althought it is documented as mandatory field in openload API documentation sometimes download ticket has no captcha. https://openload.co/api#download-getlink

func (*Client) DownloadTicket

func (c *Client) DownloadTicket(fileID string) (*DownloadTicketResponse, error)

DownloadTicket requests download ticket for a specific file This ticket will be used for actual download. https://openload.co/api#download-ticket

func (*Client) FileInfo

func (c *Client) FileInfo(fileID string) (*FileInfoResponse, error)

FileInfo requests a single file info. https://openload.co/api#download-info

func (*Client) FilesInfo

func (c *Client) FilesInfo(filesID []string) (FilesInfoResponse, error)

FilesInfo requests info for a list of files. https://openload.co/api#download-info

func (*Client) ListFolder

func (c *Client) ListFolder(folderID string) (*ListFolderResponse, error)

ListFolder lists a folder content. https://openload.co/api#file-listfolder

func (*Client) RemoteUpload

func (c *Client) RemoteUpload(url string, folderID string, headers map[string]string) (*RemoteUploadResponse, error)

RemoteUpload adds a remote upload folderID is optional pass empty string "" if not needed. headers is optional pass nil or empty map if not needed. https://openload.co/api#remoteul-add

func (*Client) RemoteUploadStatus

func (c *Client) RemoteUploadStatus(limit int64, uploadID string) (RemoteUploadsStatusResponse, error)

RemoteUploadStatus checks status of remote upload requests limit is optional pass 5 as default (Default: 5, Maximum: 100) uploadID is optional pass empty string "" if not needed uploadID is used to check only one remote upload status. https://openload.co/api#remoteul-check

func (*Client) RenameFile

func (c *Client) RenameFile(fileID string, name string) (RenameFileResponse, error)

RenameFile renames existing file. https://openload.co/api#file-rename

func (*Client) RenameFolder

func (c *Client) RenameFolder(folderID string, name string) (RenameFolderResponse, error)

RenameFolder renames existing folder. https://openload.co/api#file-renamefolder

func (*Client) RunningConversions

func (c *Client) RunningConversions(folderID string) (RunningConversionsResponse, error)

RunningConversions checks pending conversions status. folderID is optional pass empty string "" if not needed if not specified all running conversion will be returned. https://openload.co/api#file-runningconverts

func (*Client) SplashImage

func (c *Client) SplashImage(fileID string) (SplashImageResponse, error)

SplashImage request splash image direct url Usually it should be used with media fileID (movie, ...) https://openload.co/api#file-splash

func (*Client) Upload

func (c *Client) Upload(name string, folderID string, sha1 string, httponly bool) (*UploadResponse, error)

Upload uploads contesnt of filepath. folderID is optional pass empty string "" if not needed sha1 is optional pass empty string "" if not needed httponly is optional pass false if not needed. https://openload.co/api#upload

func (c *Client) UploadLink(folderID string, sha1 string, httponly bool) (*UploadURLResponse, error)

UploadLink requests an upload URL This URL will be used to perform actual upload. https://openload.co/api#upload

type ConvertFileResponse

type ConvertFileResponse bool

ConvertFileResponse represents conver file response either true or false.

type DeleteFileResponse

type DeleteFileResponse bool

DeleteFileResponse represents delete file response either true or false.

type DownloadLinkResponse

type DownloadLinkResponse struct {
	Name        string      `json:"name"`
	Size        interface{} `json:"size"`
	Sha1        string      `json:"sha1"`
	ContentType string      `json:"content_type"`
	UploadAt    string      `json:"upload_at"`
	URL         string      `json:"url"`
	Token       string      `json:"token"`
}

DownloadLinkResponse represents download link response.

type DownloadTicketResponse

type DownloadTicketResponse struct {
	Ticket     string      `json:"ticket"`
	CaptchaURL interface{} `json:"captcha_url"`
	CaptchaW   interface{} `json:"captcha_w"`
	CaptchaH   interface{} `json:"captcha_h"`
	WaitTime   int         `json:"wait_time"`
	ValidUntil string      `json:"valid_until"`
}

DownloadTicketResponse represents download ticket response.

type FileInfoResponse

type FileInfoResponse struct {
	ID          string      `json:"id"`
	Status      int         `json:"status"`
	Name        interface{} `json:"name"`
	Size        interface{} `json:"size"`
	Sha1        interface{} `json:"sha1"`
	ContentType interface{} `json:"content_type"`
}

FileInfoResponse represents single file info response.

type FilesInfoResponse

type FilesInfoResponse map[string]FileInfoResponse

FilesInfoResponse represents multiple files info response.

type ListFolderResponse

type ListFolderResponse struct {
	Folders []struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"folders"`
	Files []struct {
		Name          string `json:"name"`
		Sha1          string `json:"sha1"`
		Folderid      string `json:"folderid"`
		UploadAt      string `json:"upload_at"`
		Status        string `json:"status"`
		Size          string `json:"size"`
		ContentType   string `json:"content_type"`
		DownloadCount string `json:"download_count"`
		Cstatus       string `json:"cstatus"`
		Link          string `json:"link"`
		Linkextid     string `json:"linkextid"`
	}
}

ListFolderResponse represents list folder response.

type RemoteUploadResponse

type RemoteUploadResponse struct {
	ID       string `json:"id"`
	Folderid string `json:"folderid"`
}

RemoteUploadResponse represents remote upload response.

type RemoteUploadStatusResponse

type RemoteUploadStatusResponse struct {
	ID          interface{} `json:"id"`
	Remoteurl   string      `json:"remoteurl"`
	Status      string      `json:"status"`
	BytesLoaded interface{} `json:"bytes_loaded"`
	BytesTotal  interface{} `json:"bytes_total"`
	Folderid    string      `json:"folderid"`
	Added       string      `json:"added"`
	LastUpdate  string      `json:"last_update"`
	Extid       interface{} `json:"extid"`
	URL         interface{} `json:"url"`
}

RemoteUploadStatusResponse represents single remote upload status.

type RemoteUploadsStatusResponse

type RemoteUploadsStatusResponse map[string]RemoteUploadStatusResponse

RemoteUploadsStatusResponse represents all remote uploads status.

type RenameFileResponse

type RenameFileResponse bool

RenameFileResponse represents rename file response either true or false.

type RenameFolderResponse

type RenameFolderResponse bool

RenameFolderResponse represents rename folder response either true or false.

type RunningConversionsResponse

type RunningConversionsResponse []struct {
	Name       string  `json:"name"`
	ID         string  `json:"id"`
	Status     string  `json:"status"`
	LastUpdate string  `json:"last_update"`
	Progress   float64 `json:"progress"`
	Retries    string  `json:"retries"`
	Link       string  `json:"link"`
	Linkextid  string  `json:"linkextid"`
}

RunningConversionsResponse represents pending conversions response.

type SplashImageResponse

type SplashImageResponse string

SplashImageResponse represents splash image response.

type UploadResponse

type UploadResponse struct {
	ContentType string `json:"content_type"`
	ID          string `json:"id"`
	Name        string `json:"name"`
	Sha1        string `json:"sha1"`
	Size        string `json:"size"`
	URL         string `json:"url"`
}

UploadResponse represents upload response.

type UploadURLResponse

type UploadURLResponse struct {
	URL        string `json:"url"`
	ValidUntil string `json:"valid_until"`
}

UploadURLResponse represents upload url response.

Jump to

Keyboard shortcuts

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