esisl_genoa_client 0.1.0 → 0.1.5
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 +117 -5
- package/dist/apis/AllianceApi.d.ts +17 -17
- package/dist/apis/AllianceApi.js +53 -38
- package/dist/apis/AssetsApi.d.ts +25 -25
- package/dist/apis/AssetsApi.js +79 -56
- package/dist/apis/CalendarApi.d.ts +17 -17
- package/dist/apis/CalendarApi.js +53 -39
- package/dist/apis/CharacterApi.d.ts +57 -57
- package/dist/apis/CharacterApi.js +183 -134
- package/dist/apis/ClonesApi.d.ts +9 -9
- package/dist/apis/ClonesApi.js +27 -20
- package/dist/apis/ContactsApi.d.ts +37 -37
- package/dist/apis/ContactsApi.js +118 -85
- package/dist/apis/ContractsApi.d.ts +37 -37
- package/dist/apis/ContractsApi.js +118 -83
- package/dist/apis/CorporationApi.d.ts +89 -89
- package/dist/apis/CorporationApi.js +287 -206
- package/dist/apis/CorporationProjectsApi.d.ts +284 -0
- package/dist/apis/CorporationProjectsApi.js +491 -0
- package/dist/apis/DogmaApi.d.ts +21 -21
- package/dist/apis/DogmaApi.js +66 -47
- package/dist/apis/FactionWarfareApi.d.ts +33 -33
- package/dist/apis/FactionWarfareApi.js +105 -74
- package/dist/apis/FittingsApi.d.ts +13 -13
- package/dist/apis/FittingsApi.js +40 -30
- package/dist/apis/FleetsApi.d.ts +57 -57
- package/dist/apis/FleetsApi.js +183 -136
- package/dist/apis/FreelanceJobsApi.d.ts +386 -0
- package/dist/apis/FreelanceJobsApi.js +656 -0
- package/dist/apis/IncursionsApi.d.ts +5 -5
- package/dist/apis/IncursionsApi.js +14 -11
- package/dist/apis/IndustryApi.d.ts +33 -33
- package/dist/apis/IndustryApi.js +105 -74
- package/dist/apis/InsuranceApi.d.ts +5 -5
- package/dist/apis/InsuranceApi.js +14 -11
- package/dist/apis/KillmailsApi.d.ts +13 -13
- package/dist/apis/KillmailsApi.js +40 -29
- package/dist/apis/LocationApi.d.ts +13 -13
- package/dist/apis/LocationApi.js +40 -29
- package/dist/apis/LoyaltyApi.d.ts +9 -9
- package/dist/apis/LoyaltyApi.js +27 -20
- package/dist/apis/MailApi.d.ts +37 -37
- package/dist/apis/MailApi.js +118 -98
- package/dist/apis/MarketApi.d.ts +45 -45
- package/dist/apis/MarketApi.js +144 -101
- package/dist/apis/MetaApi.d.ts +64 -10
- package/dist/apis/MetaApi.js +114 -21
- package/dist/apis/PlanetaryInteractionApi.d.ts +17 -17
- package/dist/apis/PlanetaryInteractionApi.js +53 -38
- package/dist/apis/RoutesApi.d.ts +27 -39
- package/dist/apis/RoutesApi.js +50 -61
- package/dist/apis/SearchApi.d.ts +5 -5
- package/dist/apis/SearchApi.js +14 -11
- package/dist/apis/SkillsApi.d.ts +13 -13
- package/dist/apis/SkillsApi.js +40 -29
- package/dist/apis/SovereigntyApi.d.ts +13 -13
- package/dist/apis/SovereigntyApi.js +40 -29
- package/dist/apis/StatusApi.d.ts +5 -5
- package/dist/apis/StatusApi.js +14 -11
- package/dist/apis/UniverseApi.d.ts +121 -121
- package/dist/apis/UniverseApi.js +391 -272
- package/dist/apis/UserInterfaceApi.d.ts +21 -21
- package/dist/apis/UserInterfaceApi.js +66 -52
- package/dist/apis/WalletApi.d.ts +25 -25
- package/dist/apis/WalletApi.js +79 -62
- package/dist/apis/WarsApi.d.ts +13 -13
- package/dist/apis/WarsApi.js +40 -29
- package/dist/apis/index.d.ts +2 -0
- package/dist/apis/index.js +2 -0
- package/dist/models/index.d.ts +2339 -295
- package/dist/models/index.js +165 -2
- package/dist/runtime.d.ts +7 -55
- package/dist/runtime.js +6 -304
- package/docs/AllianceApi.md +8 -8
- package/docs/AllianceId.md +14 -0
- package/docs/AssetsApi.md +12 -12
- package/docs/CalendarApi.md +8 -8
- package/docs/CaptureFwComplex.md +14 -0
- package/docs/CharacterApi.md +28 -28
- package/docs/CharacterId.md +14 -0
- package/docs/CharactersFreelanceJobsListing.md +14 -0
- package/docs/CharactersFreelanceJobsParticipation.md +16 -0
- package/docs/ClonesApi.md +4 -4
- package/docs/ConstellationId.md +14 -0
- package/docs/ContactsApi.md +18 -18
- package/docs/ContractsApi.md +18 -18
- package/docs/CorporationApi.md +44 -44
- package/docs/CorporationId.md +14 -0
- package/docs/CorporationItemDelivery.md +14 -0
- package/docs/CorporationProjectsApi.md +387 -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 +10 -10
- package/docs/EarnLoyaltyPoint.md +14 -0
- package/docs/FactionId.md +14 -0
- package/docs/FactionWarfareApi.md +16 -16
- package/docs/FittingsApi.md +6 -6
- package/docs/FleetsApi.md +28 -28
- package/docs/FreelanceJobsApi.md +546 -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 +2 -2
- package/docs/IndustryApi.md +16 -16
- package/docs/InsuranceApi.md +2 -2
- package/docs/KillmailsApi.md +6 -6
- package/docs/LocationApi.md +6 -6
- package/docs/LostShip.md +14 -0
- package/docs/LoyaltyApi.md +4 -4
- package/docs/MailApi.md +18 -18
- package/docs/Manual.md +14 -0
- package/docs/ManufactureItem.md +14 -0
- package/docs/MarketApi.md +22 -22
- package/docs/Matcher.md +14 -0
- package/docs/MetaApi.md +82 -4
- 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 +8 -8
- 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 +22 -28
- package/docs/SalvageWreck.md +14 -0
- package/docs/ScanSignature.md +14 -0
- package/docs/SearchApi.md +2 -2
- package/docs/ShipInsurance.md +14 -0
- package/docs/SkillsApi.md +6 -6
- package/docs/SolarSystemId.md +14 -0
- package/docs/SovereigntyApi.md +6 -6
- package/docs/StationId.md +14 -0
- package/docs/StatusApi.md +2 -2
- package/docs/StructureId.md +14 -0
- package/docs/TypeId.md +14 -0
- package/docs/UniverseApi.md +60 -60
- package/docs/Unknown.md +14 -0
- package/docs/UserInterfaceApi.md +10 -10
- package/docs/WalletApi.md +12 -12
- package/docs/WarsApi.md +6 -6
- package/esisl_genoa_client-0.1.4.tgz +0 -0
- package/esisl_genoa_client-0.1.5.tgz +0 -0
- package/package.json +1 -1
- package/src/apis/AllianceApi.ts +50 -30
- package/src/apis/AssetsApi.ts +74 -44
- package/src/apis/CalendarApi.ts +50 -30
- package/src/apis/CharacterApi.ts +170 -104
- package/src/apis/ClonesApi.ts +26 -16
- package/src/apis/ContactsApi.ts +110 -65
- package/src/apis/ContractsApi.ts +110 -65
- package/src/apis/CorporationApi.ts +266 -160
- package/src/apis/CorporationProjectsApi.ts +634 -0
- package/src/apis/DogmaApi.ts +62 -37
- package/src/apis/FactionWarfareApi.ts +98 -58
- package/src/apis/FittingsApi.ts +38 -23
- package/src/apis/FleetsApi.ts +170 -100
- package/src/apis/FreelanceJobsApi.ts +846 -0
- package/src/apis/IncursionsApi.ts +14 -9
- package/src/apis/IndustryApi.ts +98 -58
- package/src/apis/InsuranceApi.ts +14 -9
- package/src/apis/KillmailsApi.ts +38 -23
- package/src/apis/LocationApi.ts +38 -23
- package/src/apis/LoyaltyApi.ts +26 -16
- package/src/apis/MailApi.ts +110 -73
- package/src/apis/MarketApi.ts +134 -79
- package/src/apis/MetaApi.ts +135 -16
- package/src/apis/PlanetaryInteractionApi.ts +50 -30
- package/src/apis/RoutesApi.ts +61 -67
- package/src/apis/SearchApi.ts +14 -9
- package/src/apis/SkillsApi.ts +38 -23
- package/src/apis/SovereigntyApi.ts +38 -23
- package/src/apis/StatusApi.ts +14 -9
- package/src/apis/UniverseApi.ts +362 -212
- package/src/apis/UserInterfaceApi.ts +62 -37
- package/src/apis/WalletApi.ts +74 -48
- package/src/apis/WarsApi.ts +38 -23
- package/src/apis/index.ts +2 -0
- package/src/models/index.ts +2374 -308
- package/src/runtime.ts +16 -222
- package/esisl_genoa_client-0.1.0.tgz +0 -0
package/src/runtime.ts
CHANGED
|
@@ -1,31 +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
|
-
|
|
11
|
+
apiFacade?: apiFacade; // external facade that provides `.esi.proxy(...)`
|
|
29
12
|
}
|
|
30
13
|
|
|
31
14
|
export class Configuration {
|
|
@@ -35,52 +18,16 @@ export class Configuration {
|
|
|
35
18
|
this.configuration = configuration;
|
|
36
19
|
}
|
|
37
20
|
|
|
38
|
-
get basePath(): string {
|
|
39
|
-
return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
get fetchApi(): FetchAPI | undefined {
|
|
43
|
-
return this.configuration.fetchApi;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
get middleware(): Middleware[] {
|
|
47
|
-
return this.configuration.middleware || [];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
21
|
get queryParamsStringify(): (params: HTTPQuery) => string {
|
|
51
22
|
return this.configuration.queryParamsStringify || querystring;
|
|
52
23
|
}
|
|
53
24
|
|
|
54
|
-
get username(): string | undefined {
|
|
55
|
-
return this.configuration.username;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
get password(): string | undefined {
|
|
59
|
-
return this.configuration.password;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
get apiKey(): ((name: string) => string | Promise<string>) | undefined {
|
|
63
|
-
const apiKey = this.configuration.apiKey;
|
|
64
|
-
if (apiKey) {
|
|
65
|
-
return typeof apiKey === 'function' ? apiKey : () => apiKey;
|
|
66
|
-
}
|
|
67
|
-
return undefined;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined {
|
|
71
|
-
const accessToken = this.configuration.accessToken;
|
|
72
|
-
if (accessToken) {
|
|
73
|
-
return typeof accessToken === 'function' ? accessToken : async () => accessToken;
|
|
74
|
-
}
|
|
75
|
-
return undefined;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
25
|
get headers(): HTTPHeaders | undefined {
|
|
79
26
|
return this.configuration.headers;
|
|
80
27
|
}
|
|
81
28
|
|
|
82
|
-
get
|
|
83
|
-
return this.configuration.
|
|
29
|
+
get apiFacade(): any | undefined {
|
|
30
|
+
return this.configuration.apiFacade;
|
|
84
31
|
}
|
|
85
32
|
}
|
|
86
33
|
|
|
@@ -91,27 +38,8 @@ export const DefaultConfig = new Configuration();
|
|
|
91
38
|
*/
|
|
92
39
|
export class BaseAPI {
|
|
93
40
|
|
|
94
|
-
private static readonly jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
|
|
95
|
-
private middleware: Middleware[];
|
|
96
|
-
|
|
97
41
|
constructor(protected configuration = DefaultConfig) {
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]) {
|
|
102
|
-
const next = this.clone<T>();
|
|
103
|
-
next.middleware = next.middleware.concat(...middlewares);
|
|
104
|
-
return next;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware['pre']>) {
|
|
108
|
-
const middlewares = preMiddlewares.map((pre) => ({ pre }));
|
|
109
|
-
return this.withMiddleware<T>(...middlewares);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>) {
|
|
113
|
-
const middlewares = postMiddlewares.map((post) => ({ post }));
|
|
114
|
-
return this.withMiddleware<T>(...middlewares);
|
|
42
|
+
|
|
115
43
|
}
|
|
116
44
|
|
|
117
45
|
/**
|
|
@@ -131,146 +59,10 @@ export class BaseAPI {
|
|
|
131
59
|
return BaseAPI.jsonRegex.test(mime);
|
|
132
60
|
}
|
|
133
61
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const response = await this.fetchApi(url, init);
|
|
137
|
-
if (response && (response.status >= 200 && response.status < 300)) {
|
|
138
|
-
return response;
|
|
139
|
-
}
|
|
140
|
-
throw new ResponseError(response, 'Response returned an error code');
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
private async createFetchParams(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction) {
|
|
144
|
-
let url = this.configuration.basePath + context.path;
|
|
145
|
-
if (context.query !== undefined && Object.keys(context.query).length !== 0) {
|
|
146
|
-
// only add the querystring to the URL if there are query parameters.
|
|
147
|
-
// this is done to avoid urls ending with a "?" character which buggy webservers
|
|
148
|
-
// do not handle correctly sometimes.
|
|
149
|
-
url += '?' + this.configuration.queryParamsStringify(context.query);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const headers = Object.assign({}, this.configuration.headers, context.headers);
|
|
153
|
-
Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {});
|
|
154
|
-
|
|
155
|
-
const initOverrideFn =
|
|
156
|
-
typeof initOverrides === "function"
|
|
157
|
-
? initOverrides
|
|
158
|
-
: async () => initOverrides;
|
|
159
|
-
|
|
160
|
-
const initParams = {
|
|
161
|
-
method: context.method,
|
|
162
|
-
headers,
|
|
163
|
-
body: context.body,
|
|
164
|
-
credentials: this.configuration.credentials,
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
const overriddenInit: RequestInit = {
|
|
168
|
-
...initParams,
|
|
169
|
-
...(await initOverrideFn({
|
|
170
|
-
init: initParams,
|
|
171
|
-
context,
|
|
172
|
-
}))
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
let body: any;
|
|
176
|
-
if (isFormData(overriddenInit.body)
|
|
177
|
-
|| (overriddenInit.body instanceof URLSearchParams)
|
|
178
|
-
|| isBlob(overriddenInit.body)) {
|
|
179
|
-
body = overriddenInit.body;
|
|
180
|
-
} else if (this.isJsonMime(headers['Content-Type'])) {
|
|
181
|
-
body = JSON.stringify(overriddenInit.body);
|
|
182
|
-
} else {
|
|
183
|
-
body = overriddenInit.body;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
const init: RequestInit = {
|
|
187
|
-
...overriddenInit,
|
|
188
|
-
body
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
return { url, init };
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
private fetchApi = async (url: string, init: RequestInit) => {
|
|
195
|
-
let fetchParams = { url, init };
|
|
196
|
-
for (const middleware of this.middleware) {
|
|
197
|
-
if (middleware.pre) {
|
|
198
|
-
fetchParams = await middleware.pre({
|
|
199
|
-
fetch: this.fetchApi,
|
|
200
|
-
...fetchParams,
|
|
201
|
-
}) || fetchParams;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
let response: Response | undefined = undefined;
|
|
205
|
-
try {
|
|
206
|
-
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
|
|
207
|
-
} catch (e) {
|
|
208
|
-
for (const middleware of this.middleware) {
|
|
209
|
-
if (middleware.onError) {
|
|
210
|
-
response = await middleware.onError({
|
|
211
|
-
fetch: this.fetchApi,
|
|
212
|
-
url: fetchParams.url,
|
|
213
|
-
init: fetchParams.init,
|
|
214
|
-
error: e,
|
|
215
|
-
response: response ? response.clone() : undefined,
|
|
216
|
-
}) || response;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
if (response === undefined) {
|
|
220
|
-
if (e instanceof Error) {
|
|
221
|
-
throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
|
|
222
|
-
} else {
|
|
223
|
-
throw e;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
for (const middleware of this.middleware) {
|
|
228
|
-
if (middleware.post) {
|
|
229
|
-
response = await middleware.post({
|
|
230
|
-
fetch: this.fetchApi,
|
|
231
|
-
url: fetchParams.url,
|
|
232
|
-
init: fetchParams.init,
|
|
233
|
-
response: response.clone(),
|
|
234
|
-
}) || response;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
return response;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Create a shallow clone of `this` by constructing a new instance
|
|
242
|
-
* and then shallow cloning data members.
|
|
243
|
-
*/
|
|
244
|
-
private clone<T extends BaseAPI>(this: T): T {
|
|
245
|
-
const constructor = this.constructor as any;
|
|
246
|
-
const next = new constructor(this.configuration);
|
|
247
|
-
next.middleware = this.middleware.slice();
|
|
248
|
-
return next;
|
|
249
|
-
}
|
|
62
|
+
private static readonly jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
|
|
63
|
+
|
|
250
64
|
};
|
|
251
65
|
|
|
252
|
-
function isBlob(value: any): value is Blob {
|
|
253
|
-
return typeof Blob !== 'undefined' && value instanceof Blob;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
function isFormData(value: any): value is FormData {
|
|
257
|
-
return typeof FormData !== "undefined" && value instanceof FormData;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
export class ResponseError extends Error {
|
|
261
|
-
override name: "ResponseError" = "ResponseError";
|
|
262
|
-
constructor(public response: Response, msg?: string) {
|
|
263
|
-
super(msg);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
export class FetchError extends Error {
|
|
268
|
-
override name: "FetchError" = "FetchError";
|
|
269
|
-
constructor(public cause: Error, msg?: string) {
|
|
270
|
-
super(msg);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
|
|
274
66
|
export class RequiredError extends Error {
|
|
275
67
|
override name: "RequiredError" = "RequiredError";
|
|
276
68
|
constructor(public field: string, msg?: string) {
|
|
@@ -285,7 +77,7 @@ export const COLLECTION_FORMATS = {
|
|
|
285
77
|
pipes: "|",
|
|
286
78
|
};
|
|
287
79
|
|
|
288
|
-
export type
|
|
80
|
+
export type apiFacade = any;
|
|
289
81
|
|
|
290
82
|
export type Json = any;
|
|
291
83
|
export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
|
|
@@ -297,11 +89,13 @@ export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'o
|
|
|
297
89
|
|
|
298
90
|
export type InitOverrideFunction = (requestContext: { init: HTTPRequestInit, context: RequestOpts }) => Promise<RequestInit>
|
|
299
91
|
|
|
92
|
+
|
|
300
93
|
export interface FetchParams {
|
|
301
94
|
url: string;
|
|
302
95
|
init: RequestInit;
|
|
303
96
|
}
|
|
304
97
|
|
|
98
|
+
|
|
305
99
|
export interface RequestOpts {
|
|
306
100
|
path: string;
|
|
307
101
|
method: HTTPMethod;
|
|
@@ -357,20 +151,20 @@ export interface Consume {
|
|
|
357
151
|
}
|
|
358
152
|
|
|
359
153
|
export interface RequestContext {
|
|
360
|
-
fetch:
|
|
154
|
+
fetch: apiFacade;
|
|
361
155
|
url: string;
|
|
362
156
|
init: RequestInit;
|
|
363
157
|
}
|
|
364
158
|
|
|
365
159
|
export interface ResponseContext {
|
|
366
|
-
fetch:
|
|
160
|
+
fetch: apiFacade;
|
|
367
161
|
url: string;
|
|
368
162
|
init: RequestInit;
|
|
369
163
|
response: Response;
|
|
370
164
|
}
|
|
371
165
|
|
|
372
166
|
export interface ErrorContext {
|
|
373
|
-
fetch:
|
|
167
|
+
fetch: apiFacade;
|
|
374
168
|
url: string;
|
|
375
169
|
init: RequestInit;
|
|
376
170
|
error: unknown;
|
|
Binary file
|