shred-api-client 1.2.1 → 1.2.2
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/dist/api/SMS.api.d.ts +10 -0
- package/dist/api/SMS.api.js +24 -0
- package/dist/model/Api.d.ts +2 -0
- package/dist/model/Api.js +2 -0
- package/dist/model/SMS.schema.d.ts +15 -0
- package/dist/model/SMS.schema.js +14 -0
- package/package.json +3 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Environment from "../model/Env";
|
|
2
|
+
import { SMSAPISchema } from "../model/SMS.schema";
|
|
3
|
+
declare class SMSAPI implements SMSAPISchema {
|
|
4
|
+
private env;
|
|
5
|
+
private clientHTTP;
|
|
6
|
+
constructor(env: Environment);
|
|
7
|
+
verify(phone: string, code: number): Promise<boolean>;
|
|
8
|
+
sendVerifyCode(phone: string, friendlyName?: string | undefined): Promise<boolean>;
|
|
9
|
+
}
|
|
10
|
+
export default SMSAPI;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const HTTPClient_1 = __importDefault(require("../util/HTTPClient"));
|
|
7
|
+
const SMS_schema_1 = require("../model/SMS.schema");
|
|
8
|
+
class SMSAPI {
|
|
9
|
+
constructor(env) {
|
|
10
|
+
this.env = env;
|
|
11
|
+
this.clientHTTP = new HTTPClient_1.default();
|
|
12
|
+
}
|
|
13
|
+
async verify(phone, code) {
|
|
14
|
+
const endpointInfo = SMS_schema_1.SMSEndpoints.SendVerifyCode;
|
|
15
|
+
const data = await this.clientHTTP.makeRequest(this.env, endpointInfo.uri, endpointInfo.method, { phone, code });
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
18
|
+
async sendVerifyCode(phone, friendlyName) {
|
|
19
|
+
const endpointInfo = SMS_schema_1.SMSEndpoints.SendVerifyCode;
|
|
20
|
+
const data = await this.clientHTTP.makeRequest(this.env, endpointInfo.uri, endpointInfo.method, { phone, friendlyName });
|
|
21
|
+
return data;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.default = SMSAPI;
|
package/dist/model/Api.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import Environment from "./Env";
|
|
2
2
|
import { PromptAPISchema } from "./Prompt.schema";
|
|
3
|
+
import { SMSAPISchema } from "./SMS.schema";
|
|
3
4
|
import { SubscriptionAPISchema } from "./Subscription.schema";
|
|
4
5
|
import { UserAPISchema } from "./User.schema";
|
|
5
6
|
export declare class ShredAPI {
|
|
6
7
|
user: UserAPISchema;
|
|
7
8
|
subscription: SubscriptionAPISchema;
|
|
8
9
|
prompt: PromptAPISchema;
|
|
10
|
+
sms: SMSAPISchema;
|
|
9
11
|
constructor(env: Environment);
|
|
10
12
|
}
|
package/dist/model/Api.js
CHANGED
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ShredAPI = void 0;
|
|
7
|
+
const SMS_api_1 = __importDefault(require("../src/api/SMS.api"));
|
|
7
8
|
const Prompt_api_1 = __importDefault(require("../api/Prompt.api"));
|
|
8
9
|
const Subscription_api_1 = __importDefault(require("../api/Subscription.api"));
|
|
9
10
|
const User_api_1 = __importDefault(require("../api/User.api"));
|
|
@@ -12,6 +13,7 @@ class ShredAPI {
|
|
|
12
13
|
this.user = new User_api_1.default(env);
|
|
13
14
|
this.prompt = new Prompt_api_1.default(env);
|
|
14
15
|
this.subscription = new Subscription_api_1.default(env);
|
|
16
|
+
this.sms = new SMS_api_1.default(env);
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
exports.ShredAPI = ShredAPI;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface SMSAPISchema {
|
|
2
|
+
sendVerifyCode: (phone: string, friendlyName?: string) => Promise<boolean>;
|
|
3
|
+
verify: (phone: string, number: number) => Promise<boolean>;
|
|
4
|
+
}
|
|
5
|
+
declare const SMSEndpoints: {
|
|
6
|
+
SendVerifyCode: {
|
|
7
|
+
uri: string;
|
|
8
|
+
method: string;
|
|
9
|
+
};
|
|
10
|
+
VerifyCode: {
|
|
11
|
+
uri: string;
|
|
12
|
+
method: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export { SMSAPISchema, SMSEndpoints };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SMSEndpoints = void 0;
|
|
4
|
+
const SMSEndpoints = {
|
|
5
|
+
SendVerifyCode: {
|
|
6
|
+
uri: "/sms/public/verify/send",
|
|
7
|
+
method: "POST",
|
|
8
|
+
},
|
|
9
|
+
VerifyCode: {
|
|
10
|
+
uri: "/sms/public/verify",
|
|
11
|
+
method: "POST",
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
exports.SMSEndpoints = SMSEndpoints;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shred-api-client",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "API Client for Shred",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
"author": "Marcus Cartágenes",
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"dependencies": {
|
|
18
|
+
"@types/uuid": "^10.0.0",
|
|
18
19
|
"axios": "1.7.2",
|
|
20
|
+
"uuid": "^10.0.0",
|
|
19
21
|
"winston": "^3.13.0"
|
|
20
22
|
},
|
|
21
23
|
"devDependencies": {
|