shred-api-client 2.9.7 → 2.9.8

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.
package/dist/index.d.ts CHANGED
@@ -1940,6 +1940,22 @@ declare const FeedbackSchema: z.ZodObject<{
1940
1940
  }[];
1941
1941
  comment?: string | undefined;
1942
1942
  }>;
1943
+ declare const RatingSchema: z.ZodObject<{
1944
+ score: z.ZodNumber;
1945
+ comment: z.ZodOptional<z.ZodString>;
1946
+ timestamp: z.ZodNumber;
1947
+ deliveryIndex: z.ZodNumber;
1948
+ }, "strip", z.ZodTypeAny, {
1949
+ timestamp: number;
1950
+ score: number;
1951
+ deliveryIndex: number;
1952
+ comment?: string | undefined;
1953
+ }, {
1954
+ timestamp: number;
1955
+ score: number;
1956
+ deliveryIndex: number;
1957
+ comment?: string | undefined;
1958
+ }>;
1943
1959
  declare const ProjectSchema: z.ZodObject<{
1944
1960
  id: z.ZodString;
1945
1961
  title: z.ZodString;
@@ -2058,6 +2074,22 @@ declare const ProjectSchema: z.ZodObject<{
2058
2074
  type: InteractionType;
2059
2075
  timestamp: number;
2060
2076
  }>, "many">>;
2077
+ ratings: z.ZodOptional<z.ZodArray<z.ZodObject<{
2078
+ score: z.ZodNumber;
2079
+ comment: z.ZodOptional<z.ZodString>;
2080
+ timestamp: z.ZodNumber;
2081
+ deliveryIndex: z.ZodNumber;
2082
+ }, "strip", z.ZodTypeAny, {
2083
+ timestamp: number;
2084
+ score: number;
2085
+ deliveryIndex: number;
2086
+ comment?: string | undefined;
2087
+ }, {
2088
+ timestamp: number;
2089
+ score: number;
2090
+ deliveryIndex: number;
2091
+ comment?: string | undefined;
2092
+ }>, "many">>;
2061
2093
  submitTimestamp: z.ZodNumber;
2062
2094
  tenantId: z.ZodOptional<z.ZodString>;
2063
2095
  status: z.ZodNativeEnum<typeof Status$1>;
@@ -2112,6 +2144,12 @@ declare const ProjectSchema: z.ZodObject<{
2112
2144
  type: InteractionType;
2113
2145
  timestamp: number;
2114
2146
  }[] | undefined;
2147
+ ratings?: {
2148
+ timestamp: number;
2149
+ score: number;
2150
+ deliveryIndex: number;
2151
+ comment?: string | undefined;
2152
+ }[] | undefined;
2115
2153
  }, {
2116
2154
  id: string;
2117
2155
  userId: string;
@@ -2163,6 +2201,12 @@ declare const ProjectSchema: z.ZodObject<{
2163
2201
  type: InteractionType;
2164
2202
  timestamp: number;
2165
2203
  }[] | undefined;
2204
+ ratings?: {
2205
+ timestamp: number;
2206
+ score: number;
2207
+ deliveryIndex: number;
2208
+ comment?: string | undefined;
2209
+ }[] | undefined;
2166
2210
  }>;
2167
2211
  type ProjectCreation = Pick<Project, "title" | "instructions" | "captionStyle" | "assets">;
2168
2212
  type SendToApproval = {
@@ -2179,6 +2223,8 @@ type Project = z.infer<typeof ProjectSchema>;
2179
2223
  type TimelineItem = z.infer<typeof TimelineItemSchema>;
2180
2224
  type Interaction = z.infer<typeof InteractionSchema>;
2181
2225
  type Feedback = z.infer<typeof FeedbackSchema>;
2226
+ type Rating = z.infer<typeof RatingSchema>;
2227
+ type RatingInput = Pick<Rating, "score" | "comment">;
2182
2228
 
2183
2229
  interface IAPI$7 {
2184
2230
  reorder: (context: Context, projectId: string, position: number) => Promise<boolean>;
@@ -2200,6 +2246,7 @@ interface IAPI$7 {
2200
2246
  getNext: (context: Context, userId: string) => Promise<Project | null>;
2201
2247
  getUserHistory: (context: Context, userId: string) => Promise<APIResponse<Project>>;
2202
2248
  interact: (context: Context, projectId: string, type: InteractionType) => Promise<boolean>;
2249
+ rate: (context: Context, projectId: string, data: RatingInput) => Promise<boolean>;
2203
2250
  getPoolSize(context: Context): Promise<number>;
2204
2251
  permissions: {
2205
2252
  isEligibleForFreeProject(context: Context): Promise<boolean>;
@@ -2294,6 +2341,10 @@ declare const Endpoints$6: {
2294
2341
  uri: string;
2295
2342
  method: string;
2296
2343
  };
2344
+ Rate: {
2345
+ uri: string;
2346
+ method: string;
2347
+ };
2297
2348
  };
2298
2349
 
2299
2350
  type StatusConfigType = {
@@ -2339,6 +2390,9 @@ type index$8_InteractionType = InteractionType;
2339
2390
  declare const index$8_InteractionType: typeof InteractionType;
2340
2391
  type index$8_ProjectCreation = ProjectCreation;
2341
2392
  declare const index$8_ProjectSchema: typeof ProjectSchema;
2393
+ type index$8_Rating = Rating;
2394
+ type index$8_RatingInput = RatingInput;
2395
+ declare const index$8_RatingSchema: typeof RatingSchema;
2342
2396
  type index$8_SendToApproval = SendToApproval;
2343
2397
  declare const index$8_StatusConfig: typeof StatusConfig;
2344
2398
  type index$8_StatusConfigType = StatusConfigType;
@@ -2347,7 +2401,7 @@ declare const index$8_Styles: typeof Styles;
2347
2401
  type index$8_TimelineItem = TimelineItem;
2348
2402
  declare const index$8_TimelineItemSchema: typeof TimelineItemSchema;
2349
2403
  declare namespace index$8 {
2350
- export { type index$8_Approve as Approve, index$8_CaptionStyle as CaptionStyle, Endpoints$6 as Endpoints, type Project as Entity, type index$8_Feedback as Feedback, index$8_FeedbackSchema as FeedbackSchema, type IAPI$7 as IAPI, type index$8_Interaction as Interaction, index$8_InteractionSchema as InteractionSchema, index$8_InteractionType as InteractionType, type index$8_ProjectCreation as ProjectCreation, index$8_ProjectSchema as ProjectSchema, type index$8_SendToApproval as SendToApproval, Status$1 as Status, index$8_StatusConfig as StatusConfig, type index$8_StatusConfigType as StatusConfigType, type index$8_Style as Style, index$8_Styles as Styles, type index$8_TimelineItem as TimelineItem, index$8_TimelineItemSchema as TimelineItemSchema };
2404
+ export { type index$8_Approve as Approve, index$8_CaptionStyle as CaptionStyle, Endpoints$6 as Endpoints, type Project as Entity, type index$8_Feedback as Feedback, index$8_FeedbackSchema as FeedbackSchema, type IAPI$7 as IAPI, type index$8_Interaction as Interaction, index$8_InteractionSchema as InteractionSchema, index$8_InteractionType as InteractionType, type index$8_ProjectCreation as ProjectCreation, index$8_ProjectSchema as ProjectSchema, type index$8_Rating as Rating, type index$8_RatingInput as RatingInput, index$8_RatingSchema as RatingSchema, type index$8_SendToApproval as SendToApproval, Status$1 as Status, index$8_StatusConfig as StatusConfig, type index$8_StatusConfigType as StatusConfigType, type index$8_Style as Style, index$8_Styles as Styles, type index$8_TimelineItem as TimelineItem, index$8_TimelineItemSchema as TimelineItemSchema };
2351
2405
  }
2352
2406
 
2353
2407
  declare const DailyMilestoneSchema: z.ZodObject<{
@@ -3428,6 +3482,7 @@ declare const Actions: {
3428
3482
  readonly PROJECT_REORDER: "project.reorder";
3429
3483
  readonly PROJECT_REQUEST_REVIEW: "project.request_review";
3430
3484
  readonly PROJECT_RECORD_INTERACTION: "project.record_interaction";
3485
+ readonly PROJECT_RATE: "project.rate";
3431
3486
  readonly PROJECT_CHECK_FREE_QUOTA: "project.check_free_quota";
3432
3487
  readonly EDITOR_LIST: "editor.list";
3433
3488
  readonly EDITOR_GET: "editor.get";
package/dist/index.js CHANGED
@@ -5055,6 +5055,7 @@ __export(project_exports, {
5055
5055
  InteractionSchema: () => InteractionSchema,
5056
5056
  InteractionType: () => InteractionType,
5057
5057
  ProjectSchema: () => ProjectSchema,
5058
+ RatingSchema: () => RatingSchema,
5058
5059
  Status: () => Status2,
5059
5060
  StatusConfig: () => StatusConfig,
5060
5061
  Styles: () => Styles,
@@ -5140,6 +5141,12 @@ var FeedbackSchema = external_exports.object({
5140
5141
  ),
5141
5142
  comment: external_exports.string().optional()
5142
5143
  });
5144
+ var RatingSchema = external_exports.object({
5145
+ score: external_exports.number().int().min(1).max(5),
5146
+ comment: external_exports.string().max(500).optional(),
5147
+ timestamp: external_exports.number(),
5148
+ deliveryIndex: external_exports.number().int().min(0)
5149
+ });
5143
5150
  var ProjectSchema = external_exports.object({
5144
5151
  id: external_exports.string(),
5145
5152
  title: external_exports.string(),
@@ -5158,6 +5165,7 @@ var ProjectSchema = external_exports.object({
5158
5165
  isFree: external_exports.boolean().optional(),
5159
5166
  timeline: external_exports.array(TimelineItemSchema),
5160
5167
  interactions: external_exports.array(InteractionSchema).optional(),
5168
+ ratings: external_exports.array(RatingSchema).optional(),
5161
5169
  submitTimestamp: external_exports.number(),
5162
5170
  tenantId: external_exports.string().optional(),
5163
5171
  status: external_exports.nativeEnum(Status2)
@@ -5192,7 +5200,8 @@ var Endpoints3 = {
5192
5200
  Assign: { uri: "/projects/:projectId/assign/", method: "POST" },
5193
5201
  GetUserHistory: { uri: "/projects/user/:userId/history/", method: "GET" },
5194
5202
  GetPoolSize: { uri: "/projects/pool/size/", method: "GET" },
5195
- Interact: { uri: "/projects/:projectId/interactions/", method: "POST" }
5203
+ Interact: { uri: "/projects/:projectId/interactions/", method: "POST" },
5204
+ Rate: { uri: "/projects/:projectId/rating/", method: "POST" }
5196
5205
  };
5197
5206
 
5198
5207
  // src/model/project/StatusConfig.ts
@@ -5618,6 +5627,18 @@ var ProjectAPI = class {
5618
5627
  );
5619
5628
  return data.success;
5620
5629
  }
5630
+ async rate(ctx, projectId, data) {
5631
+ const endpointData = Endpoints3.Rate;
5632
+ const endpoint = endpointData.uri.replace(":projectId", projectId);
5633
+ const result = await this.clientHTTP.makeRequest(
5634
+ this.env,
5635
+ endpoint,
5636
+ endpointData.method,
5637
+ data,
5638
+ ctx
5639
+ );
5640
+ return result.success;
5641
+ }
5621
5642
  async start(context) {
5622
5643
  const endpointData = Endpoints3.StartEdition;
5623
5644
  const data = await this.clientHTTP.makeRequest(
@@ -6056,6 +6077,7 @@ var Actions = {
6056
6077
  PROJECT_REORDER: "project.reorder",
6057
6078
  PROJECT_REQUEST_REVIEW: "project.request_review",
6058
6079
  PROJECT_RECORD_INTERACTION: "project.record_interaction",
6080
+ PROJECT_RATE: "project.rate",
6059
6081
  PROJECT_CHECK_FREE_QUOTA: "project.check_free_quota",
6060
6082
  // — Editors —
6061
6083
  EDITOR_LIST: "editor.list",
@@ -6143,6 +6165,7 @@ var ActionCatalog = {
6143
6165
  [Actions.PROJECT_REORDER]: { label: "Reorder your own projects", group: "Projects" },
6144
6166
  [Actions.PROJECT_REQUEST_REVIEW]: { label: "Request a review on your own project", group: "Projects" },
6145
6167
  [Actions.PROJECT_RECORD_INTERACTION]: { label: "Record an interaction on your own project", group: "Projects" },
6168
+ [Actions.PROJECT_RATE]: { label: "Rate a delivered video on your own project", group: "Projects" },
6146
6169
  [Actions.PROJECT_CHECK_FREE_QUOTA]: { label: "Check your own free-project quota", group: "Projects" },
6147
6170
  // Editors (staff)
6148
6171
  [Actions.EDITOR_LIST]: { label: "List all editors", group: "Editors" },