From 777cb745749862becc3914887feec660f098c098 Mon Sep 17 00:00:00 2001 From: Sirttas Date: Tue, 14 Jul 2026 17:14:07 +0200 Subject: [PATCH] feat(#31): RFollow mammon location rename in the generated client --- docs/mammon-api.yml | 22 +- src/generated/mammon/api.ts | 418 +++++++++++++------------- src/mammon/mammonService.ts | 6 +- src/market/location/MarketLocation.ts | 8 +- 4 files changed, 228 insertions(+), 226 deletions(-) diff --git a/docs/mammon-api.yml b/docs/mammon-api.yml index c5f12f3..154e3ae 100644 --- a/docs/mammon-api.yml +++ b/docs/mammon-api.yml @@ -777,10 +777,11 @@ paths: /locations/{id}: get: tags: - - universe - summary: Resolve a market location id to its name and containing solar system - and region - operationId: resolveLocation + - location + summary: "Resolve a market location id (NPC station or public structure, or\ + \ a private structure reachable by the authenticated caller's characters)\ + \ to its name and containing solar system and region" + operationId: findLocationById parameters: - name: id in: path @@ -795,7 +796,7 @@ paths: content: '*/*': schema: - $ref: "#/components/schemas/MarketLocationResponse" + $ref: "#/components/schemas/DockableLocationResponse" "400": description: Returned when the id is not a market location id "404": @@ -803,9 +804,10 @@ paths: /locations/search: get: tags: - - universe - summary: "Search NPC market locations (stations) whose name contains the given\ - \ text, case-insensitively" + - location + summary: "Search market locations (NPC stations and public structures, plus\ + \ private structures reachable by the authenticated caller's characters) whose\ + \ name contains the given text, case-insensitively" operationId: searchLocations parameters: - name: name @@ -831,7 +833,7 @@ paths: schema: type: array items: - $ref: "#/components/schemas/MarketLocationResponse" + $ref: "#/components/schemas/DockableLocationResponse" "400": description: |- Returned when: @@ -1701,7 +1703,7 @@ components: - regionId - volumeRemain - volumeTotal - MarketLocationResponse: + DockableLocationResponse: type: object description: A market location (NPC station) with its containing solar system and region. diff --git a/src/generated/mammon/api.ts b/src/generated/mammon/api.ts index 3ce5d07..3e46ab4 100644 --- a/src/generated/mammon/api.ts +++ b/src/generated/mammon/api.ts @@ -190,6 +190,35 @@ export interface CreateMainLedgerRequest { */ 'name': string; } +/** + * A market location (NPC station) with its containing solar system and region. + */ +export interface DockableLocationResponse { + /** + * EVE market location id (station id). + */ + 'id': number; + /** + * Location name. + */ + 'name': string; + /** + * Id of the solar system the location is in. + */ + 'systemId': number; + /** + * Name of the solar system the location is in. + */ + 'systemName': string; + /** + * Id of the region the location is in. + */ + 'regionId': number; + /** + * Name of the region the location is in. + */ + 'regionName': string; +} /** * Quartile statistics computed over a market type\'s price history. */ @@ -368,35 +397,6 @@ export interface MarketHistoryResponse { */ 'volume': number; } -/** - * A market location (NPC station) with its containing solar system and region. - */ -export interface MarketLocationResponse { - /** - * EVE market location id (station id). - */ - 'id': number; - /** - * Location name. - */ - 'name': string; - /** - * Id of the solar system the location is in. - */ - 'systemId': number; - /** - * Name of the solar system the location is in. - */ - 'systemName': string; - /** - * Id of the region the location is in. - */ - 'regionId': number; - /** - * Name of the region the location is in. - */ - 'regionName': string; -} /** * An open market order placed by one of the authenticated user\'s characters. */ @@ -2073,6 +2073,186 @@ export class LedgerApi extends BaseAPI { +/** + * LocationApi - axios parameter creator + */ +export const LocationApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Resolve a market location id (NPC station or public structure, or a private structure reachable by the authenticated caller\'s characters) to its name and containing solar system and region + * @param {number} id Market location id (station id) to resolve, e.g. 60003760 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findLocationById: async (id: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('findLocationById', 'id', id) + const localVarPath = `/locations/{id}` + .replace('{id}', encodeURIComponent(String(id))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Accept'] = '*/*'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Search market locations (NPC stations and public structures, plus private structures reachable by the authenticated caller\'s characters) whose name contains the given text, case-insensitively + * @param {string} name Text to match against the location name, e.g. name=jita + * @param {number} [limit] Maximum number of results to return, defaults to 50 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + searchLocations: async (name: string, limit?: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'name' is not null or undefined + assertParamExists('searchLocations', 'name', name) + const localVarPath = `/locations/search`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (name !== undefined) { + localVarQueryParameter['name'] = name; + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit; + } + + localVarHeaderParameter['Accept'] = '*/*'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * LocationApi - functional programming interface + */ +export const LocationApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = LocationApiAxiosParamCreator(configuration) + return { + /** + * + * @summary Resolve a market location id (NPC station or public structure, or a private structure reachable by the authenticated caller\'s characters) to its name and containing solar system and region + * @param {number} id Market location id (station id) to resolve, e.g. 60003760 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async findLocationById(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.findLocationById(id, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['LocationApi.findLocationById']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * + * @summary Search market locations (NPC stations and public structures, plus private structures reachable by the authenticated caller\'s characters) whose name contains the given text, case-insensitively + * @param {string} name Text to match against the location name, e.g. name=jita + * @param {number} [limit] Maximum number of results to return, defaults to 50 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async searchLocations(name: string, limit?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.searchLocations(name, limit, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['LocationApi.searchLocations']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + +/** + * LocationApi - factory interface + */ +export const LocationApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = LocationApiFp(configuration) + return { + /** + * + * @summary Resolve a market location id (NPC station or public structure, or a private structure reachable by the authenticated caller\'s characters) to its name and containing solar system and region + * @param {number} id Market location id (station id) to resolve, e.g. 60003760 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findLocationById(id: number, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.findLocationById(id, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary Search market locations (NPC stations and public structures, plus private structures reachable by the authenticated caller\'s characters) whose name contains the given text, case-insensitively + * @param {string} name Text to match against the location name, e.g. name=jita + * @param {number} [limit] Maximum number of results to return, defaults to 50 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + searchLocations(name: string, limit?: number, options?: RawAxiosRequestConfig): AxiosPromise> { + return localVarFp.searchLocations(name, limit, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * LocationApi - object-oriented interface + */ +export class LocationApi extends BaseAPI { + /** + * + * @summary Resolve a market location id (NPC station or public structure, or a private structure reachable by the authenticated caller\'s characters) to its name and containing solar system and region + * @param {number} id Market location id (station id) to resolve, e.g. 60003760 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + public findLocationById(id: number, options?: RawAxiosRequestConfig) { + return LocationApiFp(this.configuration).findLocationById(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary Search market locations (NPC stations and public structures, plus private structures reachable by the authenticated caller\'s characters) whose name contains the given text, case-insensitively + * @param {string} name Text to match against the location name, e.g. name=jita + * @param {number} [limit] Maximum number of results to return, defaults to 50 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + public searchLocations(name: string, limit?: number, options?: RawAxiosRequestConfig) { + return LocationApiFp(this.configuration).searchLocations(name, limit, options).then((request) => request(this.axios, this.basePath)); + } +} + + + /** * MarketApi - axios parameter creator */ @@ -3594,183 +3774,3 @@ export class TransactionApi extends BaseAPI { -/** - * UniverseApi - axios parameter creator - */ -export const UniverseApiAxiosParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Resolve a market location id to its name and containing solar system and region - * @param {number} id Market location id (station id) to resolve, e.g. 60003760 - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - resolveLocation: async (id: number, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'id' is not null or undefined - assertParamExists('resolveLocation', 'id', id) - const localVarPath = `/locations/{id}` - .replace('{id}', encodeURIComponent(String(id))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - localVarHeaderParameter['Accept'] = '*/*'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Search NPC market locations (stations) whose name contains the given text, case-insensitively - * @param {string} name Text to match against the location name, e.g. name=jita - * @param {number} [limit] Maximum number of results to return, defaults to 50 - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - searchLocations: async (name: string, limit?: number, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'name' is not null or undefined - assertParamExists('searchLocations', 'name', name) - const localVarPath = `/locations/search`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - if (name !== undefined) { - localVarQueryParameter['name'] = name; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - localVarHeaderParameter['Accept'] = '*/*'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * UniverseApi - functional programming interface - */ -export const UniverseApiFp = function(configuration?: Configuration) { - const localVarAxiosParamCreator = UniverseApiAxiosParamCreator(configuration) - return { - /** - * - * @summary Resolve a market location id to its name and containing solar system and region - * @param {number} id Market location id (station id) to resolve, e.g. 60003760 - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async resolveLocation(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.resolveLocation(id, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['UniverseApi.resolveLocation']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * - * @summary Search NPC market locations (stations) whose name contains the given text, case-insensitively - * @param {string} name Text to match against the location name, e.g. name=jita - * @param {number} [limit] Maximum number of results to return, defaults to 50 - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async searchLocations(name: string, limit?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { - const localVarAxiosArgs = await localVarAxiosParamCreator.searchLocations(name, limit, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['UniverseApi.searchLocations']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - } -}; - -/** - * UniverseApi - factory interface - */ -export const UniverseApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = UniverseApiFp(configuration) - return { - /** - * - * @summary Resolve a market location id to its name and containing solar system and region - * @param {number} id Market location id (station id) to resolve, e.g. 60003760 - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - resolveLocation(id: number, options?: RawAxiosRequestConfig): AxiosPromise { - return localVarFp.resolveLocation(id, options).then((request) => request(axios, basePath)); - }, - /** - * - * @summary Search NPC market locations (stations) whose name contains the given text, case-insensitively - * @param {string} name Text to match against the location name, e.g. name=jita - * @param {number} [limit] Maximum number of results to return, defaults to 50 - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - searchLocations(name: string, limit?: number, options?: RawAxiosRequestConfig): AxiosPromise> { - return localVarFp.searchLocations(name, limit, options).then((request) => request(axios, basePath)); - }, - }; -}; - -/** - * UniverseApi - object-oriented interface - */ -export class UniverseApi extends BaseAPI { - /** - * - * @summary Resolve a market location id to its name and containing solar system and region - * @param {number} id Market location id (station id) to resolve, e.g. 60003760 - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - public resolveLocation(id: number, options?: RawAxiosRequestConfig) { - return UniverseApiFp(this.configuration).resolveLocation(id, options).then((request) => request(this.axios, this.basePath)); - } - - /** - * - * @summary Search NPC market locations (stations) whose name contains the given text, case-insensitively - * @param {string} name Text to match against the location name, e.g. name=jita - * @param {number} [limit] Maximum number of results to return, defaults to 50 - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - public searchLocations(name: string, limit?: number, options?: RawAxiosRequestConfig) { - return UniverseApiFp(this.configuration).searchLocations(name, limit, options).then((request) => request(this.axios, this.basePath)); - } -} - - - diff --git a/src/mammon/mammonService.ts b/src/mammon/mammonService.ts index 8316e53..f73a164 100644 --- a/src/mammon/mammonService.ts +++ b/src/mammon/mammonService.ts @@ -7,13 +7,13 @@ import { AuthApi, CharacterApi, LedgerApi, + LocationApi, MarketApi, MeResponse, ReprocessingApi, RuleBookApi, RuleScriptApi, - TransactionApi, - UniverseApi + TransactionApi } from "@/generated/mammon"; export const mammonUrl = import.meta.env.VITE_MAMMON_URL; @@ -107,4 +107,4 @@ export const activityApi = new ActivityApi(undefined, mammonUrl, mammonAxiosInst export const acquisitionApi = new AcquisitionApi(undefined, mammonUrl, mammonAxiosInstance); export const marketApi = new MarketApi(undefined, mammonUrl, mammonAxiosInstance); export const reprocessingApi = new ReprocessingApi(undefined, mammonUrl, mammonAxiosInstance); -export const universeApi = new UniverseApi(undefined, mammonUrl, mammonAxiosInstance); \ No newline at end of file +export const locationApi = new LocationApi(undefined, mammonUrl, mammonAxiosInstance); \ No newline at end of file diff --git a/src/market/location/MarketLocation.ts b/src/market/location/MarketLocation.ts index 2e133c1..1244d9a 100644 --- a/src/market/location/MarketLocation.ts +++ b/src/market/location/MarketLocation.ts @@ -1,7 +1,7 @@ -import {universeApi} from '@/mammon/mammonService'; -import type {MarketLocationResponse} from '@/generated/mammon'; +import {locationApi} from '@/mammon/mammonService'; +import type {DockableLocationResponse} from '@/generated/mammon'; -export type MarketLocation = MarketLocationResponse; +export type MarketLocation = DockableLocationResponse; const cache = new Map(); @@ -24,7 +24,7 @@ export const searchMarketLocations = async (search: string): Promise r.data); + const locations = await locationApi.searchLocations(search).then(r => r.data); locations.forEach(l => cache.set(l.id, l)); return locations.toSorted((a, b) => hubRank(a.id) - hubRank(b.id)); };