@verdocs/js-sdk 3.6.12 → 3.7.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/Organizations/Organizations.d.ts +20 -1
- package/Organizations/Organizations.js +24 -5
- package/VerdocsEndpoint.d.ts +19 -1
- package/VerdocsEndpoint.js +25 -0
- package/package.json +1 -1
|
@@ -5,9 +5,28 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { IOrganization } from './Types';
|
|
7
7
|
import { VerdocsEndpoint } from '../VerdocsEndpoint';
|
|
8
|
+
/**
|
|
9
|
+
* Get a list of organizations the user has access to.
|
|
10
|
+
*/
|
|
8
11
|
export declare const getOrganizations: (endpoint: VerdocsEndpoint) => Promise<IOrganization[]>;
|
|
12
|
+
/**
|
|
13
|
+
* Create an organization.
|
|
14
|
+
*/
|
|
9
15
|
export declare const createOrganization: (endpoint: VerdocsEndpoint) => Promise<IOrganization>;
|
|
10
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Delete an organization.
|
|
18
|
+
*/
|
|
11
19
|
export declare const deleteOrganization: (endpoint: VerdocsEndpoint, organizationId: string) => Promise<any>;
|
|
20
|
+
/**
|
|
21
|
+
* Get an organization by ID.
|
|
22
|
+
*/
|
|
12
23
|
export declare const getOrganization: (endpoint: VerdocsEndpoint, organizationId: string) => Promise<any>;
|
|
24
|
+
/**
|
|
25
|
+
* Update an organization.
|
|
26
|
+
*/
|
|
13
27
|
export declare const updateOrganization: (endpoint: VerdocsEndpoint, organizationId: string, params: any) => Promise<any>;
|
|
28
|
+
/**
|
|
29
|
+
* Check if an organization name is available. Typically used during the sign-up process. This endpoint is rate-limited
|
|
30
|
+
* to prevent abuse. Developers experiencing problems with testing new applications should contact support.
|
|
31
|
+
*/
|
|
32
|
+
export declare const isOrgAvailable: (endpoint: VerdocsEndpoint) => Promise<"OK" | "TAKEN">;
|
|
@@ -3,33 +3,52 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* Get a list of organizations the user has access to.
|
|
8
|
+
*/
|
|
6
9
|
export var getOrganizations = function (endpoint) {
|
|
7
10
|
return endpoint.api //
|
|
8
11
|
.get('/organizations')
|
|
9
12
|
.then(function (r) { return r.data; });
|
|
10
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* Create an organization.
|
|
16
|
+
*/
|
|
11
17
|
export var createOrganization = function (endpoint) {
|
|
12
18
|
return endpoint.api //
|
|
13
19
|
.post('/organizations')
|
|
14
20
|
.then(function (r) { return r.data; });
|
|
15
21
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
.then(function (r) { return r.data; });
|
|
20
|
-
};
|
|
22
|
+
/**
|
|
23
|
+
* Delete an organization.
|
|
24
|
+
*/
|
|
21
25
|
export var deleteOrganization = function (endpoint, organizationId) {
|
|
22
26
|
return endpoint.api //
|
|
23
27
|
.delete("/organizations/".concat(organizationId))
|
|
24
28
|
.then(function (r) { return r.data; });
|
|
25
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* Get an organization by ID.
|
|
32
|
+
*/
|
|
26
33
|
export var getOrganization = function (endpoint, organizationId) {
|
|
27
34
|
return endpoint.api //
|
|
28
35
|
.get("/organizations/".concat(organizationId))
|
|
29
36
|
.then(function (r) { return r.data; });
|
|
30
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* Update an organization.
|
|
40
|
+
*/
|
|
31
41
|
export var updateOrganization = function (endpoint, organizationId, params) {
|
|
32
42
|
return endpoint.api //
|
|
33
43
|
.patch("/organizations/".concat(organizationId), params)
|
|
34
44
|
.then(function (r) { return r.data; });
|
|
35
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Check if an organization name is available. Typically used during the sign-up process. This endpoint is rate-limited
|
|
48
|
+
* to prevent abuse. Developers experiencing problems with testing new applications should contact support.
|
|
49
|
+
*/
|
|
50
|
+
export var isOrgAvailable = function (endpoint) {
|
|
51
|
+
return endpoint.api //
|
|
52
|
+
.get('/organizations/check-availability', { baseURL: endpoint.getBaseURLv2() })
|
|
53
|
+
.then(function (r) { return r.data; });
|
|
54
|
+
};
|
package/VerdocsEndpoint.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export type TEnvironment = 'verdocs' | 'verdocs-stage';
|
|
|
4
4
|
export type TSessionChangedListener = (endpoint: VerdocsEndpoint, session: TSession) => void;
|
|
5
5
|
export interface VerdocsEndpointOptions {
|
|
6
6
|
baseURL?: string;
|
|
7
|
+
baseURLv2?: string;
|
|
7
8
|
timeout?: number;
|
|
8
9
|
environment?: TEnvironment;
|
|
9
10
|
sessionType?: TSessionType;
|
|
@@ -33,7 +34,8 @@ export interface VerdocsEndpointOptions {
|
|
|
33
34
|
export declare class VerdocsEndpoint {
|
|
34
35
|
private environment;
|
|
35
36
|
private sessionType;
|
|
36
|
-
private
|
|
37
|
+
private baseURL;
|
|
38
|
+
private baseURLv2;
|
|
37
39
|
private clientID;
|
|
38
40
|
private timeout;
|
|
39
41
|
private token;
|
|
@@ -70,6 +72,11 @@ export declare class VerdocsEndpoint {
|
|
|
70
72
|
* Get the current base URL. This should rarely be anything other than 'https://api.verdocs.com'.
|
|
71
73
|
*/
|
|
72
74
|
getBaseURL(): string;
|
|
75
|
+
/**
|
|
76
|
+
* Get the current base URL for the v2 APIs.
|
|
77
|
+
* This should rarely be anything other than 'https://api-v2.verdocs.com'.
|
|
78
|
+
*/
|
|
79
|
+
getBaseURLv2(): string;
|
|
73
80
|
/**
|
|
74
81
|
* Get the current client ID, if set.
|
|
75
82
|
*/
|
|
@@ -121,6 +128,17 @@ export declare class VerdocsEndpoint {
|
|
|
121
128
|
* ```
|
|
122
129
|
*/
|
|
123
130
|
setBaseURL(url: string): VerdocsEndpoint;
|
|
131
|
+
/**
|
|
132
|
+
* Set the base URL for API calls. Should be called only upon direction from Verdocs Customer Solutions Engineering.
|
|
133
|
+
*
|
|
134
|
+
* ```typescript
|
|
135
|
+
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
136
|
+
*
|
|
137
|
+
* const endpoint = new VerdocsEndpoint();
|
|
138
|
+
* endpoint.setBaseURL('https://api.verdocs.com');
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
setBaseURLv2(url: string): VerdocsEndpoint;
|
|
124
142
|
/**
|
|
125
143
|
* Set the Client ID for Verdocs API calls.
|
|
126
144
|
*
|
package/VerdocsEndpoint.js
CHANGED
|
@@ -44,6 +44,7 @@ var VerdocsEndpoint = /** @class */ (function () {
|
|
|
44
44
|
this.environment = 'verdocs';
|
|
45
45
|
this.sessionType = 'user';
|
|
46
46
|
this.baseURL = 'https://api.verdocs.com';
|
|
47
|
+
this.baseURLv2 = 'https://api-v2.verdocs.com';
|
|
47
48
|
this.clientID = 'not-set';
|
|
48
49
|
this.timeout = 60000;
|
|
49
50
|
this.token = null;
|
|
@@ -57,6 +58,7 @@ var VerdocsEndpoint = /** @class */ (function () {
|
|
|
57
58
|
*/
|
|
58
59
|
this.session = null;
|
|
59
60
|
this.baseURL = (options === null || options === void 0 ? void 0 : options.baseURL) || 'https://api.verdocs.com';
|
|
61
|
+
this.baseURLv2 = (options === null || options === void 0 ? void 0 : options.baseURLv2) || 'https://api-v2.verdocs.com';
|
|
60
62
|
this.timeout = (options === null || options === void 0 ? void 0 : options.timeout) || 60000;
|
|
61
63
|
this.environment = (options === null || options === void 0 ? void 0 : options.environment) || 'verdocs';
|
|
62
64
|
this.sessionType = (options === null || options === void 0 ? void 0 : options.sessionType) || 'user';
|
|
@@ -99,6 +101,13 @@ var VerdocsEndpoint = /** @class */ (function () {
|
|
|
99
101
|
VerdocsEndpoint.prototype.getBaseURL = function () {
|
|
100
102
|
return this.baseURL;
|
|
101
103
|
};
|
|
104
|
+
/**
|
|
105
|
+
* Get the current base URL for the v2 APIs.
|
|
106
|
+
* This should rarely be anything other than 'https://api-v2.verdocs.com'.
|
|
107
|
+
*/
|
|
108
|
+
VerdocsEndpoint.prototype.getBaseURLv2 = function () {
|
|
109
|
+
return this.baseURLv2;
|
|
110
|
+
};
|
|
102
111
|
/**
|
|
103
112
|
* Get the current client ID, if set.
|
|
104
113
|
*/
|
|
@@ -162,9 +171,25 @@ var VerdocsEndpoint = /** @class */ (function () {
|
|
|
162
171
|
* ```
|
|
163
172
|
*/
|
|
164
173
|
VerdocsEndpoint.prototype.setBaseURL = function (url) {
|
|
174
|
+
this.baseURL = url;
|
|
165
175
|
this.api.defaults.baseURL = url;
|
|
166
176
|
return this;
|
|
167
177
|
};
|
|
178
|
+
/**
|
|
179
|
+
* Set the base URL for API calls. Should be called only upon direction from Verdocs Customer Solutions Engineering.
|
|
180
|
+
*
|
|
181
|
+
* ```typescript
|
|
182
|
+
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
183
|
+
*
|
|
184
|
+
* const endpoint = new VerdocsEndpoint();
|
|
185
|
+
* endpoint.setBaseURL('https://api.verdocs.com');
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
VerdocsEndpoint.prototype.setBaseURLv2 = function (url) {
|
|
189
|
+
this.baseURLv2 = url;
|
|
190
|
+
// NOTE: We do not set this on the Axios instance because v1 is still the standard.
|
|
191
|
+
return this;
|
|
192
|
+
};
|
|
168
193
|
/**
|
|
169
194
|
* Set the Client ID for Verdocs API calls.
|
|
170
195
|
*
|