@skravets/eapi 0.0.1 → 0.0.3
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/api-types.d.cts +317 -167
- package/dist/api-types.d.ts +317 -167
- package/dist/index.cjs +111 -88
- package/dist/index.d.cts +144 -65
- package/dist/index.d.ts +144 -65
- package/dist/index.js +111 -88
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ interface ChatStored {
|
|
|
27
27
|
username: string;
|
|
28
28
|
title: string;
|
|
29
29
|
about: string;
|
|
30
|
-
type:
|
|
30
|
+
type: 'group' | 'channel';
|
|
31
31
|
participants_count: number;
|
|
32
32
|
avatar_id: string | null;
|
|
33
33
|
last_offset_id: number;
|
|
@@ -50,9 +50,12 @@ interface MessageStored {
|
|
|
50
50
|
}
|
|
51
51
|
interface PublishersStatusQueueInputChatParsed {
|
|
52
52
|
chat: ChatStored;
|
|
53
|
+
metadata: {
|
|
54
|
+
externalId: string;
|
|
55
|
+
};
|
|
53
56
|
}
|
|
54
57
|
interface ChatParsedTyped extends PublishersStatusQueueInputChatParsed {
|
|
55
|
-
type:
|
|
58
|
+
type: 'chat_parsed';
|
|
56
59
|
}
|
|
57
60
|
interface PublishersStatusQueueInputMessagesParsed {
|
|
58
61
|
chat: {
|
|
@@ -65,15 +68,55 @@ interface PublishersStatusQueueInputMessagesParsed {
|
|
|
65
68
|
plannedEnd: number;
|
|
66
69
|
};
|
|
67
70
|
messages: MessageStored[];
|
|
71
|
+
metadata: {
|
|
72
|
+
externalId: string;
|
|
73
|
+
};
|
|
68
74
|
}
|
|
69
75
|
interface MessagesParsedTyped extends PublishersStatusQueueInputMessagesParsed {
|
|
70
|
-
type:
|
|
76
|
+
type: 'messages_parsed';
|
|
77
|
+
}
|
|
78
|
+
interface PublishersStatusQueueInputJoin {
|
|
79
|
+
metadata: {
|
|
80
|
+
externalId: string;
|
|
81
|
+
};
|
|
82
|
+
chat: {
|
|
83
|
+
username: string;
|
|
84
|
+
};
|
|
85
|
+
account: {
|
|
86
|
+
id: number;
|
|
87
|
+
};
|
|
88
|
+
status: 'UNAVAILABLE' | 'ALREADY_JOINED' | 'JOINED';
|
|
89
|
+
}
|
|
90
|
+
interface PublishersStatusQueueInputJoinResult extends PublishersStatusQueueInputJoin {
|
|
91
|
+
type: 'chat_join_result';
|
|
92
|
+
}
|
|
93
|
+
interface PublishersStatusQueueInputSend {
|
|
94
|
+
metadata: {
|
|
95
|
+
externalId: string;
|
|
96
|
+
};
|
|
97
|
+
chat: {
|
|
98
|
+
id: number;
|
|
99
|
+
username: string;
|
|
100
|
+
};
|
|
101
|
+
account: {
|
|
102
|
+
id: number;
|
|
103
|
+
};
|
|
104
|
+
status: 'SENT' | 'ERROR';
|
|
105
|
+
message?: {
|
|
106
|
+
id: number;
|
|
107
|
+
text: string;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
interface PublishersStatusQueueInputSendResult extends PublishersStatusQueueInputSend {
|
|
111
|
+
type: 'chat_send_result';
|
|
71
112
|
}
|
|
72
113
|
interface EventByType {
|
|
73
114
|
chat_parsed: ChatParsedTyped;
|
|
74
115
|
messages_parsed: MessagesParsedTyped;
|
|
116
|
+
chat_join_result: PublishersStatusQueueInputJoinResult;
|
|
117
|
+
chat_send_result: PublishersStatusQueueInputSendResult;
|
|
75
118
|
}
|
|
76
|
-
type WebhookBody = ChatParsedTyped | MessagesParsedTyped;
|
|
119
|
+
type WebhookBody = ChatParsedTyped | MessagesParsedTyped | PublishersStatusQueueInputJoinResult | PublishersStatusQueueInputSendResult;
|
|
77
120
|
type WebhookBodyTypes = keyof EventByType;
|
|
78
121
|
|
|
79
122
|
declare const frameworks: {
|
|
@@ -142,86 +185,122 @@ declare class EApi {
|
|
|
142
185
|
*/
|
|
143
186
|
app: {
|
|
144
187
|
/**
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
188
|
+
*
|
|
189
|
+
*
|
|
190
|
+
* @tags App
|
|
191
|
+
* @summary Get Hello World!
|
|
192
|
+
*
|
|
193
|
+
* [Documentation](.../App/operation/app.getHello)
|
|
194
|
+
*/
|
|
152
195
|
getHello: (options?: RequestOptions) => Promise<GetResponse<"/", "get">>;
|
|
153
196
|
};
|
|
154
197
|
/**
|
|
155
|
-
* @tags
|
|
198
|
+
* @tags chats
|
|
156
199
|
*/
|
|
157
|
-
|
|
200
|
+
chats: {
|
|
201
|
+
/**
|
|
202
|
+
*
|
|
203
|
+
*
|
|
204
|
+
* @tags chats
|
|
205
|
+
* @summary Get Hello World!
|
|
206
|
+
*
|
|
207
|
+
* [Documentation](.../chats/operation/channels.getHello)
|
|
208
|
+
*/
|
|
209
|
+
getHello: (options?: RequestOptions) => Promise<GetResponse<"/chats", "get">>;
|
|
158
210
|
/**
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
211
|
+
*
|
|
212
|
+
*
|
|
213
|
+
* @tags chats
|
|
214
|
+
* @summary Get last channel message
|
|
215
|
+
*
|
|
216
|
+
* [Documentation](.../chats/operation/channels.getLastMessage)
|
|
217
|
+
*/
|
|
218
|
+
getLastMessage: (chat: paths["/chats/{chat}/last-message"]["get"]["parameters"]["path"]["chat"], options?: RequestOptions) => Promise<GetResponse<"/chats/{chat}/last-message", "get">>;
|
|
167
219
|
/**
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
220
|
+
*
|
|
221
|
+
*
|
|
222
|
+
* @tags chats
|
|
223
|
+
* @summary Get chat messages
|
|
224
|
+
*
|
|
225
|
+
* [Documentation](.../chats/operation/chats.getMessages)
|
|
226
|
+
*/
|
|
227
|
+
getMessages: (chat: paths["/chats/{chat}/new-messages"]["post"]["parameters"]["path"]["chat"], body: GetRequestBody<"/chats/{chat}/new-messages", "post">, options?: RequestOptions) => Promise<GetResponse<"/chats/{chat}/new-messages", "post">>;
|
|
176
228
|
/**
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
229
|
+
*
|
|
230
|
+
*
|
|
231
|
+
* @tags chats
|
|
232
|
+
* @summary Queue chat
|
|
233
|
+
*
|
|
234
|
+
* [Documentation](.../chats/operation/chats.queue)
|
|
235
|
+
*/
|
|
236
|
+
queue: (externalId: paths["/chats/{chat}/queue/{externalId}"]["post"]["parameters"]["path"]["externalId"], chat: paths["/chats/{chat}/queue/{externalId}"]["post"]["parameters"]["path"]["chat"], options?: RequestOptions) => Promise<GetResponse<"/chats/{chat}/queue/{externalId}", "post">>;
|
|
237
|
+
/**
|
|
238
|
+
*
|
|
239
|
+
*
|
|
240
|
+
* @tags chats
|
|
241
|
+
* @summary Add task to join chat
|
|
242
|
+
*
|
|
243
|
+
* [Documentation](.../chats/operation/chats.join)
|
|
244
|
+
*/
|
|
245
|
+
join: (externalId: paths["/chats/{chat}/join/{externalId}"]["post"]["parameters"]["path"]["externalId"], chat: paths["/chats/{chat}/join/{externalId}"]["post"]["parameters"]["path"]["chat"], body: GetRequestBody<"/chats/{chat}/join/{externalId}", "post">, options?: RequestOptions) => Promise<GetResponse<"/chats/{chat}/join/{externalId}", "post">>;
|
|
246
|
+
/**
|
|
247
|
+
*
|
|
248
|
+
*
|
|
249
|
+
* @tags chats
|
|
250
|
+
* @summary Add task to send message
|
|
251
|
+
*
|
|
252
|
+
* [Documentation](.../chats/operation/chats.send)
|
|
253
|
+
*/
|
|
254
|
+
send: (externalId: paths["/chats/{chat}/send/{externalId}"]["post"]["parameters"]["path"]["externalId"], chat: paths["/chats/{chat}/send/{externalId}"]["post"]["parameters"]["path"]["chat"], body: GetRequestBody<"/chats/{chat}/send/{externalId}", "post">, options?: RequestOptions) => Promise<GetResponse<"/chats/{chat}/send/{externalId}", "post">>;
|
|
185
255
|
};
|
|
186
256
|
/**
|
|
187
257
|
* @tags subscriptions
|
|
188
258
|
*/
|
|
189
259
|
subscriptions: {
|
|
190
260
|
/**
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
261
|
+
*
|
|
262
|
+
*
|
|
263
|
+
* @tags Subscriptions
|
|
264
|
+
* @summary Create subscription
|
|
265
|
+
*
|
|
266
|
+
* [Documentation](.../Subscriptions/operation/subscriptions.create)
|
|
267
|
+
*/
|
|
198
268
|
create: (body: GetRequestBody<"/subscriptions", "post">, options?: RequestOptions) => Promise<GetResponse<"/subscriptions", "post">>;
|
|
199
269
|
/**
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
270
|
+
*
|
|
271
|
+
*
|
|
272
|
+
* @tags Subscriptions
|
|
273
|
+
* @summary Upsert subscription
|
|
274
|
+
*
|
|
275
|
+
* [Documentation](.../Subscriptions/operation/subscriptions.upsert)
|
|
276
|
+
*/
|
|
277
|
+
upsert: (body: GetRequestBody<"/subscriptions", "put">, options?: RequestOptions) => Promise<GetResponse<"/subscriptions", "put">>;
|
|
278
|
+
/**
|
|
279
|
+
*
|
|
280
|
+
*
|
|
281
|
+
* @tags Subscriptions
|
|
282
|
+
* @summary Get subscription by subscription id
|
|
283
|
+
*
|
|
284
|
+
* [Documentation](.../Subscriptions/operation/subscriptions.getById)
|
|
285
|
+
*/
|
|
207
286
|
getById: (subId: paths["/subscriptions/{subId}"]["get"]["parameters"]["path"]["subId"], options?: RequestOptions) => Promise<GetResponse<"/subscriptions/{subId}", "get">>;
|
|
208
287
|
/**
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
288
|
+
*
|
|
289
|
+
*
|
|
290
|
+
* @tags Subscriptions
|
|
291
|
+
* @summary Update subscription by subscription id
|
|
292
|
+
*
|
|
293
|
+
* [Documentation](.../Subscriptions/operation/subscriptions.update)
|
|
294
|
+
*/
|
|
216
295
|
update: (subId: paths["/subscriptions/{subId}"]["put"]["parameters"]["path"]["subId"], body: GetRequestBody<"/subscriptions/{subId}", "put">, options?: RequestOptions) => Promise<GetResponse<"/subscriptions/{subId}", "put">>;
|
|
217
296
|
/**
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
297
|
+
*
|
|
298
|
+
*
|
|
299
|
+
* @tags Subscriptions
|
|
300
|
+
* @summary Delete subscription by subscription id
|
|
301
|
+
*
|
|
302
|
+
* [Documentation](.../Subscriptions/operation/subscriptions.delete)
|
|
303
|
+
*/
|
|
225
304
|
delete: (subId: paths["/subscriptions/{subId}"]["delete"]["parameters"]["path"]["subId"], options?: RequestOptions) => Promise<GetResponse<"/subscriptions/{subId}", "delete">>;
|
|
226
305
|
};
|
|
227
306
|
}
|
package/dist/index.js
CHANGED
|
@@ -86,62 +86,86 @@ class EApi {
|
|
|
86
86
|
*/
|
|
87
87
|
app = {
|
|
88
88
|
/**
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
89
|
+
*
|
|
90
|
+
*
|
|
91
|
+
* @tags App
|
|
92
|
+
* @summary Get Hello World!
|
|
93
|
+
*
|
|
94
|
+
* [Documentation](.../App/operation/app.getHello)
|
|
95
|
+
*/
|
|
96
96
|
getHello: (options) => {
|
|
97
97
|
return this.request(`/`, void 0, { method: "GET", ...options });
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
100
|
/**
|
|
101
|
-
* @tags
|
|
101
|
+
* @tags chats
|
|
102
102
|
*/
|
|
103
|
-
|
|
103
|
+
chats = {
|
|
104
104
|
/**
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
105
|
+
*
|
|
106
|
+
*
|
|
107
|
+
* @tags chats
|
|
108
|
+
* @summary Get Hello World!
|
|
109
|
+
*
|
|
110
|
+
* [Documentation](.../chats/operation/channels.getHello)
|
|
111
|
+
*/
|
|
112
112
|
getHello: (options) => {
|
|
113
|
-
return this.request(`/
|
|
114
|
-
method: "GET",
|
|
115
|
-
...options
|
|
116
|
-
});
|
|
113
|
+
return this.request(`/chats`, void 0, { method: "GET", ...options });
|
|
117
114
|
},
|
|
118
115
|
/**
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
getLastMessage: (
|
|
127
|
-
return this.request(`/
|
|
128
|
-
method: "GET",
|
|
129
|
-
...options
|
|
130
|
-
});
|
|
116
|
+
*
|
|
117
|
+
*
|
|
118
|
+
* @tags chats
|
|
119
|
+
* @summary Get last channel message
|
|
120
|
+
*
|
|
121
|
+
* [Documentation](.../chats/operation/channels.getLastMessage)
|
|
122
|
+
*/
|
|
123
|
+
getLastMessage: (chat, options) => {
|
|
124
|
+
return this.request(`/chats/${chat}/last-message`, void 0, { method: "GET", ...options });
|
|
131
125
|
},
|
|
132
126
|
/**
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
getMessages: (
|
|
141
|
-
return this.request(`/
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
127
|
+
*
|
|
128
|
+
*
|
|
129
|
+
* @tags chats
|
|
130
|
+
* @summary Get chat messages
|
|
131
|
+
*
|
|
132
|
+
* [Documentation](.../chats/operation/chats.getMessages)
|
|
133
|
+
*/
|
|
134
|
+
getMessages: (chat, body, options) => {
|
|
135
|
+
return this.request(`/chats/${chat}/new-messages`, body, { method: "POST", ...options });
|
|
136
|
+
},
|
|
137
|
+
/**
|
|
138
|
+
*
|
|
139
|
+
*
|
|
140
|
+
* @tags chats
|
|
141
|
+
* @summary Queue chat
|
|
142
|
+
*
|
|
143
|
+
* [Documentation](.../chats/operation/chats.queue)
|
|
144
|
+
*/
|
|
145
|
+
queue: (externalId, chat, options) => {
|
|
146
|
+
return this.request(`/chats/${chat}/queue/${externalId}`, void 0, { method: "POST", ...options });
|
|
147
|
+
},
|
|
148
|
+
/**
|
|
149
|
+
*
|
|
150
|
+
*
|
|
151
|
+
* @tags chats
|
|
152
|
+
* @summary Add task to join chat
|
|
153
|
+
*
|
|
154
|
+
* [Documentation](.../chats/operation/chats.join)
|
|
155
|
+
*/
|
|
156
|
+
join: (externalId, chat, body, options) => {
|
|
157
|
+
return this.request(`/chats/${chat}/join/${externalId}`, body, { method: "POST", ...options });
|
|
158
|
+
},
|
|
159
|
+
/**
|
|
160
|
+
*
|
|
161
|
+
*
|
|
162
|
+
* @tags chats
|
|
163
|
+
* @summary Add task to send message
|
|
164
|
+
*
|
|
165
|
+
* [Documentation](.../chats/operation/chats.send)
|
|
166
|
+
*/
|
|
167
|
+
send: (externalId, chat, body, options) => {
|
|
168
|
+
return this.request(`/chats/${chat}/send/${externalId}`, body, { method: "POST", ...options });
|
|
145
169
|
}
|
|
146
170
|
};
|
|
147
171
|
/**
|
|
@@ -149,60 +173,59 @@ class EApi {
|
|
|
149
173
|
*/
|
|
150
174
|
subscriptions = {
|
|
151
175
|
/**
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
176
|
+
*
|
|
177
|
+
*
|
|
178
|
+
* @tags Subscriptions
|
|
179
|
+
* @summary Create subscription
|
|
180
|
+
*
|
|
181
|
+
* [Documentation](.../Subscriptions/operation/subscriptions.create)
|
|
182
|
+
*/
|
|
159
183
|
create: (body, options) => {
|
|
160
|
-
return this.request(`/subscriptions`, body, {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
184
|
+
return this.request(`/subscriptions`, body, { method: "POST", ...options });
|
|
185
|
+
},
|
|
186
|
+
/**
|
|
187
|
+
*
|
|
188
|
+
*
|
|
189
|
+
* @tags Subscriptions
|
|
190
|
+
* @summary Upsert subscription
|
|
191
|
+
*
|
|
192
|
+
* [Documentation](.../Subscriptions/operation/subscriptions.upsert)
|
|
193
|
+
*/
|
|
194
|
+
upsert: (body, options) => {
|
|
195
|
+
return this.request(`/subscriptions`, body, { method: "PUT", ...options });
|
|
164
196
|
},
|
|
165
197
|
/**
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
198
|
+
*
|
|
199
|
+
*
|
|
200
|
+
* @tags Subscriptions
|
|
201
|
+
* @summary Get subscription by subscription id
|
|
202
|
+
*
|
|
203
|
+
* [Documentation](.../Subscriptions/operation/subscriptions.getById)
|
|
204
|
+
*/
|
|
173
205
|
getById: (subId, options) => {
|
|
174
|
-
return this.request(`/subscriptions/${subId}`, void 0, {
|
|
175
|
-
method: "GET",
|
|
176
|
-
...options
|
|
177
|
-
});
|
|
206
|
+
return this.request(`/subscriptions/${subId}`, void 0, { method: "GET", ...options });
|
|
178
207
|
},
|
|
179
208
|
/**
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
209
|
+
*
|
|
210
|
+
*
|
|
211
|
+
* @tags Subscriptions
|
|
212
|
+
* @summary Update subscription by subscription id
|
|
213
|
+
*
|
|
214
|
+
* [Documentation](.../Subscriptions/operation/subscriptions.update)
|
|
215
|
+
*/
|
|
187
216
|
update: (subId, body, options) => {
|
|
188
|
-
return this.request(`/subscriptions/${subId}`, body, {
|
|
189
|
-
method: "PUT",
|
|
190
|
-
...options
|
|
191
|
-
});
|
|
217
|
+
return this.request(`/subscriptions/${subId}`, body, { method: "PUT", ...options });
|
|
192
218
|
},
|
|
193
219
|
/**
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
220
|
+
*
|
|
221
|
+
*
|
|
222
|
+
* @tags Subscriptions
|
|
223
|
+
* @summary Delete subscription by subscription id
|
|
224
|
+
*
|
|
225
|
+
* [Documentation](.../Subscriptions/operation/subscriptions.delete)
|
|
226
|
+
*/
|
|
201
227
|
delete: (subId, options) => {
|
|
202
|
-
return this.request(`/subscriptions/${subId}`, void 0, {
|
|
203
|
-
method: "DELETE",
|
|
204
|
-
...options
|
|
205
|
-
});
|
|
228
|
+
return this.request(`/subscriptions/${subId}`, void 0, { method: "DELETE", ...options });
|
|
206
229
|
}
|
|
207
230
|
};
|
|
208
231
|
/** @generated stop-generate-methods */
|