@remkoj/optimizely-cms-api 2.0.0-pre4 → 2.0.0-pre5

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.
Files changed (182) hide show
  1. package/dist/api-client.d.ts +35 -0
  2. package/dist/api-client.js +67 -0
  3. package/dist/client/CmsIntegrationApiClient.d.ts +24 -24
  4. package/dist/client/CmsIntegrationApiClient.js +36 -36
  5. package/dist/client/core/ApiError.d.ts +10 -10
  6. package/dist/client/core/ApiError.js +15 -15
  7. package/dist/client/core/ApiRequestOptions.d.ts +13 -13
  8. package/dist/client/core/ApiRequestOptions.js +2 -2
  9. package/dist/client/core/ApiResult.d.ts +7 -7
  10. package/dist/client/core/ApiResult.js +2 -2
  11. package/dist/client/core/BaseHttpRequest.d.ts +8 -8
  12. package/dist/client/core/BaseHttpRequest.js +9 -9
  13. package/dist/client/core/CancelablePromise.d.ts +20 -20
  14. package/dist/client/core/CancelablePromise.js +116 -116
  15. package/dist/client/core/FetchHttpRequest.d.ts +14 -14
  16. package/dist/client/core/FetchHttpRequest.js +20 -20
  17. package/dist/client/core/OpenAPI.d.ts +16 -16
  18. package/dist/client/core/OpenAPI.js +14 -14
  19. package/dist/client/core/request.d.ts +30 -30
  20. package/dist/client/core/request.js +294 -294
  21. package/dist/client/index.d.ts +81 -81
  22. package/dist/client/index.js +48 -48
  23. package/dist/client/models/BinaryProperty.d.ts +8 -8
  24. package/dist/client/models/BinaryProperty.js +2 -2
  25. package/dist/client/models/BooleanProperty.d.ts +5 -5
  26. package/dist/client/models/BooleanProperty.js +2 -2
  27. package/dist/client/models/Changeset.d.ts +26 -26
  28. package/dist/client/models/Changeset.js +2 -2
  29. package/dist/client/models/ChangesetItem.d.ts +11 -11
  30. package/dist/client/models/ChangesetItem.js +2 -2
  31. package/dist/client/models/ChangesetItemPage.d.ts +19 -19
  32. package/dist/client/models/ChangesetItemPage.js +2 -2
  33. package/dist/client/models/ChangesetPage.d.ts +19 -19
  34. package/dist/client/models/ChangesetPage.js +2 -2
  35. package/dist/client/models/ComponentListItem.d.ts +7 -10
  36. package/dist/client/models/ComponentListItem.js +2 -2
  37. package/dist/client/models/ComponentProperty.d.ts +7 -10
  38. package/dist/client/models/ComponentProperty.js +2 -2
  39. package/dist/client/models/ContentBaseType.d.ts +11 -11
  40. package/dist/client/models/ContentBaseType.js +19 -19
  41. package/dist/client/models/ContentComponent.d.ts +34 -34
  42. package/dist/client/models/ContentComponent.js +2 -2
  43. package/dist/client/models/ContentItem.d.ts +60 -60
  44. package/dist/client/models/ContentItem.js +2 -2
  45. package/dist/client/models/ContentItemListWithContentTypes.d.ts +27 -27
  46. package/dist/client/models/ContentItemListWithContentTypes.js +2 -2
  47. package/dist/client/models/ContentItemPage.d.ts +19 -19
  48. package/dist/client/models/ContentItemPage.js +2 -2
  49. package/dist/client/models/ContentItemWithContentTypes.d.ts +12 -12
  50. package/dist/client/models/ContentItemWithContentTypes.js +2 -2
  51. package/dist/client/models/ContentListItem.d.ts +8 -14
  52. package/dist/client/models/ContentListItem.js +2 -2
  53. package/dist/client/models/ContentLocaleInfo.d.ts +19 -11
  54. package/dist/client/models/ContentLocaleInfo.js +2 -2
  55. package/dist/client/models/ContentMetadata.d.ts +38 -46
  56. package/dist/client/models/ContentMetadata.js +2 -2
  57. package/dist/client/models/ContentMetadataPage.d.ts +19 -19
  58. package/dist/client/models/ContentMetadataPage.js +2 -2
  59. package/dist/client/models/ContentProperty.d.ts +8 -14
  60. package/dist/client/models/ContentProperty.js +2 -2
  61. package/dist/client/models/ContentReference.d.ts +17 -17
  62. package/dist/client/models/ContentReference.js +2 -2
  63. package/dist/client/models/ContentReferenceListItem.d.ts +8 -14
  64. package/dist/client/models/ContentReferenceListItem.js +2 -2
  65. package/dist/client/models/ContentReferenceProperty.d.ts +8 -14
  66. package/dist/client/models/ContentReferenceProperty.js +2 -2
  67. package/dist/client/models/ContentType.d.ts +79 -79
  68. package/dist/client/models/ContentType.js +2 -2
  69. package/dist/client/models/ContentTypeFeature.d.ts +10 -10
  70. package/dist/client/models/ContentTypeFeature.js +18 -18
  71. package/dist/client/models/ContentTypePage.d.ts +19 -19
  72. package/dist/client/models/ContentTypePage.js +2 -2
  73. package/dist/client/models/ContentTypeProperty.d.ts +47 -47
  74. package/dist/client/models/ContentTypeProperty.js +2 -2
  75. package/dist/client/models/ContentTypeUsage.d.ts +7 -7
  76. package/dist/client/models/ContentTypeUsage.js +15 -15
  77. package/dist/client/models/CopyContentOptions.d.ts +21 -21
  78. package/dist/client/models/CopyContentOptions.js +2 -2
  79. package/dist/client/models/DateTimeListItem.d.ts +8 -14
  80. package/dist/client/models/DateTimeListItem.js +2 -2
  81. package/dist/client/models/DateTimeProperty.d.ts +8 -14
  82. package/dist/client/models/DateTimeProperty.js +2 -2
  83. package/dist/client/models/DisplaySetting.d.ts +22 -22
  84. package/dist/client/models/DisplaySetting.js +2 -2
  85. package/dist/client/models/DisplaySettingChoice.d.ts +13 -13
  86. package/dist/client/models/DisplaySettingChoice.js +2 -2
  87. package/dist/client/models/DisplayTemplate.d.ts +49 -49
  88. package/dist/client/models/DisplayTemplate.js +2 -2
  89. package/dist/client/models/DisplayTemplatePage.d.ts +19 -19
  90. package/dist/client/models/DisplayTemplatePage.js +2 -2
  91. package/dist/client/models/DoubleEnumerationSettings.d.ts +9 -9
  92. package/dist/client/models/DoubleEnumerationSettings.js +2 -2
  93. package/dist/client/models/FloatListItem.d.ts +10 -16
  94. package/dist/client/models/FloatListItem.js +2 -2
  95. package/dist/client/models/FloatProperty.d.ts +10 -16
  96. package/dist/client/models/FloatProperty.js +2 -2
  97. package/dist/client/models/ImageDescriptor.d.ts +17 -17
  98. package/dist/client/models/ImageDescriptor.js +2 -2
  99. package/dist/client/models/ImportPackageMessage.d.ts +17 -17
  100. package/dist/client/models/ImportPackageMessage.js +2 -2
  101. package/dist/client/models/ImportPackageResult.d.ts +22 -22
  102. package/dist/client/models/ImportPackageResult.js +2 -2
  103. package/dist/client/models/IndexingType.d.ts +8 -8
  104. package/dist/client/models/IndexingType.js +16 -16
  105. package/dist/client/models/Int32EnumerationSettings.d.ts +9 -9
  106. package/dist/client/models/Int32EnumerationSettings.js +2 -2
  107. package/dist/client/models/IntegerListItem.d.ts +10 -16
  108. package/dist/client/models/IntegerListItem.js +2 -2
  109. package/dist/client/models/IntegerProperty.d.ts +10 -16
  110. package/dist/client/models/IntegerProperty.js +2 -2
  111. package/dist/client/models/JsonStringProperty.d.ts +5 -5
  112. package/dist/client/models/JsonStringProperty.js +2 -2
  113. package/dist/client/models/ListProperty.d.ts +26 -26
  114. package/dist/client/models/ListProperty.js +2 -2
  115. package/dist/client/models/ListPropertyItem.d.ts +11 -11
  116. package/dist/client/models/ListPropertyItem.js +2 -2
  117. package/dist/client/models/LocaleStatus.d.ts +7 -7
  118. package/dist/client/models/LocaleStatus.js +15 -15
  119. package/dist/client/models/Manifest.d.ts +24 -24
  120. package/dist/client/models/Manifest.js +2 -2
  121. package/dist/client/models/OauthToken.d.ts +18 -18
  122. package/dist/client/models/OauthToken.js +2 -2
  123. package/dist/client/models/OauthTokenError.d.ts +13 -13
  124. package/dist/client/models/OauthTokenError.js +2 -2
  125. package/dist/client/models/OauthTokenRequest.d.ts +21 -21
  126. package/dist/client/models/OauthTokenRequest.js +2 -2
  127. package/dist/client/models/PackageJob.d.ts +28 -28
  128. package/dist/client/models/PackageJob.js +2 -2
  129. package/dist/client/models/PackageJobMessage.d.ts +17 -17
  130. package/dist/client/models/PackageJobMessage.js +2 -2
  131. package/dist/client/models/PackageJobStatus.d.ts +4 -4
  132. package/dist/client/models/PackageJobStatus.js +2 -2
  133. package/dist/client/models/ProblemDetails.d.ts +1 -1
  134. package/dist/client/models/ProblemDetails.js +2 -2
  135. package/dist/client/models/PropertyDataType.d.ts +18 -18
  136. package/dist/client/models/PropertyDataType.js +26 -26
  137. package/dist/client/models/PropertyFormat.d.ts +34 -34
  138. package/dist/client/models/PropertyFormat.js +2 -2
  139. package/dist/client/models/PropertyFormatPage.d.ts +19 -19
  140. package/dist/client/models/PropertyFormatPage.js +2 -2
  141. package/dist/client/models/PropertyGroup.d.ts +21 -21
  142. package/dist/client/models/PropertyGroup.js +2 -2
  143. package/dist/client/models/PropertyGroupPage.d.ts +19 -19
  144. package/dist/client/models/PropertyGroupPage.js +2 -2
  145. package/dist/client/models/StringEnumerationSettings.d.ts +9 -9
  146. package/dist/client/models/StringEnumerationSettings.js +2 -2
  147. package/dist/client/models/StringListItem.d.ts +11 -14
  148. package/dist/client/models/StringListItem.js +2 -2
  149. package/dist/client/models/StringProperty.d.ts +11 -14
  150. package/dist/client/models/StringProperty.js +2 -2
  151. package/dist/client/models/UrlListItem.d.ts +5 -5
  152. package/dist/client/models/UrlListItem.js +2 -2
  153. package/dist/client/models/UrlProperty.d.ts +5 -5
  154. package/dist/client/models/UrlProperty.js +2 -2
  155. package/dist/client/models/VersionStatus.d.ts +12 -12
  156. package/dist/client/models/VersionStatus.js +20 -20
  157. package/dist/client/services/ChangesetsService.d.ts +105 -105
  158. package/dist/client/services/ChangesetsService.js +239 -239
  159. package/dist/client/services/ContentService.d.ts +172 -172
  160. package/dist/client/services/ContentService.js +409 -409
  161. package/dist/client/services/ContentTypesService.d.ts +66 -66
  162. package/dist/client/services/ContentTypesService.js +149 -149
  163. package/dist/client/services/DisplayTemplatesService.d.ts +60 -60
  164. package/dist/client/services/DisplayTemplatesService.js +135 -135
  165. package/dist/client/services/OauthService.d.ts +17 -17
  166. package/dist/client/services/OauthService.js +28 -28
  167. package/dist/client/services/PackagesService.d.ts +41 -41
  168. package/dist/client/services/PackagesService.js +80 -80
  169. package/dist/client/services/PropertyFormatsService.d.ts +26 -26
  170. package/dist/client/services/PropertyFormatsService.js +53 -53
  171. package/dist/client/services/PropertyGroupsService.d.ts +61 -61
  172. package/dist/client/services/PropertyGroupsService.js +135 -135
  173. package/dist/config.d.ts +8 -8
  174. package/dist/config.js +40 -40
  175. package/dist/getaccesstoken.d.ts +3 -0
  176. package/dist/getaccesstoken.js +43 -0
  177. package/dist/index.d.ts +16 -15
  178. package/dist/index.js +52 -95
  179. package/dist/types.d.ts +8 -0
  180. package/dist/types.js +2 -0
  181. package/dist/version.json +5 -0
  182. package/package.json +11 -7
@@ -0,0 +1,35 @@
1
+ import { CmsIntegrationApiClient } from "./client";
2
+ import { type CmsIntegrationApiOptions } from "./config";
3
+ import type { InstanceApiVersionInfo } from "./types";
4
+ import type { CancelablePromise } from "./client";
5
+ export declare class ApiClient extends CmsIntegrationApiClient {
6
+ private _config;
7
+ /**
8
+ * Create a new instance of the API Client
9
+ *
10
+ * @param config The instance configuration
11
+ */
12
+ constructor(config?: CmsIntegrationApiOptions);
13
+ /**
14
+ * The URL of the CMS instance
15
+ */
16
+ get cmsUrl(): URL;
17
+ /**
18
+ * Marker to indicate if the client has debugging enabled
19
+ */
20
+ get debug(): boolean;
21
+ /**
22
+ * The API version for which this client was build
23
+ */
24
+ get apiVersion(): string;
25
+ /**
26
+ * The CMS version for which this client was build
27
+ */
28
+ get cmsVersion(): string;
29
+ /**
30
+ * Retrieve the version information
31
+ *
32
+ * @returns The version information from the running instance
33
+ */
34
+ getInstanceInfo(): CancelablePromise<InstanceApiVersionInfo>;
35
+ }
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ApiClient = void 0;
7
+ const client_1 = require("./client");
8
+ const getaccesstoken_1 = require("./getaccesstoken");
9
+ const config_1 = require("./config");
10
+ const version_json_1 = __importDefault(require("./version.json"));
11
+ class ApiClient extends client_1.CmsIntegrationApiClient {
12
+ /**
13
+ * Create a new instance of the API Client
14
+ *
15
+ * @param config The instance configuration
16
+ */
17
+ constructor(config) {
18
+ const options = config ?? (0, config_1.getCmsIntegrationApiConfigFromEnvironment)();
19
+ super({
20
+ BASE: options.base.href,
21
+ TOKEN: () => (0, getaccesstoken_1.getAccessToken)(options),
22
+ HEADERS: {
23
+ Connection: "Close"
24
+ }
25
+ });
26
+ this._config = options;
27
+ }
28
+ /**
29
+ * The URL of the CMS instance
30
+ */
31
+ get cmsUrl() {
32
+ return this._config.base;
33
+ }
34
+ /**
35
+ * Marker to indicate if the client has debugging enabled
36
+ */
37
+ get debug() {
38
+ return this._config.debug ?? false;
39
+ }
40
+ /**
41
+ * The API version for which this client was build
42
+ */
43
+ get apiVersion() {
44
+ return version_json_1.default.api;
45
+ }
46
+ /**
47
+ * The CMS version for which this client was build
48
+ */
49
+ get cmsVersion() {
50
+ return version_json_1.default.cms;
51
+ }
52
+ /**
53
+ * Retrieve the version information
54
+ *
55
+ * @returns The version information from the running instance
56
+ */
57
+ getInstanceInfo() {
58
+ return this.request.request({
59
+ method: 'GET',
60
+ url: '/info',
61
+ errors: {
62
+ 403: `Forbidden`,
63
+ },
64
+ });
65
+ }
66
+ }
67
+ exports.ApiClient = ApiClient;
@@ -1,24 +1,24 @@
1
- import type { BaseHttpRequest } from './core/BaseHttpRequest';
2
- import type { OpenAPIConfig } from './core/OpenAPI';
3
- import { ChangesetsService } from './services/ChangesetsService';
4
- import { ContentService } from './services/ContentService';
5
- import { ContentTypesService } from './services/ContentTypesService';
6
- import { DisplayTemplatesService } from './services/DisplayTemplatesService';
7
- import { OauthService } from './services/OauthService';
8
- import { PackagesService } from './services/PackagesService';
9
- import { PropertyFormatsService } from './services/PropertyFormatsService';
10
- import { PropertyGroupsService } from './services/PropertyGroupsService';
11
- type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
12
- export declare class CmsIntegrationApiClient {
13
- readonly changesets: ChangesetsService;
14
- readonly content: ContentService;
15
- readonly contentTypes: ContentTypesService;
16
- readonly displayTemplates: DisplayTemplatesService;
17
- readonly oauth: OauthService;
18
- readonly packages: PackagesService;
19
- readonly propertyFormats: PropertyFormatsService;
20
- readonly propertyGroups: PropertyGroupsService;
21
- readonly request: BaseHttpRequest;
22
- constructor(config?: Partial<OpenAPIConfig>, HttpRequest?: HttpRequestConstructor);
23
- }
24
- export {};
1
+ import type { BaseHttpRequest } from './core/BaseHttpRequest';
2
+ import type { OpenAPIConfig } from './core/OpenAPI';
3
+ import { ChangesetsService } from './services/ChangesetsService';
4
+ import { ContentService } from './services/ContentService';
5
+ import { ContentTypesService } from './services/ContentTypesService';
6
+ import { DisplayTemplatesService } from './services/DisplayTemplatesService';
7
+ import { OauthService } from './services/OauthService';
8
+ import { PackagesService } from './services/PackagesService';
9
+ import { PropertyFormatsService } from './services/PropertyFormatsService';
10
+ import { PropertyGroupsService } from './services/PropertyGroupsService';
11
+ type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
12
+ export declare class CmsIntegrationApiClient {
13
+ readonly changesets: ChangesetsService;
14
+ readonly content: ContentService;
15
+ readonly contentTypes: ContentTypesService;
16
+ readonly displayTemplates: DisplayTemplatesService;
17
+ readonly oauth: OauthService;
18
+ readonly packages: PackagesService;
19
+ readonly propertyFormats: PropertyFormatsService;
20
+ readonly propertyGroups: PropertyGroupsService;
21
+ readonly request: BaseHttpRequest;
22
+ constructor(config?: Partial<OpenAPIConfig>, HttpRequest?: HttpRequestConstructor);
23
+ }
24
+ export {};
@@ -1,36 +1,36 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CmsIntegrationApiClient = void 0;
4
- const FetchHttpRequest_1 = require("./core/FetchHttpRequest");
5
- const ChangesetsService_1 = require("./services/ChangesetsService");
6
- const ContentService_1 = require("./services/ContentService");
7
- const ContentTypesService_1 = require("./services/ContentTypesService");
8
- const DisplayTemplatesService_1 = require("./services/DisplayTemplatesService");
9
- const OauthService_1 = require("./services/OauthService");
10
- const PackagesService_1 = require("./services/PackagesService");
11
- const PropertyFormatsService_1 = require("./services/PropertyFormatsService");
12
- const PropertyGroupsService_1 = require("./services/PropertyGroupsService");
13
- class CmsIntegrationApiClient {
14
- constructor(config, HttpRequest = FetchHttpRequest_1.FetchHttpRequest) {
15
- this.request = new HttpRequest({
16
- BASE: config?.BASE ?? '/_cms/preview2',
17
- VERSION: config?.VERSION ?? 'preview2',
18
- WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
19
- CREDENTIALS: config?.CREDENTIALS ?? 'include',
20
- TOKEN: config?.TOKEN,
21
- USERNAME: config?.USERNAME,
22
- PASSWORD: config?.PASSWORD,
23
- HEADERS: config?.HEADERS,
24
- ENCODE_PATH: config?.ENCODE_PATH,
25
- });
26
- this.changesets = new ChangesetsService_1.ChangesetsService(this.request);
27
- this.content = new ContentService_1.ContentService(this.request);
28
- this.contentTypes = new ContentTypesService_1.ContentTypesService(this.request);
29
- this.displayTemplates = new DisplayTemplatesService_1.DisplayTemplatesService(this.request);
30
- this.oauth = new OauthService_1.OauthService(this.request);
31
- this.packages = new PackagesService_1.PackagesService(this.request);
32
- this.propertyFormats = new PropertyFormatsService_1.PropertyFormatsService(this.request);
33
- this.propertyGroups = new PropertyGroupsService_1.PropertyGroupsService(this.request);
34
- }
35
- }
36
- exports.CmsIntegrationApiClient = CmsIntegrationApiClient;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CmsIntegrationApiClient = void 0;
4
+ const FetchHttpRequest_1 = require("./core/FetchHttpRequest");
5
+ const ChangesetsService_1 = require("./services/ChangesetsService");
6
+ const ContentService_1 = require("./services/ContentService");
7
+ const ContentTypesService_1 = require("./services/ContentTypesService");
8
+ const DisplayTemplatesService_1 = require("./services/DisplayTemplatesService");
9
+ const OauthService_1 = require("./services/OauthService");
10
+ const PackagesService_1 = require("./services/PackagesService");
11
+ const PropertyFormatsService_1 = require("./services/PropertyFormatsService");
12
+ const PropertyGroupsService_1 = require("./services/PropertyGroupsService");
13
+ class CmsIntegrationApiClient {
14
+ constructor(config, HttpRequest = FetchHttpRequest_1.FetchHttpRequest) {
15
+ this.request = new HttpRequest({
16
+ BASE: config?.BASE ?? '/_cms/preview2',
17
+ VERSION: config?.VERSION ?? 'preview2',
18
+ WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
19
+ CREDENTIALS: config?.CREDENTIALS ?? 'include',
20
+ TOKEN: config?.TOKEN,
21
+ USERNAME: config?.USERNAME,
22
+ PASSWORD: config?.PASSWORD,
23
+ HEADERS: config?.HEADERS,
24
+ ENCODE_PATH: config?.ENCODE_PATH,
25
+ });
26
+ this.changesets = new ChangesetsService_1.ChangesetsService(this.request);
27
+ this.content = new ContentService_1.ContentService(this.request);
28
+ this.contentTypes = new ContentTypesService_1.ContentTypesService(this.request);
29
+ this.displayTemplates = new DisplayTemplatesService_1.DisplayTemplatesService(this.request);
30
+ this.oauth = new OauthService_1.OauthService(this.request);
31
+ this.packages = new PackagesService_1.PackagesService(this.request);
32
+ this.propertyFormats = new PropertyFormatsService_1.PropertyFormatsService(this.request);
33
+ this.propertyGroups = new PropertyGroupsService_1.PropertyGroupsService(this.request);
34
+ }
35
+ }
36
+ exports.CmsIntegrationApiClient = CmsIntegrationApiClient;
@@ -1,10 +1,10 @@
1
- import type { ApiRequestOptions } from './ApiRequestOptions';
2
- import type { ApiResult } from './ApiResult';
3
- export declare class ApiError extends Error {
4
- readonly url: string;
5
- readonly status: number;
6
- readonly statusText: string;
7
- readonly body: any;
8
- readonly request: ApiRequestOptions;
9
- constructor(request: ApiRequestOptions, response: ApiResult, message: string);
10
- }
1
+ import type { ApiRequestOptions } from './ApiRequestOptions';
2
+ import type { ApiResult } from './ApiResult';
3
+ export declare class ApiError extends Error {
4
+ readonly url: string;
5
+ readonly status: number;
6
+ readonly statusText: string;
7
+ readonly body: any;
8
+ readonly request: ApiRequestOptions;
9
+ constructor(request: ApiRequestOptions, response: ApiResult, message: string);
10
+ }
@@ -1,15 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ApiError = void 0;
4
- class ApiError extends Error {
5
- constructor(request, response, message) {
6
- super(message);
7
- this.name = 'ApiError';
8
- this.url = response.url;
9
- this.status = response.status;
10
- this.statusText = response.statusText;
11
- this.body = response.body;
12
- this.request = request;
13
- }
14
- }
15
- exports.ApiError = ApiError;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiError = void 0;
4
+ class ApiError extends Error {
5
+ constructor(request, response, message) {
6
+ super(message);
7
+ this.name = 'ApiError';
8
+ this.url = response.url;
9
+ this.status = response.status;
10
+ this.statusText = response.statusText;
11
+ this.body = response.body;
12
+ this.request = request;
13
+ }
14
+ }
15
+ exports.ApiError = ApiError;
@@ -1,13 +1,13 @@
1
- export type ApiRequestOptions = {
2
- readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
3
- readonly url: string;
4
- readonly path?: Record<string, any>;
5
- readonly cookies?: Record<string, any>;
6
- readonly headers?: Record<string, any>;
7
- readonly query?: Record<string, any>;
8
- readonly formData?: Record<string, any>;
9
- readonly body?: any;
10
- readonly mediaType?: string;
11
- readonly responseHeader?: string;
12
- readonly errors?: Record<number, string>;
13
- };
1
+ export type ApiRequestOptions = {
2
+ readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
3
+ readonly url: string;
4
+ readonly path?: Record<string, any>;
5
+ readonly cookies?: Record<string, any>;
6
+ readonly headers?: Record<string, any>;
7
+ readonly query?: Record<string, any>;
8
+ readonly formData?: Record<string, any>;
9
+ readonly body?: any;
10
+ readonly mediaType?: string;
11
+ readonly responseHeader?: string;
12
+ readonly errors?: Record<number, string>;
13
+ };
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +1,7 @@
1
- export type ApiResult = {
2
- readonly url: string;
3
- readonly ok: boolean;
4
- readonly status: number;
5
- readonly statusText: string;
6
- readonly body: any;
7
- };
1
+ export type ApiResult = {
2
+ readonly url: string;
3
+ readonly ok: boolean;
4
+ readonly status: number;
5
+ readonly statusText: string;
6
+ readonly body: any;
7
+ };
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +1,8 @@
1
- import type { ApiRequestOptions } from './ApiRequestOptions';
2
- import type { CancelablePromise } from './CancelablePromise';
3
- import type { OpenAPIConfig } from './OpenAPI';
4
- export declare abstract class BaseHttpRequest {
5
- readonly config: OpenAPIConfig;
6
- constructor(config: OpenAPIConfig);
7
- abstract request<T>(options: ApiRequestOptions): CancelablePromise<T>;
8
- }
1
+ import type { ApiRequestOptions } from './ApiRequestOptions';
2
+ import type { CancelablePromise } from './CancelablePromise';
3
+ import type { OpenAPIConfig } from './OpenAPI';
4
+ export declare abstract class BaseHttpRequest {
5
+ readonly config: OpenAPIConfig;
6
+ constructor(config: OpenAPIConfig);
7
+ abstract request<T>(options: ApiRequestOptions): CancelablePromise<T>;
8
+ }
@@ -1,9 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseHttpRequest = void 0;
4
- class BaseHttpRequest {
5
- constructor(config) {
6
- this.config = config;
7
- }
8
- }
9
- exports.BaseHttpRequest = BaseHttpRequest;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseHttpRequest = void 0;
4
+ class BaseHttpRequest {
5
+ constructor(config) {
6
+ this.config = config;
7
+ }
8
+ }
9
+ exports.BaseHttpRequest = BaseHttpRequest;
@@ -1,20 +1,20 @@
1
- export declare class CancelError extends Error {
2
- constructor(message: string);
3
- get isCancelled(): boolean;
4
- }
5
- export interface OnCancel {
6
- readonly isResolved: boolean;
7
- readonly isRejected: boolean;
8
- readonly isCancelled: boolean;
9
- (cancelHandler: () => void): void;
10
- }
11
- export declare class CancelablePromise<T> implements Promise<T> {
12
- #private;
13
- constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void, onCancel: OnCancel) => void);
14
- get [Symbol.toStringTag](): string;
15
- then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
16
- catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
17
- finally(onFinally?: (() => void) | null): Promise<T>;
18
- cancel(): void;
19
- get isCancelled(): boolean;
20
- }
1
+ export declare class CancelError extends Error {
2
+ constructor(message: string);
3
+ get isCancelled(): boolean;
4
+ }
5
+ export interface OnCancel {
6
+ readonly isResolved: boolean;
7
+ readonly isRejected: boolean;
8
+ readonly isCancelled: boolean;
9
+ (cancelHandler: () => void): void;
10
+ }
11
+ export declare class CancelablePromise<T> implements Promise<T> {
12
+ #private;
13
+ constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void, onCancel: OnCancel) => void);
14
+ get [Symbol.toStringTag](): string;
15
+ then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
16
+ catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
17
+ finally(onFinally?: (() => void) | null): Promise<T>;
18
+ cancel(): void;
19
+ get isCancelled(): boolean;
20
+ }