esisl_genoa_client 0.1.1 → 0.1.6
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/.openapi-generator/FILES +105 -0
- package/README.md +119 -5
- package/dist/apis/AllianceApi.d.ts +25 -17
- package/dist/apis/AllianceApi.js +42 -17
- package/dist/apis/AssetsApi.d.ts +37 -25
- package/dist/apis/AssetsApi.js +62 -25
- package/dist/apis/CalendarApi.d.ts +25 -17
- package/dist/apis/CalendarApi.js +42 -18
- package/dist/apis/CharacterApi.d.ts +85 -57
- package/dist/apis/CharacterApi.js +142 -63
- package/dist/apis/ClonesApi.d.ts +13 -9
- package/dist/apis/ClonesApi.js +22 -9
- package/dist/apis/ContactsApi.d.ts +55 -37
- package/dist/apis/ContactsApi.js +92 -39
- package/dist/apis/ContractsApi.d.ts +55 -37
- package/dist/apis/ContractsApi.js +92 -37
- package/dist/apis/CorporationApi.d.ts +133 -89
- package/dist/apis/CorporationApi.js +222 -95
- package/dist/apis/CorporationProjectsApi.d.ts +288 -0
- package/dist/apis/CorporationProjectsApi.js +514 -0
- package/dist/apis/DogmaApi.d.ts +31 -21
- package/dist/apis/DogmaApi.js +52 -21
- package/dist/apis/FactionWarfareApi.d.ts +49 -33
- package/dist/apis/FactionWarfareApi.js +82 -33
- package/dist/apis/FittingsApi.d.ts +19 -13
- package/dist/apis/FittingsApi.js +32 -14
- package/dist/apis/FleetsApi.d.ts +85 -57
- package/dist/apis/FleetsApi.js +142 -65
- package/dist/apis/FreelanceJobsApi.d.ts +396 -0
- package/dist/apis/FreelanceJobsApi.js +696 -0
- package/dist/apis/IncursionsApi.d.ts +7 -5
- package/dist/apis/IncursionsApi.js +12 -5
- package/dist/apis/IndustryApi.d.ts +49 -33
- package/dist/apis/IndustryApi.js +82 -33
- package/dist/apis/InsuranceApi.d.ts +7 -5
- package/dist/apis/InsuranceApi.js +12 -5
- package/dist/apis/KillmailsApi.d.ts +19 -13
- package/dist/apis/KillmailsApi.js +32 -13
- package/dist/apis/LocationApi.d.ts +19 -13
- package/dist/apis/LocationApi.js +32 -13
- package/dist/apis/LoyaltyApi.d.ts +13 -9
- package/dist/apis/LoyaltyApi.js +22 -9
- package/dist/apis/MailApi.d.ts +55 -37
- package/dist/apis/MailApi.js +92 -52
- package/dist/apis/MarketApi.d.ts +67 -45
- package/dist/apis/MarketApi.js +112 -45
- package/dist/apis/MetaApi.d.ts +70 -10
- package/dist/apis/MetaApi.js +116 -10
- package/dist/apis/PlanetaryInteractionApi.d.ts +25 -17
- package/dist/apis/PlanetaryInteractionApi.js +42 -17
- package/dist/apis/RoutesApi.d.ts +29 -39
- package/dist/apis/RoutesApi.js +48 -55
- package/dist/apis/SearchApi.d.ts +7 -5
- package/dist/apis/SearchApi.js +12 -5
- package/dist/apis/SkillsApi.d.ts +19 -13
- package/dist/apis/SkillsApi.js +32 -13
- package/dist/apis/SovereigntyApi.d.ts +19 -13
- package/dist/apis/SovereigntyApi.js +32 -13
- package/dist/apis/StatusApi.d.ts +7 -5
- package/dist/apis/StatusApi.js +12 -5
- package/dist/apis/UniverseApi.d.ts +181 -121
- package/dist/apis/UniverseApi.js +302 -121
- package/dist/apis/UserInterfaceApi.d.ts +31 -21
- package/dist/apis/UserInterfaceApi.js +52 -26
- package/dist/apis/WalletApi.d.ts +37 -25
- package/dist/apis/WalletApi.js +62 -31
- package/dist/apis/WarsApi.d.ts +19 -13
- package/dist/apis/WarsApi.js +32 -13
- package/dist/apis/index.d.ts +2 -0
- package/dist/apis/index.js +2 -0
- package/dist/constants.d.ts +8 -0
- package/dist/constants.js +13 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -0
- package/dist/models/index.d.ts +2339 -295
- package/dist/models/index.js +165 -2
- package/dist/runtime.d.ts +6 -56
- package/dist/runtime.js +4 -309
- package/docs/AllianceApi.md +24 -12
- package/docs/AllianceId.md +14 -0
- package/docs/AssetsApi.md +36 -18
- package/docs/CalendarApi.md +24 -12
- package/docs/CaptureFwComplex.md +14 -0
- package/docs/CharacterApi.md +84 -42
- package/docs/CharacterId.md +14 -0
- package/docs/CharactersFreelanceJobsListing.md +14 -0
- package/docs/CharactersFreelanceJobsParticipation.md +16 -0
- package/docs/ClonesApi.md +12 -6
- package/docs/ConstellationId.md +14 -0
- package/docs/ContactsApi.md +54 -27
- package/docs/ContractsApi.md +54 -27
- package/docs/CorporationApi.md +132 -66
- package/docs/CorporationId.md +14 -0
- package/docs/CorporationItemDelivery.md +14 -0
- package/docs/CorporationProjectsApi.md +393 -0
- package/docs/CorporationsFreelanceJobsListing.md +15 -0
- package/docs/CorporationsFreelanceJobsParticipants.md +15 -0
- package/docs/CorporationsFreelanceJobsParticipantsParticipant.md +17 -0
- package/docs/CorporationsProjectsContribution.md +15 -0
- package/docs/CorporationsProjectsContributors.md +15 -0
- package/docs/CorporationsProjectsContributorsContributor.md +16 -0
- package/docs/CorporationsProjectsDetail.md +23 -0
- package/docs/CorporationsProjectsDetailConfiguration.md +31 -0
- package/docs/CorporationsProjectsDetailConfigurationcapturefwcomplex.md +16 -0
- package/docs/CorporationsProjectsDetailConfigurationcapturefwcomplexLocationsInner.md +16 -0
- package/docs/CorporationsProjectsDetailConfigurationdamageship.md +16 -0
- package/docs/CorporationsProjectsDetailConfigurationdamageshipIdentitiesInner.md +17 -0
- package/docs/CorporationsProjectsDetailConfigurationdamageshipShipsInner.md +15 -0
- package/docs/CorporationsProjectsDetailConfigurationdefendfwcomplex.md +16 -0
- package/docs/CorporationsProjectsDetailConfigurationdeliveritem.md +16 -0
- package/docs/CorporationsProjectsDetailConfigurationdeliveritemDockingLocationsInner.md +15 -0
- package/docs/CorporationsProjectsDetailConfigurationdeliveritemItemsInner.md +15 -0
- package/docs/CorporationsProjectsDetailConfigurationdestroynpc.md +14 -0
- package/docs/CorporationsProjectsDetailConfigurationdestroyship.md +16 -0
- package/docs/CorporationsProjectsDetailConfigurationearnloyaltypoints.md +14 -0
- package/docs/CorporationsProjectsDetailConfigurationlostship.md +16 -0
- package/docs/CorporationsProjectsDetailConfigurationmanufactureitem.md +16 -0
- package/docs/CorporationsProjectsDetailConfigurationmatcherarchetype.md +14 -0
- package/docs/CorporationsProjectsDetailConfigurationmatchercorporation.md +14 -0
- package/docs/CorporationsProjectsDetailConfigurationmatcherfaction.md +14 -0
- package/docs/CorporationsProjectsDetailConfigurationmatchersignature.md +14 -0
- package/docs/CorporationsProjectsDetailConfigurationminematerial.md +15 -0
- package/docs/CorporationsProjectsDetailConfigurationremoteboostshield.md +16 -0
- package/docs/CorporationsProjectsDetailConfigurationremoterepairarmor.md +16 -0
- package/docs/CorporationsProjectsDetailConfigurationsalvagewreck.md +14 -0
- package/docs/CorporationsProjectsDetailConfigurationscansignature.md +15 -0
- package/docs/CorporationsProjectsDetailConfigurationshipinsurance.md +18 -0
- package/docs/CorporationsProjectsDetailConfigurationunknown.md +15 -0
- package/docs/CorporationsProjectsDetailContribution.md +17 -0
- package/docs/CorporationsProjectsDetailCreator.md +15 -0
- package/docs/CorporationsProjectsDetailDetails.md +18 -0
- package/docs/CorporationsProjectsDetailProgress.md +15 -0
- package/docs/CorporationsProjectsDetailProject.md +19 -0
- package/docs/CorporationsProjectsDetailReward.md +15 -0
- package/docs/CorporationsProjectsListing.md +15 -0
- package/docs/Cursor.md +15 -0
- package/docs/DamageShip.md +14 -0
- package/docs/DefendFwComplex.md +14 -0
- package/docs/DeliverItem.md +14 -0
- package/docs/DestroyNpc.md +14 -0
- package/docs/DestroyShip.md +14 -0
- package/docs/DogmaApi.md +30 -15
- package/docs/EarnLoyaltyPoint.md +14 -0
- package/docs/FactionId.md +14 -0
- package/docs/FactionWarfareApi.md +48 -24
- package/docs/FittingsApi.md +18 -9
- package/docs/FleetsApi.md +84 -42
- package/docs/FreelanceJobsApi.md +561 -0
- package/docs/FreelanceJobsDetail.md +23 -0
- package/docs/FreelanceJobsDetailAccessandvisibility.md +16 -0
- package/docs/FreelanceJobsDetailBroadcastlocations.md +15 -0
- package/docs/FreelanceJobsDetailConfiguration.md +16 -0
- package/docs/FreelanceJobsDetailConfigurationParametersValue.md +17 -0
- package/docs/FreelanceJobsDetailContribution.md +18 -0
- package/docs/FreelanceJobsDetailCreator.md +15 -0
- package/docs/FreelanceJobsDetailCreatorcharacter.md +15 -0
- package/docs/FreelanceJobsDetailCreatorcorporation.md +15 -0
- package/docs/FreelanceJobsDetailDetails.md +19 -0
- package/docs/FreelanceJobsDetailFreelancejob.md +19 -0
- package/docs/FreelanceJobsDetailParameterboolean.md +14 -0
- package/docs/FreelanceJobsDetailParametercorporationitemdelivery.md +15 -0
- package/docs/FreelanceJobsDetailParametermatcher.md +14 -0
- package/docs/FreelanceJobsDetailParametermatchervalue.md +15 -0
- package/docs/FreelanceJobsDetailParameteroptions.md +14 -0
- package/docs/FreelanceJobsDetailProgress.md +15 -0
- package/docs/FreelanceJobsDetailRestrictions.md +15 -0
- package/docs/FreelanceJobsDetailReward.md +15 -0
- package/docs/FreelanceJobsListing.md +15 -0
- package/docs/GroupId.md +14 -0
- package/docs/GroupId1.md +14 -0
- package/docs/IncursionsApi.md +6 -3
- package/docs/IndustryApi.md +48 -24
- package/docs/InsuranceApi.md +6 -3
- package/docs/KillmailsApi.md +18 -9
- package/docs/LocationApi.md +18 -9
- package/docs/LostShip.md +14 -0
- package/docs/LoyaltyApi.md +12 -6
- package/docs/MailApi.md +54 -27
- package/docs/Manual.md +14 -0
- package/docs/ManufactureItem.md +14 -0
- package/docs/MarketApi.md +66 -33
- package/docs/Matcher.md +14 -0
- package/docs/MetaApi.md +95 -8
- package/docs/MetaChangelogEntry.md +1 -1
- package/docs/MetaStatus.md +14 -0
- package/docs/MetaStatusRoutestatus.md +16 -0
- package/docs/MineMaterial.md +14 -0
- package/docs/ModelBoolean.md +14 -0
- package/docs/Options.md +14 -0
- package/docs/PlanetaryInteractionApi.md +24 -12
- package/docs/RegionId.md +14 -0
- package/docs/RemoteBoostShield.md +14 -0
- package/docs/RemoteRepairArmor.md +14 -0
- package/docs/Route.md +14 -0
- package/docs/RouteConnection.md +15 -0
- package/docs/RouteRequestBody.md +17 -0
- package/docs/RoutesApi.md +24 -27
- package/docs/SalvageWreck.md +14 -0
- package/docs/ScanSignature.md +14 -0
- package/docs/SearchApi.md +6 -3
- package/docs/ShipInsurance.md +14 -0
- package/docs/SkillsApi.md +18 -9
- package/docs/SolarSystemId.md +14 -0
- package/docs/SovereigntyApi.md +18 -9
- package/docs/StationId.md +14 -0
- package/docs/StatusApi.md +6 -3
- package/docs/StructureId.md +14 -0
- package/docs/TypeId.md +14 -0
- package/docs/UniverseApi.md +180 -90
- package/docs/Unknown.md +14 -0
- package/docs/UserInterfaceApi.md +30 -15
- package/docs/WalletApi.md +36 -18
- package/docs/WarsApi.md +18 -9
- package/esisl_genoa_client-0.1.6.tgz +0 -0
- package/package.json +1 -1
- package/src/apis/AllianceApi.ts +70 -25
- package/src/apis/AssetsApi.ts +104 -37
- package/src/apis/CalendarApi.ts +70 -25
- package/src/apis/CharacterApi.ts +240 -89
- package/src/apis/ClonesApi.ts +36 -13
- package/src/apis/ContactsApi.ts +155 -55
- package/src/apis/ContractsApi.ts +155 -55
- package/src/apis/CorporationApi.ts +376 -137
- package/src/apis/CorporationProjectsApi.ts +667 -0
- package/src/apis/DogmaApi.ts +87 -31
- package/src/apis/FactionWarfareApi.ts +138 -49
- package/src/apis/FittingsApi.ts +53 -19
- package/src/apis/FleetsApi.ts +240 -85
- package/src/apis/FreelanceJobsApi.ts +907 -0
- package/src/apis/IncursionsApi.ts +19 -7
- package/src/apis/IndustryApi.ts +138 -49
- package/src/apis/InsuranceApi.ts +19 -7
- package/src/apis/KillmailsApi.ts +53 -19
- package/src/apis/LocationApi.ts +53 -19
- package/src/apis/LoyaltyApi.ts +36 -13
- package/src/apis/MailApi.ts +155 -63
- package/src/apis/MarketApi.ts +189 -67
- package/src/apis/MetaApi.ts +156 -13
- package/src/apis/PlanetaryInteractionApi.ts +70 -25
- package/src/apis/RoutesApi.ts +67 -66
- package/src/apis/SearchApi.ts +19 -7
- package/src/apis/SkillsApi.ts +53 -19
- package/src/apis/SovereigntyApi.ts +53 -19
- package/src/apis/StatusApi.ts +19 -7
- package/src/apis/UniverseApi.ts +512 -181
- package/src/apis/UserInterfaceApi.ts +87 -31
- package/src/apis/WalletApi.ts +104 -41
- package/src/apis/WarsApi.ts +53 -19
- package/src/apis/index.ts +2 -0
- package/src/constants.ts +10 -0
- package/src/index.ts +1 -0
- package/src/models/index.ts +2374 -308
- package/src/runtime.ts +14 -225
- package/esisl_genoa_client-0.1.0.tgz +0 -0
- package/esisl_genoa_client-0.1.1.tgz +0 -0
package/src/runtime.ts
CHANGED
|
@@ -1,32 +1,14 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
* The version of the OpenAPI document: 2020-01-01
|
|
8
|
-
* Contact: arcyfa_github@pm.me
|
|
9
|
-
*
|
|
10
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
-
* https://openapi-generator.tech
|
|
12
|
-
* Do not edit the class manually.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export const BASE_PATH = "https://esi.evetech.net".replace(/\/+$/, "");
|
|
3
|
+
/*
|
|
4
|
+
This is no longer a working api it simply a service layer to call esi.proxy
|
|
5
|
+
*/
|
|
17
6
|
|
|
18
7
|
export interface ConfigurationParameters {
|
|
19
|
-
|
|
20
|
-
fetchApi?: FetchAPI; // override for fetch implementation
|
|
21
|
-
middleware?: Middleware[]; // middleware to apply before/after fetch requests
|
|
8
|
+
|
|
22
9
|
queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings
|
|
23
|
-
username?: string; // parameter for basic security
|
|
24
|
-
password?: string; // parameter for basic security
|
|
25
|
-
apiKey?: string | Promise<string> | ((name: string) => string | Promise<string>); // parameter for apiKey security
|
|
26
|
-
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>); // parameter for oauth2 security
|
|
27
10
|
headers?: HTTPHeaders; //header params we want to use on every request
|
|
28
|
-
|
|
29
|
-
apiFacade?: any; // external facade that provides `.esi.proxy(...)`
|
|
11
|
+
apiFacade?: apiFacade; // external facade that provides `.esi.proxy(...)`
|
|
30
12
|
}
|
|
31
13
|
|
|
32
14
|
export class Configuration {
|
|
@@ -36,54 +18,14 @@ export class Configuration {
|
|
|
36
18
|
this.configuration = configuration;
|
|
37
19
|
}
|
|
38
20
|
|
|
39
|
-
get basePath(): string {
|
|
40
|
-
return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
get fetchApi(): FetchAPI | undefined {
|
|
44
|
-
return this.configuration.fetchApi;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
get middleware(): Middleware[] {
|
|
48
|
-
return this.configuration.middleware || [];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
21
|
get queryParamsStringify(): (params: HTTPQuery) => string {
|
|
52
22
|
return this.configuration.queryParamsStringify || querystring;
|
|
53
23
|
}
|
|
54
24
|
|
|
55
|
-
get username(): string | undefined {
|
|
56
|
-
return this.configuration.username;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
get password(): string | undefined {
|
|
60
|
-
return this.configuration.password;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
get apiKey(): ((name: string) => string | Promise<string>) | undefined {
|
|
64
|
-
const apiKey = this.configuration.apiKey;
|
|
65
|
-
if (apiKey) {
|
|
66
|
-
return typeof apiKey === 'function' ? apiKey : () => apiKey;
|
|
67
|
-
}
|
|
68
|
-
return undefined;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined {
|
|
72
|
-
const accessToken = this.configuration.accessToken;
|
|
73
|
-
if (accessToken) {
|
|
74
|
-
return typeof accessToken === 'function' ? accessToken : async () => accessToken;
|
|
75
|
-
}
|
|
76
|
-
return undefined;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
25
|
get headers(): HTTPHeaders | undefined {
|
|
80
26
|
return this.configuration.headers;
|
|
81
27
|
}
|
|
82
28
|
|
|
83
|
-
get credentials(): RequestCredentials | undefined {
|
|
84
|
-
return this.configuration.credentials;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
29
|
get apiFacade(): any | undefined {
|
|
88
30
|
return this.configuration.apiFacade;
|
|
89
31
|
}
|
|
@@ -96,27 +38,8 @@ export const DefaultConfig = new Configuration();
|
|
|
96
38
|
*/
|
|
97
39
|
export class BaseAPI {
|
|
98
40
|
|
|
99
|
-
private static readonly jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
|
|
100
|
-
private middleware: Middleware[];
|
|
101
|
-
|
|
102
41
|
constructor(protected configuration = DefaultConfig) {
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]) {
|
|
107
|
-
const next = this.clone<T>();
|
|
108
|
-
next.middleware = next.middleware.concat(...middlewares);
|
|
109
|
-
return next;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware['pre']>) {
|
|
113
|
-
const middlewares = preMiddlewares.map((pre) => ({ pre }));
|
|
114
|
-
return this.withMiddleware<T>(...middlewares);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>) {
|
|
118
|
-
const middlewares = postMiddlewares.map((post) => ({ post }));
|
|
119
|
-
return this.withMiddleware<T>(...middlewares);
|
|
42
|
+
|
|
120
43
|
}
|
|
121
44
|
|
|
122
45
|
/**
|
|
@@ -136,146 +59,10 @@ export class BaseAPI {
|
|
|
136
59
|
return BaseAPI.jsonRegex.test(mime);
|
|
137
60
|
}
|
|
138
61
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const response = await this.fetchApi(url, init);
|
|
142
|
-
if (response && (response.status >= 200 && response.status < 300)) {
|
|
143
|
-
return response;
|
|
144
|
-
}
|
|
145
|
-
throw new ResponseError(response, 'Response returned an error code');
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
private async createFetchParams(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction) {
|
|
149
|
-
let url = this.configuration.basePath + context.path;
|
|
150
|
-
if (context.query !== undefined && Object.keys(context.query).length !== 0) {
|
|
151
|
-
// only add the querystring to the URL if there are query parameters.
|
|
152
|
-
// this is done to avoid urls ending with a "?" character which buggy webservers
|
|
153
|
-
// do not handle correctly sometimes.
|
|
154
|
-
url += '?' + this.configuration.queryParamsStringify(context.query);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
const headers = Object.assign({}, this.configuration.headers, context.headers);
|
|
158
|
-
Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {});
|
|
159
|
-
|
|
160
|
-
const initOverrideFn =
|
|
161
|
-
typeof initOverrides === "function"
|
|
162
|
-
? initOverrides
|
|
163
|
-
: async () => initOverrides;
|
|
164
|
-
|
|
165
|
-
const initParams = {
|
|
166
|
-
method: context.method,
|
|
167
|
-
headers,
|
|
168
|
-
body: context.body,
|
|
169
|
-
credentials: this.configuration.credentials,
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
const overriddenInit: RequestInit = {
|
|
173
|
-
...initParams,
|
|
174
|
-
...(await initOverrideFn({
|
|
175
|
-
init: initParams,
|
|
176
|
-
context,
|
|
177
|
-
}))
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
let body: any;
|
|
181
|
-
if (isFormData(overriddenInit.body)
|
|
182
|
-
|| (overriddenInit.body instanceof URLSearchParams)
|
|
183
|
-
|| isBlob(overriddenInit.body)) {
|
|
184
|
-
body = overriddenInit.body;
|
|
185
|
-
} else if (this.isJsonMime(headers['Content-Type'])) {
|
|
186
|
-
body = JSON.stringify(overriddenInit.body);
|
|
187
|
-
} else {
|
|
188
|
-
body = overriddenInit.body;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
const init: RequestInit = {
|
|
192
|
-
...overriddenInit,
|
|
193
|
-
body
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
return { url, init };
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
private fetchApi = async (url: string, init: RequestInit) => {
|
|
200
|
-
let fetchParams = { url, init };
|
|
201
|
-
for (const middleware of this.middleware) {
|
|
202
|
-
if (middleware.pre) {
|
|
203
|
-
fetchParams = await middleware.pre({
|
|
204
|
-
fetch: this.fetchApi,
|
|
205
|
-
...fetchParams,
|
|
206
|
-
}) || fetchParams;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
let response: Response | undefined = undefined;
|
|
210
|
-
try {
|
|
211
|
-
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
|
|
212
|
-
} catch (e) {
|
|
213
|
-
for (const middleware of this.middleware) {
|
|
214
|
-
if (middleware.onError) {
|
|
215
|
-
response = await middleware.onError({
|
|
216
|
-
fetch: this.fetchApi,
|
|
217
|
-
url: fetchParams.url,
|
|
218
|
-
init: fetchParams.init,
|
|
219
|
-
error: e,
|
|
220
|
-
response: response ? response.clone() : undefined,
|
|
221
|
-
}) || response;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
if (response === undefined) {
|
|
225
|
-
if (e instanceof Error) {
|
|
226
|
-
throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
|
|
227
|
-
} else {
|
|
228
|
-
throw e;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
for (const middleware of this.middleware) {
|
|
233
|
-
if (middleware.post) {
|
|
234
|
-
response = await middleware.post({
|
|
235
|
-
fetch: this.fetchApi,
|
|
236
|
-
url: fetchParams.url,
|
|
237
|
-
init: fetchParams.init,
|
|
238
|
-
response: response.clone(),
|
|
239
|
-
}) || response;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
return response;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Create a shallow clone of `this` by constructing a new instance
|
|
247
|
-
* and then shallow cloning data members.
|
|
248
|
-
*/
|
|
249
|
-
private clone<T extends BaseAPI>(this: T): T {
|
|
250
|
-
const constructor = this.constructor as any;
|
|
251
|
-
const next = new constructor(this.configuration);
|
|
252
|
-
next.middleware = this.middleware.slice();
|
|
253
|
-
return next;
|
|
254
|
-
}
|
|
62
|
+
private static readonly jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
|
|
63
|
+
|
|
255
64
|
};
|
|
256
65
|
|
|
257
|
-
function isBlob(value: any): value is Blob {
|
|
258
|
-
return typeof Blob !== 'undefined' && value instanceof Blob;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
function isFormData(value: any): value is FormData {
|
|
262
|
-
return typeof FormData !== "undefined" && value instanceof FormData;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
export class ResponseError extends Error {
|
|
266
|
-
override name: "ResponseError" = "ResponseError";
|
|
267
|
-
constructor(public response: Response, msg?: string) {
|
|
268
|
-
super(msg);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
export class FetchError extends Error {
|
|
273
|
-
override name: "FetchError" = "FetchError";
|
|
274
|
-
constructor(public cause: Error, msg?: string) {
|
|
275
|
-
super(msg);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
66
|
export class RequiredError extends Error {
|
|
280
67
|
override name: "RequiredError" = "RequiredError";
|
|
281
68
|
constructor(public field: string, msg?: string) {
|
|
@@ -290,7 +77,7 @@ export const COLLECTION_FORMATS = {
|
|
|
290
77
|
pipes: "|",
|
|
291
78
|
};
|
|
292
79
|
|
|
293
|
-
export type
|
|
80
|
+
export type apiFacade = any;
|
|
294
81
|
|
|
295
82
|
export type Json = any;
|
|
296
83
|
export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
|
|
@@ -302,11 +89,13 @@ export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'o
|
|
|
302
89
|
|
|
303
90
|
export type InitOverrideFunction = (requestContext: { init: HTTPRequestInit, context: RequestOpts }) => Promise<RequestInit>
|
|
304
91
|
|
|
92
|
+
|
|
305
93
|
export interface FetchParams {
|
|
306
94
|
url: string;
|
|
307
95
|
init: RequestInit;
|
|
308
96
|
}
|
|
309
97
|
|
|
98
|
+
|
|
310
99
|
export interface RequestOpts {
|
|
311
100
|
path: string;
|
|
312
101
|
method: HTTPMethod;
|
|
@@ -362,20 +151,20 @@ export interface Consume {
|
|
|
362
151
|
}
|
|
363
152
|
|
|
364
153
|
export interface RequestContext {
|
|
365
|
-
fetch:
|
|
154
|
+
fetch: apiFacade;
|
|
366
155
|
url: string;
|
|
367
156
|
init: RequestInit;
|
|
368
157
|
}
|
|
369
158
|
|
|
370
159
|
export interface ResponseContext {
|
|
371
|
-
fetch:
|
|
160
|
+
fetch: apiFacade;
|
|
372
161
|
url: string;
|
|
373
162
|
init: RequestInit;
|
|
374
163
|
response: Response;
|
|
375
164
|
}
|
|
376
165
|
|
|
377
166
|
export interface ErrorContext {
|
|
378
|
-
fetch:
|
|
167
|
+
fetch: apiFacade;
|
|
379
168
|
url: string;
|
|
380
169
|
init: RequestInit;
|
|
381
170
|
error: unknown;
|
|
Binary file
|
|
Binary file
|