@ayasofyazilim/saas 0.0.136 → 0.0.138
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/AdministrationService/AdministrationServiceClient.ts +83 -80
- package/AdministrationService/core/ApiError.ts +20 -20
- package/AdministrationService/core/ApiRequestOptions.ts +20 -12
- package/AdministrationService/core/ApiResult.ts +6 -6
- package/AdministrationService/core/BaseHttpRequest.ts +9 -9
- package/AdministrationService/core/CancelablePromise.ts +125 -125
- package/AdministrationService/core/FetchHttpRequest.ts +21 -21
- package/AdministrationService/core/OpenAPI.ts +55 -55
- package/AdministrationService/core/request.ts +349 -340
- package/AdministrationService/index.ts +10 -9
- package/AdministrationService/schemas.gen.ts +6813 -6745
- package/AdministrationService/{services.gen.ts → sdk.gen.ts} +1553 -1451
- package/AdministrationService/types.gen.ts +1191 -3008
- package/package.json +1 -1
- package/AdministrationService/models/System_Net_HttpStatusCode.ts +0 -67
- package/AdministrationService/models/Volo_Abp_Application_Dtos_ListResultDto_1.ts +0 -9
- package/AdministrationService/models/Volo_Abp_Application_Dtos_PagedResultDto_1.ts +0 -10
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ApplicationAuthConfigurationDto.ts +0 -8
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ApplicationConfigurationDto.ts +0 -30
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ApplicationFeatureConfigurationDto.ts +0 -8
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ApplicationGlobalFeatureConfigurationDto.ts +0 -8
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ApplicationLocalizationConfigurationDto.ts +0 -18
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ApplicationLocalizationDto.ts +0 -9
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ApplicationLocalizationResourceDto.ts +0 -9
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ApplicationSettingConfigurationDto.ts +0 -8
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ClockDto.ts +0 -8
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_CurrentCultureDto.ts +0 -17
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_CurrentUserDto.ts +0 -22
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_DateTimeFormatDto.ts +0 -14
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_IanaTimeZone.ts +0 -8
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ObjectExtending_EntityExtensionDto.ts +0 -10
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ObjectExtending_ExtensionEnumDto.ts +0 -10
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ObjectExtending_ExtensionEnumFieldDto.ts +0 -9
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ObjectExtending_ExtensionPropertyApiCreateDto.ts +0 -8
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ObjectExtending_ExtensionPropertyApiDto.ts +0 -13
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ObjectExtending_ExtensionPropertyApiGetDto.ts +0 -8
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ObjectExtending_ExtensionPropertyApiUpdateDto.ts +0 -8
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ObjectExtending_ExtensionPropertyAttributeDto.ts +0 -9
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ObjectExtending_ExtensionPropertyDto.ts +0 -19
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ObjectExtending_ExtensionPropertyUiDto.ts +0 -14
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ObjectExtending_ExtensionPropertyUiFormDto.ts +0 -8
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ObjectExtending_ExtensionPropertyUiLookupDto.ts +0 -12
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ObjectExtending_ExtensionPropertyUiTableDto.ts +0 -8
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ObjectExtending_LocalizableStringDto.ts +0 -9
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ObjectExtending_ModuleExtensionDto.ts +0 -10
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_ObjectExtending_ObjectExtensionsDto.ts +0 -11
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_TimeZone.ts +0 -11
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_TimingDto.ts +0 -9
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_ApplicationConfigurations_WindowsTimeZone.ts +0 -8
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_MultiTenancy_CurrentTenantDto.ts +0 -10
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_MultiTenancy_FindTenantResultDto.ts +0 -11
- package/AdministrationService/models/Volo_Abp_AspNetCore_Mvc_MultiTenancy_MultiTenancyInfoDto.ts +0 -8
- package/AdministrationService/models/Volo_Abp_AuditLogging_AuditLogActionDto.ts +0 -16
- package/AdministrationService/models/Volo_Abp_AuditLogging_AuditLogDto.ts +0 -33
- package/AdministrationService/models/Volo_Abp_AuditLogging_EntityChangeDto.ts +0 -18
- package/AdministrationService/models/Volo_Abp_AuditLogging_EntityChangeWithUsernameDto.ts +0 -10
- package/AdministrationService/models/Volo_Abp_AuditLogging_EntityPropertyChangeDto.ts +0 -14
- package/AdministrationService/models/Volo_Abp_AuditLogging_GetAverageExecutionDurationPerDayOutput.ts +0 -8
- package/AdministrationService/models/Volo_Abp_AuditLogging_GetErrorRateOutput.ts +0 -8
- package/AdministrationService/models/Volo_Abp_Auditing_EntityChangeType.ts +0 -9
- package/AdministrationService/models/Volo_Abp_FeatureManagement_FeatureDto.ts +0 -17
- package/AdministrationService/models/Volo_Abp_FeatureManagement_FeatureGroupDto.ts +0 -11
- package/AdministrationService/models/Volo_Abp_FeatureManagement_FeatureProviderDto.ts +0 -9
- package/AdministrationService/models/Volo_Abp_FeatureManagement_GetFeatureListResultDto.ts +0 -9
- package/AdministrationService/models/Volo_Abp_FeatureManagement_UpdateFeatureDto.ts +0 -9
- package/AdministrationService/models/Volo_Abp_FeatureManagement_UpdateFeaturesDto.ts +0 -9
- package/AdministrationService/models/Volo_Abp_Gdpr_DownloadTokenResultDto.ts +0 -8
- package/AdministrationService/models/Volo_Abp_Gdpr_GdprRequestDto.ts +0 -10
- package/AdministrationService/models/Volo_Abp_Http_Modeling_ActionApiDescriptionModel.ts +0 -20
- package/AdministrationService/models/Volo_Abp_Http_Modeling_ApplicationApiDescriptionModel.ts +0 -11
- package/AdministrationService/models/Volo_Abp_Http_Modeling_ControllerApiDescriptionModel.ts +0 -17
- package/AdministrationService/models/Volo_Abp_Http_Modeling_ControllerInterfaceApiDescriptionModel.ts +0 -11
- package/AdministrationService/models/Volo_Abp_Http_Modeling_InterfaceMethodApiDescriptionModel.ts +0 -12
- package/AdministrationService/models/Volo_Abp_Http_Modeling_MethodParameterApiDescriptionModel.ts +0 -13
- package/AdministrationService/models/Volo_Abp_Http_Modeling_ModuleApiDescriptionModel.ts +0 -11
- package/AdministrationService/models/Volo_Abp_Http_Modeling_ParameterApiDescriptionModel.ts +0 -17
- package/AdministrationService/models/Volo_Abp_Http_Modeling_PropertyApiDescriptionModel.ts +0 -17
- package/AdministrationService/models/Volo_Abp_Http_Modeling_ReturnValueApiDescriptionModel.ts +0 -9
- package/AdministrationService/models/Volo_Abp_Http_Modeling_TypeApiDescriptionModel.ts +0 -14
- package/AdministrationService/models/Volo_Abp_Http_RemoteServiceErrorInfo.ts +0 -13
- package/AdministrationService/models/Volo_Abp_Http_RemoteServiceErrorResponse.ts +0 -9
- package/AdministrationService/models/Volo_Abp_Http_RemoteServiceValidationErrorInfo.ts +0 -9
- package/AdministrationService/models/Volo_Abp_LanguageManagement_Dto_CreateLanguageDto.ts +0 -13
- package/AdministrationService/models/Volo_Abp_LanguageManagement_Dto_CultureInfoDto.ts +0 -9
- package/AdministrationService/models/Volo_Abp_LanguageManagement_Dto_LanguageDto.ts +0 -18
- package/AdministrationService/models/Volo_Abp_LanguageManagement_Dto_LanguageResourceDto.ts +0 -8
- package/AdministrationService/models/Volo_Abp_LanguageManagement_Dto_LanguageTextDto.ts +0 -13
- package/AdministrationService/models/Volo_Abp_LanguageManagement_Dto_UpdateLanguageDto.ts +0 -12
- package/AdministrationService/models/Volo_Abp_Localization_LanguageInfo.ts +0 -12
- package/AdministrationService/models/Volo_Abp_NameValue.ts +0 -9
- package/AdministrationService/models/Volo_Abp_PermissionManagement_GetPermissionListResultDto.ts +0 -10
- package/AdministrationService/models/Volo_Abp_PermissionManagement_PermissionGrantInfoDto.ts +0 -14
- package/AdministrationService/models/Volo_Abp_PermissionManagement_PermissionGroupDto.ts +0 -13
- package/AdministrationService/models/Volo_Abp_PermissionManagement_ProviderInfoDto.ts +0 -9
- package/AdministrationService/models/Volo_Abp_PermissionManagement_UpdatePermissionDto.ts +0 -9
- package/AdministrationService/models/Volo_Abp_PermissionManagement_UpdatePermissionsDto.ts +0 -9
- package/AdministrationService/models/Volo_Abp_SettingManagement_EmailSettingsDto.ts +0 -16
- package/AdministrationService/models/Volo_Abp_SettingManagement_SendTestEmailInput.ts +0 -11
- package/AdministrationService/models/Volo_Abp_SettingManagement_UpdateEmailSettingsDto.ts +0 -16
- package/AdministrationService/models/Volo_Abp_TextTemplateManagement_TextTemplates_RestoreTemplateContentInput.ts +0 -9
- package/AdministrationService/models/Volo_Abp_TextTemplateManagement_TextTemplates_TemplateDefinitionDto.ts +0 -13
- package/AdministrationService/models/Volo_Abp_TextTemplateManagement_TextTemplates_TextTemplateContentDto.ts +0 -10
- package/AdministrationService/models/Volo_Abp_TextTemplateManagement_TextTemplates_UpdateTemplateContentInput.ts +0 -10
- package/AdministrationService/models/Volo_Abp_Validation_StringValues_IStringValueType.ts +0 -11
- package/AdministrationService/models/Volo_Abp_Validation_StringValues_IValueValidator.ts +0 -9
- package/AdministrationService/services/AbpApiDefinitionService.ts +0 -34
- package/AdministrationService/services/AbpApplicationConfigurationService.ts +0 -34
- package/AdministrationService/services/AbpApplicationLocalizationService.ts +0 -37
- package/AdministrationService/services/AbpTenantService.ts +0 -58
- package/AdministrationService/services/AuditLogsService.ts +0 -286
- package/AdministrationService/services/EmailSettingsService.ts +0 -76
- package/AdministrationService/services/FeaturesService.ts +0 -96
- package/AdministrationService/services/GdprRequestService.ts +0 -152
- package/AdministrationService/services/LanguageTextsService.ts +0 -157
- package/AdministrationService/services/LanguagesService.ts +0 -257
- package/AdministrationService/services/PermissionsService.ts +0 -69
- package/AdministrationService/services/TextTemplateContentsService.ts +0 -85
- package/AdministrationService/services/TextTemplateDefinitionsService.ts +0 -69
- package/AdministrationService/services/TimeZoneSettingsService.ts +0 -70
|
@@ -1,80 +1,83 @@
|
|
|
1
|
-
import type { BaseHttpRequest } from './core/BaseHttpRequest';
|
|
2
|
-
import type { OpenAPIConfig } from './core/OpenAPI';
|
|
3
|
-
import { Interceptors } from './core/OpenAPI';
|
|
4
|
-
import { FetchHttpRequest } from './core/FetchHttpRequest';
|
|
5
|
-
|
|
6
|
-
import { AbpApiDefinitionService } from './
|
|
7
|
-
import { AbpApplicationConfigurationService } from './
|
|
8
|
-
import { AbpApplicationLocalizationService } from './
|
|
9
|
-
import { AbpTenantService } from './
|
|
10
|
-
import { AuditLogsService } from './
|
|
11
|
-
import { CountrySettingService } from './
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
public readonly
|
|
29
|
-
public readonly
|
|
30
|
-
public readonly
|
|
31
|
-
public readonly
|
|
32
|
-
public readonly
|
|
33
|
-
public readonly
|
|
34
|
-
public readonly
|
|
35
|
-
public readonly
|
|
36
|
-
public readonly
|
|
37
|
-
public readonly
|
|
38
|
-
public readonly
|
|
39
|
-
public readonly
|
|
40
|
-
public readonly
|
|
41
|
-
public readonly
|
|
42
|
-
public readonly
|
|
43
|
-
|
|
44
|
-
public readonly
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
this.
|
|
66
|
-
this.
|
|
67
|
-
this.
|
|
68
|
-
this.
|
|
69
|
-
this.
|
|
70
|
-
this.
|
|
71
|
-
this.
|
|
72
|
-
this.
|
|
73
|
-
this.
|
|
74
|
-
this.
|
|
75
|
-
this.
|
|
76
|
-
this.
|
|
77
|
-
this.
|
|
78
|
-
this.
|
|
79
|
-
|
|
80
|
-
|
|
1
|
+
import type { BaseHttpRequest } from './core/BaseHttpRequest';
|
|
2
|
+
import type { OpenAPIConfig } from './core/OpenAPI';
|
|
3
|
+
import { Interceptors } from './core/OpenAPI';
|
|
4
|
+
import { FetchHttpRequest } from './core/FetchHttpRequest';
|
|
5
|
+
|
|
6
|
+
import { AbpApiDefinitionService } from './sdk.gen';
|
|
7
|
+
import { AbpApplicationConfigurationService } from './sdk.gen';
|
|
8
|
+
import { AbpApplicationLocalizationService } from './sdk.gen';
|
|
9
|
+
import { AbpTenantService } from './sdk.gen';
|
|
10
|
+
import { AuditLogsService } from './sdk.gen';
|
|
11
|
+
import { CountrySettingService } from './sdk.gen';
|
|
12
|
+
import { CountrySettingIntegrationService } from './sdk.gen';
|
|
13
|
+
import { EmailSettingsService } from './sdk.gen';
|
|
14
|
+
import { FeaturesService } from './sdk.gen';
|
|
15
|
+
import { GdprRequestService } from './sdk.gen';
|
|
16
|
+
import { LanguagesService } from './sdk.gen';
|
|
17
|
+
import { LanguageTextsService } from './sdk.gen';
|
|
18
|
+
import { PermissionsService } from './sdk.gen';
|
|
19
|
+
import { SettingsService } from './sdk.gen';
|
|
20
|
+
import { TextTemplateContentsService } from './sdk.gen';
|
|
21
|
+
import { TextTemplateDefinitionsService } from './sdk.gen';
|
|
22
|
+
import { TimeZoneSettingsService } from './sdk.gen';
|
|
23
|
+
|
|
24
|
+
type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
|
|
25
|
+
|
|
26
|
+
export class AdministrationServiceClient {
|
|
27
|
+
|
|
28
|
+
public readonly abpApiDefinition: AbpApiDefinitionService;
|
|
29
|
+
public readonly abpApplicationConfiguration: AbpApplicationConfigurationService;
|
|
30
|
+
public readonly abpApplicationLocalization: AbpApplicationLocalizationService;
|
|
31
|
+
public readonly abpTenant: AbpTenantService;
|
|
32
|
+
public readonly auditLogs: AuditLogsService;
|
|
33
|
+
public readonly countrySetting: CountrySettingService;
|
|
34
|
+
public readonly countrySettingIntegration: CountrySettingIntegrationService;
|
|
35
|
+
public readonly emailSettings: EmailSettingsService;
|
|
36
|
+
public readonly features: FeaturesService;
|
|
37
|
+
public readonly gdprRequest: GdprRequestService;
|
|
38
|
+
public readonly languages: LanguagesService;
|
|
39
|
+
public readonly languageTexts: LanguageTextsService;
|
|
40
|
+
public readonly permissions: PermissionsService;
|
|
41
|
+
public readonly settings: SettingsService;
|
|
42
|
+
public readonly textTemplateContents: TextTemplateContentsService;
|
|
43
|
+
public readonly textTemplateDefinitions: TextTemplateDefinitionsService;
|
|
44
|
+
public readonly timeZoneSettings: TimeZoneSettingsService;
|
|
45
|
+
|
|
46
|
+
public readonly request: BaseHttpRequest;
|
|
47
|
+
|
|
48
|
+
constructor(config?: Partial<OpenAPIConfig>, HttpRequest: HttpRequestConstructor = FetchHttpRequest) {
|
|
49
|
+
this.request = new HttpRequest({
|
|
50
|
+
BASE: config?.BASE ?? '',
|
|
51
|
+
VERSION: config?.VERSION ?? '1',
|
|
52
|
+
WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
|
|
53
|
+
CREDENTIALS: config?.CREDENTIALS ?? 'include',
|
|
54
|
+
TOKEN: config?.TOKEN,
|
|
55
|
+
USERNAME: config?.USERNAME,
|
|
56
|
+
PASSWORD: config?.PASSWORD,
|
|
57
|
+
HEADERS: config?.HEADERS,
|
|
58
|
+
ENCODE_PATH: config?.ENCODE_PATH,
|
|
59
|
+
interceptors: {
|
|
60
|
+
request: config?.interceptors?.request ?? new Interceptors(),
|
|
61
|
+
response: config?.interceptors?.response ?? new Interceptors(),
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
this.abpApiDefinition = new AbpApiDefinitionService(this.request);
|
|
66
|
+
this.abpApplicationConfiguration = new AbpApplicationConfigurationService(this.request);
|
|
67
|
+
this.abpApplicationLocalization = new AbpApplicationLocalizationService(this.request);
|
|
68
|
+
this.abpTenant = new AbpTenantService(this.request);
|
|
69
|
+
this.auditLogs = new AuditLogsService(this.request);
|
|
70
|
+
this.countrySetting = new CountrySettingService(this.request);
|
|
71
|
+
this.countrySettingIntegration = new CountrySettingIntegrationService(this.request);
|
|
72
|
+
this.emailSettings = new EmailSettingsService(this.request);
|
|
73
|
+
this.features = new FeaturesService(this.request);
|
|
74
|
+
this.gdprRequest = new GdprRequestService(this.request);
|
|
75
|
+
this.languages = new LanguagesService(this.request);
|
|
76
|
+
this.languageTexts = new LanguageTextsService(this.request);
|
|
77
|
+
this.permissions = new PermissionsService(this.request);
|
|
78
|
+
this.settings = new SettingsService(this.request);
|
|
79
|
+
this.textTemplateContents = new TextTemplateContentsService(this.request);
|
|
80
|
+
this.textTemplateDefinitions = new TextTemplateDefinitionsService(this.request);
|
|
81
|
+
this.timeZoneSettings = new TimeZoneSettingsService(this.request);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
2
|
-
import type { ApiResult } from './ApiResult';
|
|
3
|
-
|
|
4
|
-
export class ApiError extends Error {
|
|
5
|
-
public readonly url: string;
|
|
6
|
-
public readonly status: number;
|
|
7
|
-
public readonly statusText: string;
|
|
8
|
-
public readonly body: unknown;
|
|
9
|
-
public readonly request: ApiRequestOptions;
|
|
10
|
-
|
|
11
|
-
constructor(request: ApiRequestOptions, response: ApiResult, message: string) {
|
|
12
|
-
super(message);
|
|
13
|
-
|
|
14
|
-
this.name = 'ApiError';
|
|
15
|
-
this.url = response.url;
|
|
16
|
-
this.status = response.status;
|
|
17
|
-
this.statusText = response.statusText;
|
|
18
|
-
this.body = response.body;
|
|
19
|
-
this.request = request;
|
|
20
|
-
}
|
|
1
|
+
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
2
|
+
import type { ApiResult } from './ApiResult';
|
|
3
|
+
|
|
4
|
+
export class ApiError extends Error {
|
|
5
|
+
public readonly url: string;
|
|
6
|
+
public readonly status: number;
|
|
7
|
+
public readonly statusText: string;
|
|
8
|
+
public readonly body: unknown;
|
|
9
|
+
public readonly request: ApiRequestOptions;
|
|
10
|
+
|
|
11
|
+
constructor(request: ApiRequestOptions, response: ApiResult, message: string) {
|
|
12
|
+
super(message);
|
|
13
|
+
|
|
14
|
+
this.name = 'ApiError';
|
|
15
|
+
this.url = response.url;
|
|
16
|
+
this.status = response.status;
|
|
17
|
+
this.statusText = response.statusText;
|
|
18
|
+
this.body = response.body;
|
|
19
|
+
this.request = request;
|
|
20
|
+
}
|
|
21
21
|
}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
export type ApiRequestOptions = {
|
|
2
|
-
readonly
|
|
3
|
-
readonly
|
|
4
|
-
readonly
|
|
5
|
-
readonly
|
|
6
|
-
readonly headers?: Record<string, unknown>;
|
|
7
|
-
readonly
|
|
8
|
-
readonly
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
export type ApiRequestOptions<T = unknown> = {
|
|
2
|
+
readonly body?: any;
|
|
3
|
+
readonly cookies?: Record<string, unknown>;
|
|
4
|
+
readonly errors?: Record<number | string, string>;
|
|
5
|
+
readonly formData?: Record<string, unknown> | any[] | Blob | File;
|
|
6
|
+
readonly headers?: Record<string, unknown>;
|
|
7
|
+
readonly mediaType?: string;
|
|
8
|
+
readonly method:
|
|
9
|
+
| 'DELETE'
|
|
10
|
+
| 'GET'
|
|
11
|
+
| 'HEAD'
|
|
12
|
+
| 'OPTIONS'
|
|
13
|
+
| 'PATCH'
|
|
14
|
+
| 'POST'
|
|
15
|
+
| 'PUT';
|
|
16
|
+
readonly path?: Record<string, unknown>;
|
|
17
|
+
readonly query?: Record<string, unknown>;
|
|
18
|
+
readonly responseHeader?: string;
|
|
19
|
+
readonly responseTransformer?: (data: unknown) => Promise<T>;
|
|
20
|
+
readonly url: string;
|
|
13
21
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export type ApiResult<TData = any> = {
|
|
2
|
-
readonly body: TData;
|
|
3
|
-
readonly ok: boolean;
|
|
4
|
-
readonly status: number;
|
|
5
|
-
readonly statusText: string;
|
|
6
|
-
readonly url: string;
|
|
1
|
+
export type ApiResult<TData = any> = {
|
|
2
|
+
readonly body: TData;
|
|
3
|
+
readonly ok: boolean;
|
|
4
|
+
readonly status: number;
|
|
5
|
+
readonly statusText: string;
|
|
6
|
+
readonly url: string;
|
|
7
7
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
2
|
-
import type { CancelablePromise } from './CancelablePromise';
|
|
3
|
-
import type { OpenAPIConfig } from './OpenAPI';
|
|
4
|
-
|
|
5
|
-
export abstract class BaseHttpRequest {
|
|
6
|
-
|
|
7
|
-
constructor(public readonly config: OpenAPIConfig) {}
|
|
8
|
-
|
|
9
|
-
public abstract request<T>(options: ApiRequestOptions): CancelablePromise<T>;
|
|
1
|
+
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
2
|
+
import type { CancelablePromise } from './CancelablePromise';
|
|
3
|
+
import type { OpenAPIConfig } from './OpenAPI';
|
|
4
|
+
|
|
5
|
+
export abstract class BaseHttpRequest {
|
|
6
|
+
|
|
7
|
+
constructor(public readonly config: OpenAPIConfig) {}
|
|
8
|
+
|
|
9
|
+
public abstract request<T>(options: ApiRequestOptions<T>): CancelablePromise<T>;
|
|
10
10
|
}
|
|
@@ -1,126 +1,126 @@
|
|
|
1
|
-
export class CancelError extends Error {
|
|
2
|
-
constructor(message: string) {
|
|
3
|
-
super(message);
|
|
4
|
-
this.name = 'CancelError';
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
public get isCancelled(): boolean {
|
|
8
|
-
return true;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface OnCancel {
|
|
13
|
-
readonly isResolved: boolean;
|
|
14
|
-
readonly isRejected: boolean;
|
|
15
|
-
readonly isCancelled: boolean;
|
|
16
|
-
|
|
17
|
-
(cancelHandler: () => void): void;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export class CancelablePromise<T> implements Promise<T> {
|
|
21
|
-
private _isResolved: boolean;
|
|
22
|
-
private _isRejected: boolean;
|
|
23
|
-
private _isCancelled: boolean;
|
|
24
|
-
readonly cancelHandlers: (() => void)[];
|
|
25
|
-
readonly promise: Promise<T>;
|
|
26
|
-
private _resolve?: (value: T | PromiseLike<T>) => void;
|
|
27
|
-
private _reject?: (reason?: unknown) => void;
|
|
28
|
-
|
|
29
|
-
constructor(
|
|
30
|
-
executor: (
|
|
31
|
-
resolve: (value: T | PromiseLike<T>) => void,
|
|
32
|
-
reject: (reason?: unknown) => void,
|
|
33
|
-
onCancel: OnCancel
|
|
34
|
-
) => void
|
|
35
|
-
) {
|
|
36
|
-
this._isResolved = false;
|
|
37
|
-
this._isRejected = false;
|
|
38
|
-
this._isCancelled = false;
|
|
39
|
-
this.cancelHandlers = [];
|
|
40
|
-
this.promise = new Promise<T>((resolve, reject) => {
|
|
41
|
-
this._resolve = resolve;
|
|
42
|
-
this._reject = reject;
|
|
43
|
-
|
|
44
|
-
const onResolve = (value: T | PromiseLike<T>): void => {
|
|
45
|
-
if (this._isResolved || this._isRejected || this._isCancelled) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
this._isResolved = true;
|
|
49
|
-
if (this._resolve) this._resolve(value);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const onReject = (reason?: unknown): void => {
|
|
53
|
-
if (this._isResolved || this._isRejected || this._isCancelled) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
this._isRejected = true;
|
|
57
|
-
if (this._reject) this._reject(reason);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const onCancel = (cancelHandler: () => void): void => {
|
|
61
|
-
if (this._isResolved || this._isRejected || this._isCancelled) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
this.cancelHandlers.push(cancelHandler);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
Object.defineProperty(onCancel, 'isResolved', {
|
|
68
|
-
get: (): boolean => this._isResolved,
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
Object.defineProperty(onCancel, 'isRejected', {
|
|
72
|
-
get: (): boolean => this._isRejected,
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
Object.defineProperty(onCancel, 'isCancelled', {
|
|
76
|
-
get: (): boolean => this._isCancelled,
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
return executor(onResolve, onReject, onCancel as OnCancel);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
get [Symbol.toStringTag]() {
|
|
84
|
-
return "Cancellable Promise";
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
public then<TResult1 = T, TResult2 = never>(
|
|
88
|
-
onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
|
|
89
|
-
onRejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null
|
|
90
|
-
): Promise<TResult1 | TResult2> {
|
|
91
|
-
return this.promise.then(onFulfilled, onRejected);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
public catch<TResult = never>(
|
|
95
|
-
onRejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null
|
|
96
|
-
): Promise<T | TResult> {
|
|
97
|
-
return this.promise.catch(onRejected);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
public finally(onFinally?: (() => void) | null): Promise<T> {
|
|
101
|
-
return this.promise.finally(onFinally);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
public cancel(): void {
|
|
105
|
-
if (this._isResolved || this._isRejected || this._isCancelled) {
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
this._isCancelled = true;
|
|
109
|
-
if (this.cancelHandlers.length) {
|
|
110
|
-
try {
|
|
111
|
-
for (const cancelHandler of this.cancelHandlers) {
|
|
112
|
-
cancelHandler();
|
|
113
|
-
}
|
|
114
|
-
} catch (error) {
|
|
115
|
-
console.warn('Cancellation threw an error', error);
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
this.cancelHandlers.length = 0;
|
|
120
|
-
if (this._reject) this._reject(new CancelError('Request aborted'));
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
public get isCancelled(): boolean {
|
|
124
|
-
return this._isCancelled;
|
|
125
|
-
}
|
|
1
|
+
export class CancelError extends Error {
|
|
2
|
+
constructor(message: string) {
|
|
3
|
+
super(message);
|
|
4
|
+
this.name = 'CancelError';
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
public get isCancelled(): boolean {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface OnCancel {
|
|
13
|
+
readonly isResolved: boolean;
|
|
14
|
+
readonly isRejected: boolean;
|
|
15
|
+
readonly isCancelled: boolean;
|
|
16
|
+
|
|
17
|
+
(cancelHandler: () => void): void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class CancelablePromise<T> implements Promise<T> {
|
|
21
|
+
private _isResolved: boolean;
|
|
22
|
+
private _isRejected: boolean;
|
|
23
|
+
private _isCancelled: boolean;
|
|
24
|
+
readonly cancelHandlers: (() => void)[];
|
|
25
|
+
readonly promise: Promise<T>;
|
|
26
|
+
private _resolve?: (value: T | PromiseLike<T>) => void;
|
|
27
|
+
private _reject?: (reason?: unknown) => void;
|
|
28
|
+
|
|
29
|
+
constructor(
|
|
30
|
+
executor: (
|
|
31
|
+
resolve: (value: T | PromiseLike<T>) => void,
|
|
32
|
+
reject: (reason?: unknown) => void,
|
|
33
|
+
onCancel: OnCancel
|
|
34
|
+
) => void
|
|
35
|
+
) {
|
|
36
|
+
this._isResolved = false;
|
|
37
|
+
this._isRejected = false;
|
|
38
|
+
this._isCancelled = false;
|
|
39
|
+
this.cancelHandlers = [];
|
|
40
|
+
this.promise = new Promise<T>((resolve, reject) => {
|
|
41
|
+
this._resolve = resolve;
|
|
42
|
+
this._reject = reject;
|
|
43
|
+
|
|
44
|
+
const onResolve = (value: T | PromiseLike<T>): void => {
|
|
45
|
+
if (this._isResolved || this._isRejected || this._isCancelled) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
this._isResolved = true;
|
|
49
|
+
if (this._resolve) this._resolve(value);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const onReject = (reason?: unknown): void => {
|
|
53
|
+
if (this._isResolved || this._isRejected || this._isCancelled) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
this._isRejected = true;
|
|
57
|
+
if (this._reject) this._reject(reason);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const onCancel = (cancelHandler: () => void): void => {
|
|
61
|
+
if (this._isResolved || this._isRejected || this._isCancelled) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
this.cancelHandlers.push(cancelHandler);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
Object.defineProperty(onCancel, 'isResolved', {
|
|
68
|
+
get: (): boolean => this._isResolved,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
Object.defineProperty(onCancel, 'isRejected', {
|
|
72
|
+
get: (): boolean => this._isRejected,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
Object.defineProperty(onCancel, 'isCancelled', {
|
|
76
|
+
get: (): boolean => this._isCancelled,
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
return executor(onResolve, onReject, onCancel as OnCancel);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
get [Symbol.toStringTag]() {
|
|
84
|
+
return "Cancellable Promise";
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
public then<TResult1 = T, TResult2 = never>(
|
|
88
|
+
onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
|
|
89
|
+
onRejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null
|
|
90
|
+
): Promise<TResult1 | TResult2> {
|
|
91
|
+
return this.promise.then(onFulfilled, onRejected);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
public catch<TResult = never>(
|
|
95
|
+
onRejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null
|
|
96
|
+
): Promise<T | TResult> {
|
|
97
|
+
return this.promise.catch(onRejected);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
public finally(onFinally?: (() => void) | null): Promise<T> {
|
|
101
|
+
return this.promise.finally(onFinally);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
public cancel(): void {
|
|
105
|
+
if (this._isResolved || this._isRejected || this._isCancelled) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
this._isCancelled = true;
|
|
109
|
+
if (this.cancelHandlers.length) {
|
|
110
|
+
try {
|
|
111
|
+
for (const cancelHandler of this.cancelHandlers) {
|
|
112
|
+
cancelHandler();
|
|
113
|
+
}
|
|
114
|
+
} catch (error) {
|
|
115
|
+
console.warn('Cancellation threw an error', error);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
this.cancelHandlers.length = 0;
|
|
120
|
+
if (this._reject) this._reject(new CancelError('Request aborted'));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
public get isCancelled(): boolean {
|
|
124
|
+
return this._isCancelled;
|
|
125
|
+
}
|
|
126
126
|
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
2
|
-
import { BaseHttpRequest } from './BaseHttpRequest';
|
|
3
|
-
import type { CancelablePromise } from './CancelablePromise';
|
|
4
|
-
import type { OpenAPIConfig } from './OpenAPI';
|
|
5
|
-
import { request as __request } from './request';
|
|
6
|
-
|
|
7
|
-
export class FetchHttpRequest extends BaseHttpRequest {
|
|
8
|
-
|
|
9
|
-
constructor(config: OpenAPIConfig) {
|
|
10
|
-
super(config);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Request method
|
|
15
|
-
* @param options The request options from the service
|
|
16
|
-
* @returns CancelablePromise<T>
|
|
17
|
-
* @throws ApiError
|
|
18
|
-
*/
|
|
19
|
-
public override request<T>(options: ApiRequestOptions): CancelablePromise<T> {
|
|
20
|
-
return __request(this.config, options);
|
|
21
|
-
}
|
|
1
|
+
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
2
|
+
import { BaseHttpRequest } from './BaseHttpRequest';
|
|
3
|
+
import type { CancelablePromise } from './CancelablePromise';
|
|
4
|
+
import type { OpenAPIConfig } from './OpenAPI';
|
|
5
|
+
import { request as __request } from './request';
|
|
6
|
+
|
|
7
|
+
export class FetchHttpRequest extends BaseHttpRequest {
|
|
8
|
+
|
|
9
|
+
constructor(config: OpenAPIConfig) {
|
|
10
|
+
super(config);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Request method
|
|
15
|
+
* @param options The request options from the service
|
|
16
|
+
* @returns CancelablePromise<T>
|
|
17
|
+
* @throws ApiError
|
|
18
|
+
*/
|
|
19
|
+
public override request<T>(options: ApiRequestOptions<T>): CancelablePromise<T> {
|
|
20
|
+
return __request(this.config, options);
|
|
21
|
+
}
|
|
22
22
|
}
|