@muhammedaksam/ayyildiz-node 0.1.1

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 (75) hide show
  1. package/LICENSE.md +20 -0
  2. package/README.md +314 -0
  3. package/dist/AxiosHttpClient.d.ts +16 -0
  4. package/dist/AxiosHttpClient.d.ts.map +1 -0
  5. package/dist/AxiosHttpClient.js +57 -0
  6. package/dist/AxiosHttpClient.js.map +1 -0
  7. package/dist/AyyildizClient.d.ts +35 -0
  8. package/dist/AyyildizClient.d.ts.map +1 -0
  9. package/dist/AyyildizClient.js +61 -0
  10. package/dist/AyyildizClient.js.map +1 -0
  11. package/dist/IHttpClient.d.ts +8 -0
  12. package/dist/IHttpClient.d.ts.map +1 -0
  13. package/dist/IHttpClient.js +3 -0
  14. package/dist/IHttpClient.js.map +1 -0
  15. package/dist/VersionInfo.d.ts +14 -0
  16. package/dist/VersionInfo.d.ts.map +1 -0
  17. package/dist/VersionInfo.js +26 -0
  18. package/dist/VersionInfo.js.map +1 -0
  19. package/dist/__tests__/AyyildizClient.test.d.ts +2 -0
  20. package/dist/__tests__/AyyildizClient.test.d.ts.map +1 -0
  21. package/dist/__tests__/AyyildizClient.test.js +38 -0
  22. package/dist/__tests__/AyyildizClient.test.js.map +1 -0
  23. package/dist/index.d.ts +16 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +31 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/models/SmsConfig.d.ts +7 -0
  28. package/dist/models/SmsConfig.d.ts.map +1 -0
  29. package/dist/models/SmsConfig.js +3 -0
  30. package/dist/models/SmsConfig.js.map +1 -0
  31. package/dist/models/SmsReport.d.ts +18 -0
  32. package/dist/models/SmsReport.d.ts.map +1 -0
  33. package/dist/models/SmsReport.js +3 -0
  34. package/dist/models/SmsReport.js.map +1 -0
  35. package/dist/responses/AccountResponse.d.ts +7 -0
  36. package/dist/responses/AccountResponse.d.ts.map +1 -0
  37. package/dist/responses/AccountResponse.js +32 -0
  38. package/dist/responses/AccountResponse.js.map +1 -0
  39. package/dist/responses/BaseResponse.d.ts +17 -0
  40. package/dist/responses/BaseResponse.d.ts.map +1 -0
  41. package/dist/responses/BaseResponse.js +86 -0
  42. package/dist/responses/BaseResponse.js.map +1 -0
  43. package/dist/responses/IResponse.d.ts +8 -0
  44. package/dist/responses/IResponse.d.ts.map +1 -0
  45. package/dist/responses/IResponse.js +3 -0
  46. package/dist/responses/IResponse.js.map +1 -0
  47. package/dist/responses/ReportResponse.d.ts +7 -0
  48. package/dist/responses/ReportResponse.d.ts.map +1 -0
  49. package/dist/responses/ReportResponse.js +56 -0
  50. package/dist/responses/ReportResponse.js.map +1 -0
  51. package/dist/responses/SenderResponse.d.ts +6 -0
  52. package/dist/responses/SenderResponse.d.ts.map +1 -0
  53. package/dist/responses/SenderResponse.js +25 -0
  54. package/dist/responses/SenderResponse.js.map +1 -0
  55. package/dist/responses/SmsResponse.d.ts +6 -0
  56. package/dist/responses/SmsResponse.d.ts.map +1 -0
  57. package/dist/responses/SmsResponse.js +27 -0
  58. package/dist/responses/SmsResponse.js.map +1 -0
  59. package/dist/services/AccountService.d.ts +15 -0
  60. package/dist/services/AccountService.d.ts.map +1 -0
  61. package/dist/services/AccountService.js +35 -0
  62. package/dist/services/AccountService.js.map +1 -0
  63. package/dist/services/ReportService.d.ts +36 -0
  64. package/dist/services/ReportService.d.ts.map +1 -0
  65. package/dist/services/ReportService.js +94 -0
  66. package/dist/services/ReportService.js.map +1 -0
  67. package/dist/services/SenderService.d.ts +15 -0
  68. package/dist/services/SenderService.d.ts.map +1 -0
  69. package/dist/services/SenderService.js +37 -0
  70. package/dist/services/SenderService.js.map +1 -0
  71. package/dist/services/SmsService.d.ts +61 -0
  72. package/dist/services/SmsService.d.ts.map +1 -0
  73. package/dist/services/SmsService.js +171 -0
  74. package/dist/services/SmsService.js.map +1 -0
  75. package/package.json +62 -0
package/LICENSE.md ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Ayyıldız Mobile
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,314 @@
1
+ # Ayyıldız Mobile Node.js SDK
2
+
3
+ Official Node.js SDK for Ayyıldız Mobile SMS API.
4
+
5
+ ## Installation
6
+
7
+ ### Using pnpm (recommended)
8
+
9
+ ```bash
10
+ pnpm add @muhammedaksam/ayyildiz-node
11
+ ```
12
+
13
+ ### Using npm
14
+
15
+ ```bash
16
+ npm install @muhammedaksam/ayyildiz-node
17
+ ```
18
+
19
+ ### Using yarn
20
+
21
+ ```bash
22
+ yarn add @muhammedaksam/ayyildiz-node
23
+ ```
24
+
25
+ ## Quick Start
26
+
27
+ ```typescript
28
+ import { AyyildizClient } from '@muhammedaksam/ayyildiz-node';
29
+
30
+ const client = new AyyildizClient({
31
+ username: 'your-username',
32
+ password: 'your-password',
33
+ companyCode: 'your-company-code',
34
+ defaultOriginator: 'SENDER' // optional
35
+ });
36
+
37
+ // Send SMS
38
+ const response = await client.sms().send({
39
+ to: '+905551234567',
40
+ message: 'Hello from Ayyıldız Mobile!'
41
+ });
42
+
43
+ console.log(response.success);
44
+ ```
45
+
46
+ ## Configuration
47
+
48
+ ### Constructor Options
49
+
50
+ ```typescript
51
+ // Option 1: Using config object
52
+ const client = new AyyildizClient({
53
+ username: 'your-username',
54
+ password: 'your-password',
55
+ companyCode: 'your-company-code',
56
+ defaultOriginator: 'SENDER' // optional
57
+ });
58
+
59
+ // Option 2: Using parameters
60
+ const client = new AyyildizClient(
61
+ 'your-username',
62
+ 'your-password',
63
+ 'your-company-code',
64
+ 'SENDER' // optional
65
+ );
66
+ ```
67
+
68
+ ## API Reference
69
+
70
+ ### SMS Operations
71
+
72
+ #### Send SMS
73
+
74
+ ```typescript
75
+ // Send single SMS
76
+ await client.sms().send('+905551234567', 'Your message');
77
+
78
+ // Send SMS with custom originator
79
+ await client.sms().send('+905551234567', 'Your message', 'CUSTOM');
80
+
81
+ // Send SMS to multiple recipients
82
+ await client.sms().send(['+905551234567', '+905557654321'], 'Your message');
83
+
84
+ // Send different messages to different recipients
85
+ await client.sms().send({
86
+ '+905551234567': 'Message for first recipient',
87
+ '+905557654321': 'Message for second recipient'
88
+ });
89
+ ```
90
+
91
+ #### Send SMS via HTTP GET
92
+
93
+ ```typescript
94
+ // Send SMS using HTTP GET method
95
+ await client.sms().sendViaHttp('+905551234567', 'Your message', 'SENDER');
96
+ ```
97
+
98
+ #### Schedule SMS
99
+
100
+ ```typescript
101
+ // Schedule SMS for later delivery
102
+ await client
103
+ .sms()
104
+ .schedule('311220241430') // ddmmyyyyhhmm format
105
+ .send('+905551234567', 'Scheduled message');
106
+ ```
107
+
108
+ #### Set SMS Type
109
+
110
+ ```typescript
111
+ import { SmsType } from '@muhammedaksam/ayyildiz-node';
112
+
113
+ // Set SMS type before sending
114
+ await client
115
+ .sms()
116
+ .setType(SmsType.LONG) // 918 character SMS
117
+ .send('+905551234567', 'Long message');
118
+
119
+ // Available SMS types:
120
+ // SmsType.STANDARD = 160 character SMS
121
+ // SmsType.LONG = 918 character SMS
122
+ // SmsType.TURKISH_SHORT = 70 character Turkish SMS
123
+ // SmsType.TURKISH_LONG = 402 character Turkish SMS
124
+ // SmsType.TURKISH_STANDARD = 155/894 character Turkish SMS (default)
125
+ // SmsType.INTERNATIONAL = 402 character International SMS
126
+ ```
127
+
128
+ ### Account Operations
129
+
130
+ #### Get Credit Balance
131
+
132
+ ```typescript
133
+ const balance = await client.account().getCredit();
134
+ console.log(balance.data);
135
+ ```
136
+
137
+ ### Report Operations
138
+
139
+ #### Get SMS Reports
140
+
141
+ ```typescript
142
+ // Get reports by date range
143
+ const reports = await client.reports().getByDateRange('20240101', '20240131');
144
+
145
+ // Get detailed report by message GUID
146
+ const detailedReport = await client.reports().getDetailedReport('message-guid');
147
+
148
+ // Get report by message ID
149
+ const report = await client.reports().getByMessageId('message-id');
150
+
151
+ // Get report in XML format
152
+ const xmlReport = await client.reports().getXmlReport('message-id');
153
+ ```
154
+
155
+ ### Sender Operations
156
+
157
+ #### Get Available Originators
158
+
159
+ ```typescript
160
+ const originators = await client.senders().getOriginators();
161
+ console.log(originators.data);
162
+ ```
163
+
164
+ ## Error Handling
165
+
166
+ ```typescript
167
+ try {
168
+ const response = await client.sms().send('+905551234567', 'Hello!');
169
+
170
+ if (response.success) {
171
+ console.log('SMS sent successfully');
172
+ } else {
173
+ console.error('SMS failed:', response.error);
174
+ }
175
+ } catch (error) {
176
+ console.error('Request failed:', error);
177
+ }
178
+ ```
179
+
180
+ ## Debug Mode
181
+
182
+ ```typescript
183
+ const client = new AyyildizClient(config);
184
+
185
+ // Send SMS
186
+ await client.sms().send({
187
+ to: '+905551234567',
188
+ message: 'Hello!'
189
+ });
190
+
191
+ // Get debug information
192
+ console.log(client.debug());
193
+ ```
194
+
195
+ ## Turkish Character Support
196
+
197
+ The SDK automatically handles Turkish characters in SMS messages. You can send
198
+ messages with Turkish characters like ğ, ü, ş, ı, ö, ç without any special
199
+ configuration.
200
+
201
+ ## Development
202
+
203
+ ### Prerequisites
204
+
205
+ - Node.js (latest LTS version recommended)
206
+ - pnpm (latest version recommended as package manager)
207
+
208
+ ### Setup
209
+
210
+ ```bash
211
+ # Install pnpm if not already installed
212
+ npm install -g pnpm
213
+
214
+ # Install dependencies (uses pnpm-lock.yaml)
215
+ pnpm install
216
+
217
+ # Build the project
218
+ pnpm run build
219
+
220
+ # Run tests
221
+ pnpm test
222
+
223
+ # Lint code
224
+ pnpm run lint
225
+
226
+ # Format code
227
+ pnpm run format
228
+ ```
229
+
230
+ ### Package Manager Benefits
231
+
232
+ This project uses **pnpm** as the preferred package manager for several
233
+ advantages:
234
+
235
+ - **Faster installations**: pnpm reuses packages from a global store
236
+ - **Disk space efficiency**: No duplicate packages across projects
237
+ - **Stricter dependency resolution**: Better compatibility and security
238
+ - **Monorepo support**: Excellent for complex project structures
239
+ - **Lockfile optimization**: More reliable dependency resolution
240
+
241
+ ### pnpm Commands
242
+
243
+ ```bash
244
+ # Install dependencies
245
+ pnpm install
246
+
247
+ # Add a dependency
248
+ pnpm add package-name
249
+
250
+ # Add a dev dependency
251
+ pnpm add -D package-name
252
+
253
+ # Remove a dependency
254
+ pnpm remove package-name
255
+
256
+ # Update dependencies
257
+ pnpm update
258
+
259
+ # Check outdated packages
260
+ pnpm outdated
261
+ ```
262
+
263
+ ### Building
264
+
265
+ ```bash
266
+ pnpm run build
267
+ ```
268
+
269
+ This will compile TypeScript to JavaScript in the `dist` directory.
270
+
271
+ ## Package Manager
272
+
273
+ This project uses pnpm as the preferred package manager. While you can use npm
274
+ or yarn, pnpm is recommended for:
275
+
276
+ - Faster installation
277
+ - Better disk space efficiency
278
+ - Stricter dependency resolution
279
+ - Better monorepo support
280
+
281
+ ## TypeScript Support
282
+
283
+ This SDK is written in TypeScript and provides full type definitions. No
284
+ additional `@types` packages are needed.
285
+
286
+ ## API Documentation
287
+
288
+ For detailed API documentation, please visit
289
+ [Ayyıldız Mobile API Documentation](https://api.ayyildizmobile.com/docs).
290
+
291
+ ## Support
292
+
293
+ For support and questions:
294
+
295
+ - GitHub Issues:
296
+ [https://github.com/muhammedaksam/ayyildiz-node/issues](https://github.com/muhammedaksam/ayyildiz-node/issues)
297
+
298
+ ## License
299
+
300
+ This project is licensed under the MIT License - see the
301
+ [LICENSE.md](LICENSE.md) file for details.
302
+
303
+ ## Contributing
304
+
305
+ 1. Fork the repository
306
+ 2. Create a feature branch
307
+ 3. Make your changes
308
+ 4. Add tests for new functionality
309
+ 5. Ensure all tests pass
310
+ 6. Submit a pull request
311
+
312
+ ## Changelog
313
+
314
+ See [CHANGELOG.md](CHANGELOG.md) for details about changes in each version.
@@ -0,0 +1,16 @@
1
+ import { IHttpClient } from './IHttpClient';
2
+ export declare class AxiosHttpClient implements IHttpClient {
3
+ private baseUrl;
4
+ private client;
5
+ private lastResponseBody;
6
+ private lastResponseStatusCode;
7
+ private lastPayload;
8
+ constructor();
9
+ post(url: string, options: any): Promise<any>;
10
+ get(url: string, options?: any): Promise<any>;
11
+ private buildXml;
12
+ getBody(): any;
13
+ getStatusCode(): number;
14
+ getPayload(): string;
15
+ }
16
+ //# sourceMappingURL=AxiosHttpClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AxiosHttpClient.d.ts","sourceRoot":"","sources":["../src/AxiosHttpClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,qBAAa,eAAgB,YAAW,WAAW;IACjD,OAAO,CAAC,OAAO,CAA8B;IAC7C,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,gBAAgB,CAAM;IAC9B,OAAO,CAAC,sBAAsB,CAAa;IAC3C,OAAO,CAAC,WAAW,CAAc;;IAcpB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAW7C,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAU1D,OAAO,CAAC,QAAQ;IAST,OAAO,IAAI,GAAG;IAId,aAAa,IAAI,MAAM;IAIvB,UAAU,IAAI,MAAM;CAG5B"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AxiosHttpClient = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const VersionInfo_1 = require("./VersionInfo");
9
+ class AxiosHttpClient {
10
+ constructor() {
11
+ this.baseUrl = 'http://sms.ayyildiz.net/';
12
+ this.lastResponseStatusCode = 0;
13
+ this.lastPayload = '';
14
+ this.client = axios_1.default.create({
15
+ headers: {
16
+ 'Content-Type': 'application/xml; charset=UTF-8',
17
+ 'User-Agent': `Ayyildiz-Node/${VersionInfo_1.VersionInfo.string()}`
18
+ },
19
+ validateStatus(status) {
20
+ return status < 500;
21
+ }
22
+ });
23
+ }
24
+ async post(url, options) {
25
+ const xmlData = this.buildXml(options);
26
+ const response = await this.client.post(`${this.baseUrl}${url}`, xmlData);
27
+ this.lastPayload = xmlData;
28
+ this.lastResponseBody = response.data;
29
+ this.lastResponseStatusCode = response.status;
30
+ return this;
31
+ }
32
+ async get(url, options) {
33
+ const response = await this.client.get(`${this.baseUrl}${url}`, { params: options });
34
+ this.lastPayload = JSON.stringify(options || {});
35
+ this.lastResponseBody = response.data;
36
+ this.lastResponseStatusCode = response.status;
37
+ return this;
38
+ }
39
+ buildXml(data) {
40
+ if (typeof data === 'string') {
41
+ return data;
42
+ }
43
+ // For XML API calls, data should already be formatted as XML string
44
+ return JSON.stringify(data);
45
+ }
46
+ getBody() {
47
+ return this.lastResponseBody;
48
+ }
49
+ getStatusCode() {
50
+ return this.lastResponseStatusCode;
51
+ }
52
+ getPayload() {
53
+ return this.lastPayload;
54
+ }
55
+ }
56
+ exports.AxiosHttpClient = AxiosHttpClient;
57
+ //# sourceMappingURL=AxiosHttpClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AxiosHttpClient.js","sourceRoot":"","sources":["../src/AxiosHttpClient.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA6C;AAE7C,+CAA4C;AAE5C,MAAa,eAAe;IAO1B;QANQ,YAAO,GAAG,0BAA0B,CAAC;QAGrC,2BAAsB,GAAW,CAAC,CAAC;QACnC,gBAAW,GAAW,EAAE,CAAC;QAG/B,IAAI,CAAC,MAAM,GAAG,eAAK,CAAC,MAAM,CAAC;YACzB,OAAO,EAAE;gBACP,cAAc,EAAE,gCAAgC;gBAChD,YAAY,EAAE,iBAAiB,yBAAW,CAAC,MAAM,EAAE,EAAE;aACtD;YACD,cAAc,CAAC,MAAM;gBACnB,OAAO,MAAM,GAAG,GAAG,CAAC;YACtB,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,GAAW,EAAE,OAAY;QACzC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACvC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,GAAG,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;QAE1E,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;QAC3B,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC,IAAI,CAAC;QACtC,IAAI,CAAC,sBAAsB,GAAG,QAAQ,CAAC,MAAM,CAAC;QAE9C,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,GAAW,EAAE,OAAa;QACzC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,GAAG,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;QAErF,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC,IAAI,CAAC;QACtC,IAAI,CAAC,sBAAsB,GAAG,QAAQ,CAAC,MAAM,CAAC;QAE9C,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,QAAQ,CAAC,IAAS;QACxB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,oEAAoE;QACpE,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAEM,OAAO;QACZ,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAEM,aAAa;QAClB,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACrC,CAAC;IAEM,UAAU;QACf,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CACF;AA5DD,0CA4DC"}
@@ -0,0 +1,35 @@
1
+ import { SmsService } from './services/SmsService';
2
+ import { ReportService } from './services/ReportService';
3
+ import { SenderService } from './services/SenderService';
4
+ import { AccountService } from './services/AccountService';
5
+ import { SmsConfig } from './models/SmsConfig';
6
+ export declare class AyyildizClient {
7
+ private readonly httpClient;
8
+ private readonly username;
9
+ private readonly password;
10
+ private readonly companyCode;
11
+ private readonly defaultOriginator?;
12
+ constructor(_config: SmsConfig);
13
+ constructor(username: string, password: string, companyCode: string, defaultOriginator?: string);
14
+ /**
15
+ * SMS operations
16
+ */
17
+ sms(): SmsService;
18
+ /**
19
+ * Report operations
20
+ */
21
+ reports(): ReportService;
22
+ /**
23
+ * Sender/Originator operations
24
+ */
25
+ senders(): SenderService;
26
+ /**
27
+ * Account operations
28
+ */
29
+ account(): AccountService;
30
+ /**
31
+ * Get debug information about the last request and response
32
+ */
33
+ debug(): string;
34
+ }
35
+ //# sourceMappingURL=AyyildizClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AyyildizClient.d.ts","sourceRoot":"","sources":["../src/AyyildizClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAc;IACzC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAS;gBAEhC,OAAO,EAAE,SAAS;gBAClB,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM;IAsB/F;;OAEG;IACI,GAAG,IAAI,UAAU;IAUxB;;OAEG;IACI,OAAO,IAAI,aAAa;IAI/B;;OAEG;IACI,OAAO,IAAI,aAAa;IAI/B;;OAEG;IACI,OAAO,IAAI,cAAc;IAIhC;;OAEG;IACI,KAAK,IAAI,MAAM;CAWvB"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AyyildizClient = void 0;
4
+ const AxiosHttpClient_1 = require("./AxiosHttpClient");
5
+ const SmsService_1 = require("./services/SmsService");
6
+ const ReportService_1 = require("./services/ReportService");
7
+ const SenderService_1 = require("./services/SenderService");
8
+ const AccountService_1 = require("./services/AccountService");
9
+ class AyyildizClient {
10
+ constructor(configOrUsername, password, companyCode, defaultOriginator) {
11
+ if (typeof configOrUsername === 'object') {
12
+ this.username = configOrUsername.username;
13
+ this.password = configOrUsername.password;
14
+ this.companyCode = configOrUsername.companyCode;
15
+ this.defaultOriginator = configOrUsername.defaultOriginator;
16
+ }
17
+ else {
18
+ this.username = configOrUsername;
19
+ this.password = password;
20
+ this.companyCode = companyCode;
21
+ this.defaultOriginator = defaultOriginator;
22
+ }
23
+ this.httpClient = new AxiosHttpClient_1.AxiosHttpClient();
24
+ }
25
+ /**
26
+ * SMS operations
27
+ */
28
+ sms() {
29
+ return new SmsService_1.SmsService(this.httpClient, this.username, this.password, this.companyCode, this.defaultOriginator);
30
+ }
31
+ /**
32
+ * Report operations
33
+ */
34
+ reports() {
35
+ return new ReportService_1.ReportService(this.httpClient, this.username, this.password, this.companyCode);
36
+ }
37
+ /**
38
+ * Sender/Originator operations
39
+ */
40
+ senders() {
41
+ return new SenderService_1.SenderService(this.httpClient, this.username, this.password, this.companyCode);
42
+ }
43
+ /**
44
+ * Account operations
45
+ */
46
+ account() {
47
+ return new AccountService_1.AccountService(this.httpClient, this.username, this.password, this.companyCode);
48
+ }
49
+ /**
50
+ * Get debug information about the last request and response
51
+ */
52
+ debug() {
53
+ return JSON.stringify({
54
+ payload: this.httpClient.getPayload(),
55
+ response: this.httpClient.getBody(),
56
+ status: this.httpClient.getStatusCode()
57
+ }, null, 2);
58
+ }
59
+ }
60
+ exports.AyyildizClient = AyyildizClient;
61
+ //# sourceMappingURL=AyyildizClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AyyildizClient.js","sourceRoot":"","sources":["../src/AyyildizClient.ts"],"names":[],"mappings":";;;AAAA,uDAAoD;AAEpD,sDAAmD;AACnD,4DAAyD;AACzD,4DAAyD;AACzD,8DAA2D;AAG3D,MAAa,cAAc;IASzB,YACE,gBAAoC,EACpC,QAAiB,EACjB,WAAoB,EACpB,iBAA0B;QAE1B,IAAI,OAAO,gBAAgB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CAAC,CAAC;IAC7F,CAAC;IAED;;OAEG;IACI,KAAK;QACV,OAAO,IAAI,CAAC,SAAS,CACnB;YACE,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE;YACrC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE;YACnC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE;SACxC,EACD,IAAI,EACJ,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AA9ED,wCA8EC"}
@@ -0,0 +1,8 @@
1
+ export interface IHttpClient {
2
+ post(_url: string, _options: any): Promise<any>;
3
+ get?(_url: string, _options?: any): Promise<any>;
4
+ getBody(): any;
5
+ getStatusCode(): number;
6
+ getPayload(): string;
7
+ }
8
+ //# sourceMappingURL=IHttpClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IHttpClient.d.ts","sourceRoot":"","sources":["../src/IHttpClient.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAChD,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACjD,OAAO,IAAI,GAAG,CAAC;IACf,aAAa,IAAI,MAAM,CAAC;IACxB,UAAU,IAAI,MAAM,CAAC;CACtB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IHttpClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IHttpClient.js","sourceRoot":"","sources":["../src/IHttpClient.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ export declare class VersionInfo {
2
+ private static readonly MAJOR;
3
+ private static readonly MINOR;
4
+ private static readonly PATCH;
5
+ /**
6
+ * Get version string in semver format
7
+ */
8
+ static string(): string;
9
+ /**
10
+ * Get version as object
11
+ */
12
+ static toJSON(): object;
13
+ }
14
+ //# sourceMappingURL=VersionInfo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VersionInfo.d.ts","sourceRoot":"","sources":["../src/VersionInfo.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAK;IAClC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAK;IAClC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAK;IAElC;;OAEG;WACW,MAAM,IAAI,MAAM;IAI9B;;OAEG;WACW,MAAM,IAAI,MAAM;CAO/B"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VersionInfo = void 0;
4
+ class VersionInfo {
5
+ /**
6
+ * Get version string in semver format
7
+ */
8
+ static string() {
9
+ return `${this.MAJOR}.${this.MINOR}.${this.PATCH}`;
10
+ }
11
+ /**
12
+ * Get version as object
13
+ */
14
+ static toJSON() {
15
+ return {
16
+ major: this.MAJOR,
17
+ minor: this.MINOR,
18
+ patch: this.PATCH
19
+ };
20
+ }
21
+ }
22
+ exports.VersionInfo = VersionInfo;
23
+ VersionInfo.MAJOR = 1;
24
+ VersionInfo.MINOR = 0;
25
+ VersionInfo.PATCH = 0;
26
+ //# sourceMappingURL=VersionInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VersionInfo.js","sourceRoot":"","sources":["../src/VersionInfo.ts"],"names":[],"mappings":";;;AAAA,MAAa,WAAW;IAKtB;;OAEG;IACI,MAAM,CAAC,MAAM;QAClB,OAAO,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;IACrD,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,MAAM;QAClB,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC;IACJ,CAAC;;AArBH,kCAsBC;AArByB,iBAAK,GAAG,CAAC,CAAC;AACV,iBAAK,GAAG,CAAC,CAAC;AACV,iBAAK,GAAG,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=AyyildizClient.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AyyildizClient.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/AyyildizClient.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_1 = require("../index");
4
+ describe('AyyildizClient', () => {
5
+ let client;
6
+ beforeEach(() => {
7
+ client = new index_1.AyyildizClient({
8
+ username: 'test-user',
9
+ password: 'test-pass',
10
+ companyCode: 'test-company',
11
+ defaultOriginator: 'TEST'
12
+ });
13
+ });
14
+ test('should initialize with config object', () => {
15
+ expect(client).toBeDefined();
16
+ expect(client.sms).toBeDefined();
17
+ expect(client.account).toBeDefined();
18
+ expect(client.reports).toBeDefined();
19
+ expect(client.senders).toBeDefined();
20
+ });
21
+ test('should initialize with parameters', () => {
22
+ const paramClient = new index_1.AyyildizClient('user', 'pass', 'company', 'SENDER');
23
+ expect(paramClient).toBeDefined();
24
+ expect(paramClient.sms).toBeDefined();
25
+ });
26
+ test('should provide access to all services', () => {
27
+ expect(client.sms()).toBeDefined();
28
+ expect(client.account()).toBeDefined();
29
+ expect(client.reports()).toBeDefined();
30
+ expect(client.senders()).toBeDefined();
31
+ });
32
+ test('should provide debug functionality', () => {
33
+ const debugInfo = client.debug();
34
+ expect(typeof debugInfo).toBe('string');
35
+ expect(() => JSON.parse(debugInfo)).not.toThrow();
36
+ });
37
+ });
38
+ //# sourceMappingURL=AyyildizClient.test.js.map
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OAAO,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;QACvC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;QACvC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC9C,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;QACjC,MAAM,CAAC,OAAO,SAAS,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxC,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ export { AyyildizClient } from './AyyildizClient';
2
+ export { AccountService } from './services/AccountService';
3
+ export { ReportService } from './services/ReportService';
4
+ export { SenderService } from './services/SenderService';
5
+ export { SmsService, SmsType } from './services/SmsService';
6
+ export { AccountResponse } from './responses/AccountResponse';
7
+ export { BaseResponse } from './responses/BaseResponse';
8
+ export { ReportResponse } from './responses/ReportResponse';
9
+ export { SenderResponse } from './responses/SenderResponse';
10
+ export { SmsResponse } from './responses/SmsResponse';
11
+ export { SmsReport } from './models/SmsReport';
12
+ export { SmsConfig } from './models/SmsConfig';
13
+ export { IHttpClient } from './IHttpClient';
14
+ export { IResponse } from './responses/IResponse';
15
+ export { VersionInfo } from './VersionInfo';
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}