@juhuu/sdk-ts 1.2.144 → 1.2.146
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 +89 -7
- package/dist/index.d.ts +89 -7
- package/dist/index.js +192 -35
- package/dist/index.mjs +192 -35
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
@@ -12,6 +12,8 @@ type ExtractType<T> = T extends {
|
|
12
12
|
} ? U : never;
|
13
13
|
type UserGroup = "retailer" | "engineer" | "operator" | "user";
|
14
14
|
type Frontend = "dashboard" | "app";
|
15
|
+
type ApiKeyStatus = "enabled" | "disabled";
|
16
|
+
type ApiKeyScope = "device:parameter:update";
|
15
17
|
type Capability = {
|
16
18
|
type: "predictiveMaintenance";
|
17
19
|
stripePriceId: string | null;
|
@@ -537,6 +539,9 @@ declare class Service {
|
|
537
539
|
readonly httpBaseUrl: string;
|
538
540
|
readonly wssBaseUrl: string;
|
539
541
|
readonly clientVersion: string;
|
542
|
+
readonly apiKey: string | null;
|
543
|
+
readonly defaultRequestOptions: JUHUU.RequestOptions;
|
544
|
+
readonly authenticationMode: "jwt" | "apiKey";
|
540
545
|
onException: <T>(response: JUHUU.HttpResponse<T>) => Promise<"abort" | "retry">;
|
541
546
|
getAccessToken: () => Promise<string | null> | null;
|
542
547
|
setAccessToken: (accessToken: string) => Promise<void>;
|
@@ -846,6 +851,14 @@ declare class DeviceParameterHistoriesService extends Service {
|
|
846
851
|
retrieve(DeviceParameterHistoryRetrieveParams: JUHUU.DeviceParameterHistory.Retrieve.Params, DeviceParameterHistoryRetrieveOptions?: JUHUU.DeviceParameterHistory.Retrieve.Options): Promise<JUHUU.HttpResponse<JUHUU.DeviceParameterHistory.Retrieve.Response>>;
|
847
852
|
}
|
848
853
|
|
854
|
+
declare class ApiKeysService extends Service {
|
855
|
+
constructor(config: JUHUU.SetupConfig);
|
856
|
+
create(ApiKeyCreateParams: JUHUU.ApiKey.Create.Params, ApiKeyCreateOptions?: JUHUU.ApiKey.Create.Options): Promise<JUHUU.HttpResponse<JUHUU.ApiKey.Create.Response>>;
|
857
|
+
list(ApiKeyListParams: JUHUU.ApiKey.List.Params, ApiKeyListOptions?: JUHUU.ApiKey.List.Options): Promise<JUHUU.HttpResponse<JUHUU.ApiKey.List.Response>>;
|
858
|
+
retrieve(ApiKeyRetrieveParams: JUHUU.ApiKey.Retrieve.Params, ApiKeyRetrieveOptions?: JUHUU.ApiKey.Retrieve.Options): Promise<JUHUU.HttpResponse<JUHUU.ApiKey.Retrieve.Response>>;
|
859
|
+
update(ApiKeyUpdateParams: JUHUU.ApiKey.Update.Params, ApiKeyUpdateOptions?: JUHUU.ApiKey.Update.Options): Promise<JUHUU.HttpResponse<JUHUU.ApiKey.Update.Response>>;
|
860
|
+
}
|
861
|
+
|
849
862
|
declare class Juhuu {
|
850
863
|
constructor(config: JUHUU.SetupConfig);
|
851
864
|
/**
|
@@ -879,16 +892,20 @@ declare class Juhuu {
|
|
879
892
|
readonly tapkey: TapkeyService;
|
880
893
|
readonly articleGroups: ArticleGroupGroupsService;
|
881
894
|
readonly deviceParameterHistories: DeviceParameterHistoriesService;
|
895
|
+
readonly apiKeys: ApiKeysService;
|
882
896
|
}
|
883
897
|
declare namespace JUHUU {
|
884
898
|
interface SetupConfig {
|
885
|
-
environment
|
886
|
-
getAccessToken
|
887
|
-
onException
|
888
|
-
setAccessToken
|
889
|
-
getRefreshToken
|
890
|
-
setRefreshToken
|
899
|
+
environment?: Environment;
|
900
|
+
getAccessToken?: () => Promise<string | null>;
|
901
|
+
onException?: <T>(response: JUHUU.HttpResponse<T>) => Promise<"abort">;
|
902
|
+
setAccessToken?: (accessToken: string) => Promise<void>;
|
903
|
+
getRefreshToken?: () => Promise<string | null>;
|
904
|
+
setRefreshToken?: (refreshToken: string) => Promise<void>;
|
891
905
|
clientVersion: string;
|
906
|
+
apiKey?: string;
|
907
|
+
defaultRequestOptions?: JUHUU.RequestOptions;
|
908
|
+
authenticationMode?: "jwt" | "apiKey";
|
892
909
|
}
|
893
910
|
interface HttpResponse<T> {
|
894
911
|
ok: boolean;
|
@@ -914,6 +931,10 @@ declare namespace JUHUU {
|
|
914
931
|
* If this is true, a new accessToken will be requested if the current one is expired.
|
915
932
|
*/
|
916
933
|
refreshTokensIfNecessary?: boolean;
|
934
|
+
/**
|
935
|
+
* If this API key is provided, the request will be sent with this API key instead of the one passed to config.
|
936
|
+
*/
|
937
|
+
apiKey?: string | null;
|
917
938
|
};
|
918
939
|
interface LocaleString {
|
919
940
|
de?: string;
|
@@ -1462,6 +1483,67 @@ declare namespace JUHUU {
|
|
1462
1483
|
type Response = JUHUU.AccountingArea.Object;
|
1463
1484
|
}
|
1464
1485
|
}
|
1486
|
+
namespace ApiKey {
|
1487
|
+
type Object = {
|
1488
|
+
id: string;
|
1489
|
+
readonly object: "apiKey";
|
1490
|
+
name: string;
|
1491
|
+
status: ApiKeyStatus;
|
1492
|
+
scopeArray: ApiKeyScope[];
|
1493
|
+
propertyId: string;
|
1494
|
+
expiresAt: Date | null;
|
1495
|
+
createdAt: Date;
|
1496
|
+
hash: string;
|
1497
|
+
};
|
1498
|
+
namespace Create {
|
1499
|
+
type Params = {
|
1500
|
+
propertyId: string;
|
1501
|
+
name?: string;
|
1502
|
+
};
|
1503
|
+
type Options = JUHUU.RequestOptions;
|
1504
|
+
type Response = {
|
1505
|
+
apiKey: JUHUU.ApiKey.Object;
|
1506
|
+
clearText: string;
|
1507
|
+
};
|
1508
|
+
}
|
1509
|
+
namespace Retrieve {
|
1510
|
+
type Params = {
|
1511
|
+
apiKeyId: string;
|
1512
|
+
};
|
1513
|
+
type Options = {
|
1514
|
+
expand?: Array<"property">;
|
1515
|
+
} & JUHUU.RequestOptions;
|
1516
|
+
type Response = {
|
1517
|
+
apiKey: JUHUU.ApiKey.Object;
|
1518
|
+
property?: JUHUU.Property.Object;
|
1519
|
+
};
|
1520
|
+
}
|
1521
|
+
namespace List {
|
1522
|
+
type Params = {
|
1523
|
+
propertyId?: string;
|
1524
|
+
statusArray?: JUHUU.Article.Object["status"][];
|
1525
|
+
};
|
1526
|
+
type Options = {
|
1527
|
+
limit?: number;
|
1528
|
+
skip?: number;
|
1529
|
+
} & JUHUU.RequestOptions;
|
1530
|
+
type Response = {
|
1531
|
+
apiKeyArray: JUHUU.ApiKey.Object[];
|
1532
|
+
count: number;
|
1533
|
+
hasMore: boolean;
|
1534
|
+
};
|
1535
|
+
}
|
1536
|
+
namespace Update {
|
1537
|
+
type Params = {
|
1538
|
+
apiKeyId: string;
|
1539
|
+
status?: ApiKeyStatus;
|
1540
|
+
};
|
1541
|
+
type Options = JUHUU.RequestOptions;
|
1542
|
+
type Response = {
|
1543
|
+
apiKey: JUHUU.ApiKey.Object;
|
1544
|
+
};
|
1545
|
+
}
|
1546
|
+
}
|
1465
1547
|
namespace ArticleEmbedding {
|
1466
1548
|
type Object = {
|
1467
1549
|
id: string;
|
@@ -3317,4 +3399,4 @@ declare namespace JUHUU {
|
|
3317
3399
|
}
|
3318
3400
|
}
|
3319
3401
|
|
3320
|
-
export { type AccessControlListElement, type Address, 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 };
|
3402
|
+
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 };
|
package/dist/index.d.ts
CHANGED
@@ -12,6 +12,8 @@ type ExtractType<T> = T extends {
|
|
12
12
|
} ? U : never;
|
13
13
|
type UserGroup = "retailer" | "engineer" | "operator" | "user";
|
14
14
|
type Frontend = "dashboard" | "app";
|
15
|
+
type ApiKeyStatus = "enabled" | "disabled";
|
16
|
+
type ApiKeyScope = "device:parameter:update";
|
15
17
|
type Capability = {
|
16
18
|
type: "predictiveMaintenance";
|
17
19
|
stripePriceId: string | null;
|
@@ -537,6 +539,9 @@ declare class Service {
|
|
537
539
|
readonly httpBaseUrl: string;
|
538
540
|
readonly wssBaseUrl: string;
|
539
541
|
readonly clientVersion: string;
|
542
|
+
readonly apiKey: string | null;
|
543
|
+
readonly defaultRequestOptions: JUHUU.RequestOptions;
|
544
|
+
readonly authenticationMode: "jwt" | "apiKey";
|
540
545
|
onException: <T>(response: JUHUU.HttpResponse<T>) => Promise<"abort" | "retry">;
|
541
546
|
getAccessToken: () => Promise<string | null> | null;
|
542
547
|
setAccessToken: (accessToken: string) => Promise<void>;
|
@@ -846,6 +851,14 @@ declare class DeviceParameterHistoriesService extends Service {
|
|
846
851
|
retrieve(DeviceParameterHistoryRetrieveParams: JUHUU.DeviceParameterHistory.Retrieve.Params, DeviceParameterHistoryRetrieveOptions?: JUHUU.DeviceParameterHistory.Retrieve.Options): Promise<JUHUU.HttpResponse<JUHUU.DeviceParameterHistory.Retrieve.Response>>;
|
847
852
|
}
|
848
853
|
|
854
|
+
declare class ApiKeysService extends Service {
|
855
|
+
constructor(config: JUHUU.SetupConfig);
|
856
|
+
create(ApiKeyCreateParams: JUHUU.ApiKey.Create.Params, ApiKeyCreateOptions?: JUHUU.ApiKey.Create.Options): Promise<JUHUU.HttpResponse<JUHUU.ApiKey.Create.Response>>;
|
857
|
+
list(ApiKeyListParams: JUHUU.ApiKey.List.Params, ApiKeyListOptions?: JUHUU.ApiKey.List.Options): Promise<JUHUU.HttpResponse<JUHUU.ApiKey.List.Response>>;
|
858
|
+
retrieve(ApiKeyRetrieveParams: JUHUU.ApiKey.Retrieve.Params, ApiKeyRetrieveOptions?: JUHUU.ApiKey.Retrieve.Options): Promise<JUHUU.HttpResponse<JUHUU.ApiKey.Retrieve.Response>>;
|
859
|
+
update(ApiKeyUpdateParams: JUHUU.ApiKey.Update.Params, ApiKeyUpdateOptions?: JUHUU.ApiKey.Update.Options): Promise<JUHUU.HttpResponse<JUHUU.ApiKey.Update.Response>>;
|
860
|
+
}
|
861
|
+
|
849
862
|
declare class Juhuu {
|
850
863
|
constructor(config: JUHUU.SetupConfig);
|
851
864
|
/**
|
@@ -879,16 +892,20 @@ declare class Juhuu {
|
|
879
892
|
readonly tapkey: TapkeyService;
|
880
893
|
readonly articleGroups: ArticleGroupGroupsService;
|
881
894
|
readonly deviceParameterHistories: DeviceParameterHistoriesService;
|
895
|
+
readonly apiKeys: ApiKeysService;
|
882
896
|
}
|
883
897
|
declare namespace JUHUU {
|
884
898
|
interface SetupConfig {
|
885
|
-
environment
|
886
|
-
getAccessToken
|
887
|
-
onException
|
888
|
-
setAccessToken
|
889
|
-
getRefreshToken
|
890
|
-
setRefreshToken
|
899
|
+
environment?: Environment;
|
900
|
+
getAccessToken?: () => Promise<string | null>;
|
901
|
+
onException?: <T>(response: JUHUU.HttpResponse<T>) => Promise<"abort">;
|
902
|
+
setAccessToken?: (accessToken: string) => Promise<void>;
|
903
|
+
getRefreshToken?: () => Promise<string | null>;
|
904
|
+
setRefreshToken?: (refreshToken: string) => Promise<void>;
|
891
905
|
clientVersion: string;
|
906
|
+
apiKey?: string;
|
907
|
+
defaultRequestOptions?: JUHUU.RequestOptions;
|
908
|
+
authenticationMode?: "jwt" | "apiKey";
|
892
909
|
}
|
893
910
|
interface HttpResponse<T> {
|
894
911
|
ok: boolean;
|
@@ -914,6 +931,10 @@ declare namespace JUHUU {
|
|
914
931
|
* If this is true, a new accessToken will be requested if the current one is expired.
|
915
932
|
*/
|
916
933
|
refreshTokensIfNecessary?: boolean;
|
934
|
+
/**
|
935
|
+
* If this API key is provided, the request will be sent with this API key instead of the one passed to config.
|
936
|
+
*/
|
937
|
+
apiKey?: string | null;
|
917
938
|
};
|
918
939
|
interface LocaleString {
|
919
940
|
de?: string;
|
@@ -1462,6 +1483,67 @@ declare namespace JUHUU {
|
|
1462
1483
|
type Response = JUHUU.AccountingArea.Object;
|
1463
1484
|
}
|
1464
1485
|
}
|
1486
|
+
namespace ApiKey {
|
1487
|
+
type Object = {
|
1488
|
+
id: string;
|
1489
|
+
readonly object: "apiKey";
|
1490
|
+
name: string;
|
1491
|
+
status: ApiKeyStatus;
|
1492
|
+
scopeArray: ApiKeyScope[];
|
1493
|
+
propertyId: string;
|
1494
|
+
expiresAt: Date | null;
|
1495
|
+
createdAt: Date;
|
1496
|
+
hash: string;
|
1497
|
+
};
|
1498
|
+
namespace Create {
|
1499
|
+
type Params = {
|
1500
|
+
propertyId: string;
|
1501
|
+
name?: string;
|
1502
|
+
};
|
1503
|
+
type Options = JUHUU.RequestOptions;
|
1504
|
+
type Response = {
|
1505
|
+
apiKey: JUHUU.ApiKey.Object;
|
1506
|
+
clearText: string;
|
1507
|
+
};
|
1508
|
+
}
|
1509
|
+
namespace Retrieve {
|
1510
|
+
type Params = {
|
1511
|
+
apiKeyId: string;
|
1512
|
+
};
|
1513
|
+
type Options = {
|
1514
|
+
expand?: Array<"property">;
|
1515
|
+
} & JUHUU.RequestOptions;
|
1516
|
+
type Response = {
|
1517
|
+
apiKey: JUHUU.ApiKey.Object;
|
1518
|
+
property?: JUHUU.Property.Object;
|
1519
|
+
};
|
1520
|
+
}
|
1521
|
+
namespace List {
|
1522
|
+
type Params = {
|
1523
|
+
propertyId?: string;
|
1524
|
+
statusArray?: JUHUU.Article.Object["status"][];
|
1525
|
+
};
|
1526
|
+
type Options = {
|
1527
|
+
limit?: number;
|
1528
|
+
skip?: number;
|
1529
|
+
} & JUHUU.RequestOptions;
|
1530
|
+
type Response = {
|
1531
|
+
apiKeyArray: JUHUU.ApiKey.Object[];
|
1532
|
+
count: number;
|
1533
|
+
hasMore: boolean;
|
1534
|
+
};
|
1535
|
+
}
|
1536
|
+
namespace Update {
|
1537
|
+
type Params = {
|
1538
|
+
apiKeyId: string;
|
1539
|
+
status?: ApiKeyStatus;
|
1540
|
+
};
|
1541
|
+
type Options = JUHUU.RequestOptions;
|
1542
|
+
type Response = {
|
1543
|
+
apiKey: JUHUU.ApiKey.Object;
|
1544
|
+
};
|
1545
|
+
}
|
1546
|
+
}
|
1465
1547
|
namespace ArticleEmbedding {
|
1466
1548
|
type Object = {
|
1467
1549
|
id: string;
|
@@ -3317,4 +3399,4 @@ declare namespace JUHUU {
|
|
3317
3399
|
}
|
3318
3400
|
}
|
3319
3401
|
|
3320
|
-
export { type AccessControlListElement, type Address, 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 };
|
3402
|
+
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 };
|
package/dist/index.js
CHANGED
@@ -46,14 +46,17 @@ module.exports = __toCommonJS(src_exports);
|
|
46
46
|
var import_socket = __toESM(require("socket.io-client"));
|
47
47
|
var Service = class {
|
48
48
|
constructor(config) {
|
49
|
-
this.environment = config.environment;
|
50
|
-
this.getAccessToken = config.getAccessToken;
|
51
|
-
this.onException = config.onException;
|
52
|
-
this.setAccessToken = config.setAccessToken;
|
53
|
-
this.getAccessToken = config.getAccessToken;
|
54
|
-
this.setRefreshToken = config.setRefreshToken;
|
55
|
-
this.getRefreshToken = config.getRefreshToken;
|
49
|
+
this.environment = config.environment ?? "production";
|
50
|
+
this.getAccessToken = config.getAccessToken ?? (() => null);
|
51
|
+
this.onException = config.onException ?? (() => Promise.resolve("abort"));
|
52
|
+
this.setAccessToken = config.setAccessToken ?? (() => Promise.resolve());
|
53
|
+
this.getAccessToken = config.getAccessToken ?? (() => null);
|
54
|
+
this.setRefreshToken = config.setRefreshToken ?? (() => Promise.resolve());
|
55
|
+
this.getRefreshToken = config.getRefreshToken ?? (() => Promise.resolve(null));
|
56
56
|
this.clientVersion = config.clientVersion;
|
57
|
+
this.apiKey = config.apiKey ?? null;
|
58
|
+
this.defaultRequestOptions = config.defaultRequestOptions ?? {};
|
59
|
+
this.authenticationMode = config.authenticationMode ?? "jwt";
|
57
60
|
switch (config.environment) {
|
58
61
|
case "development":
|
59
62
|
this.httpBaseUrl = "https://api.juhuu.dev/v1/";
|
@@ -69,6 +72,9 @@ var Service = class {
|
|
69
72
|
httpBaseUrl;
|
70
73
|
wssBaseUrl;
|
71
74
|
clientVersion;
|
75
|
+
apiKey;
|
76
|
+
defaultRequestOptions;
|
77
|
+
authenticationMode;
|
72
78
|
onException;
|
73
79
|
getAccessToken;
|
74
80
|
setAccessToken;
|
@@ -80,29 +86,76 @@ var Service = class {
|
|
80
86
|
body = void 0,
|
81
87
|
authenticationNotOptional
|
82
88
|
}, options = {}) {
|
83
|
-
|
84
|
-
|
89
|
+
const currentOptions = {
|
90
|
+
...this.defaultRequestOptions,
|
91
|
+
...options
|
92
|
+
};
|
93
|
+
if (currentOptions.triggerOnException === void 0) {
|
94
|
+
switch (this.authenticationMode) {
|
95
|
+
case "jwt": {
|
96
|
+
currentOptions.triggerOnException = true;
|
97
|
+
break;
|
98
|
+
}
|
99
|
+
case "apiKey": {
|
100
|
+
currentOptions.triggerOnException = false;
|
101
|
+
break;
|
102
|
+
}
|
103
|
+
}
|
85
104
|
}
|
86
|
-
if (
|
87
|
-
|
105
|
+
if (currentOptions.refreshTokensIfNecessary === void 0) {
|
106
|
+
switch (this.authenticationMode) {
|
107
|
+
case "jwt": {
|
108
|
+
currentOptions.refreshTokensIfNecessary = true;
|
109
|
+
break;
|
110
|
+
}
|
111
|
+
case "apiKey": {
|
112
|
+
currentOptions.refreshTokensIfNecessary = false;
|
113
|
+
break;
|
114
|
+
}
|
115
|
+
}
|
88
116
|
}
|
89
117
|
let token = null;
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
"
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
118
|
+
let apiKey = null;
|
119
|
+
switch (this.authenticationMode) {
|
120
|
+
case "jwt": {
|
121
|
+
if (currentOptions.accessToken === void 0 || currentOptions.accessToken === null) {
|
122
|
+
token = await this.getAccessToken();
|
123
|
+
} else {
|
124
|
+
token = currentOptions.accessToken;
|
125
|
+
}
|
126
|
+
console.log("accessToken:", token);
|
127
|
+
if ((token === null || token === void 0) && authenticationNotOptional === true) {
|
128
|
+
console.error(
|
129
|
+
"endpoint",
|
130
|
+
url,
|
131
|
+
"should use authentication but no token was found"
|
132
|
+
);
|
133
|
+
return {
|
134
|
+
ok: false,
|
135
|
+
data: {}
|
136
|
+
};
|
137
|
+
}
|
138
|
+
break;
|
139
|
+
}
|
140
|
+
case "apiKey": {
|
141
|
+
if (currentOptions.apiKey === void 0 || currentOptions.apiKey === null) {
|
142
|
+
apiKey = this.apiKey;
|
143
|
+
} else {
|
144
|
+
apiKey = currentOptions.apiKey;
|
145
|
+
}
|
146
|
+
if (apiKey === null) {
|
147
|
+
console.error(
|
148
|
+
"endpoint",
|
149
|
+
url,
|
150
|
+
"should use authentication but no apiKey was found"
|
151
|
+
);
|
152
|
+
return {
|
153
|
+
ok: false,
|
154
|
+
data: {}
|
155
|
+
};
|
156
|
+
}
|
157
|
+
break;
|
158
|
+
}
|
106
159
|
}
|
107
160
|
const uri = this.httpBaseUrl + url;
|
108
161
|
let response = null;
|
@@ -110,19 +163,19 @@ var Service = class {
|
|
110
163
|
try {
|
111
164
|
switch (method) {
|
112
165
|
case "GET": {
|
113
|
-
response = await this.sendGetRequest(token, uri);
|
166
|
+
response = await this.sendGetRequest({ token, uri, apiKey });
|
114
167
|
break;
|
115
168
|
}
|
116
169
|
case "POST": {
|
117
|
-
response = await this.sendPostRequest(token, uri, body);
|
170
|
+
response = await this.sendPostRequest({ token, uri, body, apiKey });
|
118
171
|
break;
|
119
172
|
}
|
120
173
|
case "PATCH": {
|
121
|
-
response = await this.sendPatchRequest(token, uri, body);
|
174
|
+
response = await this.sendPatchRequest({ token, uri, body, apiKey });
|
122
175
|
break;
|
123
176
|
}
|
124
177
|
case "DELETE": {
|
125
|
-
response = await this.sendDeleteRequest(token, uri);
|
178
|
+
response = await this.sendDeleteRequest({ token, uri, apiKey });
|
126
179
|
break;
|
127
180
|
}
|
128
181
|
}
|
@@ -210,7 +263,11 @@ var Service = class {
|
|
210
263
|
}
|
211
264
|
return responseObject;
|
212
265
|
}
|
213
|
-
async sendGetRequest(
|
266
|
+
async sendGetRequest({
|
267
|
+
token,
|
268
|
+
apiKey,
|
269
|
+
uri
|
270
|
+
}) {
|
214
271
|
const headers = {
|
215
272
|
"Content-Type": "application/json",
|
216
273
|
"Client-Version": this.clientVersion
|
@@ -218,12 +275,20 @@ var Service = class {
|
|
218
275
|
if (token !== void 0 && token !== null) {
|
219
276
|
headers.Authorization = `Bearer ${token}`;
|
220
277
|
}
|
278
|
+
if (apiKey !== null) {
|
279
|
+
headers["X-API-KEY"] = apiKey;
|
280
|
+
}
|
221
281
|
return await fetch(uri, {
|
222
282
|
method: "GET",
|
223
283
|
headers
|
224
284
|
});
|
225
285
|
}
|
226
|
-
async sendPostRequest(
|
286
|
+
async sendPostRequest({
|
287
|
+
token,
|
288
|
+
uri,
|
289
|
+
apiKey,
|
290
|
+
body
|
291
|
+
}) {
|
227
292
|
const headers = {
|
228
293
|
"Content-Type": "application/json",
|
229
294
|
"Client-Version": this.clientVersion
|
@@ -231,13 +296,21 @@ var Service = class {
|
|
231
296
|
if (token !== void 0 && token !== null) {
|
232
297
|
headers.Authorization = `Bearer ${token}`;
|
233
298
|
}
|
299
|
+
if (apiKey !== null) {
|
300
|
+
headers["X-API-KEY"] = apiKey;
|
301
|
+
}
|
234
302
|
return await fetch(uri, {
|
235
303
|
method: "POST",
|
236
304
|
headers,
|
237
305
|
body: JSON.stringify(body)
|
238
306
|
});
|
239
307
|
}
|
240
|
-
async sendPatchRequest(
|
308
|
+
async sendPatchRequest({
|
309
|
+
token,
|
310
|
+
uri,
|
311
|
+
apiKey,
|
312
|
+
body
|
313
|
+
}) {
|
241
314
|
const headers = {
|
242
315
|
"Content-Type": "application/json",
|
243
316
|
"Client-Version": this.clientVersion
|
@@ -245,13 +318,20 @@ var Service = class {
|
|
245
318
|
if (token !== void 0 && token !== null) {
|
246
319
|
headers.Authorization = `Bearer ${token}`;
|
247
320
|
}
|
321
|
+
if (apiKey !== null) {
|
322
|
+
headers["X-API-KEY"] = apiKey;
|
323
|
+
}
|
248
324
|
return await fetch(uri, {
|
249
325
|
method: "PATCH",
|
250
326
|
headers,
|
251
327
|
body: JSON.stringify(body)
|
252
328
|
});
|
253
329
|
}
|
254
|
-
async sendDeleteRequest(
|
330
|
+
async sendDeleteRequest({
|
331
|
+
token,
|
332
|
+
uri,
|
333
|
+
apiKey
|
334
|
+
}) {
|
255
335
|
const headers = {
|
256
336
|
"Content-Type": "application/json",
|
257
337
|
"Client-Version": this.clientVersion
|
@@ -259,6 +339,9 @@ var Service = class {
|
|
259
339
|
if (token !== void 0 && token !== null) {
|
260
340
|
headers.Authorization = `Bearer ${token}`;
|
261
341
|
}
|
342
|
+
if (apiKey !== null) {
|
343
|
+
headers["X-API-KEY"] = apiKey;
|
344
|
+
}
|
262
345
|
return await fetch(uri, {
|
263
346
|
method: "DELETE",
|
264
347
|
headers
|
@@ -2749,6 +2832,78 @@ var DeviceParameterHistoriesService = class extends Service {
|
|
2749
2832
|
}
|
2750
2833
|
};
|
2751
2834
|
|
2835
|
+
// src/apiKeys/apiKeys.service.ts
|
2836
|
+
var ApiKeysService = class extends Service {
|
2837
|
+
constructor(config) {
|
2838
|
+
super(config);
|
2839
|
+
}
|
2840
|
+
async create(ApiKeyCreateParams, ApiKeyCreateOptions) {
|
2841
|
+
return await super.sendRequest(
|
2842
|
+
{
|
2843
|
+
method: "POST",
|
2844
|
+
url: "apiKeys",
|
2845
|
+
body: {
|
2846
|
+
propertyId: ApiKeyCreateParams.propertyId
|
2847
|
+
},
|
2848
|
+
authenticationNotOptional: true
|
2849
|
+
},
|
2850
|
+
ApiKeyCreateOptions
|
2851
|
+
);
|
2852
|
+
}
|
2853
|
+
async list(ApiKeyListParams, ApiKeyListOptions) {
|
2854
|
+
const queryArray = [];
|
2855
|
+
if (ApiKeyListOptions?.limit !== void 0) {
|
2856
|
+
queryArray.push("limit=" + ApiKeyListOptions.limit);
|
2857
|
+
}
|
2858
|
+
if (ApiKeyListParams?.propertyId !== void 0) {
|
2859
|
+
queryArray.push("propertyId=" + ApiKeyListParams.propertyId);
|
2860
|
+
}
|
2861
|
+
if (ApiKeyListParams?.statusArray !== void 0) {
|
2862
|
+
queryArray.push("statusArray=" + ApiKeyListParams.statusArray.join(","));
|
2863
|
+
}
|
2864
|
+
if (ApiKeyListOptions?.skip !== void 0) {
|
2865
|
+
queryArray.push("skip=" + ApiKeyListOptions.skip);
|
2866
|
+
}
|
2867
|
+
return await super.sendRequest(
|
2868
|
+
{
|
2869
|
+
method: "GET",
|
2870
|
+
url: "apiKeys?" + queryArray.join("&"),
|
2871
|
+
body: void 0,
|
2872
|
+
authenticationNotOptional: false
|
2873
|
+
},
|
2874
|
+
ApiKeyListOptions
|
2875
|
+
);
|
2876
|
+
}
|
2877
|
+
async retrieve(ApiKeyRetrieveParams, ApiKeyRetrieveOptions) {
|
2878
|
+
const queryArray = [];
|
2879
|
+
if (ApiKeyRetrieveOptions?.expand !== void 0) {
|
2880
|
+
queryArray.push("expand=" + ApiKeyRetrieveOptions.expand.join(","));
|
2881
|
+
}
|
2882
|
+
return await super.sendRequest(
|
2883
|
+
{
|
2884
|
+
method: "GET",
|
2885
|
+
url: "apiKeys/" + ApiKeyRetrieveParams.apiKeyId + "?" + queryArray.join("&"),
|
2886
|
+
body: void 0,
|
2887
|
+
authenticationNotOptional: false
|
2888
|
+
},
|
2889
|
+
ApiKeyRetrieveOptions
|
2890
|
+
);
|
2891
|
+
}
|
2892
|
+
async update(ApiKeyUpdateParams, ApiKeyUpdateOptions) {
|
2893
|
+
return await super.sendRequest(
|
2894
|
+
{
|
2895
|
+
method: "PATCH",
|
2896
|
+
url: "apiKeys/" + ApiKeyUpdateParams.apiKeyId,
|
2897
|
+
body: {
|
2898
|
+
status: ApiKeyUpdateParams.status
|
2899
|
+
},
|
2900
|
+
authenticationNotOptional: true
|
2901
|
+
},
|
2902
|
+
ApiKeyUpdateOptions
|
2903
|
+
);
|
2904
|
+
}
|
2905
|
+
};
|
2906
|
+
|
2752
2907
|
// src/types/types.ts
|
2753
2908
|
var LanguageCodeArray = [
|
2754
2909
|
"en",
|
@@ -2926,6 +3081,7 @@ var Juhuu = class {
|
|
2926
3081
|
this.tapkey = new TapkeyService(config);
|
2927
3082
|
this.articleGroups = new ArticleGroupGroupsService(config);
|
2928
3083
|
this.deviceParameterHistories = new DeviceParameterHistoriesService(config);
|
3084
|
+
this.apiKeys = new ApiKeysService(config);
|
2929
3085
|
}
|
2930
3086
|
/**
|
2931
3087
|
* Top Level Resources
|
@@ -2958,6 +3114,7 @@ var Juhuu = class {
|
|
2958
3114
|
tapkey;
|
2959
3115
|
articleGroups;
|
2960
3116
|
deviceParameterHistories;
|
3117
|
+
apiKeys;
|
2961
3118
|
};
|
2962
3119
|
var JUHUU;
|
2963
3120
|
((JUHUU2) => {
|
package/dist/index.mjs
CHANGED
@@ -2,14 +2,17 @@
|
|
2
2
|
import io from "socket.io-client";
|
3
3
|
var Service = class {
|
4
4
|
constructor(config) {
|
5
|
-
this.environment = config.environment;
|
6
|
-
this.getAccessToken = config.getAccessToken;
|
7
|
-
this.onException = config.onException;
|
8
|
-
this.setAccessToken = config.setAccessToken;
|
9
|
-
this.getAccessToken = config.getAccessToken;
|
10
|
-
this.setRefreshToken = config.setRefreshToken;
|
11
|
-
this.getRefreshToken = config.getRefreshToken;
|
5
|
+
this.environment = config.environment ?? "production";
|
6
|
+
this.getAccessToken = config.getAccessToken ?? (() => null);
|
7
|
+
this.onException = config.onException ?? (() => Promise.resolve("abort"));
|
8
|
+
this.setAccessToken = config.setAccessToken ?? (() => Promise.resolve());
|
9
|
+
this.getAccessToken = config.getAccessToken ?? (() => null);
|
10
|
+
this.setRefreshToken = config.setRefreshToken ?? (() => Promise.resolve());
|
11
|
+
this.getRefreshToken = config.getRefreshToken ?? (() => Promise.resolve(null));
|
12
12
|
this.clientVersion = config.clientVersion;
|
13
|
+
this.apiKey = config.apiKey ?? null;
|
14
|
+
this.defaultRequestOptions = config.defaultRequestOptions ?? {};
|
15
|
+
this.authenticationMode = config.authenticationMode ?? "jwt";
|
13
16
|
switch (config.environment) {
|
14
17
|
case "development":
|
15
18
|
this.httpBaseUrl = "https://api.juhuu.dev/v1/";
|
@@ -25,6 +28,9 @@ var Service = class {
|
|
25
28
|
httpBaseUrl;
|
26
29
|
wssBaseUrl;
|
27
30
|
clientVersion;
|
31
|
+
apiKey;
|
32
|
+
defaultRequestOptions;
|
33
|
+
authenticationMode;
|
28
34
|
onException;
|
29
35
|
getAccessToken;
|
30
36
|
setAccessToken;
|
@@ -36,29 +42,76 @@ var Service = class {
|
|
36
42
|
body = void 0,
|
37
43
|
authenticationNotOptional
|
38
44
|
}, options = {}) {
|
39
|
-
|
40
|
-
|
45
|
+
const currentOptions = {
|
46
|
+
...this.defaultRequestOptions,
|
47
|
+
...options
|
48
|
+
};
|
49
|
+
if (currentOptions.triggerOnException === void 0) {
|
50
|
+
switch (this.authenticationMode) {
|
51
|
+
case "jwt": {
|
52
|
+
currentOptions.triggerOnException = true;
|
53
|
+
break;
|
54
|
+
}
|
55
|
+
case "apiKey": {
|
56
|
+
currentOptions.triggerOnException = false;
|
57
|
+
break;
|
58
|
+
}
|
59
|
+
}
|
41
60
|
}
|
42
|
-
if (
|
43
|
-
|
61
|
+
if (currentOptions.refreshTokensIfNecessary === void 0) {
|
62
|
+
switch (this.authenticationMode) {
|
63
|
+
case "jwt": {
|
64
|
+
currentOptions.refreshTokensIfNecessary = true;
|
65
|
+
break;
|
66
|
+
}
|
67
|
+
case "apiKey": {
|
68
|
+
currentOptions.refreshTokensIfNecessary = false;
|
69
|
+
break;
|
70
|
+
}
|
71
|
+
}
|
44
72
|
}
|
45
73
|
let token = null;
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
"
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
74
|
+
let apiKey = null;
|
75
|
+
switch (this.authenticationMode) {
|
76
|
+
case "jwt": {
|
77
|
+
if (currentOptions.accessToken === void 0 || currentOptions.accessToken === null) {
|
78
|
+
token = await this.getAccessToken();
|
79
|
+
} else {
|
80
|
+
token = currentOptions.accessToken;
|
81
|
+
}
|
82
|
+
console.log("accessToken:", token);
|
83
|
+
if ((token === null || token === void 0) && authenticationNotOptional === true) {
|
84
|
+
console.error(
|
85
|
+
"endpoint",
|
86
|
+
url,
|
87
|
+
"should use authentication but no token was found"
|
88
|
+
);
|
89
|
+
return {
|
90
|
+
ok: false,
|
91
|
+
data: {}
|
92
|
+
};
|
93
|
+
}
|
94
|
+
break;
|
95
|
+
}
|
96
|
+
case "apiKey": {
|
97
|
+
if (currentOptions.apiKey === void 0 || currentOptions.apiKey === null) {
|
98
|
+
apiKey = this.apiKey;
|
99
|
+
} else {
|
100
|
+
apiKey = currentOptions.apiKey;
|
101
|
+
}
|
102
|
+
if (apiKey === null) {
|
103
|
+
console.error(
|
104
|
+
"endpoint",
|
105
|
+
url,
|
106
|
+
"should use authentication but no apiKey was found"
|
107
|
+
);
|
108
|
+
return {
|
109
|
+
ok: false,
|
110
|
+
data: {}
|
111
|
+
};
|
112
|
+
}
|
113
|
+
break;
|
114
|
+
}
|
62
115
|
}
|
63
116
|
const uri = this.httpBaseUrl + url;
|
64
117
|
let response = null;
|
@@ -66,19 +119,19 @@ var Service = class {
|
|
66
119
|
try {
|
67
120
|
switch (method) {
|
68
121
|
case "GET": {
|
69
|
-
response = await this.sendGetRequest(token, uri);
|
122
|
+
response = await this.sendGetRequest({ token, uri, apiKey });
|
70
123
|
break;
|
71
124
|
}
|
72
125
|
case "POST": {
|
73
|
-
response = await this.sendPostRequest(token, uri, body);
|
126
|
+
response = await this.sendPostRequest({ token, uri, body, apiKey });
|
74
127
|
break;
|
75
128
|
}
|
76
129
|
case "PATCH": {
|
77
|
-
response = await this.sendPatchRequest(token, uri, body);
|
130
|
+
response = await this.sendPatchRequest({ token, uri, body, apiKey });
|
78
131
|
break;
|
79
132
|
}
|
80
133
|
case "DELETE": {
|
81
|
-
response = await this.sendDeleteRequest(token, uri);
|
134
|
+
response = await this.sendDeleteRequest({ token, uri, apiKey });
|
82
135
|
break;
|
83
136
|
}
|
84
137
|
}
|
@@ -166,7 +219,11 @@ var Service = class {
|
|
166
219
|
}
|
167
220
|
return responseObject;
|
168
221
|
}
|
169
|
-
async sendGetRequest(
|
222
|
+
async sendGetRequest({
|
223
|
+
token,
|
224
|
+
apiKey,
|
225
|
+
uri
|
226
|
+
}) {
|
170
227
|
const headers = {
|
171
228
|
"Content-Type": "application/json",
|
172
229
|
"Client-Version": this.clientVersion
|
@@ -174,12 +231,20 @@ var Service = class {
|
|
174
231
|
if (token !== void 0 && token !== null) {
|
175
232
|
headers.Authorization = `Bearer ${token}`;
|
176
233
|
}
|
234
|
+
if (apiKey !== null) {
|
235
|
+
headers["X-API-KEY"] = apiKey;
|
236
|
+
}
|
177
237
|
return await fetch(uri, {
|
178
238
|
method: "GET",
|
179
239
|
headers
|
180
240
|
});
|
181
241
|
}
|
182
|
-
async sendPostRequest(
|
242
|
+
async sendPostRequest({
|
243
|
+
token,
|
244
|
+
uri,
|
245
|
+
apiKey,
|
246
|
+
body
|
247
|
+
}) {
|
183
248
|
const headers = {
|
184
249
|
"Content-Type": "application/json",
|
185
250
|
"Client-Version": this.clientVersion
|
@@ -187,13 +252,21 @@ var Service = class {
|
|
187
252
|
if (token !== void 0 && token !== null) {
|
188
253
|
headers.Authorization = `Bearer ${token}`;
|
189
254
|
}
|
255
|
+
if (apiKey !== null) {
|
256
|
+
headers["X-API-KEY"] = apiKey;
|
257
|
+
}
|
190
258
|
return await fetch(uri, {
|
191
259
|
method: "POST",
|
192
260
|
headers,
|
193
261
|
body: JSON.stringify(body)
|
194
262
|
});
|
195
263
|
}
|
196
|
-
async sendPatchRequest(
|
264
|
+
async sendPatchRequest({
|
265
|
+
token,
|
266
|
+
uri,
|
267
|
+
apiKey,
|
268
|
+
body
|
269
|
+
}) {
|
197
270
|
const headers = {
|
198
271
|
"Content-Type": "application/json",
|
199
272
|
"Client-Version": this.clientVersion
|
@@ -201,13 +274,20 @@ var Service = class {
|
|
201
274
|
if (token !== void 0 && token !== null) {
|
202
275
|
headers.Authorization = `Bearer ${token}`;
|
203
276
|
}
|
277
|
+
if (apiKey !== null) {
|
278
|
+
headers["X-API-KEY"] = apiKey;
|
279
|
+
}
|
204
280
|
return await fetch(uri, {
|
205
281
|
method: "PATCH",
|
206
282
|
headers,
|
207
283
|
body: JSON.stringify(body)
|
208
284
|
});
|
209
285
|
}
|
210
|
-
async sendDeleteRequest(
|
286
|
+
async sendDeleteRequest({
|
287
|
+
token,
|
288
|
+
uri,
|
289
|
+
apiKey
|
290
|
+
}) {
|
211
291
|
const headers = {
|
212
292
|
"Content-Type": "application/json",
|
213
293
|
"Client-Version": this.clientVersion
|
@@ -215,6 +295,9 @@ var Service = class {
|
|
215
295
|
if (token !== void 0 && token !== null) {
|
216
296
|
headers.Authorization = `Bearer ${token}`;
|
217
297
|
}
|
298
|
+
if (apiKey !== null) {
|
299
|
+
headers["X-API-KEY"] = apiKey;
|
300
|
+
}
|
218
301
|
return await fetch(uri, {
|
219
302
|
method: "DELETE",
|
220
303
|
headers
|
@@ -2705,6 +2788,78 @@ var DeviceParameterHistoriesService = class extends Service {
|
|
2705
2788
|
}
|
2706
2789
|
};
|
2707
2790
|
|
2791
|
+
// src/apiKeys/apiKeys.service.ts
|
2792
|
+
var ApiKeysService = class extends Service {
|
2793
|
+
constructor(config) {
|
2794
|
+
super(config);
|
2795
|
+
}
|
2796
|
+
async create(ApiKeyCreateParams, ApiKeyCreateOptions) {
|
2797
|
+
return await super.sendRequest(
|
2798
|
+
{
|
2799
|
+
method: "POST",
|
2800
|
+
url: "apiKeys",
|
2801
|
+
body: {
|
2802
|
+
propertyId: ApiKeyCreateParams.propertyId
|
2803
|
+
},
|
2804
|
+
authenticationNotOptional: true
|
2805
|
+
},
|
2806
|
+
ApiKeyCreateOptions
|
2807
|
+
);
|
2808
|
+
}
|
2809
|
+
async list(ApiKeyListParams, ApiKeyListOptions) {
|
2810
|
+
const queryArray = [];
|
2811
|
+
if (ApiKeyListOptions?.limit !== void 0) {
|
2812
|
+
queryArray.push("limit=" + ApiKeyListOptions.limit);
|
2813
|
+
}
|
2814
|
+
if (ApiKeyListParams?.propertyId !== void 0) {
|
2815
|
+
queryArray.push("propertyId=" + ApiKeyListParams.propertyId);
|
2816
|
+
}
|
2817
|
+
if (ApiKeyListParams?.statusArray !== void 0) {
|
2818
|
+
queryArray.push("statusArray=" + ApiKeyListParams.statusArray.join(","));
|
2819
|
+
}
|
2820
|
+
if (ApiKeyListOptions?.skip !== void 0) {
|
2821
|
+
queryArray.push("skip=" + ApiKeyListOptions.skip);
|
2822
|
+
}
|
2823
|
+
return await super.sendRequest(
|
2824
|
+
{
|
2825
|
+
method: "GET",
|
2826
|
+
url: "apiKeys?" + queryArray.join("&"),
|
2827
|
+
body: void 0,
|
2828
|
+
authenticationNotOptional: false
|
2829
|
+
},
|
2830
|
+
ApiKeyListOptions
|
2831
|
+
);
|
2832
|
+
}
|
2833
|
+
async retrieve(ApiKeyRetrieveParams, ApiKeyRetrieveOptions) {
|
2834
|
+
const queryArray = [];
|
2835
|
+
if (ApiKeyRetrieveOptions?.expand !== void 0) {
|
2836
|
+
queryArray.push("expand=" + ApiKeyRetrieveOptions.expand.join(","));
|
2837
|
+
}
|
2838
|
+
return await super.sendRequest(
|
2839
|
+
{
|
2840
|
+
method: "GET",
|
2841
|
+
url: "apiKeys/" + ApiKeyRetrieveParams.apiKeyId + "?" + queryArray.join("&"),
|
2842
|
+
body: void 0,
|
2843
|
+
authenticationNotOptional: false
|
2844
|
+
},
|
2845
|
+
ApiKeyRetrieveOptions
|
2846
|
+
);
|
2847
|
+
}
|
2848
|
+
async update(ApiKeyUpdateParams, ApiKeyUpdateOptions) {
|
2849
|
+
return await super.sendRequest(
|
2850
|
+
{
|
2851
|
+
method: "PATCH",
|
2852
|
+
url: "apiKeys/" + ApiKeyUpdateParams.apiKeyId,
|
2853
|
+
body: {
|
2854
|
+
status: ApiKeyUpdateParams.status
|
2855
|
+
},
|
2856
|
+
authenticationNotOptional: true
|
2857
|
+
},
|
2858
|
+
ApiKeyUpdateOptions
|
2859
|
+
);
|
2860
|
+
}
|
2861
|
+
};
|
2862
|
+
|
2708
2863
|
// src/types/types.ts
|
2709
2864
|
var LanguageCodeArray = [
|
2710
2865
|
"en",
|
@@ -2882,6 +3037,7 @@ var Juhuu = class {
|
|
2882
3037
|
this.tapkey = new TapkeyService(config);
|
2883
3038
|
this.articleGroups = new ArticleGroupGroupsService(config);
|
2884
3039
|
this.deviceParameterHistories = new DeviceParameterHistoriesService(config);
|
3040
|
+
this.apiKeys = new ApiKeysService(config);
|
2885
3041
|
}
|
2886
3042
|
/**
|
2887
3043
|
* Top Level Resources
|
@@ -2914,6 +3070,7 @@ var Juhuu = class {
|
|
2914
3070
|
tapkey;
|
2915
3071
|
articleGroups;
|
2916
3072
|
deviceParameterHistories;
|
3073
|
+
apiKeys;
|
2917
3074
|
};
|
2918
3075
|
var JUHUU;
|
2919
3076
|
((JUHUU2) => {
|