@raphaelvserafim/client-api-whatsapp 1.0.9 → 1.2.0

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.
Files changed (60) hide show
  1. package/README.md +512 -297
  2. package/dist/WhatsApp.d.ts +139 -33
  3. package/dist/WhatsApp.js +111 -167
  4. package/dist/WhatsApp.js.map +1 -1
  5. package/dist/client/HttpClient.d.ts +6 -0
  6. package/dist/client/HttpClient.js +29 -0
  7. package/dist/client/HttpClient.js.map +1 -0
  8. package/dist/client/IHttpClient.d.ts +9 -0
  9. package/dist/client/IHttpClient.js +3 -0
  10. package/dist/client/IHttpClient.js.map +1 -0
  11. package/dist/errors.d.ts +5 -0
  12. package/dist/errors.js +13 -0
  13. package/dist/errors.js.map +1 -0
  14. package/dist/index.d.ts +14 -1
  15. package/dist/index.js +33 -3
  16. package/dist/index.js.map +1 -1
  17. package/dist/services/ActionService.d.ts +9 -0
  18. package/dist/services/ActionService.js +32 -0
  19. package/dist/services/ActionService.js.map +1 -0
  20. package/dist/services/BusinessService.d.ts +10 -0
  21. package/dist/services/BusinessService.js +43 -0
  22. package/dist/services/BusinessService.js.map +1 -0
  23. package/dist/services/CallService.d.ts +8 -0
  24. package/dist/services/CallService.js +24 -0
  25. package/dist/services/CallService.js.map +1 -0
  26. package/dist/services/ChatService.d.ts +16 -0
  27. package/dist/services/ChatService.js +38 -0
  28. package/dist/services/ChatService.js.map +1 -0
  29. package/dist/services/CommunityService.d.ts +28 -0
  30. package/dist/services/CommunityService.js +76 -0
  31. package/dist/services/CommunityService.js.map +1 -0
  32. package/dist/services/ContactService.d.ts +15 -0
  33. package/dist/services/ContactService.js +30 -0
  34. package/dist/services/ContactService.js.map +1 -0
  35. package/dist/services/GroupService.d.ts +32 -0
  36. package/dist/services/GroupService.js +104 -0
  37. package/dist/services/GroupService.js.map +1 -0
  38. package/dist/services/InstanceService.d.ts +28 -0
  39. package/dist/services/InstanceService.js +124 -0
  40. package/dist/services/InstanceService.js.map +1 -0
  41. package/dist/services/LabelService.d.ts +17 -0
  42. package/dist/services/LabelService.js +43 -0
  43. package/dist/services/LabelService.js.map +1 -0
  44. package/dist/services/MessageService.d.ts +51 -0
  45. package/dist/services/MessageService.js +106 -0
  46. package/dist/services/MessageService.js.map +1 -0
  47. package/dist/types/index.d.ts +155 -11
  48. package/dist/types/index.js +10 -0
  49. package/dist/types/index.js.map +1 -1
  50. package/package.json +6 -11
  51. package/.babelrc +0 -3
  52. package/dist/exemple.d.ts +0 -1
  53. package/dist/exemple.js +0 -264
  54. package/dist/exemple.js.map +0 -1
  55. package/src/WhatsApp.ts +0 -245
  56. package/src/exemple.ts +0 -312
  57. package/src/index.ts +0 -2
  58. package/src/types/index.ts +0 -190
  59. package/tsconfig.compile.json +0 -15
  60. package/tsconfig.json +0 -35
@@ -0,0 +1,5 @@
1
+ export declare class WhatsAppError extends Error {
2
+ readonly statusCode: number | undefined;
3
+ readonly responseBody: unknown;
4
+ constructor(message: string, statusCode?: number, responseBody?: unknown);
5
+ }
package/dist/errors.js ADDED
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WhatsAppError = void 0;
4
+ class WhatsAppError extends Error {
5
+ constructor(message, statusCode, responseBody) {
6
+ super(message);
7
+ this.name = 'WhatsAppError';
8
+ this.statusCode = statusCode;
9
+ this.responseBody = responseBody;
10
+ }
11
+ }
12
+ exports.WhatsAppError = WhatsAppError;
13
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,aAAc,SAAQ,KAAK;IAItC,YAAY,OAAe,EAAE,UAAmB,EAAE,YAAsB;QACtE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF;AAVD,sCAUC","sourcesContent":["export class WhatsAppError extends Error {\n readonly statusCode: number | undefined;\n readonly responseBody: unknown;\n\n constructor(message: string, statusCode?: number, responseBody?: unknown) {\n super(message);\n this.name = 'WhatsAppError';\n this.statusCode = statusCode;\n this.responseBody = responseBody;\n }\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,15 @@
1
- export { TypeMessage, Init, StatusPresence, Contact, Location } from './types';
2
1
  export { WhatsApp } from './WhatsApp';
2
+ export { WhatsAppError } from './errors';
3
+ export { IHttpClient, RequestOptions } from './client/IHttpClient';
4
+ export { HttpClient } from './client/HttpClient';
5
+ export { InstanceService } from './services/InstanceService';
6
+ export { MessageService } from './services/MessageService';
7
+ export { ChatService } from './services/ChatService';
8
+ export { CallService } from './services/CallService';
9
+ export { LabelService } from './services/LabelService';
10
+ export { ActionService } from './services/ActionService';
11
+ export { ContactService } from './services/ContactService';
12
+ export { GroupService } from './services/GroupService';
13
+ export { CommunityService } from './services/CommunityService';
14
+ export { BusinessService } from './services/BusinessService';
15
+ export { Init, HttpMethod, Routes, TypeMessage, StatusPresence, ApiResponse, WebhookBody, Contact, Location, Row, Section, Buttons, Items, HeaderMedia, DownloadableMessage, Product, CommunityCreate, CommunityUpdate, GroupParticipantsAction, InfoInstance, Instance, User, Webhook, BusinessProfile, SendMessageRoot, MessageData, MessageKey, MessageContent, ExtendedTextMessage, Connect, PairingCodeResponse, MobileRegisterData, EventData, RegisteredResponse, ContactInfo, GroupInfo, GroupParticipant, InviteCodeResponse, ChatInfo, LabelInfo, CommunityInfo, CatalogResponse, WebhookStatistics, ListMessagesResponse, DownloadMediaResponse, CallResponse, } from './types';
package/dist/index.js CHANGED
@@ -1,9 +1,39 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WhatsApp = exports.StatusPresence = exports.TypeMessage = void 0;
3
+ exports.StatusPresence = exports.TypeMessage = exports.Routes = exports.HttpMethod = exports.BusinessService = exports.CommunityService = exports.GroupService = exports.ContactService = exports.ActionService = exports.LabelService = exports.CallService = exports.ChatService = exports.MessageService = exports.InstanceService = exports.HttpClient = exports.WhatsAppError = exports.WhatsApp = void 0;
4
+ // Main class
5
+ var WhatsApp_1 = require("./WhatsApp");
6
+ Object.defineProperty(exports, "WhatsApp", { enumerable: true, get: function () { return WhatsApp_1.WhatsApp; } });
7
+ // Error
8
+ var errors_1 = require("./errors");
9
+ Object.defineProperty(exports, "WhatsAppError", { enumerable: true, get: function () { return errors_1.WhatsAppError; } });
10
+ var HttpClient_1 = require("./client/HttpClient");
11
+ Object.defineProperty(exports, "HttpClient", { enumerable: true, get: function () { return HttpClient_1.HttpClient; } });
12
+ // Services
13
+ var InstanceService_1 = require("./services/InstanceService");
14
+ Object.defineProperty(exports, "InstanceService", { enumerable: true, get: function () { return InstanceService_1.InstanceService; } });
15
+ var MessageService_1 = require("./services/MessageService");
16
+ Object.defineProperty(exports, "MessageService", { enumerable: true, get: function () { return MessageService_1.MessageService; } });
17
+ var ChatService_1 = require("./services/ChatService");
18
+ Object.defineProperty(exports, "ChatService", { enumerable: true, get: function () { return ChatService_1.ChatService; } });
19
+ var CallService_1 = require("./services/CallService");
20
+ Object.defineProperty(exports, "CallService", { enumerable: true, get: function () { return CallService_1.CallService; } });
21
+ var LabelService_1 = require("./services/LabelService");
22
+ Object.defineProperty(exports, "LabelService", { enumerable: true, get: function () { return LabelService_1.LabelService; } });
23
+ var ActionService_1 = require("./services/ActionService");
24
+ Object.defineProperty(exports, "ActionService", { enumerable: true, get: function () { return ActionService_1.ActionService; } });
25
+ var ContactService_1 = require("./services/ContactService");
26
+ Object.defineProperty(exports, "ContactService", { enumerable: true, get: function () { return ContactService_1.ContactService; } });
27
+ var GroupService_1 = require("./services/GroupService");
28
+ Object.defineProperty(exports, "GroupService", { enumerable: true, get: function () { return GroupService_1.GroupService; } });
29
+ var CommunityService_1 = require("./services/CommunityService");
30
+ Object.defineProperty(exports, "CommunityService", { enumerable: true, get: function () { return CommunityService_1.CommunityService; } });
31
+ var BusinessService_1 = require("./services/BusinessService");
32
+ Object.defineProperty(exports, "BusinessService", { enumerable: true, get: function () { return BusinessService_1.BusinessService; } });
33
+ // Types
4
34
  var types_1 = require("./types");
35
+ Object.defineProperty(exports, "HttpMethod", { enumerable: true, get: function () { return types_1.HttpMethod; } });
36
+ Object.defineProperty(exports, "Routes", { enumerable: true, get: function () { return types_1.Routes; } });
5
37
  Object.defineProperty(exports, "TypeMessage", { enumerable: true, get: function () { return types_1.TypeMessage; } });
6
38
  Object.defineProperty(exports, "StatusPresence", { enumerable: true, get: function () { return types_1.StatusPresence; } });
7
- var WhatsApp_1 = require("./WhatsApp");
8
- Object.defineProperty(exports, "WhatsApp", { enumerable: true, get: function () { return WhatsApp_1.WhatsApp; } });
9
39
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iCAA+E;AAAtE,oGAAA,WAAW,OAAA;AAAQ,uGAAA,cAAc,OAAA;AAC1C,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA","sourcesContent":["export { TypeMessage, Init, StatusPresence, Contact, Location } from './types';\nexport { WhatsApp } from './WhatsApp';"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,aAAa;AACb,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AAEjB,QAAQ;AACR,mCAAyC;AAAhC,uGAAA,aAAa,OAAA;AAItB,kDAAiD;AAAxC,wGAAA,UAAU,OAAA;AAEnB,WAAW;AACX,8DAA6D;AAApD,kHAAA,eAAe,OAAA;AACxB,4DAA2D;AAAlD,gHAAA,cAAc,OAAA;AACvB,sDAAqD;AAA5C,0GAAA,WAAW,OAAA;AACpB,sDAAqD;AAA5C,0GAAA,WAAW,OAAA;AACpB,wDAAuD;AAA9C,4GAAA,YAAY,OAAA;AACrB,0DAAyD;AAAhD,8GAAA,aAAa,OAAA;AACtB,4DAA2D;AAAlD,gHAAA,cAAc,OAAA;AACvB,wDAAuD;AAA9C,4GAAA,YAAY,OAAA;AACrB,gEAA+D;AAAtD,oHAAA,gBAAgB,OAAA;AACzB,8DAA6D;AAApD,kHAAA,eAAe,OAAA;AAExB,QAAQ;AACR,iCAYiB;AAXT,mGAAA,UAAU,OAAA;AAAE,+FAAA,MAAM,OAAA;AAAE,oGAAA,WAAW,OAAA;AAAE,uGAAA,cAAc,OAAA","sourcesContent":["// Main class\nexport { WhatsApp } from './WhatsApp';\n\n// Error\nexport { WhatsAppError } from './errors';\n\n// Client\nexport { IHttpClient, RequestOptions } from './client/IHttpClient';\nexport { HttpClient } from './client/HttpClient';\n\n// Services\nexport { InstanceService } from './services/InstanceService';\nexport { MessageService } from './services/MessageService';\nexport { ChatService } from './services/ChatService';\nexport { CallService } from './services/CallService';\nexport { LabelService } from './services/LabelService';\nexport { ActionService } from './services/ActionService';\nexport { ContactService } from './services/ContactService';\nexport { GroupService } from './services/GroupService';\nexport { CommunityService } from './services/CommunityService';\nexport { BusinessService } from './services/BusinessService';\n\n// Types\nexport {\n Init, HttpMethod, Routes, TypeMessage, StatusPresence,\n ApiResponse, WebhookBody, Contact, Location, Row, Section,\n Buttons, Items, HeaderMedia, DownloadableMessage, Product,\n CommunityCreate, CommunityUpdate, GroupParticipantsAction,\n InfoInstance, Instance, User, Webhook, BusinessProfile,\n SendMessageRoot, MessageData, MessageKey, MessageContent, ExtendedTextMessage,\n Connect, PairingCodeResponse, MobileRegisterData, EventData,\n RegisteredResponse, ContactInfo, GroupInfo, GroupParticipant,\n InviteCodeResponse, ChatInfo, LabelInfo, CommunityInfo,\n CatalogResponse, WebhookStatistics, ListMessagesResponse,\n DownloadMediaResponse, CallResponse,\n} from './types';\n"]}
@@ -0,0 +1,9 @@
1
+ import { IHttpClient } from '../client/IHttpClient';
2
+ import { ApiResponse, RegisteredResponse, DownloadableMessage, DownloadMediaResponse } from '../types';
3
+ export declare class ActionService {
4
+ private readonly http;
5
+ constructor(http: IHttpClient);
6
+ checkRegistered(number: string): Promise<RegisteredResponse>;
7
+ downloadMedia(type: 'image' | 'video' | 'sticker' | 'audio' | 'document', message: DownloadableMessage): Promise<DownloadMediaResponse>;
8
+ deleteStorage(): Promise<ApiResponse>;
9
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActionService = void 0;
4
+ const types_1 = require("../types");
5
+ class ActionService {
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ async checkRegistered(number) {
10
+ return this.http.request({
11
+ route: `${types_1.Routes.ACTIONS}/registered`,
12
+ method: types_1.HttpMethod.GET,
13
+ params: { number },
14
+ });
15
+ }
16
+ async downloadMedia(type, message) {
17
+ return this.http.request({
18
+ route: `${types_1.Routes.ACTIONS}/download/media`,
19
+ method: types_1.HttpMethod.POST,
20
+ body: message,
21
+ params: { type },
22
+ });
23
+ }
24
+ async deleteStorage() {
25
+ return this.http.request({
26
+ route: `${types_1.Routes.ACTIONS}/storage`,
27
+ method: types_1.HttpMethod.DELETE,
28
+ });
29
+ }
30
+ }
31
+ exports.ActionService = ActionService;
32
+ //# sourceMappingURL=ActionService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionService.js","sourceRoot":"","sources":["../../src/services/ActionService.ts"],"names":[],"mappings":";;;AACA,oCAGkB;AAElB,MAAa,aAAa;IACxB,YAA6B,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAElD,KAAK,CAAC,eAAe,CAAC,MAAc;QAClC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAqB;YAC3C,KAAK,EAAE,GAAG,cAAM,CAAC,OAAO,aAAa;YACrC,MAAM,EAAE,kBAAU,CAAC,GAAG;YACtB,MAAM,EAAE,EAAE,MAAM,EAAE;SACnB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,IAA0D,EAAE,OAA4B;QAC1G,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAwB;YAC9C,KAAK,EAAE,GAAG,cAAM,CAAC,OAAO,iBAAiB;YACzC,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,OAAO;YACb,MAAM,EAAE,EAAE,IAAI,EAAE;SACjB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,OAAO,UAAU;YAClC,MAAM,EAAE,kBAAU,CAAC,MAAM;SAC1B,CAAC,CAAC;IACL,CAAC;CACF;AA1BD,sCA0BC","sourcesContent":["import { IHttpClient } from '../client/IHttpClient';\nimport {\n Routes, HttpMethod, ApiResponse, RegisteredResponse,\n DownloadableMessage, DownloadMediaResponse,\n} from '../types';\n\nexport class ActionService {\n constructor(private readonly http: IHttpClient) {}\n\n async checkRegistered(number: string): Promise<RegisteredResponse> {\n return this.http.request<RegisteredResponse>({\n route: `${Routes.ACTIONS}/registered`,\n method: HttpMethod.GET,\n params: { number },\n });\n }\n\n async downloadMedia(type: 'image' | 'video' | 'sticker' | 'audio' | 'document', message: DownloadableMessage): Promise<DownloadMediaResponse> {\n return this.http.request<DownloadMediaResponse>({\n route: `${Routes.ACTIONS}/download/media`,\n method: HttpMethod.POST,\n body: message,\n params: { type },\n });\n }\n\n async deleteStorage(): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.ACTIONS}/storage`,\n method: HttpMethod.DELETE,\n });\n }\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import { IHttpClient } from '../client/IHttpClient';
2
+ import { ApiResponse, Product, CatalogResponse } from '../types';
3
+ export declare class BusinessService {
4
+ private readonly http;
5
+ constructor(http: IHttpClient);
6
+ getCatalog(limit?: number, cursor?: string): Promise<CatalogResponse>;
7
+ createProduct(product: Product): Promise<ApiResponse>;
8
+ updateProduct(productId: string, product: Product): Promise<ApiResponse>;
9
+ deleteProduct(productId: string): Promise<ApiResponse>;
10
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BusinessService = void 0;
4
+ const types_1 = require("../types");
5
+ class BusinessService {
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ async getCatalog(limit, cursor) {
10
+ const params = {};
11
+ if (limit !== undefined)
12
+ params.limit = limit;
13
+ if (cursor !== undefined)
14
+ params.cursor = cursor;
15
+ return this.http.request({
16
+ route: `${types_1.Routes.BUSINESS}/catalog`,
17
+ method: types_1.HttpMethod.GET,
18
+ params,
19
+ });
20
+ }
21
+ async createProduct(product) {
22
+ return this.http.request({
23
+ route: `${types_1.Routes.BUSINESS}/catalog/product`,
24
+ method: types_1.HttpMethod.POST,
25
+ body: product,
26
+ });
27
+ }
28
+ async updateProduct(productId, product) {
29
+ return this.http.request({
30
+ route: `${types_1.Routes.BUSINESS}/catalog/product/${productId}`,
31
+ method: types_1.HttpMethod.PUT,
32
+ body: product,
33
+ });
34
+ }
35
+ async deleteProduct(productId) {
36
+ return this.http.request({
37
+ route: `${types_1.Routes.BUSINESS}/catalog/product/${productId}`,
38
+ method: types_1.HttpMethod.DELETE,
39
+ });
40
+ }
41
+ }
42
+ exports.BusinessService = BusinessService;
43
+ //# sourceMappingURL=BusinessService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BusinessService.js","sourceRoot":"","sources":["../../src/services/BusinessService.ts"],"names":[],"mappings":";;;AACA,oCAAqF;AAErF,MAAa,eAAe;IAC1B,YAA6B,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAElD,KAAK,CAAC,UAAU,CAAC,KAAc,EAAE,MAAe;QAC9C,MAAM,MAAM,GAAoC,EAAE,CAAC;QACnD,IAAI,KAAK,KAAK,SAAS;YAAE,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;QAC9C,IAAI,MAAM,KAAK,SAAS;YAAE,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;QACjD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAkB;YACxC,KAAK,EAAE,GAAG,cAAM,CAAC,QAAQ,UAAU;YACnC,MAAM,EAAE,kBAAU,CAAC,GAAG;YACtB,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,OAAgB;QAClC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,QAAQ,kBAAkB;YAC3C,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,OAAO;SACd,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,SAAiB,EAAE,OAAgB;QACrD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,QAAQ,oBAAoB,SAAS,EAAE;YACxD,MAAM,EAAE,kBAAU,CAAC,GAAG;YACtB,IAAI,EAAE,OAAO;SACd,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,SAAiB;QACnC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,QAAQ,oBAAoB,SAAS,EAAE;YACxD,MAAM,EAAE,kBAAU,CAAC,MAAM;SAC1B,CAAC,CAAC;IACL,CAAC;CACF;AApCD,0CAoCC","sourcesContent":["import { IHttpClient } from '../client/IHttpClient';\nimport { Routes, HttpMethod, ApiResponse, Product, CatalogResponse } from '../types';\n\nexport class BusinessService {\n constructor(private readonly http: IHttpClient) {}\n\n async getCatalog(limit?: number, cursor?: string): Promise<CatalogResponse> {\n const params: Record<string, string | number> = {};\n if (limit !== undefined) params.limit = limit;\n if (cursor !== undefined) params.cursor = cursor;\n return this.http.request<CatalogResponse>({\n route: `${Routes.BUSINESS}/catalog`,\n method: HttpMethod.GET,\n params,\n });\n }\n\n async createProduct(product: Product): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.BUSINESS}/catalog/product`,\n method: HttpMethod.POST,\n body: product,\n });\n }\n\n async updateProduct(productId: string, product: Product): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.BUSINESS}/catalog/product/${productId}`,\n method: HttpMethod.PUT,\n body: product,\n });\n }\n\n async deleteProduct(productId: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.BUSINESS}/catalog/product/${productId}`,\n method: HttpMethod.DELETE,\n });\n }\n}\n"]}
@@ -0,0 +1,8 @@
1
+ import { IHttpClient } from '../client/IHttpClient';
2
+ import { ApiResponse, CallResponse } from '../types';
3
+ export declare class CallService {
4
+ private readonly http;
5
+ constructor(http: IHttpClient);
6
+ call(to: string, isVideo?: boolean): Promise<CallResponse>;
7
+ reject(id: string, from: string): Promise<ApiResponse>;
8
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CallService = void 0;
4
+ const types_1 = require("../types");
5
+ class CallService {
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ async call(to, isVideo = false) {
10
+ return this.http.request({
11
+ route: types_1.Routes.CALL,
12
+ method: types_1.HttpMethod.POST,
13
+ body: { to, isVideo },
14
+ });
15
+ }
16
+ async reject(id, from) {
17
+ return this.http.request({
18
+ route: `${types_1.Routes.CALL}/${id}/${from}`,
19
+ method: types_1.HttpMethod.DELETE,
20
+ });
21
+ }
22
+ }
23
+ exports.CallService = CallService;
24
+ //# sourceMappingURL=CallService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CallService.js","sourceRoot":"","sources":["../../src/services/CallService.ts"],"names":[],"mappings":";;;AACA,oCAAyE;AAEzE,MAAa,WAAW;IACtB,YAA6B,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAElD,KAAK,CAAC,IAAI,CAAC,EAAU,EAAE,UAAmB,KAAK;QAC7C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAe;YACrC,KAAK,EAAE,cAAM,CAAC,IAAI;YAClB,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE;SACtB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,IAAY;QACnC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,IAAI,IAAI,EAAE,IAAI,IAAI,EAAE;YACrC,MAAM,EAAE,kBAAU,CAAC,MAAM;SAC1B,CAAC,CAAC;IACL,CAAC;CACF;AAjBD,kCAiBC","sourcesContent":["import { IHttpClient } from '../client/IHttpClient';\nimport { Routes, HttpMethod, ApiResponse, CallResponse } from '../types';\n\nexport class CallService {\n constructor(private readonly http: IHttpClient) {}\n\n async call(to: string, isVideo: boolean = false): Promise<CallResponse> {\n return this.http.request<CallResponse>({\n route: Routes.CALL,\n method: HttpMethod.POST,\n body: { to, isVideo },\n });\n }\n\n async reject(id: string, from: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.CALL}/${id}/${from}`,\n method: HttpMethod.DELETE,\n });\n }\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import { IHttpClient } from '../client/IHttpClient';
2
+ import { ApiResponse, ChatInfo, MessageData } from '../types';
3
+ export declare class ChatService {
4
+ private readonly http;
5
+ constructor(http: IHttpClient);
6
+ list(): Promise<{
7
+ status: number;
8
+ data: ChatInfo[];
9
+ }>;
10
+ modify(id: string, action: 'markRead' | 'pin', value: boolean): Promise<ApiResponse>;
11
+ delete(chatId: string): Promise<ApiResponse>;
12
+ messages(chatId: string): Promise<{
13
+ status: number;
14
+ data: MessageData[];
15
+ }>;
16
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChatService = void 0;
4
+ const types_1 = require("../types");
5
+ class ChatService {
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ async list() {
10
+ return this.http.request({
11
+ route: types_1.Routes.CHAT,
12
+ method: types_1.HttpMethod.GET,
13
+ });
14
+ }
15
+ async modify(id, action, value) {
16
+ return this.http.request({
17
+ route: types_1.Routes.CHAT,
18
+ method: types_1.HttpMethod.PATCH,
19
+ params: { id, action, value },
20
+ });
21
+ }
22
+ async delete(chatId) {
23
+ return this.http.request({
24
+ route: types_1.Routes.CHAT,
25
+ method: types_1.HttpMethod.DELETE,
26
+ params: { chatId },
27
+ });
28
+ }
29
+ async messages(chatId) {
30
+ return this.http.request({
31
+ route: `${types_1.Routes.CHAT}/messages`,
32
+ method: types_1.HttpMethod.GET,
33
+ params: { chatId },
34
+ });
35
+ }
36
+ }
37
+ exports.ChatService = ChatService;
38
+ //# sourceMappingURL=ChatService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatService.js","sourceRoot":"","sources":["../../src/services/ChatService.ts"],"names":[],"mappings":";;;AACA,oCAAkF;AAElF,MAAa,WAAW;IACtB,YAA6B,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAElD,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAuC;YAC7D,KAAK,EAAE,cAAM,CAAC,IAAI;YAClB,MAAM,EAAE,kBAAU,CAAC,GAAG;SACvB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,MAA0B,EAAE,KAAc;QACjE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,cAAM,CAAC,IAAI;YAClB,MAAM,EAAE,kBAAU,CAAC,KAAK;YACxB,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;SAC9B,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAAc;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,cAAM,CAAC,IAAI;YAClB,MAAM,EAAE,kBAAU,CAAC,MAAM;YACzB,MAAM,EAAE,EAAE,MAAM,EAAE;SACnB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,MAAc;QAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA0C;YAChE,KAAK,EAAE,GAAG,cAAM,CAAC,IAAI,WAAW;YAChC,MAAM,EAAE,kBAAU,CAAC,GAAG;YACtB,MAAM,EAAE,EAAE,MAAM,EAAE;SACnB,CAAC,CAAC;IACL,CAAC;CACF;AAjCD,kCAiCC","sourcesContent":["import { IHttpClient } from '../client/IHttpClient';\nimport { Routes, HttpMethod, ApiResponse, ChatInfo, MessageData } from '../types';\n\nexport class ChatService {\n constructor(private readonly http: IHttpClient) {}\n\n async list(): Promise<{ status: number; data: ChatInfo[] }> {\n return this.http.request<{ status: number; data: ChatInfo[] }>({\n route: Routes.CHAT,\n method: HttpMethod.GET,\n });\n }\n\n async modify(id: string, action: 'markRead' | 'pin', value: boolean): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: Routes.CHAT,\n method: HttpMethod.PATCH,\n params: { id, action, value },\n });\n }\n\n async delete(chatId: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: Routes.CHAT,\n method: HttpMethod.DELETE,\n params: { chatId },\n });\n }\n\n async messages(chatId: string): Promise<{ status: number; data: MessageData[] }> {\n return this.http.request<{ status: number; data: MessageData[] }>({\n route: `${Routes.CHAT}/messages`,\n method: HttpMethod.GET,\n params: { chatId },\n });\n }\n}\n"]}
@@ -0,0 +1,28 @@
1
+ import { IHttpClient } from '../client/IHttpClient';
2
+ import { ApiResponse, CommunityInfo, InviteCodeResponse, CommunityCreate, CommunityUpdate, GroupParticipant, GroupParticipantsAction } from '../types';
3
+ export declare class CommunityService {
4
+ private readonly http;
5
+ constructor(http: IHttpClient);
6
+ list(): Promise<{
7
+ status: number;
8
+ data: CommunityInfo[];
9
+ }>;
10
+ create(data: CommunityCreate): Promise<{
11
+ status: number;
12
+ data: CommunityInfo;
13
+ }>;
14
+ info(id: string): Promise<{
15
+ status: number;
16
+ data: CommunityInfo;
17
+ }>;
18
+ update(id: string, data: CommunityUpdate): Promise<ApiResponse>;
19
+ leave(id: string): Promise<ApiResponse>;
20
+ updatePicture(id: string, url: string): Promise<ApiResponse>;
21
+ getInviteCode(id: string): Promise<InviteCodeResponse>;
22
+ removeParticipants(id: string, participants: string[]): Promise<ApiResponse>;
23
+ getRequestParticipants(id: string): Promise<{
24
+ status: number;
25
+ data: GroupParticipant[];
26
+ }>;
27
+ updateRequestParticipants(id: string, data: GroupParticipantsAction): Promise<ApiResponse>;
28
+ }
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommunityService = void 0;
4
+ const types_1 = require("../types");
5
+ class CommunityService {
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ async list() {
10
+ return this.http.request({
11
+ route: types_1.Routes.COMMUNITY,
12
+ method: types_1.HttpMethod.GET,
13
+ });
14
+ }
15
+ async create(data) {
16
+ return this.http.request({
17
+ route: types_1.Routes.COMMUNITY,
18
+ method: types_1.HttpMethod.POST,
19
+ body: data,
20
+ });
21
+ }
22
+ async info(id) {
23
+ return this.http.request({
24
+ route: `${types_1.Routes.COMMUNITY}/${id}`,
25
+ method: types_1.HttpMethod.GET,
26
+ });
27
+ }
28
+ async update(id, data) {
29
+ return this.http.request({
30
+ route: `${types_1.Routes.COMMUNITY}/${id}`,
31
+ method: types_1.HttpMethod.PUT,
32
+ body: data,
33
+ });
34
+ }
35
+ async leave(id) {
36
+ return this.http.request({
37
+ route: `${types_1.Routes.COMMUNITY}/${id}`,
38
+ method: types_1.HttpMethod.DELETE,
39
+ });
40
+ }
41
+ async updatePicture(id, url) {
42
+ return this.http.request({
43
+ route: `${types_1.Routes.COMMUNITY}/${id}/picture`,
44
+ method: types_1.HttpMethod.PUT,
45
+ body: { url },
46
+ });
47
+ }
48
+ async getInviteCode(id) {
49
+ return this.http.request({
50
+ route: `${types_1.Routes.COMMUNITY}/${id}/invite`,
51
+ method: types_1.HttpMethod.POST,
52
+ });
53
+ }
54
+ async removeParticipants(id, participants) {
55
+ return this.http.request({
56
+ route: `${types_1.Routes.COMMUNITY}/${id}/participants`,
57
+ method: types_1.HttpMethod.DELETE,
58
+ body: { participants },
59
+ });
60
+ }
61
+ async getRequestParticipants(id) {
62
+ return this.http.request({
63
+ route: `${types_1.Routes.COMMUNITY}/${id}/request_participants_list`,
64
+ method: types_1.HttpMethod.GET,
65
+ });
66
+ }
67
+ async updateRequestParticipants(id, data) {
68
+ return this.http.request({
69
+ route: `${types_1.Routes.COMMUNITY}/${id}/request_participants_list`,
70
+ method: types_1.HttpMethod.PUT,
71
+ body: data,
72
+ });
73
+ }
74
+ }
75
+ exports.CommunityService = CommunityService;
76
+ //# sourceMappingURL=CommunityService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommunityService.js","sourceRoot":"","sources":["../../src/services/CommunityService.ts"],"names":[],"mappings":"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","sourcesContent":["import { IHttpClient } from '../client/IHttpClient';\nimport {\n Routes, HttpMethod, ApiResponse, CommunityInfo, InviteCodeResponse,\n CommunityCreate, CommunityUpdate, GroupParticipant, GroupParticipantsAction,\n} from '../types';\n\nexport class CommunityService {\n constructor(private readonly http: IHttpClient) {}\n\n async list(): Promise<{ status: number; data: CommunityInfo[] }> {\n return this.http.request<{ status: number; data: CommunityInfo[] }>({\n route: Routes.COMMUNITY,\n method: HttpMethod.GET,\n });\n }\n\n async create(data: CommunityCreate): Promise<{ status: number; data: CommunityInfo }> {\n return this.http.request<{ status: number; data: CommunityInfo }>({\n route: Routes.COMMUNITY,\n method: HttpMethod.POST,\n body: data,\n });\n }\n\n async info(id: string): Promise<{ status: number; data: CommunityInfo }> {\n return this.http.request<{ status: number; data: CommunityInfo }>({\n route: `${Routes.COMMUNITY}/${id}`,\n method: HttpMethod.GET,\n });\n }\n\n async update(id: string, data: CommunityUpdate): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}`,\n method: HttpMethod.PUT,\n body: data,\n });\n }\n\n async leave(id: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}`,\n method: HttpMethod.DELETE,\n });\n }\n\n async updatePicture(id: string, url: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}/picture`,\n method: HttpMethod.PUT,\n body: { url },\n });\n }\n\n async getInviteCode(id: string): Promise<InviteCodeResponse> {\n return this.http.request<InviteCodeResponse>({\n route: `${Routes.COMMUNITY}/${id}/invite`,\n method: HttpMethod.POST,\n });\n }\n\n async removeParticipants(id: string, participants: string[]): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}/participants`,\n method: HttpMethod.DELETE,\n body: { participants },\n });\n }\n\n async getRequestParticipants(id: string): Promise<{ status: number; data: GroupParticipant[] }> {\n return this.http.request<{ status: number; data: GroupParticipant[] }>({\n route: `${Routes.COMMUNITY}/${id}/request_participants_list`,\n method: HttpMethod.GET,\n });\n }\n\n async updateRequestParticipants(id: string, data: GroupParticipantsAction): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}/request_participants_list`,\n method: HttpMethod.PUT,\n body: data,\n });\n }\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import { IHttpClient } from '../client/IHttpClient';
2
+ import { ApiResponse, ContactInfo } from '../types';
3
+ export declare class ContactService {
4
+ private readonly http;
5
+ constructor(http: IHttpClient);
6
+ list(): Promise<{
7
+ status: number;
8
+ data: ContactInfo[];
9
+ }>;
10
+ profile(id: string): Promise<{
11
+ status: number;
12
+ data: ContactInfo;
13
+ }>;
14
+ block(number: string, action: 'block' | 'unblock'): Promise<ApiResponse>;
15
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContactService = void 0;
4
+ const types_1 = require("../types");
5
+ class ContactService {
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ async list() {
10
+ return this.http.request({
11
+ route: types_1.Routes.CONTACTS,
12
+ method: types_1.HttpMethod.GET,
13
+ });
14
+ }
15
+ async profile(id) {
16
+ return this.http.request({
17
+ route: `${types_1.Routes.CONTACTS}/${id}`,
18
+ method: types_1.HttpMethod.GET,
19
+ });
20
+ }
21
+ async block(number, action) {
22
+ return this.http.request({
23
+ route: `${types_1.Routes.CONTACTS}/${number}`,
24
+ method: types_1.HttpMethod.PATCH,
25
+ params: { action },
26
+ });
27
+ }
28
+ }
29
+ exports.ContactService = ContactService;
30
+ //# sourceMappingURL=ContactService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContactService.js","sourceRoot":"","sources":["../../src/services/ContactService.ts"],"names":[],"mappings":";;;AACA,oCAAwE;AAExE,MAAa,cAAc;IACzB,YAA6B,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAElD,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA0C;YAChE,KAAK,EAAE,cAAM,CAAC,QAAQ;YACtB,MAAM,EAAE,kBAAU,CAAC,GAAG;SACvB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,EAAU;QACtB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAwC;YAC9D,KAAK,EAAE,GAAG,cAAM,CAAC,QAAQ,IAAI,EAAE,EAAE;YACjC,MAAM,EAAE,kBAAU,CAAC,GAAG;SACvB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,MAAc,EAAE,MAA2B;QACrD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,QAAQ,IAAI,MAAM,EAAE;YACrC,MAAM,EAAE,kBAAU,CAAC,KAAK;YACxB,MAAM,EAAE,EAAE,MAAM,EAAE;SACnB,CAAC,CAAC;IACL,CAAC;CACF;AAxBD,wCAwBC","sourcesContent":["import { IHttpClient } from '../client/IHttpClient';\nimport { Routes, HttpMethod, ApiResponse, ContactInfo } from '../types';\n\nexport class ContactService {\n constructor(private readonly http: IHttpClient) {}\n\n async list(): Promise<{ status: number; data: ContactInfo[] }> {\n return this.http.request<{ status: number; data: ContactInfo[] }>({\n route: Routes.CONTACTS,\n method: HttpMethod.GET,\n });\n }\n\n async profile(id: string): Promise<{ status: number; data: ContactInfo }> {\n return this.http.request<{ status: number; data: ContactInfo }>({\n route: `${Routes.CONTACTS}/${id}`,\n method: HttpMethod.GET,\n });\n }\n\n async block(number: string, action: 'block' | 'unblock'): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.CONTACTS}/${number}`,\n method: HttpMethod.PATCH,\n params: { action },\n });\n }\n}\n"]}
@@ -0,0 +1,32 @@
1
+ import { IHttpClient } from '../client/IHttpClient';
2
+ import { ApiResponse, GroupInfo, InviteCodeResponse, GroupParticipant, GroupParticipantsAction } from '../types';
3
+ export declare class GroupService {
4
+ private readonly http;
5
+ constructor(http: IHttpClient);
6
+ list(): Promise<{
7
+ status: number;
8
+ data: GroupInfo[];
9
+ }>;
10
+ info(id: string): Promise<{
11
+ status: number;
12
+ data: GroupInfo;
13
+ }>;
14
+ create(name: string, participants: string[]): Promise<{
15
+ status: number;
16
+ data: GroupInfo;
17
+ }>;
18
+ update(id: string, name: string, description: string): Promise<ApiResponse>;
19
+ changeSettings(id: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked'): Promise<ApiResponse>;
20
+ leave(id: string): Promise<ApiResponse>;
21
+ getInviteCode(id: string): Promise<InviteCodeResponse>;
22
+ updatePicture(id: string, url: string): Promise<ApiResponse>;
23
+ removePicture(id: string): Promise<ApiResponse>;
24
+ addParticipants(id: string, participants: string[]): Promise<ApiResponse>;
25
+ removeParticipants(id: string, participants: string[]): Promise<ApiResponse>;
26
+ updateParticipantRole(id: string, action: 'promote' | 'demote', participants: string[]): Promise<ApiResponse>;
27
+ getRequestParticipants(id: string): Promise<{
28
+ status: number;
29
+ data: GroupParticipant[];
30
+ }>;
31
+ updateRequestParticipants(id: string, data: GroupParticipantsAction): Promise<ApiResponse>;
32
+ }
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GroupService = void 0;
4
+ const types_1 = require("../types");
5
+ class GroupService {
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ async list() {
10
+ return this.http.request({
11
+ route: types_1.Routes.GROUPS,
12
+ method: types_1.HttpMethod.GET,
13
+ });
14
+ }
15
+ async info(id) {
16
+ return this.http.request({
17
+ route: `${types_1.Routes.GROUPS}/${id}`,
18
+ method: types_1.HttpMethod.GET,
19
+ });
20
+ }
21
+ async create(name, participants) {
22
+ return this.http.request({
23
+ route: types_1.Routes.GROUPS,
24
+ method: types_1.HttpMethod.POST,
25
+ body: { name, participants },
26
+ });
27
+ }
28
+ async update(id, name, description) {
29
+ return this.http.request({
30
+ route: `${types_1.Routes.GROUPS}/${id}`,
31
+ method: types_1.HttpMethod.PUT,
32
+ body: { name, description },
33
+ });
34
+ }
35
+ async changeSettings(id, setting) {
36
+ return this.http.request({
37
+ route: `${types_1.Routes.GROUPS}/${id}`,
38
+ method: types_1.HttpMethod.PATCH,
39
+ params: { setting },
40
+ });
41
+ }
42
+ async leave(id) {
43
+ return this.http.request({
44
+ route: `${types_1.Routes.GROUPS}/${id}`,
45
+ method: types_1.HttpMethod.DELETE,
46
+ });
47
+ }
48
+ async getInviteCode(id) {
49
+ return this.http.request({
50
+ route: `${types_1.Routes.GROUPS}/${id}/invite`,
51
+ method: types_1.HttpMethod.GET,
52
+ });
53
+ }
54
+ async updatePicture(id, url) {
55
+ return this.http.request({
56
+ route: `${types_1.Routes.GROUPS}/${id}/picture`,
57
+ method: types_1.HttpMethod.PUT,
58
+ body: { url },
59
+ });
60
+ }
61
+ async removePicture(id) {
62
+ return this.http.request({
63
+ route: `${types_1.Routes.GROUPS}/${id}/picture`,
64
+ method: types_1.HttpMethod.DELETE,
65
+ });
66
+ }
67
+ async addParticipants(id, participants) {
68
+ return this.http.request({
69
+ route: `${types_1.Routes.GROUPS}/${id}/participants`,
70
+ method: types_1.HttpMethod.POST,
71
+ body: { participants },
72
+ });
73
+ }
74
+ async removeParticipants(id, participants) {
75
+ return this.http.request({
76
+ route: `${types_1.Routes.GROUPS}/${id}/participants`,
77
+ method: types_1.HttpMethod.DELETE,
78
+ body: { participants },
79
+ });
80
+ }
81
+ async updateParticipantRole(id, action, participants) {
82
+ return this.http.request({
83
+ route: `${types_1.Routes.GROUPS}/${id}/role`,
84
+ method: types_1.HttpMethod.PATCH,
85
+ body: { participants },
86
+ params: { action },
87
+ });
88
+ }
89
+ async getRequestParticipants(id) {
90
+ return this.http.request({
91
+ route: `${types_1.Routes.GROUPS}/${id}/request_participants_list`,
92
+ method: types_1.HttpMethod.GET,
93
+ });
94
+ }
95
+ async updateRequestParticipants(id, data) {
96
+ return this.http.request({
97
+ route: `${types_1.Routes.GROUPS}/${id}/request_participants_list`,
98
+ method: types_1.HttpMethod.PUT,
99
+ body: data,
100
+ });
101
+ }
102
+ }
103
+ exports.GroupService = GroupService;
104
+ //# sourceMappingURL=GroupService.js.map