@ariary/ariary 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -61,6 +61,9 @@ const result = await sdk.sms.notifyBulk([
61
61
  { message: 'Message 1', numbers: '261345678901' },
62
62
  { message: 'Message 2', numbers: '261345678902' }
63
63
  ]);
64
+
65
+ // Récupérer tous les SMS
66
+ const allSms = await sdk.sms.getAll();
64
67
  ```
65
68
 
66
69
  ### Transfer
@@ -29,10 +29,14 @@ declare class ApiClient {
29
29
  * Effectue une requête PUT avec les en-têtes d'authentification
30
30
  */
31
31
  put<T>(endpoint: string, data: any, requiresSecret?: boolean): Promise<T>;
32
+ /**
33
+ * Effectue une requête DELETE avec les en-têtes d'authentification
34
+ */
35
+ delete<T>(endpoint: string, requiresSecret?: boolean): Promise<T>;
32
36
  /**
33
37
  * Gère les erreurs API
34
38
  */
35
39
  private handleError;
36
40
  }
37
41
 
38
- export { type ApiConfig as A, ApiClient as a, type ApiResponse as b };
42
+ export { ApiClient as A, type ApiConfig as a, type ApiResponse as b };
@@ -29,10 +29,14 @@ declare class ApiClient {
29
29
  * Effectue une requête PUT avec les en-têtes d'authentification
30
30
  */
31
31
  put<T>(endpoint: string, data: any, requiresSecret?: boolean): Promise<T>;
32
+ /**
33
+ * Effectue une requête DELETE avec les en-têtes d'authentification
34
+ */
35
+ delete<T>(endpoint: string, requiresSecret?: boolean): Promise<T>;
32
36
  /**
33
37
  * Gère les erreurs API
34
38
  */
35
39
  private handleError;
36
40
  }
37
41
 
38
- export { type ApiConfig as A, ApiClient as a, type ApiResponse as b };
42
+ export { ApiClient as A, type ApiConfig as a, type ApiResponse as b };
package/dist/index.d.mts CHANGED
@@ -4,8 +4,64 @@ import { SmsService } from './sms/index.mjs';
4
4
  export { BulkSmsDto, BulkSmsResponseDto, CreateSmsDto, MultiSmsResponseDto, ResponseSmsDto, SendSmsDto, SendSmsResponseDto } from './sms/index.mjs';
5
5
  import { TransferService } from './transfert/index.mjs';
6
6
  export { SendTransactionDto, SendTransactionResponse, TransactionResponseDto } from './transfert/index.mjs';
7
- import { A as ApiConfig } from './client-DwMAE1vB.mjs';
8
- export { a as ApiClient, b as ApiResponse } from './client-DwMAE1vB.mjs';
7
+ import { A as ApiClient, a as ApiConfig } from './client-gwES2l4Y.mjs';
8
+ export { b as ApiResponse } from './client-gwES2l4Y.mjs';
9
+
10
+ interface CreateNotifTaskDto {
11
+ message: string;
12
+ phones: string[];
13
+ }
14
+ interface UpdateNotifTaskDto {
15
+ message?: string;
16
+ phones?: string[];
17
+ }
18
+ interface ResponseNotifTaskDto {
19
+ id: string;
20
+ message: string;
21
+ phones: string[];
22
+ status: string;
23
+ createdAt: string;
24
+ updatedAt: string;
25
+ }
26
+ interface SmsDetail {
27
+ id: string;
28
+ phone: string;
29
+ message: string;
30
+ status: string;
31
+ attempts: number;
32
+ lastAttempt?: string;
33
+ createdAt: string;
34
+ updatedAt: string;
35
+ }
36
+ interface NotifTaskDetailsDto {
37
+ id: string;
38
+ message: string;
39
+ status: string;
40
+ totalSms: number;
41
+ successCount: number;
42
+ failedCount: number;
43
+ pendingCount: number;
44
+ smsDetails: SmsDetail[];
45
+ createdAt: string;
46
+ updatedAt: string;
47
+ }
48
+ interface RetryFailedSmsResponseDto {
49
+ status: string;
50
+ message: string;
51
+ retried?: number;
52
+ }
53
+
54
+ declare class NotifTaskService {
55
+ private client;
56
+ constructor(client: ApiClient);
57
+ create(createNotifTaskDto: CreateNotifTaskDto): Promise<ResponseNotifTaskDto>;
58
+ findAll(projectId: string): Promise<ResponseNotifTaskDto[]>;
59
+ findOne(id: string): Promise<ResponseNotifTaskDto>;
60
+ update(id: string, updateNotifTaskDto: UpdateNotifTaskDto): Promise<ResponseNotifTaskDto>;
61
+ remove(id: string): Promise<ResponseNotifTaskDto>;
62
+ getSmsDetails(id: string): Promise<NotifTaskDetailsDto>;
63
+ retryFailedSms(id: string): Promise<RetryFailedSmsResponseDto>;
64
+ }
9
65
 
10
66
  /**
11
67
  * SDK client pour l'API de paiement Ariary
@@ -16,8 +72,9 @@ declare class AriarySDK {
16
72
  payment: PaymentService;
17
73
  sms: SmsService;
18
74
  transfer: TransferService;
75
+ notifTask: NotifTaskService;
19
76
  constructor(config: ApiConfig);
20
77
  }
21
78
  declare function sendPayment(code: string, amount: number, projectId: string, secretId: string): Promise<PaymentResponseDto>;
22
79
 
23
- export { ApiConfig, AriarySDK, PaymentResponseDto, PaymentService, SmsService, TransferService, sendPayment };
80
+ export { ApiClient, ApiConfig, AriarySDK, type CreateNotifTaskDto, type NotifTaskDetailsDto, NotifTaskService, PaymentResponseDto, PaymentService, type ResponseNotifTaskDto, type RetryFailedSmsResponseDto, type SmsDetail, SmsService, TransferService, type UpdateNotifTaskDto, sendPayment };
package/dist/index.d.ts CHANGED
@@ -4,8 +4,64 @@ import { SmsService } from './sms/index.js';
4
4
  export { BulkSmsDto, BulkSmsResponseDto, CreateSmsDto, MultiSmsResponseDto, ResponseSmsDto, SendSmsDto, SendSmsResponseDto } from './sms/index.js';
5
5
  import { TransferService } from './transfert/index.js';
6
6
  export { SendTransactionDto, SendTransactionResponse, TransactionResponseDto } from './transfert/index.js';
7
- import { A as ApiConfig } from './client-DwMAE1vB.js';
8
- export { a as ApiClient, b as ApiResponse } from './client-DwMAE1vB.js';
7
+ import { A as ApiClient, a as ApiConfig } from './client-gwES2l4Y.js';
8
+ export { b as ApiResponse } from './client-gwES2l4Y.js';
9
+
10
+ interface CreateNotifTaskDto {
11
+ message: string;
12
+ phones: string[];
13
+ }
14
+ interface UpdateNotifTaskDto {
15
+ message?: string;
16
+ phones?: string[];
17
+ }
18
+ interface ResponseNotifTaskDto {
19
+ id: string;
20
+ message: string;
21
+ phones: string[];
22
+ status: string;
23
+ createdAt: string;
24
+ updatedAt: string;
25
+ }
26
+ interface SmsDetail {
27
+ id: string;
28
+ phone: string;
29
+ message: string;
30
+ status: string;
31
+ attempts: number;
32
+ lastAttempt?: string;
33
+ createdAt: string;
34
+ updatedAt: string;
35
+ }
36
+ interface NotifTaskDetailsDto {
37
+ id: string;
38
+ message: string;
39
+ status: string;
40
+ totalSms: number;
41
+ successCount: number;
42
+ failedCount: number;
43
+ pendingCount: number;
44
+ smsDetails: SmsDetail[];
45
+ createdAt: string;
46
+ updatedAt: string;
47
+ }
48
+ interface RetryFailedSmsResponseDto {
49
+ status: string;
50
+ message: string;
51
+ retried?: number;
52
+ }
53
+
54
+ declare class NotifTaskService {
55
+ private client;
56
+ constructor(client: ApiClient);
57
+ create(createNotifTaskDto: CreateNotifTaskDto): Promise<ResponseNotifTaskDto>;
58
+ findAll(projectId: string): Promise<ResponseNotifTaskDto[]>;
59
+ findOne(id: string): Promise<ResponseNotifTaskDto>;
60
+ update(id: string, updateNotifTaskDto: UpdateNotifTaskDto): Promise<ResponseNotifTaskDto>;
61
+ remove(id: string): Promise<ResponseNotifTaskDto>;
62
+ getSmsDetails(id: string): Promise<NotifTaskDetailsDto>;
63
+ retryFailedSms(id: string): Promise<RetryFailedSmsResponseDto>;
64
+ }
9
65
 
10
66
  /**
11
67
  * SDK client pour l'API de paiement Ariary
@@ -16,8 +72,9 @@ declare class AriarySDK {
16
72
  payment: PaymentService;
17
73
  sms: SmsService;
18
74
  transfer: TransferService;
75
+ notifTask: NotifTaskService;
19
76
  constructor(config: ApiConfig);
20
77
  }
21
78
  declare function sendPayment(code: string, amount: number, projectId: string, secretId: string): Promise<PaymentResponseDto>;
22
79
 
23
- export { ApiConfig, AriarySDK, PaymentResponseDto, PaymentService, SmsService, TransferService, sendPayment };
80
+ export { ApiClient, ApiConfig, AriarySDK, type CreateNotifTaskDto, type NotifTaskDetailsDto, NotifTaskService, PaymentResponseDto, PaymentService, type ResponseNotifTaskDto, type RetryFailedSmsResponseDto, type SmsDetail, SmsService, TransferService, type UpdateNotifTaskDto, sendPayment };
package/dist/index.js CHANGED
@@ -32,6 +32,7 @@ var src_exports = {};
32
32
  __export(src_exports, {
33
33
  ApiClient: () => ApiClient,
34
34
  AriarySDK: () => AriarySDK,
35
+ NotifTaskService: () => NotifTaskService,
35
36
  PaymentService: () => PaymentService,
36
37
  SmsService: () => SmsService,
37
38
  TransferService: () => TransferService,
@@ -120,6 +121,23 @@ var ApiClient = class {
120
121
  throw this.handleError(error);
121
122
  }
122
123
  }
124
+ /**
125
+ * Effectue une requête DELETE avec les en-têtes d'authentification
126
+ */
127
+ async delete(endpoint, requiresSecret = true) {
128
+ const headers = {
129
+ "x-project-id": this.config.projectId
130
+ };
131
+ if (requiresSecret) {
132
+ headers["x-secret-id"] = this.config.secretId;
133
+ }
134
+ try {
135
+ const response = await this.client.delete(endpoint, { headers });
136
+ return response.data;
137
+ } catch (error) {
138
+ throw this.handleError(error);
139
+ }
140
+ }
123
141
  /**
124
142
  * Gère les erreurs API
125
143
  */
@@ -216,6 +234,13 @@ var SmsService = class {
216
234
  );
217
235
  return response;
218
236
  }
237
+ async getAll() {
238
+ const response = await this.client.get(
239
+ "/api/sms",
240
+ true
241
+ );
242
+ return response;
243
+ }
219
244
  };
220
245
 
221
246
  // src/transfert.ts
@@ -240,6 +265,65 @@ var TransferService = class {
240
265
  }
241
266
  };
242
267
 
268
+ // src/notif-task.ts
269
+ var NotifTaskService = class {
270
+ constructor(client) {
271
+ this.client = client;
272
+ }
273
+ async create(createNotifTaskDto) {
274
+ const response = await this.client.post(
275
+ "/api/notif-task",
276
+ createNotifTaskDto,
277
+ true
278
+ );
279
+ return response;
280
+ }
281
+ async findAll(projectId) {
282
+ const response = await this.client.get(
283
+ `/api/notif-task?projectId=${projectId}`,
284
+ true
285
+ );
286
+ return response;
287
+ }
288
+ async findOne(id) {
289
+ const response = await this.client.get(
290
+ `/api/notif-task/${id}`,
291
+ true
292
+ );
293
+ return response;
294
+ }
295
+ async update(id, updateNotifTaskDto) {
296
+ const response = await this.client.patch(
297
+ `/api/notif-task/${id}`,
298
+ updateNotifTaskDto,
299
+ true
300
+ );
301
+ return response;
302
+ }
303
+ async remove(id) {
304
+ const response = await this.client.delete(
305
+ `/api/notif-task/${id}`,
306
+ true
307
+ );
308
+ return response;
309
+ }
310
+ async getSmsDetails(id) {
311
+ const response = await this.client.get(
312
+ `/api/notif-task/${id}/sms-details`,
313
+ true
314
+ );
315
+ return response;
316
+ }
317
+ async retryFailedSms(id) {
318
+ const response = await this.client.post(
319
+ `/api/notif-task/${id}/retry-failed-sms`,
320
+ {},
321
+ true
322
+ );
323
+ return response;
324
+ }
325
+ };
326
+
243
327
  // src/index.ts
244
328
  var AriarySDK = class {
245
329
  constructor(config) {
@@ -249,6 +333,7 @@ var AriarySDK = class {
249
333
  this.payment = new PaymentService(this.paymentClient);
250
334
  this.sms = new SmsService(this.defaultClient);
251
335
  this.transfer = new TransferService(this.defaultClient);
336
+ this.notifTask = new NotifTaskService(this.defaultClient);
252
337
  }
253
338
  };
254
339
  async function sendPayment(code, amount, projectId, secretId) {
@@ -260,6 +345,7 @@ async function sendPayment(code, amount, projectId, secretId) {
260
345
  0 && (module.exports = {
261
346
  ApiClient,
262
347
  AriarySDK,
348
+ NotifTaskService,
263
349
  PaymentService,
264
350
  SmsService,
265
351
  TransferService,
package/dist/index.mjs CHANGED
@@ -79,6 +79,23 @@ var ApiClient = class {
79
79
  throw this.handleError(error);
80
80
  }
81
81
  }
82
+ /**
83
+ * Effectue une requête DELETE avec les en-têtes d'authentification
84
+ */
85
+ async delete(endpoint, requiresSecret = true) {
86
+ const headers = {
87
+ "x-project-id": this.config.projectId
88
+ };
89
+ if (requiresSecret) {
90
+ headers["x-secret-id"] = this.config.secretId;
91
+ }
92
+ try {
93
+ const response = await this.client.delete(endpoint, { headers });
94
+ return response.data;
95
+ } catch (error) {
96
+ throw this.handleError(error);
97
+ }
98
+ }
82
99
  /**
83
100
  * Gère les erreurs API
84
101
  */
@@ -175,6 +192,13 @@ var SmsService = class {
175
192
  );
176
193
  return response;
177
194
  }
195
+ async getAll() {
196
+ const response = await this.client.get(
197
+ "/api/sms",
198
+ true
199
+ );
200
+ return response;
201
+ }
178
202
  };
179
203
 
180
204
  // src/transfert.ts
@@ -199,6 +223,65 @@ var TransferService = class {
199
223
  }
200
224
  };
201
225
 
226
+ // src/notif-task.ts
227
+ var NotifTaskService = class {
228
+ constructor(client) {
229
+ this.client = client;
230
+ }
231
+ async create(createNotifTaskDto) {
232
+ const response = await this.client.post(
233
+ "/api/notif-task",
234
+ createNotifTaskDto,
235
+ true
236
+ );
237
+ return response;
238
+ }
239
+ async findAll(projectId) {
240
+ const response = await this.client.get(
241
+ `/api/notif-task?projectId=${projectId}`,
242
+ true
243
+ );
244
+ return response;
245
+ }
246
+ async findOne(id) {
247
+ const response = await this.client.get(
248
+ `/api/notif-task/${id}`,
249
+ true
250
+ );
251
+ return response;
252
+ }
253
+ async update(id, updateNotifTaskDto) {
254
+ const response = await this.client.patch(
255
+ `/api/notif-task/${id}`,
256
+ updateNotifTaskDto,
257
+ true
258
+ );
259
+ return response;
260
+ }
261
+ async remove(id) {
262
+ const response = await this.client.delete(
263
+ `/api/notif-task/${id}`,
264
+ true
265
+ );
266
+ return response;
267
+ }
268
+ async getSmsDetails(id) {
269
+ const response = await this.client.get(
270
+ `/api/notif-task/${id}/sms-details`,
271
+ true
272
+ );
273
+ return response;
274
+ }
275
+ async retryFailedSms(id) {
276
+ const response = await this.client.post(
277
+ `/api/notif-task/${id}/retry-failed-sms`,
278
+ {},
279
+ true
280
+ );
281
+ return response;
282
+ }
283
+ };
284
+
202
285
  // src/index.ts
203
286
  var AriarySDK = class {
204
287
  constructor(config) {
@@ -208,6 +291,7 @@ var AriarySDK = class {
208
291
  this.payment = new PaymentService(this.paymentClient);
209
292
  this.sms = new SmsService(this.defaultClient);
210
293
  this.transfer = new TransferService(this.defaultClient);
294
+ this.notifTask = new NotifTaskService(this.defaultClient);
211
295
  }
212
296
  };
213
297
  async function sendPayment(code, amount, projectId, secretId) {
@@ -218,6 +302,7 @@ async function sendPayment(code, amount, projectId, secretId) {
218
302
  export {
219
303
  ApiClient,
220
304
  AriarySDK,
305
+ NotifTaskService,
221
306
  PaymentService,
222
307
  SmsService,
223
308
  TransferService,
@@ -1,4 +1,4 @@
1
- import { a as ApiClient } from '../client-DwMAE1vB.mjs';
1
+ import { A as ApiClient } from '../client-gwES2l4Y.mjs';
2
2
 
3
3
  interface CreatePaymentDto {
4
4
  code: string;
@@ -1,4 +1,4 @@
1
- import { a as ApiClient } from '../client-DwMAE1vB.js';
1
+ import { A as ApiClient } from '../client-gwES2l4Y.js';
2
2
 
3
3
  interface CreatePaymentDto {
4
4
  code: string;
@@ -1,4 +1,4 @@
1
- import { a as ApiClient } from '../client-DwMAE1vB.mjs';
1
+ import { A as ApiClient } from '../client-gwES2l4Y.mjs';
2
2
 
3
3
  interface CreateSmsDto {
4
4
  message: string;
@@ -56,6 +56,7 @@ declare class SmsService {
56
56
  message: string;
57
57
  numbers: string | string[];
58
58
  }[]): Promise<BulkSmsResponseDto>;
59
+ getAll(): Promise<ResponseSmsDto[]>;
59
60
  }
60
61
 
61
62
  export { type BulkSmsDto, type BulkSmsResponseDto, type CreateSmsDto, type MultiSmsResponseDto, type ResponseSmsDto, type SendSmsDto, type SendSmsResponseDto, SmsService };
@@ -1,4 +1,4 @@
1
- import { a as ApiClient } from '../client-DwMAE1vB.js';
1
+ import { A as ApiClient } from '../client-gwES2l4Y.js';
2
2
 
3
3
  interface CreateSmsDto {
4
4
  message: string;
@@ -56,6 +56,7 @@ declare class SmsService {
56
56
  message: string;
57
57
  numbers: string | string[];
58
58
  }[]): Promise<BulkSmsResponseDto>;
59
+ getAll(): Promise<ResponseSmsDto[]>;
59
60
  }
60
61
 
61
62
  export { type BulkSmsDto, type BulkSmsResponseDto, type CreateSmsDto, type MultiSmsResponseDto, type ResponseSmsDto, type SendSmsDto, type SendSmsResponseDto, SmsService };
package/dist/sms/index.js CHANGED
@@ -50,6 +50,13 @@ var SmsService = class {
50
50
  );
51
51
  return response;
52
52
  }
53
+ async getAll() {
54
+ const response = await this.client.get(
55
+ "/api/sms",
56
+ true
57
+ );
58
+ return response;
59
+ }
53
60
  };
54
61
  // Annotate the CommonJS export names for ESM import in node:
55
62
  0 && (module.exports = {
@@ -24,6 +24,13 @@ var SmsService = class {
24
24
  );
25
25
  return response;
26
26
  }
27
+ async getAll() {
28
+ const response = await this.client.get(
29
+ "/api/sms",
30
+ true
31
+ );
32
+ return response;
33
+ }
27
34
  };
28
35
  export {
29
36
  SmsService
@@ -1,4 +1,4 @@
1
- import { a as ApiClient } from '../client-DwMAE1vB.mjs';
1
+ import { A as ApiClient } from '../client-gwES2l4Y.mjs';
2
2
 
3
3
  interface SendTransactionDto {
4
4
  phone: string;
@@ -1,4 +1,4 @@
1
- import { a as ApiClient } from '../client-DwMAE1vB.js';
1
+ import { A as ApiClient } from '../client-gwES2l4Y.js';
2
2
 
3
3
  interface SendTransactionDto {
4
4
  phone: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ariary/ariary",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "SDK officiel pour l'API de paiement Ariary",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",