@docbox-nz/hapi-gateway 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +6 -0
- package/.eslintrc +131 -0
- package/.prettierignore +11 -0
- package/.prettierrc +6 -0
- package/LICENSE.md +21 -0
- package/README.md +152 -0
- package/cspell.json +6 -0
- package/dist/api/adminService.d.ts +16 -0
- package/dist/api/boxService.d.ts +43 -0
- package/dist/api/client.d.ts +45 -0
- package/dist/api/docboxFile.d.ts +15 -0
- package/dist/api/fileService.d.ts +251 -0
- package/dist/api/folderService.d.ts +45 -0
- package/dist/api/linkService.d.ts +115 -0
- package/dist/api/taskService.d.ts +23 -0
- package/dist/api/utils.d.ts +1 -0
- package/dist/error.d.ts +11 -0
- package/dist/index.browser.cjs +988 -0
- package/dist/index.browser.cjs.map +1 -0
- package/dist/index.browser.esm.js +984 -0
- package/dist/index.browser.esm.js.map +1 -0
- package/dist/index.browser.js +4390 -0
- package/dist/index.browser.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.node.cjs +22660 -0
- package/dist/index.node.cjs.map +1 -0
- package/dist/index.node.esm.js +22657 -0
- package/dist/index.node.esm.js.map +1 -0
- package/dist/index.node.js +20809 -0
- package/dist/index.node.js.map +1 -0
- package/dist/options.d.ts +79 -0
- package/dist/types/box.d.ts +59 -0
- package/dist/types/file.d.ts +371 -0
- package/dist/types/folder.d.ts +153 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/types/link.d.ts +136 -0
- package/dist/types/search.d.ts +177 -0
- package/dist/types/shared.d.ts +94 -0
- package/dist/types/user.d.ts +20 -0
- package/package.json +56 -0
- package/rollup.config.js +36 -0
- package/src/error.ts +46 -0
- package/src/index.ts +244 -0
- package/src/options.ts +95 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { DocboxFileSearchRequest, DocboxFileSearchResponse, DocumentBoxScope, FileId, FileResponse, FolderId, GeneratedFileType, PresignedStatusResponse, UpdateFile, UploadFileResponse } from '../types';
|
|
2
|
+
import { DocboxClient } from './client';
|
|
3
|
+
import { DocFile, DocFileEditHistory, DocGeneratedFile as GeneratedFile, PresignedUploadFileRequest, PresignedUploadOptions, PresignedUploadResponse, UploadFileRequest } from '../types/file';
|
|
4
|
+
import 'formdata-polyfill';
|
|
5
|
+
export declare class FileService {
|
|
6
|
+
private client;
|
|
7
|
+
constructor(client: DocboxClient);
|
|
8
|
+
/**
|
|
9
|
+
* Get a URL to a raw version of a file
|
|
10
|
+
*
|
|
11
|
+
* @param scope Scope the file is within
|
|
12
|
+
* @param id ID of the file
|
|
13
|
+
* @returns The file URL
|
|
14
|
+
*/
|
|
15
|
+
rawURL(scope: DocumentBoxScope, id: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Get a URL to a raw version of a file with an additional
|
|
18
|
+
* cosmetic name shown in browser viewers
|
|
19
|
+
*
|
|
20
|
+
* @param scope Scope the file is within
|
|
21
|
+
* @param id ID of the file
|
|
22
|
+
* @param name Name to provide the file
|
|
23
|
+
* @returns The file URL
|
|
24
|
+
*/
|
|
25
|
+
rawNamedURL(scope: DocumentBoxScope, id: string, name: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Get a URL to a generated version of a file
|
|
28
|
+
*
|
|
29
|
+
* @param scope Scope the file is within
|
|
30
|
+
* @param id ID of the main file
|
|
31
|
+
* @param type Type of generated file to get
|
|
32
|
+
* @returns The URL to the generated file
|
|
33
|
+
*/
|
|
34
|
+
generatedRawURL(scope: string, id: string, type: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Get a URL to a generated version of a file with an additional
|
|
37
|
+
* cosmetic name shown in browser viewers
|
|
38
|
+
*
|
|
39
|
+
* @param scope Scope the file is within
|
|
40
|
+
* @param id ID of the main file
|
|
41
|
+
* @param type Type of generated file to get
|
|
42
|
+
* @param name Name to provide the file
|
|
43
|
+
* @returns The URL to the generated file
|
|
44
|
+
*/
|
|
45
|
+
generatedRawNamedURL(scope: string, id: string, type: string, name: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* Direct upload
|
|
48
|
+
*
|
|
49
|
+
* @deprecated When behind the proxy service this will often encounter timeout issues
|
|
50
|
+
* its recommended you use another upload method
|
|
51
|
+
*
|
|
52
|
+
* Prefer {@link FileService.uploadAsync}
|
|
53
|
+
*
|
|
54
|
+
* @param scope Scope to upload the file into
|
|
55
|
+
* @param name Name of the file
|
|
56
|
+
* @param folder_id Folder to store the file in
|
|
57
|
+
* @param file File to store
|
|
58
|
+
* @returns File upload response
|
|
59
|
+
*/
|
|
60
|
+
upload(scope: DocumentBoxScope, name: string, folder_id: FolderId, file: File): Promise<UploadFileResponse>;
|
|
61
|
+
/**
|
|
62
|
+
* Asynchronous direct upload
|
|
63
|
+
*
|
|
64
|
+
* (File is uploaded directly but processed asynchronously)
|
|
65
|
+
*
|
|
66
|
+
* If you are handling reasonably sized files prefer {@link FileService.uploadPresigned} to
|
|
67
|
+
* prevent running into browser timeouts as the file is transferred between services
|
|
68
|
+
*
|
|
69
|
+
* @param request Upload request data
|
|
70
|
+
* @returns The uploaded file response
|
|
71
|
+
*/
|
|
72
|
+
uploadAsync(request: UploadFileRequest): Promise<UploadFileResponse>;
|
|
73
|
+
/**
|
|
74
|
+
* Performs a pre-signed file upload
|
|
75
|
+
*
|
|
76
|
+
* @param scope Scope to upload the file into
|
|
77
|
+
* @param folderId ID of the folder to store the file within
|
|
78
|
+
* @param file File to upload
|
|
79
|
+
* @param options Request options
|
|
80
|
+
* @returns File upload response
|
|
81
|
+
*/
|
|
82
|
+
uploadPresigned(scope: DocumentBoxScope, folderId: FolderId, file: File, options?: PresignedUploadOptions): Promise<FileResponse>;
|
|
83
|
+
performPresignedUpload(file: File, presigned: PresignedUploadResponse, options?: PresignedUploadOptions): Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Creates a new presigned upload
|
|
86
|
+
*
|
|
87
|
+
* @param scope Scope to upload the file within
|
|
88
|
+
* @param request The presigned upload request
|
|
89
|
+
* @returns The presigned upload details
|
|
90
|
+
*/
|
|
91
|
+
createPresignedUpload(scope: DocumentBoxScope, request: PresignedUploadFileRequest): Promise<PresignedUploadResponse>;
|
|
92
|
+
/**
|
|
93
|
+
* Request the status of a presigned upload task
|
|
94
|
+
*
|
|
95
|
+
* @param scope Scope the upload file task is within
|
|
96
|
+
* @param taskId ID of the uploading task
|
|
97
|
+
* @param abort Abort handle to abort the request
|
|
98
|
+
* @returns The task status
|
|
99
|
+
*/
|
|
100
|
+
presignedStatus(scope: DocumentBoxScope, taskId: string, abort?: AbortController): Promise<PresignedStatusResponse>;
|
|
101
|
+
/**
|
|
102
|
+
* Polls for the completion of a presigned upload task
|
|
103
|
+
*
|
|
104
|
+
* @param scope Scope the upload file task is within
|
|
105
|
+
* @param task_id ID of the uploading task
|
|
106
|
+
* @param interval Rate at which to poll for completion
|
|
107
|
+
* @param abort Abort handle that can abort the polling
|
|
108
|
+
* @returns The uploaded file response
|
|
109
|
+
*/
|
|
110
|
+
presignedFinished(scope: DocumentBoxScope, task_id: string, interval?: number, abort?: AbortController): Promise<FileResponse>;
|
|
111
|
+
/**
|
|
112
|
+
* Request the details of a file using its ID and scope
|
|
113
|
+
*
|
|
114
|
+
* @param scope Scope the file resides within
|
|
115
|
+
* @param file_id ID of the file
|
|
116
|
+
* @returns The full file details
|
|
117
|
+
*/
|
|
118
|
+
get(scope: DocumentBoxScope, file_id: FileId): Promise<FileResponse>;
|
|
119
|
+
/**
|
|
120
|
+
* Search within the contents of a file
|
|
121
|
+
*
|
|
122
|
+
* @param scope Scope the file resides within
|
|
123
|
+
* @param file_id ID of the file
|
|
124
|
+
* @param request The search request
|
|
125
|
+
* @returns The full file details
|
|
126
|
+
*/
|
|
127
|
+
search(scope: DocumentBoxScope, file_id: FileId, request: DocboxFileSearchRequest): Promise<DocboxFileSearchResponse>;
|
|
128
|
+
/**
|
|
129
|
+
* Request children of the file, in the case of .eml email files this
|
|
130
|
+
* would provide a list of files for the attachments associated with
|
|
131
|
+
* the email
|
|
132
|
+
*
|
|
133
|
+
* @param scope Scope the file resides within
|
|
134
|
+
* @param file_id ID of the file to find the children of
|
|
135
|
+
* @returns The files that are children
|
|
136
|
+
*/
|
|
137
|
+
children(scope: DocumentBoxScope, file_id: FileId): Promise<DocFile[]>;
|
|
138
|
+
/**
|
|
139
|
+
* Request the history of edits to the file
|
|
140
|
+
*
|
|
141
|
+
* @param scope Scope the file resides within
|
|
142
|
+
* @param file_id ID of the file to get the history for
|
|
143
|
+
* @returns The edit history
|
|
144
|
+
*/
|
|
145
|
+
editHistory(scope: DocumentBoxScope, file_id: FileId): Promise<DocFileEditHistory[]>;
|
|
146
|
+
/**
|
|
147
|
+
* Update the details about the file
|
|
148
|
+
*
|
|
149
|
+
* @param scope Scope the file resides within
|
|
150
|
+
* @param file_id ID of the file to update
|
|
151
|
+
* @param data The updates to perform
|
|
152
|
+
*/
|
|
153
|
+
update(scope: DocumentBoxScope, file_id: FileId, data: UpdateFile): Promise<void>;
|
|
154
|
+
/**
|
|
155
|
+
* Gets the raw file contents of the provided file
|
|
156
|
+
*
|
|
157
|
+
* On node this returns an {@link ArrayBuffer} not a blob
|
|
158
|
+
*
|
|
159
|
+
* @param scope Scope the file resides within
|
|
160
|
+
* @param file_id ID of the file to retrieve
|
|
161
|
+
* @returns The raw contents of the file
|
|
162
|
+
*/
|
|
163
|
+
raw(scope: DocumentBoxScope, file_id: FileId): Promise<Blob>;
|
|
164
|
+
/**
|
|
165
|
+
* Gets the raw file contents of the provided file
|
|
166
|
+
*
|
|
167
|
+
* This function is the same as {@link FileService.raw} just
|
|
168
|
+
* it has the correct return type for Node
|
|
169
|
+
*
|
|
170
|
+
* @param scope Scope the file resides within
|
|
171
|
+
* @param file_id ID of the file to retrieve
|
|
172
|
+
* @returns The raw contents of the file
|
|
173
|
+
*/
|
|
174
|
+
rawNode(scope: DocumentBoxScope, file_id: FileId): Promise<ArrayBuffer>;
|
|
175
|
+
/**
|
|
176
|
+
* Gets the raw file contents of the provided file in
|
|
177
|
+
* JSON format (Will only work if the actual file is JSON)
|
|
178
|
+
*
|
|
179
|
+
* @param scope Scope the file resides within
|
|
180
|
+
* @param file_id ID of the file to retrieve
|
|
181
|
+
* @returns The JSON contents of the file
|
|
182
|
+
*/
|
|
183
|
+
json(scope: DocumentBoxScope, file_id: FileId): Promise<any>;
|
|
184
|
+
/**
|
|
185
|
+
* Gets the raw file contents of the provided file as text
|
|
186
|
+
* (Will only work if the actual file is text)
|
|
187
|
+
*
|
|
188
|
+
* @param scope Scope the file resides within
|
|
189
|
+
* @param file_id ID of the file to retrieve
|
|
190
|
+
* @returns The text contents of the file
|
|
191
|
+
*/
|
|
192
|
+
text(scope: DocumentBoxScope, file_id: FileId): Promise<string>;
|
|
193
|
+
/**
|
|
194
|
+
* Deletes a file
|
|
195
|
+
*
|
|
196
|
+
* @param scope Scope the file resides within
|
|
197
|
+
* @param file_id ID of the file to delete
|
|
198
|
+
*/
|
|
199
|
+
delete(scope: DocumentBoxScope, file_id: FileId): Promise<void>;
|
|
200
|
+
/**
|
|
201
|
+
* Gets a generated file details
|
|
202
|
+
*
|
|
203
|
+
* @param scope Scope the file resides within
|
|
204
|
+
* @param file_id ID of the file to query
|
|
205
|
+
* @param type Type of the generated file
|
|
206
|
+
* @returns The generated file details
|
|
207
|
+
*/
|
|
208
|
+
generated(scope: DocumentBoxScope, file_id: FileId, type: GeneratedFileType): Promise<GeneratedFile>;
|
|
209
|
+
/**
|
|
210
|
+
* Gets a generated file raw contents
|
|
211
|
+
*
|
|
212
|
+
* On node this returns an {@link ArrayBuffer} not a blob
|
|
213
|
+
*
|
|
214
|
+
* @param scope Scope the file resides within
|
|
215
|
+
* @param file_id ID of the file to query
|
|
216
|
+
* @param type Type of the generated file
|
|
217
|
+
* @returns The Blob/ArrayBuffer content of the file (Blob within a browser, ArrayBuffer on node)
|
|
218
|
+
*/
|
|
219
|
+
generatedRaw(scope: DocumentBoxScope, file_id: FileId, type: GeneratedFileType): Promise<Blob>;
|
|
220
|
+
/**
|
|
221
|
+
* Gets a generated file raw contents
|
|
222
|
+
*
|
|
223
|
+
* This function is the same as {@link FileService.generatedRaw} just
|
|
224
|
+
* it has the correct return type for Node and will only return an
|
|
225
|
+
* ArrayBuffer
|
|
226
|
+
*
|
|
227
|
+
* @param scope Scope the file resides within
|
|
228
|
+
* @param file_id ID of the file to query
|
|
229
|
+
* @param type Type of the generated file
|
|
230
|
+
* @returns The ArrayBuffer content of the generated file
|
|
231
|
+
*/
|
|
232
|
+
generatedRawNode(scope: DocumentBoxScope, file_id: FileId, type: GeneratedFileType): Promise<ArrayBuffer>;
|
|
233
|
+
/**
|
|
234
|
+
* Gets a generated file raw contents as text
|
|
235
|
+
*
|
|
236
|
+
* @param scope Scope the file resides within
|
|
237
|
+
* @param file_id ID of the file to query
|
|
238
|
+
* @param type Type of the generated file
|
|
239
|
+
* @returns The text content of the generated file
|
|
240
|
+
*/
|
|
241
|
+
generatedText(scope: DocumentBoxScope, file_id: FileId, type: GeneratedFileType): Promise<string>;
|
|
242
|
+
/**
|
|
243
|
+
* Gets a generated file raw contents as JSON
|
|
244
|
+
*
|
|
245
|
+
* @param scope Scope the file resides within
|
|
246
|
+
* @param file_id ID of the file to query
|
|
247
|
+
* @param type Type of the generated file
|
|
248
|
+
* @returns The JSON content of the generated file
|
|
249
|
+
*/
|
|
250
|
+
generatedJson(scope: DocumentBoxScope, file_id: FileId, type: GeneratedFileType): Promise<any>;
|
|
251
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { CreateFolder, DocFolderEditHistory, DocumentBoxScope, FolderId, FolderResponse, UpdateFolder } from '../types';
|
|
2
|
+
import { DocboxClient } from './client';
|
|
3
|
+
export declare class FolderService {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: DocboxClient);
|
|
6
|
+
/**
|
|
7
|
+
* Create a new folder
|
|
8
|
+
*
|
|
9
|
+
* @param scope Scope to create the folder within
|
|
10
|
+
* @param data Configuration for creating the folder
|
|
11
|
+
* @returns The created folder
|
|
12
|
+
*/
|
|
13
|
+
create(scope: DocumentBoxScope, data: CreateFolder): Promise<FolderResponse>;
|
|
14
|
+
/**
|
|
15
|
+
* Loads a specific folder
|
|
16
|
+
*
|
|
17
|
+
* @param scope Scope the folder resides within
|
|
18
|
+
* @param folder_id ID of the folder to request
|
|
19
|
+
* @returns The resolved folder
|
|
20
|
+
*/
|
|
21
|
+
get(scope: DocumentBoxScope, folder_id: FolderId): Promise<FolderResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* Update a folder details
|
|
24
|
+
*
|
|
25
|
+
* @param scope Scope the folder resides within
|
|
26
|
+
* @param folder_id ID of the folder to update
|
|
27
|
+
* @param data The folder update data
|
|
28
|
+
*/
|
|
29
|
+
update(scope: DocumentBoxScope, folder_id: FolderId, data: UpdateFolder): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Deletes the provided folder
|
|
32
|
+
*
|
|
33
|
+
* @param scope Scope the folder resides within
|
|
34
|
+
* @param folder_id ID of the folder to delete
|
|
35
|
+
*/
|
|
36
|
+
delete(scope: DocumentBoxScope, folder_id: FolderId): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Load the edit history of a folder
|
|
39
|
+
*
|
|
40
|
+
* @param scope Scope the folder resides within
|
|
41
|
+
* @param folder_id ID of the folder to query
|
|
42
|
+
* @returns The folder edit history
|
|
43
|
+
*/
|
|
44
|
+
editHistory(scope: DocumentBoxScope, folder_id: FolderId): Promise<DocFolderEditHistory[]>;
|
|
45
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { CreateLink, DocumentBoxScope, DocLinkEditHistory, LinkId, LinkMetadata, UpdateLink, DocLink } from '../types';
|
|
2
|
+
import { DocboxClient } from './client';
|
|
3
|
+
export declare class LinkService {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: DocboxClient);
|
|
6
|
+
/**
|
|
7
|
+
* Get a link to the favicon image for the provided link
|
|
8
|
+
*
|
|
9
|
+
* @param scope Scope the link resides within
|
|
10
|
+
* @param id ID of the link to request
|
|
11
|
+
* @returns The favicon image URL
|
|
12
|
+
*/
|
|
13
|
+
faviconURL(scope: string, id: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Get a link to the OGP image for the provided link
|
|
16
|
+
*
|
|
17
|
+
* @param scope Scope the link resides within
|
|
18
|
+
* @param id ID of the link to request
|
|
19
|
+
* @returns The OGP image URL
|
|
20
|
+
*/
|
|
21
|
+
imageURL(scope: string, id: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a new link within the provided document box
|
|
24
|
+
*
|
|
25
|
+
* @param scope Scope to create the link within
|
|
26
|
+
* @param data Link creation data
|
|
27
|
+
* @returns The created link
|
|
28
|
+
*/
|
|
29
|
+
create(scope: DocumentBoxScope, data: CreateLink): Promise<DocLink>;
|
|
30
|
+
/**
|
|
31
|
+
* Request a specific link by ID
|
|
32
|
+
*
|
|
33
|
+
* @param scope Scope the link resides within
|
|
34
|
+
* @param link_id ID of the link to request
|
|
35
|
+
* @returns The requested link
|
|
36
|
+
*/
|
|
37
|
+
get(scope: DocumentBoxScope, link_id: LinkId): Promise<DocLink>;
|
|
38
|
+
/**
|
|
39
|
+
* Requests metadata for the link. This will make a request to the site at
|
|
40
|
+
* the link value to extract metadata from the website itself such as title,
|
|
41
|
+
* and OGP metadata
|
|
42
|
+
*
|
|
43
|
+
* @param scope Scope the link resides within
|
|
44
|
+
* @param link_id ID of the link to request
|
|
45
|
+
* @returns The link website metadata
|
|
46
|
+
*/
|
|
47
|
+
metadata(scope: DocumentBoxScope, link_id: LinkId): Promise<LinkMetadata>;
|
|
48
|
+
/**
|
|
49
|
+
* Get the raw favicon content for a link
|
|
50
|
+
*
|
|
51
|
+
* On node this returns an {@link ArrayBuffer} not a blob
|
|
52
|
+
*
|
|
53
|
+
* @param scope Scope the link resides within
|
|
54
|
+
* @param link_id ID of the link to request
|
|
55
|
+
* @returns The link raw favicon
|
|
56
|
+
*/
|
|
57
|
+
favicon(scope: DocumentBoxScope, link_id: LinkId): Promise<Blob>;
|
|
58
|
+
/**
|
|
59
|
+
* Get the raw favicon content for a link
|
|
60
|
+
*
|
|
61
|
+
* This function is the same as {@link LinkService.favicon} just
|
|
62
|
+
* it has the correct return type for Node and will only return an
|
|
63
|
+
* ArrayBuffer
|
|
64
|
+
*
|
|
65
|
+
* @param scope Scope the link resides within
|
|
66
|
+
* @param link_id ID of the link to request
|
|
67
|
+
* @returns The link raw favicon
|
|
68
|
+
*/
|
|
69
|
+
faviconNode(scope: DocumentBoxScope, link_id: LinkId): Promise<ArrayBuffer>;
|
|
70
|
+
/**
|
|
71
|
+
* Get the raw social image for a link
|
|
72
|
+
*
|
|
73
|
+
* On node this returns an {@link ArrayBuffer} not a blob
|
|
74
|
+
*
|
|
75
|
+
* @param scope Scope the link resides within
|
|
76
|
+
* @param link_id ID of the link to request
|
|
77
|
+
* @returns The link raw social image
|
|
78
|
+
*/
|
|
79
|
+
image(scope: DocumentBoxScope, link_id: LinkId): Promise<Blob>;
|
|
80
|
+
/**
|
|
81
|
+
* Get the raw social image for a link
|
|
82
|
+
*
|
|
83
|
+
* This function is the same as {@link LinkService.image} just
|
|
84
|
+
* it has the correct return type for Node and will only return an
|
|
85
|
+
* ArrayBuffer
|
|
86
|
+
*
|
|
87
|
+
* @param scope Scope the link resides within
|
|
88
|
+
* @param link_id ID of the link to request
|
|
89
|
+
* @returns
|
|
90
|
+
*/
|
|
91
|
+
imageNode(scope: DocumentBoxScope, link_id: LinkId): Promise<ArrayBuffer>;
|
|
92
|
+
/**
|
|
93
|
+
* Get the edit history for a link
|
|
94
|
+
*
|
|
95
|
+
* @param scope Scope the link resides within
|
|
96
|
+
* @param link_id ID of the link to request
|
|
97
|
+
* @returns Edit history for the link
|
|
98
|
+
*/
|
|
99
|
+
editHistory(scope: DocumentBoxScope, link_id: LinkId): Promise<DocLinkEditHistory[]>;
|
|
100
|
+
/**
|
|
101
|
+
* Updates a link
|
|
102
|
+
*
|
|
103
|
+
* @param scope Scope the link resides within
|
|
104
|
+
* @param link_id ID of the link to request
|
|
105
|
+
* @param data The update request
|
|
106
|
+
*/
|
|
107
|
+
update(scope: DocumentBoxScope, link_id: LinkId, data: UpdateLink): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Deletes the provided link
|
|
110
|
+
*
|
|
111
|
+
* @param scope Scope the link resides within
|
|
112
|
+
* @param link_id ID of the link to request
|
|
113
|
+
*/
|
|
114
|
+
delete(scope: DocumentBoxScope, link_id: LinkId): Promise<void>;
|
|
115
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DocboxTask, DocumentBoxScope } from '../types';
|
|
2
|
+
import { DocboxClient } from './client';
|
|
3
|
+
export declare class TaskService {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: DocboxClient);
|
|
6
|
+
/**
|
|
7
|
+
* Get the current status of a specific task
|
|
8
|
+
*
|
|
9
|
+
* @param scope
|
|
10
|
+
* @param task_id
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
get(scope: DocumentBoxScope, task_id: string, abort?: AbortController): Promise<DocboxTask>;
|
|
14
|
+
/**
|
|
15
|
+
* Polls for the completion of a task
|
|
16
|
+
*
|
|
17
|
+
* @param scope
|
|
18
|
+
* @param task_id
|
|
19
|
+
* @param abort
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
finished<T>(scope: DocumentBoxScope, task_id: string, interval?: number, abort?: AbortController): Promise<T>;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sleep(timeout: number): Promise<unknown>;
|
package/dist/error.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create an axios response error interceptor to strip the
|
|
3
|
+
* sensitive internal docbox URL from error responses
|
|
4
|
+
*
|
|
5
|
+
* Also lifts the docbox error messages out of the response
|
|
6
|
+
* body onto the returned error for better HAPI error reporting
|
|
7
|
+
*
|
|
8
|
+
* @param docboxURL URL of the docbox server
|
|
9
|
+
* @returns The request handler
|
|
10
|
+
*/
|
|
11
|
+
export declare function createHandleAxiosError(docboxURL: string): (error: any) => any;
|