cogfy-messenger 0.1.0 → 0.1.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.
- package/dist/clients/base-client.d.ts +8 -0
- package/dist/clients/base-client.js +9 -0
- package/dist/clients/contacts/contacts-client.d.ts +34 -0
- package/dist/clients/contacts/contacts-client.js +66 -0
- package/dist/clients/contacts/index.d.ts +2 -0
- package/dist/clients/contacts/index.js +18 -0
- package/dist/clients/contacts/types/create-contact.d.ts +15 -0
- package/dist/clients/contacts/types/create-contact.js +2 -0
- package/{src/clients/contacts/types/delete-contact.ts → dist/clients/contacts/types/delete-contact.d.ts} +2 -2
- package/dist/clients/contacts/types/delete-contact.js +2 -0
- package/dist/clients/contacts/types/get-contact.d.ts +18 -0
- package/dist/clients/contacts/types/get-contact.js +2 -0
- package/dist/clients/contacts/types/index.d.ts +5 -0
- package/dist/clients/contacts/types/index.js +21 -0
- package/dist/clients/contacts/types/list-contacts.d.ts +20 -0
- package/dist/clients/contacts/types/list-contacts.js +2 -0
- package/dist/clients/contacts/types/update-contact.d.ts +14 -0
- package/dist/clients/contacts/types/update-contact.js +2 -0
- package/dist/clients/conversations/conversations-client.d.ts +24 -0
- package/dist/clients/conversations/conversations-client.js +57 -0
- package/dist/clients/conversations/index.d.ts +2 -0
- package/dist/clients/conversations/index.js +18 -0
- package/dist/clients/conversations/types/get-conversation.d.ts +11 -0
- package/dist/clients/conversations/types/get-conversation.js +2 -0
- package/dist/clients/conversations/types/get-messages.d.ts +35 -0
- package/dist/clients/conversations/types/get-messages.js +2 -0
- package/dist/clients/conversations/types/index.d.ts +4 -0
- package/dist/clients/conversations/types/index.js +20 -0
- package/dist/clients/conversations/types/list-conversations.d.ts +30 -0
- package/dist/clients/conversations/types/list-conversations.js +2 -0
- package/dist/clients/conversations/types/send-message.d.ts +12 -0
- package/dist/clients/conversations/types/send-message.js +2 -0
- package/dist/clients/index.d.ts +2 -0
- package/dist/clients/index.js +18 -0
- package/dist/clients/tags/index.d.ts +2 -0
- package/dist/clients/tags/index.js +18 -0
- package/dist/clients/tags/tags-client.d.ts +34 -0
- package/dist/clients/tags/tags-client.js +66 -0
- package/{src/clients/tags/types/create-tag.ts → dist/clients/tags/types/create-tag.d.ts} +5 -6
- package/dist/clients/tags/types/create-tag.js +2 -0
- package/dist/clients/tags/types/delete-tag.d.ts +4 -0
- package/dist/clients/tags/types/delete-tag.js +2 -0
- package/dist/clients/tags/types/get-tag.d.ts +4 -0
- package/dist/clients/tags/types/get-tag.js +2 -0
- package/dist/clients/tags/types/index.d.ts +5 -0
- package/dist/clients/tags/types/index.js +21 -0
- package/dist/clients/tags/types/list-tags.d.ts +6 -0
- package/dist/clients/tags/types/list-tags.js +2 -0
- package/{src/clients/tags/types/update-tag.ts → dist/clients/tags/types/update-tag.d.ts} +5 -6
- package/dist/clients/tags/types/update-tag.js +2 -0
- package/dist/cogfy-messenger.d.ts +13 -0
- package/dist/cogfy-messenger.js +27 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +18 -0
- package/package.json +5 -2
- package/.github/workflows/tests.yml +0 -18
- package/src/clients/base-client.ts +0 -13
- package/src/clients/contacts/contacts-client.test.ts +0 -89
- package/src/clients/contacts/contacts-client.ts +0 -49
- package/src/clients/contacts/index.ts +0 -2
- package/src/clients/contacts/types/create-contact.ts +0 -16
- package/src/clients/contacts/types/get-contact.ts +0 -18
- package/src/clients/contacts/types/index.ts +0 -5
- package/src/clients/contacts/types/list-contacts.ts +0 -20
- package/src/clients/contacts/types/update-contact.ts +0 -15
- package/src/clients/conversations/conversations-client.test.ts +0 -56
- package/src/clients/conversations/conversations-client.ts +0 -41
- package/src/clients/conversations/index.ts +0 -2
- package/src/clients/conversations/types/get-conversation.ts +0 -11
- package/src/clients/conversations/types/get-messages.ts +0 -35
- package/src/clients/conversations/types/index.ts +0 -4
- package/src/clients/conversations/types/list-conversations.ts +0 -37
- package/src/clients/conversations/types/send-message.ts +0 -13
- package/src/clients/index.ts +0 -2
- package/src/clients/tags/index.ts +0 -2
- package/src/clients/tags/tags-client.test.ts +0 -80
- package/src/clients/tags/tags-client.ts +0 -49
- package/src/clients/tags/types/delete-tag.ts +0 -4
- package/src/clients/tags/types/get-tag.ts +0 -4
- package/src/clients/tags/types/index.ts +0 -5
- package/src/clients/tags/types/list-tags.ts +0 -6
- package/src/cogfy-messenger.ts +0 -33
- package/src/index.ts +0 -2
- package/tsconfig.json +0 -16
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BaseClient } from '../base-client';
|
|
2
|
+
import { CreateContactCommand, CreateContactResult, DeleteContactResult, GetContactResult, ListContactsResult, UpdateContactCommand, UpdateContactResult } from './types';
|
|
3
|
+
export declare class ContactsClient extends BaseClient {
|
|
4
|
+
/**
|
|
5
|
+
* Calls the POST /contacts endpoint
|
|
6
|
+
* @param contact The contact data to create
|
|
7
|
+
* @returns An object with the ID of the newly created contact
|
|
8
|
+
*/
|
|
9
|
+
create(contact: CreateContactCommand): Promise<CreateContactResult>;
|
|
10
|
+
/**
|
|
11
|
+
* Calls the GET /contacts/:id endpoint
|
|
12
|
+
* @param id The ID of the contact to retrieve
|
|
13
|
+
* @returns The contact with the specified ID
|
|
14
|
+
*/
|
|
15
|
+
get(id: string): Promise<GetContactResult>;
|
|
16
|
+
/**
|
|
17
|
+
* Calls the GET /contacts endpoint
|
|
18
|
+
* @returns A list of all contacts in the workspace
|
|
19
|
+
*/
|
|
20
|
+
list(): Promise<ListContactsResult>;
|
|
21
|
+
/**
|
|
22
|
+
* Calls the PATCH /contacts/:id endpoint
|
|
23
|
+
* @param id The ID of the contact to update
|
|
24
|
+
* @param contact The updated contact data
|
|
25
|
+
* @returns An object with the ID of the updated contact
|
|
26
|
+
*/
|
|
27
|
+
update(id: string, contact: UpdateContactCommand): Promise<UpdateContactResult>;
|
|
28
|
+
/**
|
|
29
|
+
* Calls the DELETE /contacts/:id endpoint
|
|
30
|
+
* @param id The ID of the contact to delete
|
|
31
|
+
* @returns An object with the ID of the deleted contact
|
|
32
|
+
*/
|
|
33
|
+
delete(id: string): Promise<DeleteContactResult>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ContactsClient = void 0;
|
|
13
|
+
const base_client_1 = require("../base-client");
|
|
14
|
+
class ContactsClient extends base_client_1.BaseClient {
|
|
15
|
+
/**
|
|
16
|
+
* Calls the POST /contacts endpoint
|
|
17
|
+
* @param contact The contact data to create
|
|
18
|
+
* @returns An object with the ID of the newly created contact
|
|
19
|
+
*/
|
|
20
|
+
create(contact) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
return (yield this.axios.post('/contacts', contact)).data;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Calls the GET /contacts/:id endpoint
|
|
27
|
+
* @param id The ID of the contact to retrieve
|
|
28
|
+
* @returns The contact with the specified ID
|
|
29
|
+
*/
|
|
30
|
+
get(id) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
return (yield this.axios.get(`/contacts/${id}`)).data;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Calls the GET /contacts endpoint
|
|
37
|
+
* @returns A list of all contacts in the workspace
|
|
38
|
+
*/
|
|
39
|
+
list() {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
return (yield this.axios.get('/contacts')).data;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Calls the PATCH /contacts/:id endpoint
|
|
46
|
+
* @param id The ID of the contact to update
|
|
47
|
+
* @param contact The updated contact data
|
|
48
|
+
* @returns An object with the ID of the updated contact
|
|
49
|
+
*/
|
|
50
|
+
update(id, contact) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
return (yield this.axios.patch(`/contacts/${id}`, contact)).data;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Calls the DELETE /contacts/:id endpoint
|
|
57
|
+
* @param id The ID of the contact to delete
|
|
58
|
+
* @returns An object with the ID of the deleted contact
|
|
59
|
+
*/
|
|
60
|
+
delete(id) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
return (yield this.axios.delete(`/contacts/${id}`)).data;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.ContactsClient = ContactsClient;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./contacts-client"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type CreateContactResult = {
|
|
2
|
+
id: string;
|
|
3
|
+
};
|
|
4
|
+
export type CreateContactCommand = {
|
|
5
|
+
waProfileName: string | null;
|
|
6
|
+
firstName: string | null;
|
|
7
|
+
lastName: string | null;
|
|
8
|
+
email: string | null;
|
|
9
|
+
phone: string | null;
|
|
10
|
+
occupation: string | null;
|
|
11
|
+
gender: string | null;
|
|
12
|
+
birthdate: string | null;
|
|
13
|
+
age: number | null;
|
|
14
|
+
notes: string | null;
|
|
15
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type DeleteContactResult = {
|
|
2
|
-
|
|
3
|
-
}
|
|
2
|
+
id: string;
|
|
3
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type GetContactResult = {
|
|
2
|
+
id: string;
|
|
3
|
+
workspaceId: string;
|
|
4
|
+
statusId: string | null;
|
|
5
|
+
waId: string | null;
|
|
6
|
+
waProfileName: string | null;
|
|
7
|
+
firstName: string | null;
|
|
8
|
+
lastName: string | null;
|
|
9
|
+
email: string | null;
|
|
10
|
+
phone: string | null;
|
|
11
|
+
occupation: string | null;
|
|
12
|
+
gender: string | null;
|
|
13
|
+
birthdate: string | null;
|
|
14
|
+
age: number | null;
|
|
15
|
+
notes: string | null;
|
|
16
|
+
createDate: string;
|
|
17
|
+
updateDate: string;
|
|
18
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./create-contact"), exports);
|
|
18
|
+
__exportStar(require("./update-contact"), exports);
|
|
19
|
+
__exportStar(require("./get-contact"), exports);
|
|
20
|
+
__exportStar(require("./list-contacts"), exports);
|
|
21
|
+
__exportStar(require("./delete-contact"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type ListContactsResult = {
|
|
2
|
+
data: {
|
|
3
|
+
id: string;
|
|
4
|
+
workspaceId: string;
|
|
5
|
+
statusId: string | null;
|
|
6
|
+
waId: string | null;
|
|
7
|
+
waProfileName: string | null;
|
|
8
|
+
firstName: string | null;
|
|
9
|
+
lastName: string | null;
|
|
10
|
+
email: string | null;
|
|
11
|
+
phone: string | null;
|
|
12
|
+
occupation: string | null;
|
|
13
|
+
gender: string | null;
|
|
14
|
+
birthdate: string | null;
|
|
15
|
+
age: number | null;
|
|
16
|
+
notes: string | null;
|
|
17
|
+
createDate: string;
|
|
18
|
+
updateDate: string;
|
|
19
|
+
}[];
|
|
20
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type UpdateContactCommand = {
|
|
2
|
+
firstName: string | null;
|
|
3
|
+
lastName: string | null;
|
|
4
|
+
email: string | null;
|
|
5
|
+
phone: string | null;
|
|
6
|
+
occupation: string | null;
|
|
7
|
+
gender: string | null;
|
|
8
|
+
birthdate: string | null;
|
|
9
|
+
age: number | null;
|
|
10
|
+
notes: string | null;
|
|
11
|
+
};
|
|
12
|
+
export type UpdateContactResult = {
|
|
13
|
+
id: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseClient } from '../base-client';
|
|
2
|
+
import { SendMessageCommand } from './types/send-message';
|
|
3
|
+
import { GetConversationResult, GetMessagesResult, ListConversationsParams, ListConversationsResult, ListMessagesParams } from './types';
|
|
4
|
+
export declare class ConversationsClient extends BaseClient {
|
|
5
|
+
/**
|
|
6
|
+
* Calls the GET /conversations/:id endpoint
|
|
7
|
+
* @param id The ID of the conversation to retrieve
|
|
8
|
+
* @returns The conversation with the specified ID
|
|
9
|
+
*/
|
|
10
|
+
get(id: string): Promise<GetConversationResult>;
|
|
11
|
+
/**
|
|
12
|
+
* Calls the GET /conversations endpoint
|
|
13
|
+
* @param params Params for listing conversations, such as pagination cursors
|
|
14
|
+
* @returns A list of all conversations in the workspace
|
|
15
|
+
*/
|
|
16
|
+
list(params: ListConversationsParams): Promise<ListConversationsResult>;
|
|
17
|
+
/**
|
|
18
|
+
* Calls the GET /conversations/:id/messages endpoint
|
|
19
|
+
* @param params Params for listing messages in a conversation, such as pagination cursors
|
|
20
|
+
* @returns A list of all messages in the specified conversation
|
|
21
|
+
*/
|
|
22
|
+
getMessages(params: ListMessagesParams): Promise<GetMessagesResult>;
|
|
23
|
+
sendMessage(id: string, payload: SendMessageCommand): Promise<any>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ConversationsClient = void 0;
|
|
13
|
+
const base_client_1 = require("../base-client");
|
|
14
|
+
class ConversationsClient extends base_client_1.BaseClient {
|
|
15
|
+
/**
|
|
16
|
+
* Calls the GET /conversations/:id endpoint
|
|
17
|
+
* @param id The ID of the conversation to retrieve
|
|
18
|
+
* @returns The conversation with the specified ID
|
|
19
|
+
*/
|
|
20
|
+
get(id) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
return (yield this.axios.get(`/conversations/${id}`)).data;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Calls the GET /conversations endpoint
|
|
27
|
+
* @param params Params for listing conversations, such as pagination cursors
|
|
28
|
+
* @returns A list of all conversations in the workspace
|
|
29
|
+
*/
|
|
30
|
+
list(params) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const axiosResponse = yield this.axios.get(`/conversations`, {
|
|
33
|
+
params,
|
|
34
|
+
});
|
|
35
|
+
return axiosResponse.data;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Calls the GET /conversations/:id/messages endpoint
|
|
40
|
+
* @param params Params for listing messages in a conversation, such as pagination cursors
|
|
41
|
+
* @returns A list of all messages in the specified conversation
|
|
42
|
+
*/
|
|
43
|
+
getMessages(params) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
const axiosResponse = yield this.axios.get(`/conversations/${params.conversationId}/messages`, {
|
|
46
|
+
params
|
|
47
|
+
});
|
|
48
|
+
return axiosResponse.data;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
sendMessage(id, payload) {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
return (yield this.axios.post(`/conversations/${id}/messages`, payload)).data;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.ConversationsClient = ConversationsClient;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./conversations-client"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type GetConversationResult = {
|
|
2
|
+
id: string;
|
|
3
|
+
workspaceId: string;
|
|
4
|
+
phoneNumberId: string | null;
|
|
5
|
+
recipientId: string | null;
|
|
6
|
+
assigneeId: string | null;
|
|
7
|
+
lastMessageId: string | null;
|
|
8
|
+
data: any | null;
|
|
9
|
+
createDate: string;
|
|
10
|
+
serviceWindowExpireDate: string | null;
|
|
11
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type GetMessagesResult = {
|
|
2
|
+
data: {
|
|
3
|
+
id: string;
|
|
4
|
+
workspaceId: string;
|
|
5
|
+
conversationId: string | null;
|
|
6
|
+
assistantId: string | null;
|
|
7
|
+
userId: string | null;
|
|
8
|
+
broadcastId: string | null;
|
|
9
|
+
whatsappMessageId: string | null;
|
|
10
|
+
from: string | null;
|
|
11
|
+
to: string | null;
|
|
12
|
+
role: string;
|
|
13
|
+
status: string | null;
|
|
14
|
+
type: string | null;
|
|
15
|
+
content: string | null;
|
|
16
|
+
contentData: string | null;
|
|
17
|
+
toolCallId: string | null;
|
|
18
|
+
toolCalls: string | null;
|
|
19
|
+
data: string | null;
|
|
20
|
+
contextId: string | null;
|
|
21
|
+
contextFrom: string | null;
|
|
22
|
+
createDate: Date;
|
|
23
|
+
sendDate: Date;
|
|
24
|
+
deliverDate: Date | null;
|
|
25
|
+
readDate: Date | null;
|
|
26
|
+
promptTokens: number | null;
|
|
27
|
+
completionTokens: number | null;
|
|
28
|
+
order: number;
|
|
29
|
+
traceId: string | null;
|
|
30
|
+
}[];
|
|
31
|
+
cursors: {
|
|
32
|
+
next: string | null;
|
|
33
|
+
prev: string | null;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./get-conversation"), exports);
|
|
18
|
+
__exportStar(require("./get-messages"), exports);
|
|
19
|
+
__exportStar(require("./send-message"), exports);
|
|
20
|
+
__exportStar(require("./list-conversations"), exports);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type ListConversationsParams = {
|
|
2
|
+
phoneNumberId: string;
|
|
3
|
+
cursor?: never;
|
|
4
|
+
} | {
|
|
5
|
+
phoneNumberId?: never;
|
|
6
|
+
cursor: string;
|
|
7
|
+
};
|
|
8
|
+
export type ListMessagesParams = {
|
|
9
|
+
conversationId: string;
|
|
10
|
+
cursor?: never;
|
|
11
|
+
} | {
|
|
12
|
+
conversationId?: never;
|
|
13
|
+
cursor: string;
|
|
14
|
+
};
|
|
15
|
+
export type ListConversationsResult = {
|
|
16
|
+
data: ListConversationsResultData[];
|
|
17
|
+
cursors: {
|
|
18
|
+
next: string | null;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export type ListConversationsResultData = {
|
|
22
|
+
id: string;
|
|
23
|
+
workspaceId: string;
|
|
24
|
+
phoneNumberId: string | null;
|
|
25
|
+
recipientId: string | null;
|
|
26
|
+
assigneeId: string | null;
|
|
27
|
+
lastMessageId: string | null;
|
|
28
|
+
createDate: string;
|
|
29
|
+
serviceWindowExpireDate: string | null;
|
|
30
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./contacts/types"), exports);
|
|
18
|
+
__exportStar(require("./tags/types"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./tags-client"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BaseClient } from '../base-client';
|
|
2
|
+
import { CreateTagCommand, CreateTagResult, DeleteTagResult, GetTagResult, ListTagsResult, UpdateTagCommand, UpdateTagResult } from './types';
|
|
3
|
+
export declare class TagsClient extends BaseClient {
|
|
4
|
+
/**
|
|
5
|
+
* Calls the POST /tags endpoint
|
|
6
|
+
* @param payload The tag data to create
|
|
7
|
+
* @returns An object with the ID and the name of the newly created tag
|
|
8
|
+
*/
|
|
9
|
+
create(payload: CreateTagCommand): Promise<CreateTagResult>;
|
|
10
|
+
/**
|
|
11
|
+
* Calls the DELETE /tags/:id endpoint
|
|
12
|
+
* @param id The ID of the tag to delete
|
|
13
|
+
* @returns An object with the ID and the name of the deleted tag
|
|
14
|
+
*/
|
|
15
|
+
delete(id: string): Promise<DeleteTagResult>;
|
|
16
|
+
/**
|
|
17
|
+
* Calls the GET /tags/:id endpoint
|
|
18
|
+
* @param id The ID of the tag to retrieve
|
|
19
|
+
* @returns The tag with the specified ID
|
|
20
|
+
*/
|
|
21
|
+
get(id: string): Promise<GetTagResult>;
|
|
22
|
+
/**
|
|
23
|
+
* Calls the GET /tags endpoint
|
|
24
|
+
* @returns A list of all tags in the workspace
|
|
25
|
+
*/
|
|
26
|
+
list(): Promise<ListTagsResult>;
|
|
27
|
+
/**
|
|
28
|
+
* Calls the PATCH /tags/:id endpoint
|
|
29
|
+
* @param id The ID of the tag to update
|
|
30
|
+
* @param payload The updated tag data
|
|
31
|
+
* @returns An object with the ID and the name of the updated tag
|
|
32
|
+
*/
|
|
33
|
+
update(id: string, payload: UpdateTagCommand): Promise<UpdateTagResult>;
|
|
34
|
+
}
|