@remkoj/optimizely-cms-api 5.1.5 → 6.0.0-pre10
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/README.md +3 -5
- package/dist/api-client.d.ts +70 -11
- package/dist/api-client.js +208 -48
- package/dist/client/client/client.gen.d.ts +2 -0
- package/dist/client/client/client.gen.js +208 -0
- package/dist/client/client/index.d.ts +8 -0
- package/dist/client/client/index.js +17 -0
- package/dist/client/client/types.gen.d.ts +124 -0
- package/dist/client/{core/ApiRequestOptions.js → client/types.gen.js} +1 -0
- package/dist/client/client/utils.gen.d.ts +33 -0
- package/dist/client/client/utils.gen.js +242 -0
- package/dist/client/client.gen.d.ts +12 -0
- package/dist/client/client.gen.js +9 -0
- package/dist/client/core/auth.gen.d.ts +18 -0
- package/dist/client/core/auth.gen.js +18 -0
- package/dist/client/core/bodySerializer.gen.d.ts +25 -0
- package/dist/client/core/bodySerializer.gen.js +60 -0
- package/dist/client/core/params.gen.d.ts +33 -0
- package/dist/client/core/params.gen.js +92 -0
- package/dist/client/core/pathSerializer.gen.d.ts +33 -0
- package/dist/client/core/pathSerializer.gen.js +123 -0
- package/dist/client/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/client/core/queryKeySerializer.gen.js +105 -0
- package/dist/client/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/client/core/serverSentEvents.gen.js +139 -0
- package/dist/client/core/types.gen.d.ts +78 -0
- package/dist/client/core/{ApiResult.js → types.gen.js} +1 -0
- package/dist/client/core/utils.gen.d.ts +19 -0
- package/dist/client/core/utils.gen.js +93 -0
- package/dist/client/index.d.ts +4 -78
- package/dist/client/index.js +18 -46
- package/dist/client/sdk.gen.d.ts +117 -0
- package/dist/client/sdk.gen.js +251 -0
- package/dist/client/transformers.gen.d.ts +18 -0
- package/dist/client/transformers.gen.js +157 -0
- package/dist/client/types.gen.d.ts +1285 -0
- package/dist/client/{models/BooleanProperty.js → types.gen.js} +1 -0
- package/dist/client-config.d.ts +5 -0
- package/dist/client-config.js +55 -0
- package/dist/config.d.ts +5 -2
- package/dist/config.js +26 -18
- package/dist/getaccesstoken.d.ts +1 -1
- package/dist/getaccesstoken.js +10 -9
- package/dist/index.d.ts +7 -6
- package/dist/index.js +15 -8
- package/dist/instance.client/client/client.gen.d.ts +2 -0
- package/dist/instance.client/client/client.gen.js +208 -0
- package/dist/instance.client/client/index.d.ts +8 -0
- package/dist/instance.client/client/index.js +17 -0
- package/dist/instance.client/client/types.gen.d.ts +124 -0
- package/dist/{client/models/BinaryProperty.js → instance.client/client/types.gen.js} +1 -0
- package/dist/instance.client/client/utils.gen.d.ts +33 -0
- package/dist/instance.client/client/utils.gen.js +242 -0
- package/dist/instance.client/client.gen.d.ts +12 -0
- package/dist/instance.client/client.gen.js +9 -0
- package/dist/instance.client/core/auth.gen.d.ts +18 -0
- package/dist/instance.client/core/auth.gen.js +18 -0
- package/dist/instance.client/core/bodySerializer.gen.d.ts +25 -0
- package/dist/instance.client/core/bodySerializer.gen.js +60 -0
- package/dist/instance.client/core/params.gen.d.ts +33 -0
- package/dist/instance.client/core/params.gen.js +92 -0
- package/dist/instance.client/core/pathSerializer.gen.d.ts +33 -0
- package/dist/instance.client/core/pathSerializer.gen.js +123 -0
- package/dist/instance.client/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/instance.client/core/queryKeySerializer.gen.js +105 -0
- package/dist/instance.client/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/instance.client/core/serverSentEvents.gen.js +139 -0
- package/dist/instance.client/core/types.gen.d.ts +78 -0
- package/dist/instance.client/core/types.gen.js +3 -0
- package/dist/instance.client/core/utils.gen.d.ts +19 -0
- package/dist/instance.client/core/utils.gen.js +93 -0
- package/dist/instance.client/index.d.ts +4 -0
- package/dist/instance.client/index.js +21 -0
- package/dist/instance.client/sdk.gen.d.ts +303 -0
- package/dist/instance.client/sdk.gen.js +699 -0
- package/dist/instance.client/transformers.gen.d.ts +48 -0
- package/dist/instance.client/transformers.gen.js +431 -0
- package/dist/instance.client/types.gen.d.ts +2838 -0
- package/dist/instance.client/types.gen.js +3 -0
- package/dist/types.d.ts +3 -1
- package/dist/types.js +1 -0
- package/dist/version.json +3 -3
- package/package.json +16 -11
- package/dist/client/CmsIntegrationApiClient.d.ts +0 -22
- package/dist/client/CmsIntegrationApiClient.js +0 -34
- package/dist/client/core/ApiError.d.ts +0 -10
- package/dist/client/core/ApiError.js +0 -15
- package/dist/client/core/ApiRequestOptions.d.ts +0 -13
- package/dist/client/core/ApiResult.d.ts +0 -7
- package/dist/client/core/BaseHttpRequest.d.ts +0 -8
- package/dist/client/core/BaseHttpRequest.js +0 -9
- package/dist/client/core/CancelablePromise.d.ts +0 -20
- package/dist/client/core/CancelablePromise.js +0 -116
- package/dist/client/core/FetchHttpRequest.d.ts +0 -14
- package/dist/client/core/FetchHttpRequest.js +0 -20
- package/dist/client/core/OpenAPI.d.ts +0 -16
- package/dist/client/core/OpenAPI.js +0 -14
- package/dist/client/core/request.d.ts +0 -30
- package/dist/client/core/request.js +0 -294
- package/dist/client/models/BinaryProperty.d.ts +0 -8
- package/dist/client/models/BooleanProperty.d.ts +0 -5
- package/dist/client/models/Changeset.d.ts +0 -26
- package/dist/client/models/Changeset.js +0 -2
- package/dist/client/models/ChangesetItem.d.ts +0 -11
- package/dist/client/models/ChangesetItem.js +0 -2
- package/dist/client/models/ChangesetItemPage.d.ts +0 -19
- package/dist/client/models/ChangesetItemPage.js +0 -2
- package/dist/client/models/ChangesetPage.d.ts +0 -19
- package/dist/client/models/ChangesetPage.js +0 -2
- package/dist/client/models/ComponentListItem.d.ts +0 -10
- package/dist/client/models/ComponentListItem.js +0 -2
- package/dist/client/models/ComponentProperty.d.ts +0 -10
- package/dist/client/models/ComponentProperty.js +0 -2
- package/dist/client/models/CompositionBehavior.d.ts +0 -7
- package/dist/client/models/CompositionBehavior.js +0 -15
- package/dist/client/models/ContentBaseType.d.ts +0 -14
- package/dist/client/models/ContentBaseType.js +0 -22
- package/dist/client/models/ContentComponent.d.ts +0 -30
- package/dist/client/models/ContentComponent.js +0 -2
- package/dist/client/models/ContentItem.d.ts +0 -60
- package/dist/client/models/ContentItem.js +0 -2
- package/dist/client/models/ContentItemListWithContentTypes.d.ts +0 -27
- package/dist/client/models/ContentItemListWithContentTypes.js +0 -2
- package/dist/client/models/ContentItemPage.d.ts +0 -19
- package/dist/client/models/ContentItemPage.js +0 -2
- package/dist/client/models/ContentItemWithContentTypes.d.ts +0 -12
- package/dist/client/models/ContentItemWithContentTypes.js +0 -2
- package/dist/client/models/ContentListItem.d.ts +0 -14
- package/dist/client/models/ContentListItem.js +0 -2
- package/dist/client/models/ContentLocaleInfo.d.ts +0 -19
- package/dist/client/models/ContentLocaleInfo.js +0 -2
- package/dist/client/models/ContentMetadata.d.ts +0 -38
- package/dist/client/models/ContentMetadata.js +0 -2
- package/dist/client/models/ContentMetadataPage.d.ts +0 -19
- package/dist/client/models/ContentMetadataPage.js +0 -2
- package/dist/client/models/ContentProperty.d.ts +0 -14
- package/dist/client/models/ContentProperty.js +0 -2
- package/dist/client/models/ContentReference.d.ts +0 -17
- package/dist/client/models/ContentReference.js +0 -2
- package/dist/client/models/ContentReferenceListItem.d.ts +0 -14
- package/dist/client/models/ContentReferenceListItem.js +0 -2
- package/dist/client/models/ContentReferenceProperty.d.ts +0 -14
- package/dist/client/models/ContentReferenceProperty.js +0 -2
- package/dist/client/models/ContentType.d.ts +0 -84
- package/dist/client/models/ContentType.js +0 -2
- package/dist/client/models/ContentTypeFeature.d.ts +0 -10
- package/dist/client/models/ContentTypeFeature.js +0 -18
- package/dist/client/models/ContentTypePage.d.ts +0 -19
- package/dist/client/models/ContentTypePage.js +0 -2
- package/dist/client/models/ContentTypeProperty.d.ts +0 -47
- package/dist/client/models/ContentTypeProperty.js +0 -2
- package/dist/client/models/ContentTypeUsage.d.ts +0 -7
- package/dist/client/models/ContentTypeUsage.js +0 -15
- package/dist/client/models/CopyContentOptions.d.ts +0 -21
- package/dist/client/models/CopyContentOptions.js +0 -2
- package/dist/client/models/DateTimeListItem.d.ts +0 -14
- package/dist/client/models/DateTimeListItem.js +0 -2
- package/dist/client/models/DateTimeProperty.d.ts +0 -14
- package/dist/client/models/DateTimeProperty.js +0 -2
- package/dist/client/models/DisplaySetting.d.ts +0 -22
- package/dist/client/models/DisplaySetting.js +0 -2
- package/dist/client/models/DisplaySettingChoice.d.ts +0 -13
- package/dist/client/models/DisplaySettingChoice.js +0 -2
- package/dist/client/models/DisplayTemplate.d.ts +0 -49
- package/dist/client/models/DisplayTemplate.js +0 -2
- package/dist/client/models/DisplayTemplatePage.d.ts +0 -19
- package/dist/client/models/DisplayTemplatePage.js +0 -2
- package/dist/client/models/DoubleEnumerationSettings.d.ts +0 -10
- package/dist/client/models/DoubleEnumerationSettings.js +0 -2
- package/dist/client/models/DoubleEnumerationValue.d.ts +0 -13
- package/dist/client/models/DoubleEnumerationValue.js +0 -2
- package/dist/client/models/FloatListItem.d.ts +0 -16
- package/dist/client/models/FloatListItem.js +0 -2
- package/dist/client/models/FloatProperty.d.ts +0 -16
- package/dist/client/models/FloatProperty.js +0 -2
- package/dist/client/models/ImageDescriptor.d.ts +0 -17
- package/dist/client/models/ImageDescriptor.js +0 -2
- package/dist/client/models/IndexingType.d.ts +0 -8
- package/dist/client/models/IndexingType.js +0 -16
- package/dist/client/models/Int32EnumerationSettings.d.ts +0 -10
- package/dist/client/models/Int32EnumerationSettings.js +0 -2
- package/dist/client/models/Int32EnumerationValue.d.ts +0 -13
- package/dist/client/models/Int32EnumerationValue.js +0 -2
- package/dist/client/models/IntegerListItem.d.ts +0 -16
- package/dist/client/models/IntegerListItem.js +0 -2
- package/dist/client/models/IntegerProperty.d.ts +0 -16
- package/dist/client/models/IntegerProperty.js +0 -2
- package/dist/client/models/JsonStringProperty.d.ts +0 -5
- package/dist/client/models/JsonStringProperty.js +0 -2
- package/dist/client/models/ListProperty.d.ts +0 -26
- package/dist/client/models/ListProperty.js +0 -2
- package/dist/client/models/ListPropertyItem.d.ts +0 -11
- package/dist/client/models/ListPropertyItem.js +0 -2
- package/dist/client/models/LocaleStatus.d.ts +0 -7
- package/dist/client/models/LocaleStatus.js +0 -15
- package/dist/client/models/OauthToken.d.ts +0 -18
- package/dist/client/models/OauthToken.js +0 -2
- package/dist/client/models/OauthTokenError.d.ts +0 -13
- package/dist/client/models/OauthTokenError.js +0 -2
- package/dist/client/models/OauthTokenRequest.d.ts +0 -21
- package/dist/client/models/OauthTokenRequest.js +0 -2
- package/dist/client/models/ProblemDetails.d.ts +0 -1
- package/dist/client/models/ProblemDetails.js +0 -2
- package/dist/client/models/PropertyDataType.d.ts +0 -18
- package/dist/client/models/PropertyDataType.js +0 -26
- package/dist/client/models/PropertyFormat.d.ts +0 -37
- package/dist/client/models/PropertyFormat.js +0 -2
- package/dist/client/models/PropertyFormatPage.d.ts +0 -19
- package/dist/client/models/PropertyFormatPage.js +0 -2
- package/dist/client/models/PropertyGroup.d.ts +0 -21
- package/dist/client/models/PropertyGroup.js +0 -2
- package/dist/client/models/PropertyGroupPage.d.ts +0 -19
- package/dist/client/models/PropertyGroupPage.js +0 -2
- package/dist/client/models/StringEnumerationSettings.d.ts +0 -10
- package/dist/client/models/StringEnumerationSettings.js +0 -2
- package/dist/client/models/StringEnumerationValue.d.ts +0 -13
- package/dist/client/models/StringEnumerationValue.js +0 -2
- package/dist/client/models/StringListItem.d.ts +0 -20
- package/dist/client/models/StringListItem.js +0 -2
- package/dist/client/models/StringProperty.d.ts +0 -20
- package/dist/client/models/StringProperty.js +0 -2
- package/dist/client/models/UrlListItem.d.ts +0 -5
- package/dist/client/models/UrlListItem.js +0 -2
- package/dist/client/models/UrlProperty.d.ts +0 -5
- package/dist/client/models/UrlProperty.js +0 -2
- package/dist/client/models/VersionStatus.d.ts +0 -12
- package/dist/client/models/VersionStatus.js +0 -20
- package/dist/client/services/ChangesetsService.d.ts +0 -105
- package/dist/client/services/ChangesetsService.js +0 -239
- package/dist/client/services/ContentService.d.ts +0 -172
- package/dist/client/services/ContentService.js +0 -409
- package/dist/client/services/ContentTypesService.d.ts +0 -66
- package/dist/client/services/ContentTypesService.js +0 -149
- package/dist/client/services/DisplayTemplatesService.d.ts +0 -60
- package/dist/client/services/DisplayTemplatesService.js +0 -135
- package/dist/client/services/OauthService.d.ts +0 -17
- package/dist/client/services/OauthService.js +0 -28
- package/dist/client/services/PropertyFormatsService.d.ts +0 -26
- package/dist/client/services/PropertyFormatsService.js +0 -53
- package/dist/client/services/PropertyGroupsService.d.ts +0 -61
- package/dist/client/services/PropertyGroupsService.js +0 -135
package/README.md
CHANGED
|
@@ -17,13 +17,12 @@ import createClient, { ContentRoots } from '@remkoj/optimizely-cms-integration-a
|
|
|
17
17
|
|
|
18
18
|
// Create an instance of the client
|
|
19
19
|
const client = createClient({
|
|
20
|
-
base: "https://example.com",
|
|
21
20
|
clientId: "apiClientID",
|
|
22
21
|
clientSecret: "apiClientSecret"
|
|
23
22
|
});
|
|
24
23
|
|
|
25
24
|
// Start using client
|
|
26
|
-
client.
|
|
25
|
+
client.preview2ContentList(ContentRoots.SystemRoot).then(response => {
|
|
27
26
|
const items = response.items
|
|
28
27
|
items?.map(item => {
|
|
29
28
|
// Do something with the item
|
|
@@ -38,8 +37,7 @@ The configuration object for the `createClient()` method is optional, if it is o
|
|
|
38
37
|
The following configuration options are available for
|
|
39
38
|
| Environment variable | Configuration key | Required | Usage |
|
|
40
39
|
| --- | --- | --- | --- |
|
|
41
|
-
| OPTIMIZELY_CMS_URL | base |
|
|
40
|
+
| OPTIMIZELY_CMS_URL | base | no | Sets the URL of the Optimizely CMS instance |
|
|
42
41
|
| OPTIMIZELY_CMS_CLIENT_ID | clientId | yes | The API Client ID, as configured within the CMS |
|
|
43
42
|
| OPTIMIZELY_CMS_CLIENT_SECRET | clientSecret | yes | The API Client Secret as generated by the CMS when creating the client |
|
|
44
|
-
| OPTIMIZELY_CMS_USER_ID | actAs | no | The username of the CMS user to impersonate |
|
|
45
|
-
| OPTIMIZELY_CMS_SCHEMA | cmsVersion | no | Override the target Optimizely CMS Version:<br/><br/>`OPTI-CMS-12`: Optimizely CMS 12, With [CMS Service Preview 1](https://nuget.optimizely.com/package/?id=Optimizely.Cms.Preview1.Service) installed and working.<br/><br/>`OPTI-CMS-13`: Optimizely SaaS CMS / CMS 13<br/><br/>**Default:** SaaS CMS / CMS 13 |
|
|
43
|
+
| OPTIMIZELY_CMS_USER_ID | actAs | no | The username of the CMS user to impersonate |
|
package/dist/api-client.d.ts
CHANGED
|
@@ -1,30 +1,62 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Operations from './client/sdk.gen';
|
|
2
|
+
import { createClient, type RequestResult, type ResponseStyle } from './client/client';
|
|
3
|
+
import * as InstanceOperations from './instance.client/sdk.gen';
|
|
4
|
+
import { createClient as createInstanceClient, type RequestResult as InstanceRequestResult, type ResponseStyle as InstanceResponseStyle } from './instance.client/client';
|
|
2
5
|
import { type CmsIntegrationApiOptions } from "./config";
|
|
3
6
|
import { type InstanceApiVersionInfo, OptiCmsVersion } from "./types";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
type OperationsType = {
|
|
8
|
+
-readonly [KT in keyof typeof Operations]: (typeof Operations)[KT];
|
|
9
|
+
};
|
|
10
|
+
type OperationsNames = keyof OperationsType;
|
|
11
|
+
type OperationReturnType<RT extends (...args: any) => any> = ReturnType<RT> extends RequestResult<any, any, boolean, ResponseStyle> ? Promise<NonNullable<Awaited<ReturnType<RT>>['data']>> : never;
|
|
12
|
+
type InstanceOperationsType = {
|
|
13
|
+
-readonly [KT in keyof typeof InstanceOperations]: (typeof InstanceOperations)[KT];
|
|
14
|
+
};
|
|
15
|
+
type InstanceOperationsNames = keyof InstanceOperationsType;
|
|
16
|
+
type InstanceOperationReturnType<RT extends (...args: any) => any> = ReturnType<RT> extends InstanceRequestResult<any, any, boolean, InstanceResponseStyle> ? Promise<NonNullable<Awaited<ReturnType<RT>>['data']>> : never;
|
|
17
|
+
type BaseApiClientFunctions = {
|
|
18
|
+
readonly [KT in OperationsNames]: OperationsType[KT] extends Function ? (options?: Parameters<OperationsType[KT]>[0]) => OperationReturnType<OperationsType[KT]> : never;
|
|
19
|
+
};
|
|
20
|
+
type InstanceClientFunctions = {
|
|
21
|
+
readonly [KT in InstanceOperationsNames as InstanceOperationsType[KT] extends Function ? `preview2${Capitalize<KT>}` : never]: InstanceOperationsType[KT] extends Function ? (options?: Parameters<InstanceOperationsType[KT]>[0]) => InstanceOperationReturnType<InstanceOperationsType[KT]> : never;
|
|
22
|
+
};
|
|
23
|
+
type ApiClientFunctions = BaseApiClientFunctions & InstanceClientFunctions;
|
|
24
|
+
type BaseClass = {
|
|
25
|
+
new (...args: any[]): BaseApiClient;
|
|
26
|
+
};
|
|
27
|
+
type NonConstructorKeys<T> = ({
|
|
28
|
+
[P in keyof T]: T[P] extends new () => any ? never : P;
|
|
29
|
+
})[keyof T];
|
|
30
|
+
type OmitConstructor<TBase extends BaseClass> = Pick<TBase, NonConstructorKeys<TBase>>;
|
|
31
|
+
export type ClassWithMixin<TBase extends BaseClass, Mixin> = OmitConstructor<TBase> & {
|
|
32
|
+
new (...args: ConstructorParameters<TBase>): InstanceType<TBase> & Mixin;
|
|
33
|
+
};
|
|
34
|
+
declare class BaseApiClient {
|
|
35
|
+
protected _config: CmsIntegrationApiOptions;
|
|
36
|
+
protected _client: ReturnType<typeof createClient>;
|
|
37
|
+
protected _instanceClient: ReturnType<typeof createInstanceClient>;
|
|
12
38
|
constructor(config?: CmsIntegrationApiOptions);
|
|
13
39
|
/**
|
|
14
40
|
* Get the runtime configuration of the target CMS version.
|
|
15
41
|
*
|
|
16
42
|
* If this differs from the cmsVersion the client may not work fully or not
|
|
17
43
|
* at all.
|
|
44
|
+
*
|
|
45
|
+
* @deprecated This is based on the OPTIMIZELY_CMS_SCHEMA environment that is ignored by API client
|
|
18
46
|
*/
|
|
19
47
|
get runtimeCmsVersion(): OptiCmsVersion;
|
|
20
48
|
/**
|
|
21
49
|
* The URL of the CMS instance
|
|
22
50
|
*/
|
|
23
|
-
get cmsUrl(): URL;
|
|
51
|
+
get cmsUrl(): URL | undefined;
|
|
24
52
|
/**
|
|
25
53
|
* Marker to indicate if the client has debugging enabled
|
|
26
54
|
*/
|
|
27
55
|
get debug(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Detect the API Version from the URL, returning the runtime version. When
|
|
58
|
+
* this version differs from the `apiVersion` property errors can be expected.
|
|
59
|
+
*/
|
|
28
60
|
get version(): string;
|
|
29
61
|
/**
|
|
30
62
|
* The API version for which this client was build
|
|
@@ -39,5 +71,32 @@ export declare class ApiClient extends CmsIntegrationApiClient {
|
|
|
39
71
|
*
|
|
40
72
|
* @returns The version information from the running instance
|
|
41
73
|
*/
|
|
42
|
-
getInstanceInfo():
|
|
74
|
+
getInstanceInfo(): Promise<InstanceApiVersionInfo>;
|
|
75
|
+
getOpenApiSpec(): Promise<any>;
|
|
76
|
+
getSchemaItemBase(): URL | undefined;
|
|
77
|
+
}
|
|
78
|
+
export declare class ApiError extends Error {
|
|
79
|
+
protected _ctx: {
|
|
80
|
+
error: unknown;
|
|
81
|
+
request: Request;
|
|
82
|
+
response: Response;
|
|
83
|
+
};
|
|
84
|
+
constructor(data: {
|
|
85
|
+
error: unknown;
|
|
86
|
+
request: Request;
|
|
87
|
+
response: Response;
|
|
88
|
+
});
|
|
89
|
+
get data(): unknown;
|
|
90
|
+
/**
|
|
91
|
+
* @deprecated use data() instead
|
|
92
|
+
*/
|
|
93
|
+
get body(): unknown;
|
|
94
|
+
get request(): unknown;
|
|
95
|
+
get response(): unknown;
|
|
96
|
+
get status(): number;
|
|
97
|
+
get statusText(): string;
|
|
43
98
|
}
|
|
99
|
+
export declare const ApiClient: ClassWithMixin<typeof BaseApiClient, ApiClientFunctions>;
|
|
100
|
+
export type ApiClientStatic = typeof ApiClient;
|
|
101
|
+
export type CmsIntegrationApiClient = InstanceType<typeof ApiClient>;
|
|
102
|
+
export default ApiClient;
|
package/dist/api-client.js
CHANGED
|
@@ -1,64 +1,159 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
5
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ApiClient = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
39
|
+
exports.ApiClient = exports.ApiError = void 0;
|
|
40
|
+
const Operations = __importStar(require("./client/sdk.gen"));
|
|
41
|
+
const client_1 = require("./client/client");
|
|
42
|
+
const InstanceOperations = __importStar(require("./instance.client/sdk.gen"));
|
|
43
|
+
const client_2 = require("./instance.client/client");
|
|
9
44
|
const config_1 = require("./config");
|
|
10
45
|
const types_1 = require("./types");
|
|
46
|
+
const client_config_1 = require("./client-config");
|
|
11
47
|
const version_json_1 = __importDefault(require("./version.json"));
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
48
|
+
function applyOperations(Base) {
|
|
49
|
+
// Create the new class
|
|
50
|
+
class NewClass extends Base {
|
|
51
|
+
constructor(...args) {
|
|
52
|
+
super(...args);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// Bind the operations
|
|
56
|
+
Object.getOwnPropertyNames(Operations).filter(isApiClientFunction).forEach(propName => {
|
|
57
|
+
async function wrapper(args) {
|
|
58
|
+
const operationArgs = {
|
|
59
|
+
throwOnError: false,
|
|
60
|
+
...args,
|
|
61
|
+
//@ts-expect-error
|
|
62
|
+
client: this._client
|
|
63
|
+
};
|
|
64
|
+
//@ts-expect-error
|
|
65
|
+
const result = await Operations[propName](operationArgs);
|
|
66
|
+
if (result.data)
|
|
67
|
+
return result.data;
|
|
68
|
+
throw new ApiError(result);
|
|
69
|
+
}
|
|
70
|
+
//@ts-expect-error
|
|
71
|
+
NewClass.prototype[propName] = wrapper;
|
|
72
|
+
});
|
|
73
|
+
// Bind the older Preview2 operations
|
|
74
|
+
Object.getOwnPropertyNames(InstanceOperations).filter(isInstanceClientFunction).forEach(propName => {
|
|
75
|
+
async function wrapper(args) {
|
|
76
|
+
const operationArgs = {
|
|
77
|
+
throwOnError: false,
|
|
78
|
+
...args,
|
|
79
|
+
//@ts-expect-error
|
|
80
|
+
client: this._instanceClient
|
|
81
|
+
};
|
|
82
|
+
//@ts-expect-error
|
|
83
|
+
const result = await InstanceOperations[propName](operationArgs);
|
|
84
|
+
if (result.data)
|
|
85
|
+
return result.data;
|
|
86
|
+
throw new ApiError(result);
|
|
87
|
+
}
|
|
88
|
+
const fnName = `preview2${toCapitalized(propName)}`;
|
|
89
|
+
//@ts-expect-error
|
|
90
|
+
NewClass.prototype[fnName] = wrapper;
|
|
91
|
+
});
|
|
92
|
+
// Return the new class
|
|
93
|
+
return NewClass;
|
|
94
|
+
}
|
|
95
|
+
function toCapitalized(toCapitalize) {
|
|
96
|
+
return (toCapitalize.substring(0, 1).toUpperCase() + toCapitalize.substring(1));
|
|
97
|
+
}
|
|
98
|
+
function createIsFunctionValidator(baseType) {
|
|
99
|
+
return (propName) => {
|
|
100
|
+
return typeof (baseType[propName]) == 'function';
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
const isApiClientFunction = createIsFunctionValidator(Operations);
|
|
104
|
+
const isInstanceClientFunction = createIsFunctionValidator(InstanceOperations);
|
|
105
|
+
class BaseApiClient {
|
|
106
|
+
_config;
|
|
107
|
+
_client;
|
|
108
|
+
_instanceClient;
|
|
19
109
|
constructor(config) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
110
|
+
// Store instance variables
|
|
111
|
+
this._config = config ?? (0, config_1.readEnvConfig)();
|
|
112
|
+
this._client = (0, client_1.createClient)((0, client_config_1.createClientConfig)((0, client_1.createConfig)({
|
|
113
|
+
baseUrl: 'https://api.cms.optimizely.com/preview3'
|
|
114
|
+
}), this._config));
|
|
115
|
+
this._instanceClient = (0, client_2.createClient)((0, client_config_1.createClientConfig)((0, client_2.createConfig)({
|
|
116
|
+
baseUrl: new URL('/_cms/preview2', this._config.base).href
|
|
117
|
+
})));
|
|
118
|
+
// Configure Client
|
|
119
|
+
if (this._config.debug) {
|
|
120
|
+
this._client.interceptors.request.use(async (request) => {
|
|
121
|
+
console.log(`🔍 [CMS API] Sending ${request.method} request to ${request.url}`);
|
|
122
|
+
return request;
|
|
123
|
+
});
|
|
124
|
+
this._client.interceptors.response.use((response, request) => {
|
|
125
|
+
console.log(`✨ [CMS API] Received response ${response.status} ${response.statusText} of type ${response.headers.get('Content-Type') ?? 'unknown'} for ${request.url}`);
|
|
126
|
+
return response;
|
|
127
|
+
});
|
|
128
|
+
this._instanceClient.interceptors.request.use(async (request) => {
|
|
129
|
+
console.log(`🔍 [CMS API] Sending ${request.method} request to ${request.url}`);
|
|
130
|
+
return request;
|
|
131
|
+
});
|
|
132
|
+
this._instanceClient.interceptors.response.use((response, request) => {
|
|
133
|
+
console.log(`✨ [CMS API] Received response ${response.status} ${response.statusText} of type ${response.headers.get('Content-Type') ?? 'unknown'} for ${request.url}`);
|
|
134
|
+
return response;
|
|
135
|
+
});
|
|
136
|
+
}
|
|
47
137
|
}
|
|
48
138
|
/**
|
|
49
139
|
* Get the runtime configuration of the target CMS version.
|
|
50
140
|
*
|
|
51
141
|
* If this differs from the cmsVersion the client may not work fully or not
|
|
52
142
|
* at all.
|
|
143
|
+
*
|
|
144
|
+
* @deprecated This is based on the OPTIMIZELY_CMS_SCHEMA environment that is ignored by API client
|
|
53
145
|
*/
|
|
54
146
|
get runtimeCmsVersion() {
|
|
55
|
-
return this._config.cmsVersion ?? types_1.OptiCmsVersion.
|
|
147
|
+
return this._config.cmsVersion ?? types_1.OptiCmsVersion.CMSSAAS;
|
|
56
148
|
}
|
|
57
149
|
/**
|
|
58
150
|
* The URL of the CMS instance
|
|
59
151
|
*/
|
|
60
152
|
get cmsUrl() {
|
|
61
|
-
|
|
153
|
+
if (this._config.base)
|
|
154
|
+
return this._config.base;
|
|
155
|
+
const baseUrl = this._client.getConfig().baseUrl;
|
|
156
|
+
return baseUrl ? new URL(baseUrl) : undefined;
|
|
62
157
|
}
|
|
63
158
|
/**
|
|
64
159
|
* Marker to indicate if the client has debugging enabled
|
|
@@ -66,8 +161,14 @@ class ApiClient extends client_1.CmsIntegrationApiClient {
|
|
|
66
161
|
get debug() {
|
|
67
162
|
return this._config.debug ?? false;
|
|
68
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Detect the API Version from the URL, returning the runtime version. When
|
|
166
|
+
* this version differs from the `apiVersion` property errors can be expected.
|
|
167
|
+
*/
|
|
69
168
|
get version() {
|
|
70
|
-
|
|
169
|
+
const baseUrl = this._client.getConfig().baseUrl;
|
|
170
|
+
const detectedVersion = baseUrl?.match(/^https{0,1}:\/\/.+?\/(_cms\/){0,1}([a-z0-9\.]+)(\/|$)/)?.at(2);
|
|
171
|
+
return detectedVersion || "";
|
|
71
172
|
}
|
|
72
173
|
/**
|
|
73
174
|
* The API version for which this client was build
|
|
@@ -86,14 +187,73 @@ class ApiClient extends client_1.CmsIntegrationApiClient {
|
|
|
86
187
|
*
|
|
87
188
|
* @returns The version information from the running instance
|
|
88
189
|
*/
|
|
89
|
-
getInstanceInfo() {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
},
|
|
190
|
+
async getInstanceInfo() {
|
|
191
|
+
const result = await this._client.get({
|
|
192
|
+
url: '/info'
|
|
193
|
+
});
|
|
194
|
+
const instanceResult = await this._instanceClient.get({
|
|
195
|
+
url: '/info'
|
|
96
196
|
});
|
|
197
|
+
if (result.data) {
|
|
198
|
+
const data = result.data;
|
|
199
|
+
data.baseUrl = this._client.getConfig().baseUrl;
|
|
200
|
+
data.results = {
|
|
201
|
+
preview2Data: {
|
|
202
|
+
baseUrl: this._instanceClient.getConfig().baseUrl,
|
|
203
|
+
...instanceResult?.data ?? {}
|
|
204
|
+
},
|
|
205
|
+
...data.results,
|
|
206
|
+
};
|
|
207
|
+
return data;
|
|
208
|
+
}
|
|
209
|
+
throw new ApiError(result);
|
|
210
|
+
}
|
|
211
|
+
async getOpenApiSpec() {
|
|
212
|
+
const result = await this._client.get({
|
|
213
|
+
url: '/docs/content-openapi.json',
|
|
214
|
+
});
|
|
215
|
+
if (result.data)
|
|
216
|
+
return result.data;
|
|
217
|
+
throw new ApiError(result);
|
|
218
|
+
}
|
|
219
|
+
getSchemaItemBase() {
|
|
220
|
+
let baseUrl = this._client.getConfig().baseUrl;
|
|
221
|
+
if (typeof (baseUrl) === 'string' && !baseUrl.endsWith('/'))
|
|
222
|
+
baseUrl = baseUrl + '/';
|
|
223
|
+
return baseUrl ? new URL(baseUrl) : undefined;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
class ApiError extends Error {
|
|
227
|
+
_ctx;
|
|
228
|
+
constructor(data) {
|
|
229
|
+
if (typeof data.error == 'string')
|
|
230
|
+
super(data.error);
|
|
231
|
+
else
|
|
232
|
+
super(`Optimizely CMS API Error: ${data.response.status} ${data.response.statusText}`);
|
|
233
|
+
this._ctx = data;
|
|
234
|
+
}
|
|
235
|
+
get data() {
|
|
236
|
+
return this._ctx.error;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* @deprecated use data() instead
|
|
240
|
+
*/
|
|
241
|
+
get body() {
|
|
242
|
+
return this._ctx.error;
|
|
243
|
+
}
|
|
244
|
+
get request() {
|
|
245
|
+
return this._ctx.request;
|
|
246
|
+
}
|
|
247
|
+
get response() {
|
|
248
|
+
return this._ctx.response;
|
|
249
|
+
}
|
|
250
|
+
get status() {
|
|
251
|
+
return this._ctx.response.status;
|
|
252
|
+
}
|
|
253
|
+
get statusText() {
|
|
254
|
+
return this._ctx.response.statusText;
|
|
97
255
|
}
|
|
98
256
|
}
|
|
99
|
-
exports.
|
|
257
|
+
exports.ApiError = ApiError;
|
|
258
|
+
exports.ApiClient = applyOperations(BaseApiClient);
|
|
259
|
+
exports.default = exports.ApiClient;
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.createClient = void 0;
|
|
5
|
+
const serverSentEvents_gen_1 = require("../core/serverSentEvents.gen");
|
|
6
|
+
const utils_gen_1 = require("../core/utils.gen");
|
|
7
|
+
const utils_gen_2 = require("./utils.gen");
|
|
8
|
+
const createClient = (config = {}) => {
|
|
9
|
+
let _config = (0, utils_gen_2.mergeConfigs)((0, utils_gen_2.createConfig)(), config);
|
|
10
|
+
const getConfig = () => ({ ..._config });
|
|
11
|
+
const setConfig = (config) => {
|
|
12
|
+
_config = (0, utils_gen_2.mergeConfigs)(_config, config);
|
|
13
|
+
return getConfig();
|
|
14
|
+
};
|
|
15
|
+
const interceptors = (0, utils_gen_2.createInterceptors)();
|
|
16
|
+
const beforeRequest = async (options) => {
|
|
17
|
+
const opts = {
|
|
18
|
+
..._config,
|
|
19
|
+
...options,
|
|
20
|
+
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
21
|
+
headers: (0, utils_gen_2.mergeHeaders)(_config.headers, options.headers),
|
|
22
|
+
serializedBody: undefined,
|
|
23
|
+
};
|
|
24
|
+
if (opts.security) {
|
|
25
|
+
await (0, utils_gen_2.setAuthParams)({
|
|
26
|
+
...opts,
|
|
27
|
+
security: opts.security,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
if (opts.requestValidator) {
|
|
31
|
+
await opts.requestValidator(opts);
|
|
32
|
+
}
|
|
33
|
+
if (opts.body !== undefined && opts.bodySerializer) {
|
|
34
|
+
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
35
|
+
}
|
|
36
|
+
// remove Content-Type header if body is empty to avoid sending invalid requests
|
|
37
|
+
if (opts.body === undefined || opts.serializedBody === '') {
|
|
38
|
+
opts.headers.delete('Content-Type');
|
|
39
|
+
}
|
|
40
|
+
const url = (0, utils_gen_2.buildUrl)(opts);
|
|
41
|
+
return { opts, url };
|
|
42
|
+
};
|
|
43
|
+
const request = async (options) => {
|
|
44
|
+
// @ts-expect-error
|
|
45
|
+
const { opts, url } = await beforeRequest(options);
|
|
46
|
+
const requestInit = {
|
|
47
|
+
redirect: 'follow',
|
|
48
|
+
...opts,
|
|
49
|
+
body: (0, utils_gen_1.getValidRequestBody)(opts),
|
|
50
|
+
};
|
|
51
|
+
let request = new Request(url, requestInit);
|
|
52
|
+
for (const fn of interceptors.request.fns) {
|
|
53
|
+
if (fn) {
|
|
54
|
+
request = await fn(request, opts);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// fetch must be assigned here, otherwise it would throw the error:
|
|
58
|
+
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
|
|
59
|
+
const _fetch = opts.fetch;
|
|
60
|
+
let response = await _fetch(request);
|
|
61
|
+
for (const fn of interceptors.response.fns) {
|
|
62
|
+
if (fn) {
|
|
63
|
+
response = await fn(response, request, opts);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const result = {
|
|
67
|
+
request,
|
|
68
|
+
response,
|
|
69
|
+
};
|
|
70
|
+
if (response.ok) {
|
|
71
|
+
const parseAs = (opts.parseAs === 'auto'
|
|
72
|
+
? (0, utils_gen_2.getParseAs)(response.headers.get('Content-Type'))
|
|
73
|
+
: opts.parseAs) ?? 'json';
|
|
74
|
+
if (response.status === 204 ||
|
|
75
|
+
response.headers.get('Content-Length') === '0') {
|
|
76
|
+
let emptyData;
|
|
77
|
+
switch (parseAs) {
|
|
78
|
+
case 'arrayBuffer':
|
|
79
|
+
case 'blob':
|
|
80
|
+
case 'text':
|
|
81
|
+
emptyData = await response[parseAs]();
|
|
82
|
+
break;
|
|
83
|
+
case 'formData':
|
|
84
|
+
emptyData = new FormData();
|
|
85
|
+
break;
|
|
86
|
+
case 'stream':
|
|
87
|
+
emptyData = response.body;
|
|
88
|
+
break;
|
|
89
|
+
case 'json':
|
|
90
|
+
default:
|
|
91
|
+
emptyData = {};
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
return opts.responseStyle === 'data'
|
|
95
|
+
? emptyData
|
|
96
|
+
: {
|
|
97
|
+
data: emptyData,
|
|
98
|
+
...result,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
let data;
|
|
102
|
+
switch (parseAs) {
|
|
103
|
+
case 'arrayBuffer':
|
|
104
|
+
case 'blob':
|
|
105
|
+
case 'formData':
|
|
106
|
+
case 'json':
|
|
107
|
+
case 'text':
|
|
108
|
+
data = await response[parseAs]();
|
|
109
|
+
break;
|
|
110
|
+
case 'stream':
|
|
111
|
+
return opts.responseStyle === 'data'
|
|
112
|
+
? response.body
|
|
113
|
+
: {
|
|
114
|
+
data: response.body,
|
|
115
|
+
...result,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
if (parseAs === 'json') {
|
|
119
|
+
if (opts.responseValidator) {
|
|
120
|
+
await opts.responseValidator(data);
|
|
121
|
+
}
|
|
122
|
+
if (opts.responseTransformer) {
|
|
123
|
+
data = await opts.responseTransformer(data);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return opts.responseStyle === 'data'
|
|
127
|
+
? data
|
|
128
|
+
: {
|
|
129
|
+
data,
|
|
130
|
+
...result,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const textError = await response.text();
|
|
134
|
+
let jsonError;
|
|
135
|
+
try {
|
|
136
|
+
jsonError = JSON.parse(textError);
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
// noop
|
|
140
|
+
}
|
|
141
|
+
const error = jsonError ?? textError;
|
|
142
|
+
let finalError = error;
|
|
143
|
+
for (const fn of interceptors.error.fns) {
|
|
144
|
+
if (fn) {
|
|
145
|
+
finalError = (await fn(error, response, request, opts));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
finalError = finalError || {};
|
|
149
|
+
if (opts.throwOnError) {
|
|
150
|
+
throw finalError;
|
|
151
|
+
}
|
|
152
|
+
// TODO: we probably want to return error and improve types
|
|
153
|
+
return opts.responseStyle === 'data'
|
|
154
|
+
? undefined
|
|
155
|
+
: {
|
|
156
|
+
error: finalError,
|
|
157
|
+
...result,
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
const makeMethodFn = (method) => (options) => request({ ...options, method });
|
|
161
|
+
const makeSseFn = (method) => async (options) => {
|
|
162
|
+
const { opts, url } = await beforeRequest(options);
|
|
163
|
+
return (0, serverSentEvents_gen_1.createSseClient)({
|
|
164
|
+
...opts,
|
|
165
|
+
body: opts.body,
|
|
166
|
+
headers: opts.headers,
|
|
167
|
+
method,
|
|
168
|
+
onRequest: async (url, init) => {
|
|
169
|
+
let request = new Request(url, init);
|
|
170
|
+
for (const fn of interceptors.request.fns) {
|
|
171
|
+
if (fn) {
|
|
172
|
+
request = await fn(request, opts);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return request;
|
|
176
|
+
},
|
|
177
|
+
url,
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
return {
|
|
181
|
+
buildUrl: utils_gen_2.buildUrl,
|
|
182
|
+
connect: makeMethodFn('CONNECT'),
|
|
183
|
+
delete: makeMethodFn('DELETE'),
|
|
184
|
+
get: makeMethodFn('GET'),
|
|
185
|
+
getConfig,
|
|
186
|
+
head: makeMethodFn('HEAD'),
|
|
187
|
+
interceptors,
|
|
188
|
+
options: makeMethodFn('OPTIONS'),
|
|
189
|
+
patch: makeMethodFn('PATCH'),
|
|
190
|
+
post: makeMethodFn('POST'),
|
|
191
|
+
put: makeMethodFn('PUT'),
|
|
192
|
+
request,
|
|
193
|
+
setConfig,
|
|
194
|
+
sse: {
|
|
195
|
+
connect: makeSseFn('CONNECT'),
|
|
196
|
+
delete: makeSseFn('DELETE'),
|
|
197
|
+
get: makeSseFn('GET'),
|
|
198
|
+
head: makeSseFn('HEAD'),
|
|
199
|
+
options: makeSseFn('OPTIONS'),
|
|
200
|
+
patch: makeSseFn('PATCH'),
|
|
201
|
+
post: makeSseFn('POST'),
|
|
202
|
+
put: makeSseFn('PUT'),
|
|
203
|
+
trace: makeSseFn('TRACE'),
|
|
204
|
+
},
|
|
205
|
+
trace: makeMethodFn('TRACE'),
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
exports.createClient = createClient;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { Auth } from '../core/auth.gen';
|
|
2
|
+
export type { QuerySerializerOptions } from '../core/bodySerializer.gen';
|
|
3
|
+
export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, } from '../core/bodySerializer.gen';
|
|
4
|
+
export { buildClientParams } from '../core/params.gen';
|
|
5
|
+
export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen';
|
|
6
|
+
export { createClient } from './client.gen';
|
|
7
|
+
export type { Client, ClientOptions, Config, CreateClientConfig, Options, OptionsLegacyParser, RequestOptions, RequestResult, ResolvedRequestOptions, ResponseStyle, TDataShape, } from './types.gen';
|
|
8
|
+
export { createConfig, mergeHeaders } from './utils.gen';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.mergeHeaders = exports.createConfig = exports.createClient = exports.serializeQueryKeyValue = exports.buildClientParams = exports.urlSearchParamsBodySerializer = exports.jsonBodySerializer = exports.formDataBodySerializer = void 0;
|
|
5
|
+
var bodySerializer_gen_1 = require("../core/bodySerializer.gen");
|
|
6
|
+
Object.defineProperty(exports, "formDataBodySerializer", { enumerable: true, get: function () { return bodySerializer_gen_1.formDataBodySerializer; } });
|
|
7
|
+
Object.defineProperty(exports, "jsonBodySerializer", { enumerable: true, get: function () { return bodySerializer_gen_1.jsonBodySerializer; } });
|
|
8
|
+
Object.defineProperty(exports, "urlSearchParamsBodySerializer", { enumerable: true, get: function () { return bodySerializer_gen_1.urlSearchParamsBodySerializer; } });
|
|
9
|
+
var params_gen_1 = require("../core/params.gen");
|
|
10
|
+
Object.defineProperty(exports, "buildClientParams", { enumerable: true, get: function () { return params_gen_1.buildClientParams; } });
|
|
11
|
+
var queryKeySerializer_gen_1 = require("../core/queryKeySerializer.gen");
|
|
12
|
+
Object.defineProperty(exports, "serializeQueryKeyValue", { enumerable: true, get: function () { return queryKeySerializer_gen_1.serializeQueryKeyValue; } });
|
|
13
|
+
var client_gen_1 = require("./client.gen");
|
|
14
|
+
Object.defineProperty(exports, "createClient", { enumerable: true, get: function () { return client_gen_1.createClient; } });
|
|
15
|
+
var utils_gen_1 = require("./utils.gen");
|
|
16
|
+
Object.defineProperty(exports, "createConfig", { enumerable: true, get: function () { return utils_gen_1.createConfig; } });
|
|
17
|
+
Object.defineProperty(exports, "mergeHeaders", { enumerable: true, get: function () { return utils_gen_1.mergeHeaders; } });
|