# Interface UploadApiClient

API for uploading content.

interface UploadApiClient {
canAppendFileVersion(
permissionsAndOwnerSystem: DeepImmutable<BimChangeUploadable>,
): boolean;
canCreateFileIn(
permissions: DeepImmutable<BimChangeLayer | BimFolder>,
): boolean;
canCreateFileInFolder(permissions: DeepImmutable<BimFolder>): boolean;
createFileSession<Change extends BimChangeUploadable>(
operation: UploadApiClientContentOperation<Change>,
o?: DeepImmutableObject<UploadApiClientContentOptions>,
): Promise<UploadApiClientFailure | UploadApiTask<Change>>;
}

##### Index

### Methods

canAppendFileVersion
canCreateFileIn
canCreateFileInFolder
createFileSession

## Methods

### canAppendFileVersion

- canAppendFileVersion(
  permissionsAndOwnerSystem: DeepImmutable<BimChangeUploadable>,
  ): boolean

  Checks if it is possible to append a version to a existing change.

  #### Parameters

  - permissionsAndOwnerSystem: DeepImmutable<BimChangeUploadable>

    Permissions and owner system of the change to append a version to. See BimChangeUploadable.permissions and BimChangeUploadable.ownerSystem.

  #### Returns boolean

  `true` if it is possible to upload content and thereby appending a new version (previous version must exist.)

### canCreateFileIn

- canCreateFileIn(permissions: DeepImmutable<BimChangeLayer | BimFolder>): boolean

  Check if it is possible to create a new change (file) in a folder or a file.

  #### Parameters

  - permissions: DeepImmutable<BimChangeLayer | BimFolder>

    Folder permissions. See BimChangeUploadable.permissions.

  #### Returns boolean

  `true` if it is possible to upload content into the folder and create a new file (no previous version may exist.)

### canCreateFileInFolder

- canCreateFileInFolder(permissions: DeepImmutable<BimFolder>): boolean

  Check if it is possible to create a new change (file) in a folder.

  #### Parameters

  - permissions: DeepImmutable<BimFolder>

    Folder permissions. See BimChangeUploadable.permissions.

  #### Returns boolean

  `true` if it is possible to upload content into the folder and create a new file (no previous version may exist.)

  #### Deprecated

  Use canCreateFileIn instead.

### createFileSession

- createFileSession<Change extends BimChangeUploadable>(
  operation: UploadApiClientContentOperation<Change>,
  o?: DeepImmutableObject<UploadApiClientContentOptions>,
  ): Promise<UploadApiClientFailure | UploadApiTask<Change>>

  Creates an upload session (represented by an UploadApiTask)

  #### Type Parameters

  - Change extends BimChangeUploadable

  #### Parameters

  - operation: UploadApiClientContentOperation<Change>

    Defines whehter the upload should create a new change in a folder (previous change may not exist) or if we want to append a version to a existing change

  - `Optional` o: DeepImmutableObject<UploadApiClientContentOptions>

    Options.

  #### Returns Promise<UploadApiClientFailure | UploadApiTask<Change>>

  A promise of either UploadApiTask, representing the content that is to be uploaded, or UploadApiClientFailure representing a error that occured.