-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathversions.ts
More file actions
117 lines (106 loc) · 3.2 KB
/
versions.ts
File metadata and controls
117 lines (106 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource';
import * as FilesAPI from './files';
import { APIPromise } from '../../core/api-promise';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
export class Versions extends APIResource {
/**
* This API returns details of all versions of a file.
*
* @example
* ```ts
* const files = await client.files.versions.list('fileId');
* ```
*/
list(fileID: string, options?: RequestOptions): APIPromise<VersionListResponse> {
return this._client.get(path`/v1/files/${fileID}/versions`, options);
}
/**
* This API deletes a non-current file version permanently. The API returns an
* empty response.
*
* Note: If you want to delete all versions of a file, use the delete file API.
*
* @example
* ```ts
* const version = await client.files.versions.delete(
* 'versionId',
* { fileId: 'fileId' },
* );
* ```
*/
delete(
versionID: string,
params: VersionDeleteParams,
options?: RequestOptions,
): APIPromise<VersionDeleteResponse> {
const { fileId } = params;
return this._client.delete(path`/v1/files/${fileId}/versions/${versionID}`, options);
}
/**
* This API returns an object with details or attributes of a file version.
*
* @example
* ```ts
* const file = await client.files.versions.get('versionId', {
* fileId: 'fileId',
* });
* ```
*/
get(versionID: string, params: VersionGetParams, options?: RequestOptions): APIPromise<FilesAPI.File> {
const { fileId } = params;
return this._client.get(path`/v1/files/${fileId}/versions/${versionID}`, options);
}
/**
* This API restores a file version as the current file version.
*
* @example
* ```ts
* const file = await client.files.versions.restore(
* 'versionId',
* { fileId: 'fileId' },
* );
* ```
*/
restore(
versionID: string,
params: VersionRestoreParams,
options?: RequestOptions,
): APIPromise<FilesAPI.File> {
const { fileId } = params;
return this._client.put(path`/v1/files/${fileId}/versions/${versionID}/restore`, options);
}
}
export type VersionListResponse = Array<FilesAPI.File>;
export interface VersionDeleteResponse {}
export interface VersionDeleteParams {
/**
* The unique `fileId` of the uploaded file. `fileId` is returned in list and
* search assets API and upload API.
*/
fileId: string;
}
export interface VersionGetParams {
/**
* The unique `fileId` of the uploaded file. `fileId` is returned in list and
* search assets API and upload API.
*/
fileId: string;
}
export interface VersionRestoreParams {
/**
* The unique `fileId` of the uploaded file. `fileId` is returned in list and
* search assets API and upload API.
*/
fileId: string;
}
export declare namespace Versions {
export {
type VersionListResponse as VersionListResponse,
type VersionDeleteResponse as VersionDeleteResponse,
type VersionDeleteParams as VersionDeleteParams,
type VersionGetParams as VersionGetParams,
type VersionRestoreParams as VersionRestoreParams,
};
}