@ariary/ariary 2.0.9 → 3.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 CHANGED
@@ -13,9 +13,8 @@ npm install @ariary/ariary
13
13
  ```typescript
14
14
  import { Ariari } from '@ariary/ariary';
15
15
 
16
- import { setConfig } from '@ariary/ariary/config';
17
-
18
- setConfig({
16
+ const ariari = new Ariari();
17
+ ariari.config({
19
18
  projectId: 'your-project-id',
20
19
  secretId: 'your-secret-id'
21
20
  });
@@ -26,7 +25,7 @@ setConfig({
26
25
  ### Send Notification
27
26
 
28
27
  ```typescript
29
- const task = await Ariari.send(
28
+ const task = await ariari.send(
30
29
  { phone: '+261123456789', message: 'Message 1' },
31
30
  { phone: ['+261987654321', '+261555555555'], message: 'Message 2' }
32
31
  );
@@ -44,22 +43,22 @@ const details = await task.smsDetails();
44
43
  ### List Tasks
45
44
 
46
45
  ```typescript
47
- const result = await Ariari.tasks({
46
+ const result = await ariari.tasks({
48
47
  from: 0,
49
48
  count: 20,
50
49
  order: -1
51
50
  });
52
51
 
53
- const nextResult = await Ariari.tasks(result.next);
52
+ const nextResult = await ariari.tasks(result.next);
54
53
  ...
55
- const prevResult = await Ariari.tasks(result.prev);
54
+ const prevResult = await ariari.tasks(result.prev);
56
55
  ```
57
56
 
58
57
  ## Payment
59
58
 
60
59
 
61
60
  ```typescript
62
- const payment = await Ariari.payment.create({
61
+ const payment = await ariari.payment.create({
63
62
  code: 'PAY-123',
64
63
  amount: 5000,
65
64
  projectId: 'your-project-id'
@@ -75,21 +74,21 @@ await payment.updateRest('TICKET123');
75
74
  ### Get All Payments
76
75
 
77
76
  ```typescript
78
- const payments = await Ariari.payment.getAll();
77
+ const payments = await ariari.payment.getAll();
79
78
  ```
80
79
 
81
80
  ### Get Payment by ID
82
81
 
83
82
  ```typescript
84
- const payment = Ariari.payment.getById('payment-id-123');
83
+ const payment = ariari.payment.getById('payment-id-123');
85
84
  await payment.get();
86
85
  await payment.updateRest('TICKET123');
87
86
  ```
88
87
  ```typescript
89
- const payment = await Ariari.payment({
88
+ const payment = await ariari.payment({
90
89
  phone: '261345678901',
91
90
  amount: 5000
92
91
  });
93
92
 
94
- const payments = await Ariari.payment.getPayments();
93
+ const payments = await ariari.payment.getPayments();
95
94
  ```
package/dist/index.d.mts CHANGED
@@ -59,6 +59,10 @@ declare class Payment {
59
59
  updateRest: (ticketCode: string) => Promise<unknown>;
60
60
  }
61
61
  declare class Ariari {
62
+ config(cfg: {
63
+ projectId: string;
64
+ secretId: string;
65
+ }): void;
62
66
  send(...data: Message[]): Promise<Task>;
63
67
  tasks(param: GetTaskParam): Promise<unknown>;
64
68
  createPayment(data: {
package/dist/index.d.ts CHANGED
@@ -59,6 +59,10 @@ declare class Payment {
59
59
  updateRest: (ticketCode: string) => Promise<unknown>;
60
60
  }
61
61
  declare class Ariari {
62
+ config(cfg: {
63
+ projectId: string;
64
+ secretId: string;
65
+ }): void;
62
66
  send(...data: Message[]): Promise<Task>;
63
67
  tasks(param: GetTaskParam): Promise<unknown>;
64
68
  createPayment(data: {
package/dist/index.js CHANGED
@@ -28,6 +28,9 @@ module.exports = __toCommonJS(src_exports);
28
28
 
29
29
  // src/config/index.ts
30
30
  var config = null;
31
+ function setConfig(cfg) {
32
+ config = cfg;
33
+ }
31
34
  function getConfig() {
32
35
  return config;
33
36
  }
@@ -119,6 +122,9 @@ var Ariari = class {
119
122
  this.Task = Task;
120
123
  this.Payment = Payment;
121
124
  }
125
+ config(cfg) {
126
+ setConfig(cfg);
127
+ }
122
128
  async send(...data) {
123
129
  const messages = data.map((item) => ({
124
130
  phones: (Array.isArray(item.phone) ? item.phone : [item.phone]).map(normalizePhoneNumber),
package/dist/index.mjs CHANGED
@@ -1,5 +1,8 @@
1
1
  // src/config/index.ts
2
2
  var config = null;
3
+ function setConfig(cfg) {
4
+ config = cfg;
5
+ }
3
6
  function getConfig() {
4
7
  return config;
5
8
  }
@@ -91,6 +94,9 @@ var Ariari = class {
91
94
  this.Task = Task;
92
95
  this.Payment = Payment;
93
96
  }
97
+ config(cfg) {
98
+ setConfig(cfg);
99
+ }
94
100
  async send(...data) {
95
101
  const messages = data.map((item) => ({
96
102
  phones: (Array.isArray(item.phone) ? item.phone : [item.phone]).map(normalizePhoneNumber),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ariary/ariary",
3
- "version": "2.0.9",
3
+ "version": "3.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",