@juhuu/sdk-ts 1.2.41 → 1.2.43

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.mts CHANGED
@@ -582,8 +582,8 @@ declare class UsersService extends Service {
582
582
  refreshAccessToken(UserRefreshAccessTokenParams: JUHUU.User.RefreshAccessToken.Params, UserRefreshAccessTokenOptions?: JUHUU.User.RefreshAccessToken.Options): Promise<JUHUU.HttpResponse<JUHUU.User.RefreshAccessToken.Response>>;
583
583
  list(UserListParams: JUHUU.User.List.Params, UserListOptions?: JUHUU.User.List.Options): Promise<JUHUU.HttpResponse<JUHUU.User.List.Response>>;
584
584
  update(UserUpdateParams: JUHUU.User.Update.Params, UserUpdateOptions?: JUHUU.User.Update.Options): Promise<JUHUU.HttpResponse<JUHUU.User.Update.Response>>;
585
- inviteEmployee(UserInviteEmployeeParams: JUHUU.User.InviteEmployee.Params, UserInviteEmployeeOptions?: JUHUU.User.InviteEmployee.Options): Promise<JUHUU.HttpResponse<JUHUU.User.InviteEmployee.Response>>;
586
- removeEmployee(UserRemoveEmployeeParams: JUHUU.User.RemoveEmployee.Params, UserRemoveEmployeeOptions?: JUHUU.User.RemoveEmployee.Options): Promise<JUHUU.HttpResponse<JUHUU.User.RemoveEmployee.Response>>;
585
+ memberCreate(UserInviteMemberParams: JUHUU.User.InviteMember.Params, UserInviteMemberOptions?: JUHUU.User.InviteMember.Options): Promise<JUHUU.HttpResponse<JUHUU.User.InviteMember.Response>>;
586
+ memberDelete(UserRemoveMemberParams: JUHUU.User.RemoveMember.Params, UserRemoveMemberOptions?: JUHUU.User.RemoveMember.Options): Promise<JUHUU.HttpResponse<JUHUU.User.RemoveMember.Response>>;
587
587
  }
588
588
 
589
589
  declare class PaymentsService extends Service {
@@ -661,6 +661,10 @@ declare class TariffsService extends Service {
661
661
  */
662
662
  calculateAmount(tariff: JUHUU.Tariff.Object, rentTimeSeconds: number): number;
663
663
  calculateMaximumAmount(tariff: JUHUU.Tariff.Object): number;
664
+ /**
665
+ * Returns a date object containing the timestamp that a session would have to end at if it was created right now
666
+ */
667
+ getEndDate(tariff: JUHUU.Tariff.Object): Date;
664
668
  }
665
669
 
666
670
  declare class ProductService extends Service {
@@ -1097,7 +1101,7 @@ declare namespace JUHUU {
1097
1101
  refreshToken: string;
1098
1102
  };
1099
1103
  }
1100
- export namespace InviteEmployee {
1104
+ export namespace InviteMember {
1101
1105
  type Params = {
1102
1106
  userId: string;
1103
1107
  /**
@@ -1112,10 +1116,10 @@ declare namespace JUHUU {
1112
1116
  type Options = JUHUU.RequestOptions;
1113
1117
  type Response = void;
1114
1118
  }
1115
- export namespace RemoveEmployee {
1119
+ export namespace RemoveMember {
1116
1120
  type Params = {
1117
- userId: string;
1118
- userIdToRemove?: string;
1121
+ managementUserId: string;
1122
+ memberUserId: string;
1119
1123
  };
1120
1124
  type Options = JUHUU.RequestOptions;
1121
1125
  type Response = {
package/dist/index.d.ts CHANGED
@@ -582,8 +582,8 @@ declare class UsersService extends Service {
582
582
  refreshAccessToken(UserRefreshAccessTokenParams: JUHUU.User.RefreshAccessToken.Params, UserRefreshAccessTokenOptions?: JUHUU.User.RefreshAccessToken.Options): Promise<JUHUU.HttpResponse<JUHUU.User.RefreshAccessToken.Response>>;
583
583
  list(UserListParams: JUHUU.User.List.Params, UserListOptions?: JUHUU.User.List.Options): Promise<JUHUU.HttpResponse<JUHUU.User.List.Response>>;
584
584
  update(UserUpdateParams: JUHUU.User.Update.Params, UserUpdateOptions?: JUHUU.User.Update.Options): Promise<JUHUU.HttpResponse<JUHUU.User.Update.Response>>;
585
- inviteEmployee(UserInviteEmployeeParams: JUHUU.User.InviteEmployee.Params, UserInviteEmployeeOptions?: JUHUU.User.InviteEmployee.Options): Promise<JUHUU.HttpResponse<JUHUU.User.InviteEmployee.Response>>;
586
- removeEmployee(UserRemoveEmployeeParams: JUHUU.User.RemoveEmployee.Params, UserRemoveEmployeeOptions?: JUHUU.User.RemoveEmployee.Options): Promise<JUHUU.HttpResponse<JUHUU.User.RemoveEmployee.Response>>;
585
+ memberCreate(UserInviteMemberParams: JUHUU.User.InviteMember.Params, UserInviteMemberOptions?: JUHUU.User.InviteMember.Options): Promise<JUHUU.HttpResponse<JUHUU.User.InviteMember.Response>>;
586
+ memberDelete(UserRemoveMemberParams: JUHUU.User.RemoveMember.Params, UserRemoveMemberOptions?: JUHUU.User.RemoveMember.Options): Promise<JUHUU.HttpResponse<JUHUU.User.RemoveMember.Response>>;
587
587
  }
588
588
 
589
589
  declare class PaymentsService extends Service {
@@ -661,6 +661,10 @@ declare class TariffsService extends Service {
661
661
  */
662
662
  calculateAmount(tariff: JUHUU.Tariff.Object, rentTimeSeconds: number): number;
663
663
  calculateMaximumAmount(tariff: JUHUU.Tariff.Object): number;
664
+ /**
665
+ * Returns a date object containing the timestamp that a session would have to end at if it was created right now
666
+ */
667
+ getEndDate(tariff: JUHUU.Tariff.Object): Date;
664
668
  }
665
669
 
666
670
  declare class ProductService extends Service {
@@ -1097,7 +1101,7 @@ declare namespace JUHUU {
1097
1101
  refreshToken: string;
1098
1102
  };
1099
1103
  }
1100
- export namespace InviteEmployee {
1104
+ export namespace InviteMember {
1101
1105
  type Params = {
1102
1106
  userId: string;
1103
1107
  /**
@@ -1112,10 +1116,10 @@ declare namespace JUHUU {
1112
1116
  type Options = JUHUU.RequestOptions;
1113
1117
  type Response = void;
1114
1118
  }
1115
- export namespace RemoveEmployee {
1119
+ export namespace RemoveMember {
1116
1120
  type Params = {
1117
- userId: string;
1118
- userIdToRemove?: string;
1121
+ managementUserId: string;
1122
+ memberUserId: string;
1119
1123
  };
1120
1124
  type Options = JUHUU.RequestOptions;
1121
1125
  type Response = {
package/dist/index.js CHANGED
@@ -559,31 +559,29 @@ var UsersService = class extends Service {
559
559
  UserUpdateOptions
560
560
  );
561
561
  }
562
- async inviteEmployee(UserInviteEmployeeParams, UserInviteEmployeeOptions) {
562
+ async memberCreate(UserInviteMemberParams, UserInviteMemberOptions) {
563
563
  return await super.sendRequest(
564
564
  {
565
565
  method: "POST",
566
- url: "users/" + UserInviteEmployeeParams.userId + "/inviteEmployee",
566
+ url: "users/" + UserInviteMemberParams.userId + "/members",
567
567
  body: {
568
- userId: UserInviteEmployeeParams?.userIdToInvite,
569
- email: UserInviteEmployeeParams?.email
568
+ userId: UserInviteMemberParams?.userIdToInvite,
569
+ email: UserInviteMemberParams?.email
570
570
  },
571
571
  useAuthentication: true
572
572
  },
573
- UserInviteEmployeeOptions
573
+ UserInviteMemberOptions
574
574
  );
575
575
  }
576
- async removeEmployee(UserRemoveEmployeeParams, UserRemoveEmployeeOptions) {
576
+ async memberDelete(UserRemoveMemberParams, UserRemoveMemberOptions) {
577
577
  return await super.sendRequest(
578
578
  {
579
- method: "PATCH",
580
- url: "users/" + UserRemoveEmployeeParams.userId + "/removeEmployee",
581
- body: {
582
- userId: UserRemoveEmployeeParams.userIdToRemove
583
- },
579
+ method: "DELETE",
580
+ url: "users/" + UserRemoveMemberParams.managementUserId + "/members/" + UserRemoveMemberParams.memberUserId,
581
+ body: void 0,
584
582
  useAuthentication: true
585
583
  },
586
- UserRemoveEmployeeOptions
584
+ UserRemoveMemberOptions
587
585
  );
588
586
  }
589
587
  };
@@ -1182,6 +1180,17 @@ var TariffsService = class extends Service {
1182
1180
  calculateMaximumAmount(tariff) {
1183
1181
  return this.calculateAmount(tariff, tariff.duration);
1184
1182
  }
1183
+ /**
1184
+ * Returns a date object containing the timestamp that a session would have to end at if it was created right now
1185
+ */
1186
+ getEndDate(tariff) {
1187
+ if (tariff.roundToMidnight === false) {
1188
+ return new Date(Date.now() + tariff.duration * 1e3);
1189
+ }
1190
+ const end = new Date(Date.now() + tariff.duration * 1e3);
1191
+ end.setHours(23, 59, 59, 999);
1192
+ return end;
1193
+ }
1185
1194
  };
1186
1195
 
1187
1196
  // src/products/products.service.ts
package/dist/index.mjs CHANGED
@@ -514,31 +514,29 @@ var UsersService = class extends Service {
514
514
  UserUpdateOptions
515
515
  );
516
516
  }
517
- async inviteEmployee(UserInviteEmployeeParams, UserInviteEmployeeOptions) {
517
+ async memberCreate(UserInviteMemberParams, UserInviteMemberOptions) {
518
518
  return await super.sendRequest(
519
519
  {
520
520
  method: "POST",
521
- url: "users/" + UserInviteEmployeeParams.userId + "/inviteEmployee",
521
+ url: "users/" + UserInviteMemberParams.userId + "/members",
522
522
  body: {
523
- userId: UserInviteEmployeeParams?.userIdToInvite,
524
- email: UserInviteEmployeeParams?.email
523
+ userId: UserInviteMemberParams?.userIdToInvite,
524
+ email: UserInviteMemberParams?.email
525
525
  },
526
526
  useAuthentication: true
527
527
  },
528
- UserInviteEmployeeOptions
528
+ UserInviteMemberOptions
529
529
  );
530
530
  }
531
- async removeEmployee(UserRemoveEmployeeParams, UserRemoveEmployeeOptions) {
531
+ async memberDelete(UserRemoveMemberParams, UserRemoveMemberOptions) {
532
532
  return await super.sendRequest(
533
533
  {
534
- method: "PATCH",
535
- url: "users/" + UserRemoveEmployeeParams.userId + "/removeEmployee",
536
- body: {
537
- userId: UserRemoveEmployeeParams.userIdToRemove
538
- },
534
+ method: "DELETE",
535
+ url: "users/" + UserRemoveMemberParams.managementUserId + "/members/" + UserRemoveMemberParams.memberUserId,
536
+ body: void 0,
539
537
  useAuthentication: true
540
538
  },
541
- UserRemoveEmployeeOptions
539
+ UserRemoveMemberOptions
542
540
  );
543
541
  }
544
542
  };
@@ -1137,6 +1135,17 @@ var TariffsService = class extends Service {
1137
1135
  calculateMaximumAmount(tariff) {
1138
1136
  return this.calculateAmount(tariff, tariff.duration);
1139
1137
  }
1138
+ /**
1139
+ * Returns a date object containing the timestamp that a session would have to end at if it was created right now
1140
+ */
1141
+ getEndDate(tariff) {
1142
+ if (tariff.roundToMidnight === false) {
1143
+ return new Date(Date.now() + tariff.duration * 1e3);
1144
+ }
1145
+ const end = new Date(Date.now() + tariff.duration * 1e3);
1146
+ end.setHours(23, 59, 59, 999);
1147
+ return end;
1148
+ }
1140
1149
  };
1141
1150
 
1142
1151
  // src/products/products.service.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juhuu/sdk-ts",
3
- "version": "1.2.41",
3
+ "version": "1.2.43",
4
4
  "description": "Typescript wrapper for JUHUU services",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",