# Files

Files service should be used primarily when uploading or downloading files.

## Methods

## GetStatus

<mark style="color:green;">`POST`</mark> `https://cca-{region}-saas-{enviroment}.infomaker.io/twirp/cca.Files/GetStatus`

Method to call at an interval to check status of an ongoing upload

#### Request Body

| Name     | Type   | Description                                       |
| -------- | ------ | ------------------------------------------------- |
| uploadId | string | The uploadId (Received when an upload is started) |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## GetArtifact

<mark style="color:green;">`POST`</mark> `https://cca-{region}-saas-{enviroment}.infomaker.io/twirp/cca.Files/GetArtifact`

Method returns content (as base64 encoded) from artifact file.

#### Request Body

| Name     | Type   | Description                                       |
| -------- | ------ | ------------------------------------------------- |
| uploadId | string | The uploadid (Received when an upload is started) |
| name     | string | Name of the file                                  |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## CreateUpload

<mark style="color:green;">`POST`</mark> `https://cca-{region}-saas-{enviroment}.infomaker.io/twirp/cca.Files/CreateUpload`

Initiate a new upload.

#### Request Body

| Name     | Type   | Description |
| -------- | ------ | ----------- |
| filename | string |             |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## CreateDownload

<mark style="color:green;">`POST`</mark> `https://cca-{region}-saas-{enviroment}.infomaker.io/twirp/cca.Files/CreateDownload`

Initiate a new download

#### Request Body

| Name | Type             | Description                                                             |
| ---- | ---------------- | ----------------------------------------------------------------------- |
| UUID | string           | UUID of document                                                        |
| type | cca.DownloadType | optional with value 'original' or 'presentation', see DownloadType enum |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## GetDownloadStatus

<mark style="color:green;">`POST`</mark> `https://cca-{region}-saas-{enviroment}.infomaker.io/twirp/cca.Files/GetDownloadStatus`

Method to call at an interval to check status of downloadable image

#### Request Body

| Name       | Type   | Description                  |
| ---------- | ------ | ---------------------------- |
| downloadId | string | ID of the requested download |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

api-method-response endapi-method-response

## Enums

**cca.DownloadType** DownloadType can be passed as a parameter when downloading assets

```
TYPE_UNKNOWN
TYPE_ORIGINAL
TYPE_PRESENTATION
```

**cca.LockingMode** Locking mode is passed as a parameter when saving documents

```
NONE
OPTIMISTIC_LOCKING
PESSIMISTIC_LOCKING
```

**cca.ProcessingStatus**

```
UNKNOWN
IN_PROGRESS
DONE
ERROR
```
