rclone: github.com/ncw/rclone/backend/box/api Index | Files

package api

import "github.com/ncw/rclone/backend/box/api"

Package api has type definitions for box

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


Package Files



const (
    ItemTypeFolder    = "folder"
    ItemTypeFile      = "file"
    ItemStatusActive  = "active"
    ItemStatusTrashed = "trashed"
    ItemStatusDeleted = "deleted"

Types of things in Item


var ItemFields = "type,id,sequence_id,etag,sha1,name,size,created_at,modified_at,content_created_at,content_modified_at,item_status,shared_link"

ItemFields are the fields needed for FileInfo

type AppAuth Uses

type AppAuth struct {
    PublicKeyID string `json:"publicKeyID"`
    PrivateKey  string `json:"privateKey"`
    Passphrase  string `json:"passphrase"`

AppAuth defines the shape of the appAuth within boxAppSettings in config.json

type AppSettings Uses

type AppSettings struct {
    ClientID     string  `json:"clientID"`
    ClientSecret string  `json:"clientSecret"`
    AppAuth      AppAuth `json:"appAuth"`

AppSettings defines the shape of the boxAppSettings within box config.json

type CommitUpload Uses

type CommitUpload struct {
    Parts      []Part `json:"parts"`
    Attributes struct {
        ContentCreatedAt  Time `json:"content_created_at"`
        ContentModifiedAt Time `json:"content_modified_at"`
    }   `json:"attributes"`

CommitUpload is used in the Commit Upload call

type ConfigJSON Uses

type ConfigJSON struct {
    BoxAppSettings AppSettings `json:"boxAppSettings"`
    EnterpriseID   string      `json:"enterpriseID"`

ConfigJSON defines the shape of a box config.json

type CopyFile Uses

type CopyFile struct {
    Name   string `json:"name"`
    Parent Parent `json:"parent"`

CopyFile is the request for Copy File

type CreateFolder Uses

type CreateFolder struct {
    Name   string `json:"name"`
    Parent Parent `json:"parent"`

CreateFolder is the request for Create Folder

type CreateSharedLink struct {
    SharedLink struct {
        URL    string `json:"url,omitempty"`
        Access string `json:"access,omitempty"`
    } `json:"shared_link"`

CreateSharedLink is the request for Public Link

type Error Uses

type Error struct {
    Type        string `json:"type"`
    Status      int    `json:"status"`
    Code        string `json:"code"`
    ContextInfo json.RawMessage
    HelpURL     string `json:"help_url"`
    Message     string `json:"message"`
    RequestID   string `json:"request_id"`

Error is returned from box when things go wrong

func (*Error) Error Uses

func (e *Error) Error() string

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

type FolderItems Uses

type FolderItems struct {
    TotalCount int    `json:"total_count"`
    Entries    []Item `json:"entries"`
    Offset     int    `json:"offset"`
    Limit      int    `json:"limit"`
    Order      []struct {
        By        string `json:"by"`
        Direction string `json:"direction"`
    }   `json:"order"`

FolderItems is returned from the GetFolderItems call

type Item Uses

type Item struct {
    Type              string  `json:"type"`
    ID                string  `json:"id"`
    SequenceID        string  `json:"sequence_id"`
    Etag              string  `json:"etag"`
    SHA1              string  `json:"sha1"`
    Name              string  `json:"name"`
    Size              float64 `json:"size"` // box returns this in xEyy format for very large numbers - see #2261
    CreatedAt         Time    `json:"created_at"`
    ModifiedAt        Time    `json:"modified_at"`
    ContentCreatedAt  Time    `json:"content_created_at"`
    ContentModifiedAt Time    `json:"content_modified_at"`
    ItemStatus        string  `json:"item_status"` // active, trashed if the file has been moved to the trash, and deleted if the file has been permanently deleted
    SharedLink        struct {
        URL    string `json:"url,omitempty"`
        Access string `json:"access,omitempty"`
    }   `json:"shared_link"`

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

func (*Item) ModTime Uses

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

ModTime returns the modification time of the item

type Parent Uses

type Parent struct {
    ID string `json:"id"`

Parent defined the ID of the parent directory

type Part Uses

type Part struct {
    PartID string `json:"part_id"`
    Offset int64  `json:"offset"`
    Size   int64  `json:"size"`
    Sha1   string `json:"sha1"`

Part defines the return from upload part call which are passed to commit upload also

type Time Uses

type Time time.Time

Time represents represents date and time information for the box API, by using RFC3339

func (*Time) MarshalJSON Uses

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

MarshalJSON turns a Time into JSON (in UTC)

func (*Time) UnmarshalJSON Uses

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

UnmarshalJSON turns JSON into a Time

type UpdateFileModTime Uses

type UpdateFileModTime struct {
    ContentModifiedAt Time `json:"content_modified_at"`

UpdateFileModTime is used in Update File Info

type UpdateFileMove Uses

type UpdateFileMove struct {
    Name   string `json:"name"`
    Parent Parent `json:"parent"`

UpdateFileMove is the request for Upload File to change name and parent

type UploadFile Uses

type UploadFile struct {
    Name              string `json:"name"`
    Parent            Parent `json:"parent"`
    ContentCreatedAt  Time   `json:"content_created_at"`
    ContentModifiedAt Time   `json:"content_modified_at"`

UploadFile is the request for Upload File

type UploadPartResponse Uses

type UploadPartResponse struct {
    Part Part `json:"part"`

UploadPartResponse is returned from the upload part call

type UploadSessionRequest Uses

type UploadSessionRequest struct {
    FolderID string `json:"folder_id,omitempty"` // don't pass for update
    FileSize int64  `json:"file_size"`
    FileName string `json:"file_name,omitempty"` // optional for update

UploadSessionRequest is uses in Create Upload Session

type UploadSessionResponse Uses

type UploadSessionResponse struct {
    TotalParts       int   `json:"total_parts"`
    PartSize         int64 `json:"part_size"`
    SessionEndpoints struct {
        ListParts  string `json:"list_parts"`
        Commit     string `json:"commit"`
        UploadPart string `json:"upload_part"`
        Status     string `json:"status"`
        Abort      string `json:"abort"`
    }   `json:"session_endpoints"`
    SessionExpiresAt  Time   `json:"session_expires_at"`
    ID                string `json:"id"`
    Type              string `json:"type"`
    NumPartsProcessed int    `json:"num_parts_processed"`

UploadSessionResponse is returned from Create Upload Session

type User Uses

type User struct {
    Type          string    `json:"type"`
    ID            string    `json:"id"`
    Name          string    `json:"name"`
    Login         string    `json:"login"`
    CreatedAt     time.Time `json:"created_at"`
    ModifiedAt    time.Time `json:"modified_at"`
    Language      string    `json:"language"`
    Timezone      string    `json:"timezone"`
    SpaceAmount   int64     `json:"space_amount"`
    SpaceUsed     int64     `json:"space_used"`
    MaxUploadSize int64     `json:"max_upload_size"`
    Status        string    `json:"status"`
    JobTitle      string    `json:"job_title"`
    Phone         string    `json:"phone"`
    Address       string    `json:"address"`
    AvatarURL     string    `json:"avatar_url"`

User is returned from /users/me

Package api imports 3 packages (graph) and is imported by 2 packages. Updated 2020-08-03. Refresh now. Tools for package owners.