# DocumentVersionControllerApi

All URIs are relative to *http://localhost:8081*

|Method | HTTP request | Description|
|------------- | ------------- | -------------|
|[**downloadVersion**](#downloadversion) | **GET** /api/v1/documents/{documentId}/versions/{versionId}/download | Download a specific document version|
|[**listVersions**](#listversions) | **GET** /api/v1/documents/{documentId}/versions | List document versions|
|[**restoreVersion**](#restoreversion) | **POST** /api/v1/documents/{documentId}/versions/{versionId}/restore | Restore a previous document version|

# **downloadVersion**
> File downloadVersion()

Downloads the content of a specific stored version of a file document.

### Example

```typescript
import {
    DocumentVersionControllerApi,
    Configuration
} from '@openfilz-sdk/typescript';

const configuration = new Configuration();
const apiInstance = new DocumentVersionControllerApi(configuration);

let documentId: string; // (default to undefined)
let versionId: string; // (default to undefined)

const { status, data } = await apiInstance.downloadVersion(
    documentId,
    versionId
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **documentId** | [**string**] |  | defaults to undefined|
| **versionId** | [**string**] |  | defaults to undefined|


### Return type

**File**

### Authorization

[keycloak_auth](../README.md#keycloak_auth)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: */*


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **listVersions**
> Array<DocumentVersionInfo> listVersions()

Lists all stored versions of a file document, newest first. Requires storage versioning to be enabled (otherwise HTTP 409).

### Example

```typescript
import {
    DocumentVersionControllerApi,
    Configuration
} from '@openfilz-sdk/typescript';

const configuration = new Configuration();
const apiInstance = new DocumentVersionControllerApi(configuration);

let documentId: string; // (default to undefined)

const { status, data } = await apiInstance.listVersions(
    documentId
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **documentId** | [**string**] |  | defaults to undefined|


### Return type

**Array<DocumentVersionInfo>**

### Authorization

[keycloak_auth](../README.md#keycloak_auth)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: */*


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **restoreVersion**
> RestoreVersionResponse restoreVersion()

Restores the selected version as the new latest version. History-preserving: a new version is created on top, no version is deleted, and a RESTORE_DOCUMENT_VERSION audit entry is logged. Restoring the current latest version is rejected (HTTP 400).

### Example

```typescript
import {
    DocumentVersionControllerApi,
    Configuration
} from '@openfilz-sdk/typescript';

const configuration = new Configuration();
const apiInstance = new DocumentVersionControllerApi(configuration);

let documentId: string; // (default to undefined)
let versionId: string; // (default to undefined)

const { status, data } = await apiInstance.restoreVersion(
    documentId,
    versionId
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **documentId** | [**string**] |  | defaults to undefined|
| **versionId** | [**string**] |  | defaults to undefined|


### Return type

**RestoreVersionResponse**

### Authorization

[keycloak_auth](../README.md#keycloak_auth)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: */*


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

