FoldersModule
public class FoldersModule
Provides Folder management.
-
Initializer
Declaration
Swift
public init(boxClient: BoxClient)Parameters
boxClientRequired for communicating with Box APIs.
-
Get information about a folder.
Declaration
Parameters
folderIdThe ID of the folder on which to retrieve information.
fieldsComma-separated list of fields to include in the response.
completionReturns a full folder object or an error.
-
Gets all of the files, folders, or web links contained within a folder.
Declaration
Swift
public func listItems( folderId: String, usemarker: Bool? = nil, marker: String? = nil, offset: Int? = nil, limit: Int? = nil, sort: FolderItemsOrderBy? = nil, direction: OrderDirection? = nil, fields: [String]? = nil ) -> PaginationIterator<FolderItem>Parameters
folderIdThe ID of the folder on which to retrieve information.
usemarkerThis specifies whether you would like to use marker-based or offset-based paging. You can only use one or the other. Marker-based paging is the preferred method and is most performant. If not specified, this endpoint defaults to using offset-based paging. This parameter is unique to Get Folder Items to retain backwards compatibility for this endpoint. This parameter is required for both the first and subsequent calls to use marked-based paging.
markerThe position marker at which to begin the response. See marker-based paging for details. This parameter cannot be used simultaneously with the ‘offset’ parameter.
offsetThe offset of the item at which to begin the response. See offset-based paging for details. This parameter cannot be used simultaneously with the ‘marker’ parameter.
limitThe maximum number of items to return. The default is 100 and the maximum is 1,000.
sortThis can be id, name, or date. This parameter is not yet supported for marker- based paging on folder 0.
directionThis can be ASC or DESC.
fieldsComma-separated list of fields to include in the response.
-
Create a new folder.
Declaration
Parameters
nameThe desired name for the folder. Box supports folder names of 255 characters or less. Names containing non-printable ASCII characters,
/
or\
, names with trailing spaces, and the special names “.” and “..” are also not allowed.parentIdThe ID of the parent folder.
fieldsComma-separated list of fields to include in the response.
completionReturns a full folder object or an error if the parentId is invalid or if a name collision occurs.
-
update(folderId:name:description:parentId:sharedLink:folderUploadEmailAccess:tags:canNonOwnersInvite:isCollaborationRestrictedToEnterprise:collections:fields:completion:)Update a folder.
Declaration
Swift
public func update( folderId: String, name: String? = nil, description: String? = nil, parentId: String? = nil, sharedLink: NullableParameter<SharedLinkData>? = nil, folderUploadEmailAccess: FolderUploadEmailAccess? = nil, tags: [String]? = nil, canNonOwnersInvite: Bool? = nil, isCollaborationRestrictedToEnterprise: Bool? = nil, collections: [String]? = nil, fields: [String]? = nil, completion: @escaping Callback<Folder> )Parameters
folderIdThe ID of the file to update
nameThe name of the folder.
descriptionThe description of the folder.
parentIdThe ID of the parent folder
accessThe level of access. Can be open (
People with the link
), company (People in your company
), or collaborators (People in this folder
). If you omit this field then the access level will be set to the default access level specified by the enterprise admin.passwordThe password required to access the shared link. Set to .empty value to delete password
unsharedAtThe date-time that this link will become disabled. This field can only be set by users with paid accounts.
canDownloadWhether the shared link allows downloads. For shared links on folders, this also applies to any items in the folder. Can only be set with access levels open and company (not collaborators).
folderUploadEmailAccessCan be open or collaborators
tagsArray of tags to be added or replaced to the folder
canNonOwnersInviteIf this parameter is set to false, only folder owners and co-owners can send collaborator invites
isCollaborationRestrictedToEnterpriseWhether to restrict future collaborations to within the enterprise. Does not affect existing collaborations.
fieldsComma-separated list of fields to include in the response.
completionReturns The updated folder is returned if the name is valid. Errors generally occur only if there is a name collision.
-
Delete a folder or move a folder to the trash. The recursive parameter must be included in order to delete folders that aren’t empty. Depending on the enterprise settings for this user, the item will either be actually deleted from Box or moved to the trash.
Declaration
Swift
public func delete( folderId: String, recursive: Bool? = nil, completion: @escaping Callback<Void> )Parameters
folderIdThe ID of the file to delete.
recursiveWhether to delete this folder if it has items inside of it.
completionAn empty response will be returned upon successful deletion. An error is thrown if the folder is not empty and the ‘recursive’ parameter is not included.
-
Used to create a copy of a folder in another folder. The original version of the folder will not be altered.
Declaration
Parameters
folderIdThe ID of the folder that will be copy.
destinationFolderIDThe ID of the destination folder
nameAn optional new name for the folder
fieldsComma-separated list of fields to include in the response.
completionReturns a full folder object or an error if the parentId is invalid or if a name collision occurs.
-
Use this to get a list of all the collaborations on a folder i.e. all of the users that have access to that folder.
Declaration
Swift
public func listCollaborations( folderId: String, fields: [String]? = nil ) -> PaginationIterator<Collaboration>Parameters
folderIdThe ID of the folder on which to retrieve collaborations.
fieldsComma-separated list of fields to include in the response.
-
Gets folder with updated shared link
Declaration
Swift
public func getSharedLink( forFolder folderId: String, completion: @escaping Callback<SharedLink> )Parameters
folderIdThe ID of the folder
completionReturns a standard SharedLink object or an error
-
Creates or updates shared link for a folder
Declaration
Swift
public func setSharedLink( forFolder folderId: String, access: SharedLinkAccess? = nil, unsharedAt: NullableParameter<Date>? = nil, password: NullableParameter<String>? = nil, canDownload: Bool? = nil, completion: @escaping Callback<SharedLink> )Parameters
folderIdThe ID of the folder
accessThe level of access. If you omit this field then the access level will be set to the default access level specified by the enterprise admin
unsharedAtThe date-time that this link will become disabled. This field can only be set by users with paid accounts
passwordThe password required to access the shared link. Set to .null to remove the password
canDownloadWhether the shared link allows downloads. Applies to any items in the folder
completionReturns a standard SharedLink object or an error
-
Removes shared link for a folder
Declaration
Swift
public func deleteSharedLink( forFolder folderId: String, completion: @escaping Callback<Void> )Parameters
folderIdThe ID of the folder
completionReturns an empty response or an error
-
Remove the watermark from a specified folder.
Declaration
Swift
public func removeWatermark( folderId: String, completion: @escaping Callback<Void> )Parameters
folderIdThe id of the folder to remove the watermark from.
completionReturns an empty response or an error.
FoldersModule Class Reference