@juhuu/sdk-ts 1.0.1 → 1.0.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.
package/dist/index.d.mts CHANGED
@@ -106,18 +106,10 @@ declare const ReadonlyCategoryArray: readonly ["bike", "car", "scooter", "boat",
106
106
  type Category = (typeof ReadonlyCategoryArray)[number];
107
107
  declare const ReadonlyModalityArray: readonly ["charge", "store", "share", "wash", "repair"];
108
108
  type Modality = (typeof ReadonlyModalityArray)[number];
109
- type Purpose = {
110
- sector: Sector;
111
- category: Category;
112
- modality: Modality;
113
- };
114
109
  type GeoPoint = {
115
110
  type: "Point";
116
111
  coordinates: [number, number];
117
112
  };
118
- type DeepNullable<T> = {
119
- [K in keyof T]: DeepNullable<T[K]> | null;
120
- };
121
113
  type Circumstance = {
122
114
  type: "wheelchairAccessible";
123
115
  isWheelchairAccessible: boolean;
@@ -460,6 +452,12 @@ declare class TariffsService extends Service {
460
452
  calculateMaximumAmount(tariff: JUHUU.Tariff.Object): number;
461
453
  }
462
454
 
455
+ declare class ProductService extends Service {
456
+ constructor(config: JUHUU.SetupConfig);
457
+ list(ProductListParams: JUHUU.Product.List.Params, ProductListOptions?: JUHUU.Product.List.Options): Promise<JUHUU.HttpResponse<JUHUU.Product.List.Response>>;
458
+ retrieve(params: JUHUU.Product.Retrieve.Params, options?: JUHUU.Product.Retrieve.Options): Promise<JUHUU.HttpResponse<JUHUU.Product.Retrieve.Response>>;
459
+ }
460
+
463
461
  declare class Juhuu {
464
462
  constructor(config: JUHUU.SetupConfig);
465
463
  /**
@@ -476,6 +474,7 @@ declare class Juhuu {
476
474
  readonly locations: LocationsService;
477
475
  readonly terms: TermsService;
478
476
  readonly tariffs: TariffsService;
477
+ readonly products: ProductService;
479
478
  }
480
479
  declare namespace JUHUU {
481
480
  interface SetupConfig {
@@ -506,7 +505,22 @@ declare namespace JUHUU {
506
505
  * If this is true, a new accessToken will be requested if the current one is expired.
507
506
  */
508
507
  refreshTokensIfNecessary?: boolean;
508
+ expand?: Array<"property" | "tariffArray">;
509
509
  };
510
+ type LocaleString = {
511
+ [locale: string]: string;
512
+ };
513
+ type DeepNullable<T> = {
514
+ [P in keyof T]?: DeepNullable<T[P]> | null;
515
+ };
516
+ enum Purpose {
517
+ Purpose1 = "Purpose 1",
518
+ Purpose2 = "Purpose 2"
519
+ }
520
+ enum Technology {
521
+ Tech1 = "Technology 1",
522
+ Tech2 = "Technology 2"
523
+ }
510
524
  namespace Session {
511
525
  type Base = {
512
526
  id: string;
@@ -556,7 +570,6 @@ declare namespace JUHUU {
556
570
  autoRenew: boolean;
557
571
  sessionType: Object["type"];
558
572
  isOffSession: boolean;
559
- idempotencyKey: string;
560
573
  userId: string;
561
574
  };
562
575
  type Options = JUHUU.RequestOptions;
@@ -1106,6 +1119,63 @@ declare namespace JUHUU {
1106
1119
  }
1107
1120
  export { };
1108
1121
  }
1122
+ namespace Product {
1123
+ type Base = {
1124
+ id: string;
1125
+ readonly object: "product";
1126
+ name: string;
1127
+ propertyId: string;
1128
+ version: number;
1129
+ previewText: JUHUU.LocaleString;
1130
+ description: JUHUU.LocaleString;
1131
+ bannerImageDark: string[];
1132
+ bannerImageLight: string[];
1133
+ model3d: string | null;
1134
+ datasheet: JUHUU.DeepNullable<JUHUU.LocaleString>;
1135
+ highlightArray: JUHUU.LocaleString[];
1136
+ purposeArray: JUHUU.Purpose[];
1137
+ technologyArray: JUHUU.Technology[];
1138
+ invalidAt: Date;
1139
+ source: "fluctuo" | null;
1140
+ };
1141
+ interface PhysicalProduct extends Base {
1142
+ type: "physicalProduct";
1143
+ weight: number;
1144
+ dimensions: {
1145
+ length: number;
1146
+ width: number;
1147
+ height: number;
1148
+ };
1149
+ material: string;
1150
+ color: string;
1151
+ }
1152
+ interface DigitalProduct extends Base {
1153
+ type: "digitalProduct";
1154
+ fileSize: number;
1155
+ downloadUrl: string;
1156
+ }
1157
+ type Object = PhysicalProduct | DigitalProduct;
1158
+ namespace Retrieve {
1159
+ type Params = {
1160
+ productId: string;
1161
+ };
1162
+ type Options = JUHUU.RequestOptions;
1163
+ type Response = {
1164
+ product: Product.Object;
1165
+ };
1166
+ }
1167
+ namespace List {
1168
+ type Params = {
1169
+ propertyId?: string;
1170
+ categoryArray?: Category[];
1171
+ modalityArray?: Modality[];
1172
+ sectorArray?: Sector[];
1173
+ technologyArray?: Technology[];
1174
+ };
1175
+ type Options = JUHUU.RequestOptions;
1176
+ type Response = Product.Object[];
1177
+ }
1178
+ }
1109
1179
  namespace Link {
1110
1180
  type Base = {
1111
1181
  id: string;
package/dist/index.d.ts CHANGED
@@ -106,18 +106,10 @@ declare const ReadonlyCategoryArray: readonly ["bike", "car", "scooter", "boat",
106
106
  type Category = (typeof ReadonlyCategoryArray)[number];
107
107
  declare const ReadonlyModalityArray: readonly ["charge", "store", "share", "wash", "repair"];
108
108
  type Modality = (typeof ReadonlyModalityArray)[number];
109
- type Purpose = {
110
- sector: Sector;
111
- category: Category;
112
- modality: Modality;
113
- };
114
109
  type GeoPoint = {
115
110
  type: "Point";
116
111
  coordinates: [number, number];
117
112
  };
118
- type DeepNullable<T> = {
119
- [K in keyof T]: DeepNullable<T[K]> | null;
120
- };
121
113
  type Circumstance = {
122
114
  type: "wheelchairAccessible";
123
115
  isWheelchairAccessible: boolean;
@@ -460,6 +452,12 @@ declare class TariffsService extends Service {
460
452
  calculateMaximumAmount(tariff: JUHUU.Tariff.Object): number;
461
453
  }
462
454
 
455
+ declare class ProductService extends Service {
456
+ constructor(config: JUHUU.SetupConfig);
457
+ list(ProductListParams: JUHUU.Product.List.Params, ProductListOptions?: JUHUU.Product.List.Options): Promise<JUHUU.HttpResponse<JUHUU.Product.List.Response>>;
458
+ retrieve(params: JUHUU.Product.Retrieve.Params, options?: JUHUU.Product.Retrieve.Options): Promise<JUHUU.HttpResponse<JUHUU.Product.Retrieve.Response>>;
459
+ }
460
+
463
461
  declare class Juhuu {
464
462
  constructor(config: JUHUU.SetupConfig);
465
463
  /**
@@ -476,6 +474,7 @@ declare class Juhuu {
476
474
  readonly locations: LocationsService;
477
475
  readonly terms: TermsService;
478
476
  readonly tariffs: TariffsService;
477
+ readonly products: ProductService;
479
478
  }
480
479
  declare namespace JUHUU {
481
480
  interface SetupConfig {
@@ -506,7 +505,22 @@ declare namespace JUHUU {
506
505
  * If this is true, a new accessToken will be requested if the current one is expired.
507
506
  */
508
507
  refreshTokensIfNecessary?: boolean;
508
+ expand?: Array<"property" | "tariffArray">;
509
509
  };
510
+ type LocaleString = {
511
+ [locale: string]: string;
512
+ };
513
+ type DeepNullable<T> = {
514
+ [P in keyof T]?: DeepNullable<T[P]> | null;
515
+ };
516
+ enum Purpose {
517
+ Purpose1 = "Purpose 1",
518
+ Purpose2 = "Purpose 2"
519
+ }
520
+ enum Technology {
521
+ Tech1 = "Technology 1",
522
+ Tech2 = "Technology 2"
523
+ }
510
524
  namespace Session {
511
525
  type Base = {
512
526
  id: string;
@@ -556,7 +570,6 @@ declare namespace JUHUU {
556
570
  autoRenew: boolean;
557
571
  sessionType: Object["type"];
558
572
  isOffSession: boolean;
559
- idempotencyKey: string;
560
573
  userId: string;
561
574
  };
562
575
  type Options = JUHUU.RequestOptions;
@@ -1106,6 +1119,63 @@ declare namespace JUHUU {
1106
1119
  }
1107
1120
  export { };
1108
1121
  }
1122
+ namespace Product {
1123
+ type Base = {
1124
+ id: string;
1125
+ readonly object: "product";
1126
+ name: string;
1127
+ propertyId: string;
1128
+ version: number;
1129
+ previewText: JUHUU.LocaleString;
1130
+ description: JUHUU.LocaleString;
1131
+ bannerImageDark: string[];
1132
+ bannerImageLight: string[];
1133
+ model3d: string | null;
1134
+ datasheet: JUHUU.DeepNullable<JUHUU.LocaleString>;
1135
+ highlightArray: JUHUU.LocaleString[];
1136
+ purposeArray: JUHUU.Purpose[];
1137
+ technologyArray: JUHUU.Technology[];
1138
+ invalidAt: Date;
1139
+ source: "fluctuo" | null;
1140
+ };
1141
+ interface PhysicalProduct extends Base {
1142
+ type: "physicalProduct";
1143
+ weight: number;
1144
+ dimensions: {
1145
+ length: number;
1146
+ width: number;
1147
+ height: number;
1148
+ };
1149
+ material: string;
1150
+ color: string;
1151
+ }
1152
+ interface DigitalProduct extends Base {
1153
+ type: "digitalProduct";
1154
+ fileSize: number;
1155
+ downloadUrl: string;
1156
+ }
1157
+ type Object = PhysicalProduct | DigitalProduct;
1158
+ namespace Retrieve {
1159
+ type Params = {
1160
+ productId: string;
1161
+ };
1162
+ type Options = JUHUU.RequestOptions;
1163
+ type Response = {
1164
+ product: Product.Object;
1165
+ };
1166
+ }
1167
+ namespace List {
1168
+ type Params = {
1169
+ propertyId?: string;
1170
+ categoryArray?: Category[];
1171
+ modalityArray?: Modality[];
1172
+ sectorArray?: Sector[];
1173
+ technologyArray?: Technology[];
1174
+ };
1175
+ type Options = JUHUU.RequestOptions;
1176
+ type Response = Product.Object[];
1177
+ }
1178
+ }
1109
1179
  namespace Link {
1110
1180
  type Base = {
1111
1181
  id: string;
package/dist/index.js CHANGED
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
+ JUHUU: () => JUHUU,
33
34
  Juhuu: () => Juhuu
34
35
  });
35
36
  module.exports = __toCommonJS(src_exports);
@@ -257,7 +258,6 @@ var SessionService = class extends Service {
257
258
  autoRenew: SessionCreateParams.autoRenew,
258
259
  type: SessionCreateParams.sessionType,
259
260
  isOffSession: SessionCreateParams.isOffSession,
260
- idempotencyKey: SessionCreateParams.idempotencyKey,
261
261
  userId: SessionCreateParams.userId
262
262
  },
263
263
  useAuthentication: true
@@ -990,6 +990,58 @@ var TariffsService = class extends Service {
990
990
  }
991
991
  };
992
992
 
993
+ // src/products/products.service.ts
994
+ var ProductService = class extends Service {
995
+ constructor(config) {
996
+ super(config);
997
+ }
998
+ async list(ProductListParams, ProductListOptions) {
999
+ const queryArray = [];
1000
+ if (ProductListParams.categoryArray !== void 0) {
1001
+ queryArray.push(
1002
+ "categoryArray=" + ProductListParams.categoryArray.join(",")
1003
+ );
1004
+ }
1005
+ if (ProductListParams.modalityArray !== void 0) {
1006
+ queryArray.push(
1007
+ "modalityArray=" + ProductListParams.modalityArray.join(",")
1008
+ );
1009
+ }
1010
+ if (ProductListParams.sectorArray !== void 0) {
1011
+ queryArray.push("sectorArray=" + ProductListParams.sectorArray.join(","));
1012
+ }
1013
+ if (ProductListParams.technologyArray !== void 0) {
1014
+ queryArray.push(
1015
+ "technologyArray=" + ProductListParams.technologyArray.join(",")
1016
+ );
1017
+ }
1018
+ return await super.sendRequest(
1019
+ {
1020
+ method: "GET",
1021
+ url: "products?" + queryArray.join("&"),
1022
+ body: void 0,
1023
+ useAuthentication: false
1024
+ },
1025
+ ProductListOptions
1026
+ );
1027
+ }
1028
+ async retrieve(params, options) {
1029
+ const queryArray = [];
1030
+ if (options?.expand !== void 0) {
1031
+ queryArray.push("expand=" + options.expand.join(","));
1032
+ }
1033
+ return await super.sendRequest(
1034
+ {
1035
+ method: "GET",
1036
+ url: "products/" + params.productId + "?" + queryArray.join("&"),
1037
+ body: void 0,
1038
+ useAuthentication: false
1039
+ },
1040
+ options
1041
+ );
1042
+ }
1043
+ };
1044
+
993
1045
  // src/index.ts
994
1046
  var Juhuu = class {
995
1047
  constructor(config) {
@@ -1004,6 +1056,7 @@ var Juhuu = class {
1004
1056
  this.locations = new LocationsService(config);
1005
1057
  this.terms = new TermsService(config);
1006
1058
  this.tariffs = new TariffsService(config);
1059
+ this.products = new ProductService(config);
1007
1060
  }
1008
1061
  /**
1009
1062
  * Top Level Resources
@@ -1019,8 +1072,23 @@ var Juhuu = class {
1019
1072
  locations;
1020
1073
  terms;
1021
1074
  tariffs;
1075
+ products;
1022
1076
  };
1077
+ var JUHUU;
1078
+ ((JUHUU2) => {
1079
+ let Purpose;
1080
+ ((Purpose3) => {
1081
+ Purpose3["Purpose1"] = "Purpose 1";
1082
+ Purpose3["Purpose2"] = "Purpose 2";
1083
+ })(Purpose = JUHUU2.Purpose || (JUHUU2.Purpose = {}));
1084
+ let Technology;
1085
+ ((Technology2) => {
1086
+ Technology2["Tech1"] = "Technology 1";
1087
+ Technology2["Tech2"] = "Technology 2";
1088
+ })(Technology = JUHUU2.Technology || (JUHUU2.Technology = {}));
1089
+ })(JUHUU || (JUHUU = {}));
1023
1090
  // Annotate the CommonJS export names for ESM import in node:
1024
1091
  0 && (module.exports = {
1092
+ JUHUU,
1025
1093
  Juhuu
1026
1094
  });
package/dist/index.mjs CHANGED
@@ -221,7 +221,6 @@ var SessionService = class extends Service {
221
221
  autoRenew: SessionCreateParams.autoRenew,
222
222
  type: SessionCreateParams.sessionType,
223
223
  isOffSession: SessionCreateParams.isOffSession,
224
- idempotencyKey: SessionCreateParams.idempotencyKey,
225
224
  userId: SessionCreateParams.userId
226
225
  },
227
226
  useAuthentication: true
@@ -954,6 +953,58 @@ var TariffsService = class extends Service {
954
953
  }
955
954
  };
956
955
 
956
+ // src/products/products.service.ts
957
+ var ProductService = class extends Service {
958
+ constructor(config) {
959
+ super(config);
960
+ }
961
+ async list(ProductListParams, ProductListOptions) {
962
+ const queryArray = [];
963
+ if (ProductListParams.categoryArray !== void 0) {
964
+ queryArray.push(
965
+ "categoryArray=" + ProductListParams.categoryArray.join(",")
966
+ );
967
+ }
968
+ if (ProductListParams.modalityArray !== void 0) {
969
+ queryArray.push(
970
+ "modalityArray=" + ProductListParams.modalityArray.join(",")
971
+ );
972
+ }
973
+ if (ProductListParams.sectorArray !== void 0) {
974
+ queryArray.push("sectorArray=" + ProductListParams.sectorArray.join(","));
975
+ }
976
+ if (ProductListParams.technologyArray !== void 0) {
977
+ queryArray.push(
978
+ "technologyArray=" + ProductListParams.technologyArray.join(",")
979
+ );
980
+ }
981
+ return await super.sendRequest(
982
+ {
983
+ method: "GET",
984
+ url: "products?" + queryArray.join("&"),
985
+ body: void 0,
986
+ useAuthentication: false
987
+ },
988
+ ProductListOptions
989
+ );
990
+ }
991
+ async retrieve(params, options) {
992
+ const queryArray = [];
993
+ if (options?.expand !== void 0) {
994
+ queryArray.push("expand=" + options.expand.join(","));
995
+ }
996
+ return await super.sendRequest(
997
+ {
998
+ method: "GET",
999
+ url: "products/" + params.productId + "?" + queryArray.join("&"),
1000
+ body: void 0,
1001
+ useAuthentication: false
1002
+ },
1003
+ options
1004
+ );
1005
+ }
1006
+ };
1007
+
957
1008
  // src/index.ts
958
1009
  var Juhuu = class {
959
1010
  constructor(config) {
@@ -968,6 +1019,7 @@ var Juhuu = class {
968
1019
  this.locations = new LocationsService(config);
969
1020
  this.terms = new TermsService(config);
970
1021
  this.tariffs = new TariffsService(config);
1022
+ this.products = new ProductService(config);
971
1023
  }
972
1024
  /**
973
1025
  * Top Level Resources
@@ -983,7 +1035,22 @@ var Juhuu = class {
983
1035
  locations;
984
1036
  terms;
985
1037
  tariffs;
1038
+ products;
986
1039
  };
1040
+ var JUHUU;
1041
+ ((JUHUU2) => {
1042
+ let Purpose;
1043
+ ((Purpose3) => {
1044
+ Purpose3["Purpose1"] = "Purpose 1";
1045
+ Purpose3["Purpose2"] = "Purpose 2";
1046
+ })(Purpose = JUHUU2.Purpose || (JUHUU2.Purpose = {}));
1047
+ let Technology;
1048
+ ((Technology2) => {
1049
+ Technology2["Tech1"] = "Technology 1";
1050
+ Technology2["Tech2"] = "Technology 2";
1051
+ })(Technology = JUHUU2.Technology || (JUHUU2.Technology = {}));
1052
+ })(JUHUU || (JUHUU = {}));
987
1053
  export {
1054
+ JUHUU,
988
1055
  Juhuu
989
1056
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juhuu/sdk-ts",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Typescript wrapper for juhuu services",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",