@verdocs/js-sdk 1.0.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/LICENSE +21 -0
- package/README.md +39 -0
- package/dist/Api/Auth.d.ts +71 -0
- package/dist/Api/Auth.js +24 -0
- package/dist/Api/Documents.d.ts +124 -0
- package/dist/Api/Documents.js +47 -0
- package/dist/Api/Endpoint.d.ts +2 -0
- package/dist/Api/Endpoint.js +9 -0
- package/dist/Api/Notifications.d.ts +1 -0
- package/dist/Api/Notifications.js +40 -0
- package/dist/Api/Templates.d.ts +33 -0
- package/dist/Api/Templates.js +55 -0
- package/dist/Api/Types.d.ts +182 -0
- package/dist/Api/Types.js +1 -0
- package/dist/Api/index.d.ts +2 -0
- package/dist/Api/index.js +2 -0
- package/dist/AuthManager.d.ts +14 -0
- package/dist/AuthManager.js +53 -0
- package/dist/Documents/Documents.d.ts +129 -0
- package/dist/Documents/Documents.js +52 -0
- package/dist/Documents/Stars.d.ts +2 -0
- package/dist/Documents/Stars.js +40 -0
- package/dist/Documents/Templates.d.ts +4 -0
- package/dist/Documents/Templates.js +46 -0
- package/dist/Documents/Types.d.ts +23 -0
- package/dist/Documents/Types.js +1 -0
- package/dist/Documents/index.d.ts +4 -0
- package/dist/Documents/index.js +4 -0
- package/dist/HTTP/Endpoint.d.ts +4 -0
- package/dist/HTTP/Endpoint.js +12 -0
- package/dist/HTTP/Transport.d.ts +3 -0
- package/dist/HTTP/Transport.js +12 -0
- package/dist/HTTP/Types.d.ts +1 -0
- package/dist/HTTP/Types.js +1 -0
- package/dist/HTTP/index.d.ts +2 -0
- package/dist/HTTP/index.js +2 -0
- package/dist/Organizations/ApiKeys.d.ts +5 -0
- package/dist/Organizations/ApiKeys.js +16 -0
- package/dist/Organizations/Groups.d.ts +7 -0
- package/dist/Organizations/Groups.js +22 -0
- package/dist/Organizations/Invitations.d.ts +7 -0
- package/dist/Organizations/Invitations.js +22 -0
- package/dist/Organizations/Members.d.ts +5 -0
- package/dist/Organizations/Members.js +16 -0
- package/dist/Organizations/Organizations.d.ts +7 -0
- package/dist/Organizations/Organizations.js +13 -0
- package/dist/Organizations/Types.d.ts +16 -0
- package/dist/Organizations/Types.js +1 -0
- package/dist/Organizations/Webhooks.d.ts +2 -0
- package/dist/Organizations/Webhooks.js +7 -0
- package/dist/Organizations/index.d.ts +7 -0
- package/dist/Organizations/index.js +7 -0
- package/dist/Users/Auth.d.ts +79 -0
- package/dist/Users/Auth.js +89 -0
- package/dist/Users/Billing.d.ts +1 -0
- package/dist/Users/Billing.js +2 -0
- package/dist/Users/Notifications.d.ts +1 -0
- package/dist/Users/Notifications.js +40 -0
- package/dist/Users/Profiles.d.ts +104 -0
- package/dist/Users/Profiles.js +114 -0
- package/dist/Users/Types.d.ts +106 -0
- package/dist/Users/Types.js +1 -0
- package/dist/Users/index.d.ts +5 -0
- package/dist/Users/index.js +5 -0
- package/dist/Utils/DateTime.d.ts +1 -0
- package/dist/Utils/DateTime.js +41 -0
- package/dist/Utils/index.d.ts +1 -0
- package/dist/Utils/index.js +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/package.json +52 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
export declare type IEnvelopeStatus = 'complete' | 'pending' | 'progress';
|
|
2
|
+
export declare type IRecipientStatus = 'invited' | 'opened' | 'signed' | 'submitted';
|
|
3
|
+
export declare type IRecipientType = 'signer' | 'cc';
|
|
4
|
+
export declare type IPermission = 'org:view' | 'member:view' | 'org:update' | 'member:add' | 'member:remove' | 'admin:add' | 'admin:remove' | 'org:delete' | 'org:transfer' | 'owner:add' | 'owner:remove' | 'template:creator:create:personal' | 'template:creator:visibility' | 'template:creator:create:org' | 'template:member:read' | 'template:member:write' | 'template:member:visibility' | 'template:creator:delete' | 'template:member:delete' | 'template:creator:create:public' | 'rform:access' | 'rcommon:access' | 'org:list' | 'org:create';
|
|
5
|
+
export declare type IRole = 'owner' | 'basic_user' | 'member';
|
|
6
|
+
export declare type IPlan = 'env:essential' | 'org:standard';
|
|
7
|
+
export interface IDocumentSearchOptions {
|
|
8
|
+
rows?: number;
|
|
9
|
+
page?: number;
|
|
10
|
+
sort_by?: 'updated_at' | 'created_at';
|
|
11
|
+
ascending?: boolean;
|
|
12
|
+
is_owner?: boolean;
|
|
13
|
+
is_recipient?: boolean;
|
|
14
|
+
envelope_status: IEnvelopeStatus[];
|
|
15
|
+
recipient_status: IEnvelopeStatus[];
|
|
16
|
+
}
|
|
17
|
+
export interface IProfile {
|
|
18
|
+
id: string;
|
|
19
|
+
user_id: string;
|
|
20
|
+
organization_id: string;
|
|
21
|
+
first_name: string;
|
|
22
|
+
last_name: string;
|
|
23
|
+
email: string;
|
|
24
|
+
phone: string | null;
|
|
25
|
+
current: boolean;
|
|
26
|
+
organization: {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
address: string | null;
|
|
30
|
+
phone: string | null;
|
|
31
|
+
business_name: string | null;
|
|
32
|
+
is_business: boolean;
|
|
33
|
+
address2: string | null;
|
|
34
|
+
contact_email: string | null;
|
|
35
|
+
timezone: string | null;
|
|
36
|
+
envelope_responsible: boolean;
|
|
37
|
+
};
|
|
38
|
+
permissions?: IPermission[];
|
|
39
|
+
roles?: IRole[];
|
|
40
|
+
plans?: IPlan[];
|
|
41
|
+
}
|
|
42
|
+
export interface IActiveSession {
|
|
43
|
+
sub: string;
|
|
44
|
+
email: string;
|
|
45
|
+
email_verified: boolean;
|
|
46
|
+
iat: number;
|
|
47
|
+
exp: number;
|
|
48
|
+
permissions: IPermission[];
|
|
49
|
+
roles: IRole[];
|
|
50
|
+
plans: IPlan[];
|
|
51
|
+
profile: IProfile;
|
|
52
|
+
profile_id: string;
|
|
53
|
+
organization_id: string;
|
|
54
|
+
}
|
|
55
|
+
export declare type IHistoryEvent = 'recipient:invited' | 'recipient:opened' | 'recipient:agreed' | 'recipient:signed' | 'recipient:submitted';
|
|
56
|
+
export declare type IEventDetail = 'in_app' | 'mail' | 'signer' | '';
|
|
57
|
+
export interface IHistory {
|
|
58
|
+
created_at: string;
|
|
59
|
+
envelope_id: string;
|
|
60
|
+
event: IHistoryEvent;
|
|
61
|
+
event_detail: IEventDetail;
|
|
62
|
+
id: string;
|
|
63
|
+
role_name: string;
|
|
64
|
+
}
|
|
65
|
+
export interface IRecipient {
|
|
66
|
+
agreed: boolean;
|
|
67
|
+
claimed: boolean;
|
|
68
|
+
created_at: string;
|
|
69
|
+
delegated_to: string | null;
|
|
70
|
+
delegator: boolean;
|
|
71
|
+
email: string;
|
|
72
|
+
envelope_id: string;
|
|
73
|
+
full_name: string;
|
|
74
|
+
in_app_access_key: string;
|
|
75
|
+
key_used_to_conclude: string;
|
|
76
|
+
message: string | null;
|
|
77
|
+
phone: string;
|
|
78
|
+
profile_id: string;
|
|
79
|
+
role_name: string;
|
|
80
|
+
sequence: number;
|
|
81
|
+
status: IRecipientStatus;
|
|
82
|
+
type: IRecipientType;
|
|
83
|
+
updated_at: string;
|
|
84
|
+
}
|
|
85
|
+
export interface IDocument {
|
|
86
|
+
id: string;
|
|
87
|
+
created_at: string;
|
|
88
|
+
canceled_at: string;
|
|
89
|
+
envelope_document_id: string;
|
|
90
|
+
certificate_document_id: string | null;
|
|
91
|
+
histories: IHistory[];
|
|
92
|
+
recipients: IRecipient[];
|
|
93
|
+
name: string;
|
|
94
|
+
no_contact: boolean;
|
|
95
|
+
profile_id: string;
|
|
96
|
+
reminder_id: string | null;
|
|
97
|
+
status: IEnvelopeStatus;
|
|
98
|
+
template_id: string;
|
|
99
|
+
updated_at: string;
|
|
100
|
+
}
|
|
101
|
+
export interface IActivityEntry {
|
|
102
|
+
id: string;
|
|
103
|
+
name: string;
|
|
104
|
+
canceled_at: string;
|
|
105
|
+
created_at: string;
|
|
106
|
+
updated_at: string;
|
|
107
|
+
profile_id: string;
|
|
108
|
+
status: IEnvelopeStatus;
|
|
109
|
+
template_id: string;
|
|
110
|
+
recipient: {
|
|
111
|
+
claimed: boolean;
|
|
112
|
+
email: string;
|
|
113
|
+
name: string;
|
|
114
|
+
profile_id: string;
|
|
115
|
+
status: IRecipientStatus;
|
|
116
|
+
type: IRecipientType;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
export interface IDocumentsSummary {
|
|
120
|
+
action_required: {
|
|
121
|
+
page: number;
|
|
122
|
+
total: number;
|
|
123
|
+
result: IActivityEntry[];
|
|
124
|
+
};
|
|
125
|
+
completed: {
|
|
126
|
+
page: number;
|
|
127
|
+
total: number;
|
|
128
|
+
result: IActivityEntry[];
|
|
129
|
+
};
|
|
130
|
+
waiting_others: {
|
|
131
|
+
page: number;
|
|
132
|
+
total: number;
|
|
133
|
+
result: IActivityEntry[];
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
export interface ITemplateSummaryEntry {
|
|
137
|
+
id: string;
|
|
138
|
+
name: string;
|
|
139
|
+
sender: string;
|
|
140
|
+
counter: number;
|
|
141
|
+
description: string | null;
|
|
142
|
+
created_at: string;
|
|
143
|
+
updated_at: string;
|
|
144
|
+
is_personal: boolean;
|
|
145
|
+
is_public: boolean;
|
|
146
|
+
profile_id: string;
|
|
147
|
+
organization_id: string;
|
|
148
|
+
last_used_at: string | null;
|
|
149
|
+
document_name: string | null;
|
|
150
|
+
star_counter: number;
|
|
151
|
+
tag_name: string | null;
|
|
152
|
+
is_starred: boolean;
|
|
153
|
+
}
|
|
154
|
+
export interface ITemplatesSummary {
|
|
155
|
+
page: number;
|
|
156
|
+
total: number;
|
|
157
|
+
result: ITemplateSummaryEntry[];
|
|
158
|
+
}
|
|
159
|
+
export interface IDocumentsSearchResultEntry {
|
|
160
|
+
id: string;
|
|
161
|
+
canceled_at: string;
|
|
162
|
+
created_at: string;
|
|
163
|
+
name: string;
|
|
164
|
+
profile_id: string;
|
|
165
|
+
status: IEnvelopeStatus;
|
|
166
|
+
next_recipient: {
|
|
167
|
+
claimed: boolean;
|
|
168
|
+
email: string;
|
|
169
|
+
name: string;
|
|
170
|
+
profile_id: string;
|
|
171
|
+
status: IRecipientStatus;
|
|
172
|
+
type: IRecipientType;
|
|
173
|
+
};
|
|
174
|
+
template_id: string;
|
|
175
|
+
total_count: number;
|
|
176
|
+
updated_at: string;
|
|
177
|
+
}
|
|
178
|
+
export interface IDocumentsSearchResult {
|
|
179
|
+
page: number;
|
|
180
|
+
total: number;
|
|
181
|
+
result: IDocumentsSearchResultEntry[];
|
|
182
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface IVerdocsUser {
|
|
2
|
+
sub: string;
|
|
3
|
+
firstName: string;
|
|
4
|
+
lastName: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IVerdocsSession {
|
|
7
|
+
valid: boolean;
|
|
8
|
+
expires: number;
|
|
9
|
+
user: IVerdocsUser | null;
|
|
10
|
+
}
|
|
11
|
+
export declare const loadSession: () => Promise<void>;
|
|
12
|
+
export declare const saveSession: (session: any) => Promise<void>;
|
|
13
|
+
export declare const getCurrentUser: () => Promise<null>;
|
|
14
|
+
export declare const refreshSession: () => Promise<void>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (_) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var currentUser = null;
|
|
38
|
+
export var loadSession = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
39
|
+
return [2 /*return*/];
|
|
40
|
+
}); }); };
|
|
41
|
+
export var saveSession = function (session) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
42
|
+
return [2 /*return*/];
|
|
43
|
+
}); }); };
|
|
44
|
+
export var getCurrentUser = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
45
|
+
return __generator(this, function (_a) {
|
|
46
|
+
return [2 /*return*/, currentUser];
|
|
47
|
+
});
|
|
48
|
+
}); };
|
|
49
|
+
export var refreshSession = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
50
|
+
return __generator(this, function (_a) {
|
|
51
|
+
return [2 /*return*/];
|
|
52
|
+
});
|
|
53
|
+
}); };
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
export declare type IDocumentStatus = 'complete' | 'pending' | 'progress';
|
|
2
|
+
export declare type IRecipientStatus = 'invited' | 'opened' | 'signed' | 'submitted';
|
|
3
|
+
export declare type IRecipientType = 'signer' | 'cc';
|
|
4
|
+
export interface IDocumentsSearchResultEntry {
|
|
5
|
+
id: string;
|
|
6
|
+
canceled_at: string;
|
|
7
|
+
created_at: string;
|
|
8
|
+
name: string;
|
|
9
|
+
profile_id: string;
|
|
10
|
+
status: IDocumentStatus;
|
|
11
|
+
next_recipient: {
|
|
12
|
+
claimed: boolean;
|
|
13
|
+
email: string;
|
|
14
|
+
name: string;
|
|
15
|
+
profile_id: string;
|
|
16
|
+
status: IRecipientStatus;
|
|
17
|
+
type: IRecipientType;
|
|
18
|
+
};
|
|
19
|
+
template_id: string;
|
|
20
|
+
total_count: number;
|
|
21
|
+
updated_at: string;
|
|
22
|
+
}
|
|
23
|
+
export interface IDocumentsSearchResult {
|
|
24
|
+
page: number;
|
|
25
|
+
total: number;
|
|
26
|
+
result: IDocumentsSearchResultEntry[];
|
|
27
|
+
}
|
|
28
|
+
export interface IDocumentsSummary {
|
|
29
|
+
action_required: {
|
|
30
|
+
page: number;
|
|
31
|
+
total: number;
|
|
32
|
+
result: IActivityEntry[];
|
|
33
|
+
};
|
|
34
|
+
completed: {
|
|
35
|
+
page: number;
|
|
36
|
+
total: number;
|
|
37
|
+
result: IActivityEntry[];
|
|
38
|
+
};
|
|
39
|
+
waiting_others: {
|
|
40
|
+
page: number;
|
|
41
|
+
total: number;
|
|
42
|
+
result: IActivityEntry[];
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export interface IRecipient {
|
|
46
|
+
agreed: boolean;
|
|
47
|
+
claimed: boolean;
|
|
48
|
+
created_at: string;
|
|
49
|
+
delegated_to: string | null;
|
|
50
|
+
delegator: boolean;
|
|
51
|
+
email: string;
|
|
52
|
+
envelope_id: string;
|
|
53
|
+
full_name: string;
|
|
54
|
+
in_app_access_key: string;
|
|
55
|
+
key_used_to_conclude: string;
|
|
56
|
+
message: string | null;
|
|
57
|
+
phone: string;
|
|
58
|
+
profile_id: string;
|
|
59
|
+
role_name: string;
|
|
60
|
+
sequence: number;
|
|
61
|
+
status: IRecipientStatus;
|
|
62
|
+
type: IRecipientType;
|
|
63
|
+
updated_at: string;
|
|
64
|
+
}
|
|
65
|
+
export interface IDocument {
|
|
66
|
+
id: string;
|
|
67
|
+
created_at: string;
|
|
68
|
+
canceled_at: string;
|
|
69
|
+
envelope_document_id: string;
|
|
70
|
+
certificate_document_id: string | null;
|
|
71
|
+
histories: IHistory[];
|
|
72
|
+
recipients: IRecipient[];
|
|
73
|
+
name: string;
|
|
74
|
+
no_contact: boolean;
|
|
75
|
+
profile_id: string;
|
|
76
|
+
reminder_id: string | null;
|
|
77
|
+
status: IDocumentStatus;
|
|
78
|
+
template_id: string;
|
|
79
|
+
updated_at: string;
|
|
80
|
+
}
|
|
81
|
+
export interface IActivityEntry {
|
|
82
|
+
id: string;
|
|
83
|
+
name: string;
|
|
84
|
+
canceled_at: string;
|
|
85
|
+
created_at: string;
|
|
86
|
+
updated_at: string;
|
|
87
|
+
profile_id: string;
|
|
88
|
+
status: IDocumentStatus;
|
|
89
|
+
template_id: string;
|
|
90
|
+
recipient: {
|
|
91
|
+
claimed: boolean;
|
|
92
|
+
email: string;
|
|
93
|
+
name: string;
|
|
94
|
+
profile_id: string;
|
|
95
|
+
status: IRecipientStatus;
|
|
96
|
+
type: IRecipientType;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export interface IHistory {
|
|
100
|
+
created_at: string;
|
|
101
|
+
envelope_id: string;
|
|
102
|
+
event: IHistoryEvent;
|
|
103
|
+
event_detail: IEventDetail;
|
|
104
|
+
id: string;
|
|
105
|
+
role_name: string;
|
|
106
|
+
}
|
|
107
|
+
export interface IDocumentSearchOptions {
|
|
108
|
+
rows?: number;
|
|
109
|
+
page?: number;
|
|
110
|
+
sort_by?: 'updated_at' | 'created_at';
|
|
111
|
+
ascending?: boolean;
|
|
112
|
+
is_owner?: boolean;
|
|
113
|
+
is_recipient?: boolean;
|
|
114
|
+
envelope_status: IDocumentStatus[];
|
|
115
|
+
recipient_status: IDocumentStatus[];
|
|
116
|
+
}
|
|
117
|
+
export declare type IHistoryEvent = 'recipient:invited' | 'recipient:opened' | 'recipient:agreed' | 'recipient:signed' | 'recipient:submitted';
|
|
118
|
+
export declare type IEventDetail = 'in_app' | 'mail' | 'signer' | '';
|
|
119
|
+
export declare const getSummary: (page: number) => Promise<IDocumentsSummary>;
|
|
120
|
+
/**
|
|
121
|
+
* Search for documents matching various criteria.
|
|
122
|
+
*
|
|
123
|
+
* ```typescript
|
|
124
|
+
* import {Documents} from '@verdocs/js-sdk/Documents';
|
|
125
|
+
*
|
|
126
|
+
* const {result, page, total} = await Documents.search({ ... });
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
export declare const search: (params: any) => Promise<IDocumentsSearchResult>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (_) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { Endpoint } from '../HTTP/Transport';
|
|
38
|
+
export var getSummary = function (page) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
39
|
+
return [2 /*return*/, Endpoint.post('/documents/summary', { page: page }).then(function (r) { return r.data; })];
|
|
40
|
+
}); }); };
|
|
41
|
+
/**
|
|
42
|
+
* Search for documents matching various criteria.
|
|
43
|
+
*
|
|
44
|
+
* ```typescript
|
|
45
|
+
* import {Documents} from '@verdocs/js-sdk/Documents';
|
|
46
|
+
*
|
|
47
|
+
* const {result, page, total} = await Documents.search({ ... });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export var search = function (params) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
51
|
+
return [2 /*return*/, Endpoint.post('/documents/search', params).then(function (r) { return r.data; })];
|
|
52
|
+
}); }); };
|