@ariary/ariary 3.0.2 → 3.0.4
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 +15 -12
- package/dist/index.d.mts +9 -11
- package/dist/index.d.ts +9 -11
- package/dist/index.js +17 -22
- package/dist/index.mjs +17 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,21 +11,24 @@ npm install @ariary/ariary
|
|
|
11
11
|
## Configuration
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { Ariari } from '@ariary/ariary';
|
|
14
|
+
import { Ariari, Task, Payment } from '@ariary/ariary';
|
|
15
|
+
```
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
ariari.config({
|
|
17
|
+
Ariari.config({
|
|
18
18
|
projectId: 'your-project-id',
|
|
19
19
|
secretId: 'your-secret-id'
|
|
20
20
|
});
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
23
26
|
## Notification
|
|
24
27
|
|
|
25
28
|
### Send Notification
|
|
26
29
|
|
|
27
30
|
```typescript
|
|
28
|
-
const task = await
|
|
31
|
+
const task = await Ariari.send(
|
|
29
32
|
{ phone: '+261123456789', message: 'Message 1' },
|
|
30
33
|
{ phone: ['+261987654321', '+261555555555'], message: 'Message 2' }
|
|
31
34
|
);
|
|
@@ -43,22 +46,22 @@ const details = await task.smsDetails();
|
|
|
43
46
|
### List Tasks
|
|
44
47
|
|
|
45
48
|
```typescript
|
|
46
|
-
const result = await
|
|
49
|
+
const result = await Ariari.tasks({
|
|
47
50
|
from: 0,
|
|
48
51
|
count: 20,
|
|
49
52
|
order: -1
|
|
50
53
|
});
|
|
51
54
|
|
|
52
|
-
const nextResult = await
|
|
55
|
+
const nextResult = await Ariari.tasks(result.next);
|
|
53
56
|
...
|
|
54
|
-
const prevResult = await
|
|
57
|
+
const prevResult = await Ariari.tasks(result.prev);
|
|
55
58
|
```
|
|
56
59
|
|
|
57
60
|
## Payment
|
|
58
61
|
|
|
59
62
|
|
|
60
63
|
```typescript
|
|
61
|
-
const payment = await
|
|
64
|
+
const payment = await Ariari.payment.create({
|
|
62
65
|
code: 'PAY-123',
|
|
63
66
|
amount: 5000,
|
|
64
67
|
projectId: 'your-project-id'
|
|
@@ -74,21 +77,21 @@ await payment.updateRest('TICKET123');
|
|
|
74
77
|
### Get All Payments
|
|
75
78
|
|
|
76
79
|
```typescript
|
|
77
|
-
const payments = await
|
|
80
|
+
const payments = await Ariari.payment.getAll();
|
|
78
81
|
```
|
|
79
82
|
|
|
80
83
|
### Get Payment by ID
|
|
81
84
|
|
|
82
85
|
```typescript
|
|
83
|
-
const payment =
|
|
86
|
+
const payment = Ariari.payment.getById('payment-id-123');
|
|
84
87
|
await payment.get();
|
|
85
88
|
await payment.updateRest('TICKET123');
|
|
86
89
|
```
|
|
87
90
|
```typescript
|
|
88
|
-
const payment = await
|
|
91
|
+
const payment = await Ariari.payment.payment({
|
|
89
92
|
phone: '261345678901',
|
|
90
93
|
amount: 5000
|
|
91
94
|
});
|
|
92
95
|
|
|
93
|
-
const payments = await
|
|
96
|
+
const payments = await Ariari.payment.getPayments();
|
|
94
97
|
```
|
package/dist/index.d.mts
CHANGED
|
@@ -59,19 +59,19 @@ declare class Payment {
|
|
|
59
59
|
updateRest: (ticketCode: string) => Promise<unknown>;
|
|
60
60
|
}
|
|
61
61
|
declare class Ariari {
|
|
62
|
-
config(cfg: {
|
|
62
|
+
static config(cfg: {
|
|
63
63
|
projectId: string;
|
|
64
64
|
secretId: string;
|
|
65
65
|
}): void;
|
|
66
|
-
send(...data: Message[]): Promise<Task>;
|
|
67
|
-
tasks(param: GetTaskParam): Promise<TaskDetails[]>;
|
|
68
|
-
createPayment(data: {
|
|
66
|
+
static send(...data: Message[]): Promise<Task>;
|
|
67
|
+
static tasks(param: GetTaskParam): Promise<TaskDetails[]>;
|
|
68
|
+
static createPayment(data: {
|
|
69
69
|
code: string;
|
|
70
70
|
amount: number;
|
|
71
71
|
projectId: string;
|
|
72
72
|
}): Promise<Payment>;
|
|
73
|
-
getAllPayments: () => Promise<PaymentResponse[]>;
|
|
74
|
-
payment: {
|
|
73
|
+
static getAllPayments: () => Promise<PaymentResponse[]>;
|
|
74
|
+
static payment: {
|
|
75
75
|
create: (data: {
|
|
76
76
|
code: string;
|
|
77
77
|
amount: number;
|
|
@@ -85,10 +85,8 @@ declare class Ariari {
|
|
|
85
85
|
}) => Promise<any>;
|
|
86
86
|
getPayments: () => Promise<any>;
|
|
87
87
|
};
|
|
88
|
-
Task: typeof Task;
|
|
89
|
-
Payment: typeof Payment;
|
|
88
|
+
static Task: typeof Task;
|
|
89
|
+
static Payment: typeof Payment;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
export { Ariari, type Config, type CreatePaymentParam, type GetTaskParam, type Message, Payment, type PaymentParam, type PaymentResponse, Task, type TaskDetails, type TaskSummary, ariari as default };
|
|
92
|
+
export { Ariari, type Config, type CreatePaymentParam, type GetTaskParam, type Message, Payment, type PaymentParam, type PaymentResponse, Task, type TaskDetails, type TaskSummary };
|
package/dist/index.d.ts
CHANGED
|
@@ -59,19 +59,19 @@ declare class Payment {
|
|
|
59
59
|
updateRest: (ticketCode: string) => Promise<unknown>;
|
|
60
60
|
}
|
|
61
61
|
declare class Ariari {
|
|
62
|
-
config(cfg: {
|
|
62
|
+
static config(cfg: {
|
|
63
63
|
projectId: string;
|
|
64
64
|
secretId: string;
|
|
65
65
|
}): void;
|
|
66
|
-
send(...data: Message[]): Promise<Task>;
|
|
67
|
-
tasks(param: GetTaskParam): Promise<TaskDetails[]>;
|
|
68
|
-
createPayment(data: {
|
|
66
|
+
static send(...data: Message[]): Promise<Task>;
|
|
67
|
+
static tasks(param: GetTaskParam): Promise<TaskDetails[]>;
|
|
68
|
+
static createPayment(data: {
|
|
69
69
|
code: string;
|
|
70
70
|
amount: number;
|
|
71
71
|
projectId: string;
|
|
72
72
|
}): Promise<Payment>;
|
|
73
|
-
getAllPayments: () => Promise<PaymentResponse[]>;
|
|
74
|
-
payment: {
|
|
73
|
+
static getAllPayments: () => Promise<PaymentResponse[]>;
|
|
74
|
+
static payment: {
|
|
75
75
|
create: (data: {
|
|
76
76
|
code: string;
|
|
77
77
|
amount: number;
|
|
@@ -85,10 +85,8 @@ declare class Ariari {
|
|
|
85
85
|
}) => Promise<any>;
|
|
86
86
|
getPayments: () => Promise<any>;
|
|
87
87
|
};
|
|
88
|
-
Task: typeof Task;
|
|
89
|
-
Payment: typeof Payment;
|
|
88
|
+
static Task: typeof Task;
|
|
89
|
+
static Payment: typeof Payment;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
export { Ariari, type Config, type CreatePaymentParam, type GetTaskParam, type Message, Payment, type PaymentParam, type PaymentResponse, Task, type TaskDetails, type TaskSummary, ariari as default };
|
|
92
|
+
export { Ariari, type Config, type CreatePaymentParam, type GetTaskParam, type Message, Payment, type PaymentParam, type PaymentResponse, Task, type TaskDetails, type TaskSummary };
|
package/dist/index.js
CHANGED
|
@@ -22,8 +22,7 @@ var src_exports = {};
|
|
|
22
22
|
__export(src_exports, {
|
|
23
23
|
Ariari: () => Ariari,
|
|
24
24
|
Payment: () => Payment,
|
|
25
|
-
Task: () => Task
|
|
26
|
-
default: () => ariari
|
|
25
|
+
Task: () => Task
|
|
27
26
|
});
|
|
28
27
|
module.exports = __toCommonJS(src_exports);
|
|
29
28
|
|
|
@@ -110,23 +109,11 @@ var Payment = class {
|
|
|
110
109
|
this.id = id;
|
|
111
110
|
}
|
|
112
111
|
};
|
|
113
|
-
var
|
|
114
|
-
|
|
115
|
-
this.getAllPayments = () => httpGet("/api/payments");
|
|
116
|
-
this.payment = {
|
|
117
|
-
create: (data) => this.createPayment(data),
|
|
118
|
-
getAll: () => this.getAllPayments(),
|
|
119
|
-
getById: (id) => new Payment(id),
|
|
120
|
-
payment: (data) => httpPost("/api/send-transaction", data),
|
|
121
|
-
getPayments: () => httpGet("/api/send-transaction")
|
|
122
|
-
};
|
|
123
|
-
this.Task = Task;
|
|
124
|
-
this.Payment = Payment;
|
|
125
|
-
}
|
|
126
|
-
config(cfg) {
|
|
112
|
+
var _Ariari = class _Ariari {
|
|
113
|
+
static config(cfg) {
|
|
127
114
|
setConfig(cfg);
|
|
128
115
|
}
|
|
129
|
-
async send(...data) {
|
|
116
|
+
static async send(...data) {
|
|
130
117
|
const messages = data.map((item) => ({
|
|
131
118
|
phones: (Array.isArray(item.phone) ? item.phone : [item.phone]).map(normalizePhoneNumber),
|
|
132
119
|
message: item.message
|
|
@@ -140,17 +127,25 @@ var Ariari = class {
|
|
|
140
127
|
}
|
|
141
128
|
return new Task(response.notifTaskId);
|
|
142
129
|
}
|
|
143
|
-
async tasks(param) {
|
|
130
|
+
static async tasks(param) {
|
|
144
131
|
return httpGet(`/api/sms?from=${param.from}&count=${param.count}&order=${param.order}`);
|
|
145
132
|
}
|
|
146
|
-
async createPayment(data) {
|
|
133
|
+
static async createPayment(data) {
|
|
147
134
|
const res = await httpPost("/api/payments", data);
|
|
148
135
|
return new Payment(res.id);
|
|
149
136
|
}
|
|
150
137
|
};
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
138
|
+
_Ariari.getAllPayments = () => httpGet("/api/payments");
|
|
139
|
+
_Ariari.payment = {
|
|
140
|
+
create: (data) => _Ariari.createPayment(data),
|
|
141
|
+
getAll: () => _Ariari.getAllPayments(),
|
|
142
|
+
getById: (id) => new Payment(id),
|
|
143
|
+
payment: (data) => httpPost("/api/send-transaction", data),
|
|
144
|
+
getPayments: () => httpGet("/api/send-transaction")
|
|
145
|
+
};
|
|
146
|
+
_Ariari.Task = Task;
|
|
147
|
+
_Ariari.Payment = Payment;
|
|
148
|
+
var Ariari = _Ariari;
|
|
154
149
|
// Annotate the CommonJS export names for ESM import in node:
|
|
155
150
|
0 && (module.exports = {
|
|
156
151
|
Ariari,
|
package/dist/index.mjs
CHANGED
|
@@ -81,23 +81,11 @@ var Payment = class {
|
|
|
81
81
|
this.id = id;
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
|
-
var
|
|
85
|
-
|
|
86
|
-
this.getAllPayments = () => httpGet("/api/payments");
|
|
87
|
-
this.payment = {
|
|
88
|
-
create: (data) => this.createPayment(data),
|
|
89
|
-
getAll: () => this.getAllPayments(),
|
|
90
|
-
getById: (id) => new Payment(id),
|
|
91
|
-
payment: (data) => httpPost("/api/send-transaction", data),
|
|
92
|
-
getPayments: () => httpGet("/api/send-transaction")
|
|
93
|
-
};
|
|
94
|
-
this.Task = Task;
|
|
95
|
-
this.Payment = Payment;
|
|
96
|
-
}
|
|
97
|
-
config(cfg) {
|
|
84
|
+
var _Ariari = class _Ariari {
|
|
85
|
+
static config(cfg) {
|
|
98
86
|
setConfig(cfg);
|
|
99
87
|
}
|
|
100
|
-
async send(...data) {
|
|
88
|
+
static async send(...data) {
|
|
101
89
|
const messages = data.map((item) => ({
|
|
102
90
|
phones: (Array.isArray(item.phone) ? item.phone : [item.phone]).map(normalizePhoneNumber),
|
|
103
91
|
message: item.message
|
|
@@ -111,20 +99,27 @@ var Ariari = class {
|
|
|
111
99
|
}
|
|
112
100
|
return new Task(response.notifTaskId);
|
|
113
101
|
}
|
|
114
|
-
async tasks(param) {
|
|
102
|
+
static async tasks(param) {
|
|
115
103
|
return httpGet(`/api/sms?from=${param.from}&count=${param.count}&order=${param.order}`);
|
|
116
104
|
}
|
|
117
|
-
async createPayment(data) {
|
|
105
|
+
static async createPayment(data) {
|
|
118
106
|
const res = await httpPost("/api/payments", data);
|
|
119
107
|
return new Payment(res.id);
|
|
120
108
|
}
|
|
121
109
|
};
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
110
|
+
_Ariari.getAllPayments = () => httpGet("/api/payments");
|
|
111
|
+
_Ariari.payment = {
|
|
112
|
+
create: (data) => _Ariari.createPayment(data),
|
|
113
|
+
getAll: () => _Ariari.getAllPayments(),
|
|
114
|
+
getById: (id) => new Payment(id),
|
|
115
|
+
payment: (data) => httpPost("/api/send-transaction", data),
|
|
116
|
+
getPayments: () => httpGet("/api/send-transaction")
|
|
117
|
+
};
|
|
118
|
+
_Ariari.Task = Task;
|
|
119
|
+
_Ariari.Payment = Payment;
|
|
120
|
+
var Ariari = _Ariari;
|
|
125
121
|
export {
|
|
126
122
|
Ariari,
|
|
127
123
|
Payment,
|
|
128
|
-
Task
|
|
129
|
-
ariari as default
|
|
124
|
+
Task
|
|
130
125
|
};
|