# Interface UploadApiTask<Change>

Represents content that is about to be uploaded.

interface UploadApiTask<Change extends BimChangeUploadable> {
bytesUploaded: number;
onChunkuploaded: Observable<UploadApiTask<Change>>;
progress: number;
sizeInBytes: number;
cancel(): Promise<boolean>;
upload(): Promise<UploadApiClientFailure | Change>;
}

#### Type Parameters

- Change extends BimChangeUploadable

##### Index

### Properties

bytesUploaded
onChunkuploaded
progress
sizeInBytes

### Methods

cancel
upload

## Properties

### `Readonly` bytesUploaded

bytesUploaded: number

Number of bytes that have currently been uploaded

### `Readonly` onChunkuploaded

onChunkuploaded: Observable<UploadApiTask<Change>>

Triggered every time a chunk has been sucessfully uploaded.

### `Readonly` progress

progress: number

Progress of upload in range of [0, 100].

### `Readonly` sizeInBytes

sizeInBytes: number

Size in bytes of the content that is to be uploaded.

## Methods

### cancel

- cancel(): Promise<boolean>

  cancels the ongoing upload.

  #### Returns Promise<boolean>

  boolean promise which evaluates to `true` if cancellation was a success.

### upload

- upload(): Promise<UploadApiClientFailure | Change>

  Starts uploading the content.

  #### Returns Promise<UploadApiClientFailure | Change>

  either a change, representing the new version that the upload resulted in, or UploadApiClientFailure that represents an error.