@payhos/api 2.1.0 → 2.5.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 +99 -53
- package/ai.d.ts +6 -0
- package/ai.js +14 -0
- package/ai.js.map +1 -0
- package/api.service.d.ts +6 -0
- package/api.service.js +14 -1
- package/api.service.js.map +1 -1
- package/config.js +1 -0
- package/config.js.map +1 -1
- package/email.d.ts +0 -1
- package/email.js +1 -7
- package/email.js.map +1 -1
- package/index.d.ts +4 -0
- package/index.js +4 -0
- package/index.js.map +1 -1
- package/model.d.ts +25 -0
- package/package.json +2 -2
- package/prerender.d.ts +6 -0
- package/prerender.js +15 -0
- package/prerender.js.map +1 -0
- package/sms.d.ts +0 -1
- package/sms.js +1 -7
- package/sms.js.map +1 -1
package/README.md
CHANGED
|
@@ -4,68 +4,114 @@
|
|
|
4
4
|
|
|
5
5
|
This API SDK is intended to assist web applications of any kind to interact with the PayHos API server by utilizing its simple schematics. For a more modular usage, this library is designed such that bundlers with tree-shaking is enhanced.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
Install @payhos/api via npm by running the following command:
|
|
9
|
-
> `npm install @payhos/api --save`
|
|
7
|
+
# PayHos API SDK
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
Create an instance and call available methods from the instance created.
|
|
9
|
+
PayHos provides a small client SDK to interact with the PayHos API for sending email, SMS and requesting prerendered HTML pages.
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
import { PayHos } from '@payhos/api';
|
|
11
|
+
## Install
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
```bash
|
|
14
|
+
npm install @payhos/api --save
|
|
15
|
+
```
|
|
19
16
|
|
|
20
|
-
|
|
17
|
+
## SMS
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
const sms = payhos.sms;
|
|
24
|
-
const email = payhos.email;
|
|
25
|
-
```
|
|
19
|
+
Use the `sms` helper to send messages.
|
|
26
20
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
message:
|
|
33
|
-
recipients: [
|
|
34
|
-
senderId:
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// to send SMS
|
|
38
|
-
sms.send(data).then(response => {
|
|
39
|
-
// message(s) sent successfully
|
|
40
|
-
console.log(response);
|
|
41
|
-
}).catch(err => {
|
|
42
|
-
console.log(err);
|
|
21
|
+
```ts
|
|
22
|
+
import { PayHos } from "@payhos/api";
|
|
23
|
+
const payhos = new PayHos("<YOUR_API_TOKEN>");
|
|
24
|
+
|
|
25
|
+
await payhos.sms.send({
|
|
26
|
+
message: "Hello from PayHos",
|
|
27
|
+
recipients: ["+1234567890"],
|
|
28
|
+
senderId: "PayHos",
|
|
43
29
|
});
|
|
44
30
|
```
|
|
45
31
|
|
|
46
32
|
## Email
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
],
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
33
|
+
|
|
34
|
+
Use the `email` helper to send emails.
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { PayHos } from "@payhos/api";
|
|
38
|
+
const payhos = new PayHos("<YOUR_API_TOKEN>");
|
|
39
|
+
|
|
40
|
+
await payhos.email.send({
|
|
41
|
+
subject: "Hi",
|
|
42
|
+
html: "<p>Hello</p>",
|
|
43
|
+
recipients: [{ email: "user@example.com", name: "Jane" }],
|
|
44
|
+
sender: { name: "PayHos", email: "noreply@payhos.com" },
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Prerender
|
|
49
|
+
|
|
50
|
+
Use the `prerender` helper to request a pre-rendered HTML snapshot of a URL.
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import { PayHos } from "@payhos/api";
|
|
54
|
+
const payhos = new PayHos("<YOUR_API_TOKEN>");
|
|
55
|
+
|
|
56
|
+
const resp = await payhos.prerender.page({
|
|
57
|
+
url: "https://example.com",
|
|
58
|
+
cacheMs: 86400000,
|
|
59
|
+
});
|
|
60
|
+
console.log(resp.data);
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## AI
|
|
64
|
+
|
|
65
|
+
Use the `ai` helper to send prompts to PayHos AI API.
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
import { PayHos } from "@payhos/api";
|
|
69
|
+
const payhos = new PayHos("<YOUR_API_TOKEN>");
|
|
70
|
+
|
|
71
|
+
const resp = await payhos.ai.prompt({
|
|
72
|
+
prompt: "Write a short release note for a payments API update.",
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
if (resp.success && resp.data) {
|
|
76
|
+
console.log(resp.data.response);
|
|
77
|
+
console.log(resp.data.usage.totalChars, resp.data.usage.cost);
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### AI provider selection
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
const geminiResp = await payhos.ai.prompt({
|
|
85
|
+
prompt: "Summarize this in 3 bullets",
|
|
86
|
+
provider: "gemini", // default if omitted
|
|
87
|
+
model: "gemini-2.0-flash-lite",
|
|
88
|
+
temperature: 0.6,
|
|
89
|
+
maxInputChars: 4000,
|
|
90
|
+
maxOutputChars: 1200,
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
const gptResp = await payhos.ai.prompt({
|
|
94
|
+
prompt: "Create a concise onboarding checklist.",
|
|
95
|
+
provider: "gpt",
|
|
96
|
+
model: "gpt-4o-mini",
|
|
70
97
|
});
|
|
71
98
|
```
|
|
99
|
+
|
|
100
|
+
### AI billing
|
|
101
|
+
|
|
102
|
+
- Rate: `0.003 USD` per `1000` characters
|
|
103
|
+
- Metering basis: prompt characters + response characters
|
|
104
|
+
- Usage details are returned in `data.usage`
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
// Example usage payload shape
|
|
108
|
+
// {
|
|
109
|
+
// inputChars: number,
|
|
110
|
+
// outputChars: number,
|
|
111
|
+
// totalChars: number,
|
|
112
|
+
// cost: number,
|
|
113
|
+
// ratePer1000Chars: number
|
|
114
|
+
// }
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
For full API details, see https://docs.payhos.com.
|
package/ai.d.ts
ADDED
package/ai.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AI = void 0;
|
|
4
|
+
const api_service_1 = require("./api.service");
|
|
5
|
+
class AI {
|
|
6
|
+
constructor(key) {
|
|
7
|
+
this._apiKey = key;
|
|
8
|
+
}
|
|
9
|
+
prompt(opts) {
|
|
10
|
+
return api_service_1.apiHandler.post('ai/prompt', opts, (0, api_service_1.apiHeaders)(this._apiKey));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.AI = AI;
|
|
14
|
+
//# sourceMappingURL=ai.js.map
|
package/ai.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai.js","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":";;;AAAA,+CAAuD;AAGvD,MAAa,EAAE;IAGb,YAAY,GAAW;QACrB,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;IACrB,CAAC;IAEM,MAAM,CAAC,IAAkB;QAC9B,OAAO,wBAAU,CAAC,IAAI,CAAa,WAAW,EAAE,IAAI,EAAE,IAAA,wBAAU,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAClF,CAAC;CACF;AAVD,gBAUC"}
|
package/api.service.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { ApiResponse, Map } from './model';
|
|
2
2
|
export declare const apiHandler: {
|
|
3
3
|
post: <T>(path: string, body: Map<any>, headers: Map<any>) => Promise<ApiResponse<T>>;
|
|
4
|
+
get: <T_1>(path: string, headers: Map<any>) => Promise<ApiResponse<T_1>>;
|
|
5
|
+
};
|
|
6
|
+
export declare const apiHeaders: (apiKey: string) => {
|
|
7
|
+
Authorization: string;
|
|
8
|
+
'Content-Type': string;
|
|
9
|
+
platform: string;
|
|
4
10
|
};
|
package/api.service.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.apiHandler = void 0;
|
|
3
|
+
exports.apiHeaders = exports.apiHandler = void 0;
|
|
4
4
|
const axios_1 = require("axios");
|
|
5
5
|
const config_1 = require("./config");
|
|
6
6
|
exports.apiHandler = {
|
|
@@ -8,6 +8,19 @@ exports.apiHandler = {
|
|
|
8
8
|
const url = `${config_1.baseUrl}/v1/api/${path}`;
|
|
9
9
|
const res = await axios_1.default.post(url, body, { headers });
|
|
10
10
|
return res.data;
|
|
11
|
+
},
|
|
12
|
+
get: async (path, headers) => {
|
|
13
|
+
const url = `${config_1.baseUrl}/v1/api/${path}`;
|
|
14
|
+
const res = await axios_1.default.get(url, { headers });
|
|
15
|
+
return res.data;
|
|
11
16
|
}
|
|
12
17
|
};
|
|
18
|
+
const apiHeaders = (apiKey) => {
|
|
19
|
+
return {
|
|
20
|
+
Authorization: `Bearer ${apiKey}`,
|
|
21
|
+
'Content-Type': 'application/json',
|
|
22
|
+
platform: 'web',
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
exports.apiHeaders = apiHeaders;
|
|
13
26
|
//# sourceMappingURL=api.service.js.map
|
package/api.service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.service.js","sourceRoot":"","sources":["../src/api.service.ts"],"names":[],"mappings":";;;AAAA,iCAA0B;AAE1B,qCAAmC;AAEtB,QAAA,UAAU,GAAG;IACxB,IAAI,EAAE,KAAK,EAAK,IAAY,EAAE,IAAc,EAAE,OAAiB,EAAE,EAAE;QACjE,MAAM,GAAG,GAAG,GAAG,gBAAO,WAAW,IAAI,EAAE,CAAC;QACxC,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QACrD,OAAO,GAAG,CAAC,IAAsB,CAAC;IACpC,CAAC;CACF,CAAA"}
|
|
1
|
+
{"version":3,"file":"api.service.js","sourceRoot":"","sources":["../src/api.service.ts"],"names":[],"mappings":";;;AAAA,iCAA0B;AAE1B,qCAAmC;AAEtB,QAAA,UAAU,GAAG;IACxB,IAAI,EAAE,KAAK,EAAK,IAAY,EAAE,IAAc,EAAE,OAAiB,EAAE,EAAE;QACjE,MAAM,GAAG,GAAG,GAAG,gBAAO,WAAW,IAAI,EAAE,CAAC;QACxC,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QACrD,OAAO,GAAG,CAAC,IAAsB,CAAC;IACpC,CAAC;IACD,GAAG,EAAE,KAAK,EAAK,IAAY,EAAE,OAAiB,EAAE,EAAE;QAChD,MAAM,GAAG,GAAG,GAAG,gBAAO,WAAW,IAAI,EAAE,CAAC;QACxC,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QAC9C,OAAO,GAAG,CAAC,IAAsB,CAAC;IACpC,CAAC;CACF,CAAA;AAEM,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,EAAE;IAC3C,OAAO;QACL,aAAa,EAAE,UAAU,MAAM,EAAE;QACjC,cAAc,EAAE,kBAAkB;QAClC,QAAQ,EAAE,KAAK;KAChB,CAAC;AACJ,CAAC,CAAA;AANY,QAAA,UAAU,cAMtB"}
|
package/config.js
CHANGED
package/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAAA,MAAM,QAAQ,GAAW,MAAM,CAAC;AAErB,QAAA,OAAO,GAAG,GAAG,CAAC;AAEzB,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC;IACvB,eAAO,GAAG,uBAAuB,CAAC;AACpC,CAAC;KAAM,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;IAC/B,eAAO,GAAG,kCAAkC,CAAC;AAC/C,CAAC"}
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAAA,kCAAkC;AAClC,MAAM,QAAQ,GAAW,MAAM,CAAC;AAErB,QAAA,OAAO,GAAG,GAAG,CAAC;AAEzB,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC;IACvB,eAAO,GAAG,uBAAuB,CAAC;AACpC,CAAC;KAAM,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;IAC/B,eAAO,GAAG,kCAAkC,CAAC;AAC/C,CAAC"}
|
package/email.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { EmailOpts } from './model';
|
|
|
2
2
|
export declare class Email {
|
|
3
3
|
private _apiKey;
|
|
4
4
|
constructor(key: string);
|
|
5
|
-
private headers;
|
|
6
5
|
sendEmail(opts: EmailOpts): Promise<import("./model").ApiResponse<any>>;
|
|
7
6
|
sendEmails(opts: EmailOpts[]): Promise<import("./model").ApiResponse<any>>;
|
|
8
7
|
}
|
package/email.js
CHANGED
|
@@ -6,17 +6,11 @@ class Email {
|
|
|
6
6
|
constructor(key) {
|
|
7
7
|
this._apiKey = key;
|
|
8
8
|
}
|
|
9
|
-
headers() {
|
|
10
|
-
return {
|
|
11
|
-
Authorization: `Bearer ${this._apiKey}`,
|
|
12
|
-
'Content-Type': 'application/json',
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
9
|
sendEmail(opts) {
|
|
16
10
|
return this.sendEmails([opts]);
|
|
17
11
|
}
|
|
18
12
|
sendEmails(opts) {
|
|
19
|
-
return api_service_1.apiHandler.post('emails/send', opts, this.
|
|
13
|
+
return api_service_1.apiHandler.post('emails/send', opts, (0, api_service_1.apiHeaders)(this._apiKey));
|
|
20
14
|
}
|
|
21
15
|
}
|
|
22
16
|
exports.Email = Email;
|
package/email.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.js","sourceRoot":"","sources":["../src/email.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"email.js","sourceRoot":"","sources":["../src/email.ts"],"names":[],"mappings":";;;AAAA,+CAAuD;AAGvD,MAAa,KAAK;IAGhB,YAAY,GAAW;QACrB,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;IACrB,CAAC;IAEM,SAAS,CAAC,IAAe;QAC9B,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACjC,CAAC;IAEM,UAAU,CAAC,IAAiB;QACjC,OAAO,wBAAU,CAAC,IAAI,CAAM,aAAa,EAAE,IAAI,EAAE,IAAA,wBAAU,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAC7E,CAAC;CACF;AAdD,sBAcC"}
|
package/index.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { Email } from './email';
|
|
2
|
+
import { PreRender } from './prerender';
|
|
2
3
|
import { SMS } from './sms';
|
|
4
|
+
import { AI } from './ai';
|
|
3
5
|
export * from './model';
|
|
4
6
|
export declare class PayHos {
|
|
5
7
|
sms: SMS;
|
|
6
8
|
email: Email;
|
|
9
|
+
prerender: PreRender;
|
|
10
|
+
ai: AI;
|
|
7
11
|
constructor(key: string);
|
|
8
12
|
}
|
package/index.js
CHANGED
|
@@ -3,12 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PayHos = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const email_1 = require("./email");
|
|
6
|
+
const prerender_1 = require("./prerender");
|
|
6
7
|
const sms_1 = require("./sms");
|
|
8
|
+
const ai_1 = require("./ai");
|
|
7
9
|
tslib_1.__exportStar(require("./model"), exports);
|
|
8
10
|
class PayHos {
|
|
9
11
|
constructor(key) {
|
|
10
12
|
this.sms = new sms_1.SMS(key);
|
|
11
13
|
this.email = new email_1.Email(key);
|
|
14
|
+
this.prerender = new prerender_1.PreRender(key);
|
|
15
|
+
this.ai = new ai_1.AI(key);
|
|
12
16
|
}
|
|
13
17
|
}
|
|
14
18
|
exports.PayHos = PayHos;
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,mCAAgC;AAChC,+BAA4B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,mCAAgC;AAChC,2CAAwC;AACxC,+BAA4B;AAC5B,6BAA0B;AAE1B,kDAAwB;AAExB,MAAa,MAAM;IAMjB,YAAY,GAAW;QACrB,IAAI,CAAC,GAAG,GAAG,IAAI,SAAG,CAAC,GAAG,CAAC,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,aAAK,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,IAAI,qBAAS,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,CAAC,EAAE,GAAG,IAAI,OAAE,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;CACF;AAZD,wBAYC"}
|
package/model.d.ts
CHANGED
|
@@ -25,3 +25,28 @@ export interface SMSOpts {
|
|
|
25
25
|
message: string;
|
|
26
26
|
senderId: string;
|
|
27
27
|
}
|
|
28
|
+
export interface PreRenderOpts {
|
|
29
|
+
url: string;
|
|
30
|
+
cacheMs?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface AIPromptOpts {
|
|
33
|
+
prompt: string;
|
|
34
|
+
provider?: 'gemini' | 'gpt';
|
|
35
|
+
model?: string;
|
|
36
|
+
temperature?: number;
|
|
37
|
+
maxOutputChars?: number;
|
|
38
|
+
maxInputChars?: number;
|
|
39
|
+
}
|
|
40
|
+
export interface AIResponse {
|
|
41
|
+
id: number;
|
|
42
|
+
provider: 'gemini' | 'gpt';
|
|
43
|
+
model: string;
|
|
44
|
+
response: string;
|
|
45
|
+
usage: {
|
|
46
|
+
inputChars: number;
|
|
47
|
+
outputChars: number;
|
|
48
|
+
totalChars: number;
|
|
49
|
+
cost: number;
|
|
50
|
+
ratePer1000Chars: number;
|
|
51
|
+
};
|
|
52
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payhos/api",
|
|
3
3
|
"description": "An API package for payhos's API built for JavaScript and Typescript developers",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.5.0",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "mocha --require ts-node/register test/**/*.ts",
|
|
9
9
|
"deploy": "node copy-models && tsc && node copy-assets && cd dist && npm publish --access=public",
|
|
10
|
-
"unpublish": "npm unpublish @payhos/api@
|
|
10
|
+
"unpublish": "npm unpublish @payhos/api@2.3.0"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"axios": "^1.3.5"
|
package/prerender.d.ts
ADDED
package/prerender.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PreRender = void 0;
|
|
4
|
+
const api_service_1 = require("./api.service");
|
|
5
|
+
class PreRender {
|
|
6
|
+
constructor(key) {
|
|
7
|
+
this._apiKey = key;
|
|
8
|
+
}
|
|
9
|
+
page(opts) {
|
|
10
|
+
const path = `prerender?url=${encodeURIComponent(opts.url)}&cacheMs=${opts.cacheMs || 86400000 * 3}`;
|
|
11
|
+
return api_service_1.apiHandler.get(path, (0, api_service_1.apiHeaders)(this._apiKey));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.PreRender = PreRender;
|
|
15
|
+
//# sourceMappingURL=prerender.js.map
|
package/prerender.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prerender.js","sourceRoot":"","sources":["../src/prerender.ts"],"names":[],"mappings":";;;AAAA,+CAAuD;AAGvD,MAAa,SAAS;IAGpB,YAAY,GAAW;QACrB,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;IACrB,CAAC;IAEM,IAAI,CAAC,IAAmB;QAC7B,MAAM,IAAI,GAAG,iBAAiB,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,OAAO,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;QACrG,OAAO,wBAAU,CAAC,GAAG,CAAS,IAAI,EAAE,IAAA,wBAAU,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAChE,CAAC;CACF;AAXD,8BAWC"}
|
package/sms.d.ts
CHANGED
package/sms.js
CHANGED
|
@@ -6,14 +6,8 @@ class SMS {
|
|
|
6
6
|
constructor(key) {
|
|
7
7
|
this._apiKey = key;
|
|
8
8
|
}
|
|
9
|
-
headers() {
|
|
10
|
-
return {
|
|
11
|
-
Authorization: `Bearer ${this._apiKey}`,
|
|
12
|
-
'Content-Type': 'application/json',
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
9
|
sendSMS(opts) {
|
|
16
|
-
return api_service_1.apiHandler.post('sms/send', opts, this.
|
|
10
|
+
return api_service_1.apiHandler.post('sms/send', opts, (0, api_service_1.apiHeaders)(this._apiKey));
|
|
17
11
|
}
|
|
18
12
|
}
|
|
19
13
|
exports.SMS = SMS;
|
package/sms.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sms.js","sourceRoot":"","sources":["../src/sms.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"sms.js","sourceRoot":"","sources":["../src/sms.ts"],"names":[],"mappings":";;;AAAA,+CAAuD;AAGvD,MAAa,GAAG;IAGd,YAAY,GAAW;QACrB,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;IACrB,CAAC;IAEM,OAAO,CAAI,IAAe;QAC/B,OAAO,wBAAU,CAAC,IAAI,CAAI,UAAU,EAAE,IAAI,EAAE,IAAA,wBAAU,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IACxE,CAAC;CACF;AAVD,kBAUC"}
|