UNPKG

@hawksightco/swagger-client

Version:

OpenAPI client for Hawksight v2 Public API

282 lines (268 loc) 15.1 kB
/* tslint:disable */ /* eslint-disable */ /** * Hawksight API * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * OpenAPI spec version: 0.0.1 * * * 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, { AxiosResponse, AxiosInstance, AxiosRequestConfig } 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 { AuthGenerateNonceBody } from '../models'; import { AuthGenerateSessionMessageBody } from '../models'; import { AuthRefreshSessionBody } from '../models'; import { InlineResponse400 } from '../models'; import { TransactionMetadata } from '../models'; /** * AuthEndpointsApi - axios parameter creator * @export */ export const AuthEndpointsApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Generates signed message containing nonce, user wallet, and user pda address. * @param {AuthGenerateNonceBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ authGenerateNoncePost: async (body: AuthGenerateNonceBody, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new RequiredError('body','Required parameter body was null or undefined when calling authGenerateNoncePost.'); } const localVarPath = `/auth/generateNonce`; // 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 :AxiosRequestConfig = { 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.params) { query.set(key, options.params[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, }; }, /** * If wallet ownership is proven, this endpoint generates a session message. * @param {AuthGenerateSessionMessageBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ authGenerateSessionMessagePost: async (body: AuthGenerateSessionMessageBody, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new RequiredError('body','Required parameter body was null or undefined when calling authGenerateSessionMessagePost.'); } const localVarPath = `/auth/generateSessionMessage`; // 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 :AxiosRequestConfig = { 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.params) { query.set(key, options.params[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, }; }, /** * Refresh an expiring session by generating new refresh session token and an updated token validity. * @param {AuthRefreshSessionBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ authRefreshSessionPost: async (body: AuthRefreshSessionBody, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new RequiredError('body','Required parameter body was null or undefined when calling authRefreshSessionPost.'); } const localVarPath = `/auth/refreshSession`; // 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 :AxiosRequestConfig = { 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.params) { query.set(key, options.params[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, }; }, } }; /** * AuthEndpointsApi - functional programming interface * @export */ export const AuthEndpointsApiFp = function(configuration?: Configuration) { return { /** * Generates signed message containing nonce, user wallet, and user pda address. * @param {AuthGenerateNonceBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ async authGenerateNoncePost(body: AuthGenerateNonceBody, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<TransactionMetadata>>> { const localVarAxiosArgs = await AuthEndpointsApiAxiosParamCreator(configuration).authGenerateNoncePost(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * If wallet ownership is proven, this endpoint generates a session message. * @param {AuthGenerateSessionMessageBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ async authGenerateSessionMessagePost(body: AuthGenerateSessionMessageBody, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<TransactionMetadata>>> { const localVarAxiosArgs = await AuthEndpointsApiAxiosParamCreator(configuration).authGenerateSessionMessagePost(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * Refresh an expiring session by generating new refresh session token and an updated token validity. * @param {AuthRefreshSessionBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ async authRefreshSessionPost(body: AuthRefreshSessionBody, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<TransactionMetadata>>> { const localVarAxiosArgs = await AuthEndpointsApiAxiosParamCreator(configuration).authRefreshSessionPost(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * AuthEndpointsApi - factory interface * @export */ export const AuthEndpointsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * Generates signed message containing nonce, user wallet, and user pda address. * @param {AuthGenerateNonceBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ async authGenerateNoncePost(body: AuthGenerateNonceBody, options?: AxiosRequestConfig): Promise<AxiosResponse<TransactionMetadata>> { return AuthEndpointsApiFp(configuration).authGenerateNoncePost(body, options).then((request) => request(axios, basePath)); }, /** * If wallet ownership is proven, this endpoint generates a session message. * @param {AuthGenerateSessionMessageBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ async authGenerateSessionMessagePost(body: AuthGenerateSessionMessageBody, options?: AxiosRequestConfig): Promise<AxiosResponse<TransactionMetadata>> { return AuthEndpointsApiFp(configuration).authGenerateSessionMessagePost(body, options).then((request) => request(axios, basePath)); }, /** * Refresh an expiring session by generating new refresh session token and an updated token validity. * @param {AuthRefreshSessionBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ async authRefreshSessionPost(body: AuthRefreshSessionBody, options?: AxiosRequestConfig): Promise<AxiosResponse<TransactionMetadata>> { return AuthEndpointsApiFp(configuration).authRefreshSessionPost(body, options).then((request) => request(axios, basePath)); }, }; }; /** * AuthEndpointsApi - object-oriented interface * @export * @class AuthEndpointsApi * @extends {BaseAPI} */ export class AuthEndpointsApi extends BaseAPI { /** * Generates signed message containing nonce, user wallet, and user pda address. * @param {AuthGenerateNonceBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AuthEndpointsApi */ public async authGenerateNoncePost(body: AuthGenerateNonceBody, options?: AxiosRequestConfig) : Promise<AxiosResponse<TransactionMetadata>> { return AuthEndpointsApiFp(this.configuration).authGenerateNoncePost(body, options).then((request) => request(this.axios, this.basePath)); } /** * If wallet ownership is proven, this endpoint generates a session message. * @param {AuthGenerateSessionMessageBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AuthEndpointsApi */ public async authGenerateSessionMessagePost(body: AuthGenerateSessionMessageBody, options?: AxiosRequestConfig) : Promise<AxiosResponse<TransactionMetadata>> { return AuthEndpointsApiFp(this.configuration).authGenerateSessionMessagePost(body, options).then((request) => request(this.axios, this.basePath)); } /** * Refresh an expiring session by generating new refresh session token and an updated token validity. * @param {AuthRefreshSessionBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AuthEndpointsApi */ public async authRefreshSessionPost(body: AuthRefreshSessionBody, options?: AxiosRequestConfig) : Promise<AxiosResponse<TransactionMetadata>> { return AuthEndpointsApiFp(this.configuration).authRefreshSessionPost(body, options).then((request) => request(this.axios, this.basePath)); } }