@docbox-nz/hapi-gateway 0.2.0 → 0.3.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/.github/workflows/build.yml +30 -0
- package/.github/workflows/release.yml +37 -0
- package/.oxfmtrc.json +8 -0
- package/.oxlintrc.json +11 -0
- package/.zed/settings.json +10 -0
- package/README.md +32 -38
- package/cspell.json +1 -4
- package/dist/index.node.cjs +15031 -21882
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.esm.js +15024 -21880
- package/dist/index.node.esm.js.map +1 -1
- package/package.json +44 -55
- package/rolldown.config.js +19 -0
- package/src/index.ts +257 -257
- package/tsconfig.json +15 -15
- package/.eslintignore +0 -6
- package/.eslintrc +0 -131
- package/.prettierignore +0 -11
- package/.prettierrc +0 -6
- package/dist/api/adminService.d.ts +0 -16
- package/dist/api/boxService.d.ts +0 -43
- package/dist/api/client.d.ts +0 -45
- package/dist/api/docboxFile.d.ts +0 -15
- package/dist/api/fileService.d.ts +0 -251
- package/dist/api/folderService.d.ts +0 -45
- package/dist/api/linkService.d.ts +0 -115
- package/dist/api/taskService.d.ts +0 -23
- package/dist/api/utils.d.ts +0 -1
- package/dist/error.d.ts +0 -11
- package/dist/index.browser.cjs +0 -988
- package/dist/index.browser.cjs.map +0 -1
- package/dist/index.browser.esm.js +0 -984
- package/dist/index.browser.esm.js.map +0 -1
- package/dist/index.browser.js +0 -4390
- package/dist/index.browser.js.map +0 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.node.js +0 -20809
- package/dist/index.node.js.map +0 -1
- package/dist/options.d.ts +0 -85
- package/dist/types/box.d.ts +0 -59
- package/dist/types/file.d.ts +0 -371
- package/dist/types/folder.d.ts +0 -153
- package/dist/types/index.d.ts +0 -22
- package/dist/types/link.d.ts +0 -136
- package/dist/types/search.d.ts +0 -177
- package/dist/types/shared.d.ts +0 -94
- package/dist/types/user.d.ts +0 -20
- package/rollup.config.js +0 -36
package/.eslintignore
DELETED
package/.eslintrc
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"root": true,
|
|
3
|
-
"env": {
|
|
4
|
-
"browser": true,
|
|
5
|
-
"es2021": true,
|
|
6
|
-
},
|
|
7
|
-
"plugins": [
|
|
8
|
-
"perfectionist",
|
|
9
|
-
"unused-imports",
|
|
10
|
-
"@typescript-eslint",
|
|
11
|
-
"prettier"
|
|
12
|
-
],
|
|
13
|
-
"extends": [
|
|
14
|
-
"airbnb",
|
|
15
|
-
"airbnb-typescript",
|
|
16
|
-
"airbnb/hooks",
|
|
17
|
-
"prettier"
|
|
18
|
-
],
|
|
19
|
-
"parser": "@typescript-eslint/parser",
|
|
20
|
-
"parserOptions": {
|
|
21
|
-
"ecmaVersion": "latest",
|
|
22
|
-
"sourceType": "module",
|
|
23
|
-
"project": "./tsconfig.json",
|
|
24
|
-
},
|
|
25
|
-
"settings": {
|
|
26
|
-
"import/resolver": {
|
|
27
|
-
"typescript": {
|
|
28
|
-
"alwaysTryTypes": true,
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
"rules": {
|
|
33
|
-
"max-classes-per-file": 10,
|
|
34
|
-
"no-return-await": 0,
|
|
35
|
-
"@typescript-eslint/return-await": 0,
|
|
36
|
-
"no-await-in-loop": 0,
|
|
37
|
-
"no-restricted-syntax": [
|
|
38
|
-
"error",
|
|
39
|
-
"ForInStatement",
|
|
40
|
-
"LabeledStatement",
|
|
41
|
-
"WithStatement"
|
|
42
|
-
],
|
|
43
|
-
"no-alert": 0,
|
|
44
|
-
"camelcase": 0,
|
|
45
|
-
"no-console": 0,
|
|
46
|
-
"no-continue": 0,
|
|
47
|
-
"no-unused-vars": 0,
|
|
48
|
-
"no-param-reassign": 0,
|
|
49
|
-
"no-underscore-dangle": 0,
|
|
50
|
-
"no-restricted-exports": 0,
|
|
51
|
-
"no-promise-executor-return": 0,
|
|
52
|
-
"import/prefer-default-export": 0,
|
|
53
|
-
"@typescript-eslint/naming-convention": 0,
|
|
54
|
-
"jsx-a11y/control-has-associated-label": 0,
|
|
55
|
-
"@typescript-eslint/no-use-before-define": 0,
|
|
56
|
-
"@typescript-eslint/no-shadow": 0,
|
|
57
|
-
"prefer-destructuring": [
|
|
58
|
-
1,
|
|
59
|
-
{
|
|
60
|
-
"object": true,
|
|
61
|
-
"array": false,
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
"@typescript-eslint/no-unused-vars": [
|
|
65
|
-
1,
|
|
66
|
-
{
|
|
67
|
-
"args": "none",
|
|
68
|
-
"argsIgnorePattern": "^_",
|
|
69
|
-
"varsIgnorePattern": "^_",
|
|
70
|
-
"caughtErrorsIgnorePattern": "^_",
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
// unused-imports
|
|
74
|
-
// https://www.npmjs.com/package/eslint-plugin-unused-imports
|
|
75
|
-
"unused-imports/no-unused-imports": 1,
|
|
76
|
-
"unused-imports/no-unused-vars": [
|
|
77
|
-
0,
|
|
78
|
-
{
|
|
79
|
-
"vars": "all",
|
|
80
|
-
"varsIgnorePattern": "^_",
|
|
81
|
-
"args": "after-used",
|
|
82
|
-
"argsIgnorePattern": "^_",
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
// perfectionist
|
|
86
|
-
// https://eslint-plugin-perfectionist.azat.io/
|
|
87
|
-
"perfectionist/sort-named-imports": [
|
|
88
|
-
1,
|
|
89
|
-
{
|
|
90
|
-
"order": "asc",
|
|
91
|
-
"type": "line-length",
|
|
92
|
-
},
|
|
93
|
-
],
|
|
94
|
-
"perfectionist/sort-named-exports": [
|
|
95
|
-
1,
|
|
96
|
-
{
|
|
97
|
-
"order": "asc",
|
|
98
|
-
"type": "line-length",
|
|
99
|
-
},
|
|
100
|
-
],
|
|
101
|
-
"perfectionist/sort-exports": [
|
|
102
|
-
1,
|
|
103
|
-
{
|
|
104
|
-
"order": "asc",
|
|
105
|
-
"type": "line-length",
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
"perfectionist/sort-imports": [
|
|
109
|
-
1,
|
|
110
|
-
{
|
|
111
|
-
"order": "asc",
|
|
112
|
-
"type": "line-length",
|
|
113
|
-
"newlines-between": "always",
|
|
114
|
-
"groups": [
|
|
115
|
-
[
|
|
116
|
-
"builtin",
|
|
117
|
-
"external"
|
|
118
|
-
],
|
|
119
|
-
[
|
|
120
|
-
"parent",
|
|
121
|
-
"sibling",
|
|
122
|
-
"index"
|
|
123
|
-
],
|
|
124
|
-
],
|
|
125
|
-
"internal-pattern": [
|
|
126
|
-
"src/**"
|
|
127
|
-
],
|
|
128
|
-
},
|
|
129
|
-
],
|
|
130
|
-
},
|
|
131
|
-
}
|
package/.prettierignore
DELETED
package/.prettierrc
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { DocboxAdminSearchRequest, DocboxSearchResponseAdmin } from '../types';
|
|
2
|
-
import { DocboxClient } from './client';
|
|
3
|
-
export declare class AdminService {
|
|
4
|
-
private client;
|
|
5
|
-
constructor(client: DocboxClient);
|
|
6
|
-
/**
|
|
7
|
-
* Perform an admin search across multiple document boxes.
|
|
8
|
-
*
|
|
9
|
-
* This function will only work on your server handling authentication
|
|
10
|
-
* you should not allow the frontend to access these endpoints
|
|
11
|
-
*
|
|
12
|
-
* @param data Search request data
|
|
13
|
-
* @returns The search results
|
|
14
|
-
*/
|
|
15
|
-
search(data: DocboxAdminSearchRequest): Promise<DocboxSearchResponseAdmin>;
|
|
16
|
-
}
|
package/dist/api/boxService.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { DocboxSearchRequest, DocboxSearchResponse, DocumentBoxResponse, DocumentBoxScope, DocumentBoxStats } from '../types';
|
|
2
|
-
import { DocboxClient } from './client';
|
|
3
|
-
export declare class BoxService {
|
|
4
|
-
private client;
|
|
5
|
-
constructor(client: DocboxClient);
|
|
6
|
-
/**
|
|
7
|
-
* Get a document box for a scope
|
|
8
|
-
*
|
|
9
|
-
* @param scope Scope of the document box to get
|
|
10
|
-
* @param createIfMissing Whether to create the document box if it doesn't exist
|
|
11
|
-
*/
|
|
12
|
-
get(scope: DocumentBoxScope, createIfMissing?: boolean): Promise<DocumentBoxResponse>;
|
|
13
|
-
/**
|
|
14
|
-
* Creates a new document box optional returning an existing one if there is one available
|
|
15
|
-
*
|
|
16
|
-
* @param scope Scope for the document box to create
|
|
17
|
-
* @param allowExisting Whether to allow returning an existing document box (If one is present)
|
|
18
|
-
* @returns The created document box
|
|
19
|
-
*/
|
|
20
|
-
create(scope: DocumentBoxScope, allowExisting?: boolean): Promise<DocumentBoxResponse>;
|
|
21
|
-
/**
|
|
22
|
-
* Delete a specific document vox
|
|
23
|
-
*
|
|
24
|
-
* @param scope Scope of the document box to delete
|
|
25
|
-
* @returns
|
|
26
|
-
*/
|
|
27
|
-
delete(scope: DocumentBoxScope): Promise<any>;
|
|
28
|
-
/**
|
|
29
|
-
* Search within the provided document box
|
|
30
|
-
*
|
|
31
|
-
* @param scope The scope of the document box to search
|
|
32
|
-
* @param data Search request data
|
|
33
|
-
* @returns The search results
|
|
34
|
-
*/
|
|
35
|
-
search(scope: DocumentBoxScope, data: DocboxSearchRequest): Promise<DocboxSearchResponse>;
|
|
36
|
-
/**
|
|
37
|
-
* Get statistics for the provided document box
|
|
38
|
-
*
|
|
39
|
-
* @param scope The scope of the document box
|
|
40
|
-
* @returns The box stats
|
|
41
|
-
*/
|
|
42
|
-
stats(scope: DocumentBoxScope): Promise<DocumentBoxStats>;
|
|
43
|
-
}
|
package/dist/api/client.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { AxiosRequestConfig, AxiosInstance } from 'axios';
|
|
2
|
-
import { FileService } from './fileService';
|
|
3
|
-
import { BoxService as DocumentBoxService } from './boxService';
|
|
4
|
-
import { LinkService } from './linkService';
|
|
5
|
-
import { FolderService } from './folderService';
|
|
6
|
-
import { TaskService } from './taskService';
|
|
7
|
-
import { AdminService } from './adminService';
|
|
8
|
-
export declare class DocboxClient {
|
|
9
|
-
client: AxiosInstance;
|
|
10
|
-
/**
|
|
11
|
-
* Document box related operations
|
|
12
|
-
*/
|
|
13
|
-
documentBox: DocumentBoxService;
|
|
14
|
-
/**
|
|
15
|
-
* Task related operations
|
|
16
|
-
*/
|
|
17
|
-
task: TaskService;
|
|
18
|
-
/**
|
|
19
|
-
* File related operations
|
|
20
|
-
*/
|
|
21
|
-
file: FileService;
|
|
22
|
-
/**
|
|
23
|
-
* Link related operations
|
|
24
|
-
*/
|
|
25
|
-
link: LinkService;
|
|
26
|
-
/**
|
|
27
|
-
* Folder related operations
|
|
28
|
-
*/
|
|
29
|
-
folder: FolderService;
|
|
30
|
-
/**
|
|
31
|
-
* Admin related operations
|
|
32
|
-
*/
|
|
33
|
-
admin: AdminService;
|
|
34
|
-
/**
|
|
35
|
-
* Creates a new docbox
|
|
36
|
-
*
|
|
37
|
-
* @param client
|
|
38
|
-
*/
|
|
39
|
-
constructor(client: AxiosInstance);
|
|
40
|
-
httpGet<T = any, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<T>;
|
|
41
|
-
httpPost<T = any, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<T>;
|
|
42
|
-
httpPut<T = any, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<T>;
|
|
43
|
-
httpPatch<T = any, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<T>;
|
|
44
|
-
httpDelete<T = any, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<T>;
|
|
45
|
-
}
|
package/dist/api/docboxFile.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { DocFile } from '../types/file';
|
|
2
|
-
declare let FileGlobal: {
|
|
3
|
-
new (fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File;
|
|
4
|
-
prototype: File;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Wrapper around the browser File type to allow using a docbox file
|
|
8
|
-
* in place when handling already uploaded files in a form
|
|
9
|
-
*/
|
|
10
|
-
export declare class DocboxFile extends FileGlobal {
|
|
11
|
-
file: DocFile;
|
|
12
|
-
get size(): number;
|
|
13
|
-
constructor(file: DocFile);
|
|
14
|
-
}
|
|
15
|
-
export {};
|
|
@@ -1,251 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
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
|
-
}
|