cogfy-messenger 0.1.13 → 0.1.16

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,5 @@
1
1
  import { BaseClient } from '../base-client';
2
- import { CreateContactCommand, CreateContactResult, DeleteContactResult, GetContactResult, ListContactsResult, UpdateContactCommand, UpdateContactResult } from './types';
2
+ import { CreateContactCommand, CreateContactResult, DeleteContactResult, GetContactResult, ListContactsParams, ListContactsResult, UpdateContactCommand, UpdateContactResult, UpdateContactTagsCommand } from './types';
3
3
  export declare class ContactsClient extends BaseClient {
4
4
  /**
5
5
  * Calls the POST /contacts endpoint
@@ -14,10 +14,11 @@ export declare class ContactsClient extends BaseClient {
14
14
  */
15
15
  get(id: string): Promise<GetContactResult>;
16
16
  /**
17
- * Calls the GET /contacts endpoint
18
- * @returns A list of all contacts in the workspace
19
- */
20
- list(): Promise<ListContactsResult>;
17
+ * Calls the GET /contacts endpoint with support for cursor pagination and filters
18
+ * @param params Optional object containing 'cursor' for pagination or 'waId' for filtering
19
+ * @returns A list of contacts and cursor data for the next page
20
+ */
21
+ list(params: ListContactsParams): Promise<ListContactsResult>;
21
22
  /**
22
23
  * Calls the PATCH /contacts/:id endpoint
23
24
  * @param id The ID of the contact to update
@@ -25,6 +26,12 @@ export declare class ContactsClient extends BaseClient {
25
26
  * @returns An object with the ID of the updated contact
26
27
  */
27
28
  update(id: string, contact: UpdateContactCommand): Promise<UpdateContactResult>;
29
+ /**
30
+ * Calls the POST /contacts/:id/tags endpoint
31
+ * @param id The ID of the contact to update tags for
32
+ * @param data The tags to add, remove, or set
33
+ */
34
+ updateTags(id: string, data: UpdateContactTagsCommand): Promise<void>;
28
35
  /**
29
36
  * Calls the DELETE /contacts/:id endpoint
30
37
  * @param id The ID of the contact to delete
@@ -33,12 +33,13 @@ class ContactsClient extends base_client_1.BaseClient {
33
33
  });
34
34
  }
35
35
  /**
36
- * Calls the GET /contacts endpoint
37
- * @returns A list of all contacts in the workspace
38
- */
39
- list() {
36
+ * Calls the GET /contacts endpoint with support for cursor pagination and filters
37
+ * @param params Optional object containing 'cursor' for pagination or 'waId' for filtering
38
+ * @returns A list of contacts and cursor data for the next page
39
+ */
40
+ list(params) {
40
41
  return __awaiter(this, void 0, void 0, function* () {
41
- return (yield this.axios.get('/contacts')).data;
42
+ return (yield this.axios.get('/contacts', { params })).data;
42
43
  });
43
44
  }
44
45
  /**
@@ -52,6 +53,16 @@ class ContactsClient extends base_client_1.BaseClient {
52
53
  return (yield this.axios.patch(`/contacts/${id}`, contact)).data;
53
54
  });
54
55
  }
56
+ /**
57
+ * Calls the POST /contacts/:id/tags endpoint
58
+ * @param id The ID of the contact to update tags for
59
+ * @param data The tags to add, remove, or set
60
+ */
61
+ updateTags(id, data) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ yield this.axios.post(`/contacts/${id}/tags`, data);
64
+ });
65
+ }
55
66
  /**
56
67
  * Calls the DELETE /contacts/:id endpoint
57
68
  * @param id The ID of the contact to delete
@@ -12,4 +12,8 @@ export type CreateContactCommand = {
12
12
  birthdate: string | null;
13
13
  age: number | null;
14
14
  notes: string | null;
15
+ tags: {
16
+ id: string;
17
+ name: string;
18
+ }[] | null;
15
19
  };
@@ -13,6 +13,10 @@ export type GetContactResult = {
13
13
  birthdate: string | null;
14
14
  age: number | null;
15
15
  notes: string | null;
16
+ tags: {
17
+ id: string;
18
+ name: string;
19
+ }[];
16
20
  createDate: string;
17
21
  updateDate: string;
18
22
  };
@@ -1,5 +1,6 @@
1
1
  export * from './create-contact';
2
- export * from './update-contact';
2
+ export * from './delete-contact';
3
3
  export * from './get-contact';
4
4
  export * from './list-contacts';
5
- export * from './delete-contact';
5
+ export * from './update-contact';
6
+ export * from './update-contact-tags';
@@ -15,7 +15,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./create-contact"), exports);
18
- __exportStar(require("./update-contact"), exports);
18
+ __exportStar(require("./delete-contact"), exports);
19
19
  __exportStar(require("./get-contact"), exports);
20
20
  __exportStar(require("./list-contacts"), exports);
21
- __exportStar(require("./delete-contact"), exports);
21
+ __exportStar(require("./update-contact"), exports);
22
+ __exportStar(require("./update-contact-tags"), exports);
@@ -14,7 +14,18 @@ export type ListContactsResult = {
14
14
  birthdate: string | null;
15
15
  age: number | null;
16
16
  notes: string | null;
17
+ tags: {
18
+ id: string;
19
+ name: string;
20
+ }[];
17
21
  createDate: string;
18
22
  updateDate: string;
19
23
  }[];
24
+ cursors: {
25
+ next: string | null;
26
+ };
27
+ };
28
+ export type ListContactsParams = {
29
+ waId?: string;
30
+ cursor?: string;
20
31
  };
@@ -0,0 +1,10 @@
1
+ type Tag = {
2
+ id?: string;
3
+ name?: string;
4
+ };
5
+ export type UpdateContactTagsCommand = {
6
+ add: Tag[];
7
+ remove: Tag[];
8
+ set: Tag[];
9
+ };
10
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -8,6 +8,10 @@ export type UpdateContactCommand = {
8
8
  birthdate: string | null;
9
9
  age: number | null;
10
10
  notes: string | null;
11
+ tags: {
12
+ id: string;
13
+ name: string;
14
+ }[] | null;
11
15
  };
12
16
  export type UpdateContactResult = {
13
17
  id: string;
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "cogfy-messenger",
3
- "version": "0.1.13",
3
+ "version": "0.1.16",
4
4
  "main": "dist/index.js",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/IndigoHive/cogfy-messenger-node"
8
+ },
5
9
  "scripts": {
6
10
  "build": "rimraf dist && tsc",
7
11
  "prepublishOnly": "npm run build",
@@ -23,5 +27,8 @@
23
27
  },
24
28
  "dependencies": {
25
29
  "axios": "^1.11.0"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public"
26
33
  }
27
34
  }