@brifle/brifle-sdk 0.2.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, CoverLetterOverviewResponse, 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 {
@@ -44,6 +45,20 @@ declare class ContentEndpoints {
44
45
  * @returns
45
46
  */
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>>;
47
62
  /**
48
63
  * get the content of a cover letter
49
64
  * @param tenantId - The tenant id
@@ -52,6 +67,6 @@ declare class ContentEndpoints {
52
67
  * @param encoding - The encoding of the cover letter (base64 | pdf)
53
68
  * @returns
54
69
  */
55
- getCoverLetterContent(tenantId: string, type: 'custom' | 'default', name: string, encoding: 'base64' | 'pdf'): Promise<import("axios").AxiosResponse<Blob, any>>;
70
+ getCoverLetterContent(tenantId: string, type: 'custom' | 'default', name: string, encoding: 'base64' | 'pdf'): Promise<AxiosResponse<string | Blob>>;
56
71
  }
57
72
  export { ContentEndpoints };
@@ -45,6 +45,7 @@ interface CoverLetterOverviewItem {
45
45
  type: string;
46
46
  name: string;
47
47
  display_name: string;
48
+ description?: string;
48
49
  }
49
50
  interface CoverLetterOverviewResponse {
50
51
  cover_letters: CoverLetterOverviewItem[];
package/dist/cjs/index.js CHANGED
@@ -205,7 +205,7 @@ class ContentEndpoints {
205
205
  * @returns
206
206
  */
207
207
  listCoverLetters(tenantId) {
208
- const path = this.getPath(`cover_letters/${tenantId}/list`);
208
+ const path = this.getPath(`cover_letter/${tenantId}/list`);
209
209
  return axios.get(path, {
210
210
  headers: {
211
211
  "Authorization": `Bearer ${this.state.auth_token}`
@@ -218,6 +218,51 @@ class ContentEndpoints {
218
218
  return ApiResponse.errorAxios(error);
219
219
  });
220
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
+ }
221
266
  /**
222
267
  * get the content of a cover letter
223
268
  * @param tenantId - The tenant id
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -110,6 +110,51 @@ class ContentEndpoints {
110
110
  return ApiResponse.errorAxios(error);
111
111
  });
112
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
+ }
113
158
  /**
114
159
  * get the content of a cover letter
115
160
  * @param tenantId - The tenant id
@@ -1,5 +1,6 @@
1
+ import { AxiosResponse } from "axios";
1
2
  import { ApiResponse } from "./apiResponse";
2
- import { CheckReceiverResponse, ContentActionsResponse, ContentResponse, CoverLetterOverviewResponse, 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 {
@@ -44,6 +45,20 @@ declare class ContentEndpoints {
44
45
  * @returns
45
46
  */
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>>;
47
62
  /**
48
63
  * get the content of a cover letter
49
64
  * @param tenantId - The tenant id
@@ -52,6 +67,6 @@ declare class ContentEndpoints {
52
67
  * @param encoding - The encoding of the cover letter (base64 | pdf)
53
68
  * @returns
54
69
  */
55
- getCoverLetterContent(tenantId: string, type: 'custom' | 'default', name: string, encoding: 'base64' | 'pdf'): Promise<import("axios").AxiosResponse<Blob, any>>;
70
+ getCoverLetterContent(tenantId: string, type: 'custom' | 'default', name: string, encoding: 'base64' | 'pdf'): Promise<AxiosResponse<string | Blob>>;
56
71
  }
57
72
  export { ContentEndpoints };
@@ -45,6 +45,7 @@ interface CoverLetterOverviewItem {
45
45
  type: string;
46
46
  name: string;
47
47
  display_name: string;
48
+ description?: string;
48
49
  }
49
50
  interface CoverLetterOverviewResponse {
50
51
  cover_letters: CoverLetterOverviewItem[];
@@ -203,7 +203,7 @@ class ContentEndpoints {
203
203
  * @returns
204
204
  */
205
205
  listCoverLetters(tenantId) {
206
- const path = this.getPath(`cover_letters/${tenantId}/list`);
206
+ const path = this.getPath(`cover_letter/${tenantId}/list`);
207
207
  return axios.get(path, {
208
208
  headers: {
209
209
  "Authorization": `Bearer ${this.state.auth_token}`
@@ -216,6 +216,51 @@ class ContentEndpoints {
216
216
  return ApiResponse.errorAxios(error);
217
217
  });
218
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
+ }
219
264
  /**
220
265
  * get the content of a cover letter
221
266
  * @param tenantId - The tenant id
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import * as axios from 'axios';
2
- import { AxiosError } from 'axios';
1
+ import { AxiosError, AxiosResponse } from 'axios';
3
2
 
4
3
  declare class ApiResponse<ResponseType> {
5
4
  private _data?;
@@ -126,6 +125,7 @@ interface CoverLetterOverviewItem {
126
125
  type: string;
127
126
  name: string;
128
127
  display_name: string;
128
+ description?: string;
129
129
  }
130
130
  interface CoverLetterOverviewResponse {
131
131
  cover_letters: CoverLetterOverviewItem[];
@@ -281,6 +281,20 @@ declare class ContentEndpoints {
281
281
  * @returns
282
282
  */
283
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>>;
284
298
  /**
285
299
  * get the content of a cover letter
286
300
  * @param tenantId - The tenant id
@@ -289,7 +303,7 @@ declare class ContentEndpoints {
289
303
  * @param encoding - The encoding of the cover letter (base64 | pdf)
290
304
  * @returns
291
305
  */
292
- getCoverLetterContent(tenantId: string, type: 'custom' | 'default', name: string, encoding: 'base64' | 'pdf'): Promise<axios.AxiosResponse<Blob, any>>;
306
+ getCoverLetterContent(tenantId: string, type: 'custom' | 'default', name: string, encoding: 'base64' | 'pdf'): Promise<AxiosResponse<string | Blob>>;
293
307
  }
294
308
 
295
309
  interface CreateSignatureReferenceRequest {
@@ -1,5 +1,6 @@
1
+ import { AxiosResponse } from "axios";
1
2
  import { ApiResponse } from "./apiResponse";
2
- import { CheckReceiverResponse, ContentActionsResponse, ContentResponse, CoverLetterOverviewResponse, 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 {
@@ -44,6 +45,20 @@ declare class ContentEndpoints {
44
45
  * @returns
45
46
  */
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>>;
47
62
  /**
48
63
  * get the content of a cover letter
49
64
  * @param tenantId - The tenant id
@@ -52,6 +67,6 @@ declare class ContentEndpoints {
52
67
  * @param encoding - The encoding of the cover letter (base64 | pdf)
53
68
  * @returns
54
69
  */
55
- getCoverLetterContent(tenantId: string, type: 'custom' | 'default', name: string, encoding: 'base64' | 'pdf'): Promise<import("axios").AxiosResponse<Blob, any>>;
70
+ getCoverLetterContent(tenantId: string, type: 'custom' | 'default', name: string, encoding: 'base64' | 'pdf'): Promise<AxiosResponse<string | Blob>>;
56
71
  }
57
72
  export { ContentEndpoints };
@@ -45,6 +45,7 @@ interface CoverLetterOverviewItem {
45
45
  type: string;
46
46
  name: string;
47
47
  display_name: string;
48
+ description?: string;
48
49
  }
49
50
  interface CoverLetterOverviewResponse {
50
51
  cover_letters: CoverLetterOverviewItem[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brifle/brifle-sdk",
3
- "version": "0.2.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",