@juhuu/sdk-ts 1.2.150 → 1.2.152
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 +41 -11
- package/dist/index.d.ts +41 -11
- package/dist/index.js +44 -30
- package/dist/index.mjs +44 -30
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
@@ -13,6 +13,24 @@ type ExtractType<T> = T extends {
|
|
13
13
|
type UserGroup = "retailer" | "engineer" | "operator" | "user";
|
14
14
|
type Frontend = "dashboard" | "app";
|
15
15
|
type ApiKeyStatus = "enabled" | "disabled";
|
16
|
+
type License = {
|
17
|
+
type: "url";
|
18
|
+
validUntil: Date | null;
|
19
|
+
licenseTemplateId: string;
|
20
|
+
} | {
|
21
|
+
type: "regex";
|
22
|
+
validUntil: Date | null;
|
23
|
+
licenseTemplateId: string;
|
24
|
+
} | {
|
25
|
+
type: "card";
|
26
|
+
validUntil: Date | null;
|
27
|
+
licenseTemplateId: string;
|
28
|
+
cardId: string;
|
29
|
+
} | {
|
30
|
+
type: "automatic";
|
31
|
+
validUntil: Date | null;
|
32
|
+
licenseTemplateId: string;
|
33
|
+
};
|
16
34
|
type ApiKeyScope = "device:parameter:update";
|
17
35
|
type Capability = {
|
18
36
|
type: "predictiveMaintenance";
|
@@ -567,7 +585,7 @@ declare class Service {
|
|
567
585
|
url: string;
|
568
586
|
body: undefined;
|
569
587
|
authenticationNotOptional: boolean;
|
570
|
-
},
|
588
|
+
}, requestOptions?: JUHUU.RequestOptions): Promise<JUHUU.HttpResponse<T>>;
|
571
589
|
private sendGetRequest;
|
572
590
|
private sendPostRequest;
|
573
591
|
private sendPatchRequest;
|
@@ -604,8 +622,8 @@ declare class LinkService extends Service {
|
|
604
622
|
|
605
623
|
declare class UsersService extends Service {
|
606
624
|
constructor(config: JUHUU.SetupConfig);
|
625
|
+
create(UserCreateParams: JUHUU.User.Create.Params, UserCreateOptions?: JUHUU.User.Create.Options): Promise<JUHUU.HttpResponse<JUHUU.User.Create.Response>>;
|
607
626
|
retrieve(UserRetrieveParams: JUHUU.User.Retrieve.Params, UserRetrieveOptions?: JUHUU.User.Retrieve.Options): Promise<JUHUU.HttpResponse<JUHUU.User.Retrieve.Response>>;
|
608
|
-
exists(UserExistsParams: JUHUU.User.Exists.Params, UserExistsOptions?: JUHUU.User.Exists.Options): Promise<JUHUU.HttpResponse<JUHUU.User.Exists.Response>>;
|
609
627
|
registerEmailPassword(UserRegisterEmailPasswordParams: JUHUU.User.RegisterEmailPassword.Params, UserRegisterEmailPasswordOptions?: JUHUU.User.RegisterEmailPassword.Options): Promise<JUHUU.HttpResponse<JUHUU.User.RegisterEmailPassword.Response>>;
|
610
628
|
loginEmailPassword(UserLoginEmailPasswordParams: JUHUU.User.LoginEmailPassword.Params, UserLoginEmailPasswordOptions?: JUHUU.User.LoginEmailPassword.Options): Promise<JUHUU.HttpResponse<JUHUU.User.LoginEmailPassword.Response>>;
|
611
629
|
paymentMethodTokens(UserPaymentMethodTokensParams: JUHUU.User.PaymentMethodTokens.Params, UserPaymentMethodTokensOptions?: JUHUU.User.PaymentMethodTokens.Options): Promise<JUHUU.HttpResponse<JUHUU.User.PaymentMethodTokens.Response>>;
|
@@ -1150,13 +1168,8 @@ declare namespace JUHUU {
|
|
1150
1168
|
termsVersion: number;
|
1151
1169
|
name: string | null;
|
1152
1170
|
stripeCustomerId: string;
|
1153
|
-
defaultPaymentMethodId: string | null;
|
1154
|
-
defaultPaymentMethodProvider: "stripe" | "not_set";
|
1155
1171
|
acceptedTermIdArray: string[];
|
1156
|
-
licenseArray:
|
1157
|
-
validUntil: Date | null;
|
1158
|
-
licenseTemplateId: string;
|
1159
|
-
}[];
|
1172
|
+
licenseArray: License[];
|
1160
1173
|
languageCode: LanguageCode | null;
|
1161
1174
|
billingAddress: DeepNullable<Address>;
|
1162
1175
|
billingEmail: string | null;
|
@@ -1177,6 +1190,7 @@ declare namespace JUHUU {
|
|
1177
1190
|
};
|
1178
1191
|
};
|
1179
1192
|
group: UserGroup;
|
1193
|
+
createdByPropertyId: string | null;
|
1180
1194
|
};
|
1181
1195
|
export interface Standard extends Base {
|
1182
1196
|
type: "standard";
|
@@ -1196,12 +1210,28 @@ declare namespace JUHUU {
|
|
1196
1210
|
user: JUHUU.User.Object;
|
1197
1211
|
};
|
1198
1212
|
}
|
1213
|
+
export namespace Create {
|
1214
|
+
type Params = {
|
1215
|
+
readonly type: JUHUU.User.Object["type"];
|
1216
|
+
readonly name?: string;
|
1217
|
+
readonly createdByPropertyId?: JUHUU.User.Object["createdByPropertyId"];
|
1218
|
+
readonly licenseArray?: License[];
|
1219
|
+
};
|
1220
|
+
type Options = JUHUU.RequestOptions;
|
1221
|
+
type Response = JUHUU.User.Object;
|
1222
|
+
}
|
1199
1223
|
export namespace List {
|
1200
1224
|
type Params = {
|
1201
1225
|
managementUserId?: string;
|
1202
1226
|
propertyId?: string;
|
1227
|
+
license?: {
|
1228
|
+
cardId?: string;
|
1229
|
+
};
|
1203
1230
|
};
|
1204
|
-
type Options =
|
1231
|
+
type Options = {
|
1232
|
+
limit?: number;
|
1233
|
+
skip?: number;
|
1234
|
+
} & JUHUU.RequestOptions;
|
1205
1235
|
type Response = JUHUU.User.Object[];
|
1206
1236
|
}
|
1207
1237
|
export namespace Exists {
|
@@ -2608,7 +2638,7 @@ declare namespace JUHUU {
|
|
2608
2638
|
surveyEnabled: boolean;
|
2609
2639
|
accountingAreaId: string;
|
2610
2640
|
rentableDeviceGroupLocationId: string | null;
|
2611
|
-
deviceId: string;
|
2641
|
+
deviceId: string | null;
|
2612
2642
|
}
|
2613
2643
|
export interface UseableDevice extends Base {
|
2614
2644
|
type: "useableDevice";
|
@@ -3411,4 +3441,4 @@ declare namespace JUHUU {
|
|
3411
3441
|
}
|
3412
3442
|
}
|
3413
3443
|
|
3414
|
-
export { type AccessControlListElement, type Address, type ApiKeyScope, type ApiKeyStatus, type AutoRenewMode, type BusinessType, type Capability, type Category, type Circumstance, type Color, type ColorScheme, type Command, type Condition, ConditionType, type CountryCode, CountryCodeArray, type CurrencyCode, CurrencyCodeArray, type CustomClaims, type DeepNullable, type DevicePermission, type DeviceStatus, type DeviceType, type Environment, type EnvironmentSettings, type ExtractType, type Frontend, type FuelType, type GeneralSettings, type GeoPoint, type GraphNode, JUHUU, Juhuu, type LanguageCode, LanguageCodeArray, Layout, type LayoutBlock, type LicenseTariffIdMap, type LinkType, type LocaleString, type MapFilter, type Modality, type Offer, type OfferTime, type Parameter, type Party, type PaymentMethod, type PaymentReason, type PaymentRefundReason, type PaymentRefundStatus, type PaymentServiceProvider, type PaymentStatus, type PayoutSettings, type PayoutStatus, type PermissionTypes, type Person, type Platform, type PlatformString, type PostingRow, type Purpose, type PushToken, ReadonlyCategoryArray, ReadonlyModalityArray, ReadonlySectorArray, type RefundStatus, type Sector, type SessionCannotTerminateReason, type SessionSettings, type SessionStatus, type SessionTerminatedByType, type SessionType, Settings, type SimStatus, type StarRating, type TarifType, type TimeZone, type Unit, type UserGroup, type UserType, type Utilization, type VeloBrushDeviceDocumentUserManualStep, type Viewport, type ViewportPolygon, type VisualPriority, type hexColor };
|
3444
|
+
export { type AccessControlListElement, type Address, type ApiKeyScope, type ApiKeyStatus, type AutoRenewMode, type BusinessType, type Capability, type Category, type Circumstance, type Color, type ColorScheme, type Command, type Condition, ConditionType, type CountryCode, CountryCodeArray, type CurrencyCode, CurrencyCodeArray, type CustomClaims, type DeepNullable, type DevicePermission, type DeviceStatus, type DeviceType, type Environment, type EnvironmentSettings, type ExtractType, type Frontend, type FuelType, type GeneralSettings, type GeoPoint, type GraphNode, JUHUU, Juhuu, type LanguageCode, LanguageCodeArray, Layout, type LayoutBlock, type License, type LicenseTariffIdMap, type LinkType, type LocaleString, type MapFilter, type Modality, type Offer, type OfferTime, type Parameter, type Party, type PaymentMethod, type PaymentReason, type PaymentRefundReason, type PaymentRefundStatus, type PaymentServiceProvider, type PaymentStatus, type PayoutSettings, type PayoutStatus, type PermissionTypes, type Person, type Platform, type PlatformString, type PostingRow, type Purpose, type PushToken, ReadonlyCategoryArray, ReadonlyModalityArray, ReadonlySectorArray, type RefundStatus, type Sector, type SessionCannotTerminateReason, type SessionSettings, type SessionStatus, type SessionTerminatedByType, type SessionType, Settings, type SimStatus, type StarRating, type TarifType, type TimeZone, type Unit, type UserGroup, type UserType, type Utilization, type VeloBrushDeviceDocumentUserManualStep, type Viewport, type ViewportPolygon, type VisualPriority, type hexColor };
|
package/dist/index.d.ts
CHANGED
@@ -13,6 +13,24 @@ type ExtractType<T> = T extends {
|
|
13
13
|
type UserGroup = "retailer" | "engineer" | "operator" | "user";
|
14
14
|
type Frontend = "dashboard" | "app";
|
15
15
|
type ApiKeyStatus = "enabled" | "disabled";
|
16
|
+
type License = {
|
17
|
+
type: "url";
|
18
|
+
validUntil: Date | null;
|
19
|
+
licenseTemplateId: string;
|
20
|
+
} | {
|
21
|
+
type: "regex";
|
22
|
+
validUntil: Date | null;
|
23
|
+
licenseTemplateId: string;
|
24
|
+
} | {
|
25
|
+
type: "card";
|
26
|
+
validUntil: Date | null;
|
27
|
+
licenseTemplateId: string;
|
28
|
+
cardId: string;
|
29
|
+
} | {
|
30
|
+
type: "automatic";
|
31
|
+
validUntil: Date | null;
|
32
|
+
licenseTemplateId: string;
|
33
|
+
};
|
16
34
|
type ApiKeyScope = "device:parameter:update";
|
17
35
|
type Capability = {
|
18
36
|
type: "predictiveMaintenance";
|
@@ -567,7 +585,7 @@ declare class Service {
|
|
567
585
|
url: string;
|
568
586
|
body: undefined;
|
569
587
|
authenticationNotOptional: boolean;
|
570
|
-
},
|
588
|
+
}, requestOptions?: JUHUU.RequestOptions): Promise<JUHUU.HttpResponse<T>>;
|
571
589
|
private sendGetRequest;
|
572
590
|
private sendPostRequest;
|
573
591
|
private sendPatchRequest;
|
@@ -604,8 +622,8 @@ declare class LinkService extends Service {
|
|
604
622
|
|
605
623
|
declare class UsersService extends Service {
|
606
624
|
constructor(config: JUHUU.SetupConfig);
|
625
|
+
create(UserCreateParams: JUHUU.User.Create.Params, UserCreateOptions?: JUHUU.User.Create.Options): Promise<JUHUU.HttpResponse<JUHUU.User.Create.Response>>;
|
607
626
|
retrieve(UserRetrieveParams: JUHUU.User.Retrieve.Params, UserRetrieveOptions?: JUHUU.User.Retrieve.Options): Promise<JUHUU.HttpResponse<JUHUU.User.Retrieve.Response>>;
|
608
|
-
exists(UserExistsParams: JUHUU.User.Exists.Params, UserExistsOptions?: JUHUU.User.Exists.Options): Promise<JUHUU.HttpResponse<JUHUU.User.Exists.Response>>;
|
609
627
|
registerEmailPassword(UserRegisterEmailPasswordParams: JUHUU.User.RegisterEmailPassword.Params, UserRegisterEmailPasswordOptions?: JUHUU.User.RegisterEmailPassword.Options): Promise<JUHUU.HttpResponse<JUHUU.User.RegisterEmailPassword.Response>>;
|
610
628
|
loginEmailPassword(UserLoginEmailPasswordParams: JUHUU.User.LoginEmailPassword.Params, UserLoginEmailPasswordOptions?: JUHUU.User.LoginEmailPassword.Options): Promise<JUHUU.HttpResponse<JUHUU.User.LoginEmailPassword.Response>>;
|
611
629
|
paymentMethodTokens(UserPaymentMethodTokensParams: JUHUU.User.PaymentMethodTokens.Params, UserPaymentMethodTokensOptions?: JUHUU.User.PaymentMethodTokens.Options): Promise<JUHUU.HttpResponse<JUHUU.User.PaymentMethodTokens.Response>>;
|
@@ -1150,13 +1168,8 @@ declare namespace JUHUU {
|
|
1150
1168
|
termsVersion: number;
|
1151
1169
|
name: string | null;
|
1152
1170
|
stripeCustomerId: string;
|
1153
|
-
defaultPaymentMethodId: string | null;
|
1154
|
-
defaultPaymentMethodProvider: "stripe" | "not_set";
|
1155
1171
|
acceptedTermIdArray: string[];
|
1156
|
-
licenseArray:
|
1157
|
-
validUntil: Date | null;
|
1158
|
-
licenseTemplateId: string;
|
1159
|
-
}[];
|
1172
|
+
licenseArray: License[];
|
1160
1173
|
languageCode: LanguageCode | null;
|
1161
1174
|
billingAddress: DeepNullable<Address>;
|
1162
1175
|
billingEmail: string | null;
|
@@ -1177,6 +1190,7 @@ declare namespace JUHUU {
|
|
1177
1190
|
};
|
1178
1191
|
};
|
1179
1192
|
group: UserGroup;
|
1193
|
+
createdByPropertyId: string | null;
|
1180
1194
|
};
|
1181
1195
|
export interface Standard extends Base {
|
1182
1196
|
type: "standard";
|
@@ -1196,12 +1210,28 @@ declare namespace JUHUU {
|
|
1196
1210
|
user: JUHUU.User.Object;
|
1197
1211
|
};
|
1198
1212
|
}
|
1213
|
+
export namespace Create {
|
1214
|
+
type Params = {
|
1215
|
+
readonly type: JUHUU.User.Object["type"];
|
1216
|
+
readonly name?: string;
|
1217
|
+
readonly createdByPropertyId?: JUHUU.User.Object["createdByPropertyId"];
|
1218
|
+
readonly licenseArray?: License[];
|
1219
|
+
};
|
1220
|
+
type Options = JUHUU.RequestOptions;
|
1221
|
+
type Response = JUHUU.User.Object;
|
1222
|
+
}
|
1199
1223
|
export namespace List {
|
1200
1224
|
type Params = {
|
1201
1225
|
managementUserId?: string;
|
1202
1226
|
propertyId?: string;
|
1227
|
+
license?: {
|
1228
|
+
cardId?: string;
|
1229
|
+
};
|
1203
1230
|
};
|
1204
|
-
type Options =
|
1231
|
+
type Options = {
|
1232
|
+
limit?: number;
|
1233
|
+
skip?: number;
|
1234
|
+
} & JUHUU.RequestOptions;
|
1205
1235
|
type Response = JUHUU.User.Object[];
|
1206
1236
|
}
|
1207
1237
|
export namespace Exists {
|
@@ -2608,7 +2638,7 @@ declare namespace JUHUU {
|
|
2608
2638
|
surveyEnabled: boolean;
|
2609
2639
|
accountingAreaId: string;
|
2610
2640
|
rentableDeviceGroupLocationId: string | null;
|
2611
|
-
deviceId: string;
|
2641
|
+
deviceId: string | null;
|
2612
2642
|
}
|
2613
2643
|
export interface UseableDevice extends Base {
|
2614
2644
|
type: "useableDevice";
|
@@ -3411,4 +3441,4 @@ declare namespace JUHUU {
|
|
3411
3441
|
}
|
3412
3442
|
}
|
3413
3443
|
|
3414
|
-
export { type AccessControlListElement, type Address, type ApiKeyScope, type ApiKeyStatus, type AutoRenewMode, type BusinessType, type Capability, type Category, type Circumstance, type Color, type ColorScheme, type Command, type Condition, ConditionType, type CountryCode, CountryCodeArray, type CurrencyCode, CurrencyCodeArray, type CustomClaims, type DeepNullable, type DevicePermission, type DeviceStatus, type DeviceType, type Environment, type EnvironmentSettings, type ExtractType, type Frontend, type FuelType, type GeneralSettings, type GeoPoint, type GraphNode, JUHUU, Juhuu, type LanguageCode, LanguageCodeArray, Layout, type LayoutBlock, type LicenseTariffIdMap, type LinkType, type LocaleString, type MapFilter, type Modality, type Offer, type OfferTime, type Parameter, type Party, type PaymentMethod, type PaymentReason, type PaymentRefundReason, type PaymentRefundStatus, type PaymentServiceProvider, type PaymentStatus, type PayoutSettings, type PayoutStatus, type PermissionTypes, type Person, type Platform, type PlatformString, type PostingRow, type Purpose, type PushToken, ReadonlyCategoryArray, ReadonlyModalityArray, ReadonlySectorArray, type RefundStatus, type Sector, type SessionCannotTerminateReason, type SessionSettings, type SessionStatus, type SessionTerminatedByType, type SessionType, Settings, type SimStatus, type StarRating, type TarifType, type TimeZone, type Unit, type UserGroup, type UserType, type Utilization, type VeloBrushDeviceDocumentUserManualStep, type Viewport, type ViewportPolygon, type VisualPriority, type hexColor };
|
3444
|
+
export { type AccessControlListElement, type Address, type ApiKeyScope, type ApiKeyStatus, type AutoRenewMode, type BusinessType, type Capability, type Category, type Circumstance, type Color, type ColorScheme, type Command, type Condition, ConditionType, type CountryCode, CountryCodeArray, type CurrencyCode, CurrencyCodeArray, type CustomClaims, type DeepNullable, type DevicePermission, type DeviceStatus, type DeviceType, type Environment, type EnvironmentSettings, type ExtractType, type Frontend, type FuelType, type GeneralSettings, type GeoPoint, type GraphNode, JUHUU, Juhuu, type LanguageCode, LanguageCodeArray, Layout, type LayoutBlock, type License, type LicenseTariffIdMap, type LinkType, type LocaleString, type MapFilter, type Modality, type Offer, type OfferTime, type Parameter, type Party, type PaymentMethod, type PaymentReason, type PaymentRefundReason, type PaymentRefundStatus, type PaymentServiceProvider, type PaymentStatus, type PayoutSettings, type PayoutStatus, type PermissionTypes, type Person, type Platform, type PlatformString, type PostingRow, type Purpose, type PushToken, ReadonlyCategoryArray, ReadonlyModalityArray, ReadonlySectorArray, type RefundStatus, type Sector, type SessionCannotTerminateReason, type SessionSettings, type SessionStatus, type SessionTerminatedByType, type SessionType, Settings, type SimStatus, type StarRating, type TarifType, type TimeZone, type Unit, type UserGroup, type UserType, type Utilization, type VeloBrushDeviceDocumentUserManualStep, type Viewport, type ViewportPolygon, type VisualPriority, type hexColor };
|
package/dist/index.js
CHANGED
@@ -85,45 +85,45 @@ var Service = class {
|
|
85
85
|
method,
|
86
86
|
body = void 0,
|
87
87
|
authenticationNotOptional
|
88
|
-
},
|
89
|
-
const
|
88
|
+
}, requestOptions = {}) {
|
89
|
+
const currentRequestOptions = {
|
90
90
|
...this.defaultRequestOptions,
|
91
|
-
...
|
91
|
+
...requestOptions
|
92
92
|
};
|
93
|
-
if (
|
93
|
+
if (currentRequestOptions.triggerOnException === void 0) {
|
94
94
|
switch (this.authenticationMode) {
|
95
95
|
case "jwt": {
|
96
|
-
|
96
|
+
currentRequestOptions.triggerOnException = true;
|
97
97
|
break;
|
98
98
|
}
|
99
99
|
case "apiKey": {
|
100
|
-
|
100
|
+
currentRequestOptions.triggerOnException = false;
|
101
101
|
break;
|
102
102
|
}
|
103
103
|
}
|
104
104
|
}
|
105
105
|
console.log("authenticationMode", this.authenticationMode);
|
106
|
-
if (
|
106
|
+
if (currentRequestOptions.refreshTokensIfNecessary === void 0) {
|
107
107
|
switch (this.authenticationMode) {
|
108
108
|
case "jwt": {
|
109
|
-
|
109
|
+
currentRequestOptions.refreshTokensIfNecessary = true;
|
110
110
|
break;
|
111
111
|
}
|
112
112
|
case "apiKey": {
|
113
|
-
|
113
|
+
currentRequestOptions.refreshTokensIfNecessary = false;
|
114
114
|
break;
|
115
115
|
}
|
116
116
|
}
|
117
117
|
}
|
118
|
-
console.log("currentOptions",
|
118
|
+
console.log("currentOptions", currentRequestOptions);
|
119
119
|
let token = null;
|
120
120
|
let apiKey = null;
|
121
121
|
switch (this.authenticationMode) {
|
122
122
|
case "jwt": {
|
123
|
-
if (
|
123
|
+
if (currentRequestOptions.accessToken === void 0 || currentRequestOptions.accessToken === null) {
|
124
124
|
token = await this.getAccessToken();
|
125
125
|
} else {
|
126
|
-
token =
|
126
|
+
token = currentRequestOptions.accessToken;
|
127
127
|
}
|
128
128
|
console.log("accessToken:", token);
|
129
129
|
if ((token === null || token === void 0) && authenticationNotOptional === true) {
|
@@ -140,10 +140,10 @@ var Service = class {
|
|
140
140
|
break;
|
141
141
|
}
|
142
142
|
case "apiKey": {
|
143
|
-
if (
|
143
|
+
if (currentRequestOptions.apiKey === void 0 || currentRequestOptions.apiKey === null) {
|
144
144
|
apiKey = this.apiKey;
|
145
145
|
} else {
|
146
|
-
apiKey =
|
146
|
+
apiKey = currentRequestOptions.apiKey;
|
147
147
|
}
|
148
148
|
if (apiKey === null) {
|
149
149
|
console.error(
|
@@ -208,10 +208,10 @@ var Service = class {
|
|
208
208
|
};
|
209
209
|
console.log(
|
210
210
|
"refreshTokensIfNecessary",
|
211
|
-
|
211
|
+
currentRequestOptions.refreshTokensIfNecessary
|
212
212
|
);
|
213
213
|
console.log("responseObject.status", responseObject.status);
|
214
|
-
if (responseObject.status === 403 &&
|
214
|
+
if (responseObject.status === 403 && currentRequestOptions.refreshTokensIfNecessary === true) {
|
215
215
|
console.log("refreshing tokens...");
|
216
216
|
const oldRefreshToken = await this.getRefreshToken();
|
217
217
|
console.log("old refresh token", oldRefreshToken);
|
@@ -268,7 +268,7 @@ var Service = class {
|
|
268
268
|
return responseObject;
|
269
269
|
}
|
270
270
|
}
|
271
|
-
if (
|
271
|
+
if (currentRequestOptions.triggerOnException === true) {
|
272
272
|
await this.onException(responseObject);
|
273
273
|
}
|
274
274
|
} finally {
|
@@ -638,27 +638,32 @@ var UsersService = class extends Service {
|
|
638
638
|
constructor(config) {
|
639
639
|
super(config);
|
640
640
|
}
|
641
|
-
async
|
642
|
-
const queryArray = [];
|
641
|
+
async create(UserCreateParams, UserCreateOptions) {
|
643
642
|
return await super.sendRequest(
|
644
643
|
{
|
645
|
-
method: "
|
646
|
-
url: "users
|
647
|
-
body:
|
644
|
+
method: "POST",
|
645
|
+
url: "users",
|
646
|
+
body: {
|
647
|
+
name: UserCreateParams.name,
|
648
|
+
type: UserCreateParams.type,
|
649
|
+
createdByPropertyId: UserCreateParams.createdByPropertyId,
|
650
|
+
licenseArray: UserCreateParams.licenseArray
|
651
|
+
},
|
648
652
|
authenticationNotOptional: true
|
649
653
|
},
|
650
|
-
|
654
|
+
UserCreateOptions
|
651
655
|
);
|
652
656
|
}
|
653
|
-
async
|
657
|
+
async retrieve(UserRetrieveParams, UserRetrieveOptions) {
|
658
|
+
const queryArray = [];
|
654
659
|
return await super.sendRequest(
|
655
660
|
{
|
656
661
|
method: "GET",
|
657
|
-
url: "users/
|
662
|
+
url: "users/" + UserRetrieveParams.userId + "?" + queryArray.join("&"),
|
658
663
|
body: void 0,
|
659
|
-
authenticationNotOptional:
|
664
|
+
authenticationNotOptional: true
|
660
665
|
},
|
661
|
-
|
666
|
+
UserRetrieveOptions
|
662
667
|
);
|
663
668
|
}
|
664
669
|
async registerEmailPassword(UserRegisterEmailPasswordParams, UserRegisterEmailPasswordOptions) {
|
@@ -722,6 +727,15 @@ var UsersService = class extends Service {
|
|
722
727
|
if (UserListParams.propertyId !== void 0) {
|
723
728
|
queryArray.push("propertyId=" + UserListParams.propertyId);
|
724
729
|
}
|
730
|
+
if (UserListParams?.license?.cardId !== void 0) {
|
731
|
+
queryArray.push("license[cardId]=" + UserListParams?.license?.cardId);
|
732
|
+
}
|
733
|
+
if (UserListOptions?.skip !== void 0) {
|
734
|
+
queryArray.push("skip=" + UserListOptions.skip);
|
735
|
+
}
|
736
|
+
if (UserListOptions?.limit !== void 0) {
|
737
|
+
queryArray.push("limit=" + UserListOptions.limit);
|
738
|
+
}
|
725
739
|
return await super.sendRequest(
|
726
740
|
{
|
727
741
|
method: "GET",
|
@@ -2241,9 +2255,6 @@ var ArticlesService = class extends Service {
|
|
2241
2255
|
}
|
2242
2256
|
async list(ArticleListParams, ArticleListOptions) {
|
2243
2257
|
const queryArray = [];
|
2244
|
-
if (ArticleListOptions?.limit !== void 0) {
|
2245
|
-
queryArray.push("limit=" + ArticleListOptions.limit);
|
2246
|
-
}
|
2247
2258
|
if (ArticleListParams?.propertyId !== void 0) {
|
2248
2259
|
queryArray.push("propertyId=" + ArticleListParams.propertyId);
|
2249
2260
|
}
|
@@ -2256,6 +2267,9 @@ var ArticlesService = class extends Service {
|
|
2256
2267
|
if (ArticleListOptions?.skip !== void 0) {
|
2257
2268
|
queryArray.push("skip=" + ArticleListOptions.skip);
|
2258
2269
|
}
|
2270
|
+
if (ArticleListOptions?.limit !== void 0) {
|
2271
|
+
queryArray.push("limit=" + ArticleListOptions.limit);
|
2272
|
+
}
|
2259
2273
|
return await super.sendRequest(
|
2260
2274
|
{
|
2261
2275
|
method: "GET",
|
package/dist/index.mjs
CHANGED
@@ -41,45 +41,45 @@ var Service = class {
|
|
41
41
|
method,
|
42
42
|
body = void 0,
|
43
43
|
authenticationNotOptional
|
44
|
-
},
|
45
|
-
const
|
44
|
+
}, requestOptions = {}) {
|
45
|
+
const currentRequestOptions = {
|
46
46
|
...this.defaultRequestOptions,
|
47
|
-
...
|
47
|
+
...requestOptions
|
48
48
|
};
|
49
|
-
if (
|
49
|
+
if (currentRequestOptions.triggerOnException === void 0) {
|
50
50
|
switch (this.authenticationMode) {
|
51
51
|
case "jwt": {
|
52
|
-
|
52
|
+
currentRequestOptions.triggerOnException = true;
|
53
53
|
break;
|
54
54
|
}
|
55
55
|
case "apiKey": {
|
56
|
-
|
56
|
+
currentRequestOptions.triggerOnException = false;
|
57
57
|
break;
|
58
58
|
}
|
59
59
|
}
|
60
60
|
}
|
61
61
|
console.log("authenticationMode", this.authenticationMode);
|
62
|
-
if (
|
62
|
+
if (currentRequestOptions.refreshTokensIfNecessary === void 0) {
|
63
63
|
switch (this.authenticationMode) {
|
64
64
|
case "jwt": {
|
65
|
-
|
65
|
+
currentRequestOptions.refreshTokensIfNecessary = true;
|
66
66
|
break;
|
67
67
|
}
|
68
68
|
case "apiKey": {
|
69
|
-
|
69
|
+
currentRequestOptions.refreshTokensIfNecessary = false;
|
70
70
|
break;
|
71
71
|
}
|
72
72
|
}
|
73
73
|
}
|
74
|
-
console.log("currentOptions",
|
74
|
+
console.log("currentOptions", currentRequestOptions);
|
75
75
|
let token = null;
|
76
76
|
let apiKey = null;
|
77
77
|
switch (this.authenticationMode) {
|
78
78
|
case "jwt": {
|
79
|
-
if (
|
79
|
+
if (currentRequestOptions.accessToken === void 0 || currentRequestOptions.accessToken === null) {
|
80
80
|
token = await this.getAccessToken();
|
81
81
|
} else {
|
82
|
-
token =
|
82
|
+
token = currentRequestOptions.accessToken;
|
83
83
|
}
|
84
84
|
console.log("accessToken:", token);
|
85
85
|
if ((token === null || token === void 0) && authenticationNotOptional === true) {
|
@@ -96,10 +96,10 @@ var Service = class {
|
|
96
96
|
break;
|
97
97
|
}
|
98
98
|
case "apiKey": {
|
99
|
-
if (
|
99
|
+
if (currentRequestOptions.apiKey === void 0 || currentRequestOptions.apiKey === null) {
|
100
100
|
apiKey = this.apiKey;
|
101
101
|
} else {
|
102
|
-
apiKey =
|
102
|
+
apiKey = currentRequestOptions.apiKey;
|
103
103
|
}
|
104
104
|
if (apiKey === null) {
|
105
105
|
console.error(
|
@@ -164,10 +164,10 @@ var Service = class {
|
|
164
164
|
};
|
165
165
|
console.log(
|
166
166
|
"refreshTokensIfNecessary",
|
167
|
-
|
167
|
+
currentRequestOptions.refreshTokensIfNecessary
|
168
168
|
);
|
169
169
|
console.log("responseObject.status", responseObject.status);
|
170
|
-
if (responseObject.status === 403 &&
|
170
|
+
if (responseObject.status === 403 && currentRequestOptions.refreshTokensIfNecessary === true) {
|
171
171
|
console.log("refreshing tokens...");
|
172
172
|
const oldRefreshToken = await this.getRefreshToken();
|
173
173
|
console.log("old refresh token", oldRefreshToken);
|
@@ -224,7 +224,7 @@ var Service = class {
|
|
224
224
|
return responseObject;
|
225
225
|
}
|
226
226
|
}
|
227
|
-
if (
|
227
|
+
if (currentRequestOptions.triggerOnException === true) {
|
228
228
|
await this.onException(responseObject);
|
229
229
|
}
|
230
230
|
} finally {
|
@@ -594,27 +594,32 @@ var UsersService = class extends Service {
|
|
594
594
|
constructor(config) {
|
595
595
|
super(config);
|
596
596
|
}
|
597
|
-
async
|
598
|
-
const queryArray = [];
|
597
|
+
async create(UserCreateParams, UserCreateOptions) {
|
599
598
|
return await super.sendRequest(
|
600
599
|
{
|
601
|
-
method: "
|
602
|
-
url: "users
|
603
|
-
body:
|
600
|
+
method: "POST",
|
601
|
+
url: "users",
|
602
|
+
body: {
|
603
|
+
name: UserCreateParams.name,
|
604
|
+
type: UserCreateParams.type,
|
605
|
+
createdByPropertyId: UserCreateParams.createdByPropertyId,
|
606
|
+
licenseArray: UserCreateParams.licenseArray
|
607
|
+
},
|
604
608
|
authenticationNotOptional: true
|
605
609
|
},
|
606
|
-
|
610
|
+
UserCreateOptions
|
607
611
|
);
|
608
612
|
}
|
609
|
-
async
|
613
|
+
async retrieve(UserRetrieveParams, UserRetrieveOptions) {
|
614
|
+
const queryArray = [];
|
610
615
|
return await super.sendRequest(
|
611
616
|
{
|
612
617
|
method: "GET",
|
613
|
-
url: "users/
|
618
|
+
url: "users/" + UserRetrieveParams.userId + "?" + queryArray.join("&"),
|
614
619
|
body: void 0,
|
615
|
-
authenticationNotOptional:
|
620
|
+
authenticationNotOptional: true
|
616
621
|
},
|
617
|
-
|
622
|
+
UserRetrieveOptions
|
618
623
|
);
|
619
624
|
}
|
620
625
|
async registerEmailPassword(UserRegisterEmailPasswordParams, UserRegisterEmailPasswordOptions) {
|
@@ -678,6 +683,15 @@ var UsersService = class extends Service {
|
|
678
683
|
if (UserListParams.propertyId !== void 0) {
|
679
684
|
queryArray.push("propertyId=" + UserListParams.propertyId);
|
680
685
|
}
|
686
|
+
if (UserListParams?.license?.cardId !== void 0) {
|
687
|
+
queryArray.push("license[cardId]=" + UserListParams?.license?.cardId);
|
688
|
+
}
|
689
|
+
if (UserListOptions?.skip !== void 0) {
|
690
|
+
queryArray.push("skip=" + UserListOptions.skip);
|
691
|
+
}
|
692
|
+
if (UserListOptions?.limit !== void 0) {
|
693
|
+
queryArray.push("limit=" + UserListOptions.limit);
|
694
|
+
}
|
681
695
|
return await super.sendRequest(
|
682
696
|
{
|
683
697
|
method: "GET",
|
@@ -2197,9 +2211,6 @@ var ArticlesService = class extends Service {
|
|
2197
2211
|
}
|
2198
2212
|
async list(ArticleListParams, ArticleListOptions) {
|
2199
2213
|
const queryArray = [];
|
2200
|
-
if (ArticleListOptions?.limit !== void 0) {
|
2201
|
-
queryArray.push("limit=" + ArticleListOptions.limit);
|
2202
|
-
}
|
2203
2214
|
if (ArticleListParams?.propertyId !== void 0) {
|
2204
2215
|
queryArray.push("propertyId=" + ArticleListParams.propertyId);
|
2205
2216
|
}
|
@@ -2212,6 +2223,9 @@ var ArticlesService = class extends Service {
|
|
2212
2223
|
if (ArticleListOptions?.skip !== void 0) {
|
2213
2224
|
queryArray.push("skip=" + ArticleListOptions.skip);
|
2214
2225
|
}
|
2226
|
+
if (ArticleListOptions?.limit !== void 0) {
|
2227
|
+
queryArray.push("limit=" + ArticleListOptions.limit);
|
2228
|
+
}
|
2215
2229
|
return await super.sendRequest(
|
2216
2230
|
{
|
2217
2231
|
method: "GET",
|