cogfy-messenger 0.1.3 → 0.1.4
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/conversations/conversations-client.d.ts +16 -3
- package/dist/clients/conversations/conversations-client.js +17 -0
- package/dist/clients/conversations/types/index.d.ts +2 -1
- package/dist/clients/conversations/types/index.js +2 -1
- package/dist/clients/conversations/types/send-interactive-order-details-message.d.ts +81 -0
- package/dist/clients/conversations/types/send-interactive-order-details-message.js +2 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseClient } from '../base-client';
|
|
2
|
-
import { SendMessageCommand } from './types/send-message';
|
|
3
|
-
import { GetConversationResult, GetMessagesResult, ListConversationsParams, ListConversationsResult, ListMessagesParams } from './types';
|
|
2
|
+
import { SendMessageCommand, SendMessageResult } from './types/send-message';
|
|
3
|
+
import { GetConversationResult, GetMessagesResult, ListConversationsParams, ListConversationsResult, ListMessagesParams, SendInteractiveOrderDetailsMessageCommand, SendInteractiveOrderDetailsMessageResult } from './types';
|
|
4
4
|
export declare class ConversationsClient extends BaseClient {
|
|
5
5
|
/**
|
|
6
6
|
* Calls the GET /conversations/:id endpoint
|
|
@@ -20,5 +20,18 @@ export declare class ConversationsClient extends BaseClient {
|
|
|
20
20
|
* @returns A list of all messages in the specified conversation
|
|
21
21
|
*/
|
|
22
22
|
getMessages(params: ListMessagesParams): Promise<GetMessagesResult>;
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Calls the POST /conversations/:id/messages/interactive/order-details endpoint
|
|
25
|
+
* @param id The ID of the conversation to send a message to
|
|
26
|
+
* @param payload The message payload to send
|
|
27
|
+
* @returns The response from the API
|
|
28
|
+
*/
|
|
29
|
+
sendInteractiveOrderDetailsMessage(id: string, payload: SendInteractiveOrderDetailsMessageCommand): Promise<SendInteractiveOrderDetailsMessageResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Calls the POST /conversations/:id/messages endpoint
|
|
32
|
+
* @param id The ID of the conversation to send a message to
|
|
33
|
+
* @param payload The message payload to send
|
|
34
|
+
* @returns The response from the API
|
|
35
|
+
*/
|
|
36
|
+
sendMessage(id: string, payload: SendMessageCommand): Promise<SendMessageResult>;
|
|
24
37
|
}
|
|
@@ -48,6 +48,23 @@ class ConversationsClient extends base_client_1.BaseClient {
|
|
|
48
48
|
return axiosResponse.data;
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Calls the POST /conversations/:id/messages/interactive/order-details endpoint
|
|
53
|
+
* @param id The ID of the conversation to send a message to
|
|
54
|
+
* @param payload The message payload to send
|
|
55
|
+
* @returns The response from the API
|
|
56
|
+
*/
|
|
57
|
+
sendInteractiveOrderDetailsMessage(id, payload) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
return (yield this.axios.post(`/conversations/${id}/messages/interactive/order-details`, payload)).data;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Calls the POST /conversations/:id/messages endpoint
|
|
64
|
+
* @param id The ID of the conversation to send a message to
|
|
65
|
+
* @param payload The message payload to send
|
|
66
|
+
* @returns The response from the API
|
|
67
|
+
*/
|
|
51
68
|
sendMessage(id, payload) {
|
|
52
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
70
|
return (yield this.axios.post(`/conversations/${id}/messages`, payload)).data;
|
|
@@ -16,5 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./get-conversation"), exports);
|
|
18
18
|
__exportStar(require("./get-messages"), exports);
|
|
19
|
-
__exportStar(require("./send-message"), exports);
|
|
20
19
|
__exportStar(require("./list-conversations"), exports);
|
|
20
|
+
__exportStar(require("./send-interactive-order-details-message"), exports);
|
|
21
|
+
__exportStar(require("./send-message"), exports);
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export type SendInteractiveOrderDetailsMessageCommand = {
|
|
2
|
+
content: InteractiveOrderDetailsContent;
|
|
3
|
+
};
|
|
4
|
+
export type SendInteractiveOrderDetailsMessageResult = {
|
|
5
|
+
id: string;
|
|
6
|
+
};
|
|
7
|
+
type Amount = {
|
|
8
|
+
value: number;
|
|
9
|
+
offset: number;
|
|
10
|
+
description?: string;
|
|
11
|
+
};
|
|
12
|
+
type PaymentSettingsTypePixDynamicCode = {
|
|
13
|
+
type: 'pix_dynamic_code';
|
|
14
|
+
pix_dynamic_code: {
|
|
15
|
+
code: string;
|
|
16
|
+
merchant_name: string;
|
|
17
|
+
key: string;
|
|
18
|
+
key_type: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
type PaymentSettingsTypePaymentLink = {
|
|
22
|
+
type: 'payment_link';
|
|
23
|
+
payment_link: {
|
|
24
|
+
uri: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
type PaymentSettingsTypeBoleto = {
|
|
28
|
+
type: 'boleto';
|
|
29
|
+
boleto: {
|
|
30
|
+
digitable_line: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
type InteractiveOrderDetailsContent = {
|
|
34
|
+
type: 'order_details';
|
|
35
|
+
body: {
|
|
36
|
+
text: string;
|
|
37
|
+
};
|
|
38
|
+
action: {
|
|
39
|
+
name: string;
|
|
40
|
+
parameters: {
|
|
41
|
+
reference_id: string;
|
|
42
|
+
type: string;
|
|
43
|
+
payment_type: string;
|
|
44
|
+
payment_settings?: Array<PaymentSettingsTypePixDynamicCode | PaymentSettingsTypePaymentLink | PaymentSettingsTypeBoleto>;
|
|
45
|
+
currency: string;
|
|
46
|
+
total_amount: Amount;
|
|
47
|
+
order: {
|
|
48
|
+
status: string;
|
|
49
|
+
catalog_id?: string;
|
|
50
|
+
shipping?: Amount;
|
|
51
|
+
expiration?: {
|
|
52
|
+
description: string;
|
|
53
|
+
timestamp: string;
|
|
54
|
+
};
|
|
55
|
+
tax: Amount;
|
|
56
|
+
discount?: Amount & {
|
|
57
|
+
discount_program_name?: string;
|
|
58
|
+
};
|
|
59
|
+
items: {
|
|
60
|
+
retailer_id: string;
|
|
61
|
+
name: string;
|
|
62
|
+
amount: Amount;
|
|
63
|
+
quantity: number;
|
|
64
|
+
sale_amount?: Amount;
|
|
65
|
+
}[];
|
|
66
|
+
subtotal: Amount;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
header?: {
|
|
71
|
+
type: 'image';
|
|
72
|
+
image: {
|
|
73
|
+
link: string;
|
|
74
|
+
provider?: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
footer?: {
|
|
78
|
+
text: string;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
export {};
|