shred-api-client 2.10.6 → 2.11.0

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.js CHANGED
@@ -41,6 +41,7 @@ __export(index_exports, {
41
41
  Project: () => project_exports,
42
42
  Prompt: () => prompt_exports,
43
43
  RBAC: () => rbac_exports,
44
+ Score: () => score_exports,
44
45
  ShredAPI: () => ShredAPI,
45
46
  ShredU: () => shredu_exports,
46
47
  SpecialOffer: () => special_offer_exports,
@@ -6246,12 +6247,89 @@ var ShredUAPI = class {
6246
6247
  };
6247
6248
  var ShredU_api_default = ShredUAPI;
6248
6249
 
6250
+ // src/model/score/Score.api.ts
6251
+ var Endpoints10 = {
6252
+ GetRecap: { uri: "/score/", method: "GET" }
6253
+ };
6254
+
6255
+ // src/model/score/Score.schema.ts
6256
+ var ScoreMetricKeySchema = external_exports.enum([
6257
+ "submissions",
6258
+ "interactions",
6259
+ "attendance"
6260
+ ]);
6261
+ var ScoreBandSchema = external_exports.object({
6262
+ key: external_exports.string(),
6263
+ label: external_exports.string(),
6264
+ min: external_exports.number(),
6265
+ max: external_exports.number()
6266
+ });
6267
+ var ScoreMetricSchema = external_exports.object({
6268
+ /**
6269
+ * Deliberately not the enum: a metric added API-side must not break a client that
6270
+ * predates it. Render the array generically and switch on ScoreMetricKey only where
6271
+ * a known metric needs special treatment.
6272
+ */
6273
+ key: external_exports.string(),
6274
+ /** The share this metric actually carried, after unavailable ones were left out. */
6275
+ weight: external_exports.number(),
6276
+ value: external_exports.number(),
6277
+ target: external_exports.number(),
6278
+ ratio: external_exports.number(),
6279
+ available: external_exports.boolean(),
6280
+ rating: ScoreBandSchema.optional()
6281
+ });
6282
+ var ScoreSchema = external_exports.object({
6283
+ value: external_exports.number(),
6284
+ hasData: external_exports.boolean(),
6285
+ period: external_exports.string(),
6286
+ periodLabel: external_exports.string(),
6287
+ band: ScoreBandSchema.optional(),
6288
+ nextBand: ScoreBandSchema.optional(),
6289
+ pointsToNextBand: external_exports.number().optional(),
6290
+ trend: external_exports.number().optional(),
6291
+ computedAt: external_exports.number(),
6292
+ metrics: external_exports.array(ScoreMetricSchema)
6293
+ });
6294
+ var ScoreHistoryEntrySchema = external_exports.object({
6295
+ period: external_exports.string(),
6296
+ label: external_exports.string(),
6297
+ value: external_exports.number(),
6298
+ band: ScoreBandSchema.optional()
6299
+ });
6300
+ var ScoreRecapSchema = external_exports.object({
6301
+ current: ScoreSchema,
6302
+ /** Oldest first. Months before the customer's first project are absent, not zero. */
6303
+ history: external_exports.array(ScoreHistoryEntrySchema)
6304
+ });
6305
+
6306
+ // src/api/Score.api.ts
6307
+ var ScoreAPI = class {
6308
+ constructor(env) {
6309
+ this.env = env;
6310
+ this.clientHTTP = new HTTPClient();
6311
+ }
6312
+ async getRecap(ctx, period) {
6313
+ const { uri, method } = Endpoints10.GetRecap;
6314
+ const endpoint = period ? `${uri}?period=${encodeURIComponent(period)}` : uri;
6315
+ return this.clientHTTP.makeRequest(
6316
+ this.env,
6317
+ endpoint,
6318
+ method,
6319
+ null,
6320
+ ctx,
6321
+ ScoreRecapSchema
6322
+ );
6323
+ }
6324
+ };
6325
+ var Score_api_default = ScoreAPI;
6326
+
6249
6327
  // src/model/rbac/index.ts
6250
6328
  var rbac_exports = {};
6251
6329
  __export(rbac_exports, {
6252
6330
  ActionCatalog: () => ActionCatalog,
6253
6331
  Actions: () => Actions,
6254
- Endpoints: () => Endpoints10,
6332
+ Endpoints: () => Endpoints11,
6255
6333
  PrincipalSchema: () => PrincipalSchema,
6256
6334
  RoleAssignmentSchema: () => RoleAssignmentSchema,
6257
6335
  RoleGrantSchema: () => RoleGrantSchema,
@@ -6495,7 +6573,7 @@ var PrincipalSchema = external_exports.object({
6495
6573
  });
6496
6574
 
6497
6575
  // src/model/rbac/RBAC.api.ts
6498
- var Endpoints10 = {
6576
+ var Endpoints11 = {
6499
6577
  GetActions: { uri: "/rbac/actions", method: "GET" },
6500
6578
  ListRoles: { uri: "/rbac/roles", method: "GET" },
6501
6579
  CreateRole: { uri: "/rbac/roles", method: "POST" },
@@ -6514,29 +6592,29 @@ var RBACAPI = class {
6514
6592
  this.clientHTTP = new HTTPClient();
6515
6593
  }
6516
6594
  async getActions(c) {
6517
- const e = Endpoints10.GetActions;
6595
+ const e = Endpoints11.GetActions;
6518
6596
  return this.clientHTTP.makeRequest(this.env, e.uri, e.method, null, c);
6519
6597
  }
6520
6598
  async listRoles(c) {
6521
- const e = Endpoints10.ListRoles;
6599
+ const e = Endpoints11.ListRoles;
6522
6600
  return this.clientHTTP.makeRequest(this.env, e.uri, e.method, null, c, external_exports.array(RoleSchema));
6523
6601
  }
6524
6602
  async createRole(c, input) {
6525
- const e = Endpoints10.CreateRole;
6603
+ const e = Endpoints11.CreateRole;
6526
6604
  return this.clientHTTP.makeRequest(this.env, e.uri, e.method, input, c, RoleSchema);
6527
6605
  }
6528
6606
  async updateRole(c, roleId, input) {
6529
- const e = Endpoints10.UpdateRole;
6607
+ const e = Endpoints11.UpdateRole;
6530
6608
  const uri = e.uri.replace(":roleId", roleId);
6531
6609
  return this.clientHTTP.makeRequest(this.env, uri, e.method, input, c, RoleSchema);
6532
6610
  }
6533
6611
  async deleteRole(c, roleId) {
6534
- const e = Endpoints10.DeleteRole;
6612
+ const e = Endpoints11.DeleteRole;
6535
6613
  const uri = e.uri.replace(":roleId", roleId);
6536
6614
  return this.clientHTTP.makeRequest(this.env, uri, e.method, null, c, external_exports.boolean());
6537
6615
  }
6538
6616
  async getAssignments(c, uid) {
6539
- const e = Endpoints10.GetAssignments;
6617
+ const e = Endpoints11.GetAssignments;
6540
6618
  const uri = e.uri.replace(":uid", uid);
6541
6619
  return this.clientHTTP.makeRequest(
6542
6620
  this.env,
@@ -6548,17 +6626,17 @@ var RBACAPI = class {
6548
6626
  );
6549
6627
  }
6550
6628
  async assign(c, uid, input) {
6551
- const e = Endpoints10.Assign;
6629
+ const e = Endpoints11.Assign;
6552
6630
  const uri = e.uri.replace(":uid", uid);
6553
6631
  return this.clientHTTP.makeRequest(this.env, uri, e.method, input, c, RoleAssignmentSchema);
6554
6632
  }
6555
6633
  async unassign(c, uid, input) {
6556
- const e = Endpoints10.Unassign;
6634
+ const e = Endpoints11.Unassign;
6557
6635
  const uri = e.uri.replace(":uid", uid);
6558
6636
  return this.clientHTTP.makeRequest(this.env, uri, e.method, input, c, RoleAssignmentSchema);
6559
6637
  }
6560
6638
  async searchPrincipals(c, term) {
6561
- const e = Endpoints10.SearchPrincipals;
6639
+ const e = Endpoints11.SearchPrincipals;
6562
6640
  const uri = `${e.uri}?q=${encodeURIComponent(term)}`;
6563
6641
  return this.clientHTTP.makeRequest(this.env, uri, e.method, null, c, external_exports.array(PrincipalSchema));
6564
6642
  }
@@ -6582,6 +6660,7 @@ var ShredAPI = class {
6582
6660
  this.note = new Note_api_default(env);
6583
6661
  this.specialOffer = new SpecialOffer_api_default(env);
6584
6662
  this.shredu = new ShredU_api_default(env);
6663
+ this.score = new Score_api_default(env);
6585
6664
  this.rbac = new RBAC_api_default(env);
6586
6665
  }
6587
6666
  };
@@ -6601,7 +6680,7 @@ __export(exceptions_exports, {
6601
6680
  var prompt_exports = {};
6602
6681
  __export(prompt_exports, {
6603
6682
  CategorySchema: () => CategorySchema,
6604
- Endpoints: () => Endpoints11,
6683
+ Endpoints: () => Endpoints12,
6605
6684
  PromptSchema: () => PromptSchema,
6606
6685
  ScriptIARequestSchema: () => ScriptIARequestSchema,
6607
6686
  ScriptSchema: () => ScriptSchema
@@ -6637,7 +6716,7 @@ var PromptSchema = external_exports.object({
6637
6716
  });
6638
6717
 
6639
6718
  // src/model/prompt/Prompt.api.ts
6640
- var Endpoints11 = {
6719
+ var Endpoints12 = {
6641
6720
  GetPrompt: {
6642
6721
  uri: "/prompts/getPrompt",
6643
6722
  method: "GET"
@@ -6668,7 +6747,7 @@ var Endpoints11 = {
6668
6747
  var tenant_exports = {};
6669
6748
  __export(tenant_exports, {
6670
6749
  Action: () => Action,
6671
- Endpoints: () => Endpoints12,
6750
+ Endpoints: () => Endpoints13,
6672
6751
  MemberSchema: () => MemberSchema,
6673
6752
  MemberUpdateSchema: () => MemberUpdateSchema,
6674
6753
  PreferencesSchema: () => PreferencesSchema,
@@ -6799,7 +6878,7 @@ var TenantUpdateSchema = TenantSchema.pick({
6799
6878
  }).partial();
6800
6879
 
6801
6880
  // src/model/tenant/Tenant.api.ts
6802
- var Endpoints12 = {
6881
+ var Endpoints13 = {
6803
6882
  GetByInviteCode: {
6804
6883
  uri: "/tenants/public/invitation/",
6805
6884
  method: "GET"
@@ -6837,7 +6916,7 @@ var Endpoints12 = {
6837
6916
  // src/model/user/index.ts
6838
6917
  var user_exports = {};
6839
6918
  __export(user_exports, {
6840
- Endpoints: () => Endpoints13,
6919
+ Endpoints: () => Endpoints14,
6841
6920
  PreferencesSchema: () => PreferencesSchema2,
6842
6921
  Role: () => Role,
6843
6922
  System: () => System,
@@ -6892,7 +6971,7 @@ var UserSchema = external_exports.object({
6892
6971
  });
6893
6972
 
6894
6973
  // src/model/user/User.api.ts
6895
- var Endpoints13 = {
6974
+ var Endpoints14 = {
6896
6975
  ChangeEmail: { uri: "/accounts/user/changeEmail", method: "PUT" },
6897
6976
  GetUserInfo: { uri: "/accounts/user/info", method: "GET" },
6898
6977
  GetBindedUsers: { uri: "/accounts/binded/list", method: "GET" },
@@ -6915,7 +6994,7 @@ var Endpoints13 = {
6915
6994
  var subscription_exports = {};
6916
6995
  __export(subscription_exports, {
6917
6996
  ChargeSchema: () => ChargeSchema,
6918
- Endpoints: () => Endpoints14,
6997
+ Endpoints: () => Endpoints15,
6919
6998
  PlanSchema: () => PlanSchema,
6920
6999
  ProductSchema: () => ProductSchema,
6921
7000
  SubscriptionSchema: () => SubscriptionSchema,
@@ -6924,7 +7003,7 @@ __export(subscription_exports, {
6924
7003
  });
6925
7004
 
6926
7005
  // src/model/subscription/Subscription.api.ts
6927
- var Endpoints14 = {
7006
+ var Endpoints15 = {
6928
7007
  GetPortal: {
6929
7008
  uri: "/subscriptions/portal/",
6930
7009
  method: "GET"
@@ -6986,7 +7065,7 @@ var Endpoints14 = {
6986
7065
  // src/model/track/index.ts
6987
7066
  var track_exports = {};
6988
7067
  __export(track_exports, {
6989
- Endpoints: () => Endpoints15,
7068
+ Endpoints: () => Endpoints16,
6990
7069
  TrackParamSchema: () => TrackParamSchema,
6991
7070
  TrackSchema: () => TrackSchema
6992
7071
  });
@@ -7004,7 +7083,7 @@ var TrackSchema = external_exports.object({
7004
7083
  });
7005
7084
 
7006
7085
  // src/model/track/Track.api.ts
7007
- var Endpoints15 = {
7086
+ var Endpoints16 = {
7008
7087
  Track: {
7009
7088
  uri: "/track/public/send/",
7010
7089
  method: "POST"
@@ -7041,6 +7120,18 @@ __export(shredu_exports, {
7041
7120
  UpdateShredUSessionSchema: () => UpdateShredUSessionSchema
7042
7121
  });
7043
7122
 
7123
+ // src/model/score/index.ts
7124
+ var score_exports = {};
7125
+ __export(score_exports, {
7126
+ Endpoints: () => Endpoints10,
7127
+ ScoreBandSchema: () => ScoreBandSchema,
7128
+ ScoreHistoryEntrySchema: () => ScoreHistoryEntrySchema,
7129
+ ScoreMetricKeySchema: () => ScoreMetricKeySchema,
7130
+ ScoreMetricSchema: () => ScoreMetricSchema,
7131
+ ScoreRecapSchema: () => ScoreRecapSchema,
7132
+ ScoreSchema: () => ScoreSchema
7133
+ });
7134
+
7044
7135
  // src/index.ts
7045
7136
  var index_default = ShredAPI;
7046
7137
  //# sourceMappingURL=index.js.map