@brifle/brifle-sdk 0.0.5 → 0.2.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.
Files changed (48) hide show
  1. package/dist/api/api.js +79 -0
  2. package/dist/cjs/api/api.d.ts +6 -0
  3. package/dist/cjs/endpoints/v1/content.d.ts +16 -1
  4. package/dist/cjs/endpoints/v1/requests/content.d.ts +31 -2
  5. package/dist/cjs/endpoints/v1/requests/mailbox.d.ts +2 -0
  6. package/dist/cjs/endpoints/v1/responses/content.d.ts +35 -22
  7. package/dist/cjs/endpoints/v1/responses/status.d.ts +8 -0
  8. package/dist/cjs/endpoints/v1/status.d.ts +16 -0
  9. package/dist/cjs/index.js +68 -0
  10. package/dist/cjs/index.js.map +1 -1
  11. package/dist/endpoints/v1/accounts.js +32 -0
  12. package/dist/endpoints/v1/apiResponse.js +64 -0
  13. package/dist/endpoints/v1/authentication.js +43 -0
  14. package/dist/endpoints/v1/content.js +131 -0
  15. package/dist/endpoints/v1/mailbox.js +55 -0
  16. package/dist/endpoints/v1/requests/authentication.js +1 -0
  17. package/dist/endpoints/v1/requests/content.js +1 -0
  18. package/dist/endpoints/v1/requests/mailbox.js +1 -0
  19. package/dist/endpoints/v1/requests/signatures.js +1 -0
  20. package/dist/endpoints/v1/responses/accounts.js +1 -0
  21. package/dist/endpoints/v1/responses/authentication.js +1 -0
  22. package/dist/endpoints/v1/responses/content.js +1 -0
  23. package/dist/endpoints/v1/responses/mailbox.js +1 -0
  24. package/dist/endpoints/v1/responses/signatures.js +1 -0
  25. package/dist/endpoints/v1/responses/status.js +1 -0
  26. package/dist/endpoints/v1/responses/tenant.js +1 -0
  27. package/dist/endpoints/v1/signatures.js +55 -0
  28. package/dist/endpoints/v1/status.js +27 -0
  29. package/dist/endpoints/v1/tenant.js +49 -0
  30. package/dist/esm/api/api.d.ts +6 -0
  31. package/dist/esm/endpoints/v1/content.d.ts +16 -1
  32. package/dist/esm/endpoints/v1/requests/content.d.ts +31 -2
  33. package/dist/esm/endpoints/v1/requests/mailbox.d.ts +2 -0
  34. package/dist/esm/endpoints/v1/responses/content.d.ts +35 -22
  35. package/dist/esm/endpoints/v1/responses/status.d.ts +8 -0
  36. package/dist/esm/endpoints/v1/status.d.ts +16 -0
  37. package/dist/esm/index.mjs +68 -0
  38. package/dist/esm/index.mjs.map +1 -1
  39. package/dist/index.d.ts +109 -23
  40. package/dist/index.js +18 -0
  41. package/dist/types/api/api.d.ts +6 -0
  42. package/dist/types/endpoints/v1/content.d.ts +16 -1
  43. package/dist/types/endpoints/v1/requests/content.d.ts +31 -2
  44. package/dist/types/endpoints/v1/requests/mailbox.d.ts +2 -0
  45. package/dist/types/endpoints/v1/responses/content.d.ts +35 -22
  46. package/dist/types/endpoints/v1/responses/status.d.ts +8 -0
  47. package/dist/types/endpoints/v1/status.d.ts +16 -0
  48. package/package.json +2 -1
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as axios from 'axios';
1
2
  import { AxiosError } from 'axios';
2
3
 
3
4
  declare class ApiResponse<ResponseType> {
@@ -99,14 +100,16 @@ interface ContentMeta {
99
100
  size: number;
100
101
  subject: string;
101
102
  type: string;
103
+ size_responsive?: number;
102
104
  }
103
105
  interface ContentResponse {
104
- content: {
105
- content: string;
106
- type: string;
107
- };
106
+ content: Content[];
108
107
  meta: ContentMeta;
109
108
  }
109
+ interface Content {
110
+ content: string;
111
+ type: string;
112
+ }
110
113
  interface ContentActionsPaymentResponse {
111
114
  details: {
112
115
  amount: number;
@@ -119,31 +122,42 @@ interface ContentActionsPaymentResponse {
119
122
  };
120
123
  link: string;
121
124
  }
125
+ interface CoverLetterOverviewItem {
126
+ type: string;
127
+ name: string;
128
+ display_name: string;
129
+ }
130
+ interface CoverLetterOverviewResponse {
131
+ cover_letters: CoverLetterOverviewItem[];
132
+ }
133
+ interface EmbbededSignatureResponse {
134
+ id: string;
135
+ created_by: string;
136
+ created_date: string;
137
+ document_signature_id: string;
138
+ due_date: string;
139
+ field_name: string;
140
+ history?: string;
141
+ purpose: string;
142
+ request_date: string;
143
+ requested_to: string;
144
+ signature_date: string;
145
+ signed_by: string;
146
+ signed_for: string;
147
+ value: string;
148
+ status: 'pending' | 'signed' | 'rejected';
149
+ }
122
150
  interface ContentActionsSignatureResponse {
123
151
  document_signatures: {
124
152
  signature_ids: string[];
125
153
  signature_reference: string;
126
154
  };
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
- }[];
155
+ embedded_signatures: EmbbededSignatureResponse[];
142
156
  signature_reference: string;
143
157
  }
144
158
  interface ContentActionsResponse {
145
- payments: ContentActionsPaymentResponse[];
146
- signatures: ContentActionsSignatureResponse[];
159
+ payments: ContentActionsPaymentResponse;
160
+ signatures: ContentActionsSignatureResponse;
147
161
  }
148
162
 
149
163
  interface ReceiverRequest {
@@ -157,6 +171,17 @@ interface ReceiverRequest {
157
171
  last_name?: string;
158
172
  full_name?: string;
159
173
  date_of_birth?: string;
174
+ postal_address?: PostalAddress;
175
+ }
176
+ interface PostalAddress {
177
+ city: string;
178
+ country: string;
179
+ date_of_birth?: string;
180
+ first_name: string;
181
+ house_number: string;
182
+ last_name: string;
183
+ postcode: string;
184
+ street: string;
160
185
  }
161
186
  interface BirthInformation {
162
187
  birth_name?: string;
@@ -165,7 +190,7 @@ interface BirthInformation {
165
190
  nationality?: string;
166
191
  given_names?: string;
167
192
  last_name?: string;
168
- postaL_address?: string;
193
+ postal_address?: string;
169
194
  }
170
195
  interface PaymentDetails {
171
196
  amount: number;
@@ -183,6 +208,7 @@ interface SendContentRequest {
183
208
  type: 'application/pdf';
184
209
  content: string;
185
210
  }[];
211
+ fallback?: FallbackOptions;
186
212
  payment_info?: {
187
213
  details?: PaymentDetails;
188
214
  payable: boolean;
@@ -195,6 +221,23 @@ interface SendContentRequest {
195
221
  }[];
196
222
  };
197
223
  }
224
+ interface FallbackOptions {
225
+ enabled_physical_delivery: boolean;
226
+ paper_mail: {
227
+ recipient: {
228
+ address_line1: string;
229
+ address_line2?: string;
230
+ address_line3?: string;
231
+ postal_code: string;
232
+ city: string;
233
+ country: string;
234
+ };
235
+ test_mode: {
236
+ email: string;
237
+ enabled: boolean;
238
+ };
239
+ };
240
+ }
198
241
 
199
242
  declare class ContentEndpoints {
200
243
  private endpoint;
@@ -232,6 +275,21 @@ declare class ContentEndpoints {
232
275
  * @returns
233
276
  */
234
277
  sendContent(tenantId: string, request: SendContentRequest): Promise<ApiResponse<SendContentResponse>>;
278
+ /**
279
+ * list all cover letters for a tenant
280
+ * @param tenantId - The tenant id
281
+ * @returns
282
+ */
283
+ listCoverLetters(tenantId: string): Promise<ApiResponse<CoverLetterOverviewResponse>>;
284
+ /**
285
+ * get the content of a cover letter
286
+ * @param tenantId - The tenant id
287
+ * @param type - The type of the cover letter (custom | default)
288
+ * @param name - The name of the cover letter
289
+ * @param encoding - The encoding of the cover letter (base64 | pdf)
290
+ * @returns
291
+ */
292
+ getCoverLetterContent(tenantId: string, type: 'custom' | 'default', name: string, encoding: 'base64' | 'pdf'): Promise<axios.AxiosResponse<Blob, any>>;
235
293
  }
236
294
 
237
295
  interface CreateSignatureReferenceRequest {
@@ -286,6 +344,8 @@ interface InboxFilter {
286
344
  }
287
345
  interface OutboxFilter {
288
346
  state?: Array<'active' | 'trashed'>;
347
+ subject?: string;
348
+ type?: 'letter' | 'invoice' | 'contract';
289
349
  }
290
350
 
291
351
  interface MailboxResponse {
@@ -371,6 +431,27 @@ declare class AccountsEndpoints {
371
431
  getById(accountId: string): Promise<ApiResponse<AccountInfo>>;
372
432
  }
373
433
 
434
+ interface StatusResponse {
435
+ status: string;
436
+ timestamp: string;
437
+ version: string;
438
+ service: string;
439
+ features: string[];
440
+ }
441
+
442
+ declare class StatusEndpoint {
443
+ private endpoint;
444
+ private readonly VERSION;
445
+ private state;
446
+ constructor(api: ApiV1);
447
+ private getPath;
448
+ /**
449
+ *
450
+ * @returns the
451
+ */
452
+ getStatus(): Promise<ApiResponse<StatusResponse>>;
453
+ }
454
+
374
455
  declare class ApiV1 {
375
456
  readonly endpoint: string;
376
457
  readonly apiState: ApiV1State;
@@ -407,6 +488,11 @@ declare class ApiV1 {
407
488
  * @returns MailboxEndpoints
408
489
  */
409
490
  mailbox(): MailboxEndpoints;
491
+ /**
492
+ * gets an instance of the StatusEndpoint
493
+ * @returns StatusEndpoint
494
+ */
495
+ status(): StatusEndpoint;
410
496
  }
411
497
  interface ApiV1State {
412
498
  auth_token?: string;
@@ -414,4 +500,4 @@ interface ApiV1State {
414
500
  }
415
501
 
416
502
  export { AccountsEndpoints, ApiResponse, ApiV1, AuthenticationEndpoints, ContentEndpoints, MailboxEndpoints, SignaturesEndpoint, TenantsEndpoints };
417
- export type { AccountInfo, ApiV1State, BirthInformation, CheckReceiverResponse, ContentActionsResponse, ContentMeta, ContentResponse, CreateSignatureReferenceRequest, CreateSignatureReferenceResponse, ErrorResponse, InboxFilter, LoginRequest, LoginResponse, LogoutRequest, MailboxResponse, Meta, OutboxFilter, PaymentDetails, ReceiverRequest, SendContentRequest, SendContentResponse, Tenant, TenantsResponse };
503
+ export type { AccountInfo, ApiV1State, BirthInformation, CheckReceiverResponse, Content, ContentActionsPaymentResponse, ContentActionsResponse, ContentActionsSignatureResponse, ContentMeta, ContentResponse, CoverLetterOverviewItem, CoverLetterOverviewResponse, 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";
@@ -4,6 +4,7 @@ import { SignaturesEndpoint } from "../endpoints/v1/signatures";
4
4
  import { MailboxEndpoints } from "../endpoints/v1/mailbox";
5
5
  import { TenantsEndpoints } from "../endpoints/v1/tenant";
6
6
  import { AccountsEndpoints } from "../endpoints/v1/accounts";
7
+ import { StatusEndpoint } from "../endpoints/v1/status";
7
8
  declare class ApiV1 {
8
9
  readonly endpoint: string;
9
10
  readonly apiState: ApiV1State;
@@ -40,6 +41,11 @@ declare class ApiV1 {
40
41
  * @returns MailboxEndpoints
41
42
  */
42
43
  mailbox(): MailboxEndpoints;
44
+ /**
45
+ * gets an instance of the StatusEndpoint
46
+ * @returns StatusEndpoint
47
+ */
48
+ status(): StatusEndpoint;
43
49
  }
44
50
  export interface ApiV1State {
45
51
  auth_token?: string;
@@ -1,5 +1,5 @@
1
1
  import { ApiResponse } from "./apiResponse";
2
- import { CheckReceiverResponse, ContentActionsResponse, ContentResponse, SendContentResponse } from "./responses/content";
2
+ import { CheckReceiverResponse, ContentActionsResponse, ContentResponse, CoverLetterOverviewResponse, SendContentResponse } from "./responses/content";
3
3
  import { ApiV1 } from "../../api/api";
4
4
  import { ReceiverRequest, SendContentRequest } from "./requests/content";
5
5
  declare class ContentEndpoints {
@@ -38,5 +38,20 @@ declare class ContentEndpoints {
38
38
  * @returns
39
39
  */
40
40
  sendContent(tenantId: string, request: SendContentRequest): Promise<ApiResponse<SendContentResponse>>;
41
+ /**
42
+ * list all cover letters for a tenant
43
+ * @param tenantId - The tenant id
44
+ * @returns
45
+ */
46
+ listCoverLetters(tenantId: string): Promise<ApiResponse<CoverLetterOverviewResponse>>;
47
+ /**
48
+ * get the content of a cover letter
49
+ * @param tenantId - The tenant id
50
+ * @param type - The type of the cover letter (custom | default)
51
+ * @param name - The name of the cover letter
52
+ * @param encoding - The encoding of the cover letter (base64 | pdf)
53
+ * @returns
54
+ */
55
+ getCoverLetterContent(tenantId: string, type: 'custom' | 'default', name: string, encoding: 'base64' | 'pdf'): Promise<import("axios").AxiosResponse<Blob, any>>;
41
56
  }
42
57
  export { ContentEndpoints };
@@ -9,6 +9,17 @@ interface ReceiverRequest {
9
9
  last_name?: string;
10
10
  full_name?: string;
11
11
  date_of_birth?: string;
12
+ postal_address?: PostalAddress;
13
+ }
14
+ interface PostalAddress {
15
+ city: string;
16
+ country: string;
17
+ date_of_birth?: string;
18
+ first_name: string;
19
+ house_number: string;
20
+ last_name: string;
21
+ postcode: string;
22
+ street: string;
12
23
  }
13
24
  interface BirthInformation {
14
25
  birth_name?: string;
@@ -17,7 +28,7 @@ interface BirthInformation {
17
28
  nationality?: string;
18
29
  given_names?: string;
19
30
  last_name?: string;
20
- postaL_address?: string;
31
+ postal_address?: string;
21
32
  }
22
33
  interface PaymentDetails {
23
34
  amount: number;
@@ -35,6 +46,7 @@ interface SendContentRequest {
35
46
  type: 'application/pdf';
36
47
  content: string;
37
48
  }[];
49
+ fallback?: FallbackOptions;
38
50
  payment_info?: {
39
51
  details?: PaymentDetails;
40
52
  payable: boolean;
@@ -47,4 +59,21 @@ interface SendContentRequest {
47
59
  }[];
48
60
  };
49
61
  }
50
- export type { SendContentRequest, ReceiverRequest, BirthInformation, PaymentDetails };
62
+ interface FallbackOptions {
63
+ enabled_physical_delivery: boolean;
64
+ paper_mail: {
65
+ recipient: {
66
+ address_line1: string;
67
+ address_line2?: string;
68
+ address_line3?: string;
69
+ postal_code: string;
70
+ city: string;
71
+ country: string;
72
+ };
73
+ test_mode: {
74
+ email: string;
75
+ enabled: boolean;
76
+ };
77
+ };
78
+ }
79
+ export type { SendContentRequest, ReceiverRequest, BirthInformation, PaymentDetails, FallbackOptions };
@@ -6,5 +6,7 @@ interface InboxFilter {
6
6
  }
7
7
  interface OutboxFilter {
8
8
  state?: Array<'active' | 'trashed'>;
9
+ subject?: string;
10
+ type?: 'letter' | 'invoice' | 'contract';
9
11
  }
10
12
  export type { InboxFilter, OutboxFilter };
@@ -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,41 @@ interface ContentActionsPaymentResponse {
39
41
  };
40
42
  link: string;
41
43
  }
44
+ interface CoverLetterOverviewItem {
45
+ type: string;
46
+ name: string;
47
+ display_name: string;
48
+ }
49
+ interface CoverLetterOverviewResponse {
50
+ cover_letters: CoverLetterOverviewItem[];
51
+ }
52
+ interface EmbbededSignatureResponse {
53
+ id: string;
54
+ created_by: string;
55
+ created_date: string;
56
+ document_signature_id: string;
57
+ due_date: string;
58
+ field_name: string;
59
+ history?: string;
60
+ purpose: string;
61
+ request_date: string;
62
+ requested_to: string;
63
+ signature_date: string;
64
+ signed_by: string;
65
+ signed_for: string;
66
+ value: string;
67
+ status: 'pending' | 'signed' | 'rejected';
68
+ }
42
69
  interface ContentActionsSignatureResponse {
43
70
  document_signatures: {
44
71
  signature_ids: string[];
45
72
  signature_reference: string;
46
73
  };
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
- }[];
74
+ embedded_signatures: EmbbededSignatureResponse[];
62
75
  signature_reference: string;
63
76
  }
64
77
  interface ContentActionsResponse {
65
- payments: ContentActionsPaymentResponse[];
66
- signatures: ContentActionsSignatureResponse[];
78
+ payments: ContentActionsPaymentResponse;
79
+ signatures: ContentActionsSignatureResponse;
67
80
  }
68
- export type { SendContentResponse, CheckReceiverResponse, ContentMeta, ContentResponse, ContentActionsResponse };
81
+ export type { EmbbededSignatureResponse, Content, CoverLetterOverviewResponse, CoverLetterOverviewItem, ContentActionsSignatureResponse, ContentActionsPaymentResponse, SendContentResponse, CheckReceiverResponse, ContentMeta, ContentResponse, ContentActionsResponse };
@@ -0,0 +1,8 @@
1
+ interface StatusResponse {
2
+ status: string;
3
+ timestamp: string;
4
+ version: string;
5
+ service: string;
6
+ features: string[];
7
+ }
8
+ export type { StatusResponse };
@@ -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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brifle/brifle-sdk",
3
- "version": "0.0.5",
3
+ "version": "0.2.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"