@brifle/brifle-sdk 0.1.0 → 0.2.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.
@@ -1,5 +1,6 @@
1
+ import { AxiosResponse } from "axios";
1
2
  import { ApiResponse } from "./apiResponse";
2
- import { CheckReceiverResponse, ContentActionsResponse, ContentResponse, SendContentResponse } from "./responses/content";
3
+ import { CheckReceiverResponse, ContentActionsResponse, ContentResponse, CoverLetterOverviewItem, CoverLetterOverviewResponse, SendContentResponse } from "./responses/content";
3
4
  import { ApiV1 } from "../../api/api";
4
5
  import { ReceiverRequest, SendContentRequest } from "./requests/content";
5
6
  declare class ContentEndpoints {
@@ -38,5 +39,34 @@ declare class ContentEndpoints {
38
39
  * @returns
39
40
  */
40
41
  sendContent(tenantId: string, request: SendContentRequest): Promise<ApiResponse<SendContentResponse>>;
42
+ /**
43
+ * list all cover letters for a tenant
44
+ * @param tenantId - The tenant id
45
+ * @returns
46
+ */
47
+ listCoverLetters(tenantId: string): Promise<ApiResponse<CoverLetterOverviewResponse>>;
48
+ /**
49
+ * create a custom cover letter for a tenant
50
+ * @param tenantId - The tenant id
51
+ * @param name - The name of the cover letter
52
+ * @param base64Content - The content of the cover letter in base64 encoding
53
+ * @param description - The description of the cover letter (optional)
54
+ * @returns
55
+ */
56
+ createCoverLetter(tenantId: string, name: string, base64Content: string, description?: string): Promise<ApiResponse<CoverLetterOverviewItem>>;
57
+ /**
58
+ * delete a custom cover letter
59
+ *
60
+ */
61
+ deleteCoverLetter(tenantId: string, name: string): Promise<ApiResponse<void>>;
62
+ /**
63
+ * get the content of a cover letter
64
+ * @param tenantId - The tenant id
65
+ * @param type - The type of the cover letter (custom | default)
66
+ * @param name - The name of the cover letter
67
+ * @param encoding - The encoding of the cover letter (base64 | pdf)
68
+ * @returns
69
+ */
70
+ getCoverLetterContent(tenantId: string, type: 'custom' | 'default', name: string, encoding: 'base64' | 'pdf'): Promise<AxiosResponse<string | Blob>>;
41
71
  }
42
72
  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;
@@ -41,6 +41,15 @@ interface ContentActionsPaymentResponse {
41
41
  };
42
42
  link: string;
43
43
  }
44
+ interface CoverLetterOverviewItem {
45
+ type: string;
46
+ name: string;
47
+ display_name: string;
48
+ description?: string;
49
+ }
50
+ interface CoverLetterOverviewResponse {
51
+ cover_letters: CoverLetterOverviewItem[];
52
+ }
44
53
  interface EmbbededSignatureResponse {
45
54
  id: string;
46
55
  created_by: string;
@@ -70,4 +79,4 @@ interface ContentActionsResponse {
70
79
  payments: ContentActionsPaymentResponse;
71
80
  signatures: ContentActionsSignatureResponse;
72
81
  }
73
- export type { EmbbededSignatureResponse, Content, ContentActionsSignatureResponse, ContentActionsPaymentResponse, SendContentResponse, CheckReceiverResponse, ContentMeta, ContentResponse, ContentActionsResponse };
82
+ export type { EmbbededSignatureResponse, Content, CoverLetterOverviewResponse, CoverLetterOverviewItem, ContentActionsSignatureResponse, ContentActionsPaymentResponse, SendContentResponse, CheckReceiverResponse, ContentMeta, ContentResponse, ContentActionsResponse };
package/dist/cjs/index.js CHANGED
@@ -199,6 +199,87 @@ class ContentEndpoints {
199
199
  return ApiResponse.errorAxios(error);
200
200
  });
201
201
  }
202
+ /**
203
+ * list all cover letters for a tenant
204
+ * @param tenantId - The tenant id
205
+ * @returns
206
+ */
207
+ listCoverLetters(tenantId) {
208
+ const path = this.getPath(`cover_letter/${tenantId}/list`);
209
+ return axios.get(path, {
210
+ headers: {
211
+ "Authorization": `Bearer ${this.state.auth_token}`
212
+ }
213
+ })
214
+ .then((response) => {
215
+ return ApiResponse.success(response.data);
216
+ })
217
+ .catch((error) => {
218
+ return ApiResponse.errorAxios(error);
219
+ });
220
+ }
221
+ /**
222
+ * create a custom cover letter for a tenant
223
+ * @param tenantId - The tenant id
224
+ * @param name - The name of the cover letter
225
+ * @param base64Content - The content of the cover letter in base64 encoding
226
+ * @param description - The description of the cover letter (optional)
227
+ * @returns
228
+ */
229
+ createCoverLetter(tenantId, name, base64Content, description) {
230
+ const path = this.getPath(`cover_letter/${tenantId}/custom/new`);
231
+ const req = {
232
+ name: name,
233
+ data: base64Content,
234
+ description: description
235
+ };
236
+ return axios.post(path, req, {
237
+ headers: {
238
+ "Authorization": `Bearer ${this.state.auth_token}`
239
+ }
240
+ })
241
+ .then((response) => {
242
+ return ApiResponse.success(response.data);
243
+ })
244
+ .catch((error) => {
245
+ return ApiResponse.errorAxios(error);
246
+ });
247
+ }
248
+ /**
249
+ * delete a custom cover letter
250
+ *
251
+ */
252
+ deleteCoverLetter(tenantId, name) {
253
+ const path = this.getPath(`cover_letter/${tenantId}/custom/${name}/delete`);
254
+ return axios.delete(path, {
255
+ headers: {
256
+ "Authorization": `Bearer ${this.state.auth_token}`
257
+ }
258
+ })
259
+ .then((response) => {
260
+ return ApiResponse.success(response.data);
261
+ })
262
+ .catch((error) => {
263
+ return ApiResponse.errorAxios(error);
264
+ });
265
+ }
266
+ /**
267
+ * get the content of a cover letter
268
+ * @param tenantId - The tenant id
269
+ * @param type - The type of the cover letter (custom | default)
270
+ * @param name - The name of the cover letter
271
+ * @param encoding - The encoding of the cover letter (base64 | pdf)
272
+ * @returns
273
+ */
274
+ getCoverLetterContent(tenantId, type, name, encoding) {
275
+ const path = this.getPath(`cover_letter/${tenantId}/${type}/${name}/${encoding}`);
276
+ return axios.get(path, {
277
+ headers: {
278
+ "Authorization": `Bearer ${this.state.auth_token}`
279
+ },
280
+ responseType: 'blob'
281
+ });
282
+ }
202
283
  }
203
284
 
204
285
  class SignaturesEndpoint {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -91,5 +91,86 @@ class ContentEndpoints {
91
91
  return ApiResponse.errorAxios(error);
92
92
  });
93
93
  }
94
+ /**
95
+ * list all cover letters for a tenant
96
+ * @param tenantId - The tenant id
97
+ * @returns
98
+ */
99
+ listCoverLetters(tenantId) {
100
+ const path = this.getPath(`cover_letters/${tenantId}/list`);
101
+ return axios.get(path, {
102
+ headers: {
103
+ "Authorization": `Bearer ${this.state.auth_token}`
104
+ }
105
+ })
106
+ .then((response) => {
107
+ return ApiResponse.success(response.data);
108
+ })
109
+ .catch((error) => {
110
+ return ApiResponse.errorAxios(error);
111
+ });
112
+ }
113
+ /**
114
+ * create a custom cover letter for a tenant
115
+ * @param tenantId - The tenant id
116
+ * @param name - The name of the cover letter
117
+ * @param base64Content - The content of the cover letter in base64 encoding
118
+ * @param description - The description of the cover letter (optional)
119
+ * @returns
120
+ */
121
+ createCoverLetter(tenantId, name, base64Content, description) {
122
+ const path = this.getPath(`cover_letter/${tenantId}/custom/new`);
123
+ const req = {
124
+ name: name,
125
+ data: base64Content,
126
+ description: description
127
+ };
128
+ return axios.post(path, req, {
129
+ headers: {
130
+ "Authorization": `Bearer ${this.state.auth_token}`
131
+ }
132
+ })
133
+ .then((response) => {
134
+ return ApiResponse.success(response.data);
135
+ })
136
+ .catch((error) => {
137
+ return ApiResponse.errorAxios(error);
138
+ });
139
+ }
140
+ /**
141
+ * delete a custom cover letter
142
+ *
143
+ */
144
+ deleteCoverLetter(tenantId, name) {
145
+ const path = this.getPath(`cover_letter/${tenantId}/custom/${name}/delete`);
146
+ return axios.delete(path, {
147
+ headers: {
148
+ "Authorization": `Bearer ${this.state.auth_token}`
149
+ }
150
+ })
151
+ .then((response) => {
152
+ return ApiResponse.success(response.data);
153
+ })
154
+ .catch((error) => {
155
+ return ApiResponse.errorAxios(error);
156
+ });
157
+ }
158
+ /**
159
+ * get the content of a cover letter
160
+ * @param tenantId - The tenant id
161
+ * @param type - The type of the cover letter (custom | default)
162
+ * @param name - The name of the cover letter
163
+ * @param encoding - The encoding of the cover letter (base64 | pdf)
164
+ * @returns
165
+ */
166
+ getCoverLetterContent(tenantId, type, name, encoding) {
167
+ const path = this.getPath(`cover_letter/${tenantId}/${type}/${name}/${encoding}`);
168
+ return axios.get(path, {
169
+ headers: {
170
+ "Authorization": `Bearer ${this.state.auth_token}`
171
+ },
172
+ responseType: 'blob'
173
+ });
174
+ }
94
175
  }
95
176
  export { ContentEndpoints };
@@ -1,5 +1,6 @@
1
+ import { AxiosResponse } from "axios";
1
2
  import { ApiResponse } from "./apiResponse";
2
- import { CheckReceiverResponse, ContentActionsResponse, ContentResponse, SendContentResponse } from "./responses/content";
3
+ import { CheckReceiverResponse, ContentActionsResponse, ContentResponse, CoverLetterOverviewItem, CoverLetterOverviewResponse, SendContentResponse } from "./responses/content";
3
4
  import { ApiV1 } from "../../api/api";
4
5
  import { ReceiverRequest, SendContentRequest } from "./requests/content";
5
6
  declare class ContentEndpoints {
@@ -38,5 +39,34 @@ declare class ContentEndpoints {
38
39
  * @returns
39
40
  */
40
41
  sendContent(tenantId: string, request: SendContentRequest): Promise<ApiResponse<SendContentResponse>>;
42
+ /**
43
+ * list all cover letters for a tenant
44
+ * @param tenantId - The tenant id
45
+ * @returns
46
+ */
47
+ listCoverLetters(tenantId: string): Promise<ApiResponse<CoverLetterOverviewResponse>>;
48
+ /**
49
+ * create a custom cover letter for a tenant
50
+ * @param tenantId - The tenant id
51
+ * @param name - The name of the cover letter
52
+ * @param base64Content - The content of the cover letter in base64 encoding
53
+ * @param description - The description of the cover letter (optional)
54
+ * @returns
55
+ */
56
+ createCoverLetter(tenantId: string, name: string, base64Content: string, description?: string): Promise<ApiResponse<CoverLetterOverviewItem>>;
57
+ /**
58
+ * delete a custom cover letter
59
+ *
60
+ */
61
+ deleteCoverLetter(tenantId: string, name: string): Promise<ApiResponse<void>>;
62
+ /**
63
+ * get the content of a cover letter
64
+ * @param tenantId - The tenant id
65
+ * @param type - The type of the cover letter (custom | default)
66
+ * @param name - The name of the cover letter
67
+ * @param encoding - The encoding of the cover letter (base64 | pdf)
68
+ * @returns
69
+ */
70
+ getCoverLetterContent(tenantId: string, type: 'custom' | 'default', name: string, encoding: 'base64' | 'pdf'): Promise<AxiosResponse<string | Blob>>;
41
71
  }
42
72
  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;
@@ -41,6 +41,15 @@ interface ContentActionsPaymentResponse {
41
41
  };
42
42
  link: string;
43
43
  }
44
+ interface CoverLetterOverviewItem {
45
+ type: string;
46
+ name: string;
47
+ display_name: string;
48
+ description?: string;
49
+ }
50
+ interface CoverLetterOverviewResponse {
51
+ cover_letters: CoverLetterOverviewItem[];
52
+ }
44
53
  interface EmbbededSignatureResponse {
45
54
  id: string;
46
55
  created_by: string;
@@ -70,4 +79,4 @@ interface ContentActionsResponse {
70
79
  payments: ContentActionsPaymentResponse;
71
80
  signatures: ContentActionsSignatureResponse;
72
81
  }
73
- export type { EmbbededSignatureResponse, Content, ContentActionsSignatureResponse, ContentActionsPaymentResponse, SendContentResponse, CheckReceiverResponse, ContentMeta, ContentResponse, ContentActionsResponse };
82
+ export type { EmbbededSignatureResponse, Content, CoverLetterOverviewResponse, CoverLetterOverviewItem, ContentActionsSignatureResponse, ContentActionsPaymentResponse, SendContentResponse, CheckReceiverResponse, ContentMeta, ContentResponse, ContentActionsResponse };
@@ -197,6 +197,87 @@ class ContentEndpoints {
197
197
  return ApiResponse.errorAxios(error);
198
198
  });
199
199
  }
200
+ /**
201
+ * list all cover letters for a tenant
202
+ * @param tenantId - The tenant id
203
+ * @returns
204
+ */
205
+ listCoverLetters(tenantId) {
206
+ const path = this.getPath(`cover_letter/${tenantId}/list`);
207
+ return axios.get(path, {
208
+ headers: {
209
+ "Authorization": `Bearer ${this.state.auth_token}`
210
+ }
211
+ })
212
+ .then((response) => {
213
+ return ApiResponse.success(response.data);
214
+ })
215
+ .catch((error) => {
216
+ return ApiResponse.errorAxios(error);
217
+ });
218
+ }
219
+ /**
220
+ * create a custom cover letter for a tenant
221
+ * @param tenantId - The tenant id
222
+ * @param name - The name of the cover letter
223
+ * @param base64Content - The content of the cover letter in base64 encoding
224
+ * @param description - The description of the cover letter (optional)
225
+ * @returns
226
+ */
227
+ createCoverLetter(tenantId, name, base64Content, description) {
228
+ const path = this.getPath(`cover_letter/${tenantId}/custom/new`);
229
+ const req = {
230
+ name: name,
231
+ data: base64Content,
232
+ description: description
233
+ };
234
+ return axios.post(path, req, {
235
+ headers: {
236
+ "Authorization": `Bearer ${this.state.auth_token}`
237
+ }
238
+ })
239
+ .then((response) => {
240
+ return ApiResponse.success(response.data);
241
+ })
242
+ .catch((error) => {
243
+ return ApiResponse.errorAxios(error);
244
+ });
245
+ }
246
+ /**
247
+ * delete a custom cover letter
248
+ *
249
+ */
250
+ deleteCoverLetter(tenantId, name) {
251
+ const path = this.getPath(`cover_letter/${tenantId}/custom/${name}/delete`);
252
+ return axios.delete(path, {
253
+ headers: {
254
+ "Authorization": `Bearer ${this.state.auth_token}`
255
+ }
256
+ })
257
+ .then((response) => {
258
+ return ApiResponse.success(response.data);
259
+ })
260
+ .catch((error) => {
261
+ return ApiResponse.errorAxios(error);
262
+ });
263
+ }
264
+ /**
265
+ * get the content of a cover letter
266
+ * @param tenantId - The tenant id
267
+ * @param type - The type of the cover letter (custom | default)
268
+ * @param name - The name of the cover letter
269
+ * @param encoding - The encoding of the cover letter (base64 | pdf)
270
+ * @returns
271
+ */
272
+ getCoverLetterContent(tenantId, type, name, encoding) {
273
+ const path = this.getPath(`cover_letter/${tenantId}/${type}/${name}/${encoding}`);
274
+ return axios.get(path, {
275
+ headers: {
276
+ "Authorization": `Bearer ${this.state.auth_token}`
277
+ },
278
+ responseType: 'blob'
279
+ });
280
+ }
200
281
  }
201
282
 
202
283
  class SignaturesEndpoint {
@@ -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
@@ -1,4 +1,4 @@
1
- import { AxiosError } from 'axios';
1
+ import { AxiosError, AxiosResponse } from 'axios';
2
2
 
3
3
  declare class ApiResponse<ResponseType> {
4
4
  private _data?;
@@ -121,6 +121,15 @@ interface ContentActionsPaymentResponse {
121
121
  };
122
122
  link: string;
123
123
  }
124
+ interface CoverLetterOverviewItem {
125
+ type: string;
126
+ name: string;
127
+ display_name: string;
128
+ description?: string;
129
+ }
130
+ interface CoverLetterOverviewResponse {
131
+ cover_letters: CoverLetterOverviewItem[];
132
+ }
124
133
  interface EmbbededSignatureResponse {
125
134
  id: string;
126
135
  created_by: string;
@@ -162,6 +171,17 @@ interface ReceiverRequest {
162
171
  last_name?: string;
163
172
  full_name?: string;
164
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;
165
185
  }
166
186
  interface BirthInformation {
167
187
  birth_name?: string;
@@ -170,7 +190,7 @@ interface BirthInformation {
170
190
  nationality?: string;
171
191
  given_names?: string;
172
192
  last_name?: string;
173
- postaL_address?: string;
193
+ postal_address?: string;
174
194
  }
175
195
  interface PaymentDetails {
176
196
  amount: number;
@@ -255,6 +275,35 @@ declare class ContentEndpoints {
255
275
  * @returns
256
276
  */
257
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
+ * create a custom cover letter for a tenant
286
+ * @param tenantId - The tenant id
287
+ * @param name - The name of the cover letter
288
+ * @param base64Content - The content of the cover letter in base64 encoding
289
+ * @param description - The description of the cover letter (optional)
290
+ * @returns
291
+ */
292
+ createCoverLetter(tenantId: string, name: string, base64Content: string, description?: string): Promise<ApiResponse<CoverLetterOverviewItem>>;
293
+ /**
294
+ * delete a custom cover letter
295
+ *
296
+ */
297
+ deleteCoverLetter(tenantId: string, name: string): Promise<ApiResponse<void>>;
298
+ /**
299
+ * get the content of a cover letter
300
+ * @param tenantId - The tenant id
301
+ * @param type - The type of the cover letter (custom | default)
302
+ * @param name - The name of the cover letter
303
+ * @param encoding - The encoding of the cover letter (base64 | pdf)
304
+ * @returns
305
+ */
306
+ getCoverLetterContent(tenantId: string, type: 'custom' | 'default', name: string, encoding: 'base64' | 'pdf'): Promise<AxiosResponse<string | Blob>>;
258
307
  }
259
308
 
260
309
  interface CreateSignatureReferenceRequest {
@@ -465,4 +514,4 @@ interface ApiV1State {
465
514
  }
466
515
 
467
516
  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 };
517
+ 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 };
@@ -1,5 +1,6 @@
1
+ import { AxiosResponse } from "axios";
1
2
  import { ApiResponse } from "./apiResponse";
2
- import { CheckReceiverResponse, ContentActionsResponse, ContentResponse, SendContentResponse } from "./responses/content";
3
+ import { CheckReceiverResponse, ContentActionsResponse, ContentResponse, CoverLetterOverviewItem, CoverLetterOverviewResponse, SendContentResponse } from "./responses/content";
3
4
  import { ApiV1 } from "../../api/api";
4
5
  import { ReceiverRequest, SendContentRequest } from "./requests/content";
5
6
  declare class ContentEndpoints {
@@ -38,5 +39,34 @@ declare class ContentEndpoints {
38
39
  * @returns
39
40
  */
40
41
  sendContent(tenantId: string, request: SendContentRequest): Promise<ApiResponse<SendContentResponse>>;
42
+ /**
43
+ * list all cover letters for a tenant
44
+ * @param tenantId - The tenant id
45
+ * @returns
46
+ */
47
+ listCoverLetters(tenantId: string): Promise<ApiResponse<CoverLetterOverviewResponse>>;
48
+ /**
49
+ * create a custom cover letter for a tenant
50
+ * @param tenantId - The tenant id
51
+ * @param name - The name of the cover letter
52
+ * @param base64Content - The content of the cover letter in base64 encoding
53
+ * @param description - The description of the cover letter (optional)
54
+ * @returns
55
+ */
56
+ createCoverLetter(tenantId: string, name: string, base64Content: string, description?: string): Promise<ApiResponse<CoverLetterOverviewItem>>;
57
+ /**
58
+ * delete a custom cover letter
59
+ *
60
+ */
61
+ deleteCoverLetter(tenantId: string, name: string): Promise<ApiResponse<void>>;
62
+ /**
63
+ * get the content of a cover letter
64
+ * @param tenantId - The tenant id
65
+ * @param type - The type of the cover letter (custom | default)
66
+ * @param name - The name of the cover letter
67
+ * @param encoding - The encoding of the cover letter (base64 | pdf)
68
+ * @returns
69
+ */
70
+ getCoverLetterContent(tenantId: string, type: 'custom' | 'default', name: string, encoding: 'base64' | 'pdf'): Promise<AxiosResponse<string | Blob>>;
41
71
  }
42
72
  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;
@@ -41,6 +41,15 @@ interface ContentActionsPaymentResponse {
41
41
  };
42
42
  link: string;
43
43
  }
44
+ interface CoverLetterOverviewItem {
45
+ type: string;
46
+ name: string;
47
+ display_name: string;
48
+ description?: string;
49
+ }
50
+ interface CoverLetterOverviewResponse {
51
+ cover_letters: CoverLetterOverviewItem[];
52
+ }
44
53
  interface EmbbededSignatureResponse {
45
54
  id: string;
46
55
  created_by: string;
@@ -70,4 +79,4 @@ interface ContentActionsResponse {
70
79
  payments: ContentActionsPaymentResponse;
71
80
  signatures: ContentActionsSignatureResponse;
72
81
  }
73
- export type { EmbbededSignatureResponse, Content, ContentActionsSignatureResponse, ContentActionsPaymentResponse, SendContentResponse, CheckReceiverResponse, ContentMeta, ContentResponse, ContentActionsResponse };
82
+ export type { EmbbededSignatureResponse, Content, CoverLetterOverviewResponse, CoverLetterOverviewItem, ContentActionsSignatureResponse, ContentActionsPaymentResponse, SendContentResponse, CheckReceiverResponse, ContentMeta, ContentResponse, ContentActionsResponse };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brifle/brifle-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "The JavaScript SDK to interact with the API of Brifle",
5
5
  "files": [
6
6
  "dist",