shred-api-client 1.14.1 → 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>;
@@ -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);
@@ -27,6 +27,7 @@ interface ProjectAPISchema {
27
27
  deny: (context: Context, projectId: string, denyFeedback: string, categories?: string[]) => Promise<boolean>;
28
28
  unschedule: (context: Context, projectId: string) => Promise<boolean>;
29
29
  rollback: (context: Context, projectId: string) => Promise<boolean>;
30
+ getGoals: (context: Context) => Promise<Goal[]>;
30
31
  }
31
32
  declare const ProjectEndpoints: {
32
33
  List: {
@@ -41,6 +42,10 @@ declare const ProjectEndpoints: {
41
42
  uri: string;
42
43
  method: string;
43
44
  };
45
+ GetGoals: {
46
+ uri: string;
47
+ method: string;
48
+ };
44
49
  Review: {
45
50
  uri: string;
46
51
  method: string;
@@ -122,4 +127,26 @@ type Project = {
122
127
  tenantId?: string;
123
128
  status: Status;
124
129
  };
125
- 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",
@@ -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.1",
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",