api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2024 License: MIT Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package api has type definitions for pcloud

Converted from the API docs with help from https://mholt.github.io/json-to-go/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChecksumFileResult

type ChecksumFileResult struct {
	Error
	Hashes
	Metadata Item `json:"metadata"`
}

ChecksumFileResult is returned from /checksumfile

type Error

type Error struct {
	Result      int    `json:"result"`
	ErrorString string `json:"error"`
}

Error is returned from pcloud when things go wrong

If result is 0 then everything is OK

func (*Error) Error

func (e *Error) Error() string

Error returns a string for the error and satisfies the error interface

func (*Error) Update

func (e *Error) Update(err error) error

Update returns err directly if it was != nil, otherwise it returns an Error or nil if no error was detected

type FileChecksumResponse

type FileChecksumResponse struct {
	Error
	MD5    string `json:"md5"`
	SHA1   string `json:"sha1"`
	SHA256 string `json:"sha256"`
}

FileChecksumResponse is the response from /file_checksum

type FileCloseResponse

type FileCloseResponse struct {
	Error
}

FileCloseResponse is the response from /file_close

type FileOpenResponse

type FileOpenResponse struct {
	Error
	Fileid         int64 `json:"fileid"`
	FileDescriptor int64 `json:"fd"`
}

FileOpenResponse is the response from /file_open

type FilePWriteResponse

type FilePWriteResponse struct {
	Error
	Bytes int64 `json:"bytes"`
}

FilePWriteResponse is the response from /file_pwrite

type FileTruncateResponse

type FileTruncateResponse struct {
	Error
}

FileTruncateResponse is the response from /file_truncate

type GetFileLinkResult

type GetFileLinkResult struct {
	Error
	Dwltag  string   `json:"dwltag"`
	Hash    uint64   `json:"hash"`
	Size    int64    `json:"size"`
	Expires Time     `json:"expires"`
	Path    string   `json:"path"`
	Hosts   []string `json:"hosts"`
}

GetFileLinkResult is returned from /getfilelink

func (*GetFileLinkResult) IsValid

func (g *GetFileLinkResult) IsValid() bool

IsValid returns whether the link is valid and has not expired

func (*GetFileLinkResult) URL

func (g *GetFileLinkResult) URL() string

URL returns a URL from the Path and Hosts. Check with IsValid before calling.

type Hashes

type Hashes struct {
	SHA1   string `json:"sha1"`
	MD5    string `json:"md5"`
	SHA256 string `json:"sha256"`
}

Hashes contains the supported hashes

type Item

type Item struct {
	Path           string `json:"path"`
	Name           string `json:"name"`
	Created        Time   `json:"created"`
	IsMine         bool   `json:"ismine"`
	Thumb          bool   `json:"thumb"`
	Modified       Time   `json:"modified"`
	Comments       int    `json:"comments"`
	ID             string `json:"id"`
	IsShared       bool   `json:"isshared"`
	IsDeleted      bool   `json:"isdeleted"`
	Icon           string `json:"icon"`
	IsFolder       bool   `json:"isfolder"`
	ParentFolderID int64  `json:"parentfolderid"`
	FolderID       int64  `json:"folderid,omitempty"`
	Height         int    `json:"height,omitempty"`
	FileID         int64  `json:"fileid,omitempty"`
	Width          int    `json:"width,omitempty"`
	Hash           uint64 `json:"hash,omitempty"`
	Category       int    `json:"category,omitempty"`
	Size           int64  `json:"size,omitempty"`
	ContentType    string `json:"contenttype,omitempty"`
	Contents       []Item `json:"contents"`
}

Item describes a folder or a file as returned by Get Folder Items and others

func (*Item) ModTime

func (i *Item) ModTime() (t time.Time)

ModTime returns the modification time of the item

type ItemResult

type ItemResult struct {
	Error
	Metadata Item `json:"metadata"`
}

ItemResult is returned from the /listfolder, /createfolder, /deletefolder, /deletefile, etc. methods

type PubLinkResult

type PubLinkResult struct {
	Error
	LinkID   int    `json:"linkid"`
	Link     string `json:"link"`
	LinkCode string `json:"code"`
}

PubLinkResult is returned from /getfilepublink and /getfolderpublink

type Time

type Time time.Time

Time represents date and time information for the pcloud API, by using RFC1123Z

func (*Time) MarshalJSON

func (t *Time) MarshalJSON() (out []byte, err error)

MarshalJSON turns a Time into JSON (in UTC)

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

UnmarshalJSON turns JSON into a Time

type UploadFileResponse

type UploadFileResponse struct {
	Error
	Items     []Item   `json:"metadata"`
	Checksums []Hashes `json:"checksums"`
	Fileids   []int64  `json:"fileids"`
}

UploadFileResponse is the response from /uploadfile

type UserInfo

type UserInfo struct {
	Error
	Cryptosetup           bool   `json:"cryptosetup"`
	Plan                  int    `json:"plan"`
	CryptoSubscription    bool   `json:"cryptosubscription"`
	PublicLinkQuota       int64  `json:"publiclinkquota"`
	Email                 string `json:"email"`
	UserID                int    `json:"userid"`
	Quota                 int64  `json:"quota"`
	TrashRevretentionDays int    `json:"trashrevretentiondays"`
	Premium               bool   `json:"premium"`
	PremiumLifetime       bool   `json:"premiumlifetime"`
	EmailVerified         bool   `json:"emailverified"`
	UsedQuota             int64  `json:"usedquota"`
	Language              string `json:"language"`
	Business              bool   `json:"business"`
	CryptoLifetime        bool   `json:"cryptolifetime"`
	Registered            string `json:"registered"`
	Journey               struct {
		Claimed bool `json:"claimed"`
		Steps   struct {
			VerifyMail    bool `json:"verifymail"`
			UploadFile    bool `json:"uploadfile"`
			AutoUpload    bool `json:"autoupload"`
			DownloadApp   bool `json:"downloadapp"`
			DownloadDrive bool `json:"downloaddrive"`
		} `json:"steps"`
	} `json:"journey"`
}

UserInfo is returned from /userinfo

Jump to

Keyboard shortcuts

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