@verdocs/js-sdk 1.4.0 → 2.0.1

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.
Files changed (72) hide show
  1. package/Documents/Documents.d.ts +26 -9
  2. package/Documents/Documents.js +42 -27
  3. package/Documents/Initials.d.ts +2 -1
  4. package/Documents/Initials.js +3 -4
  5. package/Documents/Recipients.d.ts +5 -1
  6. package/Documents/Recipients.js +6 -4
  7. package/Documents/Signatures.d.ts +14 -4
  8. package/Documents/Signatures.js +21 -13
  9. package/Documents/index.d.ts +0 -1
  10. package/Documents/index.js +0 -1
  11. package/Organizations/ApiKeys.d.ts +6 -5
  12. package/Organizations/ApiKeys.js +15 -16
  13. package/Organizations/Groups.d.ts +8 -7
  14. package/Organizations/Groups.js +21 -22
  15. package/Organizations/Invitations.d.ts +8 -7
  16. package/Organizations/Invitations.js +21 -22
  17. package/Organizations/Members.d.ts +6 -5
  18. package/Organizations/Members.js +15 -16
  19. package/Organizations/Organizations.d.ts +7 -6
  20. package/Organizations/Organizations.js +18 -19
  21. package/Organizations/Webhooks.d.ts +3 -2
  22. package/Organizations/Webhooks.js +6 -7
  23. package/Organizations/Whitelabel.d.ts +3 -2
  24. package/Organizations/Whitelabel.js +6 -7
  25. package/Search/Content.d.ts +4 -3
  26. package/Search/Content.js +9 -10
  27. package/Templates/Fields.d.ts +4 -3
  28. package/Templates/Fields.js +9 -10
  29. package/Templates/Pages.d.ts +5 -4
  30. package/Templates/Pages.js +12 -13
  31. package/Templates/Reminders.d.ts +5 -4
  32. package/Templates/Reminders.js +12 -13
  33. package/Templates/Roles.d.ts +8 -7
  34. package/Templates/Roles.js +21 -22
  35. package/Templates/Stars.d.ts +3 -2
  36. package/Templates/Stars.js +6 -7
  37. package/Templates/Tags.d.ts +7 -6
  38. package/Templates/Tags.js +18 -19
  39. package/Templates/TemplateDocuments.d.ts +5 -4
  40. package/Templates/TemplateDocuments.js +12 -13
  41. package/Templates/Templates.d.ts +7 -6
  42. package/Templates/Templates.js +18 -19
  43. package/Templates/Validators.d.ts +3 -2
  44. package/Templates/Validators.js +7 -10
  45. package/Users/Auth.d.ts +9 -27
  46. package/Users/Auth.js +18 -98
  47. package/Users/Billing.d.ts +1 -1
  48. package/Users/Billing.js +1 -1
  49. package/Users/Notifications.d.ts +2 -1
  50. package/Users/Notifications.js +3 -4
  51. package/Users/Profiles.d.ts +11 -10
  52. package/Users/Profiles.js +30 -31
  53. package/Users/Types.d.ts +1 -1
  54. package/Utils/Token.d.ts +1 -1
  55. package/Utils/Token.js +2 -2
  56. package/{HTTP → Utils}/globalThis.d.ts +0 -0
  57. package/{HTTP → Utils}/globalThis.js +0 -0
  58. package/VerdocsEndpoint.d.ts +193 -0
  59. package/VerdocsEndpoint.js +290 -0
  60. package/index.d.ts +1 -1
  61. package/index.js +1 -1
  62. package/package.json +1 -1
  63. package/Documents/Stars.d.ts +0 -2
  64. package/Documents/Stars.js +0 -40
  65. package/HTTP/Transport.d.ts +0 -34
  66. package/HTTP/Transport.js +0 -47
  67. package/HTTP/Types.d.ts +0 -1
  68. package/HTTP/Types.js +0 -1
  69. package/HTTP/VerdocsEndpoint.d.ts +0 -106
  70. package/HTTP/VerdocsEndpoint.js +0 -141
  71. package/HTTP/index.d.ts +0 -3
  72. package/HTTP/index.js +0 -3
@@ -1,4 +1,5 @@
1
1
  import { ISigningSession, ISigningSessionRequest } from './Types';
2
+ import { VerdocsEndpoint } from '../VerdocsEndpoint';
2
3
  import { IFieldSetting } from '../Templates/Types';
3
4
  export declare type TDocumentStatus = 'complete' | 'pending' | 'in progress' | 'declined' | 'canceled';
4
5
  export declare type TRecipientStatus = 'invited' | 'opened' | 'signed' | 'submitted' | 'canceled' | 'pending' | 'declined';
@@ -153,7 +154,7 @@ export declare type IEventDetail = 'in_app' | 'mail' | 'signer' | '';
153
154
  * const {action_required, completed, waiting_on_others} = await Documents.getSummary();
154
155
  * ```
155
156
  */
156
- export declare const getSummary: (page: number) => Promise<IDocumentsSummary>;
157
+ export declare const getSummary: (endpoint: VerdocsEndpoint, page: number) => Promise<IDocumentsSummary>;
157
158
  /**
158
159
  * Search for documents matching various criteria.
159
160
  *
@@ -163,18 +164,34 @@ export declare const getSummary: (page: number) => Promise<IDocumentsSummary>;
163
164
  * const {result, page, total} = await Documents.search({ ... });
164
165
  * ```
165
166
  */
166
- export declare const searchDocuments: (params: any) => Promise<IDocumentsSearchResult>;
167
+ export declare const searchDocuments: (endpoint: VerdocsEndpoint, params: any) => Promise<IDocumentsSearchResult>;
167
168
  export interface ISigningSessionResult {
168
169
  recipient: IRecipient;
169
170
  session: ISigningSession;
170
171
  signerToken: string;
171
172
  }
172
173
  /**
173
- * Get a signing session for a document.
174
+ * Get a signing session for a Document.
174
175
  */
175
- export declare const getSigningSession: (params: ISigningSessionRequest) => Promise<ISigningSessionResult>;
176
- export declare const getDocumentRecipients: (documentId: string) => Promise<IRecipient[]>;
177
- export declare const getDocument: (documentId: string) => Promise<IDocument>;
178
- export declare const getDocumentFile: (documentId: string, envelopeDocumentId: string) => Promise<string>;
179
- export declare const updateDocumentField: (documentId: string, fieldName: string, value: any) => Promise<IFieldSetting>;
180
- export declare const updateDocumentFieldSignature: (documentId: string, fieldName: string, signatureId: string) => Promise<IFieldSetting>;
176
+ export declare const getSigningSession: (endpoint: VerdocsEndpoint, params: ISigningSessionRequest) => Promise<ISigningSessionResult>;
177
+ /**
178
+ * Get the list of recipients for a Document.
179
+ */
180
+ export declare const getDocumentRecipients: (endpoint: VerdocsEndpoint, documentId: string) => Promise<IRecipient[]>;
181
+ /**
182
+ * Get all metadata for a Document.
183
+ */
184
+ export declare const getDocument: (endpoint: VerdocsEndpoint, documentId: string) => Promise<IDocument>;
185
+ /**
186
+ * Get (binary download) a file attached to a Document.
187
+ */
188
+ export declare const getDocumentFile: (endpoint: VerdocsEndpoint, documentId: string, envelopeDocumentId: string) => Promise<string>;
189
+ /**
190
+ * Update a Document field. Typically called during the signing process as a Recipient fills in fields.
191
+ */
192
+ export declare const updateDocumentField: (endpoint: VerdocsEndpoint, documentId: string, fieldName: string, value: any) => Promise<IFieldSetting>;
193
+ /**
194
+ * Update a Document signature field. Signature fields are ID-driven. Call `Document.createSignature()` first to create a
195
+ * signature for a Recipient, then call `Documents.updateDocumentFieldSignature()` to attach it to a field.
196
+ */
197
+ export declare const updateDocumentFieldSignature: (endpoint: VerdocsEndpoint, documentId: string, fieldName: string, signatureId: string) => Promise<IFieldSetting>;
@@ -34,7 +34,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
34
34
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
35
  }
36
36
  };
37
- import { getEndpoint } from '../HTTP/Transport';
38
37
  import { decodeAccessTokenBody } from '../Utils/Token';
39
38
  /**
40
39
  * Get a summary of currently active documents.
@@ -45,10 +44,10 @@ import { decodeAccessTokenBody } from '../Utils/Token';
45
44
  * const {action_required, completed, waiting_on_others} = await Documents.getSummary();
46
45
  * ```
47
46
  */
48
- export var getSummary = function (page) { return __awaiter(void 0, void 0, void 0, function () {
47
+ export var getSummary = function (endpoint, page) { return __awaiter(void 0, void 0, void 0, function () {
49
48
  return __generator(this, function (_a) {
50
- return [2 /*return*/, getEndpoint()
51
- .api.post('/documents/summary', { page: page })
49
+ return [2 /*return*/, endpoint.api //
50
+ .post('/documents/summary', { page: page })
52
51
  .then(function (r) { return r.data; })];
53
52
  });
54
53
  }); };
@@ -61,64 +60,80 @@ export var getSummary = function (page) { return __awaiter(void 0, void 0, void
61
60
  * const {result, page, total} = await Documents.search({ ... });
62
61
  * ```
63
62
  */
64
- export var searchDocuments = function (params) { return __awaiter(void 0, void 0, void 0, function () {
63
+ export var searchDocuments = function (endpoint, params) { return __awaiter(void 0, void 0, void 0, function () {
65
64
  return __generator(this, function (_a) {
66
- return [2 /*return*/, getEndpoint()
67
- .api.post('/documents/search', params)
65
+ return [2 /*return*/, endpoint.api //
66
+ .post('/documents/search', params)
68
67
  .then(function (r) { return r.data; })];
69
68
  });
70
69
  }); };
71
70
  /**
72
- * Get a signing session for a document.
71
+ * Get a signing session for a Document.
73
72
  */
74
- export var getSigningSession = function (params) { return __awaiter(void 0, void 0, void 0, function () {
73
+ export var getSigningSession = function (endpoint, params) { return __awaiter(void 0, void 0, void 0, function () {
75
74
  return __generator(this, function (_a) {
76
- return [2 /*return*/, getEndpoint()
77
- .api.get("/documents/".concat(params.documentId, "/recipients/").concat(encodeURIComponent(params.roleId), "/invitation/").concat(params.inviteCode))
75
+ return [2 /*return*/, endpoint.api //
76
+ .get("/documents/".concat(params.documentId, "/recipients/").concat(encodeURIComponent(params.roleId), "/invitation/").concat(params.inviteCode))
78
77
  .then(function (r) {
79
78
  var _a, _b;
80
79
  // Avoiding a jsonwebtoken dependency here - we don't actually need the whole library
81
80
  var signerToken = ((_a = r.headers) === null || _a === void 0 ? void 0 : _a.signer_token) || '';
82
81
  var session = decodeAccessTokenBody(signerToken);
83
- getEndpoint().setAuthorization((_b = r.headers) === null || _b === void 0 ? void 0 : _b.signer_token);
82
+ endpoint.setToken((_b = r.headers) === null || _b === void 0 ? void 0 : _b.signer_token);
84
83
  return { recipient: r.data, session: session, signerToken: signerToken };
85
84
  })];
86
85
  });
87
86
  }); };
88
- export var getDocumentRecipients = function (documentId) { return __awaiter(void 0, void 0, void 0, function () {
87
+ /**
88
+ * Get the list of recipients for a Document.
89
+ */
90
+ export var getDocumentRecipients = function (endpoint, documentId) { return __awaiter(void 0, void 0, void 0, function () {
89
91
  return __generator(this, function (_a) {
90
- return [2 /*return*/, getEndpoint()
91
- .api.get("/documents/".concat(documentId, "/recipients"))
92
+ return [2 /*return*/, endpoint.api //
93
+ .get("/documents/".concat(documentId, "/recipients"))
92
94
  .then(function (r) { return r.data; })];
93
95
  });
94
96
  }); };
95
- export var getDocument = function (documentId) { return __awaiter(void 0, void 0, void 0, function () {
97
+ /**
98
+ * Get all metadata for a Document.
99
+ */
100
+ export var getDocument = function (endpoint, documentId) { return __awaiter(void 0, void 0, void 0, function () {
96
101
  return __generator(this, function (_a) {
97
- return [2 /*return*/, getEndpoint()
98
- .api.get("/documents/".concat(documentId))
102
+ return [2 /*return*/, endpoint.api //
103
+ .get("/documents/".concat(documentId))
99
104
  .then(function (r) { return r.data; })];
100
105
  });
101
106
  }); };
102
- export var getDocumentFile = function (documentId, envelopeDocumentId) { return __awaiter(void 0, void 0, void 0, function () {
107
+ /**
108
+ * Get (binary download) a file attached to a Document.
109
+ */
110
+ export var getDocumentFile = function (endpoint, documentId, envelopeDocumentId) { return __awaiter(void 0, void 0, void 0, function () {
103
111
  return __generator(this, function (_a) {
104
- return [2 /*return*/, getEndpoint()
105
- .api.get("/documents/".concat(documentId, "/envelope_documents/").concat(envelopeDocumentId, "?file=true"), {
112
+ return [2 /*return*/, endpoint.api //
113
+ .get("/documents/".concat(documentId, "/envelope_documents/").concat(envelopeDocumentId, "?file=true"), {
106
114
  responseType: 'arraybuffer',
107
115
  })
108
116
  .then(function (r) { return Buffer.from(r.data, 'binary').toString('base64'); })];
109
117
  });
110
118
  }); };
111
- export var updateDocumentField = function (documentId, fieldName, value) { return __awaiter(void 0, void 0, void 0, function () {
119
+ /**
120
+ * Update a Document field. Typically called during the signing process as a Recipient fills in fields.
121
+ */
122
+ export var updateDocumentField = function (endpoint, documentId, fieldName, value) { return __awaiter(void 0, void 0, void 0, function () {
112
123
  return __generator(this, function (_a) {
113
- return [2 /*return*/, getEndpoint()
114
- .api.put("/documents/".concat(documentId, "/fields/").concat(fieldName), value)
124
+ return [2 /*return*/, endpoint.api //
125
+ .put("/documents/".concat(documentId, "/fields/").concat(fieldName), value)
115
126
  .then(function (r) { return r.data; })];
116
127
  });
117
128
  }); };
118
- export var updateDocumentFieldSignature = function (documentId, fieldName, signatureId) { return __awaiter(void 0, void 0, void 0, function () {
129
+ /**
130
+ * Update a Document signature field. Signature fields are ID-driven. Call `Document.createSignature()` first to create a
131
+ * signature for a Recipient, then call `Documents.updateDocumentFieldSignature()` to attach it to a field.
132
+ */
133
+ export var updateDocumentFieldSignature = function (endpoint, documentId, fieldName, signatureId) { return __awaiter(void 0, void 0, void 0, function () {
119
134
  return __generator(this, function (_a) {
120
- return [2 /*return*/, getEndpoint()
121
- .api.put("/documents/".concat(documentId, "/fields/").concat(fieldName, "/signature/").concat(signatureId))
135
+ return [2 /*return*/, endpoint.api //
136
+ .put("/documents/".concat(documentId, "/fields/").concat(fieldName, "/signature/").concat(signatureId))
122
137
  .then(function (r) { return r.data; })];
123
138
  });
124
139
  }); };
@@ -1,3 +1,4 @@
1
+ import { VerdocsEndpoint } from '../VerdocsEndpoint';
1
2
  export interface IInitials {
2
3
  id?: string;
3
4
  profile_id: string;
@@ -11,4 +12,4 @@ export interface IInitials {
11
12
  * create and store an initials block. Thereafter, the ID of the initials block may be re-used for each initials field
12
13
  * to be "stamped" by the user.
13
14
  */
14
- export declare const createInitials: (name: string, initials: string | Blob) => Promise<IInitials>;
15
+ export declare const createInitials: (endpoint: VerdocsEndpoint, name: string, initials: string | Blob) => Promise<IInitials>;
@@ -1,14 +1,13 @@
1
- import { getEndpoint } from '../HTTP/Transport';
2
1
  /**
3
2
  * Create an initials block. In a typical signing workflow, the user is asked at the beginning of the process to "adopt"
4
3
  * an initials block to be used for all initials fields in the document. Thus, this is typically called one time to
5
4
  * create and store an initials block. Thereafter, the ID of the initials block may be re-used for each initials field
6
5
  * to be "stamped" by the user.
7
6
  */
8
- export var createInitials = function (name, initials) {
7
+ export var createInitials = function (endpoint, name, initials) {
9
8
  var data = new FormData();
10
9
  data.append('initial', initials, name);
11
- return getEndpoint()
12
- .api.post("/initials", data)
10
+ return endpoint.api //
11
+ .post("/initials", data)
13
12
  .then(function (r) { return r.data; });
14
13
  };
@@ -1,7 +1,11 @@
1
1
  import { IRecipient } from './Documents';
2
+ import { VerdocsEndpoint } from '../VerdocsEndpoint';
2
3
  export declare type TRecipientAction = 'submit' | 'decline' | 'prepare' | 'update';
3
4
  export interface IUpdateRecipientParams {
4
5
  new_full_name?: string;
5
6
  agreed?: boolean;
6
7
  }
7
- export declare const updateRecipientStatus: (documentId: string, roleName: string, action: TRecipientAction, params?: IUpdateRecipientParams) => Promise<IRecipient>;
8
+ /**
9
+ * Update a recipient's status block
10
+ */
11
+ export declare const updateRecipientStatus: (endpoint: VerdocsEndpoint, documentId: string, roleName: string, action: TRecipientAction, params?: IUpdateRecipientParams) => Promise<IRecipient>;
@@ -45,11 +45,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
46
  }
47
47
  };
48
- import { getEndpoint } from '../HTTP/Transport';
49
- export var updateRecipientStatus = function (documentId, roleName, action, params) { return __awaiter(void 0, void 0, void 0, function () {
48
+ /**
49
+ * Update a recipient's status block
50
+ */
51
+ export var updateRecipientStatus = function (endpoint, documentId, roleName, action, params) { return __awaiter(void 0, void 0, void 0, function () {
50
52
  return __generator(this, function (_a) {
51
- return [2 /*return*/, getEndpoint()
52
- .api.put("/documents/".concat(documentId, "/recipients/").concat(roleName), __assign({ role_name: roleName, action: action }, (params || {})))
53
+ return [2 /*return*/, endpoint.api //
54
+ .put("/documents/".concat(documentId, "/recipients/").concat(roleName), __assign({ role_name: roleName, action: action }, (params || {})))
53
55
  .then(function (r) { return r.data; })];
54
56
  });
55
57
  }); };
@@ -1,3 +1,4 @@
1
+ import { VerdocsEndpoint } from '../VerdocsEndpoint';
1
2
  export interface ISignature {
2
3
  id: string;
3
4
  profile_id: string;
@@ -12,7 +13,16 @@ export interface ISignature {
12
13
  * create and store a signature block. Thereafter, the ID of the signature block may be re-used for each signature field
13
14
  * to be "stamped" by the user.
14
15
  */
15
- export declare const createSignature: (name: string, signature: string | Blob) => Promise<ISignature>;
16
- export declare const getSignatures: () => Promise<ISignature[]>;
17
- export declare const getSignature: (signatureId: string) => Promise<any>;
18
- export declare const deleteSignature: (signatureId: string) => Promise<any>;
16
+ export declare const createSignature: (endpoint: VerdocsEndpoint, name: string, signature: string | Blob) => Promise<ISignature>;
17
+ /**
18
+ * Get the availbable signatures for a user.
19
+ */
20
+ export declare const getSignatures: (endpoint: VerdocsEndpoint) => Promise<ISignature[]>;
21
+ /**
22
+ * Get a user's signature by ID.
23
+ */
24
+ export declare const getSignature: (endpoint: VerdocsEndpoint, signatureId: string) => Promise<any>;
25
+ /**
26
+ * Delete a user's signature.
27
+ */
28
+ export declare const deleteSignature: (endpoint: VerdocsEndpoint, signatureId: string) => Promise<any>;
@@ -1,29 +1,37 @@
1
- import { getEndpoint } from '../HTTP/Transport';
2
1
  /**
3
2
  * Create a signature block. In a typical signing workflow, the user is asked at the beginning of the process to "adopt"
4
3
  * a signature block to be used for all signature fields in the document. Thus, this is typically called one time to
5
4
  * create and store a signature block. Thereafter, the ID of the signature block may be re-used for each signature field
6
5
  * to be "stamped" by the user.
7
6
  */
8
- export var createSignature = function (name, signature) {
7
+ export var createSignature = function (endpoint, name, signature) {
9
8
  var data = new FormData();
10
9
  data.append('signature', signature, name);
11
- return getEndpoint()
12
- .api.post("/signatures", data)
10
+ return endpoint.api //
11
+ .post("/signatures", data)
13
12
  .then(function (r) { return r.data; });
14
13
  };
15
- export var getSignatures = function () {
16
- return getEndpoint()
17
- .api.get('/signatures')
14
+ /**
15
+ * Get the availbable signatures for a user.
16
+ */
17
+ export var getSignatures = function (endpoint) {
18
+ return endpoint.api //
19
+ .get('/signatures')
18
20
  .then(function (r) { return r.data; });
19
21
  };
20
- export var getSignature = function (signatureId) {
21
- return getEndpoint()
22
- .api.get("/signatures/".concat(signatureId))
22
+ /**
23
+ * Get a user's signature by ID.
24
+ */
25
+ export var getSignature = function (endpoint, signatureId) {
26
+ return endpoint.api //
27
+ .get("/signatures/".concat(signatureId))
23
28
  .then(function (r) { return r.data; });
24
29
  };
25
- export var deleteSignature = function (signatureId) {
26
- return getEndpoint()
27
- .api.delete("/signatures/".concat(signatureId))
30
+ /**
31
+ * Delete a user's signature.
32
+ */
33
+ export var deleteSignature = function (endpoint, signatureId) {
34
+ return endpoint.api //
35
+ .delete("/signatures/".concat(signatureId))
28
36
  .then(function (r) { return r.data; });
29
37
  };
@@ -1,6 +1,5 @@
1
1
  export * as Documents from './Documents';
2
2
  export * as Recipients from './Recipients';
3
- export * as Stars from './Stars';
4
3
  export * as Signatures from './Signatures';
5
4
  export * as Initials from './Initials';
6
5
  export * as Types from './Types';
@@ -1,6 +1,5 @@
1
1
  export * as Documents from './Documents';
2
2
  export * as Recipients from './Recipients';
3
- export * as Stars from './Stars';
4
3
  export * as Signatures from './Signatures';
5
4
  export * as Initials from './Initials';
6
5
  export * as Types from './Types';
@@ -11,6 +11,7 @@
11
11
  * @module
12
12
  */
13
13
  import { IApiKey, IApiKeyWithSecret, ICreateApiKeyRequest, IUpdateApiKeyRequest } from './Types';
14
+ import { VerdocsEndpoint } from '../VerdocsEndpoint';
14
15
  /**
15
16
  * Get a list of keys for a given organization. The caller must have admin access to the organization.
16
17
  *
@@ -20,7 +21,7 @@ import { IApiKey, IApiKeyWithSecret, ICreateApiKeyRequest, IUpdateApiKeyRequest
20
21
  * const keys = await ApiKeys.getKeys(ORGID);
21
22
  * ```
22
23
  */
23
- export declare const getKeys: (organizationId: string) => Promise<IApiKey[]>;
24
+ export declare const getKeys: (endpoint: VerdocsEndpoint, organizationId: string) => Promise<IApiKey[]>;
24
25
  /**
25
26
  * Create an API key.
26
27
  *
@@ -30,7 +31,7 @@ export declare const getKeys: (organizationId: string) => Promise<IApiKey[]>;
30
31
  * await ApiKeys.createKey(ORGID, {name: NEWNAME});
31
32
  * ```
32
33
  */
33
- export declare const createKey: (organizationId: string, params: ICreateApiKeyRequest) => Promise<IApiKeyWithSecret>;
34
+ export declare const createKey: (endpoint: VerdocsEndpoint, organizationId: string, params: ICreateApiKeyRequest) => Promise<IApiKeyWithSecret>;
34
35
  /**
35
36
  * Rotate the secret for an API key. The caller must have admin access to the organization.
36
37
  *
@@ -40,7 +41,7 @@ export declare const createKey: (organizationId: string, params: ICreateApiKeyRe
40
41
  * const {client_secret: newSecret} = await ApiKeys.rotateKey(ORGID, CLIENTID);
41
42
  * ```
42
43
  */
43
- export declare const rotateKey: (organizationId: string, clientId: string) => Promise<IApiKeyWithSecret>;
44
+ export declare const rotateKey: (endpoint: VerdocsEndpoint, organizationId: string, clientId: string) => Promise<IApiKeyWithSecret>;
44
45
  /**
45
46
  * Update an API key to change its assigned Profile ID or Name.
46
47
  *
@@ -50,7 +51,7 @@ export declare const rotateKey: (organizationId: string, clientId: string) => Pr
50
51
  * await ApiKeys.updateKey(ORGID, CLIENTID, {name: NEWNAME});
51
52
  * ```
52
53
  */
53
- export declare const updateKey: (organizationId: string, clientId: string, params: IUpdateApiKeyRequest) => Promise<IApiKey>;
54
+ export declare const updateKey: (endpoint: VerdocsEndpoint, organizationId: string, clientId: string, params: IUpdateApiKeyRequest) => Promise<IApiKey>;
54
55
  /**
55
56
  * Delete an API key.
56
57
  *
@@ -60,4 +61,4 @@ export declare const updateKey: (organizationId: string, clientId: string, param
60
61
  * await ApiKeys.deleteKey(ORGID, CLIENTID);
61
62
  * ```
62
63
  */
63
- export declare const deleteKey: (organizationId: string, clientId: string) => Promise<any>;
64
+ export declare const deleteKey: (endpoint: VerdocsEndpoint, organizationId: string, clientId: string) => Promise<any>;
@@ -10,7 +10,6 @@
10
10
  *
11
11
  * @module
12
12
  */
13
- import { getEndpoint } from '../HTTP/Transport';
14
13
  /**
15
14
  * Get a list of keys for a given organization. The caller must have admin access to the organization.
16
15
  *
@@ -20,9 +19,9 @@ import { getEndpoint } from '../HTTP/Transport';
20
19
  * const keys = await ApiKeys.getKeys(ORGID);
21
20
  * ```
22
21
  */
23
- export var getKeys = function (organizationId) {
24
- return getEndpoint()
25
- .api.get("/organizations/".concat(organizationId, "/api_key"))
22
+ export var getKeys = function (endpoint, organizationId) {
23
+ return endpoint.api //
24
+ .get("/organizations/".concat(organizationId, "/api_key"))
26
25
  .then(function (r) { return r.data; });
27
26
  };
28
27
  /**
@@ -34,9 +33,9 @@ export var getKeys = function (organizationId) {
34
33
  * await ApiKeys.createKey(ORGID, {name: NEWNAME});
35
34
  * ```
36
35
  */
37
- export var createKey = function (organizationId, params) {
38
- return getEndpoint()
39
- .api.post("/organizations/".concat(organizationId, "/api_key"), params)
36
+ export var createKey = function (endpoint, organizationId, params) {
37
+ return endpoint.api //
38
+ .post("/organizations/".concat(organizationId, "/api_key"), params)
40
39
  .then(function (r) { return r.data; });
41
40
  };
42
41
  /**
@@ -48,9 +47,9 @@ export var createKey = function (organizationId, params) {
48
47
  * const {client_secret: newSecret} = await ApiKeys.rotateKey(ORGID, CLIENTID);
49
48
  * ```
50
49
  */
51
- export var rotateKey = function (organizationId, clientId) {
52
- return getEndpoint()
53
- .api.put("/organizations/".concat(organizationId, "/api_key/").concat(clientId, "/rotate"))
50
+ export var rotateKey = function (endpoint, organizationId, clientId) {
51
+ return endpoint.api //
52
+ .put("/organizations/".concat(organizationId, "/api_key/").concat(clientId, "/rotate"))
54
53
  .then(function (r) { return r.data; });
55
54
  };
56
55
  /**
@@ -62,9 +61,9 @@ export var rotateKey = function (organizationId, clientId) {
62
61
  * await ApiKeys.updateKey(ORGID, CLIENTID, {name: NEWNAME});
63
62
  * ```
64
63
  */
65
- export var updateKey = function (organizationId, clientId, params) {
66
- return getEndpoint()
67
- .api.patch("/organizations/".concat(organizationId, "/api_key/").concat(clientId), params)
64
+ export var updateKey = function (endpoint, organizationId, clientId, params) {
65
+ return endpoint.api //
66
+ .patch("/organizations/".concat(organizationId, "/api_key/").concat(clientId), params)
68
67
  .then(function (r) { return r.data; });
69
68
  };
70
69
  /**
@@ -76,8 +75,8 @@ export var updateKey = function (organizationId, clientId, params) {
76
75
  * await ApiKeys.deleteKey(ORGID, CLIENTID);
77
76
  * ```
78
77
  */
79
- export var deleteKey = function (organizationId, clientId) {
80
- return getEndpoint()
81
- .api.delete("/organizations/".concat(organizationId, "/api_key/").concat(clientId))
78
+ export var deleteKey = function (endpoint, organizationId, clientId) {
79
+ return endpoint.api //
80
+ .delete("/organizations/".concat(organizationId, "/api_key/").concat(clientId))
82
81
  .then(function (r) { return r.data; });
83
82
  };
@@ -8,6 +8,7 @@
8
8
  * @module
9
9
  */
10
10
  import { IGroup, IGroupDetail } from './Types';
11
+ import { VerdocsEndpoint } from '../VerdocsEndpoint';
11
12
  /**
12
13
  * Get a list of groups for a given organization. The caller must have admin access to the organization.
13
14
  *
@@ -17,7 +18,7 @@ import { IGroup, IGroupDetail } from './Types';
17
18
  * const groups = await Groups.getGroups(ORGID);
18
19
  * ```
19
20
  */
20
- export declare const getGroups: (organizationId: string) => Promise<IGroup[]>;
21
+ export declare const getGroups: (endpoint: VerdocsEndpoint, organizationId: string) => Promise<IGroup[]>;
21
22
  /**
22
23
  * Get the details for a group.
23
24
  *
@@ -27,9 +28,9 @@ export declare const getGroups: (organizationId: string) => Promise<IGroup[]>;
27
28
  * const groups = await Groups.getGroups(ORGID);
28
29
  * ```
29
30
  */
30
- export declare const getGroup: (organizationId: string, groupId: string) => Promise<IGroupDetail>;
31
- export declare const getMembers: (organizationId: string, groupId: string) => Promise<any>;
32
- export declare const addMembers: (organizationId: string, groupId: string, params: any) => Promise<any>;
33
- export declare const deleteMembers: (organizationId: string, groupId: string, params: any) => Promise<any>;
34
- export declare const addPermission: (organizationId: string, groupId: string, permissionId: string, params: any) => Promise<any>;
35
- export declare const deletePermission: (organizationId: string, groupId: string, permissionId: string) => Promise<any>;
31
+ export declare const getGroup: (endpoint: VerdocsEndpoint, organizationId: string, groupId: string) => Promise<IGroupDetail>;
32
+ export declare const getMembers: (endpoint: VerdocsEndpoint, organizationId: string, groupId: string) => Promise<any>;
33
+ export declare const addMembers: (endpoint: VerdocsEndpoint, organizationId: string, groupId: string, params: any) => Promise<any>;
34
+ export declare const deleteMembers: (endpoint: VerdocsEndpoint, organizationId: string, groupId: string, params: any) => Promise<any>;
35
+ export declare const addPermission: (endpoint: VerdocsEndpoint, organizationId: string, groupId: string, permissionId: string, params: any) => Promise<any>;
36
+ export declare const deletePermission: (endpoint: VerdocsEndpoint, organizationId: string, groupId: string, permissionId: string) => Promise<any>;
@@ -7,7 +7,6 @@
7
7
  *
8
8
  * @module
9
9
  */
10
- import { getEndpoint } from '../HTTP/Transport';
11
10
  /**
12
11
  * Get a list of groups for a given organization. The caller must have admin access to the organization.
13
12
  *
@@ -17,9 +16,9 @@ import { getEndpoint } from '../HTTP/Transport';
17
16
  * const groups = await Groups.getGroups(ORGID);
18
17
  * ```
19
18
  */
20
- export var getGroups = function (organizationId) {
21
- return getEndpoint()
22
- .api.get("/organizations/".concat(organizationId, "/groups"))
19
+ export var getGroups = function (endpoint, organizationId) {
20
+ return endpoint.api //
21
+ .get("/organizations/".concat(organizationId, "/groups"))
23
22
  .then(function (r) { return r.data; });
24
23
  };
25
24
  /**
@@ -31,33 +30,33 @@ export var getGroups = function (organizationId) {
31
30
  * const groups = await Groups.getGroups(ORGID);
32
31
  * ```
33
32
  */
34
- export var getGroup = function (organizationId, groupId) {
35
- return getEndpoint()
36
- .api.get("/organizations/".concat(organizationId, "/groups/").concat(groupId))
33
+ export var getGroup = function (endpoint, organizationId, groupId) {
34
+ return endpoint.api //
35
+ .get("/organizations/".concat(organizationId, "/groups/").concat(groupId))
37
36
  .then(function (r) { return r.data; });
38
37
  };
39
- export var getMembers = function (organizationId, groupId) {
40
- return getEndpoint()
41
- .api.get("/organizations/".concat(organizationId, "/groups/").concat(groupId, "/members"))
38
+ export var getMembers = function (endpoint, organizationId, groupId) {
39
+ return endpoint.api //
40
+ .get("/organizations/".concat(organizationId, "/groups/").concat(groupId, "/members"))
42
41
  .then(function (r) { return r.data; });
43
42
  };
44
- export var addMembers = function (organizationId, groupId, params) {
45
- return getEndpoint()
46
- .api.post("/organizations/".concat(organizationId, "/groups/").concat(groupId, "/members"), params)
43
+ export var addMembers = function (endpoint, organizationId, groupId, params) {
44
+ return endpoint.api //
45
+ .post("/organizations/".concat(organizationId, "/groups/").concat(groupId, "/members"), params)
47
46
  .then(function (r) { return r.data; });
48
47
  };
49
- export var deleteMembers = function (organizationId, groupId, params) {
50
- return getEndpoint()
51
- .api.put("/organizations/".concat(organizationId, "/groups/").concat(groupId, "/delete_members"), params)
48
+ export var deleteMembers = function (endpoint, organizationId, groupId, params) {
49
+ return endpoint.api //
50
+ .put("/organizations/".concat(organizationId, "/groups/").concat(groupId, "/delete_members"), params)
52
51
  .then(function (r) { return r.data; });
53
52
  };
54
- export var addPermission = function (organizationId, groupId, permissionId, params) {
55
- return getEndpoint()
56
- .api.post("/organizations/".concat(organizationId, "/groups/").concat(groupId, "/permissions/").concat(permissionId), params)
53
+ export var addPermission = function (endpoint, organizationId, groupId, permissionId, params) {
54
+ return endpoint.api //
55
+ .post("/organizations/".concat(organizationId, "/groups/").concat(groupId, "/permissions/").concat(permissionId), params)
57
56
  .then(function (r) { return r.data; });
58
57
  };
59
- export var deletePermission = function (organizationId, groupId, permissionId) {
60
- return getEndpoint()
61
- .api.delete("/organizations/".concat(organizationId, "/groups/").concat(groupId, "/permissions/").concat(permissionId))
58
+ export var deletePermission = function (endpoint, organizationId, groupId, permissionId) {
59
+ return endpoint.api //
60
+ .delete("/organizations/".concat(organizationId, "/groups/").concat(groupId, "/permissions/").concat(permissionId))
62
61
  .then(function (r) { return r.data; });
63
62
  };
@@ -1,12 +1,13 @@
1
+ import { VerdocsEndpoint } from '../VerdocsEndpoint';
1
2
  /**
2
3
  * An invitation represents an opportunity for a Member to join an Organization.
3
4
  *
4
5
  * @module
5
6
  */
6
- export declare const getInvitations: (organizationId: string) => Promise<any>;
7
- export declare const createInvitation: (organizationId: string, params: any) => Promise<any>;
8
- export declare const deleteInvitation: (organizationId: string, email: string) => Promise<any>;
9
- export declare const updateInvitation: (organizationId: string, email: string, params: any) => Promise<any>;
10
- export declare const resendInvitation: (organizationId: string, email: string) => Promise<any>;
11
- export declare const claimInvitation: (organizationId: string, email: string, params: any) => Promise<any>;
12
- export declare const claimNewUser: (organizationId: string, email: string, token: string) => Promise<any>;
7
+ export declare const getInvitations: (endpoint: VerdocsEndpoint, organizationId: string) => Promise<any>;
8
+ export declare const createInvitation: (endpoint: VerdocsEndpoint, organizationId: string, params: any) => Promise<any>;
9
+ export declare const deleteInvitation: (endpoint: VerdocsEndpoint, organizationId: string, email: string) => Promise<any>;
10
+ export declare const updateInvitation: (endpoint: VerdocsEndpoint, organizationId: string, email: string, params: any) => Promise<any>;
11
+ export declare const resendInvitation: (endpoint: VerdocsEndpoint, organizationId: string, email: string) => Promise<any>;
12
+ export declare const claimInvitation: (endpoint: VerdocsEndpoint, organizationId: string, email: string, params: any) => Promise<any>;
13
+ export declare const claimNewUser: (endpoint: VerdocsEndpoint, organizationId: string, email: string, token: string) => Promise<any>;