@brifle/brifle-sdk 0.0.4 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/api.js +79 -0
- package/dist/cjs/api/api.d.ts +18 -0
- package/dist/cjs/endpoints/v1/accounts.d.ts +15 -0
- package/dist/cjs/endpoints/v1/requests/content.d.ts +19 -1
- package/dist/cjs/endpoints/v1/requests/mailbox.d.ts +2 -0
- package/dist/cjs/endpoints/v1/responses/accounts.d.ts +8 -0
- package/dist/cjs/endpoints/v1/responses/content.d.ts +27 -22
- package/dist/cjs/endpoints/v1/responses/status.d.ts +8 -0
- package/dist/cjs/endpoints/v1/responses/tenant.d.ts +12 -0
- package/dist/cjs/endpoints/v1/status.d.ts +16 -0
- package/dist/cjs/endpoints/v1/tenant.d.ts +19 -0
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.js +125 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/endpoints/v1/accounts.js +32 -0
- package/dist/endpoints/v1/apiResponse.js +64 -0
- package/dist/endpoints/v1/authentication.js +43 -0
- package/dist/endpoints/v1/content.js +95 -0
- package/dist/endpoints/v1/mailbox.js +55 -0
- package/dist/endpoints/v1/requests/authentication.js +1 -0
- package/dist/endpoints/v1/requests/content.js +1 -0
- package/dist/endpoints/v1/requests/mailbox.js +1 -0
- package/dist/endpoints/v1/requests/signatures.js +1 -0
- package/dist/endpoints/v1/responses/accounts.js +1 -0
- package/dist/endpoints/v1/responses/authentication.js +1 -0
- package/dist/endpoints/v1/responses/content.js +1 -0
- package/dist/endpoints/v1/responses/mailbox.js +1 -0
- package/dist/endpoints/v1/responses/signatures.js +1 -0
- package/dist/endpoints/v1/responses/status.js +1 -0
- package/dist/endpoints/v1/responses/tenant.js +1 -0
- package/dist/endpoints/v1/signatures.js +55 -0
- package/dist/endpoints/v1/status.js +27 -0
- package/dist/endpoints/v1/tenant.js +49 -0
- package/dist/esm/api/api.d.ts +18 -0
- package/dist/esm/endpoints/v1/accounts.d.ts +15 -0
- package/dist/esm/endpoints/v1/requests/content.d.ts +19 -1
- package/dist/esm/endpoints/v1/requests/mailbox.d.ts +2 -0
- package/dist/esm/endpoints/v1/responses/accounts.d.ts +8 -0
- package/dist/esm/endpoints/v1/responses/content.d.ts +27 -22
- package/dist/esm/endpoints/v1/responses/status.d.ts +8 -0
- package/dist/esm/endpoints/v1/responses/tenant.d.ts +12 -0
- package/dist/esm/endpoints/v1/status.d.ts +16 -0
- package/dist/esm/endpoints/v1/tenant.d.ts +19 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.mjs +124 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/index.d.ts +132 -23
- package/dist/index.js +18 -0
- package/dist/types/api/api.d.ts +18 -0
- package/dist/types/endpoints/v1/accounts.d.ts +15 -0
- package/dist/types/endpoints/v1/requests/content.d.ts +19 -1
- package/dist/types/endpoints/v1/requests/mailbox.d.ts +2 -0
- package/dist/types/endpoints/v1/responses/accounts.d.ts +8 -0
- package/dist/types/endpoints/v1/responses/content.d.ts +27 -22
- package/dist/types/endpoints/v1/responses/status.d.ts +8 -0
- package/dist/types/endpoints/v1/responses/tenant.d.ts +12 -0
- package/dist/types/endpoints/v1/status.d.ts +16 -0
- package/dist/types/endpoints/v1/tenant.d.ts +19 -0
- package/dist/types/index.d.ts +4 -0
- package/package.json +2 -1
package/dist/esm/index.mjs
CHANGED
|
@@ -305,6 +305,108 @@ class MailboxEndpoints {
|
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
+
class TenantsEndpoints {
|
|
309
|
+
constructor(api) {
|
|
310
|
+
this.VERSION = "v1";
|
|
311
|
+
this.endpoint = api.endpoint;
|
|
312
|
+
this.state = api.apiState;
|
|
313
|
+
}
|
|
314
|
+
getPath(path) {
|
|
315
|
+
return `${this.endpoint}/${this.VERSION}/tenants/${path}`;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Gets a tenant by its ID
|
|
319
|
+
*/
|
|
320
|
+
getById(tenantId) {
|
|
321
|
+
const path = this.getPath(`id/${tenantId}`);
|
|
322
|
+
return axios.get(path, {
|
|
323
|
+
headers: {
|
|
324
|
+
"Authorization": `Bearer ${this.state.auth_token}`,
|
|
325
|
+
"Content-Type": "application/json"
|
|
326
|
+
}
|
|
327
|
+
})
|
|
328
|
+
.then((response) => {
|
|
329
|
+
return ApiResponse.success(response.data);
|
|
330
|
+
})
|
|
331
|
+
.catch((error) => {
|
|
332
|
+
return ApiResponse.errorAxios(error);
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Gets all tenants owned by the account id
|
|
337
|
+
*/
|
|
338
|
+
getMy() {
|
|
339
|
+
const path = this.getPath(`my`);
|
|
340
|
+
return axios.get(path, {
|
|
341
|
+
headers: {
|
|
342
|
+
"Authorization": `Bearer ${this.state.auth_token}`,
|
|
343
|
+
"Content-Type": "application/json"
|
|
344
|
+
}
|
|
345
|
+
})
|
|
346
|
+
.then((response) => {
|
|
347
|
+
return ApiResponse.success(response.data);
|
|
348
|
+
})
|
|
349
|
+
.catch((error) => {
|
|
350
|
+
return ApiResponse.errorAxios(error);
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
class AccountsEndpoints {
|
|
356
|
+
constructor(api) {
|
|
357
|
+
this.VERSION = "v1";
|
|
358
|
+
this.endpoint = api.endpoint;
|
|
359
|
+
this.state = api.apiState;
|
|
360
|
+
}
|
|
361
|
+
getPath(path) {
|
|
362
|
+
return `${this.endpoint}/${this.VERSION}/accounts/${path}`;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Gets a tenant by its ID
|
|
366
|
+
*/
|
|
367
|
+
getById(accountId) {
|
|
368
|
+
const path = this.getPath(`${accountId}`);
|
|
369
|
+
console.log(path, path);
|
|
370
|
+
return axios.get(path, {
|
|
371
|
+
headers: {
|
|
372
|
+
"Authorization": `Bearer ${this.state.auth_token}`,
|
|
373
|
+
"Content-Type": "application/json"
|
|
374
|
+
}
|
|
375
|
+
})
|
|
376
|
+
.then((response) => {
|
|
377
|
+
return ApiResponse.success(response.data);
|
|
378
|
+
})
|
|
379
|
+
.catch((error) => {
|
|
380
|
+
return ApiResponse.errorAxios(error);
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
class StatusEndpoint {
|
|
386
|
+
constructor(api) {
|
|
387
|
+
this.VERSION = "v1";
|
|
388
|
+
this.endpoint = api.endpoint;
|
|
389
|
+
this.state = api.apiState;
|
|
390
|
+
}
|
|
391
|
+
getPath(path) {
|
|
392
|
+
return `${this.endpoint}/${this.VERSION}/status/${path}`;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
*
|
|
396
|
+
* @returns the
|
|
397
|
+
*/
|
|
398
|
+
getStatus() {
|
|
399
|
+
const path = this.getPath("");
|
|
400
|
+
return axios.get(path)
|
|
401
|
+
.then((response) => {
|
|
402
|
+
return ApiResponse.success(response.data);
|
|
403
|
+
})
|
|
404
|
+
.catch((error) => {
|
|
405
|
+
return ApiResponse.errorAxios(error);
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
308
410
|
var ENDPOINTS;
|
|
309
411
|
(function (ENDPOINTS) {
|
|
310
412
|
ENDPOINTS["SANDBOX"] = "https://sandbox-api.brifle.de";
|
|
@@ -347,6 +449,20 @@ class ApiV1 {
|
|
|
347
449
|
signature() {
|
|
348
450
|
return new SignaturesEndpoint(this);
|
|
349
451
|
}
|
|
452
|
+
/**
|
|
453
|
+
* gets an instance of the TenantsEndpoints
|
|
454
|
+
* @returns TenantsEndpoints
|
|
455
|
+
*/
|
|
456
|
+
tenants() {
|
|
457
|
+
return new TenantsEndpoints(this);
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* gets an instance of the AccountsEndpoints
|
|
461
|
+
* @returns AccountsEndpoints
|
|
462
|
+
*/
|
|
463
|
+
accounts() {
|
|
464
|
+
return new AccountsEndpoints(this);
|
|
465
|
+
}
|
|
350
466
|
/**
|
|
351
467
|
* gets an instance of the MailboxEndpoints
|
|
352
468
|
* @returns MailboxEndpoints
|
|
@@ -354,7 +470,14 @@ class ApiV1 {
|
|
|
354
470
|
mailbox() {
|
|
355
471
|
return new MailboxEndpoints(this);
|
|
356
472
|
}
|
|
473
|
+
/**
|
|
474
|
+
* gets an instance of the StatusEndpoint
|
|
475
|
+
* @returns StatusEndpoint
|
|
476
|
+
*/
|
|
477
|
+
status() {
|
|
478
|
+
return new StatusEndpoint(this);
|
|
479
|
+
}
|
|
357
480
|
}
|
|
358
481
|
|
|
359
|
-
export { ApiResponse, ApiV1, AuthenticationEndpoints, ContentEndpoints, MailboxEndpoints, SignaturesEndpoint };
|
|
482
|
+
export { AccountsEndpoints, ApiResponse, ApiV1, AuthenticationEndpoints, ContentEndpoints, MailboxEndpoints, SignaturesEndpoint, TenantsEndpoints };
|
|
360
483
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -99,14 +99,16 @@ interface ContentMeta {
|
|
|
99
99
|
size: number;
|
|
100
100
|
subject: string;
|
|
101
101
|
type: string;
|
|
102
|
+
size_responsive?: number;
|
|
102
103
|
}
|
|
103
104
|
interface ContentResponse {
|
|
104
|
-
content:
|
|
105
|
-
content: string;
|
|
106
|
-
type: string;
|
|
107
|
-
};
|
|
105
|
+
content: Content[];
|
|
108
106
|
meta: ContentMeta;
|
|
109
107
|
}
|
|
108
|
+
interface Content {
|
|
109
|
+
content: string;
|
|
110
|
+
type: string;
|
|
111
|
+
}
|
|
110
112
|
interface ContentActionsPaymentResponse {
|
|
111
113
|
details: {
|
|
112
114
|
amount: number;
|
|
@@ -119,31 +121,34 @@ interface ContentActionsPaymentResponse {
|
|
|
119
121
|
};
|
|
120
122
|
link: string;
|
|
121
123
|
}
|
|
124
|
+
interface EmbbededSignatureResponse {
|
|
125
|
+
id: string;
|
|
126
|
+
created_by: string;
|
|
127
|
+
created_date: string;
|
|
128
|
+
document_signature_id: string;
|
|
129
|
+
due_date: string;
|
|
130
|
+
field_name: string;
|
|
131
|
+
history?: string;
|
|
132
|
+
purpose: string;
|
|
133
|
+
request_date: string;
|
|
134
|
+
requested_to: string;
|
|
135
|
+
signature_date: string;
|
|
136
|
+
signed_by: string;
|
|
137
|
+
signed_for: string;
|
|
138
|
+
value: string;
|
|
139
|
+
status: 'pending' | 'signed' | 'rejected';
|
|
140
|
+
}
|
|
122
141
|
interface ContentActionsSignatureResponse {
|
|
123
142
|
document_signatures: {
|
|
124
143
|
signature_ids: string[];
|
|
125
144
|
signature_reference: string;
|
|
126
145
|
};
|
|
127
|
-
embedded_signatures:
|
|
128
|
-
created_by: string;
|
|
129
|
-
created_date: string;
|
|
130
|
-
document_signature_id: string;
|
|
131
|
-
due_date: string;
|
|
132
|
-
field_name: string;
|
|
133
|
-
history?: string;
|
|
134
|
-
purpose: string;
|
|
135
|
-
request_date: string;
|
|
136
|
-
requested_to: string;
|
|
137
|
-
signature_date: string;
|
|
138
|
-
signed_by: string;
|
|
139
|
-
signed_for: string;
|
|
140
|
-
value: string;
|
|
141
|
-
}[];
|
|
146
|
+
embedded_signatures: EmbbededSignatureResponse[];
|
|
142
147
|
signature_reference: string;
|
|
143
148
|
}
|
|
144
149
|
interface ContentActionsResponse {
|
|
145
|
-
payments: ContentActionsPaymentResponse
|
|
146
|
-
signatures: ContentActionsSignatureResponse
|
|
150
|
+
payments: ContentActionsPaymentResponse;
|
|
151
|
+
signatures: ContentActionsSignatureResponse;
|
|
147
152
|
}
|
|
148
153
|
|
|
149
154
|
interface ReceiverRequest {
|
|
@@ -183,6 +188,7 @@ interface SendContentRequest {
|
|
|
183
188
|
type: 'application/pdf';
|
|
184
189
|
content: string;
|
|
185
190
|
}[];
|
|
191
|
+
fallback?: FallbackOptions;
|
|
186
192
|
payment_info?: {
|
|
187
193
|
details?: PaymentDetails;
|
|
188
194
|
payable: boolean;
|
|
@@ -195,6 +201,23 @@ interface SendContentRequest {
|
|
|
195
201
|
}[];
|
|
196
202
|
};
|
|
197
203
|
}
|
|
204
|
+
interface FallbackOptions {
|
|
205
|
+
enabled_physical_delivery: boolean;
|
|
206
|
+
paper_mail: {
|
|
207
|
+
recipient: {
|
|
208
|
+
address_line1: string;
|
|
209
|
+
address_line2?: string;
|
|
210
|
+
address_line3?: string;
|
|
211
|
+
postal_code: string;
|
|
212
|
+
city: string;
|
|
213
|
+
country: string;
|
|
214
|
+
};
|
|
215
|
+
test_mode: {
|
|
216
|
+
email: string;
|
|
217
|
+
enabled: boolean;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
}
|
|
198
221
|
|
|
199
222
|
declare class ContentEndpoints {
|
|
200
223
|
private endpoint;
|
|
@@ -286,6 +309,8 @@ interface InboxFilter {
|
|
|
286
309
|
}
|
|
287
310
|
interface OutboxFilter {
|
|
288
311
|
state?: Array<'active' | 'trashed'>;
|
|
312
|
+
subject?: string;
|
|
313
|
+
type?: 'letter' | 'invoice' | 'contract';
|
|
289
314
|
}
|
|
290
315
|
|
|
291
316
|
interface MailboxResponse {
|
|
@@ -323,6 +348,75 @@ declare class MailboxEndpoints {
|
|
|
323
348
|
getOutbox(tenant: string, filter: OutboxFilter, page?: number): Promise<ApiResponse<MailboxResponse>>;
|
|
324
349
|
}
|
|
325
350
|
|
|
351
|
+
interface Tenant {
|
|
352
|
+
account_id: string;
|
|
353
|
+
name: string;
|
|
354
|
+
image?: string;
|
|
355
|
+
private: boolean;
|
|
356
|
+
id: string;
|
|
357
|
+
}
|
|
358
|
+
interface TenantsResponse {
|
|
359
|
+
total: number;
|
|
360
|
+
tenants: Tenant[];
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
declare class TenantsEndpoints {
|
|
364
|
+
private endpoint;
|
|
365
|
+
private readonly VERSION;
|
|
366
|
+
private state;
|
|
367
|
+
constructor(api: ApiV1);
|
|
368
|
+
private getPath;
|
|
369
|
+
/**
|
|
370
|
+
* Gets a tenant by its ID
|
|
371
|
+
*/
|
|
372
|
+
getById(tenantId: string): Promise<ApiResponse<Tenant>>;
|
|
373
|
+
/**
|
|
374
|
+
* Gets all tenants owned by the account id
|
|
375
|
+
*/
|
|
376
|
+
getMy(): Promise<ApiResponse<TenantsResponse>>;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
interface AccountInfo {
|
|
380
|
+
company_name: string;
|
|
381
|
+
first_name: string;
|
|
382
|
+
last_name: string;
|
|
383
|
+
middle_name: string;
|
|
384
|
+
type: 'private' | 'business';
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
declare class AccountsEndpoints {
|
|
388
|
+
private endpoint;
|
|
389
|
+
private readonly VERSION;
|
|
390
|
+
private state;
|
|
391
|
+
constructor(api: ApiV1);
|
|
392
|
+
private getPath;
|
|
393
|
+
/**
|
|
394
|
+
* Gets a tenant by its ID
|
|
395
|
+
*/
|
|
396
|
+
getById(accountId: string): Promise<ApiResponse<AccountInfo>>;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
interface StatusResponse {
|
|
400
|
+
status: string;
|
|
401
|
+
timestamp: string;
|
|
402
|
+
version: string;
|
|
403
|
+
service: string;
|
|
404
|
+
features: string[];
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
declare class StatusEndpoint {
|
|
408
|
+
private endpoint;
|
|
409
|
+
private readonly VERSION;
|
|
410
|
+
private state;
|
|
411
|
+
constructor(api: ApiV1);
|
|
412
|
+
private getPath;
|
|
413
|
+
/**
|
|
414
|
+
*
|
|
415
|
+
* @returns the
|
|
416
|
+
*/
|
|
417
|
+
getStatus(): Promise<ApiResponse<StatusResponse>>;
|
|
418
|
+
}
|
|
419
|
+
|
|
326
420
|
declare class ApiV1 {
|
|
327
421
|
readonly endpoint: string;
|
|
328
422
|
readonly apiState: ApiV1State;
|
|
@@ -344,16 +438,31 @@ declare class ApiV1 {
|
|
|
344
438
|
* @returns ContentEndpoints
|
|
345
439
|
*/
|
|
346
440
|
signature(): SignaturesEndpoint;
|
|
441
|
+
/**
|
|
442
|
+
* gets an instance of the TenantsEndpoints
|
|
443
|
+
* @returns TenantsEndpoints
|
|
444
|
+
*/
|
|
445
|
+
tenants(): TenantsEndpoints;
|
|
446
|
+
/**
|
|
447
|
+
* gets an instance of the AccountsEndpoints
|
|
448
|
+
* @returns AccountsEndpoints
|
|
449
|
+
*/
|
|
450
|
+
accounts(): AccountsEndpoints;
|
|
347
451
|
/**
|
|
348
452
|
* gets an instance of the MailboxEndpoints
|
|
349
453
|
* @returns MailboxEndpoints
|
|
350
454
|
*/
|
|
351
455
|
mailbox(): MailboxEndpoints;
|
|
456
|
+
/**
|
|
457
|
+
* gets an instance of the StatusEndpoint
|
|
458
|
+
* @returns StatusEndpoint
|
|
459
|
+
*/
|
|
460
|
+
status(): StatusEndpoint;
|
|
352
461
|
}
|
|
353
462
|
interface ApiV1State {
|
|
354
463
|
auth_token?: string;
|
|
355
464
|
auth_token_expire_date?: Date;
|
|
356
465
|
}
|
|
357
466
|
|
|
358
|
-
export { ApiResponse, ApiV1, AuthenticationEndpoints, ContentEndpoints, MailboxEndpoints, SignaturesEndpoint };
|
|
359
|
-
export type { ApiV1State, BirthInformation, CheckReceiverResponse, ContentActionsResponse, ContentMeta, ContentResponse, CreateSignatureReferenceRequest, CreateSignatureReferenceResponse, ErrorResponse, InboxFilter, LoginRequest, LoginResponse, LogoutRequest, MailboxResponse, Meta, OutboxFilter, PaymentDetails, ReceiverRequest, SendContentRequest, SendContentResponse };
|
|
467
|
+
export { AccountsEndpoints, ApiResponse, ApiV1, AuthenticationEndpoints, ContentEndpoints, MailboxEndpoints, SignaturesEndpoint, TenantsEndpoints };
|
|
468
|
+
export type { AccountInfo, ApiV1State, BirthInformation, CheckReceiverResponse, Content, ContentActionsPaymentResponse, ContentActionsResponse, ContentActionsSignatureResponse, ContentMeta, ContentResponse, CreateSignatureReferenceRequest, CreateSignatureReferenceResponse, EmbbededSignatureResponse, ErrorResponse, FallbackOptions, InboxFilter, LoginRequest, LoginResponse, LogoutRequest, MailboxResponse, Meta, OutboxFilter, PaymentDetails, ReceiverRequest, SendContentRequest, SendContentResponse, Tenant, TenantsResponse };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from "./api/api";
|
|
2
|
+
export * from "./endpoints/v1/requests/authentication";
|
|
3
|
+
export * from "./endpoints/v1/responses/authentication";
|
|
4
|
+
export * from "./endpoints/v1/requests/content";
|
|
5
|
+
export * from "./endpoints/v1/responses/content";
|
|
6
|
+
export * from "./endpoints/v1/requests/signatures";
|
|
7
|
+
export * from "./endpoints/v1/responses/signatures";
|
|
8
|
+
export * from "./endpoints/v1/apiResponse";
|
|
9
|
+
export * from "./endpoints/v1/authentication";
|
|
10
|
+
export * from "./endpoints/v1/content";
|
|
11
|
+
export * from "./endpoints/v1/signatures";
|
|
12
|
+
export * from "./endpoints/v1/mailbox";
|
|
13
|
+
export * from "./endpoints/v1/requests/mailbox";
|
|
14
|
+
export * from "./endpoints/v1/responses/mailbox";
|
|
15
|
+
export * from "./endpoints/v1/tenant";
|
|
16
|
+
export * from "./endpoints/v1/responses/tenant";
|
|
17
|
+
export * from "./endpoints/v1/accounts";
|
|
18
|
+
export * from "./endpoints/v1/responses/accounts";
|
package/dist/types/api/api.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { AuthenticationEndpoints } from "../endpoints/v1/authentication";
|
|
|
2
2
|
import { ContentEndpoints } from "../endpoints/v1/content";
|
|
3
3
|
import { SignaturesEndpoint } from "../endpoints/v1/signatures";
|
|
4
4
|
import { MailboxEndpoints } from "../endpoints/v1/mailbox";
|
|
5
|
+
import { TenantsEndpoints } from "../endpoints/v1/tenant";
|
|
6
|
+
import { AccountsEndpoints } from "../endpoints/v1/accounts";
|
|
7
|
+
import { StatusEndpoint } from "../endpoints/v1/status";
|
|
5
8
|
declare class ApiV1 {
|
|
6
9
|
readonly endpoint: string;
|
|
7
10
|
readonly apiState: ApiV1State;
|
|
@@ -23,11 +26,26 @@ declare class ApiV1 {
|
|
|
23
26
|
* @returns ContentEndpoints
|
|
24
27
|
*/
|
|
25
28
|
signature(): SignaturesEndpoint;
|
|
29
|
+
/**
|
|
30
|
+
* gets an instance of the TenantsEndpoints
|
|
31
|
+
* @returns TenantsEndpoints
|
|
32
|
+
*/
|
|
33
|
+
tenants(): TenantsEndpoints;
|
|
34
|
+
/**
|
|
35
|
+
* gets an instance of the AccountsEndpoints
|
|
36
|
+
* @returns AccountsEndpoints
|
|
37
|
+
*/
|
|
38
|
+
accounts(): AccountsEndpoints;
|
|
26
39
|
/**
|
|
27
40
|
* gets an instance of the MailboxEndpoints
|
|
28
41
|
* @returns MailboxEndpoints
|
|
29
42
|
*/
|
|
30
43
|
mailbox(): MailboxEndpoints;
|
|
44
|
+
/**
|
|
45
|
+
* gets an instance of the StatusEndpoint
|
|
46
|
+
* @returns StatusEndpoint
|
|
47
|
+
*/
|
|
48
|
+
status(): StatusEndpoint;
|
|
31
49
|
}
|
|
32
50
|
export interface ApiV1State {
|
|
33
51
|
auth_token?: string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ApiV1 } from "../../api/api";
|
|
2
|
+
import { AccountInfo } from "./responses/accounts";
|
|
3
|
+
import { ApiResponse } from "./apiResponse";
|
|
4
|
+
declare class AccountsEndpoints {
|
|
5
|
+
private endpoint;
|
|
6
|
+
private readonly VERSION;
|
|
7
|
+
private state;
|
|
8
|
+
constructor(api: ApiV1);
|
|
9
|
+
private getPath;
|
|
10
|
+
/**
|
|
11
|
+
* Gets a tenant by its ID
|
|
12
|
+
*/
|
|
13
|
+
getById(accountId: string): Promise<ApiResponse<AccountInfo>>;
|
|
14
|
+
}
|
|
15
|
+
export { AccountsEndpoints };
|
|
@@ -35,6 +35,7 @@ interface SendContentRequest {
|
|
|
35
35
|
type: 'application/pdf';
|
|
36
36
|
content: string;
|
|
37
37
|
}[];
|
|
38
|
+
fallback?: FallbackOptions;
|
|
38
39
|
payment_info?: {
|
|
39
40
|
details?: PaymentDetails;
|
|
40
41
|
payable: boolean;
|
|
@@ -47,4 +48,21 @@ interface SendContentRequest {
|
|
|
47
48
|
}[];
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
|
-
|
|
51
|
+
interface FallbackOptions {
|
|
52
|
+
enabled_physical_delivery: boolean;
|
|
53
|
+
paper_mail: {
|
|
54
|
+
recipient: {
|
|
55
|
+
address_line1: string;
|
|
56
|
+
address_line2?: string;
|
|
57
|
+
address_line3?: string;
|
|
58
|
+
postal_code: string;
|
|
59
|
+
city: string;
|
|
60
|
+
country: string;
|
|
61
|
+
};
|
|
62
|
+
test_mode: {
|
|
63
|
+
email: string;
|
|
64
|
+
enabled: boolean;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export type { SendContentRequest, ReceiverRequest, BirthInformation, PaymentDetails, FallbackOptions };
|
|
@@ -19,14 +19,16 @@ interface ContentMeta {
|
|
|
19
19
|
size: number;
|
|
20
20
|
subject: string;
|
|
21
21
|
type: string;
|
|
22
|
+
size_responsive?: number;
|
|
22
23
|
}
|
|
23
24
|
interface ContentResponse {
|
|
24
|
-
content:
|
|
25
|
-
content: string;
|
|
26
|
-
type: string;
|
|
27
|
-
};
|
|
25
|
+
content: Content[];
|
|
28
26
|
meta: ContentMeta;
|
|
29
27
|
}
|
|
28
|
+
interface Content {
|
|
29
|
+
content: string;
|
|
30
|
+
type: string;
|
|
31
|
+
}
|
|
30
32
|
interface ContentActionsPaymentResponse {
|
|
31
33
|
details: {
|
|
32
34
|
amount: number;
|
|
@@ -39,30 +41,33 @@ interface ContentActionsPaymentResponse {
|
|
|
39
41
|
};
|
|
40
42
|
link: string;
|
|
41
43
|
}
|
|
44
|
+
interface EmbbededSignatureResponse {
|
|
45
|
+
id: string;
|
|
46
|
+
created_by: string;
|
|
47
|
+
created_date: string;
|
|
48
|
+
document_signature_id: string;
|
|
49
|
+
due_date: string;
|
|
50
|
+
field_name: string;
|
|
51
|
+
history?: string;
|
|
52
|
+
purpose: string;
|
|
53
|
+
request_date: string;
|
|
54
|
+
requested_to: string;
|
|
55
|
+
signature_date: string;
|
|
56
|
+
signed_by: string;
|
|
57
|
+
signed_for: string;
|
|
58
|
+
value: string;
|
|
59
|
+
status: 'pending' | 'signed' | 'rejected';
|
|
60
|
+
}
|
|
42
61
|
interface ContentActionsSignatureResponse {
|
|
43
62
|
document_signatures: {
|
|
44
63
|
signature_ids: string[];
|
|
45
64
|
signature_reference: string;
|
|
46
65
|
};
|
|
47
|
-
embedded_signatures:
|
|
48
|
-
created_by: string;
|
|
49
|
-
created_date: string;
|
|
50
|
-
document_signature_id: string;
|
|
51
|
-
due_date: string;
|
|
52
|
-
field_name: string;
|
|
53
|
-
history?: string;
|
|
54
|
-
purpose: string;
|
|
55
|
-
request_date: string;
|
|
56
|
-
requested_to: string;
|
|
57
|
-
signature_date: string;
|
|
58
|
-
signed_by: string;
|
|
59
|
-
signed_for: string;
|
|
60
|
-
value: string;
|
|
61
|
-
}[];
|
|
66
|
+
embedded_signatures: EmbbededSignatureResponse[];
|
|
62
67
|
signature_reference: string;
|
|
63
68
|
}
|
|
64
69
|
interface ContentActionsResponse {
|
|
65
|
-
payments: ContentActionsPaymentResponse
|
|
66
|
-
signatures: ContentActionsSignatureResponse
|
|
70
|
+
payments: ContentActionsPaymentResponse;
|
|
71
|
+
signatures: ContentActionsSignatureResponse;
|
|
67
72
|
}
|
|
68
|
-
export type { SendContentResponse, CheckReceiverResponse, ContentMeta, ContentResponse, ContentActionsResponse };
|
|
73
|
+
export type { EmbbededSignatureResponse, Content, ContentActionsSignatureResponse, ContentActionsPaymentResponse, SendContentResponse, CheckReceiverResponse, ContentMeta, ContentResponse, ContentActionsResponse };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ApiV1 } from "../../api/api";
|
|
2
|
+
import { ApiResponse } from "./apiResponse";
|
|
3
|
+
import { StatusResponse } from "./responses/status";
|
|
4
|
+
declare class StatusEndpoint {
|
|
5
|
+
private endpoint;
|
|
6
|
+
private readonly VERSION;
|
|
7
|
+
private state;
|
|
8
|
+
constructor(api: ApiV1);
|
|
9
|
+
private getPath;
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @returns the
|
|
13
|
+
*/
|
|
14
|
+
getStatus(): Promise<ApiResponse<StatusResponse>>;
|
|
15
|
+
}
|
|
16
|
+
export { StatusEndpoint };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ApiV1 } from "../../api/api";
|
|
2
|
+
import { Tenant, TenantsResponse } from "./responses/tenant";
|
|
3
|
+
import { ApiResponse } from "./apiResponse";
|
|
4
|
+
declare class TenantsEndpoints {
|
|
5
|
+
private endpoint;
|
|
6
|
+
private readonly VERSION;
|
|
7
|
+
private state;
|
|
8
|
+
constructor(api: ApiV1);
|
|
9
|
+
private getPath;
|
|
10
|
+
/**
|
|
11
|
+
* Gets a tenant by its ID
|
|
12
|
+
*/
|
|
13
|
+
getById(tenantId: string): Promise<ApiResponse<Tenant>>;
|
|
14
|
+
/**
|
|
15
|
+
* Gets all tenants owned by the account id
|
|
16
|
+
*/
|
|
17
|
+
getMy(): Promise<ApiResponse<TenantsResponse>>;
|
|
18
|
+
}
|
|
19
|
+
export { TenantsEndpoints };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -12,3 +12,7 @@ export * from "./endpoints/v1/signatures";
|
|
|
12
12
|
export * from "./endpoints/v1/mailbox";
|
|
13
13
|
export * from "./endpoints/v1/requests/mailbox";
|
|
14
14
|
export * from "./endpoints/v1/responses/mailbox";
|
|
15
|
+
export * from "./endpoints/v1/tenant";
|
|
16
|
+
export * from "./endpoints/v1/responses/tenant";
|
|
17
|
+
export * from "./endpoints/v1/accounts";
|
|
18
|
+
export * from "./endpoints/v1/responses/accounts";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brifle/brifle-sdk",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "The JavaScript SDK to interact with the API of Brifle",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"scripts": {
|
|
22
22
|
"test": "jest --setupFiles dotenv/config",
|
|
23
23
|
"test-jest": "jest",
|
|
24
|
+
"test-only": "jest",
|
|
24
25
|
"rollup": "tsc --project tsconfig.types.json && rollup -c",
|
|
25
26
|
"build": "tsc",
|
|
26
27
|
"publish": "npm run rollup && npm publish --access public"
|