\subsection{@generated/api.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ export * from './api/analytics-api'; export * from './api/audit-api'; export * from './api/batch-status-api'; export * from './api/category-api'; export * from './api/charity-api'; export * from './api/chat-api'; export * from './api/donation-request-api'; export * from './api/donations-api'; export * from './api/file-api'; export * from './api/login-api'; export * from './api/money-api'; export * from './api/news-api'; export * from './api/notifications-api'; export * from './api/registration-api'; export * from './api/settings-api'; export * from './api/user-api'; \end{lstlisting} \subsection{@generated/api/analytics-api.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * 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'; // @ts-ignore import { AnalyticsOneMonthProfit } from '../models'; // @ts-ignore import { AnalyticsOneMonthRegistrations } from '../models'; // @ts-ignore import { AnalyticsTopCategory } from '../models'; /** * AnalyticsApi - axios parameter creator * @export */ export const AnalyticsApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Get sum of all donations by month * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiAnalyticsGetDonationsSumByMonthGet: async (options: any = {}): Promise => { const localVarPath = `/api/analytics/get_donations_sum_by_month`; // 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: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * Get number of registrations by month * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiAnalyticsGetRegistrationsCountByMonthGet: async (options: any = {}): Promise => { const localVarPath = `/api/analytics/get_registrations_count_by_month`; // 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: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * Get number of times category was used * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiAnalyticsGetTopCategoriesCountGet: async (options: any = {}): Promise => { const localVarPath = `/api/analytics/get_top_categories_count`; // 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: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, } }; /** * AnalyticsApi - functional programming interface * @export */ export const AnalyticsApiFp = function(configuration?: Configuration) { return { /** * Get sum of all donations by month * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiAnalyticsGetDonationsSumByMonthGet(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { const localVarAxiosArgs = await AnalyticsApiAxiosParamCreator(configuration).apiAnalyticsGetDonationsSumByMonthGet(options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * Get number of registrations by month * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiAnalyticsGetRegistrationsCountByMonthGet(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { const localVarAxiosArgs = await AnalyticsApiAxiosParamCreator(configuration).apiAnalyticsGetRegistrationsCountByMonthGet(options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * Get number of times category was used * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiAnalyticsGetTopCategoriesCountGet(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { const localVarAxiosArgs = await AnalyticsApiAxiosParamCreator(configuration).apiAnalyticsGetTopCategoriesCountGet(options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * AnalyticsApi - factory interface * @export */ export const AnalyticsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * Get sum of all donations by month * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiAnalyticsGetDonationsSumByMonthGet(options?: any): AxiosPromise> { return AnalyticsApiFp(configuration).apiAnalyticsGetDonationsSumByMonthGet(options).then((request) => request(axios, basePath)); }, /** * Get number of registrations by month * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiAnalyticsGetRegistrationsCountByMonthGet(options?: any): AxiosPromise> { return AnalyticsApiFp(configuration).apiAnalyticsGetRegistrationsCountByMonthGet(options).then((request) => request(axios, basePath)); }, /** * Get number of times category was used * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiAnalyticsGetTopCategoriesCountGet(options?: any): AxiosPromise> { return AnalyticsApiFp(configuration).apiAnalyticsGetTopCategoriesCountGet(options).then((request) => request(axios, basePath)); }, }; }; /** * AnalyticsApi - object-oriented interface * @export * @class AnalyticsApi * @extends {BaseAPI} */ export class AnalyticsApi extends BaseAPI { /** * Get sum of all donations by month * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AnalyticsApi */ public apiAnalyticsGetDonationsSumByMonthGet(options?: any) { return AnalyticsApiFp(this.configuration).apiAnalyticsGetDonationsSumByMonthGet(options).then((request) => request(this.axios, this.basePath)); } /** * Get number of registrations by month * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AnalyticsApi */ public apiAnalyticsGetRegistrationsCountByMonthGet(options?: any) { return AnalyticsApiFp(this.configuration).apiAnalyticsGetRegistrationsCountByMonthGet(options).then((request) => request(this.axios, this.basePath)); } /** * Get number of times category was used * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AnalyticsApi */ public apiAnalyticsGetTopCategoriesCountGet(options?: any) { return AnalyticsApiFp(this.configuration).apiAnalyticsGetTopCategoriesCountGet(options).then((request) => request(this.axios, this.basePath)); } } \end{lstlisting} \subsection{@generated/api/audit-api.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * 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'; // @ts-ignore import { AuditResponse } from '../models'; /** * AuditApi - axios parameter creator * @export */ export const AuditApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Get logs of system * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] Sort param * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiAuditGet: async (page?: number, size?: number, sort?: string, options: any = {}): Promise => { const localVarPath = `/api/audit/`; // 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: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (page !== undefined) { localVarQueryParameter['page'] = page; } if (size !== undefined) { localVarQueryParameter['size'] = size; } if (sort !== undefined) { localVarQueryParameter['sort'] = sort; } const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, } }; /** * AuditApi - functional programming interface * @export */ export const AuditApiFp = function(configuration?: Configuration) { return { /** * Get logs of system * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] Sort param * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiAuditGet(page?: number, size?: number, sort?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await AuditApiAxiosParamCreator(configuration).apiAuditGet(page, size, sort, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * AuditApi - factory interface * @export */ export const AuditApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * Get logs of system * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] Sort param * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiAuditGet(page?: number, size?: number, sort?: string, options?: any): AxiosPromise { return AuditApiFp(configuration).apiAuditGet(page, size, sort, options).then((request) => request(axios, basePath)); }, }; }; /** * Request parameters for apiAuditGet operation in AuditApi. * @export * @interface AuditApiApiAuditGetRequest */ export interface AuditApiApiAuditGetRequest { /** * Page number * @type {number} * @memberof AuditApiApiAuditGet */ readonly page?: number /** * Page size * @type {number} * @memberof AuditApiApiAuditGet */ readonly size?: number /** * Sort param * @type {string} * @memberof AuditApiApiAuditGet */ readonly sort?: string } /** * AuditApi - object-oriented interface * @export * @class AuditApi * @extends {BaseAPI} */ export class AuditApi extends BaseAPI { /** * Get logs of system * @param {AuditApiApiAuditGetRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AuditApi */ public apiAuditGet(requestParameters: AuditApiApiAuditGetRequest = {}, options?: any) { return AuditApiFp(this.configuration).apiAuditGet(requestParameters.page, requestParameters.size, requestParameters.sort, options).then((request) => request(this.axios, this.basePath)); } } \end{lstlisting} \subsection{@generated/api/batch-status-api.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * 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'; // @ts-ignore import { BlockchainStatusResponse } from '../models'; /** * BatchStatusApi - axios parameter creator * @export */ export const BatchStatusApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * * @summary Retrieves a list of all operation statuses in blockchain * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] Sort param * @param {Array} [type] Request type * @param {Array} [status] Request status * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiBatchStatusesGet: async (page?: number, size?: number, sort?: string, type?: Array, status?: Array, options: any = {}): Promise => { const localVarPath = `/api/batch-statuses`; // 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: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (page !== undefined) { localVarQueryParameter['page'] = page; } if (size !== undefined) { localVarQueryParameter['size'] = size; } if (sort !== undefined) { localVarQueryParameter['sort'] = sort; } if (type) { localVarQueryParameter['type'] = type; } if (status) { localVarQueryParameter['status'] = status; } const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, } }; /** * BatchStatusApi - functional programming interface * @export */ export const BatchStatusApiFp = function(configuration?: Configuration) { return { /** * * @summary Retrieves a list of all operation statuses in blockchain * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] Sort param * @param {Array} [type] Request type * @param {Array} [status] Request status * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiBatchStatusesGet(page?: number, size?: number, sort?: string, type?: Array, status?: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await BatchStatusApiAxiosParamCreator(configuration).apiBatchStatusesGet(page, size, sort, type, status, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * BatchStatusApi - factory interface * @export */ export const BatchStatusApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * * @summary Retrieves a list of all operation statuses in blockchain * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] Sort param * @param {Array} [type] Request type * @param {Array} [status] Request status * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiBatchStatusesGet(page?: number, size?: number, sort?: string, type?: Array, status?: Array, options?: any): AxiosPromise { return BatchStatusApiFp(configuration).apiBatchStatusesGet(page, size, sort, type, status, options).then((request) => request(axios, basePath)); }, }; }; /** * Request parameters for apiBatchStatusesGet operation in BatchStatusApi. * @export * @interface BatchStatusApiApiBatchStatusesGetRequest */ export interface BatchStatusApiApiBatchStatusesGetRequest { /** * Page number * @type {number} * @memberof BatchStatusApiApiBatchStatusesGet */ readonly page?: number /** * Page size * @type {number} * @memberof BatchStatusApiApiBatchStatusesGet */ readonly size?: number /** * Sort param * @type {string} * @memberof BatchStatusApiApiBatchStatusesGet */ readonly sort?: string /** * Request type * @type {Array} * @memberof BatchStatusApiApiBatchStatusesGet */ readonly type?: Array /** * Request status * @type {Array} * @memberof BatchStatusApiApiBatchStatusesGet */ readonly status?: Array } /** * BatchStatusApi - object-oriented interface * @export * @class BatchStatusApi * @extends {BaseAPI} */ export class BatchStatusApi extends BaseAPI { /** * * @summary Retrieves a list of all operation statuses in blockchain * @param {BatchStatusApiApiBatchStatusesGetRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BatchStatusApi */ public apiBatchStatusesGet(requestParameters: BatchStatusApiApiBatchStatusesGetRequest = {}, options?: any) { return BatchStatusApiFp(this.configuration).apiBatchStatusesGet(requestParameters.page, requestParameters.size, requestParameters.sort, requestParameters.type, requestParameters.status, options).then((request) => request(this.axios, this.basePath)); } } \end{lstlisting} \subsection{@generated/api/category-api.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * 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'; // @ts-ignore import { CategoryAdminCategory } from '../models'; // @ts-ignore import { CategoryDeleteInput } from '../models'; // @ts-ignore import { CategoryUpdateInput } from '../models'; /** * CategoryApi - axios parameter creator * @export */ export const CategoryApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * * @summary Delete categories of fund * @param {CategoryDeleteInput} [body] array of ids to be deleted * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiCategoriesDelete: async (body?: CategoryDeleteInput, options: any = {}): Promise => { const localVarPath = `/api/categories`; // 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: 'DELETE', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; localVarHeaderParameter['Content-Type'] = 'application/json'; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; const nonString = typeof body !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Get categories of fund * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiCategoriesGet: async (options: any = {}): Promise => { const localVarPath = `/api/categories`; // 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: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Create or update existing categories of fund * @param {CategoryUpdateInput} [body] array with new categories * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiCategoriesPost: async (body?: CategoryUpdateInput, options: any = {}): Promise => { const localVarPath = `/api/categories`; // 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 queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; const nonString = typeof body !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, } }; /** * CategoryApi - functional programming interface * @export */ export const CategoryApiFp = function(configuration?: Configuration) { return { /** * * @summary Delete categories of fund * @param {CategoryDeleteInput} [body] array of ids to be deleted * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiCategoriesDelete(body?: CategoryDeleteInput, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await CategoryApiAxiosParamCreator(configuration).apiCategoriesDelete(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Get categories of fund * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiCategoriesGet(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { const localVarAxiosArgs = await CategoryApiAxiosParamCreator(configuration).apiCategoriesGet(options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Create or update existing categories of fund * @param {CategoryUpdateInput} [body] array with new categories * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiCategoriesPost(body?: CategoryUpdateInput, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await CategoryApiAxiosParamCreator(configuration).apiCategoriesPost(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * CategoryApi - factory interface * @export */ export const CategoryApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * * @summary Delete categories of fund * @param {CategoryDeleteInput} [body] array of ids to be deleted * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiCategoriesDelete(body?: CategoryDeleteInput, options?: any): AxiosPromise { return CategoryApiFp(configuration).apiCategoriesDelete(body, options).then((request) => request(axios, basePath)); }, /** * * @summary Get categories of fund * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiCategoriesGet(options?: any): AxiosPromise> { return CategoryApiFp(configuration).apiCategoriesGet(options).then((request) => request(axios, basePath)); }, /** * * @summary Create or update existing categories of fund * @param {CategoryUpdateInput} [body] array with new categories * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiCategoriesPost(body?: CategoryUpdateInput, options?: any): AxiosPromise { return CategoryApiFp(configuration).apiCategoriesPost(body, options).then((request) => request(axios, basePath)); }, }; }; /** * Request parameters for apiCategoriesDelete operation in CategoryApi. * @export * @interface CategoryApiApiCategoriesDeleteRequest */ export interface CategoryApiApiCategoriesDeleteRequest { /** * array of ids to be deleted * @type {CategoryDeleteInput} * @memberof CategoryApiApiCategoriesDelete */ readonly body?: CategoryDeleteInput } /** * Request parameters for apiCategoriesPost operation in CategoryApi. * @export * @interface CategoryApiApiCategoriesPostRequest */ export interface CategoryApiApiCategoriesPostRequest { /** * array with new categories * @type {CategoryUpdateInput} * @memberof CategoryApiApiCategoriesPost */ readonly body?: CategoryUpdateInput } /** * CategoryApi - object-oriented interface * @export * @class CategoryApi * @extends {BaseAPI} */ export class CategoryApi extends BaseAPI { /** * * @summary Delete categories of fund * @param {CategoryApiApiCategoriesDeleteRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CategoryApi */ public apiCategoriesDelete(requestParameters: CategoryApiApiCategoriesDeleteRequest = {}, options?: any) { return CategoryApiFp(this.configuration).apiCategoriesDelete(requestParameters.body, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Get categories of fund * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CategoryApi */ public apiCategoriesGet(options?: any) { return CategoryApiFp(this.configuration).apiCategoriesGet(options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Create or update existing categories of fund * @param {CategoryApiApiCategoriesPostRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CategoryApi */ public apiCategoriesPost(requestParameters: CategoryApiApiCategoriesPostRequest = {}, options?: any) { return CategoryApiFp(this.configuration).apiCategoriesPost(requestParameters.body, options).then((request) => request(this.axios, this.basePath)); } } \end{lstlisting} \subsection{@generated/api/charity-api.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * 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'; // @ts-ignore import { CharityFaq } from '../models'; // @ts-ignore import { CharityFaqInput } from '../models'; // @ts-ignore import { CharityFundInfo } from '../models'; // @ts-ignore import { CharityFundInfoResponse } from '../models'; // @ts-ignore import { CharityFundInput } from '../models'; // @ts-ignore import { UtilsMoneyJson } from '../models'; /** * CharityApi - axios parameter creator * @export */ export const CharityApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * * @summary Get balance of charity * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiCharityBalanceGet: async (options: any = {}): Promise => { const localVarPath = `/api/charity/balance`; // 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: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Get fund\'s faq * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiCharityFaqGet: async (options: any = {}): Promise => { const localVarPath = `/api/charity/faq`; // 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: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Update fund\'s faq * @param {CharityFaqInput} [body] faq * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiCharityFaqPatch: async (body?: CharityFaqInput, options: any = {}): Promise => { const localVarPath = `/api/charity/faq`; // 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: 'PATCH', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; localVarHeaderParameter['Content-Type'] = 'application/json'; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; const nonString = typeof body !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Get info about fund * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiCharityGet: async (options: any = {}): Promise => { const localVarPath = `/api/charity`; // 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: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Update info about fund * @param {CharityFundInput} [body] input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiCharityPatch: async (body?: CharityFundInput, options: any = {}): Promise => { const localVarPath = `/api/charity`; // 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: 'PATCH', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; localVarHeaderParameter['Content-Type'] = 'application/json'; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; const nonString = typeof body !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, } }; /** * CharityApi - functional programming interface * @export */ export const CharityApiFp = function(configuration?: Configuration) { return { /** * * @summary Get balance of charity * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiCharityBalanceGet(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await CharityApiAxiosParamCreator(configuration).apiCharityBalanceGet(options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Get fund\'s faq * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiCharityFaqGet(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await CharityApiAxiosParamCreator(configuration).apiCharityFaqGet(options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Update fund\'s faq * @param {CharityFaqInput} [body] faq * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiCharityFaqPatch(body?: CharityFaqInput, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await CharityApiAxiosParamCreator(configuration).apiCharityFaqPatch(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Get info about fund * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiCharityGet(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await CharityApiAxiosParamCreator(configuration).apiCharityGet(options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Update info about fund * @param {CharityFundInput} [body] input * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiCharityPatch(body?: CharityFundInput, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await CharityApiAxiosParamCreator(configuration).apiCharityPatch(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * CharityApi - factory interface * @export */ export const CharityApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * * @summary Get balance of charity * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiCharityBalanceGet(options?: any): AxiosPromise { return CharityApiFp(configuration).apiCharityBalanceGet(options).then((request) => request(axios, basePath)); }, /** * * @summary Get fund\'s faq * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiCharityFaqGet(options?: any): AxiosPromise { return CharityApiFp(configuration).apiCharityFaqGet(options).then((request) => request(axios, basePath)); }, /** * * @summary Update fund\'s faq * @param {CharityFaqInput} [body] faq * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiCharityFaqPatch(body?: CharityFaqInput, options?: any): AxiosPromise { return CharityApiFp(configuration).apiCharityFaqPatch(body, options).then((request) => request(axios, basePath)); }, /** * * @summary Get info about fund * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiCharityGet(options?: any): AxiosPromise { return CharityApiFp(configuration).apiCharityGet(options).then((request) => request(axios, basePath)); }, /** * * @summary Update info about fund * @param {CharityFundInput} [body] input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiCharityPatch(body?: CharityFundInput, options?: any): AxiosPromise { return CharityApiFp(configuration).apiCharityPatch(body, options).then((request) => request(axios, basePath)); }, }; }; /** * Request parameters for apiCharityFaqPatch operation in CharityApi. * @export * @interface CharityApiApiCharityFaqPatchRequest */ export interface CharityApiApiCharityFaqPatchRequest { /** * faq * @type {CharityFaqInput} * @memberof CharityApiApiCharityFaqPatch */ readonly body?: CharityFaqInput } /** * Request parameters for apiCharityPatch operation in CharityApi. * @export * @interface CharityApiApiCharityPatchRequest */ export interface CharityApiApiCharityPatchRequest { /** * input * @type {CharityFundInput} * @memberof CharityApiApiCharityPatch */ readonly body?: CharityFundInput } /** * CharityApi - object-oriented interface * @export * @class CharityApi * @extends {BaseAPI} */ export class CharityApi extends BaseAPI { /** * * @summary Get balance of charity * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CharityApi */ public apiCharityBalanceGet(options?: any) { return CharityApiFp(this.configuration).apiCharityBalanceGet(options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Get fund\'s faq * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CharityApi */ public apiCharityFaqGet(options?: any) { return CharityApiFp(this.configuration).apiCharityFaqGet(options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Update fund\'s faq * @param {CharityApiApiCharityFaqPatchRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CharityApi */ public apiCharityFaqPatch(requestParameters: CharityApiApiCharityFaqPatchRequest = {}, options?: any) { return CharityApiFp(this.configuration).apiCharityFaqPatch(requestParameters.body, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Get info about fund * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CharityApi */ public apiCharityGet(options?: any) { return CharityApiFp(this.configuration).apiCharityGet(options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Update info about fund * @param {CharityApiApiCharityPatchRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CharityApi */ public apiCharityPatch(requestParameters: CharityApiApiCharityPatchRequest = {}, options?: any) { return CharityApiFp(this.configuration).apiCharityPatch(requestParameters.body, options).then((request) => request(this.axios, this.basePath)); } } \end{lstlisting} \subsection{@generated/api/chat-api.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * 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'; // @ts-ignore import { ChatAdminInput } from '../models'; // @ts-ignore import { ChatDialog } from '../models'; // @ts-ignore import { ChatDialogResponse } from '../models'; // @ts-ignore import { ChatMessage } from '../models'; // @ts-ignore import { ChatMessagesResponse } from '../models'; /** * ChatApi - axios parameter creator * @export */ export const ChatApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * * @summary Get list of all dialogs from operator * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] Sort param * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiChatDialogsGet: async (page?: number, size?: number, sort?: string, options: any = {}): Promise => { const localVarPath = `/api/chat/dialogs`; // 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: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (page !== undefined) { localVarQueryParameter['page'] = page; } if (size !== undefined) { localVarQueryParameter['size'] = size; } if (sort !== undefined) { localVarQueryParameter['sort'] = sort; } const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Get dialog entity * @param {string} id Dialog id * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiChatDialogsIdGet: async (id: string, options: any = {}): Promise => { // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiChatDialogsIdGet.'); } const localVarPath = `/api/chat/dialogs/{id}` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // 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: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Get messages by dialog id * @param {number} [size] Page size * @param {string} id Dialog id * @param {string} [cursor] id of last displayed message * @param {*} [options] Override http request option. * @throws {RequiredError} */ // @ts-ignore apiChatDialogsIdMessagesGet: async (size?: number, id: string, cursor?: string, options: any = {}): Promise => { // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiChatDialogsIdMessagesGet.'); } const localVarPath = `/api/chat/dialogs/{id}/messages` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // 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: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (size !== undefined) { localVarQueryParameter['size'] = size; } if (cursor !== undefined) { localVarQueryParameter['cursor'] = cursor; } const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Send message from operator * @param {ChatAdminInput} [body] Message * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiChatOperatorPost: async (body?: ChatAdminInput, options: any = {}): Promise => { const localVarPath = `/api/chat/operator`; // 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 queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; const nonString = typeof body !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, } }; /** * ChatApi - functional programming interface * @export */ export const ChatApiFp = function (configuration?: Configuration) { return { /** * * @summary Get list of all dialogs from operator * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] Sort param * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiChatDialogsGet(page?: number, size?: number, sort?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await ChatApiAxiosParamCreator(configuration).apiChatDialogsGet(page, size, sort, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url }; return axios.request(axiosRequestArgs); }; }, /** * * @summary Get dialog entity * @param {string} id Dialog id * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiChatDialogsIdGet(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await ChatApiAxiosParamCreator(configuration).apiChatDialogsIdGet(id, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url }; return axios.request(axiosRequestArgs); }; }, /** * * @summary Get messages by dialog id * @param {number} [size] Page size * @param {string} id Dialog id * @param {string} [cursor] id of last displayed message * @param {*} [options] Override http request option. * @throws {RequiredError} */ // @ts-ignore async apiChatDialogsIdMessagesGet(size?: number, id: string, cursor?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await ChatApiAxiosParamCreator(configuration).apiChatDialogsIdMessagesGet(size, id, cursor, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url }; return axios.request(axiosRequestArgs); }; }, /** * * @summary Send message from operator * @param {ChatAdminInput} [body] Message * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiChatOperatorPost(body?: ChatAdminInput, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await ChatApiAxiosParamCreator(configuration).apiChatOperatorPost(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url }; return axios.request(axiosRequestArgs); }; }, } }; /** * ChatApi - factory interface * @export */ export const ChatApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * * @summary Get list of all dialogs from operator * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] Sort param * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiChatDialogsGet(page?: number, size?: number, sort?: string, options?: any): AxiosPromise { return ChatApiFp(configuration).apiChatDialogsGet(page, size, sort, options).then((request) => request(axios, basePath)); }, /** * * @summary Get dialog entity * @param {string} id Dialog id * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiChatDialogsIdGet(id: string, options?: any): AxiosPromise { return ChatApiFp(configuration).apiChatDialogsIdGet(id, options).then((request) => request(axios, basePath)); }, /** * * @summary Get messages by dialog id * @param {number} [size] Page size * @param {string} id Dialog id * @param {string} [cursor] id of last displayed message * @param {*} [options] Override http request option. * @throws {RequiredError} */ // @ts-ignore apiChatDialogsIdMessagesGet(size?: number, id: string, cursor?: string, options?: any): AxiosPromise { return ChatApiFp(configuration).apiChatDialogsIdMessagesGet(size, id, cursor, options).then((request) => request(axios, basePath)); }, /** * * @summary Send message from operator * @param {ChatAdminInput} [body] Message * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiChatOperatorPost(body?: ChatAdminInput, options?: any): AxiosPromise { return ChatApiFp(configuration).apiChatOperatorPost(body, options).then((request) => request(axios, basePath)); }, }; }; /** * Request parameters for apiChatDialogsGet operation in ChatApi. * @export * @interface ChatApiApiChatDialogsGetRequest */ export interface ChatApiApiChatDialogsGetRequest { /** * Page number * @type {number} * @memberof ChatApiApiChatDialogsGet */ readonly page?: number /** * Page size * @type {number} * @memberof ChatApiApiChatDialogsGet */ readonly size?: number /** * Sort param * @type {string} * @memberof ChatApiApiChatDialogsGet */ readonly sort?: string } /** * Request parameters for apiChatDialogsIdGet operation in ChatApi. * @export * @interface ChatApiApiChatDialogsIdGetRequest */ export interface ChatApiApiChatDialogsIdGetRequest { /** * Dialog id * @type {string} * @memberof ChatApiApiChatDialogsIdGet */ readonly id: string } /** * Request parameters for apiChatDialogsIdMessagesGet operation in ChatApi. * @export * @interface ChatApiApiChatDialogsIdMessagesGetRequest */ export interface ChatApiApiChatDialogsIdMessagesGetRequest { /** * Page size * @type {number} * @memberof ChatApiApiChatDialogsIdMessagesGet */ readonly size?: number /** * Dialog id * @type {string} * @memberof ChatApiApiChatDialogsIdMessagesGet */ readonly id: string /** * id of last displayed message * @type {string} * @memberof ChatApiApiChatDialogsIdMessagesGet */ readonly cursor?: string } /** * Request parameters for apiChatOperatorPost operation in ChatApi. * @export * @interface ChatApiApiChatOperatorPostRequest */ export interface ChatApiApiChatOperatorPostRequest { /** * Message * @type {ChatAdminInput} * @memberof ChatApiApiChatOperatorPost */ readonly body?: ChatAdminInput } /** * ChatApi - object-oriented interface * @export * @class ChatApi * @extends {BaseAPI} */ export class ChatApi extends BaseAPI { /** * * @summary Get list of all dialogs from operator * @param {ChatApiApiChatDialogsGetRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ChatApi */ public apiChatDialogsGet(requestParameters: ChatApiApiChatDialogsGetRequest = {}, options?: any) { return ChatApiFp(this.configuration).apiChatDialogsGet(requestParameters.page, requestParameters.size, requestParameters.sort, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Get dialog entity * @param {ChatApiApiChatDialogsIdGetRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ChatApi */ public apiChatDialogsIdGet(requestParameters: ChatApiApiChatDialogsIdGetRequest, options?: any) { return ChatApiFp(this.configuration).apiChatDialogsIdGet(requestParameters.id, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Get messages by dialog id * @param {ChatApiApiChatDialogsIdMessagesGetRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ChatApi */ public apiChatDialogsIdMessagesGet(requestParameters: ChatApiApiChatDialogsIdMessagesGetRequest, options?: any) { return ChatApiFp(this.configuration).apiChatDialogsIdMessagesGet(requestParameters.size, requestParameters.id, requestParameters.cursor, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Send message from operator * @param {ChatApiApiChatOperatorPostRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ChatApi */ public apiChatOperatorPost(requestParameters: ChatApiApiChatOperatorPostRequest = {}, options?: any) { return ChatApiFp(this.configuration).apiChatOperatorPost(requestParameters.body, options).then((request) => request(this.axios, this.basePath)); } } \end{lstlisting} \subsection{@generated/api/donation-request-api.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * 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'; // @ts-ignore import { DonationRequestBody } from '../models'; // @ts-ignore import { DonationRequestComment } from '../models'; // @ts-ignore import { DonationRequestDonationRequest } from '../models'; // @ts-ignore import { DonationRequestHistoryResponse } from '../models'; // @ts-ignore import { DonationRequestInput } from '../models'; // @ts-ignore import { DonationRequestResponse } from '../models'; // @ts-ignore import { DonationRequestReviewResponse } from '../models'; // @ts-ignore import { DonationRequestSubmitReviewInput } from '../models'; // @ts-ignore import { DonationRequestSuperManagerInput } from '../models'; // @ts-ignore import { DonationRequestUpdateInput } from '../models'; // @ts-ignore import { DonationRequestUpdateStatusInput } from '../models'; /** * DonationRequestApi - axios parameter creator * @export */ export const DonationRequestApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * * @summary Creates donation request from fund * @param {DonationRequestSuperManagerInput} request Donation request Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationRequestFromManagerPost: async (request: DonationRequestSuperManagerInput, options: any = {}): Promise => { // verify required parameter 'request' is not null or undefined if (request === null || request === undefined) { throw new RequiredError('request', 'Required parameter request was null or undefined when calling apiDonationRequestFromManagerPost.'); } const localVarPath = `/api/donation-request/from_manager`; // 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 queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; const nonString = typeof request !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(request !== undefined ? request : {}) : (request || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Retrieves all donation requests * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] Sort param * @param {Array} [author] request author id * @param {Array} [assignee] request assignee id * @param {Array} [status] request status * @param {Array} [category] request category * @param {string} [searchString] id == searchString OR title LIKE searchString OR description LIKE searchString * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationRequestGet: async (page?: number, size?: number, sort?: string, author?: Array, assignee?: Array, status?: Array, category?: Array, searchString?: string, options: any = {}): Promise => { const localVarPath = `/api/donation-request/`; // 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: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (page !== undefined) { localVarQueryParameter['page'] = page; } if (size !== undefined) { localVarQueryParameter['size'] = size; } if (sort !== undefined) { localVarQueryParameter['sort'] = sort; } if (author) { localVarQueryParameter['author'] = author; } if (assignee) { localVarQueryParameter['assignee'] = assignee; } if (searchString !== undefined) { localVarQueryParameter['searchString'] = searchString; } const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } // status=a&status=b if (status) { for (const index in status) { queryParameters.append('status', status[index]); } } // category=a&category=b if (category) { for (const index in category) { queryParameters.append('category', category[index]); } } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Get comments for a given application * @param {number} id donation request id * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationRequestIdCommentsGet: async (id: number, options: any = {}): Promise => { // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiDonationRequestIdCommentsGet.'); } const localVarPath = `/api/donation-request/{id}/comments` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // 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: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Retrieves donation request based on given ID * @param {number} id Donation request ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationRequestIdGet: async (id: number, options: any = {}): Promise => { // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiDonationRequestIdGet.'); } const localVarPath = `/api/donation-request/{id}` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // 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: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Get all SuperManagers responsible for category of application * @param {number} id donation request id * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationRequestIdGetAllReviewersGet: async (id: number, options: any = {}): Promise => { // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiDonationRequestIdGetAllReviewersGet.'); } const localVarPath = `/api/donation-request/{id}/get_all_reviewers` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // 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: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Gets history of status changes * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] sort * @param {number} id donation request id * @param {*} [options] Override http request option. * @throws {RequiredError} */ // @ts-ignore apiDonationRequestIdHistoryGet: async (page?: number, size?: number, sort?: string, id: number, options: any = {}): Promise => { // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiDonationRequestIdHistoryGet.'); } const localVarPath = `/api/donation-request/{id}/history` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // 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: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (page !== undefined) { localVarQueryParameter['page'] = page; } if (size !== undefined) { localVarQueryParameter['size'] = size; } if (sort !== undefined) { localVarQueryParameter['sort'] = sort; } const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Updates donation request * @param {number} id Donation request ID * @param {DonationRequestUpdateInput} request Donation request Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationRequestIdPatch: async (id: number, request: DonationRequestUpdateInput, options: any = {}): Promise => { // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiDonationRequestIdPatch.'); } // verify required parameter 'request' is not null or undefined if (request === null || request === undefined) { throw new RequiredError('request', 'Required parameter request was null or undefined when calling apiDonationRequestIdPatch.'); } const localVarPath = `/api/donation-request/{id}` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // 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: 'PATCH', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; localVarHeaderParameter['Content-Type'] = 'application/json'; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; const nonString = typeof request !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(request !== undefined ? request : {}) : (request || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary RollBacks status of donation request * @param {number} id donation request id * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationRequestIdStatusDelete: async (id: number, options: any = {}): Promise => { // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiDonationRequestIdStatusDelete.'); } const localVarPath = `/api/donation-request/{id}/status` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // 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: 'DELETE', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Updates status of donation request * @param {number} id donation request id * @param {DonationRequestUpdateStatusInput} [input] Status and message * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationRequestIdStatusPatch: async (id: number, input?: DonationRequestUpdateStatusInput, options: any = {}): Promise => { // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiDonationRequestIdStatusPatch.'); } const localVarPath = `/api/donation-request/{id}/status` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // 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: 'PATCH', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; localVarHeaderParameter['Content-Type'] = 'application/json'; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; const nonString = typeof input !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(input !== undefined ? input : {}) : (input || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Submit result of application review * @param {number} id donation request id * @param {DonationRequestSubmitReviewInput} request Donation request Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationRequestIdSubmitReviewPatch: async (id: number, request: DonationRequestSubmitReviewInput, options: any = {}): Promise => { // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiDonationRequestIdSubmitReviewPatch.'); } // verify required parameter 'request' is not null or undefined if (request === null || request === undefined) { throw new RequiredError('request', 'Required parameter request was null or undefined when calling apiDonationRequestIdSubmitReviewPatch.'); } const localVarPath = `/api/donation-request/{id}/submit_review` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // 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: 'PATCH', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; localVarHeaderParameter['Content-Type'] = 'application/json'; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; const nonString = typeof request !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(request !== undefined ? request : {}) : (request || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Creates donation request * @param {DonationRequestInput} request Donation request Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationRequestPost: async (request: DonationRequestInput, options: any = {}): Promise => { // verify required parameter 'request' is not null or undefined if (request === null || request === undefined) { throw new RequiredError('request', 'Required parameter request was null or undefined when calling apiDonationRequestPost.'); } const localVarPath = `/api/donation-request`; // 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 queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; const nonString = typeof request !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(request !== undefined ? request : {}) : (request || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, } }; /** * DonationRequestApi - functional programming interface * @export */ export const DonationRequestApiFp = function (configuration?: Configuration) { return { /** * * @summary Creates donation request from fund * @param {DonationRequestSuperManagerInput} request Donation request Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiDonationRequestFromManagerPost(request: DonationRequestSuperManagerInput, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await DonationRequestApiAxiosParamCreator(configuration).apiDonationRequestFromManagerPost(request, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url }; return axios.request(axiosRequestArgs); }; }, /** * * @summary Retrieves all donation requests * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] Sort param * @param {Array} [author] request author id * @param {Array} [assignee] request assignee id * @param {Array} [status] request status * @param {Array} [category] request category * @param {string} [searchString] id == searchString OR title LIKE searchString OR description LIKE searchString * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiDonationRequestGet(page?: number, size?: number, sort?: string, author?: Array, assignee?: Array, status?: Array, category?: Array, searchString?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await DonationRequestApiAxiosParamCreator(configuration).apiDonationRequestGet(page, size, sort, author, assignee, status, category, searchString, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url }; return axios.request(axiosRequestArgs); }; }, /** * * @summary Get comments for a given application * @param {number} id donation request id * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiDonationRequestIdCommentsGet(id: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { const localVarAxiosArgs = await DonationRequestApiAxiosParamCreator(configuration).apiDonationRequestIdCommentsGet(id, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url }; return axios.request(axiosRequestArgs); }; }, /** * * @summary Retrieves donation request based on given ID * @param {number} id Donation request ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiDonationRequestIdGet(id: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await DonationRequestApiAxiosParamCreator(configuration).apiDonationRequestIdGet(id, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url }; return axios.request(axiosRequestArgs); }; }, /** * * @summary Get all SuperManagers responsible for category of application * @param {number} id donation request id * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiDonationRequestIdGetAllReviewersGet(id: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await DonationRequestApiAxiosParamCreator(configuration).apiDonationRequestIdGetAllReviewersGet(id, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url }; return axios.request(axiosRequestArgs); }; }, /** * * @summary Gets history of status changes * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] sort * @param {number} id donation request id * @param {*} [options] Override http request option. * @throws {RequiredError} */ // @ts-ignore async apiDonationRequestIdHistoryGet(page?: number, size?: number, sort?: string, id: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await DonationRequestApiAxiosParamCreator(configuration).apiDonationRequestIdHistoryGet(page, size, sort, id, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url }; return axios.request(axiosRequestArgs); }; }, /** * * @summary Updates donation request * @param {number} id Donation request ID * @param {DonationRequestUpdateInput} request Donation request Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiDonationRequestIdPatch(id: number, request: DonationRequestUpdateInput, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await DonationRequestApiAxiosParamCreator(configuration).apiDonationRequestIdPatch(id, request, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url }; return axios.request(axiosRequestArgs); }; }, /** * * @summary RollBacks status of donation request * @param {number} id donation request id * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiDonationRequestIdStatusDelete(id: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await DonationRequestApiAxiosParamCreator(configuration).apiDonationRequestIdStatusDelete(id, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url }; return axios.request(axiosRequestArgs); }; }, /** * * @summary Updates status of donation request * @param {number} id donation request id * @param {DonationRequestUpdateStatusInput} [input] Status and message * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiDonationRequestIdStatusPatch(id: number, input?: DonationRequestUpdateStatusInput, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await DonationRequestApiAxiosParamCreator(configuration).apiDonationRequestIdStatusPatch(id, input, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url }; return axios.request(axiosRequestArgs); }; }, /** * * @summary Submit result of application review * @param {number} id donation request id * @param {DonationRequestSubmitReviewInput} request Donation request Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiDonationRequestIdSubmitReviewPatch(id: number, request: DonationRequestSubmitReviewInput, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await DonationRequestApiAxiosParamCreator(configuration).apiDonationRequestIdSubmitReviewPatch(id, request, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url }; return axios.request(axiosRequestArgs); }; }, /** * * @summary Creates donation request * @param {DonationRequestInput} request Donation request Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiDonationRequestPost(request: DonationRequestInput, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await DonationRequestApiAxiosParamCreator(configuration).apiDonationRequestPost(request, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url }; return axios.request(axiosRequestArgs); }; }, } }; /** * DonationRequestApi - factory interface * @export */ export const DonationRequestApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * * @summary Creates donation request from fund * @param {DonationRequestSuperManagerInput} request Donation request Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationRequestFromManagerPost(request: DonationRequestSuperManagerInput, options?: any): AxiosPromise { return DonationRequestApiFp(configuration).apiDonationRequestFromManagerPost(request, options).then((request) => request(axios, basePath)); }, /** * * @summary Retrieves all donation requests * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] Sort param * @param {Array} [author] request author id * @param {Array} [assignee] request assignee id * @param {Array} [status] request status * @param {Array} [category] request category * @param {string} [searchString] id == searchString OR title LIKE searchString OR description LIKE searchString * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationRequestGet(page?: number, size?: number, sort?: string, author?: Array, assignee?: Array, status?: Array, category?: Array, searchString?: string, options?: any): AxiosPromise { return DonationRequestApiFp(configuration).apiDonationRequestGet(page, size, sort, author, assignee, status, category, searchString, options).then((request) => request(axios, basePath)); }, /** * * @summary Get comments for a given application * @param {number} id donation request id * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationRequestIdCommentsGet(id: number, options?: any): AxiosPromise> { return DonationRequestApiFp(configuration).apiDonationRequestIdCommentsGet(id, options).then((request) => request(axios, basePath)); }, /** * * @summary Retrieves donation request based on given ID * @param {number} id Donation request ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationRequestIdGet(id: number, options?: any): AxiosPromise { return DonationRequestApiFp(configuration).apiDonationRequestIdGet(id, options).then((request) => request(axios, basePath)); }, /** * * @summary Get all SuperManagers responsible for category of application * @param {number} id donation request id * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationRequestIdGetAllReviewersGet(id: number, options?: any): AxiosPromise { return DonationRequestApiFp(configuration).apiDonationRequestIdGetAllReviewersGet(id, options).then((request) => request(axios, basePath)); }, /** * * @summary Gets history of status changes * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] sort * @param {number} id donation request id * @param {*} [options] Override http request option. * @throws {RequiredError} */ // @ts-ignore apiDonationRequestIdHistoryGet(page?: number, size?: number, sort?: string, id: number, options?: any): AxiosPromise { return DonationRequestApiFp(configuration).apiDonationRequestIdHistoryGet(page, size, sort, id, options).then((request) => request(axios, basePath)); }, /** * * @summary Updates donation request * @param {number} id Donation request ID * @param {DonationRequestUpdateInput} request Donation request Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationRequestIdPatch(id: number, request: DonationRequestUpdateInput, options?: any): AxiosPromise { return DonationRequestApiFp(configuration).apiDonationRequestIdPatch(id, request, options).then((request) => request(axios, basePath)); }, /** * * @summary RollBacks status of donation request * @param {number} id donation request id * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationRequestIdStatusDelete(id: number, options?: any): AxiosPromise { return DonationRequestApiFp(configuration).apiDonationRequestIdStatusDelete(id, options).then((request) => request(axios, basePath)); }, /** * * @summary Updates status of donation request * @param {number} id donation request id * @param {DonationRequestUpdateStatusInput} [input] Status and message * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationRequestIdStatusPatch(id: number, input?: DonationRequestUpdateStatusInput, options?: any): AxiosPromise { return DonationRequestApiFp(configuration).apiDonationRequestIdStatusPatch(id, input, options).then((request) => request(axios, basePath)); }, /** * * @summary Submit result of application review * @param {number} id donation request id * @param {DonationRequestSubmitReviewInput} request Donation request Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationRequestIdSubmitReviewPatch(id: number, request: DonationRequestSubmitReviewInput, options?: any): AxiosPromise { return DonationRequestApiFp(configuration).apiDonationRequestIdSubmitReviewPatch(id, request, options).then((request) => request(axios, basePath)); }, /** * * @summary Creates donation request * @param {DonationRequestInput} request Donation request Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationRequestPost(request: DonationRequestInput, options?: any): AxiosPromise { return DonationRequestApiFp(configuration).apiDonationRequestPost(request, options).then((request) => request(axios, basePath)); }, }; }; /** * Request parameters for apiDonationRequestFromManagerPost operation in DonationRequestApi. * @export * @interface DonationRequestApiApiDonationRequestFromManagerPostRequest */ export interface DonationRequestApiApiDonationRequestFromManagerPostRequest { /** * Donation request Input * @type {DonationRequestSuperManagerInput} * @memberof DonationRequestApiApiDonationRequestFromManagerPost */ readonly request: DonationRequestSuperManagerInput } /** * Request parameters for apiDonationRequestGet operation in DonationRequestApi. * @export * @interface DonationRequestApiApiDonationRequestGetRequest */ export interface DonationRequestApiApiDonationRequestGetRequest { /** * Page number * @type {number} * @memberof DonationRequestApiApiDonationRequestGet */ readonly page?: number /** * Page size * @type {number} * @memberof DonationRequestApiApiDonationRequestGet */ readonly size?: number /** * Sort param * @type {string} * @memberof DonationRequestApiApiDonationRequestGet */ readonly sort?: string /** * request author id * @type {Array} * @memberof DonationRequestApiApiDonationRequestGet */ readonly author?: Array /** * request assignee id * @type {Array} * @memberof DonationRequestApiApiDonationRequestGet */ readonly assignee?: Array /** * request status * @type {Array} * @memberof DonationRequestApiApiDonationRequestGet */ readonly status?: Array /** * request category * @type {Array} * @memberof DonationRequestApiApiDonationRequestGet */ readonly category?: Array /** * id == searchString OR title LIKE searchString OR description LIKE searchString * @type {string} * @memberof DonationRequestApiApiDonationRequestGet */ readonly searchString?: string } /** * Request parameters for apiDonationRequestIdCommentsGet operation in DonationRequestApi. * @export * @interface DonationRequestApiApiDonationRequestIdCommentsGetRequest */ export interface DonationRequestApiApiDonationRequestIdCommentsGetRequest { /** * donation request id * @type {number} * @memberof DonationRequestApiApiDonationRequestIdCommentsGet */ readonly id: number } /** * Request parameters for apiDonationRequestIdGet operation in DonationRequestApi. * @export * @interface DonationRequestApiApiDonationRequestIdGetRequest */ export interface DonationRequestApiApiDonationRequestIdGetRequest { /** * Donation request ID * @type {number} * @memberof DonationRequestApiApiDonationRequestIdGet */ readonly id: number } /** * Request parameters for apiDonationRequestIdGetAllReviewersGet operation in DonationRequestApi. * @export * @interface DonationRequestApiApiDonationRequestIdGetAllReviewersGetRequest */ export interface DonationRequestApiApiDonationRequestIdGetAllReviewersGetRequest { /** * donation request id * @type {number} * @memberof DonationRequestApiApiDonationRequestIdGetAllReviewersGet */ readonly id: number } /** * Request parameters for apiDonationRequestIdHistoryGet operation in DonationRequestApi. * @export * @interface DonationRequestApiApiDonationRequestIdHistoryGetRequest */ export interface DonationRequestApiApiDonationRequestIdHistoryGetRequest { /** * Page number * @type {number} * @memberof DonationRequestApiApiDonationRequestIdHistoryGet */ readonly page?: number /** * Page size * @type {number} * @memberof DonationRequestApiApiDonationRequestIdHistoryGet */ readonly size?: number /** * sort * @type {string} * @memberof DonationRequestApiApiDonationRequestIdHistoryGet */ readonly sort?: string /** * donation request id * @type {number} * @memberof DonationRequestApiApiDonationRequestIdHistoryGet */ readonly id: number } /** * Request parameters for apiDonationRequestIdPatch operation in DonationRequestApi. * @export * @interface DonationRequestApiApiDonationRequestIdPatchRequest */ export interface DonationRequestApiApiDonationRequestIdPatchRequest { /** * Donation request ID * @type {number} * @memberof DonationRequestApiApiDonationRequestIdPatch */ readonly id: number /** * Donation request Input * @type {DonationRequestUpdateInput} * @memberof DonationRequestApiApiDonationRequestIdPatch */ readonly request: DonationRequestUpdateInput } /** * Request parameters for apiDonationRequestIdStatusDelete operation in DonationRequestApi. * @export * @interface DonationRequestApiApiDonationRequestIdStatusDeleteRequest */ export interface DonationRequestApiApiDonationRequestIdStatusDeleteRequest { /** * donation request id * @type {number} * @memberof DonationRequestApiApiDonationRequestIdStatusDelete */ readonly id: number } /** * Request parameters for apiDonationRequestIdStatusPatch operation in DonationRequestApi. * @export * @interface DonationRequestApiApiDonationRequestIdStatusPatchRequest */ export interface DonationRequestApiApiDonationRequestIdStatusPatchRequest { /** * donation request id * @type {number} * @memberof DonationRequestApiApiDonationRequestIdStatusPatch */ readonly id: number /** * Status and message * @type {DonationRequestUpdateStatusInput} * @memberof DonationRequestApiApiDonationRequestIdStatusPatch */ readonly input?: DonationRequestUpdateStatusInput } /** * Request parameters for apiDonationRequestIdSubmitReviewPatch operation in DonationRequestApi. * @export * @interface DonationRequestApiApiDonationRequestIdSubmitReviewPatchRequest */ export interface DonationRequestApiApiDonationRequestIdSubmitReviewPatchRequest { /** * donation request id * @type {number} * @memberof DonationRequestApiApiDonationRequestIdSubmitReviewPatch */ readonly id: number /** * Donation request Input * @type {DonationRequestSubmitReviewInput} * @memberof DonationRequestApiApiDonationRequestIdSubmitReviewPatch */ readonly request: DonationRequestSubmitReviewInput } /** * Request parameters for apiDonationRequestPost operation in DonationRequestApi. * @export * @interface DonationRequestApiApiDonationRequestPostRequest */ export interface DonationRequestApiApiDonationRequestPostRequest { /** * Donation request Input * @type {DonationRequestInput} * @memberof DonationRequestApiApiDonationRequestPost */ readonly request: DonationRequestInput } /** * DonationRequestApi - object-oriented interface * @export * @class DonationRequestApi * @extends {BaseAPI} */ export class DonationRequestApi extends BaseAPI { /** * * @summary Creates donation request from fund * @param {DonationRequestApiApiDonationRequestFromManagerPostRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DonationRequestApi */ public apiDonationRequestFromManagerPost(requestParameters: DonationRequestApiApiDonationRequestFromManagerPostRequest, options?: any) { return DonationRequestApiFp(this.configuration).apiDonationRequestFromManagerPost(requestParameters.request, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Retrieves all donation requests * @param {DonationRequestApiApiDonationRequestGetRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DonationRequestApi */ public apiDonationRequestGet(requestParameters: DonationRequestApiApiDonationRequestGetRequest = {}, options?: any) { return DonationRequestApiFp(this.configuration).apiDonationRequestGet(requestParameters.page, requestParameters.size, requestParameters.sort, requestParameters.author, requestParameters.assignee, requestParameters.status, requestParameters.category, requestParameters.searchString, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Get comments for a given application * @param {DonationRequestApiApiDonationRequestIdCommentsGetRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DonationRequestApi */ public apiDonationRequestIdCommentsGet(requestParameters: DonationRequestApiApiDonationRequestIdCommentsGetRequest, options?: any) { return DonationRequestApiFp(this.configuration).apiDonationRequestIdCommentsGet(requestParameters.id, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Retrieves donation request based on given ID * @param {DonationRequestApiApiDonationRequestIdGetRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DonationRequestApi */ public apiDonationRequestIdGet(requestParameters: DonationRequestApiApiDonationRequestIdGetRequest, options?: any) { return DonationRequestApiFp(this.configuration).apiDonationRequestIdGet(requestParameters.id, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Get all SuperManagers responsible for category of application * @param {DonationRequestApiApiDonationRequestIdGetAllReviewersGetRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DonationRequestApi */ public apiDonationRequestIdGetAllReviewersGet(requestParameters: DonationRequestApiApiDonationRequestIdGetAllReviewersGetRequest, options?: any) { return DonationRequestApiFp(this.configuration).apiDonationRequestIdGetAllReviewersGet(requestParameters.id, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Gets history of status changes * @param {DonationRequestApiApiDonationRequestIdHistoryGetRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DonationRequestApi */ public apiDonationRequestIdHistoryGet(requestParameters: DonationRequestApiApiDonationRequestIdHistoryGetRequest, options?: any) { return DonationRequestApiFp(this.configuration).apiDonationRequestIdHistoryGet(requestParameters.page, requestParameters.size, requestParameters.sort, requestParameters.id, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Updates donation request * @param {DonationRequestApiApiDonationRequestIdPatchRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DonationRequestApi */ public apiDonationRequestIdPatch(requestParameters: DonationRequestApiApiDonationRequestIdPatchRequest, options?: any) { return DonationRequestApiFp(this.configuration).apiDonationRequestIdPatch(requestParameters.id, requestParameters.request, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary RollBacks status of donation request * @param {DonationRequestApiApiDonationRequestIdStatusDeleteRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DonationRequestApi */ public apiDonationRequestIdStatusDelete(requestParameters: DonationRequestApiApiDonationRequestIdStatusDeleteRequest, options?: any) { return DonationRequestApiFp(this.configuration).apiDonationRequestIdStatusDelete(requestParameters.id, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Updates status of donation request * @param {DonationRequestApiApiDonationRequestIdStatusPatchRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DonationRequestApi */ public apiDonationRequestIdStatusPatch(requestParameters: DonationRequestApiApiDonationRequestIdStatusPatchRequest, options?: any) { return DonationRequestApiFp(this.configuration).apiDonationRequestIdStatusPatch(requestParameters.id, requestParameters.input, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Submit result of application review * @param {DonationRequestApiApiDonationRequestIdSubmitReviewPatchRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DonationRequestApi */ public apiDonationRequestIdSubmitReviewPatch(requestParameters: DonationRequestApiApiDonationRequestIdSubmitReviewPatchRequest, options?: any) { return DonationRequestApiFp(this.configuration).apiDonationRequestIdSubmitReviewPatch(requestParameters.id, requestParameters.request, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Creates donation request * @param {DonationRequestApiApiDonationRequestPostRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DonationRequestApi */ public apiDonationRequestPost(requestParameters: DonationRequestApiApiDonationRequestPostRequest, options?: any) { return DonationRequestApiFp(this.configuration).apiDonationRequestPost(requestParameters.request, options).then((request) => request(this.axios, this.basePath)); } } \end{lstlisting} \subsection{@generated/api/donations-api.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * 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'; // @ts-ignore import { BlockchainDonation } from '../models'; // @ts-ignore import { BlockchainDonationsResponse } from '../models'; /** * DonationsApi - axios parameter creator * @export */ export const DonationsApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * * @summary Retrieves a list of donations * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] Sort param * @param {string} [user] Only for manager * @param {string} [application] User can access only his donations * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationsGet: async (page?: number, size?: number, sort?: string, user?: string, application?: string, options: any = {}): Promise => { const localVarPath = `/api/donations`; // 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: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (page !== undefined) { localVarQueryParameter['page'] = page; } if (size !== undefined) { localVarQueryParameter['size'] = size; } if (sort !== undefined) { localVarQueryParameter['sort'] = sort; } if (user !== undefined) { localVarQueryParameter['user'] = user; } if (application !== undefined) { localVarQueryParameter['application'] = application; } const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Returns donation with a given id * @param {string} id Donation ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationsIdGet: async (id: string, options: any = {}): Promise => { // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new RequiredError('id','Required parameter id was null or undefined when calling apiDonationsIdGet.'); } const localVarPath = `/api/donations/{id}` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // 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: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, } }; /** * DonationsApi - functional programming interface * @export */ export const DonationsApiFp = function(configuration?: Configuration) { return { /** * * @summary Retrieves a list of donations * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] Sort param * @param {string} [user] Only for manager * @param {string} [application] User can access only his donations * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiDonationsGet(page?: number, size?: number, sort?: string, user?: string, application?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await DonationsApiAxiosParamCreator(configuration).apiDonationsGet(page, size, sort, user, application, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Returns donation with a given id * @param {string} id Donation ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiDonationsIdGet(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await DonationsApiAxiosParamCreator(configuration).apiDonationsIdGet(id, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * DonationsApi - factory interface * @export */ export const DonationsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * * @summary Retrieves a list of donations * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] Sort param * @param {string} [user] Only for manager * @param {string} [application] User can access only his donations * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationsGet(page?: number, size?: number, sort?: string, user?: string, application?: string, options?: any): AxiosPromise { return DonationsApiFp(configuration).apiDonationsGet(page, size, sort, user, application, options).then((request) => request(axios, basePath)); }, /** * * @summary Returns donation with a given id * @param {string} id Donation ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiDonationsIdGet(id: string, options?: any): AxiosPromise { return DonationsApiFp(configuration).apiDonationsIdGet(id, options).then((request) => request(axios, basePath)); }, }; }; /** * Request parameters for apiDonationsGet operation in DonationsApi. * @export * @interface DonationsApiApiDonationsGetRequest */ export interface DonationsApiApiDonationsGetRequest { /** * Page number * @type {number} * @memberof DonationsApiApiDonationsGet */ readonly page?: number /** * Page size * @type {number} * @memberof DonationsApiApiDonationsGet */ readonly size?: number /** * Sort param * @type {string} * @memberof DonationsApiApiDonationsGet */ readonly sort?: string /** * Only for manager * @type {string} * @memberof DonationsApiApiDonationsGet */ readonly user?: string /** * User can access only his donations * @type {string} * @memberof DonationsApiApiDonationsGet */ readonly application?: string } /** * Request parameters for apiDonationsIdGet operation in DonationsApi. * @export * @interface DonationsApiApiDonationsIdGetRequest */ export interface DonationsApiApiDonationsIdGetRequest { /** * Donation ID * @type {string} * @memberof DonationsApiApiDonationsIdGet */ readonly id: string } /** * DonationsApi - object-oriented interface * @export * @class DonationsApi * @extends {BaseAPI} */ export class DonationsApi extends BaseAPI { /** * * @summary Retrieves a list of donations * @param {DonationsApiApiDonationsGetRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DonationsApi */ public apiDonationsGet(requestParameters: DonationsApiApiDonationsGetRequest = {}, options?: any) { return DonationsApiFp(this.configuration).apiDonationsGet(requestParameters.page, requestParameters.size, requestParameters.sort, requestParameters.user, requestParameters.application, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Returns donation with a given id * @param {DonationsApiApiDonationsIdGetRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof DonationsApi */ public apiDonationsIdGet(requestParameters: DonationsApiApiDonationsIdGetRequest, options?: any) { return DonationsApiFp(this.configuration).apiDonationsIdGet(requestParameters.id, options).then((request) => request(this.axios, this.basePath)); } } \end{lstlisting} \subsection{@generated/api/file-api.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * 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'; // @ts-ignore import { FileInfo } from '../models'; /** * FileApi - axios parameter creator * @export */ export const FileApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * * @summary Gets the binary representation of a file * @param {string} id File Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiFileIdDownloadGet: async (id: string, options: any = {}): Promise => { // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new RequiredError('id','Required parameter id was null or undefined when calling apiFileIdDownloadGet.'); } const localVarPath = `/api/file/{id}/download` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // 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: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Gets the info about file * @param {string} id File Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiFileIdGet: async (id: string, options: any = {}): Promise => { // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new RequiredError('id','Required parameter id was null or undefined when calling apiFileIdGet.'); } const localVarPath = `/api/file/{id}` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // 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: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Uploads given file * @param {object} [file] File * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiFileUploadPost: async (file?: object, options: any = {}): Promise => { const localVarPath = `/api/file/upload`; // 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 localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)(); if (file !== undefined) { localVarFormParams.append('file', new Blob([JSON.stringify(file)], { type: "application/json", })); } localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = localVarFormParams; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, } }; /** * FileApi - functional programming interface * @export */ export const FileApiFp = function(configuration?: Configuration) { return { /** * * @summary Gets the binary representation of a file * @param {string} id File Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiFileIdDownloadGet(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await FileApiAxiosParamCreator(configuration).apiFileIdDownloadGet(id, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Gets the info about file * @param {string} id File Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiFileIdGet(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await FileApiAxiosParamCreator(configuration).apiFileIdGet(id, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Uploads given file * @param {object} [file] File * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiFileUploadPost(file?: object, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { const localVarAxiosArgs = await FileApiAxiosParamCreator(configuration).apiFileUploadPost(file, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * FileApi - factory interface * @export */ export const FileApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * * @summary Gets the binary representation of a file * @param {string} id File Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiFileIdDownloadGet(id: string, options?: any): AxiosPromise { return FileApiFp(configuration).apiFileIdDownloadGet(id, options).then((request) => request(axios, basePath)); }, /** * * @summary Gets the info about file * @param {string} id File Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiFileIdGet(id: string, options?: any): AxiosPromise { return FileApiFp(configuration).apiFileIdGet(id, options).then((request) => request(axios, basePath)); }, /** * * @summary Uploads given file * @param {object} [file] File * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiFileUploadPost(file?: object, options?: any): AxiosPromise> { return FileApiFp(configuration).apiFileUploadPost(file, options).then((request) => request(axios, basePath)); }, }; }; /** * Request parameters for apiFileIdDownloadGet operation in FileApi. * @export * @interface FileApiApiFileIdDownloadGetRequest */ export interface FileApiApiFileIdDownloadGetRequest { /** * File Id * @type {string} * @memberof FileApiApiFileIdDownloadGet */ readonly id: string } /** * Request parameters for apiFileIdGet operation in FileApi. * @export * @interface FileApiApiFileIdGetRequest */ export interface FileApiApiFileIdGetRequest { /** * File Id * @type {string} * @memberof FileApiApiFileIdGet */ readonly id: string } /** * Request parameters for apiFileUploadPost operation in FileApi. * @export * @interface FileApiApiFileUploadPostRequest */ export interface FileApiApiFileUploadPostRequest { /** * File * @type {object} * @memberof FileApiApiFileUploadPost */ readonly file?: object } /** * FileApi - object-oriented interface * @export * @class FileApi * @extends {BaseAPI} */ export class FileApi extends BaseAPI { /** * * @summary Gets the binary representation of a file * @param {FileApiApiFileIdDownloadGetRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof FileApi */ public apiFileIdDownloadGet(requestParameters: FileApiApiFileIdDownloadGetRequest, options?: any) { return FileApiFp(this.configuration).apiFileIdDownloadGet(requestParameters.id, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Gets the info about file * @param {FileApiApiFileIdGetRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof FileApi */ public apiFileIdGet(requestParameters: FileApiApiFileIdGetRequest, options?: any) { return FileApiFp(this.configuration).apiFileIdGet(requestParameters.id, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Uploads given file * @param {FileApiApiFileUploadPostRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof FileApi */ public apiFileUploadPost(requestParameters: FileApiApiFileUploadPostRequest = {}, options?: any) { return FileApiFp(this.configuration).apiFileUploadPost(requestParameters.file, options).then((request) => request(this.axios, this.basePath)); } } \end{lstlisting} \subsection{@generated/api/login-api.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * 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'; // @ts-ignore import { AuthCredentials } from '../models'; /** * LoginApi - axios parameter creator * @export */ export const LoginApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Sets token on success * @summary Route for signing in * @param {AuthCredentials} request User credentials * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiLoginPost: async (request: AuthCredentials, options: any = {}): Promise => { // verify required parameter 'request' is not null or undefined if (request === null || request === undefined) { throw new RequiredError('request','Required parameter request was null or undefined when calling apiLoginPost.'); } const localVarPath = `/api/login`; // 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 queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; const nonString = typeof request !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(request !== undefined ? request : {}) : (request || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Route for refreshing * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiLoginRefreshPost: async (options: any = {}): Promise => { const localVarPath = `/api/login/refresh`; // 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 queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Destroys user session * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiLogoutPost: async (options: any = {}): Promise => { const localVarPath = `/api/logout`; // 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 queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, } }; /** * LoginApi - functional programming interface * @export */ export const LoginApiFp = function(configuration?: Configuration) { return { /** * Sets token on success * @summary Route for signing in * @param {AuthCredentials} request User credentials * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiLoginPost(request: AuthCredentials, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await LoginApiAxiosParamCreator(configuration).apiLoginPost(request, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Route for refreshing * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiLoginRefreshPost(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await LoginApiAxiosParamCreator(configuration).apiLoginRefreshPost(options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Destroys user session * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiLogoutPost(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await LoginApiAxiosParamCreator(configuration).apiLogoutPost(options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * LoginApi - factory interface * @export */ export const LoginApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * Sets token on success * @summary Route for signing in * @param {AuthCredentials} request User credentials * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiLoginPost(request: AuthCredentials, options?: any): AxiosPromise { return LoginApiFp(configuration).apiLoginPost(request, options).then((request) => request(axios, basePath)); }, /** * * @summary Route for refreshing * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiLoginRefreshPost(options?: any): AxiosPromise { return LoginApiFp(configuration).apiLoginRefreshPost(options).then((request) => request(axios, basePath)); }, /** * * @summary Destroys user session * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiLogoutPost(options?: any): AxiosPromise { return LoginApiFp(configuration).apiLogoutPost(options).then((request) => request(axios, basePath)); }, }; }; /** * Request parameters for apiLoginPost operation in LoginApi. * @export * @interface LoginApiApiLoginPostRequest */ export interface LoginApiApiLoginPostRequest { /** * User credentials * @type {AuthCredentials} * @memberof LoginApiApiLoginPost */ readonly request: AuthCredentials } /** * LoginApi - object-oriented interface * @export * @class LoginApi * @extends {BaseAPI} */ export class LoginApi extends BaseAPI { /** * Sets token on success * @summary Route for signing in * @param {LoginApiApiLoginPostRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof LoginApi */ public apiLoginPost(requestParameters: LoginApiApiLoginPostRequest, options?: any) { return LoginApiFp(this.configuration).apiLoginPost(requestParameters.request, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Route for refreshing * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof LoginApi */ public apiLoginRefreshPost(options?: any) { return LoginApiFp(this.configuration).apiLoginRefreshPost(options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Destroys user session * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof LoginApi */ public apiLogoutPost(options?: any) { return LoginApiFp(this.configuration).apiLogoutPost(options).then((request) => request(this.axios, this.basePath)); } } \end{lstlisting} \subsection{@generated/api/money-api.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * 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'; // @ts-ignore import { AuthUnregisteredUser } from '../models'; // @ts-ignore import { BlockchainDonation } from '../models'; // @ts-ignore import { BlockchainDonationToApplicationFromFund } from '../models'; // @ts-ignore import { BlockchainDonationToCharity } from '../models'; // @ts-ignore import { BlockchainDonationToCharityFromUser } from '../models'; // @ts-ignore import { ControllersDeposit } from '../models'; // @ts-ignore import { ControllersDonateRequestInput } from '../models'; // @ts-ignore import { UserBalance } from '../models'; /** * MoneyApi - axios parameter creator * @export */ export const MoneyApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * * @summary Gets user\'s balance * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiMoneyBalanceGet: async (options: any = {}): Promise => { const localVarPath = `/api/money/balance`; // 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: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Deposit money to user with given ID * @param {ControllersDeposit} request Deposit * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiMoneyDepositPost: async (request: ControllersDeposit, options: any = {}): Promise => { // verify required parameter 'request' is not null or undefined if (request === null || request === undefined) { throw new RequiredError('request','Required parameter request was null or undefined when calling apiMoneyDepositPost.'); } const localVarPath = `/api/money/deposit`; // 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 queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; const nonString = typeof request !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(request !== undefined ? request : {}) : (request || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Donate to application from charity * @param {BlockchainDonationToApplicationFromFund} request Donation Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiMoneyDonateApplicationFromCharityPost: async (request: BlockchainDonationToApplicationFromFund, options: any = {}): Promise => { // verify required parameter 'request' is not null or undefined if (request === null || request === undefined) { throw new RequiredError('request','Required parameter request was null or undefined when calling apiMoneyDonateApplicationFromCharityPost.'); } const localVarPath = `/api/money/donate/application/from_charity`; // 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 queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; const nonString = typeof request !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(request !== undefined ? request : {}) : (request || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Donation to an application with a given ID * @param {ControllersDonateRequestInput} request DonateRequestInput * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiMoneyDonateApplicationPost: async (request: ControllersDonateRequestInput, options: any = {}): Promise => { // verify required parameter 'request' is not null or undefined if (request === null || request === undefined) { throw new RequiredError('request','Required parameter request was null or undefined when calling apiMoneyDonateApplicationPost.'); } const localVarPath = `/api/money/donate/application`; // 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 queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; const nonString = typeof request !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(request !== undefined ? request : {}) : (request || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Donate to charity from manager * @param {BlockchainDonationToCharity} request Donation Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiMoneyDonateCharityFromManagerPost: async (request: BlockchainDonationToCharity, options: any = {}): Promise => { // verify required parameter 'request' is not null or undefined if (request === null || request === undefined) { throw new RequiredError('request','Required parameter request was null or undefined when calling apiMoneyDonateCharityFromManagerPost.'); } const localVarPath = `/api/money/donate/charity/from_manager`; // 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 queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; const nonString = typeof request !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(request !== undefined ? request : {}) : (request || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Donate to charity from user * @param {BlockchainDonationToCharityFromUser} request Donation Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiMoneyDonateCharityFromUserPost: async (request: BlockchainDonationToCharityFromUser, options: any = {}): Promise => { // verify required parameter 'request' is not null or undefined if (request === null || request === undefined) { throw new RequiredError('request','Required parameter request was null or undefined when calling apiMoneyDonateCharityFromUserPost.'); } const localVarPath = `/api/money/donate/charity/from_user`; // 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 queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; const nonString = typeof request !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(request !== undefined ? request : {}) : (request || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, } }; /** * MoneyApi - functional programming interface * @export */ export const MoneyApiFp = function(configuration?: Configuration) { return { /** * * @summary Gets user\'s balance * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiMoneyBalanceGet(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await MoneyApiAxiosParamCreator(configuration).apiMoneyBalanceGet(options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Deposit money to user with given ID * @param {ControllersDeposit} request Deposit * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiMoneyDepositPost(request: ControllersDeposit, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await MoneyApiAxiosParamCreator(configuration).apiMoneyDepositPost(request, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Donate to application from charity * @param {BlockchainDonationToApplicationFromFund} request Donation Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiMoneyDonateApplicationFromCharityPost(request: BlockchainDonationToApplicationFromFund, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await MoneyApiAxiosParamCreator(configuration).apiMoneyDonateApplicationFromCharityPost(request, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Donation to an application with a given ID * @param {ControllersDonateRequestInput} request DonateRequestInput * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiMoneyDonateApplicationPost(request: ControllersDonateRequestInput, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await MoneyApiAxiosParamCreator(configuration).apiMoneyDonateApplicationPost(request, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Donate to charity from manager * @param {BlockchainDonationToCharity} request Donation Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiMoneyDonateCharityFromManagerPost(request: BlockchainDonationToCharity, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await MoneyApiAxiosParamCreator(configuration).apiMoneyDonateCharityFromManagerPost(request, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Donate to charity from user * @param {BlockchainDonationToCharityFromUser} request Donation Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiMoneyDonateCharityFromUserPost(request: BlockchainDonationToCharityFromUser, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await MoneyApiAxiosParamCreator(configuration).apiMoneyDonateCharityFromUserPost(request, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * MoneyApi - factory interface * @export */ export const MoneyApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * * @summary Gets user\'s balance * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiMoneyBalanceGet(options?: any): AxiosPromise { return MoneyApiFp(configuration).apiMoneyBalanceGet(options).then((request) => request(axios, basePath)); }, /** * * @summary Deposit money to user with given ID * @param {ControllersDeposit} request Deposit * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiMoneyDepositPost(request: ControllersDeposit, options?: any): AxiosPromise { return MoneyApiFp(configuration).apiMoneyDepositPost(request, options).then((request) => request(axios, basePath)); }, /** * * @summary Donate to application from charity * @param {BlockchainDonationToApplicationFromFund} request Donation Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiMoneyDonateApplicationFromCharityPost(request: BlockchainDonationToApplicationFromFund, options?: any): AxiosPromise { return MoneyApiFp(configuration).apiMoneyDonateApplicationFromCharityPost(request, options).then((request) => request(axios, basePath)); }, /** * * @summary Donation to an application with a given ID * @param {ControllersDonateRequestInput} request DonateRequestInput * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiMoneyDonateApplicationPost(request: ControllersDonateRequestInput, options?: any): AxiosPromise { return MoneyApiFp(configuration).apiMoneyDonateApplicationPost(request, options).then((request) => request(axios, basePath)); }, /** * * @summary Donate to charity from manager * @param {BlockchainDonationToCharity} request Donation Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiMoneyDonateCharityFromManagerPost(request: BlockchainDonationToCharity, options?: any): AxiosPromise { return MoneyApiFp(configuration).apiMoneyDonateCharityFromManagerPost(request, options).then((request) => request(axios, basePath)); }, /** * * @summary Donate to charity from user * @param {BlockchainDonationToCharityFromUser} request Donation Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiMoneyDonateCharityFromUserPost(request: BlockchainDonationToCharityFromUser, options?: any): AxiosPromise { return MoneyApiFp(configuration).apiMoneyDonateCharityFromUserPost(request, options).then((request) => request(axios, basePath)); }, }; }; /** * Request parameters for apiMoneyDepositPost operation in MoneyApi. * @export * @interface MoneyApiApiMoneyDepositPostRequest */ export interface MoneyApiApiMoneyDepositPostRequest { /** * Deposit * @type {ControllersDeposit} * @memberof MoneyApiApiMoneyDepositPost */ readonly request: ControllersDeposit } /** * Request parameters for apiMoneyDonateApplicationFromCharityPost operation in MoneyApi. * @export * @interface MoneyApiApiMoneyDonateApplicationFromCharityPostRequest */ export interface MoneyApiApiMoneyDonateApplicationFromCharityPostRequest { /** * Donation Input * @type {BlockchainDonationToApplicationFromFund} * @memberof MoneyApiApiMoneyDonateApplicationFromCharityPost */ readonly request: BlockchainDonationToApplicationFromFund } /** * Request parameters for apiMoneyDonateApplicationPost operation in MoneyApi. * @export * @interface MoneyApiApiMoneyDonateApplicationPostRequest */ export interface MoneyApiApiMoneyDonateApplicationPostRequest { /** * DonateRequestInput * @type {ControllersDonateRequestInput} * @memberof MoneyApiApiMoneyDonateApplicationPost */ readonly request: ControllersDonateRequestInput } /** * Request parameters for apiMoneyDonateCharityFromManagerPost operation in MoneyApi. * @export * @interface MoneyApiApiMoneyDonateCharityFromManagerPostRequest */ export interface MoneyApiApiMoneyDonateCharityFromManagerPostRequest { /** * Donation Input * @type {BlockchainDonationToCharity} * @memberof MoneyApiApiMoneyDonateCharityFromManagerPost */ readonly request: BlockchainDonationToCharity } /** * Request parameters for apiMoneyDonateCharityFromUserPost operation in MoneyApi. * @export * @interface MoneyApiApiMoneyDonateCharityFromUserPostRequest */ export interface MoneyApiApiMoneyDonateCharityFromUserPostRequest { /** * Donation Input * @type {BlockchainDonationToCharityFromUser} * @memberof MoneyApiApiMoneyDonateCharityFromUserPost */ readonly request: BlockchainDonationToCharityFromUser } /** * MoneyApi - object-oriented interface * @export * @class MoneyApi * @extends {BaseAPI} */ export class MoneyApi extends BaseAPI { /** * * @summary Gets user\'s balance * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof MoneyApi */ public apiMoneyBalanceGet(options?: any) { return MoneyApiFp(this.configuration).apiMoneyBalanceGet(options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Deposit money to user with given ID * @param {MoneyApiApiMoneyDepositPostRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof MoneyApi */ public apiMoneyDepositPost(requestParameters: MoneyApiApiMoneyDepositPostRequest, options?: any) { return MoneyApiFp(this.configuration).apiMoneyDepositPost(requestParameters.request, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Donate to application from charity * @param {MoneyApiApiMoneyDonateApplicationFromCharityPostRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof MoneyApi */ public apiMoneyDonateApplicationFromCharityPost(requestParameters: MoneyApiApiMoneyDonateApplicationFromCharityPostRequest, options?: any) { return MoneyApiFp(this.configuration).apiMoneyDonateApplicationFromCharityPost(requestParameters.request, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Donation to an application with a given ID * @param {MoneyApiApiMoneyDonateApplicationPostRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof MoneyApi */ public apiMoneyDonateApplicationPost(requestParameters: MoneyApiApiMoneyDonateApplicationPostRequest, options?: any) { return MoneyApiFp(this.configuration).apiMoneyDonateApplicationPost(requestParameters.request, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Donate to charity from manager * @param {MoneyApiApiMoneyDonateCharityFromManagerPostRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof MoneyApi */ public apiMoneyDonateCharityFromManagerPost(requestParameters: MoneyApiApiMoneyDonateCharityFromManagerPostRequest, options?: any) { return MoneyApiFp(this.configuration).apiMoneyDonateCharityFromManagerPost(requestParameters.request, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Donate to charity from user * @param {MoneyApiApiMoneyDonateCharityFromUserPostRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof MoneyApi */ public apiMoneyDonateCharityFromUserPost(requestParameters: MoneyApiApiMoneyDonateCharityFromUserPostRequest, options?: any) { return MoneyApiFp(this.configuration).apiMoneyDonateCharityFromUserPost(requestParameters.request, options).then((request) => request(this.axios, this.basePath)); } } \end{lstlisting} \subsection{@generated/api/news-api.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * 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'; // @ts-ignore import { NewsInput } from '../models'; // @ts-ignore import { NewsResponse } from '../models'; // @ts-ignore import { NewsView } from '../models'; /** * NewsApi - axios parameter creator * @export */ export const NewsApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * * @summary Get all news with pagination * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] Sort param * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiNewsGet: async (page?: number, size?: number, sort?: string, options: any = {}): Promise => { const localVarPath = `/api/news`; // 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: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (page !== undefined) { localVarQueryParameter['page'] = page; } if (size !== undefined) { localVarQueryParameter['size'] = size; } if (sort !== undefined) { localVarQueryParameter['sort'] = sort; } const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Deletes one news entity * @param {string} id News entity id * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiNewsIdDelete: async (id: string, options: any = {}): Promise => { // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new RequiredError('id','Required parameter id was null or undefined when calling apiNewsIdDelete.'); } const localVarPath = `/api/news/{id}` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // 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: 'DELETE', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Get one news entity * @param {string} id News entity id * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiNewsIdGet: async (id: string, options: any = {}): Promise => { // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new RequiredError('id','Required parameter id was null or undefined when calling apiNewsIdGet.'); } const localVarPath = `/api/news/{id}` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // 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: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Edit one news entity * @param {string} id News id * @param {NewsInput} [body] News input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiNewsIdPatch: async (id: string, body?: NewsInput, options: any = {}): Promise => { // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new RequiredError('id','Required parameter id was null or undefined when calling apiNewsIdPatch.'); } const localVarPath = `/api/news/{id}` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // 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: 'PATCH', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; localVarHeaderParameter['Content-Type'] = 'application/json'; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; const nonString = typeof body !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Creates news entity * @param {NewsInput} [body] News input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiNewsPost: async (body?: NewsInput, options: any = {}): Promise => { const localVarPath = `/api/news`; // 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 queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; const nonString = typeof body !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, } }; /** * NewsApi - functional programming interface * @export */ export const NewsApiFp = function(configuration?: Configuration) { return { /** * * @summary Get all news with pagination * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] Sort param * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiNewsGet(page?: number, size?: number, sort?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await NewsApiAxiosParamCreator(configuration).apiNewsGet(page, size, sort, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Deletes one news entity * @param {string} id News entity id * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiNewsIdDelete(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await NewsApiAxiosParamCreator(configuration).apiNewsIdDelete(id, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Get one news entity * @param {string} id News entity id * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiNewsIdGet(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await NewsApiAxiosParamCreator(configuration).apiNewsIdGet(id, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Edit one news entity * @param {string} id News id * @param {NewsInput} [body] News input * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiNewsIdPatch(id: string, body?: NewsInput, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await NewsApiAxiosParamCreator(configuration).apiNewsIdPatch(id, body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Creates news entity * @param {NewsInput} [body] News input * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiNewsPost(body?: NewsInput, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await NewsApiAxiosParamCreator(configuration).apiNewsPost(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * NewsApi - factory interface * @export */ export const NewsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * * @summary Get all news with pagination * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] Sort param * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiNewsGet(page?: number, size?: number, sort?: string, options?: any): AxiosPromise { return NewsApiFp(configuration).apiNewsGet(page, size, sort, options).then((request) => request(axios, basePath)); }, /** * * @summary Deletes one news entity * @param {string} id News entity id * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiNewsIdDelete(id: string, options?: any): AxiosPromise { return NewsApiFp(configuration).apiNewsIdDelete(id, options).then((request) => request(axios, basePath)); }, /** * * @summary Get one news entity * @param {string} id News entity id * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiNewsIdGet(id: string, options?: any): AxiosPromise { return NewsApiFp(configuration).apiNewsIdGet(id, options).then((request) => request(axios, basePath)); }, /** * * @summary Edit one news entity * @param {string} id News id * @param {NewsInput} [body] News input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiNewsIdPatch(id: string, body?: NewsInput, options?: any): AxiosPromise { return NewsApiFp(configuration).apiNewsIdPatch(id, body, options).then((request) => request(axios, basePath)); }, /** * * @summary Creates news entity * @param {NewsInput} [body] News input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiNewsPost(body?: NewsInput, options?: any): AxiosPromise { return NewsApiFp(configuration).apiNewsPost(body, options).then((request) => request(axios, basePath)); }, }; }; /** * Request parameters for apiNewsGet operation in NewsApi. * @export * @interface NewsApiApiNewsGetRequest */ export interface NewsApiApiNewsGetRequest { /** * Page number * @type {number} * @memberof NewsApiApiNewsGet */ readonly page?: number /** * Page size * @type {number} * @memberof NewsApiApiNewsGet */ readonly size?: number /** * Sort param * @type {string} * @memberof NewsApiApiNewsGet */ readonly sort?: string } /** * Request parameters for apiNewsIdDelete operation in NewsApi. * @export * @interface NewsApiApiNewsIdDeleteRequest */ export interface NewsApiApiNewsIdDeleteRequest { /** * News entity id * @type {string} * @memberof NewsApiApiNewsIdDelete */ readonly id: string } /** * Request parameters for apiNewsIdGet operation in NewsApi. * @export * @interface NewsApiApiNewsIdGetRequest */ export interface NewsApiApiNewsIdGetRequest { /** * News entity id * @type {string} * @memberof NewsApiApiNewsIdGet */ readonly id: string } /** * Request parameters for apiNewsIdPatch operation in NewsApi. * @export * @interface NewsApiApiNewsIdPatchRequest */ export interface NewsApiApiNewsIdPatchRequest { /** * News id * @type {string} * @memberof NewsApiApiNewsIdPatch */ readonly id: string /** * News input * @type {NewsInput} * @memberof NewsApiApiNewsIdPatch */ readonly body?: NewsInput } /** * Request parameters for apiNewsPost operation in NewsApi. * @export * @interface NewsApiApiNewsPostRequest */ export interface NewsApiApiNewsPostRequest { /** * News input * @type {NewsInput} * @memberof NewsApiApiNewsPost */ readonly body?: NewsInput } /** * NewsApi - object-oriented interface * @export * @class NewsApi * @extends {BaseAPI} */ export class NewsApi extends BaseAPI { /** * * @summary Get all news with pagination * @param {NewsApiApiNewsGetRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof NewsApi */ public apiNewsGet(requestParameters: NewsApiApiNewsGetRequest = {}, options?: any) { return NewsApiFp(this.configuration).apiNewsGet(requestParameters.page, requestParameters.size, requestParameters.sort, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Deletes one news entity * @param {NewsApiApiNewsIdDeleteRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof NewsApi */ public apiNewsIdDelete(requestParameters: NewsApiApiNewsIdDeleteRequest, options?: any) { return NewsApiFp(this.configuration).apiNewsIdDelete(requestParameters.id, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Get one news entity * @param {NewsApiApiNewsIdGetRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof NewsApi */ public apiNewsIdGet(requestParameters: NewsApiApiNewsIdGetRequest, options?: any) { return NewsApiFp(this.configuration).apiNewsIdGet(requestParameters.id, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Edit one news entity * @param {NewsApiApiNewsIdPatchRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof NewsApi */ public apiNewsIdPatch(requestParameters: NewsApiApiNewsIdPatchRequest, options?: any) { return NewsApiFp(this.configuration).apiNewsIdPatch(requestParameters.id, requestParameters.body, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Creates news entity * @param {NewsApiApiNewsPostRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof NewsApi */ public apiNewsPost(requestParameters: NewsApiApiNewsPostRequest = {}, options?: any) { return NewsApiFp(this.configuration).apiNewsPost(requestParameters.body, options).then((request) => request(this.axios, this.basePath)); } } \end{lstlisting} \subsection{@generated/api/notifications-api.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * 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'; // @ts-ignore import { ControllersFcmId } from '../models'; // @ts-ignore import { NotificationsNotificationResponse } from '../models'; /** * NotificationsApi - axios parameter creator * @export */ export const NotificationsApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Get all user notifications with pagination * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] Sort param * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiNotificationsGet: async (page?: number, size?: number, sort?: string, options: any = {}): Promise => { const localVarPath = `/api/notifications`; // 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: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (page !== undefined) { localVarQueryParameter['page'] = page; } if (size !== undefined) { localVarQueryParameter['size'] = size; } if (sort !== undefined) { localVarQueryParameter['sort'] = sort; } const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Sets firebase token to current session for sending notifications * @param {ControllersFcmId} [body] client registration id * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiNotificationsSetTokenPatch: async (body?: ControllersFcmId, options: any = {}): Promise => { const localVarPath = `/api/notifications/set-token`; // 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: 'PATCH', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; localVarHeaderParameter['Content-Type'] = 'application/json'; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; const nonString = typeof body !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, } }; /** * NotificationsApi - functional programming interface * @export */ export const NotificationsApiFp = function(configuration?: Configuration) { return { /** * Get all user notifications with pagination * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] Sort param * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiNotificationsGet(page?: number, size?: number, sort?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await NotificationsApiAxiosParamCreator(configuration).apiNotificationsGet(page, size, sort, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Sets firebase token to current session for sending notifications * @param {ControllersFcmId} [body] client registration id * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiNotificationsSetTokenPatch(body?: ControllersFcmId, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await NotificationsApiAxiosParamCreator(configuration).apiNotificationsSetTokenPatch(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * NotificationsApi - factory interface * @export */ export const NotificationsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * Get all user notifications with pagination * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] Sort param * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiNotificationsGet(page?: number, size?: number, sort?: string, options?: any): AxiosPromise { return NotificationsApiFp(configuration).apiNotificationsGet(page, size, sort, options).then((request) => request(axios, basePath)); }, /** * * @summary Sets firebase token to current session for sending notifications * @param {ControllersFcmId} [body] client registration id * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiNotificationsSetTokenPatch(body?: ControllersFcmId, options?: any): AxiosPromise { return NotificationsApiFp(configuration).apiNotificationsSetTokenPatch(body, options).then((request) => request(axios, basePath)); }, }; }; /** * Request parameters for apiNotificationsGet operation in NotificationsApi. * @export * @interface NotificationsApiApiNotificationsGetRequest */ export interface NotificationsApiApiNotificationsGetRequest { /** * Page number * @type {number} * @memberof NotificationsApiApiNotificationsGet */ readonly page?: number /** * Page size * @type {number} * @memberof NotificationsApiApiNotificationsGet */ readonly size?: number /** * Sort param * @type {string} * @memberof NotificationsApiApiNotificationsGet */ readonly sort?: string } /** * Request parameters for apiNotificationsSetTokenPatch operation in NotificationsApi. * @export * @interface NotificationsApiApiNotificationsSetTokenPatchRequest */ export interface NotificationsApiApiNotificationsSetTokenPatchRequest { /** * client registration id * @type {ControllersFcmId} * @memberof NotificationsApiApiNotificationsSetTokenPatch */ readonly body?: ControllersFcmId } /** * NotificationsApi - object-oriented interface * @export * @class NotificationsApi * @extends {BaseAPI} */ export class NotificationsApi extends BaseAPI { /** * Get all user notifications with pagination * @param {NotificationsApiApiNotificationsGetRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof NotificationsApi */ public apiNotificationsGet(requestParameters: NotificationsApiApiNotificationsGetRequest = {}, options?: any) { return NotificationsApiFp(this.configuration).apiNotificationsGet(requestParameters.page, requestParameters.size, requestParameters.sort, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Sets firebase token to current session for sending notifications * @param {NotificationsApiApiNotificationsSetTokenPatchRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof NotificationsApi */ public apiNotificationsSetTokenPatch(requestParameters: NotificationsApiApiNotificationsSetTokenPatchRequest = {}, options?: any) { return NotificationsApiFp(this.configuration).apiNotificationsSetTokenPatch(requestParameters.body, options).then((request) => request(this.axios, this.basePath)); } } \end{lstlisting} \subsection{@generated/api/registration-api.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * 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'; // @ts-ignore import { AuthEmailConfirmationInput } from '../models'; // @ts-ignore import { AuthManagerRegistrationInput } from '../models'; // @ts-ignore import { AuthRegistrationInput } from '../models'; /** * RegistrationApi - axios parameter creator * @export */ export const RegistrationApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Confirms email with code from email * @summary Confirm email * @param {AuthEmailConfirmationInput} request Email confirmation input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiRegisterConfirmPost: async (request: AuthEmailConfirmationInput, options: any = {}): Promise => { // verify required parameter 'request' is not null or undefined if (request === null || request === undefined) { throw new RequiredError('request','Required parameter request was null or undefined when calling apiRegisterConfirmPost.'); } const localVarPath = `/api/register/confirm`; // 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 queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; const nonString = typeof request !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(request !== undefined ? request : {}) : (request || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * Register another user * @summary Register another user from manager * @param {AuthManagerRegistrationInput} request Registration input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiRegisterManagerPost: async (request: AuthManagerRegistrationInput, options: any = {}): Promise => { // verify required parameter 'request' is not null or undefined if (request === null || request === undefined) { throw new RequiredError('request','Required parameter request was null or undefined when calling apiRegisterManagerPost.'); } const localVarPath = `/api/register/manager`; // 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 queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; const nonString = typeof request !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(request !== undefined ? request : {}) : (request || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * Register with this route * @summary Register * @param {AuthRegistrationInput} request Email registration input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiRegisterPost: async (request: AuthRegistrationInput, options: any = {}): Promise => { // verify required parameter 'request' is not null or undefined if (request === null || request === undefined) { throw new RequiredError('request','Required parameter request was null or undefined when calling apiRegisterPost.'); } const localVarPath = `/api/register`; // 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 queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; const nonString = typeof request !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(request !== undefined ? request : {}) : (request || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, } }; /** * RegistrationApi - functional programming interface * @export */ export const RegistrationApiFp = function(configuration?: Configuration) { return { /** * Confirms email with code from email * @summary Confirm email * @param {AuthEmailConfirmationInput} request Email confirmation input * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiRegisterConfirmPost(request: AuthEmailConfirmationInput, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await RegistrationApiAxiosParamCreator(configuration).apiRegisterConfirmPost(request, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * Register another user * @summary Register another user from manager * @param {AuthManagerRegistrationInput} request Registration input * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiRegisterManagerPost(request: AuthManagerRegistrationInput, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await RegistrationApiAxiosParamCreator(configuration).apiRegisterManagerPost(request, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * Register with this route * @summary Register * @param {AuthRegistrationInput} request Email registration input * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiRegisterPost(request: AuthRegistrationInput, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await RegistrationApiAxiosParamCreator(configuration).apiRegisterPost(request, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * RegistrationApi - factory interface * @export */ export const RegistrationApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * Confirms email with code from email * @summary Confirm email * @param {AuthEmailConfirmationInput} request Email confirmation input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiRegisterConfirmPost(request: AuthEmailConfirmationInput, options?: any): AxiosPromise { return RegistrationApiFp(configuration).apiRegisterConfirmPost(request, options).then((request) => request(axios, basePath)); }, /** * Register another user * @summary Register another user from manager * @param {AuthManagerRegistrationInput} request Registration input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiRegisterManagerPost(request: AuthManagerRegistrationInput, options?: any): AxiosPromise { return RegistrationApiFp(configuration).apiRegisterManagerPost(request, options).then((request) => request(axios, basePath)); }, /** * Register with this route * @summary Register * @param {AuthRegistrationInput} request Email registration input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiRegisterPost(request: AuthRegistrationInput, options?: any): AxiosPromise { return RegistrationApiFp(configuration).apiRegisterPost(request, options).then((request) => request(axios, basePath)); }, }; }; /** * Request parameters for apiRegisterConfirmPost operation in RegistrationApi. * @export * @interface RegistrationApiApiRegisterConfirmPostRequest */ export interface RegistrationApiApiRegisterConfirmPostRequest { /** * Email confirmation input * @type {AuthEmailConfirmationInput} * @memberof RegistrationApiApiRegisterConfirmPost */ readonly request: AuthEmailConfirmationInput } /** * Request parameters for apiRegisterManagerPost operation in RegistrationApi. * @export * @interface RegistrationApiApiRegisterManagerPostRequest */ export interface RegistrationApiApiRegisterManagerPostRequest { /** * Registration input * @type {AuthManagerRegistrationInput} * @memberof RegistrationApiApiRegisterManagerPost */ readonly request: AuthManagerRegistrationInput } /** * Request parameters for apiRegisterPost operation in RegistrationApi. * @export * @interface RegistrationApiApiRegisterPostRequest */ export interface RegistrationApiApiRegisterPostRequest { /** * Email registration input * @type {AuthRegistrationInput} * @memberof RegistrationApiApiRegisterPost */ readonly request: AuthRegistrationInput } /** * RegistrationApi - object-oriented interface * @export * @class RegistrationApi * @extends {BaseAPI} */ export class RegistrationApi extends BaseAPI { /** * Confirms email with code from email * @summary Confirm email * @param {RegistrationApiApiRegisterConfirmPostRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof RegistrationApi */ public apiRegisterConfirmPost(requestParameters: RegistrationApiApiRegisterConfirmPostRequest, options?: any) { return RegistrationApiFp(this.configuration).apiRegisterConfirmPost(requestParameters.request, options).then((request) => request(this.axios, this.basePath)); } /** * Register another user * @summary Register another user from manager * @param {RegistrationApiApiRegisterManagerPostRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof RegistrationApi */ public apiRegisterManagerPost(requestParameters: RegistrationApiApiRegisterManagerPostRequest, options?: any) { return RegistrationApiFp(this.configuration).apiRegisterManagerPost(requestParameters.request, options).then((request) => request(this.axios, this.basePath)); } /** * Register with this route * @summary Register * @param {RegistrationApiApiRegisterPostRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof RegistrationApi */ public apiRegisterPost(requestParameters: RegistrationApiApiRegisterPostRequest, options?: any) { return RegistrationApiFp(this.configuration).apiRegisterPost(requestParameters.request, options).then((request) => request(this.axios, this.basePath)); } } \end{lstlisting} \subsection{@generated/api/settings-api.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * 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'; // @ts-ignore import { UserSettings } from '../models'; /** * SettingsApi - axios parameter creator * @export */ export const SettingsApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * * @summary Retrieves user\'s settings * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiUserSettingsGet: async (options: any = {}): Promise => { const localVarPath = `/api/user-settings`; // 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: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Updates user settings * @param {UserSettings} [body] user settings input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiUserSettingsPatch: async (body?: UserSettings, options: any = {}): Promise => { const localVarPath = `/api/user-settings`; // 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: 'PATCH', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; localVarHeaderParameter['Content-Type'] = 'application/json'; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; const nonString = typeof body !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, } }; /** * SettingsApi - functional programming interface * @export */ export const SettingsApiFp = function(configuration?: Configuration) { return { /** * * @summary Retrieves user\'s settings * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiUserSettingsGet(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await SettingsApiAxiosParamCreator(configuration).apiUserSettingsGet(options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * * @summary Updates user settings * @param {UserSettings} [body] user settings input * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiUserSettingsPatch(body?: UserSettings, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await SettingsApiAxiosParamCreator(configuration).apiUserSettingsPatch(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * SettingsApi - factory interface * @export */ export const SettingsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * * @summary Retrieves user\'s settings * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiUserSettingsGet(options?: any): AxiosPromise { return SettingsApiFp(configuration).apiUserSettingsGet(options).then((request) => request(axios, basePath)); }, /** * * @summary Updates user settings * @param {UserSettings} [body] user settings input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiUserSettingsPatch(body?: UserSettings, options?: any): AxiosPromise { return SettingsApiFp(configuration).apiUserSettingsPatch(body, options).then((request) => request(axios, basePath)); }, }; }; /** * Request parameters for apiUserSettingsPatch operation in SettingsApi. * @export * @interface SettingsApiApiUserSettingsPatchRequest */ export interface SettingsApiApiUserSettingsPatchRequest { /** * user settings input * @type {UserSettings} * @memberof SettingsApiApiUserSettingsPatch */ readonly body?: UserSettings } /** * SettingsApi - object-oriented interface * @export * @class SettingsApi * @extends {BaseAPI} */ export class SettingsApi extends BaseAPI { /** * * @summary Retrieves user\'s settings * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SettingsApi */ public apiUserSettingsGet(options?: any) { return SettingsApiFp(this.configuration).apiUserSettingsGet(options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Updates user settings * @param {SettingsApiApiUserSettingsPatchRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SettingsApi */ public apiUserSettingsPatch(requestParameters: SettingsApiApiUserSettingsPatchRequest = {}, options?: any) { return SettingsApiFp(this.configuration).apiUserSettingsPatch(requestParameters.body, options).then((request) => request(this.axios, this.basePath)); } } \end{lstlisting} \subsection{@generated/api/user-api.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * 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'; // @ts-ignore import { UserEditableInfo } from '../models'; // @ts-ignore import { UserExtendedUser } from '../models'; // @ts-ignore import { UserResponse } from '../models'; // @ts-ignore import { UserUser } from '../models'; /** * UserApi - axios parameter creator * @export */ export const UserApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * * @summary GetAllUsers * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] sort * @param {Array} [role] User role * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiUserGet: async (page?: number, size?: number, sort?: string, role?: Array, options: any = {}): Promise => { const localVarPath = `/api/user`; // 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: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (page !== undefined) { localVarQueryParameter['page'] = page; } if (size !== undefined) { localVarQueryParameter['size'] = size; } if (sort !== undefined) { localVarQueryParameter['sort'] = sort; } const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } // role=a&role=b if (role) { for (const index in role) { queryParameters.append('role', role[index]); } } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Block or unblock user * @param {string} id User id * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiUserIdBlockPatch: async (id: string, options: any = {}): Promise => { // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiUserIdBlockPatch.'); } const localVarPath = `/api/user/{id}/block` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // 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: 'PATCH', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Retrieves user based on given ID * @param {string} id User ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiUserIdGet: async (id: string, options: any = {}): Promise => { // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiUserIdGet.'); } const localVarPath = `/api/user/{id}` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // 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: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * * @summary Update user info * @param {string} id User id * @param {UserEditableInfo} [body] Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiUserIdPatch: async (id: string, body?: UserEditableInfo, options: any = {}): Promise => { // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new RequiredError('id', 'Required parameter id was null or undefined when calling apiUserIdPatch.'); } const localVarPath = `/api/user/{id}` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // 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: 'PATCH', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; localVarHeaderParameter['Content-Type'] = 'application/json'; const queryParameters = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { queryParameters.set(key, localVarQueryParameter[key]); } for (const key in options.query) { queryParameters.set(key, options.query[key]); } localVarUrlObj.search = (new URLSearchParams(queryParameters)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; const nonString = typeof body !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime ? configuration.isJsonMime(localVarRequestOptions.headers['Content-Type']) : nonString; localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, } }; /** * UserApi - functional programming interface * @export */ export const UserApiFp = function (configuration?: Configuration) { return { /** * * @summary GetAllUsers * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] sort * @param {Array} [role] User role * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiUserGet(page?: number, size?: number, sort?: string, role?: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).apiUserGet(page, size, sort, role, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url }; return axios.request(axiosRequestArgs); }; }, /** * * @summary Block or unblock user * @param {string} id User id * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiUserIdBlockPatch(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).apiUserIdBlockPatch(id, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url }; return axios.request(axiosRequestArgs); }; }, /** * * @summary Retrieves user based on given ID * @param {string} id User ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiUserIdGet(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).apiUserIdGet(id, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url }; return axios.request(axiosRequestArgs); }; }, /** * * @summary Update user info * @param {string} id User id * @param {UserEditableInfo} [body] Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ async apiUserIdPatch(id: string, body?: UserEditableInfo, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).apiUserIdPatch(id, body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = { ...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url }; return axios.request(axiosRequestArgs); }; }, } }; /** * UserApi - factory interface * @export */ export const UserApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * * @summary GetAllUsers * @param {number} [page] Page number * @param {number} [size] Page size * @param {string} [sort] sort * @param {Array} [role] User role * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiUserGet(page?: number, size?: number, sort?: string, role?: Array, options?: any): AxiosPromise { return UserApiFp(configuration).apiUserGet(page, size, sort, role, options).then((request) => request(axios, basePath)); }, /** * * @summary Block or unblock user * @param {string} id User id * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiUserIdBlockPatch(id: string, options?: any): AxiosPromise { return UserApiFp(configuration).apiUserIdBlockPatch(id, options).then((request) => request(axios, basePath)); }, /** * * @summary Retrieves user based on given ID * @param {string} id User ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiUserIdGet(id: string, options?: any): AxiosPromise { return UserApiFp(configuration).apiUserIdGet(id, options).then((request) => request(axios, basePath)); }, /** * * @summary Update user info * @param {string} id User id * @param {UserEditableInfo} [body] Input * @param {*} [options] Override http request option. * @throws {RequiredError} */ apiUserIdPatch(id: string, body?: UserEditableInfo, options?: any): AxiosPromise { return UserApiFp(configuration).apiUserIdPatch(id, body, options).then((request) => request(axios, basePath)); }, }; }; /** * Request parameters for apiUserGet operation in UserApi. * @export * @interface UserApiApiUserGetRequest */ export interface UserApiApiUserGetRequest { /** * Page number * @type {number} * @memberof UserApiApiUserGet */ readonly page?: number /** * Page size * @type {number} * @memberof UserApiApiUserGet */ readonly size?: number /** * sort * @type {string} * @memberof UserApiApiUserGet */ readonly sort?: string /** * User role * @type {Array} * @memberof UserApiApiUserGet */ readonly role?: Array } /** * Request parameters for apiUserIdBlockPatch operation in UserApi. * @export * @interface UserApiApiUserIdBlockPatchRequest */ export interface UserApiApiUserIdBlockPatchRequest { /** * User id * @type {string} * @memberof UserApiApiUserIdBlockPatch */ readonly id: string } /** * Request parameters for apiUserIdGet operation in UserApi. * @export * @interface UserApiApiUserIdGetRequest */ export interface UserApiApiUserIdGetRequest { /** * User ID * @type {string} * @memberof UserApiApiUserIdGet */ readonly id: string } /** * Request parameters for apiUserIdPatch operation in UserApi. * @export * @interface UserApiApiUserIdPatchRequest */ export interface UserApiApiUserIdPatchRequest { /** * User id * @type {string} * @memberof UserApiApiUserIdPatch */ readonly id: string /** * Input * @type {UserEditableInfo} * @memberof UserApiApiUserIdPatch */ readonly body?: UserEditableInfo } /** * UserApi - object-oriented interface * @export * @class UserApi * @extends {BaseAPI} */ export class UserApi extends BaseAPI { /** * * @summary GetAllUsers * @param {UserApiApiUserGetRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UserApi */ public apiUserGet(requestParameters: UserApiApiUserGetRequest = {}, options?: any) { return UserApiFp(this.configuration).apiUserGet(requestParameters.page, requestParameters.size, requestParameters.sort, requestParameters.role, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Block or unblock user * @param {UserApiApiUserIdBlockPatchRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UserApi */ public apiUserIdBlockPatch(requestParameters: UserApiApiUserIdBlockPatchRequest, options?: any) { return UserApiFp(this.configuration).apiUserIdBlockPatch(requestParameters.id, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Retrieves user based on given ID * @param {UserApiApiUserIdGetRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UserApi */ public apiUserIdGet(requestParameters: UserApiApiUserIdGetRequest, options?: any) { return UserApiFp(this.configuration).apiUserIdGet(requestParameters.id, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Update user info * @param {UserApiApiUserIdPatchRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UserApi */ public apiUserIdPatch(requestParameters: UserApiApiUserIdPatchRequest, options?: any) { return UserApiFp(this.configuration).apiUserIdPatch(requestParameters.id, requestParameters.body, options).then((request) => request(this.axios, this.basePath)); } } \end{lstlisting} \subsection{@generated/base.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { Configuration } from "./configuration"; // Some imports not used depending on template conditions // @ts-ignore import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; export const BASE_PATH = process.env.REACT_APP_API_URL?.replace(/\/+$/, "") ?? ""; /** * * @export */ export const COLLECTION_FORMATS = { csv: ",", ssv: " ", tsv: "\t", pipes: "|", }; /** * * @export * @interface RequestArgs */ export interface RequestArgs { url: string; options: any; } /** * * @export * @class BaseAPI */ export class BaseAPI { protected configuration: Configuration | undefined; constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { if (configuration) { this.configuration = configuration; this.basePath = configuration.basePath || this.basePath; } } }; /** * * @export * @class RequiredError * @extends {Error} */ export class RequiredError extends Error { name: "RequiredError" = "RequiredError"; constructor(public field: string, msg?: string) { super(msg); } } \end{lstlisting} \subsection{@generated/configuration.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); basePath?: string; baseOptions?: any; formDataCtor?: new () => any; } export class Configuration { /** * parameter for apiKey security * @param name security name * @memberof Configuration */ apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); /** * parameter for basic security * * @type {string} * @memberof Configuration */ username?: string; /** * parameter for basic security * * @type {string} * @memberof Configuration */ password?: string; /** * parameter for oauth2 security * @param name security name * @param scopes oauth2 scope * @memberof Configuration */ accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); /** * override base path * * @type {string} * @memberof Configuration */ basePath?: string; /** * base options for axios calls * * @type {any} * @memberof Configuration */ baseOptions?: any; /** * The FormData constructor that will be used to create multipart form data * requests. You can inject this here so that execution environments that * do not support the FormData class can still run the generated client. * * @type {new () => FormData} */ formDataCtor?: new () => any; constructor(param: ConfigurationParameters = {}) { this.apiKey = param.apiKey; this.username = param.username; this.password = param.password; this.accessToken = param.accessToken; this.basePath = param.basePath; this.baseOptions = param.baseOptions; this.formDataCtor = param.formDataCtor; } /** * Check if the given MIME is a JSON MIME. * JSON MIME examples: * application/json * application/json; charset=UTF8 * APPLICATION/JSON * application/vnd.company+json * @param mime - MIME (Multipurpose Internet Mail Extensions) * @return True if the given MIME is JSON, false otherwise. */ public isJsonMime(mime: string): boolean { const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); } } \end{lstlisting} \subsection{@generated/git_push.sh} \begin{lstlisting} #!/bin/sh # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ # # Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" git_user_id=$1 git_repo_id=$2 release_note=$3 git_host=$4 if [ "$git_host" = "" ]; then git_host="github.com" echo "[INFO] No command line input provided. Set \$git_host to $git_host" fi if [ "$git_user_id" = "" ]; then git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi if [ "$release_note" = "" ]; then release_note="Minor update" echo "[INFO] No command line input provided. Set \$release_note to $release_note" fi # Initialize the local directory as a Git repository git init # Adds the files in the local repository and stages them for commit. git add . # Commits the tracked changes and prepares them to be pushed to a remote repository. git commit -m "$release_note" # Sets the new remote git_remote=`git remote` if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git else git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git fi fi git pull origin master # Pushes (Forces) the changes in the local repository up to the remote repository echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" git push origin master 2>&1 | grep -v 'To https' \end{lstlisting} \subsection{@generated/index.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ export * from "./api"; export * from "./configuration"; export * from "./models"; \end{lstlisting} \subsection{@generated/models/analytics-one-month-profit.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface AnalyticsOneMonthProfit */ export interface AnalyticsOneMonthProfit { /** * * @type {string} * @memberof AnalyticsOneMonthProfit */ month?: string; /** * * @type {number} * @memberof AnalyticsOneMonthProfit */ to_application?: number; /** * * @type {number} * @memberof AnalyticsOneMonthProfit */ to_fund?: number; /** * * @type {number} * @memberof AnalyticsOneMonthProfit */ total?: number; /** * * @type {string} * @memberof AnalyticsOneMonthProfit */ year?: string; } \end{lstlisting} \subsection{@generated/models/analytics-one-month-registrations.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface AnalyticsOneMonthRegistrations */ export interface AnalyticsOneMonthRegistrations { /** * * @type {number} * @memberof AnalyticsOneMonthRegistrations */ count?: number; /** * * @type {string} * @memberof AnalyticsOneMonthRegistrations */ month?: string; /** * * @type {string} * @memberof AnalyticsOneMonthRegistrations */ year?: string; } \end{lstlisting} \subsection{@generated/models/analytics-top-category.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface AnalyticsTopCategory */ export interface AnalyticsTopCategory { /** * * @type {string} * @memberof AnalyticsTopCategory */ category_id?: string; /** * * @type {number} * @memberof AnalyticsTopCategory */ count?: number; } \end{lstlisting} \subsection{@generated/models/audit-audit.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { UserUser } from './user-user'; /** * * @export * @interface AuditAudit */ export interface AuditAudit { /** * * @type {UserUser} * @memberof AuditAudit */ author?: UserUser; /** * * @type {string} * @memberof AuditAudit */ created_at?: string; /** * * @type {string} * @memberof AuditAudit */ data?: string; /** * * @type {string} * @memberof AuditAudit */ id?: string; /** * * @type {string} * @memberof AuditAudit */ type?: AuditAuditTypeEnum; } /** * @export * @enum {string} */ export enum AuditAuditTypeEnum { Login = 'Login', ApplicationStatusChanged = 'ApplicationStatusChanged', ApplicationDataChange = 'ApplicationDataChange' } \end{lstlisting} \subsection{@generated/models/audit-response.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { AuditAudit } from './audit-audit'; import { UtilsPageData } from './utils-page-data'; /** * * @export * @interface AuditResponse */ export interface AuditResponse { /** * * @type {Array} * @memberof AuditResponse */ data?: Array; /** * * @type {UtilsPageData} * @memberof AuditResponse */ page?: UtilsPageData; } \end{lstlisting} \subsection{@generated/models/auth-credentials.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface AuthCredentials */ export interface AuthCredentials { /** * * @type {string} * @memberof AuthCredentials */ email?: string; /** * * @type {string} * @memberof AuthCredentials */ password?: string; } \end{lstlisting} \subsection{@generated/models/auth-email-confirmation-input.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface AuthEmailConfirmationInput */ export interface AuthEmailConfirmationInput { /** * * @type {string} * @memberof AuthEmailConfirmationInput */ code?: string; /** * * @type {string} * @memberof AuthEmailConfirmationInput */ email?: string; } \end{lstlisting} \subsection{@generated/models/auth-manager-registration-input.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { AuthManagerRegistrationUser } from './auth-manager-registration-user'; /** * * @export * @interface AuthManagerRegistrationInput */ export interface AuthManagerRegistrationInput { /** * * @type {Array} * @memberof AuthManagerRegistrationInput */ assigned_categories?: Array; /** * * @type {string} * @memberof AuthManagerRegistrationInput */ role?: AuthManagerRegistrationInputRoleEnum; /** * * @type {AuthManagerRegistrationUser} * @memberof AuthManagerRegistrationInput */ user?: AuthManagerRegistrationUser; } /** * @export * @enum {string} */ export enum AuthManagerRegistrationInputRoleEnum { User = 'User', Manager = 'Manager', SuperManager = 'SuperManager', ContentManager = 'ContentManager', Operator = 'Operator', Admin = 'Admin' } \end{lstlisting} \subsection{@generated/models/auth-manager-registration-user.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface AuthManagerRegistrationUser */ export interface AuthManagerRegistrationUser { /** * * @type {string} * @memberof AuthManagerRegistrationUser */ birth_date?: string; /** * * @type {string} * @memberof AuthManagerRegistrationUser */ city?: string; /** * * @type {string} * @memberof AuthManagerRegistrationUser */ country?: string; /** * * @type {string} * @memberof AuthManagerRegistrationUser */ email: string; /** * * @type {string} * @memberof AuthManagerRegistrationUser */ first_name: string; /** * * @type {string} * @memberof AuthManagerRegistrationUser */ image_id?: string; /** * * @type {string} * @memberof AuthManagerRegistrationUser */ last_name: string; /** * * @type {string} * @memberof AuthManagerRegistrationUser */ middle_name?: string; /** * * @type {string} * @memberof AuthManagerRegistrationUser */ phone?: string; } \end{lstlisting} \subsection{@generated/models/auth-registration-input.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface AuthRegistrationInput */ export interface AuthRegistrationInput { /** * * @type {string} * @memberof AuthRegistrationInput */ birth_date?: string; /** * * @type {string} * @memberof AuthRegistrationInput */ city?: string; /** * * @type {string} * @memberof AuthRegistrationInput */ country?: string; /** * * @type {string} * @memberof AuthRegistrationInput */ email: string; /** * * @type {string} * @memberof AuthRegistrationInput */ first_name: string; /** * * @type {string} * @memberof AuthRegistrationInput */ image_id?: string; /** * * @type {string} * @memberof AuthRegistrationInput */ last_name: string; /** * * @type {string} * @memberof AuthRegistrationInput */ middle_name?: string; /** * * @type {string} * @memberof AuthRegistrationInput */ password: string; /** * * @type {string} * @memberof AuthRegistrationInput */ phone?: string; } \end{lstlisting} \subsection{@generated/models/auth-unregistered-user.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { UserPrettyPublicKey } from './user-pretty-public-key'; /** * * @export * @interface AuthUnregisteredUser */ export interface AuthUnregisteredUser { /** * * @type {string} * @memberof AuthUnregisteredUser */ birth_date?: string; /** * * @type {boolean} * @memberof AuthUnregisteredUser */ blocked?: boolean; /** * * @type {string} * @memberof AuthUnregisteredUser */ city?: string; /** * * @type {string} * @memberof AuthUnregisteredUser */ country?: string; /** * * @type {string} * @memberof AuthUnregisteredUser */ created_at?: string; /** * * @type {string} * @memberof AuthUnregisteredUser */ email?: string; /** * * @type {string} * @memberof AuthUnregisteredUser */ first_name?: string; /** * * @type {string} * @memberof AuthUnregisteredUser */ id?: string; /** * * @type {string} * @memberof AuthUnregisteredUser */ image_id?: string; /** * * @type {string} * @memberof AuthUnregisteredUser */ last_name?: string; /** * * @type {string} * @memberof AuthUnregisteredUser */ middle_name?: string; /** * * @type {string} * @memberof AuthUnregisteredUser */ phone?: string; /** * * @type {UserPrettyPublicKey} * @memberof AuthUnregisteredUser */ pretty_public_key?: UserPrettyPublicKey; /** * * @type {string} * @memberof AuthUnregisteredUser */ role?: AuthUnregisteredUserRoleEnum; } /** * @export * @enum {string} */ export enum AuthUnregisteredUserRoleEnum { User = 'User', Manager = 'Manager', SuperManager = 'SuperManager', ContentManager = 'ContentManager', Operator = 'Operator', Admin = 'Admin' } \end{lstlisting} \subsection{@generated/models/blockchain-deposit.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { UtilsMoneyJson } from './utils-money-json'; /** * * @export * @interface BlockchainDeposit */ export interface BlockchainDeposit { /** * * @type {UtilsMoneyJson} * @memberof BlockchainDeposit */ amount: UtilsMoneyJson; /** * * @type {string} * @memberof BlockchainDeposit */ user_id: string; } \end{lstlisting} \subsection{@generated/models/blockchain-donate-request-input.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { UtilsMoneyJson } from './utils-money-json'; /** * * @export * @interface BlockchainDonateRequestInput */ export interface BlockchainDonateRequestInput { /** * * @type {UtilsMoneyJson} * @memberof BlockchainDonateRequestInput */ amount: UtilsMoneyJson; /** * * @type {number} * @memberof BlockchainDonateRequestInput */ application: number; /** * * @type {string} * @memberof BlockchainDonateRequestInput */ password: string; } \end{lstlisting} \subsection{@generated/models/blockchain-donation-to-application-from-fund.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { UtilsMoneyJson } from './utils-money-json'; /** * * @export * @interface BlockchainDonationToApplicationFromFund */ export interface BlockchainDonationToApplicationFromFund { /** * * @type {UtilsMoneyJson} * @memberof BlockchainDonationToApplicationFromFund */ amount: UtilsMoneyJson; /** * * @type {boolean} * @memberof BlockchainDonationToApplicationFromFund */ anonymous?: boolean; /** * * @type {number} * @memberof BlockchainDonationToApplicationFromFund */ application_id: number; /** * * @type {string} * @memberof BlockchainDonationToApplicationFromFund */ donor_id?: string; } \end{lstlisting} \subsection{@generated/models/blockchain-donation-to-charity-from-user.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { UtilsMoneyJson } from './utils-money-json'; /** * * @export * @interface BlockchainDonationToCharityFromUser */ export interface BlockchainDonationToCharityFromUser { /** * * @type {UtilsMoneyJson} * @memberof BlockchainDonationToCharityFromUser */ amount: UtilsMoneyJson; /** * * @type {boolean} * @memberof BlockchainDonationToCharityFromUser */ anonymous?: boolean; /** * * @type {string} * @memberof BlockchainDonationToCharityFromUser */ password: string; } \end{lstlisting} \subsection{@generated/models/blockchain-donation-to-charity.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { UserUser } from './user-user'; import { UtilsMoneyJson } from './utils-money-json'; /** * * @export * @interface BlockchainDonationToCharity */ export interface BlockchainDonationToCharity { /** * * @type {UtilsMoneyJson} * @memberof BlockchainDonationToCharity */ amount?: UtilsMoneyJson; /** * * @type {UserUser} * @memberof BlockchainDonationToCharity */ donor?: UserUser; } \end{lstlisting} \subsection{@generated/models/blockchain-donation.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { AuthUnregisteredUser } from './auth-unregistered-user'; import { DonationRequestDonationRequest } from './donation-request-donation-request'; import { UserUser } from './user-user'; import { UtilsMoneyJson } from './utils-money-json'; /** * * @export * @interface BlockchainDonation */ export interface BlockchainDonation { /** * * @type {UtilsMoneyJson} * @memberof BlockchainDonation */ amount?: UtilsMoneyJson; /** * * @type {boolean} * @memberof BlockchainDonation */ anonymous?: boolean; /** * * @type {string} * @memberof BlockchainDonation */ created_at?: string; /** * * @type {UserUser} * @memberof BlockchainDonation */ donation_author?: UserUser; /** * * @type {DonationRequestDonationRequest} * @memberof BlockchainDonation */ donation_request?: DonationRequestDonationRequest; /** * * @type {string} * @memberof BlockchainDonation */ id?: string; /** * * @type {AuthUnregisteredUser} * @memberof BlockchainDonation */ unverified_author?: AuthUnregisteredUser; } \end{lstlisting} \subsection{@generated/models/blockchain-donations-response.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { BlockchainDonation } from './blockchain-donation'; import { UtilsPageData } from './utils-page-data'; /** * * @export * @interface BlockchainDonationsResponse */ export interface BlockchainDonationsResponse { /** * * @type {Array} * @memberof BlockchainDonationsResponse */ data?: Array; /** * * @type {UtilsPageData} * @memberof BlockchainDonationsResponse */ page?: UtilsPageData; } \end{lstlisting} \subsection{@generated/models/blockchain-status-response.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { BlockchainStatus } from './blockchain-status'; import { UtilsPageData } from './utils-page-data'; /** * * @export * @interface BlockchainStatusResponse */ export interface BlockchainStatusResponse { /** * * @type {Array} * @memberof BlockchainStatusResponse */ data?: Array; /** * * @type {UtilsPageData} * @memberof BlockchainStatusResponse */ page?: UtilsPageData; } \end{lstlisting} \subsection{@generated/models/blockchain-status.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface BlockchainStatus */ export interface BlockchainStatus { /** * * @type {string} * @memberof BlockchainStatus */ batch_id?: string; /** * * @type {string} * @memberof BlockchainStatus */ created_at?: string; /** * * @type {string} * @memberof BlockchainStatus */ error_string?: string; /** * * @type {string} * @memberof BlockchainStatus */ status?: BlockchainStatusStatusEnum; /** * * @type {string} * @memberof BlockchainStatus */ type?: BlockchainStatusTypeEnum; /** * * @type {string} * @memberof BlockchainStatus */ updated_at?: string; } /** * @export * @enum {string} */ export enum BlockchainStatusStatusEnum { Pending = 'Pending', Success = 'Success', Failure = 'Failure' } /** * @export * @enum {string} */ export enum BlockchainStatusTypeEnum { DonateToCharity = 'DonateToCharity', DonateFromCharityToApplication = 'DonateFromCharityToApplication', DonateToCharityFromExistingUser = 'DonateToCharityFromExistingUser', DonateToCharityFromNewUser = 'DonateToCharityFromNewUser', DepositMoney = 'DepositMoney', DonateToApplication = 'DonateToApplication', ProposeApplication = 'ProposeApplication', PublishApplication = 'PublishApplication', CancelApplication = 'CancelApplication', Registration = 'Registration', CloseApplication = 'CloseApplication' } \end{lstlisting} \subsection{@generated/models/category-admin-category.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface CategoryAdminCategory */ export interface CategoryAdminCategory { /** * * @type {string} * @memberof CategoryAdminCategory */ ara: string; /** * * @type {string} * @memberof CategoryAdminCategory */ eng: string; /** * * @type {string} * @memberof CategoryAdminCategory */ id: string; /** * * @type {boolean} * @memberof CategoryAdminCategory */ is_hidden?: boolean; /** * * @type {string} * @memberof CategoryAdminCategory */ rus: string; } \end{lstlisting} \subsection{@generated/models/category-category.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface CategoryCategory */ export interface CategoryCategory { /** * * @type {string} * @memberof CategoryCategory */ eng: string; /** * * @type {string} * @memberof CategoryCategory */ id: string; /** * * @type {string} * @memberof CategoryCategory */ rus: string; } \end{lstlisting} \subsection{@generated/models/category-delete-input.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface CategoryDeleteInput */ export interface CategoryDeleteInput { /** * * @type {Array} * @memberof CategoryDeleteInput */ categories: Array; } \end{lstlisting} \subsection{@generated/models/category-update-input.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { CategoryAdminCategory } from './category-admin-category'; /** * * @export * @interface CategoryUpdateInput */ export interface CategoryUpdateInput { /** * * @type {Array} * @memberof CategoryUpdateInput */ categories: Array; } \end{lstlisting} \subsection{@generated/models/charity-faq-input.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface CharityFaqInput */ export interface CharityFaqInput { /** * * @type {string} * @memberof CharityFaqInput */ faq?: string; } \end{lstlisting} \subsection{@generated/models/charity-faq.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface CharityFaq */ export interface CharityFaq { /** * * @type {string} * @memberof CharityFaq */ faq?: string; /** * * @type {string} * @memberof CharityFaq */ fund_id?: string; } \end{lstlisting} \subsection{@generated/models/charity-fund-info-response.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { FileInfo } from './file-info'; /** * * @export * @interface CharityFundInfoResponse */ export interface CharityFundInfoResponse { /** * * @type {string} * @memberof CharityFundInfoResponse */ address?: string; /** * * @type {string} * @memberof CharityFundInfoResponse */ description: string; /** * * @type {string} * @memberof CharityFundInfoResponse */ email?: string; /** * * @type {Array} * @memberof CharityFundInfoResponse */ files?: Array; /** * * @type {string} * @memberof CharityFundInfoResponse */ phone?: string; /** * * @type {string} * @memberof CharityFundInfoResponse */ title: string; } \end{lstlisting} \subsection{@generated/models/charity-fund-info.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface CharityFundInfo */ export interface CharityFundInfo { /** * * @type {string} * @memberof CharityFundInfo */ address?: string; /** * * @type {string} * @memberof CharityFundInfo */ description: string; /** * * @type {string} * @memberof CharityFundInfo */ email?: string; /** * * @type {string} * @memberof CharityFundInfo */ phone?: string; /** * * @type {string} * @memberof CharityFundInfo */ title: string; } \end{lstlisting} \subsection{@generated/models/charity-fund-input.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface CharityFundInput */ export interface CharityFundInput { /** * * @type {string} * @memberof CharityFundInput */ address?: string; /** * * @type {string} * @memberof CharityFundInput */ description: string; /** * * @type {string} * @memberof CharityFundInput */ email?: string; /** * * @type {Array} * @memberof CharityFundInput */ file_ids?: Array; /** * * @type {string} * @memberof CharityFundInput */ phone?: string; /** * * @type {string} * @memberof CharityFundInput */ title: string; } \end{lstlisting} \subsection{@generated/models/chat-admin-input.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface ChatAdminInput */ export interface ChatAdminInput { /** * * @type {Array} * @memberof ChatAdminInput */ attachments?: Array; /** * * @type {string} * @memberof ChatAdminInput */ body: string; /** * * @type {string} * @memberof ChatAdminInput */ dialog_id: string; } \end{lstlisting} \subsection{@generated/models/chat-dialog-response-body.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { ChatMessage } from './chat-message'; import { UserUser } from './user-user'; /** * * @export * @interface ChatDialogResponseBody */ export interface ChatDialogResponseBody { /** * * @type {string} * @memberof ChatDialogResponseBody */ id?: string; /** * * @type {ChatMessage} * @memberof ChatDialogResponseBody */ last_message?: ChatMessage; /** * * @type {number} * @memberof ChatDialogResponseBody */ unread_message_counter?: number; /** * * @type {UserUser} * @memberof ChatDialogResponseBody */ user?: UserUser; } \end{lstlisting} \subsection{@generated/models/chat-dialog-response.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { ChatDialogResponseBody } from './chat-dialog-response-body'; import { UtilsPageData } from './utils-page-data'; /** * * @export * @interface ChatDialogResponse */ export interface ChatDialogResponse { /** * * @type {Array} * @memberof ChatDialogResponse */ data?: Array; /** * * @type {UtilsPageData} * @memberof ChatDialogResponse */ page?: UtilsPageData; } \end{lstlisting} \subsection{@generated/models/chat-dialog.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { UserUser } from './user-user'; /** * * @export * @interface ChatDialog */ export interface ChatDialog { /** * * @type {string} * @memberof ChatDialog */ id?: string; /** * * @type {number} * @memberof ChatDialog */ unread_message_counter?: number; /** * * @type {UserUser} * @memberof ChatDialog */ user: UserUser; } \end{lstlisting} \subsection{@generated/models/chat-message-body.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { ChatDialog } from './chat-dialog'; import { FileInfo } from './file-info'; import { UserUser } from './user-user'; /** * * @export * @interface ChatMessageBody */ export interface ChatMessageBody { /** * * @type {Array} * @memberof ChatMessageBody */ attachments?: Array; /** * * @type {UserUser} * @memberof ChatMessageBody */ author?: UserUser; /** * * @type {string} * @memberof ChatMessageBody */ body?: string; /** * * @type {ChatDialog} * @memberof ChatMessageBody */ dialog?: ChatDialog; /** * * @type {string} * @memberof ChatMessageBody */ dialog_id?: string; /** * * @type {string} * @memberof ChatMessageBody */ created_at?: string; /** * * @type {number} * @memberof ChatMessageBody */ id?: number; } \end{lstlisting} \subsection{@generated/models/chat-message.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { UserUser } from './user-user'; /** * * @export * @interface ChatMessage */ export interface ChatMessage { /** * * @type {UserUser} * @memberof ChatMessage */ author?: UserUser; /** * * @type {string} * @memberof ChatMessage */ body?: string; /** * * @type {string} * @memberof ChatMessage */ created_at?: string; /** * * @type {number} * @memberof ChatMessage */ id?: number; } \end{lstlisting} \subsection{@generated/models/chat-messages-response.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { ChatMessageBody } from './chat-message-body'; /** * * @export * @interface ChatMessagesResponse */ export interface ChatMessagesResponse { /** * * @type {string} * @memberof ChatMessagesResponse */ cursor?: string; /** * * @type {Array} * @memberof ChatMessagesResponse */ data?: Array; } \end{lstlisting} \subsection{@generated/models/controllers-deposit.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { UtilsMoneyJson } from './utils-money-json'; /** * * @export * @interface ControllersDeposit */ export interface ControllersDeposit { /** * * @type {UtilsMoneyJson} * @memberof ControllersDeposit */ amount: UtilsMoneyJson; /** * * @type {string} * @memberof ControllersDeposit */ user_id: string; } \end{lstlisting} \subsection{@generated/models/controllers-donate-request-input.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { UtilsMoneyJson } from './utils-money-json'; /** * * @export * @interface ControllersDonateRequestInput */ export interface ControllersDonateRequestInput { /** * * @type {UtilsMoneyJson} * @memberof ControllersDonateRequestInput */ amount: UtilsMoneyJson; /** * * @type {number} * @memberof ControllersDonateRequestInput */ application: number; /** * * @type {string} * @memberof ControllersDonateRequestInput */ password: string; } \end{lstlisting} \subsection{@generated/models/controllers-fcm-id.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface ControllersFcmId */ export interface ControllersFcmId { /** * * @type {string} * @memberof ControllersFcmId */ id: string; } \end{lstlisting} \subsection{@generated/models/donation-request-body.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { CategoryCategory } from './category-category'; import { FileInfo } from './file-info'; import { UserSimpleUser } from './user-simple-user'; import { UserUser } from './user-user'; import { UtilsMoneyJson } from './utils-money-json'; /** * * @export * @interface DonationRequestBody */ export interface DonationRequestBody { /** * * @type {boolean} * @memberof DonationRequestBody */ anonymous?: boolean; /** * * @type {UtilsMoneyJson} * @memberof DonationRequestBody */ approved_amount?: UtilsMoneyJson; /** * * @type {UserUser} * @memberof DonationRequestBody */ assignee?: UserUser; /** * * @type {Array} * @memberof DonationRequestBody */ attached_files?: Array; /** * * @type {UserUser} * @memberof DonationRequestBody */ author?: UserUser; /** * * @type {Array} * @memberof DonationRequestBody */ available_statuses?: Array; /** * * @type {boolean} * @memberof DonationRequestBody */ undo_transition?: boolean; /** * * @type {CategoryCategory} * @memberof DonationRequestBody */ category?: CategoryCategory; /** * * @type {string} * @memberof DonationRequestBody */ created_at?: string; /** * * @type {string} * @memberof DonationRequestBody */ description?: string; /** * * @type {UserSimpleUser} * @memberof DonationRequestBody */ donee?: UserSimpleUser; /** * * @type {number} * @memberof DonationRequestBody */ id?: number; /** * * @type {UtilsMoneyJson} * @memberof DonationRequestBody */ received_amount?: UtilsMoneyJson; /** * * @type {string} * @memberof DonationRequestBody */ relationship?: string; /** * * @type {UtilsMoneyJson} * @memberof DonationRequestBody */ requested_amount?: UtilsMoneyJson; /** * * @type {string} * @memberof DonationRequestBody */ started_at?: string; /** * * @type {string} * @memberof DonationRequestBody */ status?: DonationRequestBodyStatusEnum; /** * * @type {string} * @memberof DonationRequestBody */ title?: string; /** * * @type {string} * @memberof DonationRequestBody */ until?: string; } /** * @export * @enum {string} */ export enum DonationRequestBodyAvailableStatusesEnum { New = 'New', InProcessing = 'InProcessing', Refused = 'Refused', NeedsImprovement = 'NeedsImprovement', Archived = 'Archived', SuperManagerConfirmation = 'SuperManagerConfirmation', UserConfirmation = 'UserConfirmation', Active = 'Active', Spam = 'Spam', Deleted = 'Deleted', OnRealization = 'OnRealization' } /** * @export * @enum {string} */ export enum DonationRequestBodyStatusEnum { New = 'New', InProcessing = 'InProcessing', Refused = 'Refused', NeedsImprovement = 'NeedsImprovement', Archived = 'Archived', SuperManagerConfirmation = 'SuperManagerConfirmation', UserConfirmation = 'UserConfirmation', Active = 'Active', Spam = 'Spam', Deleted = 'Deleted', OnRealization = 'OnRealization' } \end{lstlisting} \subsection{@generated/models/donation-request-comment.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { UserUser } from './user-user'; /** * * @export * @interface DonationRequestComment */ export interface DonationRequestComment { /** * * @type {UserUser} * @memberof DonationRequestComment */ author?: UserUser; /** * * @type {string} * @memberof DonationRequestComment */ created_at?: string; /** * * @type {number} * @memberof DonationRequestComment */ donation_request_id?: number; /** * * @type {string} * @memberof DonationRequestComment */ id?: string; /** * * @type {string} * @memberof DonationRequestComment */ text?: string; } \end{lstlisting} \subsection{@generated/models/donation-request-donation-request.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { CategoryCategory } from './category-category'; import { UserSimpleUser } from './user-simple-user'; import { UserUser } from './user-user'; import { UtilsMoneyJson } from './utils-money-json'; /** * * @export * @interface DonationRequestDonationRequest */ export interface DonationRequestDonationRequest { /** * * @type {boolean} * @memberof DonationRequestDonationRequest */ anonymous?: boolean; /** * * @type {UtilsMoneyJson} * @memberof DonationRequestDonationRequest */ approved_amount?: UtilsMoneyJson; /** * * @type {UserUser} * @memberof DonationRequestDonationRequest */ assignee?: UserUser; /** * * @type {UserUser} * @memberof DonationRequestDonationRequest */ author?: UserUser; /** * * @type {CategoryCategory} * @memberof DonationRequestDonationRequest */ category?: CategoryCategory; /** * * @type {string} * @memberof DonationRequestDonationRequest */ created_at?: string; /** * * @type {string} * @memberof DonationRequestDonationRequest */ description?: string; /** * * @type {UserSimpleUser} * @memberof DonationRequestDonationRequest */ donee?: UserSimpleUser; /** * * @type {number} * @memberof DonationRequestDonationRequest */ id?: number; /** * * @type {UtilsMoneyJson} * @memberof DonationRequestDonationRequest */ received_amount?: UtilsMoneyJson; /** * * @type {string} * @memberof DonationRequestDonationRequest */ relationship?: string; /** * * @type {UtilsMoneyJson} * @memberof DonationRequestDonationRequest */ requested_amount?: UtilsMoneyJson; /** * * @type {string} * @memberof DonationRequestDonationRequest */ started_at?: string; /** * * @type {string} * @memberof DonationRequestDonationRequest */ status?: DonationRequestDonationRequestStatusEnum; /** * * @type {string} * @memberof DonationRequestDonationRequest */ title?: string; /** * * @type {string} * @memberof DonationRequestDonationRequest */ until?: string; } /** * @export * @enum {string} */ export enum DonationRequestDonationRequestStatusEnum { New = 'New', InProcessing = 'InProcessing', Refused = 'Refused', NeedsImprovement = 'NeedsImprovement', Archived = 'Archived', SuperManagerConfirmation = 'SuperManagerConfirmation', UserConfirmation = 'UserConfirmation', Active = 'Active', Spam = 'Spam', Deleted = 'Deleted', OnRealization = 'OnRealization' } \end{lstlisting} \subsection{@generated/models/donation-request-history-response.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { DonationRequestStatusHistory } from './donation-request-status-history'; import { UtilsPageData } from './utils-page-data'; /** * * @export * @interface DonationRequestHistoryResponse */ export interface DonationRequestHistoryResponse { /** * * @type {Array} * @memberof DonationRequestHistoryResponse */ data?: Array; /** * * @type {UtilsPageData} * @memberof DonationRequestHistoryResponse */ page?: UtilsPageData; } \end{lstlisting} \subsection{@generated/models/donation-request-input.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { UserSimpleUser } from './user-simple-user'; import { UtilsMoneyJson } from './utils-money-json'; /** * * @export * @interface DonationRequestInput */ export interface DonationRequestInput { /** * * @type {string} * @memberof DonationRequestInput */ assignee_id?: string; /** * * @type {string} * @memberof DonationRequestInput */ category_id?: string; /** * * @type {string} * @memberof DonationRequestInput */ comment?: string; /** * * @type {string} * @memberof DonationRequestInput */ description?: string; /** * * @type {UserSimpleUser} * @memberof DonationRequestInput */ donee?: UserSimpleUser; /** * * @type {Array} * @memberof DonationRequestInput */ file_ids?: Array; /** * * @type {string} * @memberof DonationRequestInput */ relationship?: string; /** * * @type {UtilsMoneyJson} * @memberof DonationRequestInput */ requested_amount?: UtilsMoneyJson; /** * * @type {string} * @memberof DonationRequestInput */ title?: string; /** * * @type {string} * @memberof DonationRequestInput */ until?: string; } \end{lstlisting} \subsection{@generated/models/donation-request-response.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { DonationRequestBody } from './donation-request-body'; import { UtilsPageData } from './utils-page-data'; /** * * @export * @interface DonationRequestResponse */ export interface DonationRequestResponse { /** * * @type {Array} * @memberof DonationRequestResponse */ data?: Array; /** * * @type {UtilsPageData} * @memberof DonationRequestResponse */ page?: UtilsPageData; } \end{lstlisting} \subsection{@generated/models/donation-request-review-response.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { DonationRequestSingleReviewStatus } from './donation-request-single-review-status'; /** * * @export * @interface DonationRequestReviewResponse */ export interface DonationRequestReviewResponse { /** * * @type {number} * @memberof DonationRequestReviewResponse */ accepted_count?: number; /** * * @type {number} * @memberof DonationRequestReviewResponse */ not_viewed_count?: number; /** * * @type {number} * @memberof DonationRequestReviewResponse */ rejected_count?: number; /** * * @type {string} * @memberof DonationRequestReviewResponse */ review_status?: DonationRequestReviewResponseReviewStatusEnum; /** * * @type {Array} * @memberof DonationRequestReviewResponse */ reviewers?: Array; /** * * @type {number} * @memberof DonationRequestReviewResponse */ total_count?: number; } /** * @export * @enum {string} */ export enum DonationRequestReviewResponseReviewStatusEnum { Accepted = 'Accepted', Rejected = 'Rejected', NotViewed = 'NotViewed' } \end{lstlisting} \subsection{@generated/models/donation-request-single-review-status.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { UserUser } from './user-user'; /** * * @export * @interface DonationRequestSingleReviewStatus */ export interface DonationRequestSingleReviewStatus { /** * * @type {number} * @memberof DonationRequestSingleReviewStatus */ application_id?: number; /** * * @type {UserUser} * @memberof DonationRequestSingleReviewStatus */ manager?: UserUser; /** * * @type {string} * @memberof DonationRequestSingleReviewStatus */ single_review_status?: DonationRequestSingleReviewStatusSingleReviewStatusEnum; } /** * @export * @enum {string} */ export enum DonationRequestSingleReviewStatusSingleReviewStatusEnum { Accepted = 'Accepted', Rejected = 'Rejected', NotViewed = 'NotViewed' } \end{lstlisting} \subsection{@generated/models/donation-request-status-history.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { DonationRequestComment } from './donation-request-comment'; import { UserUser } from './user-user'; /** * * @export * @interface DonationRequestStatusHistory */ export interface DonationRequestStatusHistory { /** * * @type {UserUser} * @memberof DonationRequestStatusHistory */ assignee?: UserUser; /** * * @type {UserUser} * @memberof DonationRequestStatusHistory */ author?: UserUser; /** * * @type {DonationRequestComment} * @memberof DonationRequestStatusHistory */ comment?: DonationRequestComment; /** * * @type {string} * @memberof DonationRequestStatusHistory */ created_at?: string; /** * * @type {string} * @memberof DonationRequestStatusHistory */ current_status?: string; /** * * @type {number} * @memberof DonationRequestStatusHistory */ donation_request_id?: number; /** * * @type {string} * @memberof DonationRequestStatusHistory */ id?: string; /** * * @type {string} * @memberof DonationRequestStatusHistory */ previous_status?: string; } \end{lstlisting} \subsection{@generated/models/donation-request-submit-review-input.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface DonationRequestSubmitReviewInput */ export interface DonationRequestSubmitReviewInput { /** * * @type {number} * @memberof DonationRequestSubmitReviewInput */ id?: number; /** * * @type {string} * @memberof DonationRequestSubmitReviewInput */ review_status?: DonationRequestSubmitReviewInputReviewStatusEnum; } /** * @export * @enum {string} */ export enum DonationRequestSubmitReviewInputReviewStatusEnum { Accepted = 'Accepted', Rejected = 'Rejected', NotViewed = 'NotViewed' } \end{lstlisting} \subsection{@generated/models/donation-request-super-manager-input.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { UserSimpleUser } from './user-simple-user'; import { UtilsMoneyJson } from './utils-money-json'; /** * * @export * @interface DonationRequestSuperManagerInput */ export interface DonationRequestSuperManagerInput { /** * * @type {UtilsMoneyJson} * @memberof DonationRequestSuperManagerInput */ approved_amount?: UtilsMoneyJson; /** * * @type {string} * @memberof DonationRequestSuperManagerInput */ assignee_id?: string; /** * * @type {string} * @memberof DonationRequestSuperManagerInput */ category_id: string; /** * * @type {string} * @memberof DonationRequestSuperManagerInput */ comment?: string; /** * * @type {string} * @memberof DonationRequestSuperManagerInput */ description?: string; /** * * @type {UserSimpleUser} * @memberof DonationRequestSuperManagerInput */ donee?: UserSimpleUser; /** * * @type {Array} * @memberof DonationRequestSuperManagerInput */ file_ids?: Array; /** * * @type {string} * @memberof DonationRequestSuperManagerInput */ relationship?: string; /** * * @type {UtilsMoneyJson} * @memberof DonationRequestSuperManagerInput */ requested_amount?: UtilsMoneyJson; /** * * @type {string} * @memberof DonationRequestSuperManagerInput */ title?: string; /** * * @type {string} * @memberof DonationRequestSuperManagerInput */ until?: string; } \end{lstlisting} \subsection{@generated/models/donation-request-update-input.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { UserSimpleUser } from './user-simple-user'; import { UtilsMoneyJson } from './utils-money-json'; /** * * @export * @interface DonationRequestUpdateInput */ export interface DonationRequestUpdateInput { /** * * @type {boolean} * @memberof DonationRequestUpdateInput */ anonymous?: boolean; /** * * @type {UtilsMoneyJson} * @memberof DonationRequestUpdateInput */ approved_amount?: UtilsMoneyJson; /** * * @type {string} * @memberof DonationRequestUpdateInput */ assignee_id?: string; /** * * @type {string} * @memberof DonationRequestUpdateInput */ category_id?: string; /** * * @type {string} * @memberof DonationRequestUpdateInput */ description?: string; /** * * @type {UserSimpleUser} * @memberof DonationRequestUpdateInput */ donee?: UserSimpleUser; /** * * @type {Array} * @memberof DonationRequestUpdateInput */ file_ids?: Array; /** * * @type {string} * @memberof DonationRequestUpdateInput */ message?: string; /** * * @type {string} * @memberof DonationRequestUpdateInput */ relationship?: string; /** * * @type {UtilsMoneyJson} * @memberof DonationRequestUpdateInput */ requested_amount?: UtilsMoneyJson; /** * * @type {string} * @memberof DonationRequestUpdateInput */ title?: string; /** * * @type {string} * @memberof DonationRequestUpdateInput */ until?: string; } \end{lstlisting} \subsection{@generated/models/donation-request-update-status-input.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface DonationRequestUpdateStatusInput */ export interface DonationRequestUpdateStatusInput { /** * * @type {string} * @memberof DonationRequestUpdateStatusInput */ assignee_id?: string; /** * * @type {string} * @memberof DonationRequestUpdateStatusInput */ comment?: string; /** * * @type {string} * @memberof DonationRequestUpdateStatusInput */ password?: string; /** * * @type {string} * @memberof DonationRequestUpdateStatusInput */ status?: string; /** * * @type {Array} * @memberof DonationRequestUpdateStatusInput */ file_ids?: Array; } \end{lstlisting} \subsection{@generated/models/file-info.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface FileInfo */ export interface FileInfo { /** * * @type {string} * @memberof FileInfo */ created_at?: string; /** * * @type {string} * @memberof FileInfo */ id?: string; /** * * @type {string} * @memberof FileInfo */ mime_type?: string; /** * * @type {string} * @memberof FileInfo */ title?: string; } \end{lstlisting} \subsection{@generated/models/file-response.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface FileResponse */ export interface FileResponse { /** * * @type {string} * @memberof FileResponse */ createdAt?: string; /** * * @type {string} * @memberof FileResponse */ id?: string; } \end{lstlisting} \subsection{@generated/models/index.ts} \begin{lstlisting} export * from './analytics-one-month-profit'; export * from './analytics-one-month-registrations'; export * from './analytics-top-category'; export * from './audit-audit'; export * from './audit-response'; export * from './auth-credentials'; export * from './auth-email-confirmation-input'; export * from './auth-manager-registration-input'; export * from './auth-manager-registration-user'; export * from './auth-registration-input'; export * from './auth-unregistered-user'; export * from './blockchain-donation'; export * from './blockchain-donation-to-application-from-fund'; export * from './blockchain-donation-to-charity'; export * from './blockchain-donation-to-charity-from-user'; export * from './blockchain-donations-response'; export * from './blockchain-status'; export * from './blockchain-status-response'; export * from './category-admin-category'; export * from './category-category'; export * from './category-delete-input'; export * from './category-update-input'; export * from './charity-faq'; export * from './charity-faq-input'; export * from './charity-fund-info'; export * from './charity-fund-info-response'; export * from './charity-fund-input'; export * from './chat-admin-input'; export * from './chat-dialog'; export * from './chat-dialog-response'; export * from './chat-dialog-response-body'; export * from './chat-message'; export * from './chat-message-body'; export * from './chat-messages-response'; export * from './controllers-deposit'; export * from './controllers-donate-request-input'; export * from './controllers-fcm-id'; export * from './donation-request-body'; export * from './donation-request-comment'; export * from './donation-request-donation-request'; export * from './donation-request-history-response'; export * from './donation-request-input'; export * from './donation-request-response'; export * from './donation-request-review-response'; export * from './donation-request-single-review-status'; export * from './donation-request-status-history'; export * from './donation-request-submit-review-input'; export * from './donation-request-super-manager-input'; export * from './donation-request-update-input'; export * from './donation-request-update-status-input'; export * from './file-info'; export * from './news-input'; export * from './news-response'; export * from './news-view'; export * from './notifications-notification'; export * from './notifications-notification-response'; export * from './user-balance'; export * from './user-editable-info'; export * from './user-extended-user'; export * from './user-pretty-public-key'; export * from './user-response'; export * from './user-settings'; export * from './user-simple-user'; export * from './user-user'; export * from './utils-money-json'; export * from './utils-page-data'; \end{lstlisting} \subsection{@generated/models/news-input.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface NewsInput */ export interface NewsInput { /** * * @type {string} * @memberof NewsInput */ description: string; /** * * @type {string} * @memberof NewsInput */ image_id?: string; /** * * @type {string} * @memberof NewsInput */ text: string; /** * * @type {string} * @memberof NewsInput */ title: string; } \end{lstlisting} \subsection{@generated/models/news-response.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { NewsView } from './news-view'; import { UtilsPageData } from './utils-page-data'; /** * * @export * @interface NewsResponse */ export interface NewsResponse { /** * * @type {Array} * @memberof NewsResponse */ data?: Array; /** * * @type {UtilsPageData} * @memberof NewsResponse */ page?: UtilsPageData; } \end{lstlisting} \subsection{@generated/models/news-view.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface NewsView */ export interface NewsView { /** * * @type {string} * @memberof NewsView */ created_at?: string; /** * * @type {string} * @memberof NewsView */ description?: string; /** * * @type {string} * @memberof NewsView */ id?: string; /** * * @type {string} * @memberof NewsView */ image_id?: string; /** * * @type {string} * @memberof NewsView */ text?: string; /** * * @type {string} * @memberof NewsView */ title?: string; /** * * @type {string} * @memberof NewsView */ updated_at?: string; } \end{lstlisting} \subsection{@generated/models/notifications-notification-response.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { NotificationsNotification } from './notifications-notification'; import { UtilsPageData } from './utils-page-data'; /** * * @export * @interface NotificationsNotificationResponse */ export interface NotificationsNotificationResponse { /** * * @type {Array} * @memberof NotificationsNotificationResponse */ data?: Array; /** * * @type {UtilsPageData} * @memberof NotificationsNotificationResponse */ page?: UtilsPageData; } \end{lstlisting} \subsection{@generated/models/notifications-notification.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { UserUser } from './user-user'; /** * * @export * @interface NotificationsNotification */ export interface NotificationsNotification { /** * * @type {string} * @memberof NotificationsNotification */ body?: string; /** * * @type {string} * @memberof NotificationsNotification */ created_at?: string; /** * * @type {string} * @memberof NotificationsNotification */ id?: string; /** * * @type {UserUser} * @memberof NotificationsNotification */ notification_author?: UserUser; /** * * @type {string} * @memberof NotificationsNotification */ notification_type?: string; } \end{lstlisting} \subsection{@generated/models/user-balance.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { UtilsMoneyJson } from './utils-money-json'; /** * * @export * @interface UserBalance */ export interface UserBalance { /** * * @type {UtilsMoneyJson} * @memberof UserBalance */ balance?: UtilsMoneyJson; } \end{lstlisting} \subsection{@generated/models/user-editable-info.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface UserEditableInfo */ export interface UserEditableInfo { /** * * @type {Array} * @memberof UserEditableInfo */ assigned_categories?: Array; /** * * @type {string} * @memberof UserEditableInfo */ birth_date?: string; /** * * @type {string} * @memberof UserEditableInfo */ city?: string; /** * * @type {string} * @memberof UserEditableInfo */ country?: string; /** * * @type {string} * @memberof UserEditableInfo */ email?: string; /** * * @type {string} * @memberof UserEditableInfo */ first_name?: string; /** * * @type {string} * @memberof UserEditableInfo */ image_id?: string; /** * * @type {string} * @memberof UserEditableInfo */ last_name?: string; /** * * @type {string} * @memberof UserEditableInfo */ middle_name?: string; /** * * @type {string} * @memberof UserEditableInfo */ phone?: string; /** * * @type {string} * @memberof UserEditableInfo */ role?: UserEditableInfoRoleEnum; } /** * @export * @enum {string} */ export enum UserEditableInfoRoleEnum { User = 'User', Manager = 'Manager', SuperManager = 'SuperManager', ContentMaRolnager = 'ContentMaRolnager', Operator = 'Operator', Admin = 'Admin' } \end{lstlisting} \subsection{@generated/models/user-extended-user.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { CategoryCategory } from './category-category'; import { UserPrettyPublicKey } from './user-pretty-public-key'; /** * * @export * @interface UserExtendedUser */ export interface UserExtendedUser { /** * * @type {Array} * @memberof UserExtendedUser */ assigned_categories?: Array; /** * * @type {string} * @memberof UserExtendedUser */ birth_date?: string; /** * * @type {boolean} * @memberof UserExtendedUser */ blocked?: boolean; /** * * @type {string} * @memberof UserExtendedUser */ city?: string; /** * * @type {string} * @memberof UserExtendedUser */ country?: string; /** * * @type {string} * @memberof UserExtendedUser */ created_at?: string; /** * * @type {string} * @memberof UserExtendedUser */ email?: string; /** * * @type {string} * @memberof UserExtendedUser */ first_name?: string; /** * * @type {string} * @memberof UserExtendedUser */ id?: string; /** * * @type {string} * @memberof UserExtendedUser */ image_id?: string; /** * * @type {string} * @memberof UserExtendedUser */ last_name?: string; /** * * @type {string} * @memberof UserExtendedUser */ middle_name?: string; /** * * @type {string} * @memberof UserExtendedUser */ phone?: string; /** * * @type {UserPrettyPublicKey} * @memberof UserExtendedUser */ pretty_public_key?: UserPrettyPublicKey; /** * * @type {string} * @memberof UserExtendedUser */ role?: UserExtendedUserRoleEnum; /** * * @type {boolean} * @memberof UserExtendedUser */ tech_user?: boolean; } /** * @export * @enum {string} */ export enum UserExtendedUserRoleEnum { User = 'User', Manager = 'Manager', SuperManager = 'SuperManager', ContentManager = 'ContentManager', Operator = 'Operator', Admin = 'Admin' } \end{lstlisting} \subsection{@generated/models/user-pretty-public-key.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface UserPrettyPublicKey */ export interface UserPrettyPublicKey { /** * * @type {string} * @memberof UserPrettyPublicKey */ _long?: string; /** * * @type {string} * @memberof UserPrettyPublicKey */ _short?: string; } \end{lstlisting} \subsection{@generated/models/user-response.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { UserUser } from './user-user'; import { UtilsPageData } from './utils-page-data'; /** * * @export * @interface UserResponse */ export interface UserResponse { /** * * @type {Array} * @memberof UserResponse */ data?: Array; /** * * @type {UtilsPageData} * @memberof UserResponse */ page?: UtilsPageData; } \end{lstlisting} \subsection{@generated/models/user-settings.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface UserSettings */ export interface UserSettings { /** * * @type {string} * @memberof UserSettings */ language: UserSettingsLanguageEnum; } /** * @export * @enum {string} */ export enum UserSettingsLanguageEnum { Ru = 'ru', En = 'en' } \end{lstlisting} \subsection{@generated/models/user-simple-user.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface UserSimpleUser */ export interface UserSimpleUser { /** * * @type {string} * @memberof UserSimpleUser */ created_at?: string; /** * * @type {string} * @memberof UserSimpleUser */ first_name?: string; /** * * @type {string} * @memberof UserSimpleUser */ last_name?: string; /** * * @type {string} * @memberof UserSimpleUser */ middle_name?: string; } \end{lstlisting} \subsection{@generated/models/user-user.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { UserPrettyPublicKey } from './user-pretty-public-key'; /** * * @export * @interface UserUser */ export interface UserUser { /** * * @type {string} * @memberof UserUser */ birth_date?: string; /** * * @type {boolean} * @memberof UserUser */ blocked?: boolean; /** * * @type {string} * @memberof UserUser */ city?: string; /** * * @type {string} * @memberof UserUser */ country?: string; /** * * @type {string} * @memberof UserUser */ created_at?: string; /** * * @type {string} * @memberof UserUser */ email?: string; /** * * @type {string} * @memberof UserUser */ first_name?: string; /** * * @type {string} * @memberof UserUser */ id?: string; /** * * @type {string} * @memberof UserUser */ image_id?: string; /** * * @type {string} * @memberof UserUser */ last_name?: string; /** * * @type {string} * @memberof UserUser */ middle_name?: string; /** * * @type {string} * @memberof UserUser */ phone?: string; /** * * @type {UserPrettyPublicKey} * @memberof UserUser */ pretty_public_key?: UserPrettyPublicKey; /** * * @type {string} * @memberof UserUser */ role?: UserUserRoleEnum; /** * * @type {boolean} * @memberof UserUser */ tech_user?: boolean; } /** * @export * @enum {string} */ export enum UserUserRoleEnum { User = 'User', Manager = 'Manager', SuperManager = 'SuperManager', ContentManager = 'ContentManager', Operator = 'Operator', Admin = 'Admin' } \end{lstlisting} \subsection{@generated/models/utils-money-json.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface UtilsMoneyJson */ export interface UtilsMoneyJson { /** * * @type {string} * @memberof UtilsMoneyJson */ currency?: string; /** * * @type {number} * @memberof UtilsMoneyJson */ denominator?: number; /** * * @type {number} * @memberof UtilsMoneyJson */ numerator?: number; } \end{lstlisting} \subsection{@generated/models/utils-page-data.ts} \begin{lstlisting} /* tslint:disable */ /* eslint-disable */ /** * Charity API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface UtilsPageData */ export interface UtilsPageData { /** * * @type {number} * @memberof UtilsPageData */ page?: number; /** * * @type {number} * @memberof UtilsPageData */ size?: number; /** * * @type {number} * @memberof UtilsPageData */ totalElements?: number; /** * * @type {number} * @memberof UtilsPageData */ totalPages?: number; } \end{lstlisting} \subsection{@lib/components/AmountInput/index.tsx} \begin{lstlisting} import React, { useState } from "react"; import { Input, Select } from "antd"; const { Option } = Select; export type Currency = "rmb" | "dollar"; interface PriceValue { amount?: number; currency?: Currency; } interface PriceInputProps { value?: PriceValue; onChange?: (value: PriceValue) => void; } export const AmountInput: React.FC = ({ value = {}, onChange, }) => { const [amount, setAmount] = useState(0); const [currency, setCurrency] = useState("rmb"); const triggerChange = (changedValue: { amount?: number; currency?: Currency; }): void => { if (onChange) { onChange({ amount, currency, ...value, ...changedValue }); } }; const onAmountChange = (e: React.ChangeEvent): void => { const newAmount = parseInt(e.target.value || "0", 10); if (Number.isNaN(amount)) { return; } if (!("amount" in value)) { setAmount(newAmount); } triggerChange({ amount: newAmount }); }; const onCurrencyChange = (newCurrency: Currency): void => { if (!("currency" in value)) { setCurrency(newCurrency); } triggerChange({ currency: newCurrency }); }; return ( ); }; \end{lstlisting} \subsection{@lib/components/Auth/index.tsx} \begin{lstlisting} import React, { Component } from "react"; import { notification } from "antd"; import { UserSettings, UserSettingsLanguageEnum } from "@generated"; import { decode } from "@lib/utils/base64"; import { notify } from "@lib/utils/notification"; import { i18n } from "@providers"; import { AuthProvider, Credentials } from "@providers/authContext"; import { LoginFactory, SettingsFactory, UserApiModel, UserApiRole, UserRequestFactory, } from "@providers/axios"; import { Role } from "@providers/rbac-rules"; import axios from "axios"; import { getToken, onMessageListener, sendTokenToServer } from "firebase.js"; export type HeaderData = { user_id: string; role: UserApiRole; exp: number; token: string; }; // TODO: replace or remove function mapRole(apiRole: UserApiRole): Role { switch (apiRole) { case UserApiRole.Manager: return Role.manager; case UserApiRole.ContentManager: return Role.contentManager; case UserApiRole.SuperManager: return Role.supermanager; case UserApiRole.Admin: return Role.admin; case UserApiRole.User: return Role.visitor; case UserApiRole.Operator: return Role.operator; } } class Auth extends Component { state = { authenticated: localStorage.getItem("authenticated") === "true", user: { role: (localStorage.getItem("role") as Role) ?? Role.visitor, uuid: localStorage.getItem("uuid") ?? "", name: localStorage.getItem("name") ?? "", surname: localStorage.getItem("surname") ?? "", language: localStorage.getItem("language") ?? "", }, accessToken: localStorage.getItem("accessToken") ?? "", expires: parseInt(localStorage.getItem("exp") ?? "0"), }; initiateLogin = (credentials: Credentials): void => { LoginFactory.apiLoginPost(credentials) .then((r) => { const headerData = this.parseHeader(r.headers.authorization); this.handleAuthentication(headerData); // TODO: replace }) .catch((e) => { if ( e.response.status === 404 || e.response.status === 401 || e.response.status === 403 ) { notify(i18n.t(`Login:error.${e.response.status}`), "error"); } else { notify(i18n.t("Login:error.undefined"), "error"); } }); }; logout = (): void => { LoginFactory.apiLogoutPost() .catch((e) => { console.error(e); }) .finally(() => { localStorage.clear(); this.setState({ authenticated: false, user: { role: Role.visitor, }, accessToken: "", expires: undefined, }); }); }; handleAuthentication = async (headerData: HeaderData): Promise => { const data = await UserRequestFactory.apiUserIdGet(headerData.user_id); localStorage.setItem("accessToken", headerData.token); const settings = await SettingsFactory.apiUserSettingsGet(); if (data && settings) { this.setSession(headerData, data.data, settings.data); } }; // Parse header https://git.infostrategic.com/hsecharity/android/-/blob/develop/app/src/main/java/com/hse/charity/screens/auth/AuthRepository.kt#L39 parseHeader(authHeader: string): HeaderData { const fst = authHeader.indexOf("."); const lst = authHeader.lastIndexOf("."); const headerUndecodedData = authHeader.substring(fst + 1, lst); return { ...JSON.parse(decode(headerUndecodedData) ?? ""), token: authHeader, }; } // Important data to save in LocalStorage saveToLocalStorage( role: Role, user: UserApiModel, exp: number, token: string, language: UserSettingsLanguageEnum, ): void { localStorage.setItem("authenticated", "true"); localStorage.setItem("role", role); localStorage.setItem("uuid", user.id ?? ""); localStorage.setItem("name", user.first_name ?? ""); localStorage.setItem("surname", user.last_name ?? ""); localStorage.setItem("accessToken", token); localStorage.setItem("exp", exp.toString()); localStorage.setItem("language", language); } // Function that will be called to refresh authorization // eslint-disable-next-line refreshAuthLogic = async (): Promise => LoginFactory.apiLoginRefreshPost() .then((r) => { return this.parseHeader(r.headers.authorization); }) .catch(() => { return undefined; }); setSession( headerData: HeaderData, user: UserApiModel, settings: UserSettings, ): void { const role = mapRole(headerData.role); // TODO: remove if (role === Role.visitor) { notify(i18n.t("Login:error.denied")); return; } this.saveToLocalStorage( role, user, headerData.exp, headerData.token, settings.language, ); this.setState({ authenticated: true, user: { role, uuid: headerData.user_id, name: user.first_name, surname: user.last_name, language: settings.language, }, accessToken: headerData.token, expires: headerData.exp, }); } render(): JSX.Element { const authProviderValue = { ...this.state, initiateLogin: this.initiateLogin, handleAuthentication: this.handleAuthentication, logout: this.logout, }; if (this.state.authenticated) { getToken().then((maybeToken) => { sendTokenToServer(maybeToken); }); onMessageListener() .then((payload) => { const n = payload.notification; notification.info({ message: n.title, description: n.body, placement: "topRight", }); }) .catch((err) => console.log("failed: ", err)); } // Add a request interceptor axios.interceptors.response.use( async (response) => { const originalResponce = response.config; if ( originalResponce.url === `/api/login/refresh` || originalResponce.url === `${process.env.REACT_APP_API_URL}/api/login/refresh` ) { return response; } const exp = parseInt(localStorage.getItem("exp") ?? ""); if (exp && new Date(exp * 1000) < new Date()) { const headerData = await this.refreshAuthLogic(); if (!headerData) { this.logout(); return Promise.reject(response); } const { token, exp: expires } = headerData; localStorage.setItem("accessToken", token); localStorage.setItem("exp", expires.toString()); axios.defaults.headers.common = { Authorization: token, }; axios.defaults.withCredentials = true; return axios(originalResponce); } return response; }, async (error) => { const originalRequest = error.config; if ( originalRequest.url === `/api/login/refresh` || originalRequest.url === `${process.env.REACT_APP_API_URL}/api/login/refresh` ) { return Promise.reject(error); } const exp = parseInt(localStorage.getItem("exp") ?? ""); if (exp && new Date(exp * 1000) < new Date()) { const headerData = await this.refreshAuthLogic(); if (!headerData) { this.logout(); return Promise.reject(error); } const { token, exp: expired } = headerData; localStorage.setItem("accessToken", token); localStorage.setItem("exp", expired.toString()); axios.defaults.headers.common = { Authorization: token, }; axios.defaults.withCredentials = true; return axios(originalRequest); } return Promise.reject(error); }, ); axios.interceptors.request.use( (config) => { const token = localStorage.getItem("accessToken"); if (token) { config.headers = { Authorization: token, }; } console.log( config.url, config.headers.Authorization?.substr( config.headers.Authorization?.length - 10, ), ); return config; }, (error) => { Promise.reject(error); }, ); axios.defaults.headers.common = { Authorization: `${this.state.accessToken}`, }; return ( {this.props.children} ); } } export default Auth; \end{lstlisting} \subsection{@lib/components/Metrics/index.tsx} \begin{lstlisting} import React, { FC } from "react"; import { Col, Row, Tooltip } from "antd"; type Metric = { title: string; icon: JSX.Element; value: number; }; export type MetricsProps = { metrics: Metric[]; }; const Metrics: FC = ({ metrics }) => { return ( {metrics.map((metric) => { return ( {metric.icon} {metric.value} ); })} ); }; export default Metrics; \end{lstlisting} \subsection{@lib/components/Pagination/index.tsx} \begin{lstlisting} import React, { MutableRefObject, ReactNode, useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { Empty, Result as DisplayResult, Skeleton } from "antd"; import Pagination, { PaginationProps } from "antd/lib/pagination"; import useAxios, { PageData as ModelsPageData } from "@providers/axios"; import { AxiosResponse } from "axios"; import classnames from "classnames"; import i18n from "i18next"; import styles from "./styles.module.less"; type RestProps = Omit< PaginationProps, | "current" | "defaultCurrent" | "defaultPageSize" | "pageSize" | "total" | "showSizeChanger" | "showQuickJumper" | "showTotal" | "onChange" | "onShowSizeChange" >; type FullProps = PaginatedQueryProps< Variables, Result, Single > & RestProps; type PaginationState = { currentPage: number; size: number; }; type PaginationHookState = PaginationState & { onCurrentChange: PaginationProps["onChange"]; onPageSizeChange: PaginationProps["onShowSizeChange"]; }; export type PaginatedResult = { total: number | null; entries: T[]; }; export type StateRef = { page: number; size: number; } | null; type PaginatedQueryProps = { noInfo?: boolean; className?: string; paginationClassName?: string; refetch?: boolean; // eslint-disable-next-line requestQuery: (variables: any) => Promise>; variables?: Omit; stateRef?: MutableRefObject; initialPage?: number; initialSize?: number; render: ( entries: PaginatedResult["entries"], total: PaginatedResult["total"], ) => ReactNode; onResult?: (queryResult: Result) => void; onPaginationState?: (state: PaginationState) => void; }; /** * Pagination resume, generates string from total and current scope * * @param total * @param scope [from, to] */ function showTotal(total: number, [from, to]: [number, number]): string { return i18n.t("Pagination.showTotal", { total, from, to }); } /** * Extracts entries and total using provided reduce option * * @param data raw query result */ function grabPaginatedResult(data: R): PaginatedResult { let entries: S[] = []; // eslint-disable-next-line const { page = null, ...rest } = data as any; // TODO // can be less hacky if pagination has fixed list field name if (Object.keys(rest).length === 1) { entries = rest[Object.keys(rest)[0]]; } return { total: (page as ModelsPageData).totalElements ?? 0, entries, }; } /** * Actual Pagination component without wrapper for className */ function InnerPaginatedQuery< Variables extends Record, Result, Single >({ noInfo = false, paginationClassName, refetch = undefined, requestQuery, initialPage = 1, initialSize = 10, stateRef, variables, onResult, render, onPaginationState, ...rest }: PaginatedQueryProps & RestProps): JSX.Element | null { // pagination state handlers const { t } = useTranslation("translation"); const [page, onCurrentChange] = useState(initialPage); const [size, onPageSizeChange] = useState(initialSize); // save state above if needed useEffect(() => { if (stateRef !== undefined) { stateRef.current = { page, size }; } onPaginationState?.({ currentPage: page, size }); }, [stateRef, onPaginationState, page, size]); const { data, loading, error } = useAxios( requestQuery, refetch, ...Object.values( variables ? { page: page - 1, size, ...variables } : { page: page - 1, size, sort: "" }, ), ); // propagate result above if needed useEffect(() => { if (data) { onResult?.(data); } }, [onResult, data]); if (error) { console.error(error); // TODO : make more userfriendly and consice return ; } // Handle data if (loading || !data) { return ; } // Grab total and entries const { total, entries } = grabPaginatedResult( data, ); // Handle bad response if (total === null || total === 0) { return ; } return ( <> {render(entries, total)} size} showQuickJumper={total > size} showTotal={noInfo ? () => "" : showTotal} onChange={onCurrentChange} onShowSizeChange={onPageSizeChange} /> ); } export default function PaginatedQuery< Variables extends Record, Result, Single >(props: FullProps): JSX.Element { return (
); } \end{lstlisting} \subsection{@lib/components/Pagination/styles.module.less} \begin{lstlisting} @import "../../../variables.less"; .pagination { display: flex; :global(.ant-pagination-total-text) { flex: 1 1 auto; } } \end{lstlisting} \subsection{@lib/components/RegistryTable/index.tsx} \begin{lstlisting} import React, { useCallback, useMemo } from "react"; import { get, isFunction } from "lodash"; import { Table } from "antd"; import { ColumnsType, ColumnType, TableProps } from "antd/lib/table"; import { bindStyles, formatDate, formatNumber } from "@lib/utils"; import classnames from "classnames"; import i18n, { TFunction } from "i18next"; import styles from "./styles.module.less"; export type RegistryColumnConf = { key: string; title?: string; render?: | ColumnType["render"] | "Int" | "Boolean" | "String" | "Text" | "DateTime"; width?: string; sortOrder?: "descend" | "ascend"; }; export type RegistryRowState = { selected?: boolean; target?: boolean; }; export type RegistryTableProps = { entity: string; className?: string; headerClassName?: string; rowState?: (record: Element, index?: number) => RegistryRowState; rowClassName?: | string | ((record: Element, index?: number) => string | undefined); rowKey?: TableProps["rowKey"]; columns: Array>; rows: Element[]; expandable?: TableProps["expandable"]; // Handlers onRecordClick?: ( event: React.MouseEvent, record: Element, index?: number, ) => void; }; function cellRenderer( t: TFunction, key: string, type: RegistryColumnConf["render"], ): ColumnType["render"] { switch (type) { case "Int": return (text, record) => formatNumber(get(record, key)); case "Boolean": return (text, record) => get(record, key); case "String": return (text, record) => get(record, key); case "Text": return (text, record) => (get(record, key, "") as string).substr(0, 200); case "DateTime": return (text, record) => formatDate(get(record, key)); default: return type; } } function buildSingleColumn( t: TFunction, column: RegistryColumnConf, ): ColumnType { const key = column.key; const title = column.title ?? t(column.key); const render = cellRenderer(t, key, column.render); return { key, title, render, width: column.width, sortOrder: column.sortOrder, }; } function buildColumns( entity: string, columns: Array>, ): ColumnsType { const t = i18n.getFixedT(null, entity); return columns.map((column) => buildSingleColumn(t, column)); } function RegistryTable>({ entity, className, headerClassName, rowState, rowClassName, rows, rowKey = "id", columns, // Handlers expandable, onRecordClick, }: RegistryTableProps): JSX.Element { const COLUMNS = useMemo(() => buildColumns(entity, columns), [ entity, columns, ]); const onHeaderRow = useCallback( () => ({ className: classnames(styles.headerRow, headerClassName), }), [headerClassName], ); const boundStyles = useMemo(() => bindStyles(styles, rowState), [rowState]); const onRow = useCallback( (record: Element, index?: number) => ({ className: classnames( styles.row, boundStyles(record, index), isFunction(rowClassName) ? rowClassName(record, index) : rowClassName, ), onClick(event: React.MouseEvent): void { onRecordClick?.(event, record, index); }, onMouseDown(event: React.MouseEvent): void { // prevent shift+click selection behavior event.preventDefault(); }, }), [boundStyles, rowClassName, onRecordClick], ); return ( ); } export default RegistryTable; \end{lstlisting} \subsection{@lib/components/RegistryTable/styles.module.less} \begin{lstlisting} @import "../../../variables.less"; .table { margin-bottom: @main-vertical-padding; } .row { & > td { background: none !important; transition: background 0s; } cursor: pointer; .selectAndHover(); } \end{lstlisting} \subsection{@lib/components/RoleSwitch/index.tsx} \begin{lstlisting} import { FC } from "react"; import { check, Role } from "@providers/rbac-rules"; type RoleSwitchProps = { role: Role; perform: string; yes?: () => JSX.Element; no?: () => JSX.Element; }; const RoleSwitch: FC = ({ role, perform, yes = () => null, no = () => null, }) => (check(role, perform) ? yes() : no()); export default RoleSwitch; \end{lstlisting} \subsection{@lib/hooks/debounce.ts} \begin{lstlisting} import { useEffect, useState } from "react"; export function useDebounce(value: T, delay: number): T { // State and setters for debounced value const [debouncedValue, setDebouncedValue] = useState(value); useEffect( () => { // Update debounced value after delay const handler = setTimeout(() => { setDebouncedValue(value); }, delay); // Cancel the timeout if value changes (also on delay change or unmount) // This is how we prevent debounced value from updating if value is changed ... // .. within the delay period. Timeout gets cleared and restarted. return (): void => { clearTimeout(handler); }; }, [value, delay], // Only re-call effect if value or delay changes ); return debouncedValue; } \end{lstlisting} \subsection{@lib/hooks/index.ts} \begin{lstlisting} import { useEffect } from "react"; import { nameString } from "../../appInfo"; export { useLocationQuery, useLocationQueryState, useLocationQueryEffect, } from "./location"; export { usePrevious } from "./previous"; export { useListSelection } from "./list"; export { useDebounce } from "./debounce"; export function useDocumentTitle(title: string): void { useEffect(() => { document.title = `[${nameString}] ${title}`; return () => { document.title = `[${nameString}]`; }; }, [title]); } \end{lstlisting} \subsection{@lib/hooks/list.ts} \begin{lstlisting} import { useCallback, useEffect, useMemo, useState } from "react"; import { isNil, update } from "lodash/fp"; type Index = number; type ListSelectionState = { target?: T | null; selected: T[]; isTarget: (index: Index | undefined) => boolean; isSelected: (index: Index | undefined) => boolean; onElementClick: (event: React.MouseEvent | MouseEvent, index: Index) => void; setList: React.Dispatch>; getSelectedIndeces: () => Index[]; reset: () => void; }; type SelectedState = boolean[]; function buildStateFromList( list: T[], from?: Index, to?: Index, ): SelectedState { if (isNil(to)) { if (isNil(from)) { return list.map(() => false); } return list.map((e, index) => index >= from); } const selectedStart = Math.min(from ?? 0, to); const selectedEnd = Math.max(from ?? 0, to); return list.map((e, index) => index >= selectedStart && index <= selectedEnd); } function isCtrl(event: React.MouseEvent | MouseEvent): boolean { return event.ctrlKey || event.metaKey; } function isShift(event: React.MouseEvent | MouseEvent): boolean { return event.shiftKey; } type ListSelectionProps = { external?: boolean; }; export function useListSelection( list: T[] = [], { external = false }: ListSelectionProps = {}, ): ListSelectionState { const [innerList, setList] = useState(list); const actualList = useMemo(() => (external ? list : innerList), [ external, list, innerList, ]); const [selected, setSelected] = useState(() => buildStateFromList(actualList), ); const [target, setTarget] = useState(); const reset = useCallback((): void => { setSelected(buildStateFromList(actualList)); setTarget(undefined); }, [actualList]); const toggleElement = (index: Index): void => { setSelected(update([index], (x) => !x)); }; const isTarget = useCallback( (index: Index | undefined): boolean => target !== undefined && target === index, [target], ); const isSelected = useCallback( (index: Index | undefined = -1): boolean => selected[index] ?? false, [selected], ); const onElementClick = useCallback( (event: React.MouseEvent | MouseEvent, index: Index): void => { const currentTarget = target; // Click with queue if (isCtrl(event)) { event.preventDefault(); toggleElement(index); setTarget(index); return; } // From-to select if (isShift(event)) { event.preventDefault(); setSelected(buildStateFromList(actualList, currentTarget, index)); return; } // Usual single click if (currentTarget === index) { reset(); } else { setSelected(buildStateFromList(actualList, index, index)); setTarget(index); } }, [actualList, target, reset], ); const getSelectedIndeces = useCallback( () => selected.reduce( (ac, value, index) => (value ? [...ac, index] : ac), [] as Index[], ), [selected], ); useEffect(reset, [actualList, reset]); return { target: useMemo(() => (isNil(target) ? null : actualList[target]), [ actualList, target, ]), selected: useMemo( () => actualList.filter((element, index) => selected[index]), [actualList, selected], ), isTarget, isSelected, onElementClick, getSelectedIndeces, setList, reset, }; } \end{lstlisting} \subsection{@lib/hooks/location.ts} \begin{lstlisting} import { Dispatch, SetStateAction, useEffect, useState } from "react"; import { isEmpty } from "lodash"; import { useResponse, useRouter } from "@curi/react-dom"; import { NavigationDetails } from "@curi/types"; import { QueryObject, queryParse, queryStringify } from "@lib/utils/query"; type T = QueryObject; /** * get @QueryObject from route location query * * @param value */ export function useLocationQuery(defaultValue: T = {}): T { const { response } = useResponse(); const { query: queryString } = response.location; const value = isEmpty(queryString) ? defaultValue : queryParse(queryString); return value; } /** * Store limited @QueryObject synchronously with route location query * * @param value */ export function useLocationQueryEffect( value: T, method: NavigationDetails["method"] = "replace", ): void { const { response } = useResponse(); const router = useRouter(); const { pathname: currentPath } = response.location; useEffect(() => { const newQueryString = queryStringify(value); router.navigate({ url: `${currentPath}?${newQueryString}`, method, }); }, [value, router, currentPath, method]); } /** * Allows to work with limited @QueryObject as usual useState, * but stores it synchronously with route location query * * @param defaultValue */ export function useLocationQueryState( defaultValue: T = {}, method: NavigationDetails["method"] = "replace", ): [T, Dispatch>] { const initialState = useLocationQuery(defaultValue); const [value, setValue] = useState(initialState); useLocationQueryEffect(value, method); return [value, setValue]; } \end{lstlisting} \subsection{@lib/hooks/previous.ts} \begin{lstlisting} import { useEffect, useRef } from "react"; export function usePrevious(value: T): T { const ref = useRef(value); useEffect(() => { ref.current = value; }, [value]); return ref.current; } \end{lstlisting} \subsection{@lib/hooks/storage.ts} \begin{lstlisting} import { Dispatch, SetStateAction, useState } from "react"; import KVStorage from "../utils/kvstorage"; const LocalStorage = new KVStorage("local"); export function useLocalStorage( key: string, initialValue: T, ): [T, Dispatch>] { const [storedValue, setStoredValue] = useState(() => { return LocalStorage.get(key) ?? initialValue; }); const setValue: Dispatch> = (value) => { const valueToStore = value instanceof Function ? value(storedValue) : value; setStoredValue(valueToStore); LocalStorage.set(key, valueToStore); }; return [storedValue, setValue]; } \end{lstlisting} \subsection{@lib/utils/__tests__/base64.ts} \begin{lstlisting} /* eslint-disable no-undef */ import { decode as d, encode as e } from "../base64"; test("base64 encode", () => { expect(e("test string")).toEqual("dGVzdCUyMHN0cmluZw=="); expect(e("")).toEqual("JUUyJTk5JUEw"); }); test("base64 decode", () => { expect(d("dGVzdCUyMHN0cmluZw==")).toEqual("test string"); }); test("base64 full cycle", () => { expect(d(e("test string") ?? "")).toEqual("test string"); }); \end{lstlisting} \subsection{@lib/utils/__tests__/query.ts} \begin{lstlisting} /* eslint-disable no-undef */ import { queryParse, queryStringify } from "../query"; const settings = { str: "test", flag: false, interval: { from: 0, to: 10, }, tags: ["tag1", "tag2"], hide: undefined, }; test("queryParse", () => { expect(queryParse("a=b&c=d")).toEqual({ a: "b", c: "d" }); expect(queryParse("a=true")).toEqual({ a: true }); expect(queryParse("a=")).toEqual({ a: "" }); expect(queryParse("a")).toEqual({ a: null }); expect(queryParse("a=1&a=2&a=3")).toEqual({ a: [1, 2, 3] }); expect(queryParse("a.a=1&a.b=b")).toEqual({ a: { a: 1, b: "b" } }); }); test("queryStringify", () => { expect(queryStringify({ a: true }, false)).toEqual("a=true"); expect(queryStringify({ a: "b", c: "d" }, false)).toEqual("a=b&c=d"); expect(queryStringify({ a: [1, 2, 3] }, false)).toEqual("a=1&a=2&a=3"); expect(queryStringify({ a: { a: 1, b: "b" } }, false)).toEqual("a.a=1&a.b=b"); expect(queryStringify({ a: { a: [1, 2, 3] } }, false)).toEqual( "a.a=1&a.a=2&a.a=3", ); expect(queryStringify(settings, false)).toEqual( "flag=false&interval.from=0&interval.to=10&str=test&tags=tag1&tags=tag2", ); }); test("marshall/unmarshall", () => { expect(queryParse(queryStringify(settings))).toEqual(settings); }); \end{lstlisting} \subsection{@lib/utils/__tests__/storage.ts} \begin{lstlisting} /* eslint-disable no-undef */ import KVStorage from "../kvstorage"; const value = { foo: 1, bar: "bar", }; test("KVStorage", () => { const S = new KVStorage("local", "test"); expect(S.get("1")).toEqual(undefined); S.set("2", 1); expect(S.get("2")).toEqual(1); S.set("3", value); expect(S.get("3")).toEqual(value); S.remove("3"); expect(S.get("3")).toEqual(undefined); S.clear(); expect([S.get("1"), S.get("2"), S.get("3")]).toStrictEqual([ undefined, undefined, undefined, ]); }); \end{lstlisting} \subsection{@lib/utils/__tests__/transliterate.ts} \begin{lstlisting} /* eslint-disable no-undef */ import t from "../transliterate"; test("Transliteration", () => { expect(t("TEST")).toEqual("TEST"); }); \end{lstlisting} \subsection{@lib/utils/auth.ts} \begin{lstlisting} import KVStorage from "./kvstorage"; const JWT_TOKEN = "jwtToken"; const PERM = "permissions"; const storage = new KVStorage("local"); export type Permission = string; export type Permissions = Array; export type AuthToken = string; export function getPermissions(): Permissions { return storage.get(PERM) || []; } export function setPermissions(permissions: Permissions): void { storage.set(PERM, permissions); } export function clearPermissions(): void { storage.set(PERM, []); } export function getToken(): AuthToken | undefined { return storage.get(JWT_TOKEN); } export function setToken(token: AuthToken): void { storage.set(JWT_TOKEN, token); } export function checkPermissions( permissions: Permissions | Permission, against?: Permissions, ): boolean { if (!permissions) { return true; } const access = against || getPermissions(); if (Array.isArray(permissions)) { return permissions.every((p) => access.includes(p)); } return access.includes(permissions); } \end{lstlisting} \subsection{@lib/utils/base64.ts} \begin{lstlisting} export function encode(str: string): string | undefined { try { return window.btoa(encodeURIComponent(str)); } catch (e) { return; } } export function decode(str: string): string | undefined { try { return decodeURIComponent(window.atob(str)); } catch (e) { return; } } \end{lstlisting} \subsection{@lib/utils/category.ts} \begin{lstlisting} import { CategoryCategory as Category, CategoryCategory } from "@generated"; export function format( lang: "ru" | "en" | string | undefined, category?: Category, ): string { if (lang === "ru") { return category?.rus ?? "-"; } if (lang === "en") { return category?.eng ?? "-"; } return "-"; } export function formatMany( lang: "run" | "en" | string | undefined, categories?: CategoryCategory[], ): string { if (!categories) { return "-"; } if (categories?.length === 0) { return "-"; } return categories .map((item) => { return format(lang, item); }) .join(", "); } \end{lstlisting} \subsection{@lib/utils/clipboard.ts} \begin{lstlisting} function fallbackCopyTextToClipboard(text: string): void { const textArea = document.createElement("textarea"); textArea.value = text; document.body.appendChild(textArea); textArea.focus(); textArea.select(); try { document.execCommand("copy"); } catch (err) { // Do nothing } document.body.removeChild(textArea); } export function copyTextToClipboard(text: string): Promise { if (!navigator.clipboard) { fallbackCopyTextToClipboard(text); return Promise.resolve(); } return navigator.clipboard.writeText(text); } \end{lstlisting} \subsection{@lib/utils/currency.ts} \begin{lstlisting} import { UtilsMoneyJson } from "@generated"; import { NO_DATA_PLACEHOLDER } from "./meta"; export function format(apiValue: UtilsMoneyJson | undefined): string { if (!apiValue) { return NO_DATA_PLACEHOLDER; } const { currency, denominator, numerator } = apiValue; return `${numerator ?? 0 / (denominator ?? 0)} ${currency}`; } export function moneyCollected( approved?: UtilsMoneyJson, collected?: UtilsMoneyJson, ): number | undefined { if (!approved) { return undefined; } const approvedNumber = (approved?.numerator ?? 0) / (approved?.denominator ?? 1); const collectedNumber = (collected?.numerator ?? 0) / (collected?.denominator ?? 1); if (approvedNumber < collectedNumber) { return 100; } return Math.ceil((collectedNumber / approvedNumber) * 100); } \end{lstlisting} \subsection{@lib/utils/date.ts} \begin{lstlisting} import * as DateFn from "date-fns"; import { ru } from "date-fns/locale"; import { NO_DATA_PLACEHOLDER } from "./meta"; export type UnixTime = string; type DateInput = { year?: number | null; month?: number | null; day?: number | null; }; type TimeInput = { hour: number; minute: number; second: number; }; export type ApiDateTime = { date: DateInput; time?: TimeInput | null; }; /** * Names are picked from luxon */ export enum DateTimeFormat { DATE_SHORT = "dd.MM.yyyy", DATE_MED = "dd MMM yyyy", DATE_MED_WITH_WEEKDAY = "EE, dd MMM yyyy", DATE_FULL = "dd MMMM yyyy", DATE_HUGE = "EEEE, dd MMMM yyyy", TIME_SIMPLE = "p", TIME_WITH_SECONDS = "pp", TIME_WITH_SHORT_OFFSET = "ppp", TIME_WITH_LONG_OFFSET = "pppp", TIME_24_SIMPLE = "HH:mm", TIME_24_WITH_SECONDS = "HH:mm:ss", TIME_24_WITH_SHORT_OFFSET = "HH:mm:ss O", TIME_24_WITH_LONG_OFFSET = "HH:mm:ss OOOO", DATETIME_SHORT = "dd.MM.yyyy HH:mm", DATETIME_MED = "dd MMM yyyy HH:mm", DATETIME_FULL = "dd MMMM yyyy HH:mm", DATETIME_HUGE = "EEEE, dd MMMM yyyy HH:mm OOOO", DATETIME_SHORT_WITH_SECONDS = "dd.MM.yyyy HH:mm:ss", DATETIME_MED_WITH_SECONDS = "dd MMM yyyy HH:mm:ss", DATETIME_FULL_WITH_SECONDS = "dd MMMM yyyy HH:mm:ss", DATETIME_HUGE_WITH_SECONDS = "dd MMMM yyyy OOOO", } export function noNull(value: T | null | undefined): T | undefined { if (value === null) { return undefined; } return value; } export function dateFromApi( source: DeepPartial | null | undefined, ): Date | null { if (!source) { return null; } return DateFn.set(new Date(), { year: noNull(source.date?.year), month: noNull(source.date?.month), date: noNull(source.date?.day), hours: noNull(source.time?.hour), minutes: noNull(source.time?.minute), seconds: noNull(source.time?.second), }); } export function dateToApi(source: Date | null): ApiDateTime | null { if (!source) { return null; } return { date: { year: DateFn.getYear(source), month: DateFn.getMonth(source), day: DateFn.getDate(source), }, time: { hour: DateFn.getHours(source), minute: DateFn.getMinutes(source), second: DateFn.getSeconds(source), }, }; } export function format( apiValue: UnixTime | null | undefined, display: DateTimeFormat | string = DateTimeFormat.DATETIME_SHORT, ): string { if (!apiValue) { return NO_DATA_PLACEHOLDER; } const d = new Date(apiValue); return DateFn.format(d, display, { locale: ru }); } export function formatDateTime(apiValue: DeepPartial): string { const dt = dateFromApi(apiValue); if (!dt) { return NO_DATA_PLACEHOLDER; } return DateFn.format( dt, apiValue.time ? DateTimeFormat.DATETIME_FULL : DateTimeFormat.DATE_FULL, { locale: ru }, ); } type UntilProgress = { days: number; percentage: number; }; export function daysLeft( started?: string, until?: string, ): UntilProgress | undefined { if (!until || !started) { return undefined; } const startDate = new Date(started); const untilDate = new Date(until); const currentDate = new Date(); if (untilDate < currentDate) { return { days: 0, percentage: 100, }; } const diff = Math.abs(untilDate.getTime() - currentDate.getTime()); const diffDays = Math.ceil(diff / (1000 * 3600 * 24)); const totalDiff = Math.abs(untilDate.getTime() - startDate.getTime()); const diffTotalDays = Math.ceil(totalDiff / (1000 * 3600 * 24)); return { days: diffDays, percentage: (diffDays / diffTotalDays) * 100, }; } \end{lstlisting} \subsection{@lib/utils/index.ts} \begin{lstlisting} import { format as formatDate, UnixTime } from "./date"; export { queryParse, queryStringify } from "./query"; export { copyTextToClipboard } from "./clipboard"; export { encode as base64encode, decode as base64decode } from "./base64"; export { format as formatDate, formatDateTime } from "./date"; export { format as formatMoney } from "./currency"; export { format as formatNumber } from "./number"; export { format as formatCategory } from "./category"; export { formatMany as formatCategories } from "./category"; export { default as transliterate } from "./transliterate"; export { default as KVStorage } from "./kvstorage"; export { bindStyles } from "./styles"; export { format as formatString } from "./list_data"; export { NO_DATA_PLACEHOLDER, NO_IMAGE_PLACEHOLDER } from "./meta"; type User = { name: string; }; export function formatSystemInfo( date: UnixTime | null | undefined, user: User | null | undefined, ): string { if (user === undefined || user === null) { return formatDate(date); } if (date === undefined) { return user.name; } return `${user.name} - ${formatDate(date)}`; } \end{lstlisting} \subsection{@lib/utils/kvstorage.ts} \begin{lstlisting} const BACKENDS = { local: window.localStorage, session: window.sessionStorage, }; type StorageBackend = "local" | "session"; export default class KVStorage { private backend: Storage; private prefix?: string; constructor(type: StorageBackend = "local", prefix?: string) { this.backend = BACKENDS[type]; this.prefix = prefix; } private prefixedKey(key: string): string { const prefix = this.prefix ?? window.APP.name; return `${prefix}:${key}`; } set(key: string, value: T): void { const innerKey = this.prefixedKey(key); this.backend.setItem(innerKey, JSON.stringify(value)); } get(key: string): T | undefined { try { const innerKey = this.prefixedKey(key); const strValue = this.backend.getItem(innerKey); if (strValue) { return JSON.parse(strValue) as T; } return undefined; } catch (e) { return undefined; } } remove(key: string): void { const innerKey = this.prefixedKey(key); this.backend.removeItem(innerKey); } clear(): void { this.backend.clear(); } } \end{lstlisting} \subsection{@lib/utils/list_data.ts} \begin{lstlisting} export function format(data: string | undefined | null): string { if (data?.length === 0) { return "-"; } return data ?? "-"; } \end{lstlisting} \subsection{@lib/utils/meta.ts} \begin{lstlisting} export const NO_DATA_PLACEHOLDER = "-"; export const NO_IMAGE_PLACEHOLDER = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghgg0Aj8i0JO4OzsrPv69Wv+hi2qPHr0qNvf39+iI97soRIh4f3z58/u7du3SXX7Xt7Z2enevHmzfQe+oSN2apSAPj09TSrb+XKI/f379+08+A0cNRE2ANkupk+ACNPvkSPcAAEibACyXUyfABGm3yNHuAECRNgAZLuYPgEirKlHu7u7XdyytGwHAd8jjNyng4OD7vnz51dbPT8/7z58+NB9+/bt6jU/TI+AGWHEnrx48eJ/EsSmHzx40L18+fLyzxF3ZVMjEyDCiEDjMYZZS5wiPXnyZFbJaxMhQIQRGzHvWR7XCyOCXsOmiDAi1HmPMMQjDpbpEiDCiL358eNHurW/5SnWdIBbXiDCiA38/Pnzrce2YyZ4//59F3ePLNMl4PbpiL2J0L979+7yDtHDhw8vtzzvdGnEXdvUigSIsCLAWavHp/+qM0BcXMd/q25n1vF57TYBp0a3mUzilePj4+7k5KSLb6gt6ydAhPUzXnoPR0dHl79WGTNCfBnn1uvSCJdegQhLI1vvCk+fPu2ePXt2tZOYEV6/fn31dz+shwAR1sP1cqvLntbEN9MxA9xcYjsxS1jWR4AIa2Ibzx0tc44fYX/16lV6NDFLXH+YL32jwiACRBiEbf5KcXoTIsQSpzXx4N28Ja4BQoK7rgXiydbHjx/P25TaQAJEGAguWy0+2Q8PD6/Ki4R8EVl+bzBOnZY95fq9rj9zAkTI2SxdidBHqG9+skdw43borCXO/ZcJdraPWdv22uIEiLA4q7nvvCug8WTqzQveOH26fodo7g6uFe/a17W3+nFBAkRYENRdb1vkkz1CH9cPsVy/jrhr27PqMYvENYNlHAIesRiBYwRy0V+8iXP8+/fvX11Mr7L7ECueb/r48eMqm7FuI2BGWDEG8cm+7G3NEOfmdcTQw4h9/55lhm7DekRYKQPZF2ArbXTAyu4kDYB2YxUzwg0gi/41ztHnfQG26HbGel/crVrm7tNY+/1btkOEAZ2M05r4FB7r9GbAIdxaZYrHdOsgJ/wCEQY0J74TmOKnbxxT9n3FgGGWWsVdowHtjt9Nnvf7yQM2aZU/TIAIAxrw6dOnAWtZZcoEnBpNuTuObWMEiLAx1HY0ZQJEmHJ3HNvGCBBhY6jtaMoEiJB0Z29vL6ls58vxPcO8/zfrdo5qvKO+d3Fx8Wu8zf1dW4p/cPzLly/dtv9Ts/EbcvGAHhHyfBIhZ6NSiIBTo0LNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg=="; \end{lstlisting} \subsection{@lib/utils/name.ts} \begin{lstlisting} export function cred( firstName?: string, middleName?: string, lastName?: string, ): string { const fst = firstName?.charAt(0) ?? ""; const middle = middleName?.charAt(0) ?? ""; const last = lastName ?? ""; return `${last} ${fst.length === 0 ? fst : `${fst}. `}${ middle.length === 0 ? middle : `${middle}.` }`; } /** Surname FirstName MiddleName*/ export function fullName( firstName?: string, middleName?: string, lastName?: string, ): string { const lName = lastName ? `${lastName} ` : ""; const fName = firstName ? ` ${firstName}` : ""; const mName = middleName ? ` ${middleName}` : ""; return lName + fName + mName; } \end{lstlisting} \subsection{@lib/utils/notification.module.less} \begin{lstlisting} @import "../../variables.less"; .error { background: @red-2; } .success { background: @green-2; } .warning { background: @yellow-2; } .info { background: @blue-2; } \end{lstlisting} \subsection{@lib/utils/notification.ts} \begin{lstlisting} import { notification } from "antd"; import { ArgsProps } from "antd/lib/notification"; import styles from "./notification.module.less"; notification.config({ placement: "bottomLeft", }); type NotificationLevel = "success" | "info" | "error" | "warning"; type NotificationParams = Omit; export function notify( message: string, level: NotificationLevel = "info", params: NotificationParams = {}, ): void { switch (level) { case "error": return notification.error({ message, className: styles.error, ...params, }); case "success": return notification.success({ message, className: styles.success, ...params, }); case "warning": return notification.warning({ message, className: styles.warning, ...params, }); case "info": return notification.info({ message, className: styles.info, ...params, }); } } \end{lstlisting} \subsection{@lib/utils/number.ts} \begin{lstlisting} import { NO_DATA_PLACEHOLDER } from "./meta"; const numberFormatter = new Intl.NumberFormat("ru-ru"); export function format(apiValue: number | null | undefined): string { if (apiValue === null || apiValue === undefined) { return NO_DATA_PLACEHOLDER; } return numberFormatter.format(apiValue); } \end{lstlisting} \subsection{@lib/utils/query.ts} \begin{lstlisting} import { forEach, isArray, isObject, set } from "lodash"; import { parse, stringify } from "query-string"; type Primitive = undefined | null | string | number | boolean; interface PrimitiveObject { [key: string]: Primitive | Array; } // only allow objects on first nest level export interface QueryObject { [key: string]: Primitive | Array | PrimitiveObject; } export function queryStringify(input: QueryObject, encode = true): string { const proccedInput: PrimitiveObject = {}; forEach(input, (outerValue, outerKey) => { if (isObject(outerValue) && !isArray(outerValue)) { forEach(outerValue, (value, key) => { proccedInput[`${outerKey}.${key}`] = value; }); } else { proccedInput[outerKey] = outerValue as Primitive | Array; } }); return stringify(proccedInput, { encode }); } export function queryParse(input: string): QueryObject { const result: QueryObject = {}; const draft = parse(input, { parseBooleans: true, parseNumbers: true, }) as PrimitiveObject; forEach(draft, (value, key) => { if (key.includes(".")) { set(result, key.split("."), value); } else { result[key] = value; } }); return result; } \end{lstlisting} \subsection{@lib/utils/styles.ts} \begin{lstlisting} import { isFunction, map } from "lodash"; import classnames from "classnames"; type StyleModule = Record; type State = Record; // eslint-disable-next-line @typescript-eslint/no-explicit-any export function bindStyles State>( styles: StyleModule, stateFn?: T, ) { return (...args: Parameters): string => { if (!isFunction(stateFn)) { return ""; } return classnames( map(stateFn(...args), (isActive, state) => isActive && styles[state]), ); }; } \end{lstlisting} \subsection{@lib/utils/transliterate.ts} \begin{lstlisting} type CharMap = { [key: string]: string; }; export default function transliterate(word: string): string { return word .split("") .map((letter) => CHAR_MAP[letter] || letter) .join(""); } \end{lstlisting} \subsection{@lib/utils/xmlhttp.ts} \begin{lstlisting} export type ProgressCallback = ( this: XMLHttpRequest, ev: ProgressEvent, ) => void; export type XMLHttpParams = { // 0 (or negative) to wait forever timeout?: number; responseType?: XMLHttpRequestResponseType; method?: | "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "CONNECT" | "OPTIONS" | "TRACE" | "PATCH"; body?: string | null; token?: string | null; }; export function wrapXMLHttp( link: string, params: XMLHttpParams, onProgress?: ProgressCallback, ): Promise { const { method = "GET", body, responseType = "blob", token, timeout = 0, } = params; return new Promise((resolve) => { const req = new XMLHttpRequest(); req.open(method, link); req.responseType = responseType; req.timeout = timeout; if (token) { req.setRequestHeader("authorization", `Bearer ${token}`); } req.setRequestHeader("content-type", "application/json"); req.onload = (): void => { resolve(req); }; req.onerror = (): void => { resolve(req); }; if (onProgress) { req.addEventListener("progress", onProgress); } if (body) { req.send(body); } else { req.send(); } }); } export function isOk(xhr: XMLHttpRequest): boolean { return xhr.status >= 200 && xhr.status < 300; } \end{lstlisting} \subsection{@providers/authContext.ts} \begin{lstlisting} import { createContext } from "react"; import { HeaderData } from "@lib/components/Auth"; import { Role } from "./rbac-rules"; export type User = { name?: string; role: Role; surname?: string; uuid?: string; language?: string; }; export type Credentials = { email: string; password: string; }; type AuthContextType = { authenticated: boolean; user: User; accessToken: string; initiateLogin: (credentials: Credentials) => void; handleAuthentication: (headerData: HeaderData) => void; logout: () => void; }; const authContext = createContext({ authenticated: false, // to check if authenticated or not user: { role: Role.admin, name: "Hello World" }, // store all the user details accessToken: "", // accessToken of user for Auth0 initiateLogin: () => { console.log("initiate login"); }, // to start the login process handleAuthentication: () => { console.log("handle auth"); }, // handle Auth0 login process logout: () => { console.log("logout"); }, // logout the user }); export const AuthProvider = authContext.Provider; export const AuthConsumer = authContext.Consumer; \end{lstlisting} \subsection{@providers/axios.ts} \begin{lstlisting} import { useEffect, useState } from "react"; import { AnalyticsApiFactory, AuditApiFactory, BatchStatusApiFactory, CategoryApiFactory, CharityApiFactory, ChatApiFactory, DonationRequestApiFactory, DonationsApiFactory, FileApiFactory, LoginApiFactory, MoneyApiFactory, NewsApiFactory, NotificationsApiFactory, RegistrationApiFactory, SettingsApiFactory, UserApiFactory, } from "@generated"; import { AxiosResponse as Response } from "axios"; // i18n reexports export type { UtilsPageData as PageData } from "@generated"; export const soketUrl = `${process.env.NODE_ENV === "production" ? "wss" : "ws" }//:${process.env.REACT_APP_WEBSOCKET}/api/chat/ws/`; type AxiosResponse = { data: R | undefined; loading: boolean; error: string | undefined; refetchQuery: () => Promise; }; export default function useAxios( // eslint-disable-next-line query: (...v: any[]) => Promise>, refetch: boolean | undefined = undefined, // eslint-disable-next-line ...variables: any[] ): AxiosResponse { const [data, setData] = useState(undefined); const [error, setError] = useState(undefined); // Turn objects into strings for useCallback & useEffect dependencies const [stringifiedUrl, stringifiedInit] = [ JSON.stringify(variables), JSON.stringify(query), ]; const fetchData = async (): Promise => { try { const response = await query(...variables); if (response.status === 200) { setData(response.data); } else { console.error(`Error ${response.status} ${response.statusText}`); } } catch (e) { console.log(e); setError(e?.message); } }; useEffect(() => { fetchData(); // eslint-disable-next-line }, [stringifiedUrl, stringifiedInit, refetch]); if (!(data || error)) { return { data, loading: true, error, refetchQuery: fetchData }; } return { data, loading: false, error, refetchQuery: fetchData }; } const configuration = undefined; const basePath = undefined; const axios = undefined; export const DonationRequestFactory = DonationRequestApiFactory( configuration, basePath, axios, ); export const AuditFactory = AuditApiFactory(configuration, basePath, axios); export const DonationsFactory = DonationsApiFactory( configuration, basePath, axios, ); export const FileFactory = FileApiFactory(configuration, basePath, axios); export const BatchStatusFactory = BatchStatusApiFactory( configuration, basePath, axios, ); export const MoneyFactory = MoneyApiFactory(configuration, basePath, axios); export const NewsFactory = NewsApiFactory(configuration, basePath, axios); export const AnalyticsFactory = AnalyticsApiFactory(configuration, basePath, axios); export const ChatsFactory = ChatApiFactory(configuration, basePath, axios); export const NotificationsFactory = NotificationsApiFactory( configuration, basePath, axios, ); export const UserRequestFactory = UserApiFactory( configuration, basePath, axios, ); export const CharityFactory = CharityApiFactory(configuration, basePath, axios); export const CategoryFactory = CategoryApiFactory( configuration, basePath, axios, ); export const RegistrationFactory = RegistrationApiFactory( configuration, basePath, axios, ); export const LoginFactory = LoginApiFactory(configuration, basePath, axios); export const SettingsFactory = SettingsApiFactory( configuration, basePath, axios, ); export { UserExtendedUserRoleEnum as UserApiRole } from "@generated"; export type { UserExtendedUser as UserApiModel } from "@generated"; \end{lstlisting} \subsection{@providers/cusomUpload.ts} \begin{lstlisting} import { RcCustomRequestOptions } from "antd/lib/upload/interface"; import { FileInfo } from "@generated"; export const customRequest = ( options: RcCustomRequestOptions, setIds: (ids: string[]) => void, ): void => { const { file, onError, onSuccess } = options; const url = `/api/file/upload`; const formData = new FormData(); formData.append("file", file as Blob); const request = new XMLHttpRequest(); request.open("POST", url); request.send(formData); request.onload = function () { if (request.status === 200) { const parsed: FileInfo[] = JSON.parse(request.responseText); setIds(parsed.map((value) => value.id ?? "")); return onSuccess(parsed, file); } else { return onError(Error(request.statusText)); } }; }; \end{lstlisting} \subsection{@providers/i18n.ts} \begin{lstlisting} import { initReactI18next } from "react-i18next"; import i18n, { TFunction } from "i18next"; import detector from "i18next-browser-languagedetector"; import HttpApi from "i18next-http-backend"; const DETECTION_OPTIONS = { order: ["navigator"], }; const I18N_LANGUAGE = "language"; export const init = (): Promise => i18n .use(detector) .use(initReactI18next) .use(HttpApi) .init({ detection: DETECTION_OPTIONS, ns: ["translation", "form", "_error"], defaultNS: "translation", lng: localStorage.getItem(I18N_LANGUAGE) || "en", fallbackLng: "en", interpolation: { escapeValue: false, }, }); \end{lstlisting} \subsection{@providers/index.tsx} \begin{lstlisting} import React, { FC } from "react"; import { Provider as ReduxProvider } from "react-redux"; import { ConfigProvider as AntdConfigProvider } from "antd"; // static imports aren't perfect for locales import ru from "antd/lib/locale/ru_RU"; import { Response } from "@curi/types"; import Auth from "@lib/components/Auth"; import { transliterate } from "@lib/utils"; import { closeRightPanel } from "reducer/workspace"; import { init as i18nInit } from "./i18n"; import { store } from "./redux"; import { init as routerInit, Router, router } from "./router"; // i18n reexports export { default as i18n } from "i18next"; export { useTranslation } from "react-i18next"; // Helpers export { toggleRightPanelAtom } from "../Layout/Workspace/index"; // router reexports export { useResponse, useActive } from "@curi/react-dom"; export { router } from "./router"; export interface PageProps { response: Response; } // Redux reexports export { useDispatch, useSelector, useStore, shallowEqual } from "react-redux"; export { useActions } from "./redux"; // Helpers export { default as Workspace } from "../Layout/Workspace/index"; const Provider: FC = ({ children }) => { return ( {children} ); }; router.observe(() => { store.dispatch(closeRightPanel()); }); function setupGlobalInfo(info: APP_INFO): void { window.APP = { name: transliterate(info.name), }; } export const init = async (info: APP_INFO): Promise => { setupGlobalInfo(info); await Promise.all([i18nInit(), routerInit()]); }; export default Provider; \end{lstlisting} \subsection{@providers/rbac-rules.ts} \begin{lstlisting} export enum Role { visitor = "visitor", manager = "manager", supermanager = "supermanager", contentManager = "contentManager", operator = "operator", admin = "admin", } const rules = { visitor: { static: [ "auth:login", "faq:pretty", "fund:description-pretty", "news:public", ], }, contentManager: { static: [ "applications:show", "settings:index", "users:show", "fund:index", "fund:faq-index", "fund:description", "fund:description-edit", "faq:edit", "news:edit", "news:create", "news:index", "notifications:index", ], }, operator: { static: ["chats:show", "chats:index", "settings:index"], }, manager: { static: [ "applications:index", "settings:index", "application:edit", "applications:show", "applications:create", "users:show", "user:view-applications", "notifications:index", ], }, supermanager: { static: [ "applications:index", "applications:show", "application:edit", "application:can-vote", "applications:create", "settings:index", "categories:index", "users:show", "user:view-applications", "fund:index", "fund:description", "transactions:show", "transactions:index", "transactions:create", "managers:index", "managers:show", "fund:faq-index", "notifications:index", "transactions:distribute", ], }, admin: { static: [ "users:index", "users:show", "user:edit", "users:create", "user:view-sessions", "user:show-admin", "settings:index", "logs:index", "notifications:index", ], }, }; export function check(role: Role, action: string): boolean { const permissions = rules[role]; if (!permissions) { // role is not present in the rules return false; } const staticPermissions = permissions.static; if (staticPermissions && staticPermissions.includes(action)) { // static rule not provided for action return true; } return false; } export default rules; \end{lstlisting} \subsection{@providers/redux.ts} \begin{lstlisting} import { useMemo } from "react"; import { useDispatch } from "react-redux"; import { ActionCreator, bindActionCreators, configureStore, } from "@reduxjs/toolkit"; import reducer from "../reducer"; export const store = configureStore({ reducer, devTools: true, }); export type RootState = ReturnType; export type AppDispatch = typeof store.dispatch; export function useActions>( actionCreators: C, ): C { const dispatch = useDispatch(); return useMemo(() => bindActionCreators(actionCreators, dispatch), [ dispatch, actionCreators, ]); } \end{lstlisting} \subsection{@providers/router/__tests__/utils.ts} \begin{lstlisting} /* eslint-disable no-undef */ import { RouteDescriptor } from "@curi/types"; import { buildRoutes, filename, treeFromFilenames } from "../utils"; const CONF_1 = { pages: [ "./first/[id].tsx", "./first/index.tsx", "./first/foo.tsx", "./index.tsx", ], tree: { index: { [filename]: "./index.tsx" }, first: { "[id]": { [filename]: "./first/[id].tsx" }, index: { [filename]: "./first/index.tsx" }, foo: { [filename]: "./first/foo.tsx" }, }, }, routes: [ { name: "index", path: "", extra: { file: "./index.tsx" } }, { name: "first:index", path: "first", extra: { file: "./first/index.tsx" }, children: [ { name: "first:foo", path: "foo", extra: { file: "./first/foo.tsx" } }, { name: "first", path: ":id", extra: { file: "./first/[id].tsx" } }, ], }, ], }; test("Tree builder", () => { expect(treeFromFilenames(CONF_1.pages)).toEqual(CONF_1.tree); }); const builderMock = jest.fn( (file: string, path: string, name: string): RouteDescriptor => ({ path, name, extra: { file }, }), ); const wrap = (x: Array): Array => buildRoutes(x, builderMock); test("Routes builder", () => { expect(wrap(CONF_1.pages)).toEqual(CONF_1.routes); expect(builderMock.mock.calls.length).toBe(4); }); \end{lstlisting} \subsection{@providers/router/index.ts} \begin{lstlisting} import { createRouterComponent } from "@curi/react-dom"; import { createRouter, prepareRoutes } from "@curi/router"; import { browser } from "@hickory/browser"; import pages from "./pageRoutes"; const routes = prepareRoutes(pages); export const router = createRouter(browser, routes); export function init(): Promise { return new Promise((resolve) => router.once(() => resolve())); } export const Router = createRouterComponent(router); \end{lstlisting} \subsection{@providers/router/pageRoutes.ts} \begin{lstlisting} import { ReactNode } from "react"; import { RouteDescriptor, SettableResponseProperties } from "@curi/types"; import NotFound from "../../pages/_notFound"; import { buildRoutes } from "./utils"; interface ResolveResult { component: ReactNode; } // TODO: better regexp for pages to ignore util pages const context = require.context("../../pages", true, /\.\/[^_]*.tsx$/); function buildSubRoute( file: string, path: string, name: string, ): RouteDescriptor { const { default: importedComponent, name: importedName, pageComponent: importedPageComponent, } = context(file); return { path, name: importedName || name, resolve(): Promise { // TODO: check if this can be async return Promise.resolve({ component: importedComponent || importedPageComponent, }); }, respond({ resolved }): SettableResponseProperties { const { component } = resolved as ResolveResult; return { body: component }; // TODO: add AuthConsumer }, }; } const appRoutes = buildRoutes(context.keys(), buildSubRoute); const utilRoutes: Array = [ { name: "NotFound", path: "(.*)", respond(): SettableResponseProperties { return { body: NotFound }; }, }, ]; export default [...appRoutes, ...utilRoutes]; \end{lstlisting} \subsection{@providers/router/utils.ts} \begin{lstlisting} import { map, reverse, set, sortBy, toPairs } from "lodash"; import { RouteDescriptor } from "@curi/types"; export const filename = Symbol("filename"); type PageInfo = { [filename]: string; }; type PageTree = { [key: string]: PageTree | PageInfo; }; function cleanPath(str: string): string { return str.replace(/(^|\/)index$/, "").replace(/\[([^\]]*)\]/g, ":$1"); } function cleanName(str: string): string { return str.replace(/\[(.*)\]/, ""); } type RouteBuilder = ( file: string, path: string, name: string, ) => RouteDescriptor; type BuilderContext = { build: RouteBuilder; }; export function buildFromTree( this: BuilderContext, from: PageTree | PageInfo, paths: Array = [], names: Array = [], ): RouteDescriptor { // Util function for child routes const buildChildrenRoutes = (tree: PageTree): Array => { // Sort pairs from tree by key, basically moving templated routes down const sorted = reverse(sortBy(toPairs(tree), ["0"])); return map(sorted, ([path, value]) => { const addedName = cleanName(path); const addedPath = cleanPath(path); return buildFromTree.call( this, value, [...paths, addedPath], [...names, addedName], ); }); }; // Actual function body const pathTail = paths.length > 0 ? paths[paths.length - 1] : ""; const currentName = names.filter(Boolean).join(":"); if ((from as PageInfo)[filename]) { const leaf = from as PageInfo; return this.build(leaf[filename], pathTail, currentName); } if (paths.length === 0) { const tree = from as PageTree; // Ephemeral root const resultEntry: RouteDescriptor = { name: "", path: "", }; resultEntry.children = buildChildrenRoutes(tree); return resultEntry; } const { index, ...rest } = from as PageTree; const resultEntry: RouteDescriptor = index ? this.build( (index as PageInfo)[filename], pathTail, `${currentName}:index`, ) : { name: `${currentName}:index`, path: pathTail, }; resultEntry.children = buildChildrenRoutes(rest); return resultEntry; } export function treeFromFilenames(files: Array): PageTree { const result = {}; files.forEach((file) => { const centerPart = file.replace(/^\.\//, "").replace(/.tsx$/, ""); set(result, centerPart.split("/"), { [filename]: file }); }); return result; } export function buildRoutes( files: Array, builder: RouteBuilder, ): Array { const tree = treeFromFilenames(files); return buildFromTree.call({ build: builder }, tree).children ?? []; } \end{lstlisting} \subsection{@typings/component.d.ts} \begin{lstlisting} import { FC } from "react"; type DataComponent = FC<{ data: T }>; type IdComponent = FC<{ id: number }>; \end{lstlisting} \subsection{@typings/index.d.ts} \begin{lstlisting} /* eslint-disable */ declare module "*.module.less" { const classes: { [key: string]: string }; export default classes; } declare module "*.elm" { export const Elm: any; } declare module "react-elm-components" { import { Component } from "react"; type ElmProps = { src: any; flags?: any; ports?: any; key?: string; }; class Elm extends Component {} export = Elm; } type DeepPartial = { [P in keyof T]?: DeepPartial; }; type WrapperComponent = (props: { className?: string; children: T; }) => JSX.Element | null; \end{lstlisting} \subsection{@typings/window.d.ts} \begin{lstlisting} type APP_INFO = { name: string; }; interface Window { APP: APP_INFO; } \end{lstlisting} \subsection{App.tsx} \begin{lstlisting} import React, { FC, Suspense } from "react"; import Provider, { useTranslation } from "@providers"; import Layout from "./Layout"; const App: FC = () => { const { t } = useTranslation(); const loadingMessage =
{t("loading")}
; return ( ); }; export default App; \end{lstlisting} \subsection{appInfo.tsx} \begin{lstlisting} import React from "react"; import meta from "../package.json"; export const logoSmall = "Charity"; export const logoLarge = "Charity CRM"; export const nameString = "Charity"; export const name = ( <> System {nameString} ); const suffix = process.env.CI_PIPELINE_ID || "dev"; export const version = `${meta.version}.${suffix}`; \end{lstlisting} \subsection{components/Application/ActionForm/Change.tsx} \begin{lstlisting} import React, { forwardRef, ForwardRefRenderFunction, useCallback, } from "react"; import { DonationRequestBodyAvailableStatusesEnum as ApplicationStatus } from "@generated"; import { notify } from "@lib/utils/notification"; import { useTranslation } from "@providers"; import { DonationRequestFactory } from "@providers/axios"; import ApplicationForm, { ApplicationFormHandler, ApplicationFormState, } from "./form"; type ChangeApplicationFormProps = { id: number; setLoading: (value: boolean) => void; availiableStatuses: ApplicationStatus[]; currentStatus: ApplicationStatus; undoTransition?: boolean; onSuccess?: () => void; onError?: (error: Error) => void; }; const ChangeApplicationForm: ForwardRefRenderFunction< ApplicationFormHandler, ChangeApplicationFormProps > = ( { onSuccess, onError, id, availiableStatuses, currentStatus, undoTransition, setLoading, }, ref, ) => { const { t } = useTranslation("Application"); const onSubmit = useCallback( async (values: ApplicationFormState): Promise => { try { setLoading(true); DonationRequestFactory.apiDonationRequestIdStatusPatch(id, values).then( () => { notify(t("$views.updateStatus"), "success"); onSuccess?.(); }, ); } catch (e) { onError?.(e); } finally { setLoading(false); } }, // eslint-disable-next-line [], ); const onUndoTransition = async (): Promise => { try { await DonationRequestFactory.apiDonationRequestIdStatusDelete(id); notify(t("$views.undoTransitionSuccess", "success")); onSuccess?.(); } catch (e) { onError?.(e); } }; return ( ); }; export default forwardRef(ChangeApplicationForm); \end{lstlisting} \subsection{components/Application/ActionForm/ChangeDrawerButton.tsx} \begin{lstlisting} import React, { FC, useRef, useState } from "react"; import { Button, Drawer, Space } from "antd"; import { DonationRequestBodyAvailableStatusesEnum as ApplicationStatus } from "@generated"; import { useTranslation } from "@providers"; import { ApplicationFormHandler } from "./form"; import { ApplicationForm } from "."; import styles from "./styles.module.less"; const CreateDrawerButton: FC<{ refetch: () => void; availiableStatuses: ApplicationStatus[]; currentStatus: ApplicationStatus; undoTransition?: boolean; id: number; }> = ({ availiableStatuses, id, currentStatus, undoTransition, refetch }) => { const { t } = useTranslation("Application"); const handlers = useRef(null); const [drawer, setDrawer] = useState(false); const [loading, setLoading] = useState(false); const onClose = (): void => { setDrawer(false); refetch(); handlers.current?.resetFields(); }; return ( <> } > ); }; export default CreateDrawerButton; \end{lstlisting} \subsection{components/Application/ActionForm/form.tsx} \begin{lstlisting} /* eslint-disable @typescript-eslint/no-explicit-any */ import React, { FC, forwardRef, ForwardRefRenderFunction, useEffect, useMemo, useState, } from "react"; import { defaults, noop } from "lodash"; import { Button, Form, Input, Tooltip, Upload } from "antd"; import { FormInstance, Rule } from "antd/lib/form"; import { UploadChangeParam, UploadFile } from "antd/lib/upload/interface"; import { UploadOutlined } from "@ant-design/icons"; import { DonationRequestBodyAvailableStatusesEnum as ApplicationStatus, DonationRequestUpdateStatusInput, } from "@generated"; import { useTranslation } from "@providers"; import { customRequest } from "@providers/cusomUpload"; import AssigneeSelect from "components/Assignee/Select"; import StatusSelect from "components/Status/Select"; export type ApplicationFormState = DonationRequestUpdateStatusInput; export type ApplicationFormHandler = FormInstance; type ApplicationFormProps = { initial?: ApplicationFormState; availiableStatuses: ApplicationStatus[]; undoTransition?: boolean; currentStatus: ApplicationStatus; onSubmit?: (values: ApplicationFormState) => void | Promise; onUndoTransition?: () => void | Promise; }; const DEFAULTS: ApplicationFormState = { assignee_id: undefined, status: undefined, comment: undefined, }; const RULES: { [K in keyof ApplicationFormState]?: Rule[] } = { status: [ { required: true, message: "Couldn't be elmpy", }, ], }; const UndoTransition: FC<{ currentStatus: ApplicationStatus; onClick?: () => void | Promise; }> = ({ currentStatus, onClick }) => { const { t } = useTranslation("Application"); return ( ); }; type UploadFilesProps = { initial: Array>; onFilesChange: (files: string[]) => void; onUploadChange: (info: UploadChangeParam) => void; }; const UploadFilesItem: FC = ( { initial, onFilesChange, onUploadChange }, ...rest ) => { const { t } = useTranslation("Application"); return ( customRequest(options, onFilesChange)} > ); }; const ApplicationForm: ForwardRefRenderFunction< ApplicationFormHandler, ApplicationFormProps > = ( { initial, onSubmit, availiableStatuses, undoTransition, onUndoTransition, currentStatus, }, ref, ) => { const { t } = useTranslation("Application"); const [form] = Form.useForm(); const [status, setStatus] = useState(); // file ids after uploading during OnRealization const [initialFileList, setUploadChange] = useState>>( [], ); const handleOnChange = (info: UploadChangeParam): void => { setUploadChange(info.fileList); }; const initialValues = useMemo(() => defaults({}, initial, DEFAULTS), [ initial, ]); useEffect(() => { form.setFieldsValue(initialValues); }, [form, initialValues]); return ( layout="vertical" ref={ref} form={form} initialValues={initialValues} // eslint-disable-next-line onFinish={(values: any) => { const file_ids = initialFileList .map((item) => { if (item.response) { return item.response[0]?.id; } else { return undefined; } }) .flatMap((item) => { return item ? [item] : []; }); console.log(file_ids); onSubmit?.({ assignee_id: values?.assignee?.value, comment: values.comment, status: values.status, file_ids, }); }} > ) : undefined } > {currentStatus === ApplicationStatus.OnRealization && status === ApplicationStatus.Archived && ( { console.log(ids); }} onUploadChange={handleOnChange} /> )} ); }; export default forwardRef(ApplicationForm); \end{lstlisting} \subsection{components/Application/ActionForm/index.tsx} \begin{lstlisting} import Form from "./form"; export { default as ApplicationForm } from "./Change"; export { default as ChangeButton } from "./ChangeDrawerButton"; export type { ApplicationFormHandler, ApplicationFormState } from "./form"; export default Form; \end{lstlisting} \subsection{components/Application/ActionForm/styles.module.less} \begin{lstlisting} \end{lstlisting} \subsection{components/Application/Buttons/create.tsx} \begin{lstlisting} import React, { FC } from "react"; import { Button } from "antd"; import { PlusOutlined } from "@ant-design/icons"; import { router, useTranslation } from "@providers"; export const Actions: FC = () => { const { t } = useTranslation("Application"); return ( ); }; \end{lstlisting} \subsection{components/Application/Buttons/index.tsx} \begin{lstlisting} import React, { FC, useState } from "react"; import { useTranslation } from "react-i18next"; import { Dropdown, Menu } from "antd"; import { DonationRequestBodyAvailableStatusesEnum as ApplicationStatus, DonationRequestBodyStatusEnum, DonationRequestUpdateInput, } from "@generated"; import { DonationRequestFactory } from "@providers/axios"; import { AxiosPromise } from "axios"; import ModalWithMessage from "components/Application/Modal"; import { startProcessing, stopProcessing } from "./Processing"; import { requireConfirmation } from "./RequireConfirmation"; type ApplicationButtonsProps = { currentStatus: ApplicationStatus; applicationId: number; availiableStatuses: ApplicationStatus[]; onRefetch: () => Promise; }; type ModalState = { title: string; newStatus: ApplicationStatus; query: ( id: number, input?: DonationRequestUpdateInput, // eslint-disable-next-line options?: any, ) => AxiosPromise; }; const ActionButtons: FC = (props) => { const { applicationId, onRefetch, currentStatus } = props; const { t } = useTranslation("Application"); const [visibleModal, setVisibleModal] = useState(false); const [modalState, setModalState] = useState( undefined, ); const menu = []; for (const ind in props.availiableStatuses) { const status = props.availiableStatuses[ind]; switch (status) { case ApplicationStatus.InProcessing: menu.push( startProcessing(applicationId, onRefetch)} > {t("$views.buttons.inProcessing")} , ); break; case ApplicationStatus.Deleted: menu.push( { setVisibleModal(true); setModalState({ title: t("$views.modal.deleteTitle"), newStatus: ApplicationStatus.Deleted, query: DonationRequestFactory.apiDonationRequestIdStatusPatch, }); }} > {t("$views.buttons.delete")} , ); break; case ApplicationStatus.Spam: menu.push( { setVisibleModal(true); setModalState({ title: t("$views.modal.spamTitle"), query: DonationRequestFactory.apiDonationRequestIdStatusPatch, newStatus: ApplicationStatus.Spam, }); }} > {t("$views.buttons.spam")} , ); break; case ApplicationStatus.New: menu.push( stopProcessing(applicationId, onRefetch)} > {currentStatus === ApplicationStatus.Spam ? t("$views.buttons.returnFromSpam") : t("$views.buttons.stopProcessing")} , ); break; case ApplicationStatus.NeedsImprovement: menu.push( { setVisibleModal(true); setModalState({ newStatus: ApplicationStatus.NeedsImprovement, query: DonationRequestFactory.apiDonationRequestIdStatusPatch, title: t("$views.modal.requestChangesTitle"), }); }} > {t("$views.buttons.request_changes")} , ); break; case ApplicationStatus.Refused: menu.push( { setVisibleModal(true); setModalState({ title: t("$views.modal.refuse"), query: DonationRequestFactory.apiDonationRequestIdStatusPatch, newStatus: ApplicationStatus.Refused, }); }} > {t("$views.buttons.refuse")} , ); break; case ApplicationStatus.SuperManagerConfirmation: menu.push( requireConfirmation( applicationId, onRefetch, ApplicationStatus.SuperManagerConfirmation, ) } > {currentStatus === ApplicationStatus.SuperManagerConfirmation ? t("$views.buttons.activate") : t("$views.buttons.require_confirmation")} , ); break; case ApplicationStatus.UserConfirmation: menu.push( requireConfirmation( applicationId, onRefetch, ApplicationStatus.UserConfirmation, ) } > {currentStatus === ApplicationStatus.SuperManagerConfirmation ? t("$views.buttons.activate") : t("$views.buttons.require_confirmation")} , ); break; default: break; } } return ( <> {menu.length !== 0 && ( {menu}}> {t("$views.buttons.actions.title")} )} setVisibleModal(false)} /> ); }; export default ActionButtons; \end{lstlisting} \subsection{components/Application/Buttons/Processing/index.ts} \begin{lstlisting} import { DonationRequestFactory } from "@providers/axios"; import { ApplicationStatus } from "../../Status/tag"; export const stopProcessing = async ( id: number, onRefetch: () => Promise, ): Promise => { try { await DonationRequestFactory.apiDonationRequestIdStatusDelete(id); } catch (e) { console.log(e); } finally { onRefetch(); } }; export const startProcessing = async ( id: number, onRefetch: () => Promise, ): Promise => { try { const input = { status: ApplicationStatus.InProcessing, role: "Manager", }; await DonationRequestFactory.apiDonationRequestIdStatusPatch(id, input); } catch (e) { console.log(e); } finally { onRefetch(); } }; \end{lstlisting} \subsection{components/Application/Buttons/RequireConfirmation/index.tsx} \begin{lstlisting} import { DonationRequestBodyAvailableStatusesEnum as ApplicationStatus } from "@generated"; import { DonationRequestFactory } from "@providers/axios"; export const requireConfirmation = async ( id: number, onRefetch: () => Promise, status: ApplicationStatus, ): Promise => { try { // const newStatus = // status === ApplicationStatus.SuperManagerConfirmation // ? ApplicationStatus.Active // : ApplicationStatus.SuperManagerConfirmation; await DonationRequestFactory.apiDonationRequestIdStatusPatch(id, { status, }); } catch (e) { console.log(e); } finally { onRefetch(); } }; \end{lstlisting} \subsection{components/Application/Filters/assignee.tsx} \begin{lstlisting} import React, { FC } from "react"; import { Checkbox } from "antd"; import { useTranslation } from "@providers"; export const AssignedToMe: FC<{ initial: boolean; onChange: () => void }> = ({ initial, onChange, }) => { const { t } = useTranslation("Application"); return ( {t("Filters.assignee")} ); }; \end{lstlisting} \subsection{components/Application/Filters/clear.tsx} \begin{lstlisting} import React, { FC } from "react"; import { Button } from "antd"; import { ClearOutlined } from "@ant-design/icons"; export const ClearButton: FC<{ onClearAll: () => void }> = ({ onClearAll }) => { return ); }; export default CreatePage; \end{lstlisting} \subsection{components/Application/Form/relationship_select.tsx} \begin{lstlisting} import React, { FC, useState } from "react"; import { useTranslation } from "react-i18next"; import { Divider, Input, Select } from "antd"; import { PlusOutlined } from "@ant-design/icons"; import styles from "./styles.module.less"; const { Option } = Select; const RelationshipSelect: FC = () => { let index = 0; const { t } = useTranslation("Relationship"); const [state, setState] = useState({ items: [t("parent"), t("grandparent"), t("relative"), t("friend")], name: "", }); const addItem = (): void => { console.log("addItem"); const { items, name } = state; setState({ items: [...items, name || `New item ${index++}`], name: "", }); }; const onNameChange = (event: React.ChangeEvent): void => { setState({ ...state, name: event.target.value, }); }; return ( {t("addRelationship")} )} > {state.items.map((item) => ( ))} ); }; export default RelationshipSelect; \end{lstlisting} \subsection{components/Application/Form/styles.module.less} \begin{lstlisting} .add { flex: none; padding: 8px; display: block; cursor: pointer; } .divider { margin: 4px 0; } .input { flex: auto; } \end{lstlisting} \subsection{components/Application/Modal/index.tsx} \begin{lstlisting} import React, { FC, useCallback, useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { Form, Input, Modal } from "antd"; import { useForm } from "antd/lib/form/Form"; import { DonationRequestUpdateStatusInput } from "@generated"; import { notify } from "@lib/utils/notification"; import { AxiosPromise } from "axios"; import { ApplicationStatus } from "../Status/tag"; type FormValues = { message: string; }; const ModalWithMessage: FC<{ query: ( id: number, input?: DonationRequestUpdateStatusInput, // eslint-disable-next-line options?: any, ) => AxiosPromise; title: string; applicationId: number; newStatus: ApplicationStatus; onRefetch: () => Promise; isVisible: boolean; onClose: () => void; }> = ({ query, title, applicationId: id, newStatus, onRefetch, isVisible, onClose, }) => { const { t } = useTranslation("Application"); const [form] = useForm(); const [visible, setVisible] = useState(isVisible); const [confirmLoading, setConfirmLoading] = useState(false); useEffect(() => { setVisible(isVisible); }, [isVisible]); const handleOk = useCallback( async (values: FormValues): Promise => { try { setConfirmLoading(true); console.log(values); const input: DonationRequestUpdateStatusInput = { status: newStatus, comment: values.message, }; await query(id, input); form.resetFields(); notify(t("$views.card.successUpdateStatus")); } catch (e) { console.error(e); } finally { setVisible(false); setConfirmLoading(false); onClose(); onRefetch(); } }, [ setConfirmLoading, setVisible, id, onRefetch, newStatus, query, onClose, t, form, ], ); return ( handleOk(form.getFieldsValue())} confirmLoading={confirmLoading} onCancel={() => setVisible(false)} > form={form}> ); }; export default ModalWithMessage; \end{lstlisting} \subsection{components/Application/RightPanel/index.tsx} \begin{lstlisting} import React, { FC, useCallback } from "react"; import { toInteger, toNumber } from "lodash"; import { Button, Card, Col, Divider, Empty, List, Progress, Row, Skeleton, Statistic, Tag, Typography, } from "antd"; import Avatar from "antd/lib/avatar/avatar"; import { CheckOutlined, CloseCircleOutlined, WarningOutlined, } from "@ant-design/icons"; import { DonationRequestReviewResponseReviewStatusEnum as ReviewStatus, DonationRequestSingleReviewStatusSingleReviewStatusEnum as SingleReviewStatus, DonationRequestSubmitReviewInputReviewStatusEnum as IsReadyEum, } from "@generated"; import { fullName } from "@lib/utils/name"; import { notify } from "@lib/utils/notification"; import { useTranslation } from "@providers"; import { AuthConsumer } from "@providers/authContext"; import useAxios, { DonationRequestFactory } from "@providers/axios"; const { Paragraph, Title } = Typography; const StatusTag: FC<{ status?: ReviewStatus }> = ({ status }) => { const { t } = useTranslation("Application"); let color; switch (status) { case ReviewStatus.Accepted: color = "green"; break; case ReviewStatus.Rejected: color = "red"; break; case ReviewStatus.NotViewed: color = "gold"; break; } return {t(`ReviewStatus.${status}`)}; }; const SingleReviewSpan: FC<{ status?: SingleReviewStatus }> = ({ status }) => { const { t } = useTranslation("Application"); let emoji; switch (status) { case SingleReviewStatus.Accepted: emoji = "👍🏻"; break; case SingleReviewStatus.Rejected: emoji = "👎🏻"; break; case SingleReviewStatus.NotViewed: emoji = "⏳"; break; } return ( {emoji} {t(`ReviewStatus.${status}`)} ); }; const RightPanel: FC<{ id: number; category?: string; onRefetchApplication: () => Promise; }> = ({ id, category, onRefetchApplication }) => { const { t } = useTranslation("Application"); const { data, loading, refetchQuery } = useAxios( DonationRequestFactory.apiDonationRequestIdGetAllReviewersGet, undefined, id, ); const voteAPI = useCallback( async (vote: IsReadyEum) => { try { await DonationRequestFactory.apiDonationRequestIdSubmitReviewPatch(id, { id: toInteger(id.toString()), review_status: vote, }); notify(t("$views.rightPanel.success_vote"), "success"); } catch (e) { notify(t("$views.rightPanel.error_vote"), "error"); } finally { await refetchQuery(); await onRefetchApplication(); } }, [t, id, onRefetchApplication, refetchQuery], ); if (!data) { return ; } if (loading) { return ; } return ( {({ user }) => { //const canVote = data.reviewers?.[0]; const canVote = data.reviewers?.find( (element) => element.manager?.id === user.uuid, ); const alreadyVoted = canVote?.single_review_status !== SingleReviewStatus.NotViewed; return ( } >
{canVote && !alreadyVoted && ( )} {canVote && !alreadyVoted && ( )} {alreadyVoted && canVote?.single_review_status === SingleReviewStatus.Accepted && ( {" "} {t("vote_text", { id })} )} {!canVote && ( {" "} {t("vote_text_visitor", { id, category })} )} {alreadyVoted && canVote?.single_review_status === SingleReviewStatus.Rejected && ( {" "} {t("vote_text_reject", { id })} )} {t("reviewers")} ( } description={fullName( item.manager?.first_name, item.manager?.middle_name, item.manager?.last_name, )} title={ } /> )} /> ); }} ); }; export default RightPanel; \end{lstlisting} \subsection{components/Application/Status/tag.tsx} \begin{lstlisting} import React, { FC } from "react"; import { useTranslation } from "react-i18next"; import Tag, { TagProps } from "antd/lib/tag"; import { DonationRequestBodyStatusEnum } from "@generated"; import { NO_DATA_PLACEHOLDER } from "@lib/utils"; export { DonationRequestBodyStatusEnum as ApplicationStatus }; function getColor(level: DonationRequestBodyStatusEnum): TagProps["color"] { switch (level) { case DonationRequestBodyStatusEnum.New: return "blue"; case DonationRequestBodyStatusEnum.InProcessing: return "gold"; case DonationRequestBodyStatusEnum.Deleted: return "pink"; case DonationRequestBodyStatusEnum.NeedsImprovement: return "warning"; case DonationRequestBodyStatusEnum.SuperManagerConfirmation: return "gray"; case DonationRequestBodyStatusEnum.Active: return "green"; case DonationRequestBodyStatusEnum.Spam: return "red"; case DonationRequestBodyStatusEnum.Refused: return "error"; case DonationRequestBodyStatusEnum.UserConfirmation: return "magenta"; case DonationRequestBodyStatusEnum.Archived: return "volcano"; } } const StatusTag: FC<{ status?: DonationRequestBodyStatusEnum | null | undefined; }> = ({ status }) => { const { t } = useTranslation("Application"); if (!status) { return {NO_DATA_PLACEHOLDER}; } return {t(`Status.${status}`)}; }; export default StatusTag; \end{lstlisting} \subsection{components/Application/View/index.tsx} \begin{lstlisting} import React, { MutableRefObject, useEffect } from "react"; import { /*Badge,*/ Card, Tabs, Tooltip } from "antd"; import { DiffOutlined, FileOutlined, InfoCircleOutlined, MessageOutlined, } from "@ant-design/icons"; import { DonationRequestBody } from "@generated"; import { useTranslation } from "@providers"; // import { DonationRequestFactory } from "@providers/axios"; import { CommentTab, FilesTab, GeneralInfoTab, LogsTab } from "./Tabs"; const { TabPane } = Tabs; type PropsType = { donation: DonationRequestBody; onRefetch: () => Promise; }; type RefType = { onRefetch: () => Promise; }; const ApplicationView = React.forwardRef((props, ref) => { const { t } = useTranslation("Application"); const { donation, onRefetch } = props; useEffect(() => { if (ref !== undefined) { (ref as MutableRefObject).current = { onRefetch, }; } // eslint-disable-next-line }, [ref]); return ( } key="general" > {/* } key="donee" > */} } key="files" > } key="logs" > {/* */} } > ); }); ApplicationView.displayName = "ApplicationView"; export default ApplicationView; \end{lstlisting} \subsection{components/Application/View/Tabs/Comments/index.tsx} \begin{lstlisting} import React, { FC, useCallback, useEffect, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; import { Avatar, Button, Card, Comment, Empty, Form, Input } from "antd"; import { CommentProps } from "antd/lib/comment"; import { UserOutlined } from "@ant-design/icons"; import { UserUser } from "@generated"; import { formatDate } from "@lib/utils"; import { DonationRequestFactory } from "@providers/axios"; import { IdComponent } from "@typings/component"; import styles from "./styles.module.less"; const { TextArea } = Input; /** Comment list */ const CommentList: FC<{ comments: CommentProps[] }> = ({ comments }) => { const { t } = useTranslation("Comments"); // eslint-disable-next-line const messagesEndRef = useRef(null); const scrollToBottom = (): void => { messagesEndRef.current?.scrollIntoView({ behavior: "smooth" }); }; useEffect(scrollToBottom, [comments]); return (
{comments.length === 0 && ( )} {comments.map((item, index) => ( ))}
); }; const Editor: FC<{ onChange: (e: React.ChangeEvent) => void; onSubmit: () => void; submitting: boolean; value: string; }> = ({ onChange, onSubmit, submitting, value }) => { const { t } = useTranslation("Comments"); return ( <>