teleleo 0.0.0-stage → 0.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 (140) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/LICENSE +21 -0
  3. package/README.md +236 -2
  4. package/api.md +187 -0
  5. package/dist/client.d.ts +28 -0
  6. package/dist/client.d.ts.map +1 -0
  7. package/dist/client.js +27 -0
  8. package/dist/client.js.map +1 -0
  9. package/dist/core.d.ts +66 -0
  10. package/dist/core.d.ts.map +1 -0
  11. package/dist/core.js +195 -0
  12. package/dist/core.js.map +1 -0
  13. package/dist/errors.d.ts +92 -0
  14. package/dist/errors.d.ts.map +1 -0
  15. package/dist/errors.js +163 -0
  16. package/dist/errors.js.map +1 -0
  17. package/dist/index.d.ts +23 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +23 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/pagination.d.ts +41 -0
  22. package/dist/pagination.d.ts.map +1 -0
  23. package/dist/pagination.js +98 -0
  24. package/dist/pagination.js.map +1 -0
  25. package/dist/resource.d.ts +7 -0
  26. package/dist/resource.d.ts.map +1 -0
  27. package/dist/resource.js +8 -0
  28. package/dist/resource.js.map +1 -0
  29. package/dist/resources/call-scenarios.d.ts +77 -0
  30. package/dist/resources/call-scenarios.d.ts.map +1 -0
  31. package/dist/resources/call-scenarios.js +137 -0
  32. package/dist/resources/call-scenarios.js.map +1 -0
  33. package/dist/resources/calls.d.ts +69 -0
  34. package/dist/resources/calls.d.ts.map +1 -0
  35. package/dist/resources/calls.js +109 -0
  36. package/dist/resources/calls.js.map +1 -0
  37. package/dist/resources/contact-groups.d.ts +65 -0
  38. package/dist/resources/contact-groups.d.ts.map +1 -0
  39. package/dist/resources/contact-groups.js +99 -0
  40. package/dist/resources/contact-groups.js.map +1 -0
  41. package/dist/resources/contacts.d.ts +75 -0
  42. package/dist/resources/contacts.d.ts.map +1 -0
  43. package/dist/resources/contacts.js +132 -0
  44. package/dist/resources/contacts.js.map +1 -0
  45. package/dist/resources/dongles.d.ts +201 -0
  46. package/dist/resources/dongles.d.ts.map +1 -0
  47. package/dist/resources/dongles.js +296 -0
  48. package/dist/resources/dongles.js.map +1 -0
  49. package/dist/resources/files.d.ts +52 -0
  50. package/dist/resources/files.d.ts.map +1 -0
  51. package/dist/resources/files.js +73 -0
  52. package/dist/resources/files.js.map +1 -0
  53. package/dist/resources/follow-up-sms-settings.d.ts +65 -0
  54. package/dist/resources/follow-up-sms-settings.d.ts.map +1 -0
  55. package/dist/resources/follow-up-sms-settings.js +111 -0
  56. package/dist/resources/follow-up-sms-settings.js.map +1 -0
  57. package/dist/resources/index.d.ts +50 -0
  58. package/dist/resources/index.d.ts.map +1 -0
  59. package/dist/resources/index.js +36 -0
  60. package/dist/resources/index.js.map +1 -0
  61. package/dist/resources/mailings.d.ts +85 -0
  62. package/dist/resources/mailings.d.ts.map +1 -0
  63. package/dist/resources/mailings.js +191 -0
  64. package/dist/resources/mailings.js.map +1 -0
  65. package/dist/resources/public-vpn.d.ts +51 -0
  66. package/dist/resources/public-vpn.d.ts.map +1 -0
  67. package/dist/resources/public-vpn.js +67 -0
  68. package/dist/resources/public-vpn.js.map +1 -0
  69. package/dist/resources/redirections.d.ts +65 -0
  70. package/dist/resources/redirections.d.ts.map +1 -0
  71. package/dist/resources/redirections.js +113 -0
  72. package/dist/resources/redirections.js.map +1 -0
  73. package/dist/resources/sip-users.d.ts +30 -0
  74. package/dist/resources/sip-users.d.ts.map +1 -0
  75. package/dist/resources/sip-users.js +40 -0
  76. package/dist/resources/sip-users.js.map +1 -0
  77. package/dist/resources/sms.d.ts +116 -0
  78. package/dist/resources/sms.d.ts.map +1 -0
  79. package/dist/resources/sms.js +203 -0
  80. package/dist/resources/sms.js.map +1 -0
  81. package/dist/resources/socks-proxies.d.ts +65 -0
  82. package/dist/resources/socks-proxies.d.ts.map +1 -0
  83. package/dist/resources/socks-proxies.js +91 -0
  84. package/dist/resources/socks-proxies.js.map +1 -0
  85. package/dist/resources/ussd.d.ts +71 -0
  86. package/dist/resources/ussd.d.ts.map +1 -0
  87. package/dist/resources/ussd.js +89 -0
  88. package/dist/resources/ussd.js.map +1 -0
  89. package/dist/types/enums.d.ts +280 -0
  90. package/dist/types/enums.d.ts.map +1 -0
  91. package/dist/types/enums.js +233 -0
  92. package/dist/types/enums.js.map +1 -0
  93. package/dist/types/index.d.ts +4 -0
  94. package/dist/types/index.d.ts.map +1 -0
  95. package/dist/types/index.js +5 -0
  96. package/dist/types/index.js.map +1 -0
  97. package/dist/types/models.d.ts +686 -0
  98. package/dist/types/models.d.ts.map +1 -0
  99. package/dist/types/models.js +3 -0
  100. package/dist/types/models.js.map +1 -0
  101. package/dist/types/params.d.ts +711 -0
  102. package/dist/types/params.d.ts.map +1 -0
  103. package/dist/types/params.js +3 -0
  104. package/dist/types/params.js.map +1 -0
  105. package/dist/utils.d.ts +32 -0
  106. package/dist/utils.d.ts.map +1 -0
  107. package/dist/utils.js +118 -0
  108. package/dist/utils.js.map +1 -0
  109. package/dist/version.d.ts +2 -0
  110. package/dist/version.d.ts.map +1 -0
  111. package/dist/version.js +2 -0
  112. package/dist/version.js.map +1 -0
  113. package/package.json +63 -4
  114. package/src/client.ts +42 -0
  115. package/src/core.ts +278 -0
  116. package/src/errors.ts +170 -0
  117. package/src/index.ts +46 -0
  118. package/src/pagination.ts +110 -0
  119. package/src/resource.ts +10 -0
  120. package/src/resources/call-scenarios.ts +154 -0
  121. package/src/resources/calls.ts +117 -0
  122. package/src/resources/contact-groups.ts +115 -0
  123. package/src/resources/contacts.ts +149 -0
  124. package/src/resources/dongles.ts +346 -0
  125. package/src/resources/files.ts +79 -0
  126. package/src/resources/follow-up-sms-settings.ts +130 -0
  127. package/src/resources/index.ts +86 -0
  128. package/src/resources/mailings.ts +207 -0
  129. package/src/resources/public-vpn.ts +72 -0
  130. package/src/resources/redirections.ts +129 -0
  131. package/src/resources/sip-users.ts +44 -0
  132. package/src/resources/sms.ts +232 -0
  133. package/src/resources/socks-proxies.ts +107 -0
  134. package/src/resources/ussd.ts +97 -0
  135. package/src/types/enums.ts +300 -0
  136. package/src/types/index.ts +5 -0
  137. package/src/types/models.ts +747 -0
  138. package/src/types/params.ts +767 -0
  139. package/src/utils.ts +123 -0
  140. package/src/version.ts +1 -0
@@ -0,0 +1,130 @@
1
+ // File generated from spec/openapi.yaml by scripts/generate.mjs. Do not edit by hand.
2
+
3
+ import type { RequestOptions } from '../core.js';
4
+ import type { PagePromise } from '../pagination.js';
5
+ import { APIResource } from '../resource.js';
6
+ import type { FollowUpSmsSetting } from '../types/models.js';
7
+ import type {
8
+ FollowUpSmsSettingsCreateParams,
9
+ FollowUpSmsSettingsListParams,
10
+ FollowUpSmsSettingsUpdateParams,
11
+ } from '../types/params.js';
12
+ import { asStatus, pathParam } from '../utils.js';
13
+ /** SMS a modem sends to a caller after a call. */
14
+ export class FollowUpSmsSettingsResource extends APIResource {
15
+ /**
16
+ * List follow-up SMS settings.
17
+ *
18
+ * Follow-up SMS settings of the account: the SMS a modem sends to a caller after a call. Newest first by default (the id descending).
19
+ *
20
+ * Error codes (`errorMessage`): REQUEST_VALIDATION_EXCEPTION.
21
+ *
22
+ * Capability the role of an organization API key needs: `automation.view`.
23
+ */
24
+ list(
25
+ params: FollowUpSmsSettingsListParams = {},
26
+ options?: RequestOptions,
27
+ ): PagePromise<FollowUpSmsSetting> {
28
+ return this._client.getPage<FollowUpSmsSetting>('/follow-up-sms-setting', {
29
+ query: {
30
+ 'dongle_ids[]': params.dongle_ids,
31
+ page: params.page,
32
+ limit: params.limit,
33
+ order_by: params.order_by,
34
+ order: params.order,
35
+ },
36
+ itemKey: 'follow_up_sms_settings',
37
+ options,
38
+ });
39
+ }
40
+
41
+ /**
42
+ * Create follow-up SMS setting.
43
+ *
44
+ * Creates a follow-up SMS setting for a modem.
45
+ *
46
+ * Error codes (`errorMessage`): REQUEST_VALIDATION_EXCEPTION, DONGLE_NOT_FOUND_EXCEPTION, INVALID_DONGLE_TYPE, BILLING_ERROR_IDENTIFIER_DONGLE_SUBSCRIPTION_NOT_ACTIVE, INVALID_RINGING_DURATION_TIMEOUT, INVALID_CALL_DURATION_TIMEOUT, INVALID_DAILY_SMS_LIMIT, DUPLICATE_DONGLE_FOLLOW_UP_SMS_SETTING, SMS_ERROR_IDENTIFIER_EMPTY_MESSAGE.
47
+ *
48
+ * Capability the role of an organization API key needs: `automation.manage`.
49
+ */
50
+ create(params: FollowUpSmsSettingsCreateParams, options?: RequestOptions): Promise<FollowUpSmsSetting> {
51
+ return this._client
52
+ .request('POST', '/follow-up-sms-setting', {
53
+ body: {
54
+ dongle_id: params.dongle_id,
55
+ name: params.name,
56
+ text: params.text,
57
+ ringing_duration_timeout: params.ringing_duration_timeout,
58
+ call_duration_timeout: params.call_duration_timeout,
59
+ daily_sms_limit: params.daily_sms_limit,
60
+ },
61
+ options,
62
+ })
63
+ .then((data) => data as FollowUpSmsSetting);
64
+ }
65
+
66
+ /**
67
+ * Get follow-up SMS setting.
68
+ *
69
+ * One follow-up SMS setting of the account.
70
+ *
71
+ * @param followUpSmsSettingId - Follow Up Sms Setting ID
72
+ *
73
+ * Error codes (`errorMessage`): REQUEST_VALIDATION_EXCEPTION, FOLLOW_UP_SMS_SETTING_NOT_FOUND_EXCEPTION.
74
+ *
75
+ * Capability the role of an organization API key needs: `automation.view`.
76
+ */
77
+ get(followUpSmsSettingId: number, options?: RequestOptions): Promise<FollowUpSmsSetting> {
78
+ return this._client
79
+ .request('GET', `/follow-up-sms-setting/${pathParam(followUpSmsSettingId)}`, { options })
80
+ .then((data) => data as FollowUpSmsSetting);
81
+ }
82
+
83
+ /**
84
+ * Update follow-up SMS setting.
85
+ *
86
+ * Replaces the follow-up SMS setting.
87
+ *
88
+ * @param followUpSmsSettingId - Follow-up SMS setting ID
89
+ *
90
+ * Error codes (`errorMessage`): REQUEST_VALIDATION_EXCEPTION, FOLLOW_UP_SMS_SETTING_NOT_FOUND_EXCEPTION, DONGLE_NOT_FOUND_EXCEPTION, INVALID_DONGLE_TYPE, BILLING_ERROR_IDENTIFIER_DONGLE_SUBSCRIPTION_NOT_ACTIVE, INVALID_RINGING_DURATION_TIMEOUT, INVALID_CALL_DURATION_TIMEOUT, INVALID_DAILY_SMS_LIMIT, DUPLICATE_DONGLE_FOLLOW_UP_SMS_SETTING, SMS_ERROR_IDENTIFIER_EMPTY_MESSAGE.
91
+ *
92
+ * Capability the role of an organization API key needs: `automation.manage`.
93
+ */
94
+ update(
95
+ followUpSmsSettingId: number,
96
+ params: FollowUpSmsSettingsUpdateParams,
97
+ options?: RequestOptions,
98
+ ): Promise<FollowUpSmsSetting> {
99
+ return this._client
100
+ .request('PUT', `/follow-up-sms-setting/${pathParam(followUpSmsSettingId)}`, {
101
+ body: {
102
+ dongle_id: params.dongle_id,
103
+ name: params.name,
104
+ text: params.text,
105
+ ringing_duration_timeout: params.ringing_duration_timeout,
106
+ call_duration_timeout: params.call_duration_timeout,
107
+ daily_sms_limit: params.daily_sms_limit,
108
+ },
109
+ options,
110
+ })
111
+ .then((data) => data as FollowUpSmsSetting);
112
+ }
113
+
114
+ /**
115
+ * Delete follow-up SMS setting.
116
+ *
117
+ * Deletes the follow-up SMS setting.
118
+ *
119
+ * @param followUpSmsSettingId - Follow-up SMS setting ID
120
+ *
121
+ * Error codes (`errorMessage`): REQUEST_VALIDATION_EXCEPTION, FOLLOW_UP_SMS_SETTING_NOT_FOUND_EXCEPTION, BILLING_ERROR_IDENTIFIER_DONGLE_SUBSCRIPTION_NOT_ACTIVE.
122
+ *
123
+ * Capability the role of an organization API key needs: `automation.manage`.
124
+ */
125
+ delete(followUpSmsSettingId: number, options?: RequestOptions): Promise<boolean> {
126
+ return this._client
127
+ .request('DELETE', `/follow-up-sms-setting/${pathParam(followUpSmsSettingId)}`, { options })
128
+ .then(asStatus);
129
+ }
130
+ }
@@ -0,0 +1,86 @@
1
+ // File generated from spec/openapi.yaml by scripts/generate.mjs. Do not edit by hand.
2
+
3
+ import type { BaseClient } from '../core.js';
4
+ import { DonglesResource } from './dongles.js';
5
+ import { SmsResource } from './sms.js';
6
+ import { CallsResource } from './calls.js';
7
+ import { UssdResource } from './ussd.js';
8
+ import { ContactsResource } from './contacts.js';
9
+ import { ContactGroupsResource } from './contact-groups.js';
10
+ import { MailingsResource } from './mailings.js';
11
+ import { RedirectionsResource } from './redirections.js';
12
+ import { CallScenariosResource } from './call-scenarios.js';
13
+ import { FollowUpSmsSettingsResource } from './follow-up-sms-settings.js';
14
+ import { PublicVpnResource } from './public-vpn.js';
15
+ import { SocksProxiesResource } from './socks-proxies.js';
16
+ import { SipUsersResource } from './sip-users.js';
17
+ import { FilesResource } from './files.js';
18
+
19
+ export {
20
+ DonglesResource,
21
+ SmsResource,
22
+ CallsResource,
23
+ UssdResource,
24
+ ContactsResource,
25
+ ContactGroupsResource,
26
+ MailingsResource,
27
+ RedirectionsResource,
28
+ CallScenariosResource,
29
+ FollowUpSmsSettingsResource,
30
+ PublicVpnResource,
31
+ SocksProxiesResource,
32
+ SipUsersResource,
33
+ FilesResource,
34
+ };
35
+
36
+ /** Resource groups of the client. */
37
+ export interface Resources {
38
+ /** Modems of the account and their commands: reboot, Wi-Fi, Wi-Fi extender, number, network info. */
39
+ readonly dongles: DonglesResource;
40
+ /** SMS of the modems: history, sending, replies, threads. */
41
+ readonly sms: SmsResource;
42
+ /** Calls of the modems: history, outgoing calls, transcripts. */
43
+ readonly calls: CallsResource;
44
+ /** USSD requests through a modem. */
45
+ readonly ussd: UssdResource;
46
+ /** Address book of the account. */
47
+ readonly contacts: ContactsResource;
48
+ /** Groups of contacts, used by mailings, call scenarios and redirections. */
49
+ readonly contactGroups: ContactGroupsResource;
50
+ /** Bulk SMS and call campaigns. */
51
+ readonly mailings: MailingsResource;
52
+ /** Rules for incoming SMS and calls: forwarding, auto reply, HTTP callback. */
53
+ readonly redirections: RedirectionsResource;
54
+ /** What a modem plays to incoming callers. */
55
+ readonly callScenarios: CallScenariosResource;
56
+ /** SMS a modem sends to a caller after a call. */
57
+ readonly followUpSmsSettings: FollowUpSmsSettingsResource;
58
+ /** VPN access through a modem. */
59
+ readonly publicVpn: PublicVpnResource;
60
+ /** SOCKS5 proxy through the mobile network of a modem. */
61
+ readonly socksProxies: SocksProxiesResource;
62
+ /** SIP accounts of the modems. */
63
+ readonly sipUsers: SipUsersResource;
64
+ /** Downloads, temporary audio uploads and text-to-speech. */
65
+ readonly files: FilesResource;
66
+ }
67
+
68
+ /** @internal */
69
+ export function createResources(client: BaseClient): Resources {
70
+ return {
71
+ dongles: new DonglesResource(client),
72
+ sms: new SmsResource(client),
73
+ calls: new CallsResource(client),
74
+ ussd: new UssdResource(client),
75
+ contacts: new ContactsResource(client),
76
+ contactGroups: new ContactGroupsResource(client),
77
+ mailings: new MailingsResource(client),
78
+ redirections: new RedirectionsResource(client),
79
+ callScenarios: new CallScenariosResource(client),
80
+ followUpSmsSettings: new FollowUpSmsSettingsResource(client),
81
+ publicVpn: new PublicVpnResource(client),
82
+ socksProxies: new SocksProxiesResource(client),
83
+ sipUsers: new SipUsersResource(client),
84
+ files: new FilesResource(client),
85
+ };
86
+ }
@@ -0,0 +1,207 @@
1
+ // File generated from spec/openapi.yaml by scripts/generate.mjs. Do not edit by hand.
2
+
3
+ import type { RequestOptions } from '../core.js';
4
+ import type { PagePromise } from '../pagination.js';
5
+ import { APIResource } from '../resource.js';
6
+ import type { Mailing } from '../types/models.js';
7
+ import type {
8
+ MailingsCreateCallParams,
9
+ MailingsCreateParams,
10
+ MailingsCreateSmsParams,
11
+ MailingsListParams,
12
+ MailingsUpdateParams,
13
+ } from '../types/params.js';
14
+ import { asStatus, pathParam } from '../utils.js';
15
+ /** Bulk SMS and call campaigns. */
16
+ export class MailingsResource extends APIResource {
17
+ /**
18
+ * List mailings.
19
+ *
20
+ * Mailings (bulk SMS or call campaigns) of the account. Newest first by default (created_at descending, then the id descending).
21
+ *
22
+ * Error codes (`errorMessage`): REQUEST_VALIDATION_EXCEPTION, PARSING_DATE_TIME_EXCEPTION.
23
+ *
24
+ * Capability the role of an organization API key needs: `automation.view`.
25
+ */
26
+ list(params: MailingsListParams = {}, options?: RequestOptions): PagePromise<Mailing> {
27
+ return this._client.getPage<Mailing>('/mailing', {
28
+ query: {
29
+ page: params.page,
30
+ limit: params.limit,
31
+ order_by: params.order_by,
32
+ order: params.order,
33
+ from: params.from,
34
+ to: params.to,
35
+ is_deleted: params.is_deleted,
36
+ created_at_from: params.created_at_from,
37
+ created_at_to: params.created_at_to,
38
+ scheduled_at_from: params.scheduled_at_from,
39
+ scheduled_at_to: params.scheduled_at_to,
40
+ 'dongle_ids[]': params.dongle_ids,
41
+ dongle_name: params.dongle_name,
42
+ 'mailing_status_ids[]': params.mailing_status_ids,
43
+ mailing_type_id: params.mailing_type_id,
44
+ mailing_entity_type_id: params.mailing_entity_type_id,
45
+ 'mailing_entity_type_ids[]': params.mailing_entity_type_ids,
46
+ mailing_history_id: params.mailing_history_id,
47
+ 'mailing_history_ids[]': params.mailing_history_ids,
48
+ name: params.name,
49
+ text: params.text,
50
+ },
51
+ itemKey: 'mailings',
52
+ options,
53
+ });
54
+ }
55
+
56
+ /**
57
+ * Create mailing.
58
+ *
59
+ * Creates an SMS or call mailing. Use POST /mailing/sms or POST /mailing/call instead.
60
+ *
61
+ * Error codes (`errorMessage`): REQUEST_VALIDATION_EXCEPTION, DONGLE_NOT_FOUND_EXCEPTION, PARSING_DATE_TIME_EXCEPTION, MAILING_MANAGEMENT_INVALID_STATUS_FOR_CREATE, MAILING_MANAGEMENT_INVALID_SCHEDULED_AT, MAILING_MANAGEMENT_DONGLE_TARIFF_INVALID, MAILING_MANAGEMENT_INVALID_PHONE, MAILING_MANAGEMENT_NO_RECIPIENTS, MAILING_MANAGEMENT_CONTACT_NOT_FOUND, MAILING_MANAGEMENT_CONTACT_GROUP_NOT_FOUND, MAILING_MANAGEMENT_DONGLE_SMS_LIMIT_EXCEEDED, TMP_FILE_NOT_FOUND, DONGLE_FIRMWARE_UPDATING_EXCEPTION, SMS_ERROR_IDENTIFIER_EMPTY_MESSAGE.
62
+ *
63
+ * Capability the role of an organization API key needs: `automation.manage`.
64
+ */
65
+ create(params: MailingsCreateParams, options?: RequestOptions): Promise<Mailing> {
66
+ return this._client
67
+ .request('POST', '/mailing', {
68
+ body: {
69
+ name: params.name,
70
+ text: params.text,
71
+ mailing_type_id: params.mailing_type_id,
72
+ mailing_entity_type_id: params.mailing_entity_type_id,
73
+ dongle_id: params.dongle_id,
74
+ scheduled_at: params.scheduled_at,
75
+ mailing_status_id: params.mailing_status_id,
76
+ is_call_record: params.is_call_record,
77
+ tmp_file_id: params.tmp_file_id,
78
+ mailing_phones: params.mailing_phones,
79
+ mailing_contact_ids: params.mailing_contact_ids,
80
+ mailing_contact_group_ids: params.mailing_contact_group_ids,
81
+ },
82
+ options,
83
+ })
84
+ .then((data) => data as Mailing);
85
+ }
86
+
87
+ /**
88
+ * Create SMS mailing.
89
+ *
90
+ * Creates an SMS mailing to the listed phones, contacts and contact groups, sent now or at scheduled_at.
91
+ *
92
+ * Error codes (`errorMessage`): REQUEST_VALIDATION_EXCEPTION, DONGLE_NOT_FOUND_EXCEPTION, PARSING_DATE_TIME_EXCEPTION, MAILING_MANAGEMENT_INVALID_STATUS_FOR_CREATE, MAILING_MANAGEMENT_INVALID_SCHEDULED_AT, MAILING_MANAGEMENT_DONGLE_TARIFF_INVALID, MAILING_MANAGEMENT_INVALID_PHONE, MAILING_MANAGEMENT_NO_RECIPIENTS, MAILING_MANAGEMENT_CONTACT_NOT_FOUND, MAILING_MANAGEMENT_CONTACT_GROUP_NOT_FOUND, MAILING_MANAGEMENT_DONGLE_SMS_LIMIT_EXCEEDED, DONGLE_FIRMWARE_UPDATING_EXCEPTION, SMS_ERROR_IDENTIFIER_EMPTY_MESSAGE.
93
+ *
94
+ * Capability the role of an organization API key needs: `automation.manage`.
95
+ */
96
+ createSms(params: MailingsCreateSmsParams, options?: RequestOptions): Promise<Mailing> {
97
+ return this._client
98
+ .request('POST', '/mailing/sms', {
99
+ body: {
100
+ name: params.name,
101
+ text: params.text,
102
+ mailing_type_id: params.mailing_type_id,
103
+ dongle_id: params.dongle_id,
104
+ scheduled_at: params.scheduled_at,
105
+ mailing_status_id: params.mailing_status_id,
106
+ mailing_phones: params.mailing_phones,
107
+ mailing_contact_ids: params.mailing_contact_ids,
108
+ mailing_contact_group_ids: params.mailing_contact_group_ids,
109
+ },
110
+ options,
111
+ })
112
+ .then((data) => data as Mailing);
113
+ }
114
+
115
+ /**
116
+ * Create call mailing.
117
+ *
118
+ * Creates a call mailing that plays an audio file (tmp_file_id) to the listed phones, contacts and contact groups.
119
+ *
120
+ * Error codes (`errorMessage`): REQUEST_VALIDATION_EXCEPTION, DONGLE_NOT_FOUND_EXCEPTION, PARSING_DATE_TIME_EXCEPTION, MAILING_MANAGEMENT_INVALID_STATUS_FOR_CREATE, MAILING_MANAGEMENT_INVALID_SCHEDULED_AT, MAILING_MANAGEMENT_DONGLE_TARIFF_INVALID, MAILING_MANAGEMENT_INVALID_PHONE, MAILING_MANAGEMENT_NO_RECIPIENTS, MAILING_MANAGEMENT_CONTACT_NOT_FOUND, MAILING_MANAGEMENT_CONTACT_GROUP_NOT_FOUND, TMP_FILE_NOT_FOUND, DONGLE_FIRMWARE_UPDATING_EXCEPTION.
121
+ *
122
+ * Capability the role of an organization API key needs: `automation.manage`.
123
+ */
124
+ createCall(params: MailingsCreateCallParams, options?: RequestOptions): Promise<Mailing> {
125
+ return this._client
126
+ .request('POST', '/mailing/call', {
127
+ body: {
128
+ name: params.name,
129
+ text: params.text,
130
+ mailing_type_id: params.mailing_type_id,
131
+ dongle_id: params.dongle_id,
132
+ is_call_record: params.is_call_record,
133
+ tmp_file_id: params.tmp_file_id,
134
+ scheduled_at: params.scheduled_at,
135
+ mailing_status_id: params.mailing_status_id,
136
+ mailing_phones: params.mailing_phones,
137
+ mailing_contact_ids: params.mailing_contact_ids,
138
+ mailing_contact_group_ids: params.mailing_contact_group_ids,
139
+ },
140
+ options,
141
+ })
142
+ .then((data) => data as Mailing);
143
+ }
144
+
145
+ /**
146
+ * Get mailing.
147
+ *
148
+ * One mailing of the account with its recipients and its last run.
149
+ *
150
+ * @param mailingId - Identifier in the path
151
+ *
152
+ * Error codes (`errorMessage`): REQUEST_VALIDATION_EXCEPTION, MAILING_NOT_FOUND.
153
+ *
154
+ * Capability the role of an organization API key needs: `automation.view`.
155
+ */
156
+ get(mailingId: number, options?: RequestOptions): Promise<Mailing> {
157
+ return this._client
158
+ .request('GET', `/mailing/${pathParam(mailingId)}`, { options })
159
+ .then((data) => data as Mailing);
160
+ }
161
+
162
+ /**
163
+ * Update mailing.
164
+ *
165
+ * Changes the mailing; omitted fields keep their values.
166
+ *
167
+ * @param mailingId - Identifier in the path
168
+ *
169
+ * Error codes (`errorMessage`): REQUEST_VALIDATION_EXCEPTION, MAILING_NOT_FOUND, PARSING_DATE_TIME_EXCEPTION, MAILING_MANAGEMENT_INVALID_STATUS_FOR_UPDATE, MAILING_MANAGEMENT_INVALID_STATUS_FOR_CANCEL, MAILING_MANAGEMENT_INVALID_STATUS_FOR_SOFT_DELETE, MAILING_MANAGEMENT_DONGLE_TARIFF_INVALID, MAILING_MANAGEMENT_INVALID_PHONE, MAILING_MANAGEMENT_NO_RECIPIENTS, MAILING_MANAGEMENT_CONTACT_NOT_FOUND, MAILING_MANAGEMENT_CONTACT_GROUP_NOT_FOUND, MAILING_MANAGEMENT_DONGLE_SMS_LIMIT_EXCEEDED, TMP_FILE_NOT_FOUND, DONGLE_FIRMWARE_UPDATING_EXCEPTION, SMS_ERROR_IDENTIFIER_EMPTY_MESSAGE.
170
+ *
171
+ * Capability the role of an organization API key needs: `automation.manage`.
172
+ */
173
+ update(mailingId: number, params: MailingsUpdateParams = {}, options?: RequestOptions): Promise<Mailing> {
174
+ return this._client
175
+ .request('PUT', `/mailing/${pathParam(mailingId)}`, {
176
+ body: {
177
+ name: params.name,
178
+ text: params.text,
179
+ mailing_type_id: params.mailing_type_id,
180
+ mailing_status_id: params.mailing_status_id,
181
+ scheduled_at: params.scheduled_at,
182
+ is_deleted: params.is_deleted,
183
+ tmp_file_id: params.tmp_file_id,
184
+ mailing_phones: params.mailing_phones,
185
+ mailing_contact_ids: params.mailing_contact_ids,
186
+ mailing_contact_group_ids: params.mailing_contact_group_ids,
187
+ },
188
+ options,
189
+ })
190
+ .then((data) => data as Mailing);
191
+ }
192
+
193
+ /**
194
+ * Delete mailing.
195
+ *
196
+ * Deletes the mailing.
197
+ *
198
+ * @param mailingId - Identifier in the path
199
+ *
200
+ * Error codes (`errorMessage`): REQUEST_VALIDATION_EXCEPTION, MAILING_NOT_FOUND, MAILING_MANAGEMENT_INVALID_STATUS_FOR_HARD_DELETE, DONGLE_NOT_FOUND_EXCEPTION, MAILING_MANAGEMENT_DONGLE_TARIFF_INVALID.
201
+ *
202
+ * Capability the role of an organization API key needs: `automation.manage`.
203
+ */
204
+ delete(mailingId: number, options?: RequestOptions): Promise<boolean> {
205
+ return this._client.request('DELETE', `/mailing/${pathParam(mailingId)}`, { options }).then(asStatus);
206
+ }
207
+ }
@@ -0,0 +1,72 @@
1
+ // File generated from spec/openapi.yaml by scripts/generate.mjs. Do not edit by hand.
2
+
3
+ import type { RequestOptions } from '../core.js';
4
+ import { APIResource } from '../resource.js';
5
+ import type { PublicVpnSession } from '../types/models.js';
6
+ import { asArray, asStatus, pathParam } from '../utils.js';
7
+ /** VPN access through a modem. */
8
+ export class PublicVpnResource extends APIResource {
9
+ /**
10
+ * Enable public VPN.
11
+ *
12
+ * Creates the VPN account of the modem on the gateway and answers {"status": true}. The credentials are not in the answer: read public_vpn_login, public_vpn_password and public_vpn_server from GET /dongle (full mode). is_public_vpn_enabled of the modem becomes true.
13
+ *
14
+ * @param dongleId - ID of the dongle
15
+ *
16
+ * Error codes (`errorMessage`): REQUEST_VALIDATION_EXCEPTION, DONGLE_NOT_FOUND_EXCEPTION, BILLING_ERROR_IDENTIFIER_DONGLE_SUBSCRIPTION_NOT_ACTIVE, DONGLE_PUBLIC_VPN_ALREADY_ENABLED_EXCEPTION.
17
+ *
18
+ * Capability the role of an organization API key needs: `network.manage`.
19
+ */
20
+ enable(dongleId: number, options?: RequestOptions): Promise<boolean> {
21
+ return this._client
22
+ .request('POST', `/dongle/${pathParam(dongleId)}/public-vpn/enable`, { options })
23
+ .then(asStatus);
24
+ }
25
+
26
+ /**
27
+ * Disable public VPN.
28
+ *
29
+ * Removes the VPN account of the modem from the gateway and drops its sessions; answers {"status": true}. is_public_vpn_enabled becomes false; the login is kept and reused by a later enable.
30
+ *
31
+ * @param dongleId - ID of the dongle
32
+ *
33
+ * Error codes (`errorMessage`): REQUEST_VALIDATION_EXCEPTION, DONGLE_NOT_FOUND_EXCEPTION, DONGLE_PUBLIC_VPN_ALREADY_DISABLED_EXCEPTION.
34
+ *
35
+ * Capability the role of an organization API key needs: `network.manage`.
36
+ */
37
+ disable(dongleId: number, options?: RequestOptions): Promise<boolean> {
38
+ return this._client
39
+ .request('POST', `/dongle/${pathParam(dongleId)}/public-vpn/disable`, { options })
40
+ .then(asStatus);
41
+ }
42
+
43
+ /**
44
+ * Refresh public VPN password.
45
+ *
46
+ * The response carries only status; the new password is returned by GET /dongle (public_vpn_password, full mode). Requires an active tariff.
47
+ *
48
+ * @param dongleId - ID of the dongle
49
+ *
50
+ * Error codes (`errorMessage`): REQUEST_VALIDATION_EXCEPTION, DONGLE_NOT_FOUND_EXCEPTION, BILLING_ERROR_IDENTIFIER_DONGLE_SUBSCRIPTION_NOT_ACTIVE.
51
+ *
52
+ * Capability the role of an organization API key needs: `network.manage`.
53
+ */
54
+ refreshPassword(dongleId: number, options?: RequestOptions): Promise<boolean> {
55
+ return this._client
56
+ .request('POST', `/dongle/${pathParam(dongleId)}/public-vpn/refresh-password`, { options })
57
+ .then(asStatus);
58
+ }
59
+
60
+ /**
61
+ * List public VPN sessions.
62
+ *
63
+ * Live VPN sessions of the modems of the account, as the VPN gateway reports them. Not paginated.
64
+ *
65
+ * Capability the role of an organization API key needs: `network.view`.
66
+ */
67
+ listSessions(options?: RequestOptions): Promise<Array<PublicVpnSession>> {
68
+ return this._client
69
+ .request('GET', '/public-vpn/connect-session-list', { options })
70
+ .then((data) => asArray(data, 'connect_sessions') as Array<PublicVpnSession>);
71
+ }
72
+ }
@@ -0,0 +1,129 @@
1
+ // File generated from spec/openapi.yaml by scripts/generate.mjs. Do not edit by hand.
2
+
3
+ import type { RequestOptions } from '../core.js';
4
+ import type { PagePromise } from '../pagination.js';
5
+ import { APIResource } from '../resource.js';
6
+ import type { Redirection } from '../types/models.js';
7
+ import type {
8
+ RedirectionsCreateParams,
9
+ RedirectionsListParams,
10
+ RedirectionsUpdateParams,
11
+ } from '../types/params.js';
12
+ import { asStatus, pathParam } from '../utils.js';
13
+ /** Rules for incoming SMS and calls: forwarding, auto reply, HTTP callback. */
14
+ export class RedirectionsResource extends APIResource {
15
+ /**
16
+ * List redirections.
17
+ *
18
+ * Redirection rules of the account: forwarding of incoming SMS and calls, auto replies and HTTP callbacks. Newest first by default (created_at descending, then the id descending).
19
+ *
20
+ * Error codes (`errorMessage`): REQUEST_VALIDATION_EXCEPTION, PARSING_DATE_TIME_EXCEPTION.
21
+ *
22
+ * Capability the role of an organization API key needs: `automation.view`.
23
+ */
24
+ list(params: RedirectionsListParams = {}, options?: RequestOptions): PagePromise<Redirection> {
25
+ return this._client.getPage<Redirection>('/redirection', {
26
+ query: {
27
+ name: params.name,
28
+ auto_reply_message: params.auto_reply_message,
29
+ dongle_id: params.dongle_id,
30
+ 'dongle_ids[]': params.dongle_ids,
31
+ from: params.from,
32
+ to: params.to,
33
+ page: params.page,
34
+ limit: params.limit,
35
+ order_by: params.order_by,
36
+ order: params.order,
37
+ 'redirection_type_ids[]': params.redirection_type_ids,
38
+ },
39
+ itemKey: 'redirections',
40
+ options,
41
+ });
42
+ }
43
+
44
+ /**
45
+ * Create redirection.
46
+ *
47
+ * Creates a redirection rule; condition and params are checked on save (see RedirectionCondition and RedirectionParams).
48
+ *
49
+ * Error codes (`errorMessage`): REQUEST_VALIDATION_EXCEPTION, PARAMS_NOT_VALID_EXCEPTION, CONDITION_NOT_VALID_EXCEPTION, DONGLE_NOT_FOUND, BILLING_ERROR_IDENTIFIER_DONGLE_SUBSCRIPTION_NOT_ACTIVE, SMS_ERROR_IDENTIFIER_EMPTY_MESSAGE.
50
+ *
51
+ * Capability the role of an organization API key needs: `automation.manage`.
52
+ */
53
+ create(params: RedirectionsCreateParams, options?: RequestOptions): Promise<Redirection> {
54
+ return this._client
55
+ .request('POST', '/redirection', {
56
+ body: {
57
+ condition: params.condition,
58
+ name: params.name,
59
+ params: params.params,
60
+ redirection_type_id: params.redirection_type_id,
61
+ },
62
+ options,
63
+ })
64
+ .then((data) => data as Redirection);
65
+ }
66
+
67
+ /**
68
+ * Get redirection.
69
+ *
70
+ * One redirection rule of the account.
71
+ *
72
+ * @param redirectionId - Identifier in the path
73
+ *
74
+ * Error codes (`errorMessage`): REQUEST_VALIDATION_EXCEPTION, REDIRECTION_NOT_FOUND_EXCEPTION.
75
+ *
76
+ * Capability the role of an organization API key needs: `automation.view`.
77
+ */
78
+ get(redirectionId: number, options?: RequestOptions): Promise<Redirection> {
79
+ return this._client
80
+ .request('GET', `/redirection/${pathParam(redirectionId)}`, { options })
81
+ .then((data) => data as Redirection);
82
+ }
83
+
84
+ /**
85
+ * Update redirection.
86
+ *
87
+ * Replaces the redirection rule; the body is checked as on create.
88
+ *
89
+ * @param redirectionId - Identifier in the path
90
+ *
91
+ * Error codes (`errorMessage`): REQUEST_VALIDATION_EXCEPTION, REDIRECTION_NOT_FOUND_EXCEPTION, PARAMS_NOT_VALID_EXCEPTION, CONDITION_NOT_VALID_EXCEPTION, DONGLE_NOT_FOUND, BILLING_ERROR_IDENTIFIER_DONGLE_SUBSCRIPTION_NOT_ACTIVE, SMS_ERROR_IDENTIFIER_EMPTY_MESSAGE.
92
+ *
93
+ * Capability the role of an organization API key needs: `automation.manage`.
94
+ */
95
+ update(
96
+ redirectionId: number,
97
+ params: RedirectionsUpdateParams,
98
+ options?: RequestOptions,
99
+ ): Promise<Redirection> {
100
+ return this._client
101
+ .request('PUT', `/redirection/${pathParam(redirectionId)}`, {
102
+ body: {
103
+ condition: params.condition,
104
+ name: params.name,
105
+ params: params.params,
106
+ redirection_type_id: params.redirection_type_id,
107
+ },
108
+ options,
109
+ })
110
+ .then((data) => data as Redirection);
111
+ }
112
+
113
+ /**
114
+ * Delete redirection.
115
+ *
116
+ * Deletes the redirection rule.
117
+ *
118
+ * @param redirectionId - Identifier in the path
119
+ *
120
+ * Error codes (`errorMessage`): REQUEST_VALIDATION_EXCEPTION, REDIRECTION_NOT_FOUND_EXCEPTION.
121
+ *
122
+ * Capability the role of an organization API key needs: `automation.manage`.
123
+ */
124
+ delete(redirectionId: number, options?: RequestOptions): Promise<boolean> {
125
+ return this._client
126
+ .request('DELETE', `/redirection/${pathParam(redirectionId)}`, { options })
127
+ .then(asStatus);
128
+ }
129
+ }
@@ -0,0 +1,44 @@
1
+ // File generated from spec/openapi.yaml by scripts/generate.mjs. Do not edit by hand.
2
+
3
+ import type { RequestOptions } from '../core.js';
4
+ import { APIResource } from '../resource.js';
5
+ import type { PbxSipUser } from '../types/models.js';
6
+ import type { SipUsersListParams } from '../types/params.js';
7
+ import { asArray, pathParam } from '../utils.js';
8
+ /** SIP accounts of the modems. */
9
+ export class SipUsersResource extends APIResource {
10
+ /**
11
+ * List SIP users.
12
+ *
13
+ * SIP accounts of the modems of the account, one per modem (dongle_id is always set; the softphone login of the cabinet and the mobile app is not listed). Modems deleted from the account are not listed. pbx_sip_connections lists the SIP servers to register at (TLS and UDP/TCP).
14
+ *
15
+ * Error codes (`errorMessage`): REQUEST_VALIDATION_EXCEPTION.
16
+ *
17
+ * Capability the role of an organization API key needs: `call.make`.
18
+ */
19
+ list(params: SipUsersListParams = {}, options?: RequestOptions): Promise<Array<PbxSipUser>> {
20
+ return this._client
21
+ .request('GET', '/sip-user', {
22
+ query: { 'dongle_call_type_ids[]': params.dongle_call_type_ids },
23
+ options,
24
+ })
25
+ .then((data) => asArray(data, 'pbx_sip_users') as Array<PbxSipUser>);
26
+ }
27
+
28
+ /**
29
+ * Get SIP user.
30
+ *
31
+ * One SIP account of a modem of the account. An unknown id, the SIP account of a deleted modem and the softphone login of the cabinet and the mobile app answer 404 PBX_SIP_ERROR_IDENTIFIER_CANT_FIND_PBX_USER.
32
+ *
33
+ * @param sipUserId - Identifier in the path
34
+ *
35
+ * Error codes (`errorMessage`): PBX_SIP_ERROR_IDENTIFIER_CANT_FIND_PBX_USER.
36
+ *
37
+ * Capability the role of an organization API key needs: `call.make`.
38
+ */
39
+ get(sipUserId: number, options?: RequestOptions): Promise<PbxSipUser> {
40
+ return this._client
41
+ .request('GET', `/sip-user/${pathParam(sipUserId)}`, { options })
42
+ .then((data) => data as PbxSipUser);
43
+ }
44
+ }