shred-api-client 2.0.4 → 2.0.6

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.
@@ -6,6 +6,7 @@ declare class ProjectAPI implements Project.IAPI {
6
6
  private env;
7
7
  private clientHTTP;
8
8
  constructor(env: Environment);
9
+ getUserHistory(context: Context, userId: string): Promise<Core.APIResponse<Project.Entity>>;
9
10
  find(context: Context, projectId: string): Promise<Project.Entity>;
10
11
  create(context: Context, createData: Project.ProjectCreation): Promise<Project.Entity>;
11
12
  review(ctx: Context, pId: string, revision: string): Promise<boolean>;
@@ -34,6 +34,12 @@ class ProjectAPI {
34
34
  this.env = env;
35
35
  this.clientHTTP = new HTTPClient_1.default();
36
36
  }
37
+ async getUserHistory(context, userId) {
38
+ const endpointData = Project.Endpoints.GetUserHistory;
39
+ const endpoint = endpointData.uri.replace(":userId", userId);
40
+ const data = await this.clientHTTP.makeRequest(this.env, endpoint, endpointData.method, null, context);
41
+ return data;
42
+ }
37
43
  async find(context, projectId) {
38
44
  const endpointData = Project.Endpoints.FindOne;
39
45
  const endpoint = endpointData.uri.replace(":projectId", projectId);
@@ -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);
@@ -13,6 +13,7 @@ export interface IAPI {
13
13
  deny: (context: Context, projectId: string, denyFeedback: string, categories?: string[]) => Promise<boolean>;
14
14
  unschedule: (context: Context, projectId: string) => Promise<boolean>;
15
15
  rollback: (context: Context, projectId: string) => Promise<boolean>;
16
+ getUserHistory: (context: Context, userId: string) => Promise<Core.APIResponse<Project>>;
16
17
  }
17
18
  export declare const Endpoints: {
18
19
  List: {
@@ -63,4 +64,8 @@ export declare const Endpoints: {
63
64
  uri: string;
64
65
  method: string;
65
66
  };
67
+ GetUserHistory: {
68
+ uri: string;
69
+ method: string;
70
+ };
66
71
  };
@@ -17,4 +17,5 @@ exports.Endpoints = {
17
17
  Unschedule: { uri: "/projects/:projectId/unschedule/", method: "POST" },
18
18
  Rollback: { uri: "/projects/:projectId/rollback/", method: "POST" },
19
19
  Deny: { uri: "/projects/:projectId/deny/", method: "POST" },
20
+ GetUserHistory: { uri: "/projects/user/:userId/history/", method: "GET" },
20
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.4",
3
+ "version": "2.0.6",
4
4
  "description": "API Client for Shred",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",