/* tslint:disable */ /* eslint-disable */ /** * 统一管理平台API文档 * 包含模块:会员、账号、商品、支付、咨询、营销 * * OpenAPI spec version: 2.0 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; import { Configuration } from '../configuration'; // Some imports not used depending on template conditions // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; import { Resource } from '../models'; import { ResponseResult } from '../models'; /** * ResourceManageControllerApi - axios parameter creator * @export */ export const ResourceManageControllerApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * * @param {Resource} [body] * @param {*} [options] Override http request option. * @throws {RequiredError} */ addResource: async (body?: Resource, options: any = {}): Promise => { const localVarPath = `/res/add`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, 'https://example.com'); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; localVarHeaderParameter['Content-Type'] = 'application/json'; const query = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { query.set(key, localVarQueryParameter[key]); } for (const key in options.query) { query.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(query)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @param {string} type * @param {string} resourceId * @param {*} [options] Override http request option. * @throws {RequiredError} */ getResourceInfo: async (type: string, resourceId: string, options: any = {}): Promise => { // verify required parameter 'type' is not null or undefined if (type === null || type === undefined) { throw new RequiredError('type','Required parameter type was null or undefined when calling getResourceInfo.'); } // verify required parameter 'resourceId' is not null or undefined if (resourceId === null || resourceId === undefined) { throw new RequiredError('resourceId','Required parameter resourceId was null or undefined when calling getResourceInfo.'); } const localVarPath = `/res/get/{type}/{resourceId}` .replace(`{${"type"}}`, encodeURIComponent(String(type))) .replace(`{${"resourceId"}}`, encodeURIComponent(String(resourceId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, 'https://example.com'); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const query = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { query.set(key, localVarQueryParameter[key]); } for (const key in options.query) { query.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(query)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, } }; /** * ResourceManageControllerApi - functional programming interface * @export */ export const ResourceManageControllerApiFp = function(configuration?: Configuration) { return { /** * * @param {Resource} [body] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async addResource(body?: Resource, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await ResourceManageControllerApiAxiosParamCreator(configuration).addResource(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @param {string} type * @param {string} resourceId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getResourceInfo(type: string, resourceId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await ResourceManageControllerApiAxiosParamCreator(configuration).getResourceInfo(type, resourceId, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * ResourceManageControllerApi - factory interface * @export */ export const ResourceManageControllerApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * * @param {Resource} [body] * @param {*} [options] Override http request option. * @throws {RequiredError} */ addResource(body?: Resource, options?: any): AxiosPromise { return ResourceManageControllerApiFp(configuration).addResource(body, options).then((request) => request(axios, basePath)); }, /** * * @param {string} type * @param {string} resourceId * @param {*} [options] Override http request option. * @throws {RequiredError} */ getResourceInfo(type: string, resourceId: string, options?: any): AxiosPromise { return ResourceManageControllerApiFp(configuration).getResourceInfo(type, resourceId, options).then((request) => request(axios, basePath)); }, }; }; /** * ResourceManageControllerApi - object-oriented interface * @export * @class ResourceManageControllerApi * @extends {BaseAPI} */ export class ResourceManageControllerApi extends BaseAPI { /** * * @param {Resource} [body] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ResourceManageControllerApi */ public addResource(body?: Resource, options?: any) { return ResourceManageControllerApiFp(this.configuration).addResource(body, options).then((request) => request(this.axios, this.basePath)); } /** * * @param {string} type * @param {string} resourceId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ResourceManageControllerApi */ public getResourceInfo(type: string, resourceId: string, options?: any) { return ResourceManageControllerApiFp(this.configuration).getResourceInfo(type, resourceId, options).then((request) => request(this.axios, this.basePath)); } }