@contiva/sap-integration-suite-client
Version:
SAP Cloud Platform Integration API Client
687 lines (686 loc) • 30.5 kB
JavaScript
;
/* 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 B2B Scenarios
* @version 1.0.0
* @baseUrl https://{Account Short Name}-tmn.{SSL Host}.{Landscapehost}/api/v1
* @externalDocs https://help.sap.com/docs/cloud-integration/sap-cloud-integration/api-details
*
* The B2B Scenarios OData API is used to access data related to inter-enterprise business integration scenarios.
* With this API, you can securely query business documents, thereby supporting efficient data exchange and business process collaboration between enterprises.
*/
class Api extends HttpClient {
constructor() {
super(...arguments);
this.orphanedInterchanges = {
/**
* @description Retrieve a list of all orphaned interchanges available in the system. This endpoint supports filtering, ordering, and selecting specific properties.
*
* @tags Orphaned Interchanges
* @name OrphanedInterchangesList
* @summary Get all orphaned interchanges.
* @request GET:/OrphanedInterchanges
* @secure
*/
orphanedInterchangesList: (query, params = {}) => this.request({
path: `/OrphanedInterchanges`,
method: "GET",
query: query,
secure: true,
format: "json",
...params,
}),
/**
* @description You can use the following request to get number of all unassigned interchange documents.
*
* @tags Orphaned Interchanges
* @name CountList
* @summary Get number of all unassigned interchange documents.
* @request GET:/OrphanedInterchanges/$count
* @secure
*/
countList: (params = {}) => this.request({
path: `/OrphanedInterchanges/$count`,
method: "GET",
secure: true,
...params,
}),
};
this.orphanedInterchangesId = {
/**
* @description You can use the following request to get unassigned interchange document by Guid.
*
* @tags Orphaned Interchanges
* @name OrphanedInterchangesList
* @summary Get unassigned interchange document by Guid.
* @request GET:/OrphanedInterchanges('{Id}')
* @secure
*/
orphanedInterchangesList: (id, query, params = {}) => this.request({
path: `/OrphanedInterchanges('${id}')`,
method: "GET",
query: query,
secure: true,
format: "json",
...params,
}),
/**
* @description You can use the following request to get unassigned interchange document's error detail by Guid.
*
* @tags Orphaned Interchanges
* @name ErrorDetailsList
* @summary Get unassigned interchange document's error detail by Guid.
* @request GET:/OrphanedInterchanges('{Id}')/ErrorDetails
* @secure
*/
errorDetailsList: (id, params = {}) => this.request({
path: `/OrphanedInterchanges('${id}')/ErrorDetails`,
method: "GET",
secure: true,
format: "json",
...params,
}),
/**
* @description You can use the following request to get unassigned interchange document's processing event by Guid.
*
* @tags Orphaned Interchanges
* @name BusinessDocumentProcessingEventList
* @summary Get unassigned interchange document's processing event by Guid.
* @request GET:/OrphanedInterchanges('{Id}')/BusinessDocumentProcessingEvent
* @secure
*/
businessDocumentProcessingEventList: (id, query, params = {}) => this.request({
path: `/OrphanedInterchanges('${id}')/BusinessDocumentProcessingEvent`,
method: "GET",
query: query,
secure: true,
format: "json",
...params,
}),
/**
* @description You can use the following request to get unassigned interchange document's payload by Guid.
*
* @tags Orphaned Interchanges
* @name BusinessDocumentPayloadsList
* @summary Get unassigned interchange document's payload by Guid.
* @request GET:/OrphanedInterchanges('{Id}')/BusinessDocumentPayloads
* @secure
*/
businessDocumentPayloadsList: (id, query, params = {}) => this.request({
path: `/OrphanedInterchanges('${id}')/BusinessDocumentPayloads`,
method: "GET",
query: query,
secure: true,
format: "json",
...params,
}),
/**
* @description You can use the following request to get unassigned interchange document's protocol headers by Guid.
*
* @tags Orphaned Interchanges
* @name BusinessDocumentProtocolHeadersList
* @summary Get unassigned interchange document's protocol headers by Guid.
* @request GET:/OrphanedInterchanges('{Id}')/BusinessDocumentProtocolHeaders
* @secure
*/
businessDocumentProtocolHeadersList: (id, query, params = {}) => this.request({
path: `/OrphanedInterchanges('${id}')/BusinessDocumentProtocolHeaders`,
method: "GET",
query: query,
secure: true,
format: "json",
...params,
}),
};
this.businessDocuments = {
/**
* @description Retrieve a list of all inter-enterprise business documents available in the system. This endpoint supports filtering, ordering, and selecting specific properties.
*
* @tags Business Documents
* @name BusinessDocumentsList
* @summary Get all interchange documents.
* @request GET:/BusinessDocuments
* @secure
*/
businessDocumentsList: (query, params = {}) => this.request({
path: `/BusinessDocuments`,
method: "GET",
query: query,
secure: true,
format: "json",
...params,
}),
/**
* @description You can use the following request to get number of all interchange documents.
*
* @tags Business Documents
* @name CountList
* @summary Get number of all interchange documents.
* @request GET:/BusinessDocuments/$count
* @secure
*/
countList: (params = {}) => this.request({
path: `/BusinessDocuments/$count`,
method: "GET",
secure: true,
...params,
}),
};
this.businessDocumentsId = {
/**
* @description You can use the following request to get interchange document by message Guid.
*
* @tags Business Documents
* @name BusinessDocumentsList
* @summary Get interchange document by message Guid.
* @request GET:/BusinessDocuments('{Id}')
* @secure
*/
businessDocumentsList: (id, query, params = {}) => this.request({
path: `/BusinessDocuments('${id}')`,
method: "GET",
query: query,
secure: true,
format: "json",
...params,
}),
/**
* @description You can use the following request to get interchange document's sender technical acknowledgement by Guid.
*
* @tags Sender Technical Acknowledgement
* @name SenderTechnicalAcknowledgementList
* @summary Get interchange document's sender technical acknowledgement by Guid.
* @request GET:/BusinessDocuments('{Id}')/SenderTechnicalAcknowledgement
* @secure
*/
senderTechnicalAcknowledgementList: (id, query, params = {}) => this.request({
path: `/BusinessDocuments('${id}')/SenderTechnicalAcknowledgement`,
method: "GET",
query: query,
secure: true,
format: "json",
...params,
}),
/**
* @description You can use the following request to get interchange document's sender functional acknowledgement by Guid.
*
* @tags Sender Functional Acknowledgement
* @name SenderFunctionalAcknowledgementList
* @summary Get interchange document's sender functional acknowledgement by Guid.
* @request GET:/BusinessDocuments('{Id}')/SenderFunctionalAcknowledgement
* @secure
*/
senderFunctionalAcknowledgementList: (id, query, params = {}) => this.request({
path: `/BusinessDocuments('${id}')/SenderFunctionalAcknowledgement`,
method: "GET",
query: query,
secure: true,
format: "json",
...params,
}),
/**
* @description You can use the following request to get interchange document's receiver technical acknowledgement by Guid.
*
* @tags Receiver Technical Acknowledgement
* @name ReceiverTechnicalAcknowledgementList
* @summary Get interchange document's receiver technical acknowledgement by Guid.
* @request GET:/BusinessDocuments('{Id}')/ReceiverTechnicalAcknowledgement
* @secure
*/
receiverTechnicalAcknowledgementList: (id, query, params = {}) => this.request({
path: `/BusinessDocuments('${id}')/ReceiverTechnicalAcknowledgement`,
method: "GET",
query: query,
secure: true,
format: "json",
...params,
}),
/**
* @description You can use the following request to get interchange document's receiver functional acknowledgement by Guid.
*
* @tags Receiver Functional Acknowledgement
* @name ReceiverFunctionalAcknowledgementList
* @summary Get interchange document's receiver functional acknowledgement by Guid.
* @request GET:/BusinessDocuments('{Id}')/ReceiverFunctionalAcknowledgement
* @secure
*/
receiverFunctionalAcknowledgementList: (id, query, params = {}) => this.request({
path: `/BusinessDocuments('${id}')/ReceiverFunctionalAcknowledgement`,
method: "GET",
query: query,
secure: true,
format: "json",
...params,
}),
/**
* @description You can use the following request to get interchange document's processing event by Guid.
*
* @tags Business Document Processing Event
* @name BusinessDocumentProcessingEventsList
* @summary Get interchange document's processing event by Guid.
* @request GET:/BusinessDocuments('{Id}')/BusinessDocumentProcessingEvents
* @secure
*/
businessDocumentProcessingEventsList: (id, query, params = {}) => this.request({
path: `/BusinessDocuments('${id}')/BusinessDocumentProcessingEvents`,
method: "GET",
query: query,
secure: true,
format: "json",
...params,
}),
/**
* @description You can use the following request to get interchange document's payloads by Guid.
*
* @tags Business Document Payloads
* @name BusinessDocumentPayloadsList
* @summary Get interchange document's Payloads by Guid.
* @request GET:/BusinessDocuments('{Id}')/BusinessDocumentPayloads
* @secure
*/
businessDocumentPayloadsList: (id, params = {}) => this.request({
path: `/BusinessDocuments('${id}')/BusinessDocumentPayloads`,
method: "GET",
secure: true,
format: "json",
...params,
}),
/**
* @description You can use the following request to get interchange document's notes by Guid.
*
* @tags Business Document Notes
* @name BusinessDocumentNotesList
* @summary Get interchange document's notes by Guid.
* @request GET:/BusinessDocuments('{Id}')/BusinessDocumentNotes
* @secure
*/
businessDocumentNotesList: (id, params = {}) => this.request({
path: `/BusinessDocuments('${id}')/BusinessDocumentNotes`,
method: "GET",
secure: true,
format: "json",
...params,
}),
/**
* @description You can use the following request to get interchange document's custom search attributes by Guid.</b> The B2B Scenarios tab under the Monitor section allows you to monitor the interchanges that are created during a B2B transaction.</b> The interchanges are displayed in a list with a list of filters using which helps you find a specific interchange easily. </b> These search filters are provided in a standard format.</b> There could be scenarios where you need to search for an interchange using a filter that is not provided in general.</b> In such cases, the Configuration Manager allows you to create and use custom search attributes.
*
* @tags Custom Search Attributes
* @name CustomObjectsList
* @summary Get interchange document's custom search attributes by Guid.
* @request GET:/BusinessDocuments('{Id}')/CustomObjects
* @secure
*/
customObjectsList: (id, query, params = {}) => this.request({
path: `/BusinessDocuments('${id}')/CustomObjects`,
method: "GET",
query: query,
secure: true,
format: "json",
...params,
}),
/**
* @description You can use the following request to get interchange document's extension fields by Guid.
*
* @tags Business Document Extended Fields
* @name BusinessDocumentExtFieldsList
* @summary Get interchange document's extension fields by Guid.
* @request GET:/BusinessDocuments('{Id}')/BusinessDocumentExtFields
* @secure
*/
businessDocumentExtFieldsList: (id, params = {}) => this.request({
path: `/BusinessDocuments('${id}')/BusinessDocumentExtFields`,
method: "GET",
secure: true,
format: "json",
...params,
}),
/**
* @description You can use the following request to get interchange document's error detail by Guid.
*
* @tags Error Details
* @name LastErrorDetailsList
* @summary Get interchange document's error detail by Guid.
* @request GET:/BusinessDocuments('{Id}')/LastErrorDetails
* @secure
*/
lastErrorDetailsList: (id, params = {}) => this.request({
path: `/BusinessDocuments('${id}')/LastErrorDetails`,
method: "GET",
secure: true,
format: "json",
...params,
}),
/**
* @description You can use the following request to get interchange document's protocol headers by Guid.
*
* @tags Business Document Protocol Headers
* @name BusinessDocumentProtocolHeadersList
* @summary Get interchange document's protocol headers by Guid.
* @request GET:/BusinessDocuments('{Id}')/BusinessDocumentProtocolHeaders
* @secure
*/
businessDocumentProtocolHeadersList: (id, query, params = {}) => this.request({
path: `/BusinessDocuments('${id}')/BusinessDocumentProtocolHeaders`,
method: "GET",
query: query,
secure: true,
format: "json",
...params,
}),
};
this.businessDocumentPayloadsId = {
/**
* @description You can use the following request to get payload value by Guid.
*
* @tags Business Document Payloads
* @name ValueList
* @summary Get interchange document's payload by Guid.
* @request GET:/BusinessDocumentPayloads('{Id}')/$value
* @secure
*/
valueList: (id, params = {}) => this.request({
path: `/BusinessDocumentPayloads('${id}')/$value`,
method: "GET",
secure: true,
format: "json",
...params,
}),
};
this.technicalAcknowledgementsId = {
/**
* @description You can use the following request to get technical acknowledgement by Guid.
*
* @tags Technical Acknowledgement
* @name TechnicalAcknowledgementsList
* @summary Get technical acknowledgement by Guid.
* @request GET:/TechnicalAcknowledgements('{Id}')
* @secure
*/
technicalAcknowledgementsList: (id, params = {}) => this.request({
path: `/TechnicalAcknowledgements('${id}')`,
method: "GET",
secure: true,
format: "json",
...params,
}),
/**
* @description You can use the following request to get technical acknowledgement by Guid.
*
* @tags Technical Acknowledgement
* @name ValueList
* @summary Get technical acknowledgement by Guid.
* @request GET:/TechnicalAcknowledgements('{Id}')/$value
* @secure
*/
valueList: (id, params = {}) => this.request({
path: `/TechnicalAcknowledgements('${id}')/$value`,
method: "GET",
secure: true,
format: "json",
...params,
}),
};
this.functionalAcknowledgementsId = {
/**
* @description You can use the following request to get technical acknowledgement by Guid.
*
* @tags Functional Acknowledgement
* @name FunctionalAcknowledgementsList
* @summary Get technical acknowledgement by Guid.
* @request GET:/FunctionalAcknowledgements('{Id}')
* @secure
*/
functionalAcknowledgementsList: (id, params = {}) => this.request({
path: `/FunctionalAcknowledgements('${id}')`,
method: "GET",
secure: true,
format: "json",
...params,
}),
/**
* @description You can use the following request to get functional acknowledgement value by Guid.
*
* @tags Functional Acknowledgement
* @name ValueList
* @summary Get functional acknowledgement value by Guid.
* @request GET:/FunctionalAcknowledgements('{Id}')/$value
* @secure
*/
valueList: (id, params = {}) => this.request({
path: `/FunctionalAcknowledgements('${id}')/$value`,
method: "GET",
secure: true,
format: "json",
...params,
}),
};
this.activateB2BArchivingConfiguration = {
/**
* @description This API is only present in the <b>Cloud Foundry environment.</b> You can use the following request to acitvate the archiving functionality in your tenant.
*
* @tags Data Archiving
* @name ActivateB2BArchivingConfigurationCreate
* @summary Enable archiving
* @request POST:/activateB2BArchivingConfiguration
* @secure
*/
activateB2BArchivingConfigurationCreate: (params = {}) => this.request({
path: `/activateB2BArchivingConfiguration`,
method: "POST",
secure: true,
format: "json",
...params,
}),
};
this.b2BArchivingConfigurationsTenantName = {
/**
* @description This API is only present in the <b>Cloud Foundry environment.</b> You can use the following request to acitvate the archiving functionality in your tenant.
*
* @tags Data Archiving
* @name B2BArchivingConfigurationsList
* @summary Get archiving configuration for a tenant
* @request GET:/B2BArchivingConfigurations('{TenantName}')
* @secure
*/
b2BArchivingConfigurationsList: (tenantName, params = {}) => this.request({
path: `/B2BArchivingConfigurations('${tenantName}')`,
method: "GET",
secure: true,
format: "json",
...params,
}),
};
this.b2BArchivingKeyPerformanceIndicators = {
/**
* @description This API is only present in the <b>Cloud Foundry environment.</b> You can use the following request to get the Key Performance Indicators (KPIs) of the archiving runs.
*
* @tags Data Archiving
* @name B2BArchivingKeyPerformanceIndicatorsList
* @summary Get Key Performance Indicators of the archiving run
* @request GET:/B2BArchivingKeyPerformanceIndicators
* @secure
*/
b2BArchivingKeyPerformanceIndicatorsList: (query, params = {}) => this.request({
path: `/B2BArchivingKeyPerformanceIndicators`,
method: "GET",
query: query,
secure: true,
format: "json",
...params,
}),
};
}
}
exports.Api = Api;