@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/index.cjs CHANGED
@@ -88,62 +88,86 @@ class EApi {
88
88
  */
89
89
  app = {
90
90
  /**
91
- *
92
- *
93
- * @tags App
94
- * @summary Get Hello World!
95
- *
96
- * [Documentation](.../App/operation/app.getHello)
97
- */
91
+ *
92
+ *
93
+ * @tags App
94
+ * @summary Get Hello World!
95
+ *
96
+ * [Documentation](.../App/operation/app.getHello)
97
+ */
98
98
  getHello: (options) => {
99
99
  return this.request(`/`, void 0, { method: "GET", ...options });
100
100
  }
101
101
  };
102
102
  /**
103
- * @tags channels
103
+ * @tags chats
104
104
  */
105
- channels = {
105
+ chats = {
106
106
  /**
107
- *
108
- *
109
- * @tags Channels
110
- * @summary Get Hello World!
111
- *
112
- * [Documentation](.../Channels/operation/channels.getHello)
113
- */
107
+ *
108
+ *
109
+ * @tags chats
110
+ * @summary Get Hello World!
111
+ *
112
+ * [Documentation](.../chats/operation/channels.getHello)
113
+ */
114
114
  getHello: (options) => {
115
- return this.request(`/channels`, void 0, {
116
- method: "GET",
117
- ...options
118
- });
115
+ return this.request(`/chats`, void 0, { method: "GET", ...options });
119
116
  },
120
117
  /**
121
- *
122
- *
123
- * @tags Channels
124
- * @summary Get last channel message
125
- *
126
- * [Documentation](.../Channels/operation/channels.getLastMessage)
127
- */
128
- getLastMessage: (channelId, options) => {
129
- return this.request(`/channels/${channelId}/last-message`, void 0, {
130
- method: "GET",
131
- ...options
132
- });
118
+ *
119
+ *
120
+ * @tags chats
121
+ * @summary Get last channel message
122
+ *
123
+ * [Documentation](.../chats/operation/channels.getLastMessage)
124
+ */
125
+ getLastMessage: (chat, options) => {
126
+ return this.request(`/chats/${chat}/last-message`, void 0, { method: "GET", ...options });
133
127
  },
134
128
  /**
135
- *
136
- *
137
- * @tags Channels
138
- * @summary Get channel messages
139
- *
140
- * [Documentation](.../Channels/operation/channels.getMessages)
141
- */
142
- getMessages: (channelId, body, options) => {
143
- return this.request(`/channels/${channelId}/new-messages`, body, {
144
- method: "POST",
145
- ...options
146
- });
129
+ *
130
+ *
131
+ * @tags chats
132
+ * @summary Get chat messages
133
+ *
134
+ * [Documentation](.../chats/operation/chats.getMessages)
135
+ */
136
+ getMessages: (chat, body, options) => {
137
+ return this.request(`/chats/${chat}/new-messages`, body, { method: "POST", ...options });
138
+ },
139
+ /**
140
+ *
141
+ *
142
+ * @tags chats
143
+ * @summary Queue chat
144
+ *
145
+ * [Documentation](.../chats/operation/chats.queue)
146
+ */
147
+ queue: (externalId, chat, options) => {
148
+ return this.request(`/chats/${chat}/queue/${externalId}`, void 0, { method: "POST", ...options });
149
+ },
150
+ /**
151
+ *
152
+ *
153
+ * @tags chats
154
+ * @summary Add task to join chat
155
+ *
156
+ * [Documentation](.../chats/operation/chats.join)
157
+ */
158
+ join: (externalId, chat, body, options) => {
159
+ return this.request(`/chats/${chat}/join/${externalId}`, body, { method: "POST", ...options });
160
+ },
161
+ /**
162
+ *
163
+ *
164
+ * @tags chats
165
+ * @summary Add task to send message
166
+ *
167
+ * [Documentation](.../chats/operation/chats.send)
168
+ */
169
+ send: (externalId, chat, body, options) => {
170
+ return this.request(`/chats/${chat}/send/${externalId}`, body, { method: "POST", ...options });
147
171
  }
148
172
  };
149
173
  /**
@@ -151,60 +175,59 @@ class EApi {
151
175
  */
152
176
  subscriptions = {
153
177
  /**
154
- *
155
- *
156
- * @tags Subscriptions
157
- * @summary Create subscription
158
- *
159
- * [Documentation](.../Subscriptions/operation/subscriptions.create)
160
- */
178
+ *
179
+ *
180
+ * @tags Subscriptions
181
+ * @summary Create subscription
182
+ *
183
+ * [Documentation](.../Subscriptions/operation/subscriptions.create)
184
+ */
161
185
  create: (body, options) => {
162
- return this.request(`/subscriptions`, body, {
163
- method: "POST",
164
- ...options
165
- });
186
+ return this.request(`/subscriptions`, body, { method: "POST", ...options });
187
+ },
188
+ /**
189
+ *
190
+ *
191
+ * @tags Subscriptions
192
+ * @summary Upsert subscription
193
+ *
194
+ * [Documentation](.../Subscriptions/operation/subscriptions.upsert)
195
+ */
196
+ upsert: (body, options) => {
197
+ return this.request(`/subscriptions`, body, { method: "PUT", ...options });
166
198
  },
167
199
  /**
168
- *
169
- *
170
- * @tags Subscriptions
171
- * @summary Get subscription by subscription id
172
- *
173
- * [Documentation](.../Subscriptions/operation/subscriptions.getById)
174
- */
200
+ *
201
+ *
202
+ * @tags Subscriptions
203
+ * @summary Get subscription by subscription id
204
+ *
205
+ * [Documentation](.../Subscriptions/operation/subscriptions.getById)
206
+ */
175
207
  getById: (subId, options) => {
176
- return this.request(`/subscriptions/${subId}`, void 0, {
177
- method: "GET",
178
- ...options
179
- });
208
+ return this.request(`/subscriptions/${subId}`, void 0, { method: "GET", ...options });
180
209
  },
181
210
  /**
182
- *
183
- *
184
- * @tags Subscriptions
185
- * @summary Update subscription by subscription id
186
- *
187
- * [Documentation](.../Subscriptions/operation/subscriptions.update)
188
- */
211
+ *
212
+ *
213
+ * @tags Subscriptions
214
+ * @summary Update subscription by subscription id
215
+ *
216
+ * [Documentation](.../Subscriptions/operation/subscriptions.update)
217
+ */
189
218
  update: (subId, body, options) => {
190
- return this.request(`/subscriptions/${subId}`, body, {
191
- method: "PUT",
192
- ...options
193
- });
219
+ return this.request(`/subscriptions/${subId}`, body, { method: "PUT", ...options });
194
220
  },
195
221
  /**
196
- *
197
- *
198
- * @tags Subscriptions
199
- * @summary Delete subscription by subscription id
200
- *
201
- * [Documentation](.../Subscriptions/operation/subscriptions.delete)
202
- */
222
+ *
223
+ *
224
+ * @tags Subscriptions
225
+ * @summary Delete subscription by subscription id
226
+ *
227
+ * [Documentation](.../Subscriptions/operation/subscriptions.delete)
228
+ */
203
229
  delete: (subId, options) => {
204
- return this.request(`/subscriptions/${subId}`, void 0, {
205
- method: "DELETE",
206
- ...options
207
- });
230
+ return this.request(`/subscriptions/${subId}`, void 0, { method: "DELETE", ...options });
208
231
  }
209
232
  };
210
233
  /** @generated stop-generate-methods */
package/dist/index.d.cts CHANGED
@@ -27,7 +27,7 @@ interface ChatStored {
27
27
  username: string;
28
28
  title: string;
29
29
  about: string;
30
- type: "group" | "channel";
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: "chat_parsed";
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: "messages_parsed";
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
- * @tags App
148
- * @summary Get Hello World!
149
- *
150
- * [Documentation](.../App/operation/app.getHello)
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 channels
198
+ * @tags chats
156
199
  */
157
- channels: {
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
- * @tags Channels
162
- * @summary Get Hello World!
163
- *
164
- * [Documentation](.../Channels/operation/channels.getHello)
165
- */
166
- getHello: (options?: RequestOptions) => Promise<GetResponse<"/channels", "get">>;
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
- * @tags Channels
171
- * @summary Get last channel message
172
- *
173
- * [Documentation](.../Channels/operation/channels.getLastMessage)
174
- */
175
- getLastMessage: (channelId: paths["/channels/{channelId}/last-message"]["get"]["parameters"]["path"]["channelId"], options?: RequestOptions) => Promise<GetResponse<"/channels/{channelId}/last-message", "get">>;
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
- * @tags Channels
180
- * @summary Get channel messages
181
- *
182
- * [Documentation](.../Channels/operation/channels.getMessages)
183
- */
184
- getMessages: (channelId: paths["/channels/{channelId}/new-messages"]["post"]["parameters"]["path"]["channelId"], body: GetRequestBody<"/channels/{channelId}/new-messages", "post">, options?: RequestOptions) => Promise<GetResponse<"/channels/{channelId}/new-messages", "post">>;
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
- * @tags Subscriptions
194
- * @summary Create subscription
195
- *
196
- * [Documentation](.../Subscriptions/operation/subscriptions.create)
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
- * @tags Subscriptions
203
- * @summary Get subscription by subscription id
204
- *
205
- * [Documentation](.../Subscriptions/operation/subscriptions.getById)
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
- * @tags Subscriptions
212
- * @summary Update subscription by subscription id
213
- *
214
- * [Documentation](.../Subscriptions/operation/subscriptions.update)
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
- * @tags Subscriptions
221
- * @summary Delete subscription by subscription id
222
- *
223
- * [Documentation](.../Subscriptions/operation/subscriptions.delete)
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
  }