-
Notifications
You must be signed in to change notification settings - Fork 3
/
temp-contents.d.ts
167 lines (165 loc) · 6.71 KB
/
temp-contents.d.ts
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
import { A as ApiCallOptions } from './global.types-qsBNouXJ.js';
import './auth-types-PkN9CAF_.js';
/**
* An Error object.
*/
type Error = {
/** The API error code. */
code: string;
/** A human-readable problem description of the issue. */
detail?: string;
/** Additional properties and information regarding the issue. */
meta?: {
/** The error type. */
errorType?: string;
/** Locale */
locale?: string;
/** The source errors (stack trace). */
sourceErrors?: string;
};
/** Title of the type of API Error. */
title: string;
};
/**
* An array of Error objects.
*/
type Errors = {
errors?: Error[];
/** A way to trace the source of the error. */
traceId?: string;
};
type DetailResponse = {
/** Datetime-stamp when the resource was created (in UTC). */
CreatedAt?: string;
/** Identifier for the subject / resource creator. */
CreatorID?: string;
/** Datetime-stamp when the resource expired (in UTC). */
Expires?: string;
/** Identifier */
ID?: string;
/** File name of the file uploaded by the user. */
Name?: string;
/** Size of resource (in bytes). */
Size?: string;
/** Time-to-live in seconds. */
TTLSeconds?: number;
/** Datetime-stamp when the resource was updated (in UTC). */
UpdatedAt?: string;
};
/**
* This endpoint is used to upload a file as a temporary content resource. It returns a `201 Created` with a location header that contains the location of the created resource. If filename or TTL is not properly set, a `400 Bad request` is returned. For internal issues, a `500 Internal Server Error` is returned.
*
* @param query an object with query parameters
* @param body an object with the body content
* @throws UploadTempFileHttpError
*/
declare const uploadTempFile: (query: {
/** The name of the file to upload. */
filename?: string;
/** The TTL parameter is used to define the time-to-live for the content resource in seconds.
* It defaults to one hour (3600) if no input is provided. Max TTL is 259200 (3 days).' */
ttl?: number;
}, body: BodyInit, options?: ApiCallOptions) => Promise<UploadTempFileHttpResponse>;
type UploadTempFileHttpResponse = {
data: void;
headers: Headers;
status: number;
};
type UploadTempFileHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* This endpoint is used to retrieve a temporary content file. It returns a valid (`200 OK`) in case the file exists and the user is authorized to view the contents. It returns a `410 Gone` if the file has expired and `404 Not Found` if the criteria is not met.
*
* @param id The temporary contents ID.
* @param query an object with query parameters
* @throws DownloadTempFileHttpError
*/
declare const downloadTempFile: (id: string, query: {
/** Set to "1" to download the file in inline mode. Useful for displaying a preview of the file in a browser. */
inline?: string;
}, options?: ApiCallOptions) => Promise<DownloadTempFileHttpResponse>;
type DownloadTempFile200HttpResponse = {
data: unknown;
headers: Headers;
status: 200;
};
type DownloadTempFile204HttpResponse = {
data: void;
headers: Headers;
status: 204;
};
type DownloadTempFile206HttpResponse = {
data: unknown;
headers: Headers;
status: 206;
};
type DownloadTempFileHttpResponse = DownloadTempFile200HttpResponse | DownloadTempFile204HttpResponse | DownloadTempFile206HttpResponse;
type DownloadTempFileHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* This endpoint is used to retrieve a summary of the metadata associated with a temporary content resource. It returns a `200 OK` with a model if the temporary resource is valid. It returns a `410 Gone` if the file has expired and `404 Not Found` if the criteria is not met.
*
* @param id The temporary contents ID.
* @throws GetTempFileDetailsHttpError
*/
declare const getTempFileDetails: (id: string, options?: ApiCallOptions) => Promise<GetTempFileDetailsHttpResponse>;
type GetTempFileDetails200HttpResponse = {
data: DetailResponse;
headers: Headers;
status: 200;
};
type GetTempFileDetails204HttpResponse = {
data: void;
headers: Headers;
status: 204;
};
type GetTempFileDetailsHttpResponse = GetTempFileDetails200HttpResponse | GetTempFileDetails204HttpResponse;
type GetTempFileDetailsHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Clears the cache for temp-contents api requests.
*/
declare function clearCache(): void;
interface TempContentsAPI {
/**
* This endpoint is used to upload a file as a temporary content resource. It returns a `201 Created` with a location header that contains the location of the created resource. If filename or TTL is not properly set, a `400 Bad request` is returned. For internal issues, a `500 Internal Server Error` is returned.
*
* @param query an object with query parameters
* @param body an object with the body content
* @throws UploadTempFileHttpError
*/
uploadTempFile: typeof uploadTempFile;
/**
* This endpoint is used to retrieve a temporary content file. It returns a valid (`200 OK`) in case the file exists and the user is authorized to view the contents. It returns a `410 Gone` if the file has expired and `404 Not Found` if the criteria is not met.
*
* @param id The temporary contents ID.
* @param query an object with query parameters
* @throws DownloadTempFileHttpError
*/
downloadTempFile: typeof downloadTempFile;
/**
* This endpoint is used to retrieve a summary of the metadata associated with a temporary content resource. It returns a `200 OK` with a model if the temporary resource is valid. It returns a `410 Gone` if the file has expired and `404 Not Found` if the criteria is not met.
*
* @param id The temporary contents ID.
* @throws GetTempFileDetailsHttpError
*/
getTempFileDetails: typeof getTempFileDetails;
/**
* Clears the cache for temp-contents api requests.
*/
clearCache: typeof clearCache;
}
/**
* Functions for the temp-contents api
*/
declare const tempContentsExport: TempContentsAPI;
export { type DetailResponse, type DownloadTempFile200HttpResponse, type DownloadTempFile204HttpResponse, type DownloadTempFile206HttpResponse, type DownloadTempFileHttpError, type DownloadTempFileHttpResponse, type Error, type Errors, type GetTempFileDetails200HttpResponse, type GetTempFileDetails204HttpResponse, type GetTempFileDetailsHttpError, type GetTempFileDetailsHttpResponse, type TempContentsAPI, type UploadTempFileHttpError, type UploadTempFileHttpResponse, clearCache, tempContentsExport as default, downloadTempFile, getTempFileDetails, uploadTempFile };