FoldersModule
public class FoldersModule
Provides Folder management.
-
Get information about a folder.
Declaration
Parameters
folderId
The ID of the folder on which to retrieve information.
fields
Comma-separated list of fields to include in the response.
completion
Returns 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 ) -> PagingIterator<FolderItem>
Parameters
folderId
The ID of the folder on which to retrieve information.
usemarker
This 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.
marker
The position marker at which to begin the response. See marker-based paging for details. This parameter cannot be used simultaneously with the ‘offset’ parameter.
offset
The 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.
limit
The maximum number of items to return. The default is 100 and the maximum is 1,000.
sort
This can be id, name, or date. This parameter is not yet supported for marker- based paging on folder 0.
direction
This can be ASC or DESC.
fields
Comma-separated list of fields to include in the response.
-
Create a new folder.
Declaration
Parameters
name
The 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.
parentId
The ID of the parent folder.
fields
Comma-separated list of fields to include in the response.
completion
Returns 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
folderId
The ID of the file to update
name
The name of the folder.
description
The description of the folder.
parentId
The ID of the parent folder
sharedLink
Shared links provide direct, read-only access to folder on Box using a URL.
folderUploadEmailAccess
Can be open or collaborators
tags
Array of tags to be added or replaced to the folder
canNonOwnersInvite
If this parameter is set to false, only folder owners and co-owners can send collaborator invites
isCollaborationRestrictedToEnterprise
Whether to restrict future collaborations to within the enterprise. Does not affect existing collaborations.
fields
Comma-separated list of fields to include in the response.
completion
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
folderId
The ID of the file to delete.
recursive
Whether to delete this folder if it has items inside of it.
completion
An 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
folderId
The ID of the folder that will be copy.
destinationFolderID
The ID of the destination folder
name
An optional new name for the folder
fields
Comma-separated list of fields to include in the response.
completion
Returns 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 ) -> PagingIterator<Collaboration>
Parameters
folderId
The ID of the folder on which to retrieve collaborations.
fields
Comma-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
folderId
The ID of the folder
completion
Returns 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, vanityName: NullableParameter<String>? = nil, password: NullableParameter<String>? = nil, canDownload: Bool? = nil, completion: @escaping Callback<SharedLink> )
Parameters
folderId
The ID of the folder
access
The 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
unsharedAt
The date-time that this link will become disabled. This field can only be set by users with paid accounts
vanityName
The custom name of a shared link, as used in the vanityUrl field. It should be between 12 and 30 characters. This field can contains only letters, numbers, and hyphens.
password
The password required to access the shared link. Set to .null to remove the password
canDownload
Whether the shared link allows downloads. Applies to any items in the folder
completion
Returns 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
folderId
The ID of the folder
completion
Returns 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
folderId
The id of the folder to remove the watermark from.
completion
Returns an empty response or an error.
-
Get all of the locks on a folder.
Declaration
Swift
public func listLocks( folderId: String ) -> PagingIterator<FolderLock>
Parameters
folderId
The ID of the folder on which to retrieve folder locks.
completion
Returns all of the locks on the folder, or an error if the request is unsuccessful.
-
Creates a folder lock on a folder, preventing it from being moved and/or deleted.
Declaration
Swift
public func createLock( folderId: String, completion: @escaping Callback<FolderLock> )
Parameters
folderId
The ID of the folder to apply the lock to.
completion
Returns a folder lock object or an error if the request is unsuccessful.
-
Remove the specified folder lock.
Declaration
Swift
public func deleteLock( folderLockId: String, completion: @escaping Callback<Void> )
Parameters
folderLockId
The id of the folder lock to remove.
completion
Returns an empty response or an error.