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