shred-api-client 1.10.7 → 1.10.9

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.
@@ -0,0 +1,10 @@
1
+ import Environment from "../model/Env";
2
+ import { NotificationSchema, Notification } from "../model/Notification.schema";
3
+ import Context from "../model/Context";
4
+ declare class NotificationAPI implements NotificationSchema {
5
+ private env;
6
+ private clientHTTP;
7
+ constructor(env: Environment);
8
+ push(ctx: Context, notification: Notification): Promise<boolean>;
9
+ }
10
+ export default NotificationAPI;
@@ -4,16 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const HTTPClient_1 = __importDefault(require("../util/HTTPClient"));
7
- const PushNotification_schema_1 = require("../model/PushNotification.schema");
8
- class PushNotificationAPI {
7
+ const Notification_schema_1 = require("../model/Notification.schema");
8
+ class NotificationAPI {
9
9
  constructor(env) {
10
10
  this.env = env;
11
11
  this.clientHTTP = new HTTPClient_1.default();
12
12
  }
13
13
  async push(ctx, notification) {
14
- const endpointInfo = PushNotification_schema_1.PushNotificationEndpoints.Push;
14
+ const endpointInfo = Notification_schema_1.NotificationEndpoints.Push;
15
15
  const data = await this.clientHTTP.makeRequest(this.env, endpointInfo.uri, endpointInfo.method, notification, ctx);
16
16
  return data.success;
17
17
  }
18
18
  }
19
- exports.default = PushNotificationAPI;
19
+ exports.default = NotificationAPI;
@@ -1,6 +1,6 @@
1
1
  import Environment from "./Env";
2
2
  import { PromptAPISchema } from "./Prompt.schema";
3
- import { PushNotificationSchema } from "./PushNotification.schema";
3
+ import { NotificationSchema } from "./Notification.schema";
4
4
  import { SubscriptionAPISchema } from "./Subscription.schema";
5
5
  import { UserAPISchema } from "./User.schema";
6
6
  import { EmailAPISchema } from "./Email.schema";
@@ -11,7 +11,7 @@ export declare class ShredAPI {
11
11
  user: UserAPISchema;
12
12
  subscription: SubscriptionAPISchema;
13
13
  prompt: PromptAPISchema;
14
- pushNotification: PushNotificationSchema;
14
+ pushNotification: NotificationSchema;
15
15
  email: EmailAPISchema;
16
16
  tenant: TenantAPISchema;
17
17
  app: APPConfigSchema;
package/dist/model/Api.js CHANGED
@@ -4,7 +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 PushNotification_api_1 = __importDefault(require("../api/PushNotification.api"));
7
+ const Notification_api_1 = __importDefault(require("../api/Notification.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 Tenant_api_1 = __importDefault(require("../api/Tenant.api"));
@@ -17,7 +17,7 @@ class ShredAPI {
17
17
  this.user = new User_api_1.default(env);
18
18
  this.prompt = new Prompt_api_1.default(env);
19
19
  this.subscription = new Subscription_api_1.default(env);
20
- this.pushNotification = new PushNotification_api_1.default(env);
20
+ this.pushNotification = new Notification_api_1.default(env);
21
21
  this.email = new Email_api_1.default(env);
22
22
  this.tenant = new Tenant_api_1.default(env);
23
23
  this.project = new Project_api_1.default(env);
@@ -1,48 +1,45 @@
1
1
  import Context from "./Context";
2
2
  import { Notification } from "./../namespace";
3
- interface PushNotificationSchema {
4
- push: (context: Context, notification: PushNotification) => Promise<boolean>;
3
+ interface NotificationSchema {
4
+ push: (context: Context, notification: Notification) => Promise<boolean>;
5
5
  }
6
- declare const PushNotificationEndpoints: {
6
+ declare const NotificationEndpoints: {
7
7
  Push: {
8
8
  uri: string;
9
9
  method: string;
10
10
  };
11
11
  };
12
- type NotificationCriteria = {
12
+ type Criteria = {
13
13
  type: Notification.CriteriaType;
14
14
  params: Record<string, any>;
15
15
  };
16
- type NotificationHistory = {
16
+ type History = {
17
17
  executedAt: number;
18
18
  status: "success" | "failed" | "info" | "warn";
19
19
  notifiedUsers?: number;
20
20
  executionTimeDuration?: number;
21
21
  };
22
- type NotificationTrigger = {
22
+ type Trigger = {
23
23
  id: string;
24
24
  title: string;
25
25
  description: string;
26
26
  transportType: Notification.TransportType[];
27
- notification: {
28
- title: string;
29
- body: string;
30
- };
27
+ notification: Notification;
31
28
  executionTime: string;
32
29
  repeatDays: Notification.WeekDay[];
33
- history?: NotificationHistory[];
30
+ history?: History[];
34
31
  status: Notification.Status;
35
32
  isRecurring: boolean;
36
33
  executionDate?: number;
37
- criteria: NotificationCriteria;
34
+ criteria: Criteria;
38
35
  nextExecution?: number;
39
36
  createdAt?: number;
40
37
  modified?: number;
41
38
  };
42
- type PushNotification = {
39
+ type Notification = {
43
40
  title: string;
44
41
  body: string;
45
- userToken: string;
46
- metadata: any;
42
+ userToken?: string;
43
+ metadata?: any;
47
44
  };
48
- export { PushNotificationSchema, PushNotificationEndpoints, PushNotification, NotificationTrigger, NotificationCriteria, NotificationHistory, };
45
+ export { NotificationSchema, NotificationEndpoints, Notification, Trigger, Criteria, History, };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Notification = exports.NotificationEndpoints = void 0;
4
+ const namespace_1 = require("./../namespace");
5
+ Object.defineProperty(exports, "Notification", { enumerable: true, get: function () { return namespace_1.Notification; } });
6
+ const NotificationEndpoints = {
7
+ Push: {
8
+ uri: "/notifications/push/",
9
+ method: "POST",
10
+ },
11
+ };
12
+ exports.NotificationEndpoints = NotificationEndpoints;
@@ -98,6 +98,7 @@ type User = {
98
98
  preferences?: Preferences;
99
99
  tenantId?: string;
100
100
  editorId?: string;
101
+ timezone?: string;
101
102
  customerId: string;
102
103
  role: Role;
103
104
  };
@@ -1,5 +1,5 @@
1
1
  import { Product as TProduct, Subscription as TSubscription, Charge as TCharge } from "./model/Subscription.schema";
2
- import { NotificationTrigger as TTrigger, NotificationCriteria as TCriteria, NotificationHistory as THistory } from "./model/PushNotification.schema";
2
+ import { Trigger as TTrigger, Criteria as TCriteria, Notification as TNContent, History as THistory } from "./model/Notification.schema";
3
3
  import { System as TSystem, User as TUser, Preferences as UserPreferences, Role as TRole } from "./model/User.schema";
4
4
  import { Email as TEmail } from "./model/Email.schema";
5
5
  import { Asset as TAsset } from "./model/Asset.schema";
@@ -59,6 +59,7 @@ export declare namespace Notification {
59
59
  type Trigger = TTrigger;
60
60
  type Criteria = TCriteria;
61
61
  type History = THistory;
62
+ type Item = TNContent;
62
63
  }
63
64
  export declare namespace User {
64
65
  type Preferences = UserPreferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shred-api-client",
3
- "version": "1.10.7",
3
+ "version": "1.10.9",
4
4
  "description": "API Client for Shred",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,10 +0,0 @@
1
- import Environment from "../model/Env";
2
- import { PushNotificationSchema, PushNotification } from "../model/PushNotification.schema";
3
- import Context from "../model/Context";
4
- declare class PushNotificationAPI implements PushNotificationSchema {
5
- private env;
6
- private clientHTTP;
7
- constructor(env: Environment);
8
- push(ctx: Context, notification: PushNotification): Promise<boolean>;
9
- }
10
- export default PushNotificationAPI;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PushNotificationEndpoints = void 0;
4
- const PushNotificationEndpoints = {
5
- Push: {
6
- uri: "/notifications/push/",
7
- method: "POST",
8
- },
9
- };
10
- exports.PushNotificationEndpoints = PushNotificationEndpoints;