Documentation ¶
Index ¶
- func PreflightCheck(name string, parentID string, size int32) bool
- type AccessTokenObject
- type AppAuth
- type AppSettings
- type Config
- type EmbeddedFile
- type Entries
- type FileObject
- type FileVersion
- type FolderObject
- type FolderUploadEmail
- type Item
- type ItemCollection
- type Order
- type Parent
- type PathCollection
- type Permissions
- type SDK
- func (sdk *SDK) CopyFile(fileID, folderID, name, version string) (*FileObject, error)
- func (sdk *SDK) CopyFolder(folderID string, parentFolderID string, newName string) (*FolderObject, error)
- func (sdk *SDK) CreateFolder(name string, parentFolderID string) (*FolderObject, error)
- func (sdk *SDK) DeleteFile(fileID, etag string) error
- func (sdk *SDK) DeleteFolder(folderID string)
- func (sdk *SDK) DownloadFile(fileID, location string) error
- func (sdk *SDK) GetEmbedLink(fileID string) (*EmbeddedFile, error)
- func (sdk *SDK) GetFileInfo(fileID string) (*FileObject, error)
- func (sdk *SDK) GetFolderInfo(folderID string) (*FolderObject, error)
- func (sdk *SDK) GetThumbnail(fileID, extension string, minHeight, minWidth int) (image.Image, error)
- func (sdk *SDK) ListItemsInFolder(folderID string, limit int, offset int) (*ItemCollection, error)
- func (sdk *SDK) NewConfig(cfg *Config)
- func (sdk *SDK) NewConfigFromFile(filename string) error
- func (sdk *SDK) RequestAccessToken() error
- func (sdk *SDK) UpdateFile(fileID, newFilename string) error
- func (sdk *SDK) UpdateFolder()
- func (sdk *SDK) UploadFile(inFile interface{}, newFilename, folderID string) (*PathCollection, error)
- func (sdk *SDK) UploadFileVersion(fileID, newName string)
- type Session
- func (s *Session) Abort()
- func (s *Session) CommitUpload(partID string, offset int, size int32)
- func (s *Session) ListParts(offset int, limit int)
- func (s *Session) NewFile(folderID string, fileSize int32, fileName string)
- func (s *Session) NewVersion(folderID string, fileSize int32, fileName string)
- func (s *Session) UploadPart()
- type SharedLink
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccessTokenObject ¶
type AccessTokenObject struct { AccessToken string `json:"access_token"` ExpiresIn int `json:"expires_in"` IssuedTokenType string `json:"issued_token_type,omitempty"` RefreshToken string `json:"refresh_token"` RestrictedTo []struct { Scope string `json:"scope,omitempty"` Object *FileObject `json:"object,omitempty` } `json:"restricted_to,omitempty"` TokenType string `json:"token_type,omitempty"` }
AccessTokenObject is a token object returned by a successful request to the Box API.
type AppAuth ¶
type AppAuth struct { PublicKeyID string `json:"publicKeyID"` PrivateKey string `json:"privateKey"` Passphrase string `json:"passphrase"` }
AppAuth is the authentication details for the configuration.
type AppSettings ¶
type AppSettings struct { ClientID string `json:"clientID"` ClientSecret string `json:"clientSecret"` AppAuth AppAuth `json:"appAuth"` }
AppSettings is the structure of the configuration information.
type Config ¶
type Config struct { BoxAppSettings AppSettings `json:"boxAppSettings"` EnterpriseID string `json:"enterpriseID"` }
Config is the basic structure for a Box API JWT.
type EmbeddedFile ¶
type EmbeddedFile struct { Type string `json:"type,omitempty"` ID string `json:"id,omitempty"` Etag string `json:"etag,omitempty"` ExpiringEmbedLink struct { URL string `json:"url,omitempty"` } `json:"expiring_embed_link,omitempty"` }
EmbeddedFile : An HTML embeddable file.
type Entries ¶
type Entries struct { Type string `json:"type,omitempty"` ID string `json:"id,omitempty"` SequenceID struct{} `json:"sequence_id,omitempty"` Etag string `json:"etag,omitempty"` Name string `json:"name,omitempty"` Sha1 string `json:"sha1,omitempty"` Description string `json:"description,omitempty"` Size int `json:"size,omitempty"` PathCollection *PathCollection `json:"path_collection,omitempty"` CreatedAt string `json:"created_at,omitempty"` ModifiedAt string `json:"modified_at,omitempty"` TrashedAt struct{} `json:"trashed_at,omitempty"` PurgedAt struct{} `json:"purged_at,omitempty"` ContentCreatedAt string `json:"content_created_at,omitempty"` ContentModifiedAt string `json:"content_modified_at,omitempty"` CreatedBy *User `json:"created_by,omitempty"` ModifiedBy *User `json:"modified_by,omitempty"` OwnedBy *User `json:"owned_by,omitempty"` Parent *Parent `json:"parent,omitempty"` ItemStatus string `json:"item_status,omitempty"` }
Entries : A more in-depth response containing more information about box objects.
type FileObject ¶
type FileObject struct {
Item
}
FileObject : File information describe file objects in Box, with attributes like who created the file, when it was last modified, and other information. The actual content of the file itself is accessible through the /files/{id}/content endpoint. Italicized attributes are not returned by default and must be retrieved through the fields parameter.
type FileVersion ¶
type FileVersion struct { Type string `json:"type,omitempty"` ID string `json:"id,omitempty"` Sha1 string `json:"sha1,omitempty"` Name string `json:"name,omitempty"` Size int `json:"size,omitempty"` CreatedAt string `json:"created_at,omitempty"` ModifiedAt string `json:"modified_at,omitempty"` ModifiedBy *User `json:"modified_by,omitempty"` TrashedAt string `json:"trashed_at,omitempty"` PurgedAt string `json:"purged_at,omitempty"` }
FileVersion : Contains version information of a FileObject.
type FolderObject ¶
type FolderObject struct { Item ItemCollection *ItemCollection `json:"item_collection,omitempty"` Tags []string `json:"tags,omitempty"` }
FolderObject : A Box Folder object.
type FolderUploadEmail ¶
type FolderUploadEmail struct { Access string `json:"access,omitempty"` Email string `json:"email,omitempty"` }
FolderUploadEmail : Access level and email address of upload folder.
type Item ¶
type Item struct { Type string `json:"type"` ID string `json:"id"` FileVersion *FileVersion `json:"file_version,omitempty"` SequenceID string `json:"sequence_id,omitempty"` Etag string `json:"etag,omitempty"` Sha1 string `json:"sha1,omitempty"` Name string `json:"name"` Description string `json:"description,omitempty"` Size int `json:"size"` PathCollection *PathCollection `json:"path_collection,omitempty"` CreatedAt string `json:"created_at,omitempty"` ModifiedAt string `json:"modified_at,omitempty"` CreatedBy *User `json:"created_by,omitempty"` ModifiedBy *User `json:"modified_by,omitempty"` OwnedBy *User `json:"owned_by,omitempty"` Parent *Parent `json:"parent,omitempty"` ItemStatus string `json:"item_status,omitempty"` }
Item is the base structure of a Box object.
type ItemCollection ¶
type ItemCollection struct { TotalCount int `json:"total_count,omitempty"` Entries []*Entries `json:"entries,omitempty"` Offset int `json:"offset,omitempty"` Limit int `json:"limit,omitempty"` }
ItemCollection : Total count up to the limit of the number of entries in a folder, as well as the entries themselves.
type Parent ¶
type Parent struct { Type string `json:"type,omitempty"` ID string `json:"id,omitempty"` SequenceID struct{} `json:"sequence_id,omitempty"` Etag struct{} `json:"etag,omitempty"` Name string `json:"name,omitempty"` }
Parent : Parent folder of a returned box object.
type PathCollection ¶
type PathCollection struct { TotalCount int `json:"total_count,omitempty"` Entries []*Entries `json:"entries,omitempty"` }
PathCollection : The total amount of entries in a given path, as well as the entries themselves.
type Permissions ¶
type Permissions struct { CanDelete bool `json:"can_delete,omitempty"` CanDownload bool `json:"can_download,omitempty"` CanInviteCollaborator bool `json:"can_invite_collaborator,omitempty"` CanRename bool `json:"can_rename,omitempty"` CanAnnotate bool `json:"can_annotate,omitempty"` CanComment bool `json:"can_comment,omitempty"` CanPreview bool `json:"can_preview,omitempty"` CanUpload bool `json:"can_upload,omitempty"` CanViewAnnotationsAll bool `json:"can_view_annotations_all,omitempty"` CanViewAnnotationsSelf bool `json:"can_view_annotations_self,omitempty"` }
Permissions : Flags for downloaded files.
type SDK ¶
type SDK struct {
// contains filtered or unexported fields
}
SDK is the structure for establishing the connection to the Box API.
func (*SDK) CopyFile ¶
func (sdk *SDK) CopyFile(fileID, folderID, name, version string) (*FileObject, error)
CopyFile copies a file. The version and a new name can be optionally supplied.
func (*SDK) CopyFolder ¶
func (sdk *SDK) CopyFolder(folderID string, parentFolderID string, newName string) (*FolderObject, error)
CopyFolder copies a speified folder to a specified parent folder.
func (*SDK) CreateFolder ¶
func (sdk *SDK) CreateFolder(name string, parentFolderID string) (*FolderObject, error)
CreateFolder creates a new folder under the parent folder that has 'ID' parentFolderID.
func (*SDK) DeleteFile ¶
DeleteFile deletes a file in a specific folder with an 'ID' matching fileID.
func (*SDK) DeleteFolder ¶
DeleteFolder deletes the folder who's 'ID' matches folderID.
func (*SDK) DownloadFile ¶
DownloadFile : Retrieves the actual data of the file. An optional version parameter can be set to download a previous version of the file.
func (*SDK) GetEmbedLink ¶
func (sdk *SDK) GetEmbedLink(fileID string) (*EmbeddedFile, error)
GetEmbedLink returns information about the file with 'ID' fileID.
func (*SDK) GetFileInfo ¶
func (sdk *SDK) GetFileInfo(fileID string) (*FileObject, error)
GetFileInfo : Get information about a file.
func (*SDK) GetFolderInfo ¶
func (sdk *SDK) GetFolderInfo(folderID string) (*FolderObject, error)
GetFolderInfo gets the information for the requested folder ID
func (*SDK) GetThumbnail ¶
func (sdk *SDK) GetThumbnail(fileID, extension string, minHeight, minWidth int) (image.Image, error)
GetThumbnail gets a thumbnail image for the requested file.
func (*SDK) ListItemsInFolder ¶
ListItemsInFolder returns all the items contained inside the folder with 'ID' folderID.
func (*SDK) NewConfigFromFile ¶
NewConfigFromFile sets the config file to read Box info from.
func (*SDK) RequestAccessToken ¶
RequestAccessToken requests a valid access token from the Box API.
func (*SDK) UpdateFile ¶
UpdateFile updates the file with a new name and content.
func (*SDK) UploadFile ¶
func (sdk *SDK) UploadFile(inFile interface{}, newFilename, folderID string) (*PathCollection, error)
UploadFile uses the Upload API to allow users to add a new file. The user can then upload a file by specifying the destination folder for the file. If the user provides a file name that already exists in the destination folder, the user will receive an error.
func (*SDK) UploadFileVersion ¶
UploadFileVersion : Uploading a new file version is performed in the same way as uploading a file. This method is used to upload a new version of an existing file in a user’s account.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session TODO: Add definition
func (*Session) CommitUpload ¶
CommitUpload TODO: Add definition
func (*Session) NewVersion ¶
NewVersion TODO: Add definition