ch-chat-api-typescript-axios
Version:
An OpenAPI generator tool for the CH Chat API, designed to simplify API client generation and streamline integration workflows.
228 lines • 12 kB
JavaScript
;
/* tslint:disable */
/* eslint-disable */
/**
* CloudHospital.ChatApi
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.NotificationsApi = exports.NotificationsApiFactory = exports.NotificationsApiFp = exports.NotificationsApiAxiosParamCreator = void 0;
const axios_1 = __importDefault(require("axios"));
// Some imports not used depending on template conditions
// @ts-ignore
const common_1 = require("../common");
// @ts-ignore
const base_1 = require("../base");
/**
* NotificationsApi - axios parameter creator
* @export
*/
const NotificationsApiAxiosParamCreator = function (configuration) {
return {
/**
*
* @summary Get the notifications for the current user.
* @param {boolean} [isRead]
* @param {number} [page]
* @param {number} [limit]
* @param {Date} [lastRetrieved]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
apiV1ChatNotificationsGet: (isRead_1, page_1, limit_1, lastRetrieved_1, ...args_1) => __awaiter(this, [isRead_1, page_1, limit_1, lastRetrieved_1, ...args_1], void 0, function* (isRead, page, limit, lastRetrieved, options = {}) {
const localVarPath = `/api/v1/chat/notifications`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication oauth2 required
// oauth required
yield (0, common_1.setOAuthToObject)(localVarHeaderParameter, "oauth2", ["cloudhospital_chat_api"], configuration);
if (isRead !== undefined) {
localVarQueryParameter['IsRead'] = isRead;
}
if (page !== undefined) {
localVarQueryParameter['page'] = page;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (lastRetrieved !== undefined) {
localVarQueryParameter['lastRetrieved'] = (lastRetrieved instanceof Date) ?
lastRetrieved.toISOString() :
lastRetrieved;
}
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
*
* @summary Marks the notification as read for the current user.
* @param {string} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
apiV1ChatNotificationsIdCheckPost: (id_1, ...args_1) => __awaiter(this, [id_1, ...args_1], void 0, function* (id, options = {}) {
// verify required parameter 'id' is not null or undefined
(0, common_1.assertParamExists)('apiV1ChatNotificationsIdCheckPost', 'id', id);
const localVarPath = `/api/v1/chat/notifications/{id}/check`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication oauth2 required
// oauth required
yield (0, common_1.setOAuthToObject)(localVarHeaderParameter, "oauth2", ["cloudhospital_chat_api"], configuration);
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
};
};
exports.NotificationsApiAxiosParamCreator = NotificationsApiAxiosParamCreator;
/**
* NotificationsApi - functional programming interface
* @export
*/
const NotificationsApiFp = function (configuration) {
const localVarAxiosParamCreator = (0, exports.NotificationsApiAxiosParamCreator)(configuration);
return {
/**
*
* @summary Get the notifications for the current user.
* @param {boolean} [isRead]
* @param {number} [page]
* @param {number} [limit]
* @param {Date} [lastRetrieved]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
apiV1ChatNotificationsGet(isRead, page, limit, lastRetrieved, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.apiV1ChatNotificationsGet(isRead, page, limit, lastRetrieved, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['NotificationsApi.apiV1ChatNotificationsGet']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
/**
*
* @summary Marks the notification as read for the current user.
* @param {string} id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
apiV1ChatNotificationsIdCheckPost(id, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.apiV1ChatNotificationsIdCheckPost(id, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['NotificationsApi.apiV1ChatNotificationsIdCheckPost']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
};
};
exports.NotificationsApiFp = NotificationsApiFp;
/**
* NotificationsApi - factory interface
* @export
*/
const NotificationsApiFactory = function (configuration, basePath, axios) {
const localVarFp = (0, exports.NotificationsApiFp)(configuration);
return {
/**
*
* @summary Get the notifications for the current user.
* @param {NotificationsApiApiV1ChatNotificationsGetRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
apiV1ChatNotificationsGet(requestParameters = {}, options) {
return localVarFp.apiV1ChatNotificationsGet(requestParameters.isRead, requestParameters.page, requestParameters.limit, requestParameters.lastRetrieved, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Marks the notification as read for the current user.
* @param {NotificationsApiApiV1ChatNotificationsIdCheckPostRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
apiV1ChatNotificationsIdCheckPost(requestParameters, options) {
return localVarFp.apiV1ChatNotificationsIdCheckPost(requestParameters.id, options).then((request) => request(axios, basePath));
},
};
};
exports.NotificationsApiFactory = NotificationsApiFactory;
/**
* NotificationsApi - object-oriented interface
* @export
* @class NotificationsApi
* @extends {BaseAPI}
*/
class NotificationsApi extends base_1.BaseAPI {
/**
*
* @summary Get the notifications for the current user.
* @param {NotificationsApiApiV1ChatNotificationsGetRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof NotificationsApi
*/
apiV1ChatNotificationsGet(requestParameters = {}, options) {
return (0, exports.NotificationsApiFp)(this.configuration).apiV1ChatNotificationsGet(requestParameters.isRead, requestParameters.page, requestParameters.limit, requestParameters.lastRetrieved, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Marks the notification as read for the current user.
* @param {NotificationsApiApiV1ChatNotificationsIdCheckPostRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof NotificationsApi
*/
apiV1ChatNotificationsIdCheckPost(requestParameters, options) {
return (0, exports.NotificationsApiFp)(this.configuration).apiV1ChatNotificationsIdCheckPost(requestParameters.id, options).then((request) => request(this.axios, this.basePath));
}
}
exports.NotificationsApi = NotificationsApi;
//# sourceMappingURL=notifications-api.js.map