@ariary/ariary 1.0.8 → 2.0.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.
- package/README.md +45 -56
- package/dist/index.d.mts +194 -22
- package/dist/index.d.ts +194 -22
- package/dist/index.js +121 -293
- package/dist/index.mjs +120 -276
- package/package.json +3 -29
- package/dist/client-CKv433F4.d.mts +0 -42
- package/dist/client-CKv433F4.d.ts +0 -42
- package/dist/notif-task/index.d.mts +0 -58
- package/dist/notif-task/index.d.ts +0 -58
- package/dist/notif-task/index.js +0 -80
- package/dist/notif-task/index.mjs +0 -53
- package/dist/payment/index.d.mts +0 -54
- package/dist/payment/index.d.ts +0 -54
- package/dist/payment/index.js +0 -86
- package/dist/payment/index.mjs +0 -59
- package/dist/sms/index.d.mts +0 -62
- package/dist/sms/index.d.ts +0 -62
- package/dist/sms/index.js +0 -64
- package/dist/sms/index.mjs +0 -37
- package/dist/transfert/index.d.mts +0 -36
- package/dist/transfert/index.d.ts +0 -36
- package/dist/transfert/index.js +0 -51
- package/dist/transfert/index.mjs +0 -24
package/dist/index.mjs
CHANGED
|
@@ -1,302 +1,146 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const headers = {
|
|
19
|
-
"x-project-id": this.config.projectId
|
|
20
|
-
};
|
|
21
|
-
if (requiresSecret) {
|
|
22
|
-
headers["x-secret-id"] = this.config.secretId;
|
|
23
|
-
}
|
|
24
|
-
try {
|
|
25
|
-
const response = await this.client.post(endpoint, data, { headers });
|
|
26
|
-
return response.data;
|
|
27
|
-
} catch (error) {
|
|
28
|
-
throw this.handleError(error);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Effectue une requête GET avec les en-têtes d'authentification
|
|
33
|
-
*/
|
|
34
|
-
async get(endpoint, requiresSecret = true) {
|
|
35
|
-
const headers = {
|
|
36
|
-
"x-project-id": this.config.projectId
|
|
37
|
-
};
|
|
38
|
-
if (requiresSecret) {
|
|
39
|
-
headers["x-secret-id"] = this.config.secretId;
|
|
40
|
-
}
|
|
41
|
-
try {
|
|
42
|
-
const response = await this.client.get(endpoint, { headers });
|
|
43
|
-
return response.data;
|
|
44
|
-
} catch (error) {
|
|
45
|
-
throw this.handleError(error);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Effectue une requête PATCH avec les en-têtes d'authentification
|
|
50
|
-
*/
|
|
51
|
-
async patch(endpoint, data, requiresSecret = true) {
|
|
52
|
-
const headers = {
|
|
53
|
-
"x-project-id": this.config.projectId
|
|
54
|
-
};
|
|
55
|
-
if (requiresSecret) {
|
|
56
|
-
headers["x-secret-id"] = this.config.secretId;
|
|
57
|
-
}
|
|
58
|
-
try {
|
|
59
|
-
const response = await this.client.patch(endpoint, data, { headers });
|
|
60
|
-
return response.data;
|
|
61
|
-
} catch (error) {
|
|
62
|
-
throw this.handleError(error);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Effectue une requête PUT avec les en-têtes d'authentification
|
|
67
|
-
*/
|
|
68
|
-
async put(endpoint, data, requiresSecret = true) {
|
|
69
|
-
const headers = {
|
|
70
|
-
"x-project-id": this.config.projectId
|
|
71
|
-
};
|
|
72
|
-
if (requiresSecret) {
|
|
73
|
-
headers["x-secret-id"] = this.config.secretId;
|
|
74
|
-
}
|
|
1
|
+
// src/http.ts
|
|
2
|
+
async function request(method, endpoint, body) {
|
|
3
|
+
const config2 = getConfig();
|
|
4
|
+
const baseUrl = config2.baseUrl || "https://back.ariari.mg/payment/api-docs";
|
|
5
|
+
const url = `${baseUrl}${endpoint}`;
|
|
6
|
+
const response = await fetch(url, {
|
|
7
|
+
method,
|
|
8
|
+
headers: {
|
|
9
|
+
"Content-Type": "application/json",
|
|
10
|
+
"x-project-id": config2.projectId,
|
|
11
|
+
"x-secret-id": config2.secretId
|
|
12
|
+
},
|
|
13
|
+
body: body ? JSON.stringify(body) : void 0
|
|
14
|
+
});
|
|
15
|
+
if (!response.ok) {
|
|
16
|
+
const text = await response.text();
|
|
17
|
+
let message = response.statusText;
|
|
75
18
|
try {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
} catch (error) {
|
|
79
|
-
throw this.handleError(error);
|
|
80
|
-
}
|
|
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
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Gère les erreurs API
|
|
101
|
-
*/
|
|
102
|
-
handleError(error) {
|
|
103
|
-
if (error.response) {
|
|
104
|
-
const status = error.response.status;
|
|
105
|
-
const message = error.response.data?.message || error.response.statusText;
|
|
106
|
-
return new Error(`[${status}] ${message}`);
|
|
19
|
+
message = JSON.parse(text).message || message;
|
|
20
|
+
} catch (e) {
|
|
107
21
|
}
|
|
108
|
-
|
|
22
|
+
throw new Error(`[${response.status}] ${message}`);
|
|
109
23
|
}
|
|
110
|
-
|
|
24
|
+
return response.json();
|
|
25
|
+
}
|
|
26
|
+
async function httpGet(endpoint) {
|
|
27
|
+
return request("GET", endpoint);
|
|
28
|
+
}
|
|
29
|
+
async function httpPost(endpoint, body) {
|
|
30
|
+
return request("POST", endpoint, body);
|
|
31
|
+
}
|
|
32
|
+
async function httpPatch(endpoint, body) {
|
|
33
|
+
return request("PATCH", endpoint, body);
|
|
34
|
+
}
|
|
35
|
+
async function httpPut(endpoint, body) {
|
|
36
|
+
return request("PUT", endpoint, body);
|
|
37
|
+
}
|
|
38
|
+
async function httpDelete(endpoint) {
|
|
39
|
+
return request("DELETE", endpoint);
|
|
40
|
+
}
|
|
111
41
|
|
|
112
|
-
// src/payment.ts
|
|
113
|
-
var
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
*/
|
|
134
|
-
async getAllPayments() {
|
|
135
|
-
const response = await this.client.get(
|
|
136
|
-
"/api/payments",
|
|
137
|
-
false
|
|
138
|
-
);
|
|
139
|
-
return response;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Récupère un paiement par son ID
|
|
143
|
-
* @param paymentId L'ID du paiement à récupérer
|
|
144
|
-
* @returns Le paiement demandé
|
|
145
|
-
*/
|
|
146
|
-
async getPaymentById(paymentId) {
|
|
147
|
-
const response = await this.client.get(
|
|
148
|
-
`/api/payments/${paymentId}`,
|
|
149
|
-
false
|
|
150
|
-
);
|
|
151
|
-
return response;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Met à jour le reste d'un paiement avec un code de ticket
|
|
155
|
-
* @param paymentId L'ID du paiement à mettre à jour
|
|
156
|
-
* @param ticketCode Le code du ticket à associer
|
|
157
|
-
* @returns Le paiement mis à jour
|
|
158
|
-
*/
|
|
159
|
-
async updatePaymentRest(paymentId, ticketCode) {
|
|
160
|
-
const response = await this.client.put(
|
|
161
|
-
`/api/payments/${paymentId}/rest`,
|
|
162
|
-
{ ticketCode },
|
|
163
|
-
false
|
|
164
|
-
);
|
|
165
|
-
return response;
|
|
42
|
+
// src/payment/service.ts
|
|
43
|
+
var paymentService = {
|
|
44
|
+
async create(data) {
|
|
45
|
+
return httpPost("/api/payments", data);
|
|
46
|
+
},
|
|
47
|
+
async getAll() {
|
|
48
|
+
return httpGet("/api/payments");
|
|
49
|
+
},
|
|
50
|
+
async getById(id) {
|
|
51
|
+
return httpGet(`/api/payments/${id}`);
|
|
52
|
+
},
|
|
53
|
+
async updateRest(paymentId, ticketCode) {
|
|
54
|
+
return httpPut(`/api/payments/${paymentId}/rest`, {
|
|
55
|
+
ticketCode
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
async transfert(data) {
|
|
59
|
+
return httpPost("/api/send-transaction", data);
|
|
60
|
+
},
|
|
61
|
+
async getAllTransfert() {
|
|
62
|
+
return httpGet("/api/send-transaction");
|
|
166
63
|
}
|
|
167
64
|
};
|
|
168
65
|
|
|
169
|
-
// src/
|
|
170
|
-
var
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
true
|
|
180
|
-
);
|
|
181
|
-
return response;
|
|
182
|
-
}
|
|
183
|
-
async notifyBulk(messages) {
|
|
66
|
+
// src/notification/service.ts
|
|
67
|
+
var smsApi = {
|
|
68
|
+
async send(data) {
|
|
69
|
+
const phones = Array.isArray(data.phone) ? data.phone : [data.phone];
|
|
70
|
+
return httpPost("/api/sms/multi", {
|
|
71
|
+
phones,
|
|
72
|
+
message: data.message
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
async sendBulk(messages) {
|
|
184
76
|
const bulkMessages = messages.map((item) => ({
|
|
185
77
|
message: item.message,
|
|
186
|
-
phones: Array.isArray(item.
|
|
78
|
+
phones: Array.isArray(item.phone) ? item.phone : [item.phone]
|
|
187
79
|
}));
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
);
|
|
193
|
-
return response;
|
|
194
|
-
}
|
|
195
|
-
async getAll() {
|
|
196
|
-
const response = await this.client.get(
|
|
197
|
-
"/api/sms",
|
|
198
|
-
true
|
|
199
|
-
);
|
|
200
|
-
return response;
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
// src/transfert.ts
|
|
205
|
-
var TransferService = class {
|
|
206
|
-
constructor(client) {
|
|
207
|
-
this.client = client;
|
|
208
|
-
}
|
|
209
|
-
async send(phone, amount) {
|
|
210
|
-
const response = await this.client.post(
|
|
211
|
-
"/api/send-transaction",
|
|
212
|
-
{ phone, amount },
|
|
213
|
-
true
|
|
214
|
-
);
|
|
215
|
-
return response;
|
|
216
|
-
}
|
|
80
|
+
return httpPost("/api/sms/bulk", {
|
|
81
|
+
messages: bulkMessages
|
|
82
|
+
});
|
|
83
|
+
},
|
|
217
84
|
async getAll() {
|
|
218
|
-
|
|
219
|
-
"/api/send-transaction",
|
|
220
|
-
true
|
|
221
|
-
);
|
|
222
|
-
return response;
|
|
85
|
+
return httpGet("/api/sms");
|
|
223
86
|
}
|
|
224
87
|
};
|
|
225
|
-
|
|
226
|
-
// src/notif-task.ts
|
|
227
|
-
var NotifTaskService = class {
|
|
228
|
-
constructor(client) {
|
|
229
|
-
this.client = client;
|
|
230
|
-
}
|
|
88
|
+
var notifTaskApi = {
|
|
231
89
|
async findAll(projectId) {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
true
|
|
235
|
-
);
|
|
236
|
-
return response;
|
|
237
|
-
}
|
|
90
|
+
return httpGet(`/api/notif-task?projectId=${projectId}`);
|
|
91
|
+
},
|
|
238
92
|
async findOne(id) {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
);
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
`/api/notif-task/${id}`,
|
|
248
|
-
updateNotifTaskDto,
|
|
249
|
-
true
|
|
250
|
-
);
|
|
251
|
-
return response;
|
|
252
|
-
}
|
|
253
|
-
async remove(id) {
|
|
254
|
-
const response = await this.client.delete(
|
|
255
|
-
`/api/notif-task/${id}`,
|
|
256
|
-
true
|
|
257
|
-
);
|
|
258
|
-
return response;
|
|
259
|
-
}
|
|
93
|
+
return httpGet(`/api/notif-task/${id}`);
|
|
94
|
+
},
|
|
95
|
+
async update(id, data) {
|
|
96
|
+
return httpPatch(`/api/notif-task/${id}`, data);
|
|
97
|
+
},
|
|
98
|
+
async delete(id) {
|
|
99
|
+
return httpDelete(`/api/notif-task/${id}`);
|
|
100
|
+
},
|
|
260
101
|
async getSmsDetails(id) {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
true
|
|
264
|
-
);
|
|
265
|
-
return response;
|
|
266
|
-
}
|
|
102
|
+
return httpGet(`/api/notif-task/${id}/sms-details`);
|
|
103
|
+
},
|
|
267
104
|
async retryFailedSms(id) {
|
|
268
|
-
|
|
105
|
+
return httpPost(
|
|
269
106
|
`/api/notif-task/${id}/retry-failed-sms`,
|
|
270
|
-
{}
|
|
271
|
-
true
|
|
107
|
+
{}
|
|
272
108
|
);
|
|
273
|
-
return response;
|
|
274
109
|
}
|
|
275
110
|
};
|
|
111
|
+
var notificationService = {
|
|
112
|
+
...smsApi,
|
|
113
|
+
task: notifTaskApi
|
|
114
|
+
};
|
|
276
115
|
|
|
277
|
-
// src/
|
|
278
|
-
var
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
this.sms = new SmsService(this.defaultClient);
|
|
285
|
-
this.transfer = new TransferService(this.defaultClient);
|
|
286
|
-
this.notifTask = new NotifTaskService(this.defaultClient);
|
|
116
|
+
// src/ariari.ts
|
|
117
|
+
var config = null;
|
|
118
|
+
function getConfig() {
|
|
119
|
+
if (!config) {
|
|
120
|
+
throw new Error(
|
|
121
|
+
"Ariari not configured. Call Ariari.config({ secretId, projectId }) first."
|
|
122
|
+
);
|
|
287
123
|
}
|
|
288
|
-
|
|
289
|
-
async function sendPayment(code, amount, projectId, secretId) {
|
|
290
|
-
const sdk = new AriarySDK({ secretId, projectId });
|
|
291
|
-
const paymentData = { code, amount, projectId };
|
|
292
|
-
return sdk.payment.createPayment(paymentData);
|
|
124
|
+
return config;
|
|
293
125
|
}
|
|
126
|
+
var Ariari = {
|
|
127
|
+
/**
|
|
128
|
+
* Configure the SDK with your API credentials
|
|
129
|
+
* @param cfg Configuration object with secretId and projectId
|
|
130
|
+
*/
|
|
131
|
+
config(cfg) {
|
|
132
|
+
if (!cfg.secretId || !cfg.projectId) {
|
|
133
|
+
throw new Error("secretId and projectId are required");
|
|
134
|
+
}
|
|
135
|
+
config = {
|
|
136
|
+
secretId: cfg.secretId,
|
|
137
|
+
projectId: cfg.projectId,
|
|
138
|
+
baseUrl: cfg.baseUrl || "https://back.ariari.mg/payment/api-docs"
|
|
139
|
+
};
|
|
140
|
+
},
|
|
141
|
+
payment: paymentService,
|
|
142
|
+
notification: notificationService
|
|
143
|
+
};
|
|
294
144
|
export {
|
|
295
|
-
|
|
296
|
-
AriarySDK,
|
|
297
|
-
NotifTaskService,
|
|
298
|
-
PaymentService,
|
|
299
|
-
SmsService,
|
|
300
|
-
TransferService,
|
|
301
|
-
sendPayment
|
|
145
|
+
Ariari
|
|
302
146
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ariary/ariary",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "SDK officiel pour l'API de paiement Ariary",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -10,26 +10,6 @@
|
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"import": "./dist/index.mjs",
|
|
12
12
|
"require": "./dist/index.js"
|
|
13
|
-
},
|
|
14
|
-
"./payment": {
|
|
15
|
-
"types": "./dist/payment/index.d.ts",
|
|
16
|
-
"import": "./dist/payment/index.mjs",
|
|
17
|
-
"require": "./dist/payment/index.js"
|
|
18
|
-
},
|
|
19
|
-
"./sms": {
|
|
20
|
-
"types": "./dist/sms/index.d.ts",
|
|
21
|
-
"import": "./dist/sms/index.mjs",
|
|
22
|
-
"require": "./dist/sms/index.js"
|
|
23
|
-
},
|
|
24
|
-
"./transfert": {
|
|
25
|
-
"types": "./dist/transfert/index.d.ts",
|
|
26
|
-
"import": "./dist/transfert/index.mjs",
|
|
27
|
-
"require": "./dist/transfert/index.js"
|
|
28
|
-
},
|
|
29
|
-
"./notif-task": {
|
|
30
|
-
"types": "./dist/notif-task/index.d.ts",
|
|
31
|
-
"import": "./dist/notif-task/index.mjs",
|
|
32
|
-
"require": "./dist/notif-task/index.js"
|
|
33
13
|
}
|
|
34
14
|
},
|
|
35
15
|
"files": [
|
|
@@ -38,11 +18,7 @@
|
|
|
38
18
|
"tsup": [
|
|
39
19
|
{
|
|
40
20
|
"entry": {
|
|
41
|
-
"index": "src/index.ts"
|
|
42
|
-
"payment/index": "src/payment/index.ts",
|
|
43
|
-
"sms/index": "src/sms/index.ts",
|
|
44
|
-
"transfert/index": "src/transfert/index.ts",
|
|
45
|
-
"notif-task/index": "src/notif-task/index.ts"
|
|
21
|
+
"index": "src/index.ts"
|
|
46
22
|
},
|
|
47
23
|
"format": [
|
|
48
24
|
"cjs",
|
|
@@ -69,9 +45,7 @@
|
|
|
69
45
|
],
|
|
70
46
|
"author": "Ariary",
|
|
71
47
|
"license": "ISC",
|
|
72
|
-
"dependencies": {
|
|
73
|
-
"axios": "^1.13.2"
|
|
74
|
-
},
|
|
48
|
+
"dependencies": {},
|
|
75
49
|
"devDependencies": {
|
|
76
50
|
"tsup": "^8.5.1",
|
|
77
51
|
"typescript": "^5.9.3"
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
interface ApiResponse<T> {
|
|
2
|
-
status: string;
|
|
3
|
-
data?: T;
|
|
4
|
-
message?: string;
|
|
5
|
-
}
|
|
6
|
-
interface ApiConfig {
|
|
7
|
-
secretId: string;
|
|
8
|
-
projectId: string;
|
|
9
|
-
baseUrl?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
declare class ApiClient {
|
|
13
|
-
private client;
|
|
14
|
-
private config;
|
|
15
|
-
constructor(config: ApiConfig, baseUrl?: string);
|
|
16
|
-
/**
|
|
17
|
-
* Effectue une requête POST avec les en-têtes d'authentification
|
|
18
|
-
*/
|
|
19
|
-
post<T>(endpoint: string, data: any, requiresSecret?: boolean): Promise<T>;
|
|
20
|
-
/**
|
|
21
|
-
* Effectue une requête GET avec les en-têtes d'authentification
|
|
22
|
-
*/
|
|
23
|
-
get<T>(endpoint: string, requiresSecret?: boolean): Promise<T>;
|
|
24
|
-
/**
|
|
25
|
-
* Effectue une requête PATCH avec les en-têtes d'authentification
|
|
26
|
-
*/
|
|
27
|
-
patch<T>(endpoint: string, data: any, requiresSecret?: boolean): Promise<T>;
|
|
28
|
-
/**
|
|
29
|
-
* Effectue une requête PUT avec les en-têtes d'authentification
|
|
30
|
-
*/
|
|
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>;
|
|
36
|
-
/**
|
|
37
|
-
* Gère les erreurs API
|
|
38
|
-
*/
|
|
39
|
-
private handleError;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export { type ApiConfig as A, ApiClient as a, type ApiResponse as b };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
interface ApiResponse<T> {
|
|
2
|
-
status: string;
|
|
3
|
-
data?: T;
|
|
4
|
-
message?: string;
|
|
5
|
-
}
|
|
6
|
-
interface ApiConfig {
|
|
7
|
-
secretId: string;
|
|
8
|
-
projectId: string;
|
|
9
|
-
baseUrl?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
declare class ApiClient {
|
|
13
|
-
private client;
|
|
14
|
-
private config;
|
|
15
|
-
constructor(config: ApiConfig, baseUrl?: string);
|
|
16
|
-
/**
|
|
17
|
-
* Effectue une requête POST avec les en-têtes d'authentification
|
|
18
|
-
*/
|
|
19
|
-
post<T>(endpoint: string, data: any, requiresSecret?: boolean): Promise<T>;
|
|
20
|
-
/**
|
|
21
|
-
* Effectue une requête GET avec les en-têtes d'authentification
|
|
22
|
-
*/
|
|
23
|
-
get<T>(endpoint: string, requiresSecret?: boolean): Promise<T>;
|
|
24
|
-
/**
|
|
25
|
-
* Effectue une requête PATCH avec les en-têtes d'authentification
|
|
26
|
-
*/
|
|
27
|
-
patch<T>(endpoint: string, data: any, requiresSecret?: boolean): Promise<T>;
|
|
28
|
-
/**
|
|
29
|
-
* Effectue une requête PUT avec les en-têtes d'authentification
|
|
30
|
-
*/
|
|
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>;
|
|
36
|
-
/**
|
|
37
|
-
* Gère les erreurs API
|
|
38
|
-
*/
|
|
39
|
-
private handleError;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export { type ApiConfig as A, ApiClient as a, type ApiResponse as b };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { a as ApiClient } from '../client-CKv433F4.mjs';
|
|
2
|
-
|
|
3
|
-
interface CreateNotifTaskDto {
|
|
4
|
-
message: string;
|
|
5
|
-
phones: string[];
|
|
6
|
-
}
|
|
7
|
-
interface UpdateNotifTaskDto {
|
|
8
|
-
message?: string;
|
|
9
|
-
phones?: string[];
|
|
10
|
-
}
|
|
11
|
-
interface ResponseNotifTaskDto {
|
|
12
|
-
id: string;
|
|
13
|
-
message: string;
|
|
14
|
-
phones: string[];
|
|
15
|
-
status: string;
|
|
16
|
-
createdAt: string;
|
|
17
|
-
updatedAt: string;
|
|
18
|
-
}
|
|
19
|
-
interface SmsDetail {
|
|
20
|
-
id: string;
|
|
21
|
-
phone: string;
|
|
22
|
-
message: string;
|
|
23
|
-
status: string;
|
|
24
|
-
attempts: number;
|
|
25
|
-
lastAttempt?: string;
|
|
26
|
-
createdAt: string;
|
|
27
|
-
updatedAt: string;
|
|
28
|
-
}
|
|
29
|
-
interface NotifTaskDetailsDto {
|
|
30
|
-
id: string;
|
|
31
|
-
message: string;
|
|
32
|
-
status: string;
|
|
33
|
-
totalSms: number;
|
|
34
|
-
successCount: number;
|
|
35
|
-
failedCount: number;
|
|
36
|
-
pendingCount: number;
|
|
37
|
-
smsDetails: SmsDetail[];
|
|
38
|
-
createdAt: string;
|
|
39
|
-
updatedAt: string;
|
|
40
|
-
}
|
|
41
|
-
interface RetryFailedSmsResponseDto {
|
|
42
|
-
status: string;
|
|
43
|
-
message: string;
|
|
44
|
-
retried?: number;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
declare class NotifTaskService {
|
|
48
|
-
private client;
|
|
49
|
-
constructor(client: ApiClient);
|
|
50
|
-
findAll(projectId: string): Promise<ResponseNotifTaskDto[]>;
|
|
51
|
-
findOne(id: string): Promise<ResponseNotifTaskDto>;
|
|
52
|
-
update(id: string, updateNotifTaskDto: UpdateNotifTaskDto): Promise<ResponseNotifTaskDto>;
|
|
53
|
-
remove(id: string): Promise<ResponseNotifTaskDto>;
|
|
54
|
-
getSmsDetails(id: string): Promise<NotifTaskDetailsDto>;
|
|
55
|
-
retryFailedSms(id: string): Promise<RetryFailedSmsResponseDto>;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export { type CreateNotifTaskDto, type NotifTaskDetailsDto, NotifTaskService, type ResponseNotifTaskDto, type RetryFailedSmsResponseDto, type SmsDetail, type UpdateNotifTaskDto };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { a as ApiClient } from '../client-CKv433F4.js';
|
|
2
|
-
|
|
3
|
-
interface CreateNotifTaskDto {
|
|
4
|
-
message: string;
|
|
5
|
-
phones: string[];
|
|
6
|
-
}
|
|
7
|
-
interface UpdateNotifTaskDto {
|
|
8
|
-
message?: string;
|
|
9
|
-
phones?: string[];
|
|
10
|
-
}
|
|
11
|
-
interface ResponseNotifTaskDto {
|
|
12
|
-
id: string;
|
|
13
|
-
message: string;
|
|
14
|
-
phones: string[];
|
|
15
|
-
status: string;
|
|
16
|
-
createdAt: string;
|
|
17
|
-
updatedAt: string;
|
|
18
|
-
}
|
|
19
|
-
interface SmsDetail {
|
|
20
|
-
id: string;
|
|
21
|
-
phone: string;
|
|
22
|
-
message: string;
|
|
23
|
-
status: string;
|
|
24
|
-
attempts: number;
|
|
25
|
-
lastAttempt?: string;
|
|
26
|
-
createdAt: string;
|
|
27
|
-
updatedAt: string;
|
|
28
|
-
}
|
|
29
|
-
interface NotifTaskDetailsDto {
|
|
30
|
-
id: string;
|
|
31
|
-
message: string;
|
|
32
|
-
status: string;
|
|
33
|
-
totalSms: number;
|
|
34
|
-
successCount: number;
|
|
35
|
-
failedCount: number;
|
|
36
|
-
pendingCount: number;
|
|
37
|
-
smsDetails: SmsDetail[];
|
|
38
|
-
createdAt: string;
|
|
39
|
-
updatedAt: string;
|
|
40
|
-
}
|
|
41
|
-
interface RetryFailedSmsResponseDto {
|
|
42
|
-
status: string;
|
|
43
|
-
message: string;
|
|
44
|
-
retried?: number;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
declare class NotifTaskService {
|
|
48
|
-
private client;
|
|
49
|
-
constructor(client: ApiClient);
|
|
50
|
-
findAll(projectId: string): Promise<ResponseNotifTaskDto[]>;
|
|
51
|
-
findOne(id: string): Promise<ResponseNotifTaskDto>;
|
|
52
|
-
update(id: string, updateNotifTaskDto: UpdateNotifTaskDto): Promise<ResponseNotifTaskDto>;
|
|
53
|
-
remove(id: string): Promise<ResponseNotifTaskDto>;
|
|
54
|
-
getSmsDetails(id: string): Promise<NotifTaskDetailsDto>;
|
|
55
|
-
retryFailedSms(id: string): Promise<RetryFailedSmsResponseDto>;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export { type CreateNotifTaskDto, type NotifTaskDetailsDto, NotifTaskService, type ResponseNotifTaskDto, type RetryFailedSmsResponseDto, type SmsDetail, type UpdateNotifTaskDto };
|