Documentation ¶
Index ¶
- func BoxRequest(method string, url string, body io.Reader, headers map[string]string) ([]byte, error)
- func DeleteFile(fileID string, etag string) error
- func DeleteFolder(folderID string)
- func DownloadFile(fileID string, location string) error
- func GetFileCollaborations()
- func GetFileComments()
- func GetFileTasks()
- func GetThumbnail(fileID string, extension string, minHeight int32, minWidth int32)
- func LockandUnlock(fileID string, expiresAt time.Time, preventDownload bool)
- func PreflightCheck(name string, parentID string, size int32) bool
- func RequestAccessToken() error
- func SetConfigFile(name string)
- func UploadFileVersion(fileID string, newName string)
- type AccessResponse
- type BoxJWTRequest
- type EmbeddedFile
- type Entries
- type EntriesMini
- type FileObject
- type FileVersion
- type FileVersionObject
- type FolderObject
- type FolderUploadEmail
- type ItemCollection
- type Order
- type Parent
- type PathCollection
- type Permissions
- 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 ¶
func BoxRequest ¶
func BoxRequest(method string, url string, body io.Reader, headers map[string]string) ([]byte, error)
BoxRequest : Runs an HTTP request to the box app.
func DeleteFile ¶
DeleteFile : Deletes a file in a specific folder with 'ID" fileID.
func DeleteFolder ¶
func DeleteFolder(folderID string)
DeleteFolder : Deletes the folder with 'ID' folderID.
func 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 GetFileCollaborations ¶
func GetFileCollaborations()
func GetFileComments ¶
func GetFileComments()
func GetFileTasks ¶
func GetFileTasks()
func GetThumbnail ¶
GetThumbnail : Get a thumbnail image for a file.
func LockandUnlock ¶
LockandUnlock : Sets a lock, which expires within a specific time.
func RequestAccessToken ¶
func RequestAccessToken() error
RequestAccessToken : Get valid ACCESS_TOKEN using JWT.
func SetConfigFile ¶
func SetConfigFile(name string)
SetConfigFile : Sets the config file to read Box info from.
func 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.
Types ¶
type AccessResponse ¶
type AccessResponse struct { AccessToken string `json:"access_token"` ExpiresIn int `json:"expires_in"` RestrictedTo []interface{} `json:"restricted_to"` TokenType string `json:"token_type"` }
AccessResponse : Object returned by a successful request to the Box API.
type BoxJWTRequest ¶
type BoxJWTRequest struct { BoxAppSettings struct { ClientID string `json:"clientID"` ClientSecret string `json:"clientSecret"` AppAuth struct { PublicKeyID string `json:"publicKeyID"` PrivateKey string `json:"privateKey"` Passphrase string `json:"passphrase"` } `json:"appAuth"` } `json:"boxAppSettings"` EnterpriseID string `json:"enterpriseID"` }
BoxJWTRequest : Basic structure for a Box API JWT.
type EmbeddedFile ¶
type EmbeddedFile struct { Type string `json:"type"` ID string `json:"id"` Etag string `json:"etag"` ExpiringEmbedLink struct { URL string `json:"url"` } `json:"expiring_embed_link"` }
EmbeddedFile : An HTML embeddable file.
func GetEmbedLink ¶
func GetEmbedLink(fileID string) (*EmbeddedFile, error)
GetEmbedLink : Returns information about the file with 'ID' fileID.
type Entries ¶
type Entries struct { EntriesMini Sha1 string `json:"sha1 "` Description string `json:"description"` Size int `json:"size"` PathCollection PathCollection `json:"path_collection,omitempty"` CreatedAt string `json:"created_at"` ModifiedAt string `json:"modified_at"` TrashedAt interface{} `json:"trashed_at,omitempty"` PurgedAt interface{} `json:"purged_at,omitempty"` ContentCreatedAt string `json:"content_created_at"` ContentModifiedAt string `json:"content_modified_at"` 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"` }
Entries : A more in-depth response containing more information about box objects.
type EntriesMini ¶
type EntriesMini struct { Type string `json:"type"` ID string `json:"id"` SequenceID interface{} `json:"sequence_id,omitempty"` Etag string `json:"etag,omitempty"` Name string `json:"name"` }
EntriesMini : Basic structure for response carrying info about box objects.
type FileObject ¶
type FileObject struct { Type string `json:"type"` ID string `json:"id"` FileVersion FileVersion `json:"file_version"` SequenceID string `json:"sequence_id"` Etag string `json:"etag"` Sha1 string `json:"sha1"` Name string `json:"name"` Description string `json:"description"` Size int `json:"size"` PathCollection PathCollection `json:"path_collection"` CreatedAt string `json:"created_at"` ModifiedAt string `json:"modified_at"` CreatedBy User `json:"created_by"` ModifiedBy User `json:"modified_by"` OwnedBy User `json:"owned_by"` Parent Parent `json:"parent"` ItemStatus string `json:"item_status"` }
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.
func CopyFile ¶
func CopyFile(fileID string, folderID, version string, name string) (*FileObject, error)
CopyFile : Copy a file. The version and a new name can be optionally supplied.
func GetFileInfo ¶
func GetFileInfo(fileID string) (*FileObject, error)
GetFileInfo : Get information about a file.
type FileVersion ¶
type FileVersion struct { Type string `json:"type"` ID string `json:"id"` Sha1 string `json:"sha1"` }
FileVersion : Contains version information of a FileObject.
type FileVersionObject ¶
type FileVersionObject struct { Type string `json:"type"` ID string `json:"id"` Sha1 string `json:"sha1"` Name string `json:"name"` Size int `json:"size"` CreatedAt string `json:"created_at"` ModifiedAt string `json:"modified_at"` ModifiedBy User TrashedAt string `json:"trashed_at"` PurgedAt string `json:"purged_at"` }
type FolderObject ¶
type FolderObject struct { Type string `json:"type"` ID string `json:"id"` SequenceID string `json:"sequence_id"` Etag string `json:"etag"` Name string `json:"name"` CreatedAt string `json:"created_at"` ModifiedAt string `json:"modified_at"` Description string `json:"description"` Size int `json:"size"` PathCollection PathCollection `json:"path_collection,omitempty"` CreatedBy User `json:"created_by,omitempty"` ModifiedBy User `json:"modified_by,omitempty"` OwnedBy User `json:"owned_by,omitempty"` FolderUploadEmail FolderUploadEmail `json:"folder_upload_email,omitempty"` Parent Parent `json:"parent,omitempty"` ItemStatus string `json:"item_status"` ItemCollection ItemCollection `json:"item_collection,omitempty"` Tags []string `json:"tags"` }
FolderObject : A Box Folder object.
func CreateFolder ¶
func CreateFolder(name string, parentFolderID string) (*FolderObject, error)
CreateFolder : Creates a new folder under the parent folder that has 'ID' parentFolderID.
type FolderUploadEmail ¶
FolderUploadEmail : Access level and email address of upload folder.
type ItemCollection ¶
type ItemCollection struct { TotalCount int `json:"total_count"` Entries []EntriesMini `json:"entries"` Offset int `json:"offset"` Limit int `json:"limit"` }
ItemCollection : Total count up to the limit of the number of entries in a folder, as well as the entries themselves.
func GetFolderItems ¶
func GetFolderItems(folderID string, limit int, offset int) (*ItemCollection, error)
GetFolderItems : Returns all the items contained inside the folder with 'ID' folderID.
type Parent ¶
type Parent struct { Type string `json:"type"` ID string `json:"id"` SequenceID interface{} `json:"sequence_id,omitempty"` Etag interface{} `json:"etag,omitempty"` Name string `json:"name"` }
Parent : Parent folder of a returned box object.
type PathCollection ¶
type PathCollection struct { TotalCount int `json:"total_count"` Entries []Entries `json:"entries"` }
PathCollection : The total amount of entries in a given path, as well as the entries themselves.
func UploadFile ¶
func UploadFile(file interface{}, newName string, folderID string) (*PathCollection, error)
UploadFile : Use 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.
type Permissions ¶
type Permissions struct { CanDownload bool `json:"can_download"` CanPreview bool `json:"can_preview"` }
Permissions : Flags for downloaded files.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func (*Session) CommitUpload ¶
func (*Session) NewVersion ¶
func (*Session) UploadPart ¶
func (s *Session) UploadPart()