@ariary/ariary 1.0.5 → 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.
@@ -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
  */
@@ -247,6 +265,65 @@ var TransferService = class {
247
265
  }
248
266
  };
249
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
+
250
327
  // src/index.ts
251
328
  var AriarySDK = class {
252
329
  constructor(config) {
@@ -256,6 +333,7 @@ var AriarySDK = class {
256
333
  this.payment = new PaymentService(this.paymentClient);
257
334
  this.sms = new SmsService(this.defaultClient);
258
335
  this.transfer = new TransferService(this.defaultClient);
336
+ this.notifTask = new NotifTaskService(this.defaultClient);
259
337
  }
260
338
  };
261
339
  async function sendPayment(code, amount, projectId, secretId) {
@@ -267,6 +345,7 @@ async function sendPayment(code, amount, projectId, secretId) {
267
345
  0 && (module.exports = {
268
346
  ApiClient,
269
347
  AriarySDK,
348
+ NotifTaskService,
270
349
  PaymentService,
271
350
  SmsService,
272
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
  */
@@ -206,6 +223,65 @@ var TransferService = class {
206
223
  }
207
224
  };
208
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
+
209
285
  // src/index.ts
210
286
  var AriarySDK = class {
211
287
  constructor(config) {
@@ -215,6 +291,7 @@ var AriarySDK = class {
215
291
  this.payment = new PaymentService(this.paymentClient);
216
292
  this.sms = new SmsService(this.defaultClient);
217
293
  this.transfer = new TransferService(this.defaultClient);
294
+ this.notifTask = new NotifTaskService(this.defaultClient);
218
295
  }
219
296
  };
220
297
  async function sendPayment(code, amount, projectId, secretId) {
@@ -225,6 +302,7 @@ async function sendPayment(code, amount, projectId, secretId) {
225
302
  export {
226
303
  ApiClient,
227
304
  AriarySDK,
305
+ NotifTaskService,
228
306
  PaymentService,
229
307
  SmsService,
230
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;
@@ -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;
@@ -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.5",
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",