item search
This commit is contained in:
@@ -480,6 +480,42 @@ paths:
|
||||
Returned when:
|
||||
- the ids parameter is missing
|
||||
- an ids value is not a numeric id
|
||||
/market/types/search:
|
||||
get:
|
||||
tags:
|
||||
- market
|
||||
summary: "Search marketable types whose name contains the given text, case-insensitively"
|
||||
operationId: searchTypes
|
||||
parameters:
|
||||
- name: name
|
||||
in: query
|
||||
description: "Text to match against the type name, e.g. name=tritan"
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
- name: limit
|
||||
in: query
|
||||
description: "Maximum number of results to return, defaults to 50"
|
||||
required: false
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
default: 50
|
||||
responses:
|
||||
"200":
|
||||
description: "The marketable types matching the search, ordered by name\
|
||||
\ and capped at the requested limit"
|
||||
content:
|
||||
'*/*':
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/MarketTypeResponse"
|
||||
"400":
|
||||
description: |-
|
||||
Returned when:
|
||||
- the name parameter is missing
|
||||
- the limit value is not a number
|
||||
/market/scan:
|
||||
get:
|
||||
tags:
|
||||
|
||||
@@ -1490,6 +1490,48 @@ export const MarketApiAxiosParamCreator = function (configuration?: Configuratio
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
|
||||
return {
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary Search marketable types whose name contains the given text, case-insensitively
|
||||
* @param {string} name Text to match against the type name, e.g. name=tritan
|
||||
* @param {number} [limit] Maximum number of results to return, defaults to 50
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
searchTypes: async (name: string, limit?: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'name' is not null or undefined
|
||||
assertParamExists('searchTypes', 'name', name)
|
||||
const localVarPath = `/market/types/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,
|
||||
@@ -1575,6 +1617,20 @@ export const MarketApiFp = function(configuration?: Configuration) {
|
||||
const localVarOperationServerBasePath = operationServerMap['MarketApi.scanMarketType']?.[localVarOperationServerIndex]?.url;
|
||||
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary Search marketable types whose name contains the given text, case-insensitively
|
||||
* @param {string} name Text to match against the type name, e.g. name=tritan
|
||||
* @param {number} [limit] Maximum number of results to return, defaults to 50
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async searchTypes(name: string, limit?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<MarketTypeResponse>>> {
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.searchTypes(name, limit, options);
|
||||
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
||||
const localVarOperationServerBasePath = operationServerMap['MarketApi.searchTypes']?.[localVarOperationServerIndex]?.url;
|
||||
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1640,6 +1696,17 @@ export const MarketApiFactory = function (configuration?: Configuration, basePat
|
||||
scanMarketType(marketTypeId: number, days?: number, brokerFee?: number, salesTax?: number, options?: RawAxiosRequestConfig): AxiosPromise<MarketScanResponse> {
|
||||
return localVarFp.scanMarketType(marketTypeId, days, brokerFee, salesTax, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary Search marketable types whose name contains the given text, case-insensitively
|
||||
* @param {string} name Text to match against the type name, e.g. name=tritan
|
||||
* @param {number} [limit] Maximum number of results to return, defaults to 50
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
searchTypes(name: string, limit?: number, options?: RawAxiosRequestConfig): AxiosPromise<Array<MarketTypeResponse>> {
|
||||
return localVarFp.searchTypes(name, limit, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1707,6 +1774,18 @@ export class MarketApi extends BaseAPI {
|
||||
public scanMarketType(marketTypeId: number, days?: number, brokerFee?: number, salesTax?: number, options?: RawAxiosRequestConfig) {
|
||||
return MarketApiFp(this.configuration).scanMarketType(marketTypeId, days, brokerFee, salesTax, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Search marketable types whose name contains the given text, case-insensitively
|
||||
* @param {string} name Text to match against the type name, e.g. name=tritan
|
||||
* @param {number} [limit] Maximum number of results to return, defaults to 50
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
public searchTypes(name: string, limit?: number, options?: RawAxiosRequestConfig) {
|
||||
return MarketApiFp(this.configuration).searchTypes(name, limit, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,6 +30,11 @@ export const getMarketTypes = async (types: (string | number)[]): Promise<Market
|
||||
return ids.map(id => cache.get(id)).filter((t): t is MarketType => t !== undefined);
|
||||
}
|
||||
|
||||
export const searchMarketTypes = async (_search: string): Promise<MarketType[]> => {
|
||||
return []
|
||||
export const searchMarketTypes = async (search: string): Promise<MarketType[]> => {
|
||||
if (search.length === 0) {
|
||||
return [];
|
||||
}
|
||||
const types = await marketApi.searchTypes(search).then(r => r.data);
|
||||
types.forEach(t => cache.set(t.id, t));
|
||||
return types;
|
||||
}
|
||||
Reference in New Issue
Block a user