shred-api-client 1.2.11 → 1.3.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/dist/api/Email.api.d.ts +10 -0
- package/dist/api/Email.api.js +19 -0
- package/dist/api/Subscription.api.d.ts +1 -1
- package/dist/model/Api.d.ts +2 -0
- package/dist/model/Api.js +2 -0
- package/dist/model/Email.schema.d.ts +15 -20
- package/dist/model/Email.schema.js +8 -0
- package/dist/model/Subscription.schema.d.ts +1 -1
- package/dist/namespace.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Context from "../model/Context";
|
|
2
|
+
import Environment from "../model/Env";
|
|
3
|
+
import { EmailAPISchema, Email } from "../model/Email.schema";
|
|
4
|
+
declare class EmailAPI implements EmailAPISchema {
|
|
5
|
+
private env;
|
|
6
|
+
private clientHTTP;
|
|
7
|
+
constructor(env: Environment);
|
|
8
|
+
send(email: Email, context: Context): Promise<boolean>;
|
|
9
|
+
}
|
|
10
|
+
export default EmailAPI;
|
|
@@ -0,0 +1,19 @@
|
|
|
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 Email_schema_1 = require("../model/Email.schema");
|
|
8
|
+
class EmailAPI {
|
|
9
|
+
constructor(env) {
|
|
10
|
+
this.env = env;
|
|
11
|
+
this.clientHTTP = new HTTPClient_1.default();
|
|
12
|
+
}
|
|
13
|
+
async send(email, context) {
|
|
14
|
+
const endpointInfo = Email_schema_1.EmailEndpoints.SendEmail;
|
|
15
|
+
const data = await this.clientHTTP.makeRequest(this.env, endpointInfo.uri, endpointInfo.method, email, context);
|
|
16
|
+
return data.result;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.default = EmailAPI;
|
|
@@ -6,6 +6,6 @@ declare class SubscriptionAPI implements SubscriptionAPISchema {
|
|
|
6
6
|
private clientHTTP;
|
|
7
7
|
constructor(env: Environment);
|
|
8
8
|
getProducts(): Promise<Product[]>;
|
|
9
|
-
createCheckout(planId: string, ctx: Context): Promise<string>;
|
|
9
|
+
createCheckout(planId: string | null, ctx: Context): Promise<string>;
|
|
10
10
|
}
|
|
11
11
|
export default SubscriptionAPI;
|
package/dist/model/Api.d.ts
CHANGED
|
@@ -3,10 +3,12 @@ import { PromptAPISchema } from "./Prompt.schema";
|
|
|
3
3
|
import { SMSAPISchema } from "./SMS.schema";
|
|
4
4
|
import { SubscriptionAPISchema } from "./Subscription.schema";
|
|
5
5
|
import { UserAPISchema } from "./User.schema";
|
|
6
|
+
import { EmailAPISchema } from "./Email.schema";
|
|
6
7
|
export declare class ShredAPI {
|
|
7
8
|
user: UserAPISchema;
|
|
8
9
|
subscription: SubscriptionAPISchema;
|
|
9
10
|
prompt: PromptAPISchema;
|
|
10
11
|
sms: SMSAPISchema;
|
|
12
|
+
email: EmailAPISchema;
|
|
11
13
|
constructor(env: Environment);
|
|
12
14
|
}
|
package/dist/model/Api.js
CHANGED
|
@@ -8,12 +8,14 @@ const SMS_api_1 = __importDefault(require("../api/SMS.api"));
|
|
|
8
8
|
const Prompt_api_1 = __importDefault(require("../api/Prompt.api"));
|
|
9
9
|
const Subscription_api_1 = __importDefault(require("../api/Subscription.api"));
|
|
10
10
|
const User_api_1 = __importDefault(require("../api/User.api"));
|
|
11
|
+
const Email_api_1 = __importDefault(require("../src/api/Email.api"));
|
|
11
12
|
class ShredAPI {
|
|
12
13
|
constructor(env) {
|
|
13
14
|
this.user = new User_api_1.default(env);
|
|
14
15
|
this.prompt = new Prompt_api_1.default(env);
|
|
15
16
|
this.subscription = new Subscription_api_1.default(env);
|
|
16
17
|
this.sms = new SMS_api_1.default(env);
|
|
18
|
+
this.email = new Email_api_1.default(env);
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
exports.ShredAPI = ShredAPI;
|
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import Context from "./Context";
|
|
2
|
+
interface EmailAPISchema {
|
|
3
|
+
send: (email: Email, c: Context) => Promise<boolean>;
|
|
4
|
+
}
|
|
5
|
+
declare const EmailEndpoints: {
|
|
6
|
+
SendEmail: {
|
|
7
|
+
uri: string;
|
|
8
|
+
method: string;
|
|
9
|
+
};
|
|
8
10
|
};
|
|
9
|
-
type
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
customerId: string;
|
|
14
|
-
registered: boolean;
|
|
15
|
-
profession?: string;
|
|
16
|
-
registeredAt: number;
|
|
17
|
-
fcmToken?: string;
|
|
18
|
-
photoUrl?: string;
|
|
19
|
-
preferences?: Preferences;
|
|
20
|
-
invitationCode?: string;
|
|
11
|
+
type Email = {
|
|
12
|
+
to?: string;
|
|
13
|
+
subject: string;
|
|
14
|
+
body: string;
|
|
21
15
|
};
|
|
22
|
-
export
|
|
16
|
+
export default Email;
|
|
17
|
+
export { Email, EmailEndpoints, EmailAPISchema };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Context from "./Context";
|
|
2
2
|
interface SubscriptionAPISchema {
|
|
3
3
|
getProducts: () => Promise<Product[]>;
|
|
4
|
-
createCheckout: (planId: string, ctx: Context) => Promise<string>;
|
|
4
|
+
createCheckout: (planId: string | null, ctx: Context) => Promise<string>;
|
|
5
5
|
}
|
|
6
6
|
declare const SubscriptionEndpoints: {
|
|
7
7
|
GetProducts: {
|
package/dist/namespace.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Product as TProduct, Subscription as TSubscription } from "./model/Subscription.schema";
|
|
2
2
|
import { User as TUser, Role as TRole } from "./model/User.schema";
|
|
3
|
+
import { Email as TEmail } from "./model/Email.schema";
|
|
3
4
|
import { Tenant as TTenant } from "./model/Tenant.schema";
|
|
4
5
|
import { Prompt as TPrompt, Script as TScript, Category as TCategory } from "./model/Prompt.schema";
|
|
5
6
|
export declare namespace Permissions {
|
|
@@ -10,6 +11,7 @@ export declare namespace Shred {
|
|
|
10
11
|
type Product = TProduct;
|
|
11
12
|
type Subscription = TSubscription;
|
|
12
13
|
type User = TUser;
|
|
14
|
+
type Email = TEmail;
|
|
13
15
|
namespace PromptTypes {
|
|
14
16
|
type Prompt = TPrompt;
|
|
15
17
|
type Script = TScript;
|