plenna_utilities 1.4.1 → 1.5.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.
@@ -16,6 +16,10 @@ interface deleteDocumentResponse {
16
16
  }
17
17
  export interface ISchemaRequest extends docs_v1.Schema$Request {
18
18
  }
19
+ export interface IInsertText extends docs_v1.Schema$InsertTextRequest {
20
+ }
21
+ export interface ITextStyles extends docs_v1.Schema$UpdateTextStyleRequest {
22
+ }
19
23
  export interface ICredentials extends JWTInput {
20
24
  }
21
25
  export declare class PlennaGoogleService {
@@ -25,6 +29,7 @@ export declare class PlennaGoogleService {
25
29
  getDocument(documentId: string): Promise<docs_v1.Schema$Document | undefined>;
26
30
  cloneDocument(documentId: string, folderId: string): Promise<cloneDocumentResponse>;
27
31
  buildPayload(template?: Array<Partial<IPlennaGoogleBase>>): ISchemaRequest[];
32
+ addTextToRequest(text: IInsertText, style: ITextStyles): ISchemaRequest[];
28
33
  updateDocument(id: string, requests?: ISchemaRequest[]): Promise<updateDocumentResponse>;
29
34
  exportDocumentAsUrl(fileId: string): Promise<string | undefined>;
30
35
  exportDocumentAsFile(fileId: string): Promise<ArrayBuffer | undefined>;
@@ -51,6 +51,16 @@ class PlennaGoogleService {
51
51
  buildPayload(template = []) {
52
52
  return (0, requestBuilder_1.payloadBuilder)(template);
53
53
  }
54
+ addTextToRequest(text, style) {
55
+ return [
56
+ {
57
+ insertText: text
58
+ },
59
+ {
60
+ updateTextStyle: style
61
+ }
62
+ ];
63
+ }
54
64
  async updateDocument(id, requests = []) {
55
65
  const authClient = this.authorization();
56
66
  const client = new docs_1.docs_v1.Docs({ auth: authClient });
@@ -8,7 +8,7 @@ class Mailer {
8
8
  }
9
9
  async sendEmail(templateId, destiny, params) {
10
10
  try {
11
- await fetch('https://api.sendinblue.com/v3/smtp/email', {
11
+ const response = await fetch('https://api.sendinblue.com/v3/smtp/email', {
12
12
  method: 'post',
13
13
  headers: {
14
14
  accept: 'application/json',
@@ -21,9 +21,11 @@ class Mailer {
21
21
  templateId
22
22
  })
23
23
  });
24
+ console.log(JSON.stringify(response));
24
25
  return true;
25
26
  }
26
27
  catch (error) {
28
+ console.log(JSON.stringify(error));
27
29
  console.log('error sending email');
28
30
  return false;
29
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plenna_utilities",
3
- "version": "1.4.1",
3
+ "version": "1.5.1",
4
4
  "description": "plenna's utils for backend projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",