shred-api-client 1.14.0 → 1.14.2

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,11 @@
1
1
  import Environment from "../model/Env";
2
- import { Approve, Project, ProjectAPISchema, ProjectCreation, Query, SendToApproval } from "../model/Project.schema";
2
+ import { Approve, Goal, Project, ProjectAPISchema, ProjectCreation, Query, SendToApproval } from "../model/Project.schema";
3
3
  import Context from "../model/Context";
4
4
  declare class ProjectAPI implements ProjectAPISchema {
5
5
  private env;
6
6
  private clientHTTP;
7
7
  constructor(env: Environment);
8
+ getGoals(context: Context): Promise<Goal[]>;
8
9
  find(context: Context, projectId: string): Promise<Project>;
9
10
  create(context: Context, createData: ProjectCreation): Promise<Project>;
10
11
  review(ctx: Context, pId: string, revision: string): Promise<boolean>;
@@ -12,6 +13,7 @@ declare class ProjectAPI implements ProjectAPISchema {
12
13
  list(context: Context, query: Query): Promise<Project[]>;
13
14
  deny(ctx: Context, pId: string, denyFB: string, categories?: string[]): Promise<boolean>;
14
15
  unschedule(context: Context, projectId: string): Promise<boolean>;
16
+ rollback(context: Context, projectId: string): Promise<boolean>;
15
17
  start(context: Context, projectId: string): Promise<boolean>;
16
18
  approve(ctx: Context, pId: string, approve: Approve): Promise<boolean>;
17
19
  sendToApproval(context: Context, projectId: string, approval: SendToApproval): Promise<boolean>;
@@ -10,6 +10,11 @@ class ProjectAPI {
10
10
  this.env = env;
11
11
  this.clientHTTP = new HTTPClient_1.default();
12
12
  }
13
+ async getGoals(context) {
14
+ const endpointData = Project_schema_1.ProjectEndpoints.GetGoals;
15
+ const data = await this.clientHTTP.makeRequest(this.env, endpointData.uri, endpointData.method, null, context);
16
+ return data;
17
+ }
13
18
  async find(context, projectId) {
14
19
  const endpointData = Project_schema_1.ProjectEndpoints.FindOne;
15
20
  const endpoint = endpointData.uri.replace(":projectId", projectId);
@@ -50,6 +55,12 @@ class ProjectAPI {
50
55
  const data = await this.clientHTTP.makeRequest(this.env, endpoint, endpointData.method, null, context);
51
56
  return data.success;
52
57
  }
58
+ async rollback(context, projectId) {
59
+ const endpointData = Project_schema_1.ProjectEndpoints.Rollback;
60
+ const endpoint = endpointData.uri.replace(":projectId", projectId);
61
+ const data = await this.clientHTTP.makeRequest(this.env, endpoint, endpointData.method, null, context);
62
+ return data.success;
63
+ }
53
64
  async start(context, projectId) {
54
65
  const endpointData = Project_schema_1.ProjectEndpoints.StartEdition;
55
66
  const endpoint = endpointData.uri.replace(":projectId", projectId);
@@ -26,6 +26,8 @@ interface ProjectAPISchema {
26
26
  approve: (context: Context, projectId: string, data: Approve) => Promise<boolean>;
27
27
  deny: (context: Context, projectId: string, denyFeedback: string, categories?: string[]) => Promise<boolean>;
28
28
  unschedule: (context: Context, projectId: string) => Promise<boolean>;
29
+ rollback: (context: Context, projectId: string) => Promise<boolean>;
30
+ getGoals: (context: Context) => Promise<Goal[]>;
29
31
  }
30
32
  declare const ProjectEndpoints: {
31
33
  List: {
@@ -40,6 +42,10 @@ declare const ProjectEndpoints: {
40
42
  uri: string;
41
43
  method: string;
42
44
  };
45
+ GetGoals: {
46
+ uri: string;
47
+ method: string;
48
+ };
43
49
  Review: {
44
50
  uri: string;
45
51
  method: string;
@@ -64,6 +70,10 @@ declare const ProjectEndpoints: {
64
70
  uri: string;
65
71
  method: string;
66
72
  };
73
+ Rollback: {
74
+ uri: string;
75
+ method: string;
76
+ };
67
77
  Deny: {
68
78
  uri: string;
69
79
  method: string;
@@ -117,4 +127,26 @@ type Project = {
117
127
  tenantId?: string;
118
128
  status: Status;
119
129
  };
120
- export { Project, ProjectAPISchema, ProjectEndpoints, TimelineItem };
130
+ type DailyMilestone = {
131
+ id: string;
132
+ date: string;
133
+ target: number;
134
+ progress: number;
135
+ };
136
+ type WeeklyMilestone = {
137
+ id: string;
138
+ week: string;
139
+ target: number;
140
+ progress: number;
141
+ dailyMilestones: DailyMilestone[];
142
+ };
143
+ type Goal = {
144
+ id: string;
145
+ editorId: string;
146
+ month: string;
147
+ target: number;
148
+ progress: number;
149
+ createdAt: number;
150
+ weeklyMilestones: WeeklyMilestone[];
151
+ };
152
+ export { Project, DailyMilestone, WeeklyMilestone, Goal, ProjectAPISchema, ProjectEndpoints, TimelineItem, };
@@ -14,6 +14,10 @@ const ProjectEndpoints = {
14
14
  uri: `/projects/:projectId/`,
15
15
  method: "GET",
16
16
  },
17
+ GetGoals: {
18
+ uri: `/projects/goals/list/`,
19
+ method: "GET",
20
+ },
17
21
  Review: {
18
22
  uri: "/projects/:projectId/review/",
19
23
  method: "POST",
@@ -38,6 +42,10 @@ const ProjectEndpoints = {
38
42
  uri: "/projects/:projectId/unschedule/",
39
43
  method: "POST",
40
44
  },
45
+ Rollback: {
46
+ uri: "/projects/:projectId/rollback/",
47
+ method: "POST",
48
+ },
41
49
  Deny: {
42
50
  uri: "/projects/:projectId/deny/",
43
51
  method: "POST",
@@ -4,7 +4,7 @@ import { APIResponse } from "./model/Api";
4
4
  import { System as TSystem, User as TUser, Preferences as UserPreferences, Role as TRole } from "./model/User.schema";
5
5
  import { Email as TEmail } from "./model/Email.schema";
6
6
  import { Asset as TAsset } from "./model/Asset.schema";
7
- import { Project as TProject, TimelineItem as TTimlineItem } from "./model/Project.schema";
7
+ import { Project as TProject, TimelineItem as TTimlineItem, WeeklyMilestone as TWeeklyMilestone, DailyMilestone as TDailyMilestone, Goal as TGoal } from "./model/Project.schema";
8
8
  import { Tenant as TTenant } from "./model/Tenant.schema";
9
9
  import { Track as TTrack } from "./model/Track.schema";
10
10
  import { Prompt as TPrompt, Script as TScript, Category as TCategory } from "./model/Prompt.schema";
@@ -30,6 +30,11 @@ export declare namespace Shred {
30
30
  type Category = TCategory;
31
31
  }
32
32
  }
33
+ export declare namespace Goal {
34
+ type WeeklyMilestone = TWeeklyMilestone;
35
+ type DailyMilestone = TDailyMilestone;
36
+ type Month = TGoal;
37
+ }
33
38
  export declare namespace Notification {
34
39
  enum Frequency {
35
40
  DAILY = "daily",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shred-api-client",
3
- "version": "1.14.0",
3
+ "version": "1.14.2",
4
4
  "description": "API Client for Shred",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",