shred-api-client 1.2.7 → 1.2.8
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
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import Environment from "../model/Env";
|
|
2
2
|
import { SMSAPISchema } from "../model/SMS.schema";
|
|
3
|
+
import Context from "../src/model/Context";
|
|
3
4
|
declare class SMSAPI implements SMSAPISchema {
|
|
4
5
|
private env;
|
|
5
6
|
private clientHTTP;
|
|
6
7
|
constructor(env: Environment);
|
|
8
|
+
sendSMS(content: string, ctx: Context): Promise<boolean>;
|
|
7
9
|
verify(phone: string, code: number): Promise<boolean>;
|
|
8
10
|
sendVerifyCode(phone: string, friendlyName?: string | undefined): Promise<boolean>;
|
|
9
11
|
}
|
package/dist/api/SMS.api.js
CHANGED
|
@@ -10,6 +10,11 @@ class SMSAPI {
|
|
|
10
10
|
this.env = env;
|
|
11
11
|
this.clientHTTP = new HTTPClient_1.default();
|
|
12
12
|
}
|
|
13
|
+
async sendSMS(content, ctx) {
|
|
14
|
+
const endpointInfo = SMS_schema_1.SMSEndpoints.SendSMS;
|
|
15
|
+
const data = await this.clientHTTP.makeRequest(this.env, endpointInfo.uri, endpointInfo.method, { content }, ctx);
|
|
16
|
+
return data.success;
|
|
17
|
+
}
|
|
13
18
|
async verify(phone, code) {
|
|
14
19
|
const endpointInfo = SMS_schema_1.SMSEndpoints.VerifyCode;
|
|
15
20
|
const data = await this.clientHTTP.makeRequest(this.env, endpointInfo.uri, endpointInfo.method, { phone, code });
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import Context from "./Context";
|
|
1
2
|
interface SMSAPISchema {
|
|
3
|
+
sendSMS: (content: string, context: Context) => Promise<boolean>;
|
|
2
4
|
sendVerifyCode: (phone: string, friendlyName?: string) => Promise<boolean>;
|
|
3
5
|
verify: (phone: string, number: number) => Promise<boolean>;
|
|
4
6
|
}
|
|
@@ -11,5 +13,9 @@ declare const SMSEndpoints: {
|
|
|
11
13
|
uri: string;
|
|
12
14
|
method: string;
|
|
13
15
|
};
|
|
16
|
+
SendSMS: {
|
|
17
|
+
uri: string;
|
|
18
|
+
method: string;
|
|
19
|
+
};
|
|
14
20
|
};
|
|
15
21
|
export { SMSAPISchema, SMSEndpoints };
|
package/dist/model/SMS.schema.js
CHANGED