UNPKG

@contiva/sap-integration-suite-client

Version:
674 lines (673 loc) 30.3 kB
"use strict"; /* eslint-disable */ /* tslint:disable */ // @ts-nocheck /* * --------------------------------------------------------------- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## * ## ## * ## AUTHOR: acacode ## * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## * --------------------------------------------------------------- */ Object.defineProperty(exports, "__esModule", { value: true }); exports.Api = exports.HttpClient = exports.ContentType = void 0; var ContentType; (function (ContentType) { ContentType["Json"] = "application/json"; ContentType["JsonApi"] = "application/vnd.api+json"; ContentType["FormData"] = "multipart/form-data"; ContentType["UrlEncoded"] = "application/x-www-form-urlencoded"; ContentType["Text"] = "text/plain"; })(ContentType || (exports.ContentType = ContentType = {})); class HttpClient { constructor(apiConfig = {}) { this.baseUrl = "https://{Account Short Name}-tmn.{SSL Host}.{landscapehost}/api/v1"; this.securityData = null; this.abortControllers = new Map(); this.customFetch = (...fetchParams) => fetch(...fetchParams); this.baseApiParams = { credentials: "same-origin", headers: {}, redirect: "follow", referrerPolicy: "no-referrer", }; this.setSecurityData = (data) => { this.securityData = data; }; this.contentFormatters = { [ContentType.Json]: (input) => input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, [ContentType.JsonApi]: (input) => input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, [ContentType.Text]: (input) => input !== null && typeof input !== "string" ? JSON.stringify(input) : input, [ContentType.FormData]: (input) => { if (input instanceof FormData) { return input; } return Object.keys(input || {}).reduce((formData, key) => { const property = input[key]; formData.append(key, property instanceof Blob ? property : typeof property === "object" && property !== null ? JSON.stringify(property) : `${property}`); return formData; }, new FormData()); }, [ContentType.UrlEncoded]: (input) => this.toQueryString(input), }; this.createAbortSignal = (cancelToken) => { if (this.abortControllers.has(cancelToken)) { const abortController = this.abortControllers.get(cancelToken); if (abortController) { return abortController.signal; } return void 0; } const abortController = new AbortController(); this.abortControllers.set(cancelToken, abortController); return abortController.signal; }; this.abortRequest = (cancelToken) => { const abortController = this.abortControllers.get(cancelToken); if (abortController) { abortController.abort(); this.abortControllers.delete(cancelToken); } }; this.request = async ({ body, secure, path, type, query, format, baseUrl, cancelToken, ...params }) => { const secureParams = ((typeof secure === "boolean" ? secure : this.baseApiParams.secure) && this.securityWorker && (await this.securityWorker(this.securityData))) || {}; const requestParams = this.mergeRequestParams(params, secureParams); const queryString = query && this.toQueryString(query); const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { ...requestParams, headers: { ...(requestParams.headers || {}), ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), }).then(async (response) => { const r = response; r.data = null; r.error = null; const responseToParse = responseFormat ? response.clone() : response; const data = !responseFormat ? r : await responseToParse[responseFormat]() .then((data) => { if (r.ok) { r.data = data; } else { r.error = data; } return r; }) .catch((e) => { r.error = e; return r; }); if (cancelToken) { this.abortControllers.delete(cancelToken); } if (!response.ok) throw data; return data; }); }; Object.assign(this, apiConfig); } encodeQueryParam(key, value) { const encodedKey = encodeURIComponent(key); return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; } addQueryParam(query, key) { return this.encodeQueryParam(key, query[key]); } addArrayQueryParam(query, key) { const value = query[key]; return value.map((v) => this.encodeQueryParam(key, v)).join("&"); } toQueryString(rawQuery) { const query = rawQuery || {}; const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]); return keys .map((key) => Array.isArray(query[key]) ? this.addArrayQueryParam(query, key) : this.addQueryParam(query, key)) .join("&"); } addQueryParams(rawQuery) { const queryString = this.toQueryString(rawQuery); return queryString ? `?${queryString}` : ""; } mergeRequestParams(params1, params2) { return { ...this.baseApiParams, ...params1, ...(params2 || {}), headers: { ...(this.baseApiParams.headers || {}), ...(params1.headers || {}), ...((params2 && params2.headers) || {}), }, }; } } exports.HttpClient = HttpClient; /** * @title Partner Directory * @version 1.0.0 * @baseUrl https://{Account Short Name}-tmn.{SSL Host}.{landscapehost}/api/v1 * @externalDocs https://help.sap.com/viewer/368c481cd6954bdfa5d0435479fd4eaf/Cloud/en-US/0fe80dc9d3be4dfbbb89ee4c791d326e.html * * Partner Directory enables you to get, write or delete data. This component contains information on partners that are connected to a tenant in the context of a larger network. Information stored in the Partner Directory can be used to parameterize integration flows. * This API is implemented based on OData version 2 specification. */ class Api extends HttpClient { constructor() { super(...arguments); /** * @description You can use the following request to request the CSRF token for this session, which is required for write access via POST, PUT and DELETE operations. Copy the received X-CSRF-Token from the response header.<br> **In API sandbox this request is not relevant!** * * @tags CSRF Token Handling * @name GetRoot * @summary Get CSRF token. * @request GET:/ * @secure */ this.getRoot = (params = {}) => this.request({ path: `/`, method: "GET", secure: true, ...params, }); this.alternativePartners = { /** * @description You can use the following request to get all alternative partners. * * @tags Alternative Partners * @name AlternativePartnersList * @summary Get all alternative partners. * @request GET:/AlternativePartners * @secure */ alternativePartnersList: (query, params = {}) => this.request({ path: `/AlternativePartners`, method: "GET", query: query, secure: true, format: "json", ...params, }), /** * @description You can use the following request to add new alternative partner.<br> In API sandbox only read APIs could be tested. You need to configure an API endpoint for your account, where you have the required write permissions to update the partner directory. * * @tags Alternative Partners * @name AlternativePartnersCreate * @summary Add new alternative partner. * @request POST:/AlternativePartners * @secure */ alternativePartnersCreate: (AlternativePartner, params = {}) => this.request({ path: `/AlternativePartners`, method: "POST", body: AlternativePartner, secure: true, type: ContentType.Json, format: "json", ...params, }), }; this.alternativePartnersHexagencyHexagencyHexschemeHexschemeHexidHexid = { /** * @description You can use the following request to get an alternative partner by key fields. * * @tags Alternative Partners * @name AlternativePartnersHexagencyHexschemeHexidList * @summary Get alternative partner by key fields. * @request GET:/AlternativePartners(Hexagency='{Hexagency}',Hexscheme='{Hexscheme}',Hexid='{Hexid}') * @secure */ alternativePartnersHexagencyHexschemeHexidList: (hexagency, hexscheme, hexid, query, params = {}) => this.request({ path: `/AlternativePartners(Hexagency='${hexagency}',Hexscheme='${hexscheme}',Hexid='${hexid}')`, method: "GET", query: query, secure: true, format: "json", ...params, }), /** * @description You can use the following request to update alternative partner.<br> In API sandbox only read APIs could be tested. You need to configure an API endpoint for your account, where you have the required write permissions to update the partner directory. * * @tags Alternative Partners * @name AlternativePartnersHexagencyHexschemeHexidUpdate * @summary Update alternative partner. * @request PUT:/AlternativePartners(Hexagency='{Hexagency}',Hexscheme='{Hexscheme}',Hexid='{Hexid}') * @secure */ alternativePartnersHexagencyHexschemeHexidUpdate: (hexagency, hexscheme, hexid, AlternativePartner, params = {}) => this.request({ path: `/AlternativePartners(Hexagency='${hexagency}',Hexscheme='${hexscheme}',Hexid='${hexid}')`, method: "PUT", body: AlternativePartner, secure: true, type: ContentType.Json, ...params, }), /** * @description You can use the following request to delete alternative partner.<br> In API sandbox only read APIs could be tested. You need to configure an API endpoint for your account, where you have the required write permissions to update the partner directory. * * @tags Alternative Partners * @name AlternativePartnersHexagencyHexschemeHexidDelete * @summary Delete alternative partner. * @request DELETE:/AlternativePartners(Hexagency='{Hexagency}',Hexscheme='{Hexscheme}',Hexid='{Hexid}') * @secure */ alternativePartnersHexagencyHexschemeHexidDelete: (hexagency, hexscheme, hexid, params = {}) => this.request({ path: `/AlternativePartners(Hexagency='${hexagency}',Hexscheme='${hexscheme}',Hexid='${hexid}')`, method: "DELETE", secure: true, ...params, }), }; this.authorizedUsers = { /** * @description You can use the following request to get all authorized users. * * @tags Authorized Users * @name AuthorizedUsersList * @summary Get all authorized users. * @request GET:/AuthorizedUsers * @secure */ authorizedUsersList: (query, params = {}) => this.request({ path: `/AuthorizedUsers`, method: "GET", query: query, secure: true, format: "json", ...params, }), /** * @description You can use the following request to add new authorized user.<br> In API sandbox only read APIs could be tested. You need to configure an API endpoint for your account, where you have the required write permissions to update the partner directory. * * @tags Authorized Users * @name AuthorizedUsersCreate * @summary Add new authorized user. * @request POST:/AuthorizedUsers * @secure */ authorizedUsersCreate: (AuthorizedUser, query, params = {}) => this.request({ path: `/AuthorizedUsers`, method: "POST", query: query, body: AuthorizedUser, secure: true, type: ContentType.Json, format: "json", ...params, }), }; this.authorizedUsersUser = { /** * @description You can use the following request to get an authorized user by key. * * @tags Authorized Users * @name AuthorizedUsersList * @summary Get authorized user by key. * @request GET:/AuthorizedUsers('{User}') * @secure */ authorizedUsersList: (user, query, params = {}) => this.request({ path: `/AuthorizedUsers('${user}')`, method: "GET", query: query, secure: true, format: "json", ...params, }), /** * @description You can use the following request to update authorized user.<br> In API sandbox only read APIs could be tested. You need to configure an API endpoint for your account, where you have the required write permissions to update the partner directory. * * @tags Authorized Users * @name AuthorizedUsersUpdate * @summary Update authorized user. * @request PUT:/AuthorizedUsers('{User}') * @secure */ authorizedUsersUpdate: (user, AuthorizedUser, query, params = {}) => this.request({ path: `/AuthorizedUsers('${user}')`, method: "PUT", query: query, body: AuthorizedUser, secure: true, type: ContentType.Json, ...params, }), /** * @description You can use the following request to delete authorized users.<br> In API sandbox only read APIs could be tested. You need to configure an API endpoint for your account, where you have the required write permissions to update the partner directory. * * @tags Authorized Users * @name AuthorizedUsersDelete * @summary Delete authorized users. * @request DELETE:/AuthorizedUsers('{User}') * @secure */ authorizedUsersDelete: (user, query, params = {}) => this.request({ path: `/AuthorizedUsers('${user}')`, method: "DELETE", query: query, secure: true, ...params, }), }; this.binaryParameters = { /** * @description You can use the following request to get all binary parameters. * * @tags Binary Parameters * @name BinaryParametersList * @summary Get all binary parameters. * @request GET:/BinaryParameters * @secure */ binaryParametersList: (query, params = {}) => this.request({ path: `/BinaryParameters`, method: "GET", query: query, secure: true, format: "json", ...params, }), /** * @description You can use the following request to add a new binary parameter.<br> In API sandbox only read APIs could be tested. You need to configure an API endpoint for your account, where you have the required write permissions to update the partner directory. * * @tags Binary Parameters * @name BinaryParametersCreate * @summary Add a new binary parameter. * @request POST:/BinaryParameters * @secure */ binaryParametersCreate: (BinaryParameter, query, params = {}) => this.request({ path: `/BinaryParameters`, method: "POST", query: query, body: BinaryParameter, secure: true, type: ContentType.Json, format: "json", ...params, }), }; this.binaryParametersPidPidIdId = { /** * @description You can use the following request to get a binary parameter by key. * * @tags Binary Parameters * @name BinaryParametersPidIdList * @summary Get binary parameter by key * @request GET:/BinaryParameters(Pid='{Pid}',Id='{Id}') * @secure */ binaryParametersPidIdList: (pid, id, query, params = {}) => this.request({ path: `/BinaryParameters(Pid='${pid}',Id='${id}')`, method: "GET", query: query, secure: true, format: "json", ...params, }), /** * @description You can use the following request to update binary parameter by key.<br> In API sandbox only read APIs could be tested. You need to configure an API endpoint for your account, where you have the required write permissions to update the partner directory. * * @tags Binary Parameters * @name BinaryParametersPidIdUpdate * @summary Update binary parameter by key. * @request PUT:/BinaryParameters(Pid='{Pid}',Id='{Id}') * @secure */ binaryParametersPidIdUpdate: (pid, id, BinaryParameter, query, params = {}) => this.request({ path: `/BinaryParameters(Pid='${pid}',Id='${id}')`, method: "PUT", query: query, body: BinaryParameter, secure: true, type: ContentType.Json, ...params, }), /** * @description You can use the following request to delete binary parameter.<br> In API sandbox only read APIs could be tested. You need to configure an API endpoint for your account, where you have the required write permissions to update the partner directory. * * @tags Binary Parameters * @name BinaryParametersPidIdDelete * @summary Delete binary parameter. * @request DELETE:/BinaryParameters(Pid='{Pid}',Id='{Id}') * @secure */ binaryParametersPidIdDelete: (pid, id, query, params = {}) => this.request({ path: `/BinaryParameters(Pid='${pid}',Id='${id}')`, method: "DELETE", query: query, secure: true, ...params, }), }; this.partners = { /** * @description You can use the following request to get all partners. * * @tags Partners * @name PartnersList * @summary Get all partners. * @request GET:/Partners * @secure */ partnersList: (query, params = {}) => this.request({ path: `/Partners`, method: "GET", query: query, secure: true, format: "json", ...params, }), }; this.partnersPid = { /** * @description You can use the following request to delete partner.<br> In API sandbox only read APIs could be tested. You need to configure an API endpoint for your account, where you have the required write permissions to update the partner directory. * * @tags Partners * @name PartnersDelete * @summary Delete partner. * @request DELETE:/Partners('{Pid}') * @secure */ partnersDelete: (pid, query, params = {}) => this.request({ path: `/Partners('${pid}')`, method: "DELETE", query: query, secure: true, ...params, }), }; this.stringParameters = { /** * @description You can use the following request to get all string parameters. * * @tags String Parameters * @name StringParametersList * @summary Get all string parameters. * @request GET:/StringParameters * @secure */ stringParametersList: (query, params = {}) => this.request({ path: `/StringParameters`, method: "GET", query: query, secure: true, format: "json", ...params, }), /** * @description You can use the following request to add new string parameter.<br> In API sandbox only read APIs could be tested. You need to configure an API endpoint for your account, where you have the required write permissions to update the partner directory. * * @tags String Parameters * @name StringParametersCreate * @summary Add new string parameter. * @request POST:/StringParameters * @secure */ stringParametersCreate: (StringParameter, query, params = {}) => this.request({ path: `/StringParameters`, method: "POST", query: query, body: StringParameter, secure: true, type: ContentType.Json, format: "json", ...params, }), }; this.stringParametersPidPidIdId = { /** * @description You can use the following request to get a string parameter by key. * * @tags String Parameters * @name StringParametersPidIdList * @summary Get string parameter by key. * @request GET:/StringParameters(Pid='{Pid}',Id='{Id}') * @secure */ stringParametersPidIdList: (pid, id, query, params = {}) => this.request({ path: `/StringParameters(Pid='${pid}',Id='${id}')`, method: "GET", query: query, secure: true, format: "json", ...params, }), /** * @description You can use the following request to update string parameter.<br> In API sandbox only read APIs could be tested. You need to configure an API endpoint for your account, where you have the required write permissions to update the partner directory. * * @tags String Parameters * @name StringParametersPidIdUpdate * @summary Update string parameter. * @request PUT:/StringParameters(Pid='{Pid}',Id='{Id}') * @secure */ stringParametersPidIdUpdate: (pid, id, StringParameter, query, params = {}) => this.request({ path: `/StringParameters(Pid='${pid}',Id='${id}')`, method: "PUT", query: query, body: StringParameter, secure: true, type: ContentType.Json, ...params, }), /** * @description You can use the following request to delete string parameter.<br> In API sandbox only read APIs could be tested. You need to configure an API endpoint for your account, where you have the required write permissions to update the partner directory. * * @tags String Parameters * @name StringParametersPidIdDelete * @summary Delete string parameter. * @request DELETE:/StringParameters(Pid='{Pid}',Id='{Id}') * @secure */ stringParametersPidIdDelete: (pid, id, query, params = {}) => this.request({ path: `/StringParameters(Pid='${pid}',Id='${id}')`, method: "DELETE", query: query, secure: true, ...params, }), }; this.userCredentialParameters = { /** * @description You can use the following request to get all user credential parameters. * * @tags User Credential Parameters * @name UserCredentialParametersList * @summary Get all user credential parameters. * @request GET:/UserCredentialParameters * @secure */ userCredentialParametersList: (query, params = {}) => this.request({ path: `/UserCredentialParameters`, method: "GET", query: query, secure: true, format: "json", ...params, }), /** * @description You can use the following request to add/update user credential parameter.<br> In API sandbox only read APIs could be tested. You need to configure an API endpoint for your account, where you have the required write permissions to update the partner directory. * * @tags User Credential Parameters * @name UserCredentialParametersCreate * @summary Add/update user credential parameter. * @request POST:/UserCredentialParameters * @secure */ userCredentialParametersCreate: (UserCredentialParameter, params = {}) => this.request({ path: `/UserCredentialParameters`, method: "POST", body: UserCredentialParameter, secure: true, type: ContentType.Json, format: "json", ...params, }), }; this.userCredentialParametersPidPidIdId = { /** * @description You can use the following request to get user credential parameter by key. * * @tags User Credential Parameters * @name UserCredentialParametersPidIdList * @summary Get user credential parameter by key. * @request GET:/UserCredentialParameters(Pid='{Pid}',Id='{Id}') * @secure */ userCredentialParametersPidIdList: (pid, id, query, params = {}) => this.request({ path: `/UserCredentialParameters(Pid='${pid}',Id='${id}')`, method: "GET", query: query, secure: true, format: "json", ...params, }), /** * @description You can use the following request to delete user credential parameter.<br> In API sandbox only read APIs could be tested. You need to configure an API endpoint for your account, where you have the required write permissions to update the partner directory. * * @tags User Credential Parameters * @name UserCredentialParametersPidIdDelete * @summary Delete user credential parameter. * @request DELETE:/UserCredentialParameters(Pid='{Pid}',Id='{Id}') * @secure */ userCredentialParametersPidIdDelete: (pid, id, params = {}) => this.request({ path: `/UserCredentialParameters(Pid='${pid}',Id='${id}')`, method: "DELETE", secure: true, ...params, }), }; } } exports.Api = Api;