shred-api-client 2.0.3 → 2.0.5

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.
@@ -1,10 +1,12 @@
1
1
  import Context from "../model/Context";
2
2
  import { User } from "../";
3
3
  import Environment from "../model/Env";
4
+ import * as Core from "../model/core";
4
5
  declare class UserAPI implements User.IAPI {
5
6
  private env;
6
7
  private clientHTTP;
7
8
  constructor(env: Environment);
9
+ search(ctx: Context, query: Core.QueryOptions<User.Entity>): Promise<Core.APIResponse<User.Entity>>;
8
10
  deleteAccount(ctx: Context): Promise<boolean>;
9
11
  createIntegrationToken(ctx: Context): Promise<string>;
10
12
  getIntegrationToken(ctx: Context): Promise<string | null>;
@@ -5,11 +5,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const __1 = require("../");
7
7
  const HTTPClient_1 = __importDefault(require("../util/HTTPClient"));
8
+ const parseQuery_1 = require("../util/parseQuery");
8
9
  class UserAPI {
9
10
  constructor(env) {
10
11
  this.env = env;
11
12
  this.clientHTTP = new HTTPClient_1.default();
12
13
  }
14
+ async search(ctx, query) {
15
+ const endpointData = __1.User.Endpoints.Search;
16
+ const qs = (0, parseQuery_1.buildQueryString)(query);
17
+ const data = await this.clientHTTP.makeRequest(this.env, `${endpointData.uri}${qs}`, endpointData.method, null, ctx);
18
+ return data;
19
+ }
13
20
  async deleteAccount(ctx) {
14
21
  const endpointData = __1.User.Endpoints.DeleteAccount;
15
22
  const data = await this.clientHTTP.makeRequest(this.env, endpointData.uri, endpointData.method, null, ctx);
@@ -16,6 +16,6 @@ exports.Endpoints = {
16
16
  },
17
17
  UpdateNote: {
18
18
  uri: "/user-context/notes/:id/",
19
- method: "PATCH",
19
+ method: "POST",
20
20
  },
21
21
  };
@@ -1,3 +1,4 @@
1
+ import * as Core from "../core";
1
2
  import Context from "../Context";
2
3
  import { System, User, Update } from "./User.schema";
3
4
  export interface IAPI {
@@ -14,6 +15,7 @@ export interface IAPI {
14
15
  deleteAccount: (ctx: Context) => Promise<boolean>;
15
16
  getIntegrationToken: (ctx: Context) => Promise<string | null>;
16
17
  createIntegrationToken: (ctx: Context) => Promise<string>;
18
+ search: (ctx: Context, query: Core.QueryOptions<User>) => Promise<Core.APIResponse<User>>;
17
19
  createUser: (email: string, name: string, password: string, passwordConfirmation: string, profession: string | null, invitationCode: string | null) => Promise<User>;
18
20
  }
19
21
  export declare const Endpoints: {
@@ -77,4 +79,8 @@ export declare const Endpoints: {
77
79
  uri: string;
78
80
  method: string;
79
81
  };
82
+ Search: {
83
+ uri: string;
84
+ method: string;
85
+ };
80
86
  };
@@ -17,4 +17,5 @@ exports.Endpoints = {
17
17
  CreateUser: { uri: "/accounts/public/create", method: "POST" },
18
18
  UpdateUser: { uri: "/accounts/user/update", method: "PUT" },
19
19
  Setup: { uri: "/accounts/user/setup/", method: "POST" },
20
+ Search: { uri: "/accounts/users/search/", method: "GET" },
20
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shred-api-client",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "API Client for Shred",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",