shred-api-client 1.1.5 → 1.1.7

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,8 @@
1
+ import Context from "../src/model/Context";
2
+ import { Prompt, PromptAPISchema } from "../src/model/Prompt.schema";
3
+ declare class PromptAPI implements PromptAPISchema {
4
+ private clientHTTP;
5
+ constructor();
6
+ getPrompt(context: Context): Promise<Prompt>;
7
+ }
8
+ export default PromptAPI;
@@ -0,0 +1,18 @@
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 Prompt_schema_1 = require("../src/model/Prompt.schema");
8
+ class PromptAPI {
9
+ constructor() {
10
+ this.clientHTTP = new HTTPClient_1.default();
11
+ }
12
+ async getPrompt(context) {
13
+ const endpointInfo = Prompt_schema_1.PromptEndpoints.GetPrompt;
14
+ const data = await this.clientHTTP.makeRequest(endpointInfo.uri, endpointInfo.method, context);
15
+ return data;
16
+ }
17
+ }
18
+ exports.default = PromptAPI;
@@ -0,0 +1,29 @@
1
+ import Context from "./Context";
2
+ interface PromptAPISchema {
3
+ getPrompt: (c: Context) => Promise<Prompt>;
4
+ }
5
+ declare const PromptEndpoints: {
6
+ GetPrompt: {
7
+ uri: string;
8
+ method: string;
9
+ };
10
+ };
11
+ type Script = {
12
+ id: string;
13
+ title: string;
14
+ content: string;
15
+ };
16
+ type Category = {
17
+ id: string;
18
+ title: string;
19
+ pictureUrl: string;
20
+ backgroundColor: string;
21
+ active: boolean;
22
+ scripts: Script[];
23
+ };
24
+ type Prompt = {
25
+ id: string;
26
+ tenantId: string;
27
+ categories: Category[];
28
+ };
29
+ export { PromptAPISchema, Prompt, PromptEndpoints };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PromptEndpoints = void 0;
4
+ const PromptEndpoints = {
5
+ GetPrompt: {
6
+ uri: "/prompts/getPrompt",
7
+ method: "GET",
8
+ },
9
+ };
10
+ exports.PromptEndpoints = PromptEndpoints;
@@ -1,7 +1,9 @@
1
1
  import { Product as TProduct, Subscription as TSubscription } from "./model/Subscription.schema";
2
2
  import { User as TUser } from "./model/User.schema";
3
+ import { Prompt as TPrompt } from "./model/Prompt.schema";
3
4
  export declare namespace Shred {
4
5
  type Product = TProduct;
5
6
  type Subscription = TSubscription;
7
+ type Prompt = TPrompt;
6
8
  type User = TUser;
7
9
  }
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const axios_1 = __importDefault(require("axios"));
7
7
  const HOSTS = {
8
- prod: "https://api.shredmedia.co",
8
+ prod: "https://api.shreditapp.com",
9
9
  staging: "https://api.staging.shreditapp.com",
10
10
  };
11
11
  const OLD_HOSTS = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shred-api-client",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "API Client for Shred",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",