const transformationController = new TransformationController(client);
TransformationController
- Transform Via File
- Transform Via URL
- Download Transformed File
- Download Input File
- List All Transformations
- Get a Transformation
- Delete Transformation
Transform an API into any of the supported API specification formats by uploading the API specification file.
This endpoint transforms and then uploads the transformed API specification to APIMatic's cloud storage. An ID for the transformation performed is returned as part of the response.
async transformViaFile(
file: FileWrapper,
exportFormat: ExportFormats,
requestOptions?: RequestOptions
): Promise<ApiResponse<Transformation>>
Parameter | Type | Tags | Description |
---|---|---|---|
file |
FileWrapper |
Form, Required | The API specification file. The type of the specification file should be any of the supported formats. |
exportFormat |
ExportFormats |
Form, Required | The structure contains API specification formats that Transformer can convert to. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const contentType = null;
const file = new FileWrapper(fs.createReadStream('dummy_file'));
const exportFormat = 'WSDL';
try {
const { result, ...httpResponse } = await transformationController.transformViaFile(file, exportFormat);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Transform an API into any of the supported API specification formats by providing the URL of the API specification file.
This endpoint transforms and then uploads the transformed API specification to APIMatic's cloud storage. An ID for the transformation performed is returned as part of the response.
async transformViaURL(
body: TransformViaUrlRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<Transformation>>
Parameter | Type | Tags | Description |
---|---|---|---|
body |
TransformViaUrlRequest |
Body, Required | Request Body |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const contentType = null;
const body: TransformViaUrlRequest = {
url: 'https://petstore.swagger.io/v2/swagger.json',
exportFormat: 'APIMATIC',
};
try {
const { result, ...httpResponse } = await transformationController.transformViaURL(body);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Download the transformed API specification file transformed via the Transformation endpoints.
async downloadTransformedFile(
transformationId: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<NodeJS.ReadableStream | Blob>>
Parameter | Type | Tags | Description |
---|---|---|---|
transformationId |
string |
Template, Required | The ID of transformation received in the response of the Transform Via File or Transform Via URL calls. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
NodeJS.ReadableStream | Blob
const transformationId = 'transformation_id6';
try {
const { result, ...httpResponse } = await transformationController.downloadTransformedFile(transformationId);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Download the API Specification file used as input for a particular Transformation performed via the Transformation endpoints.
async downloadInputFile(
transformationId: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<NodeJS.ReadableStream | Blob>>
Parameter | Type | Tags | Description |
---|---|---|---|
transformationId |
string |
Template, Required | The ID of the transformation to download the API specification for. The transformation ID is received in the response of the Transform Via File or Transform Via URL calls. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
NodeJS.ReadableStream | Blob
const transformationId = 'transformation_id6';
try {
const { result, ...httpResponse } = await transformationController.downloadInputFile(transformationId);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Get a list of all API transformations performed.
async listAllTransformations(
requestOptions?: RequestOptions
): Promise<ApiResponse<Transformation[]>>
Parameter | Type | Tags | Description |
---|---|---|---|
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
try {
const { result, ...httpResponse } = await transformationController.listAllTransformations();
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Get details on a particular Transformation performed via the Transformation endpoints.
async getATransformation(
transformationId: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<Transformation>>
Parameter | Type | Tags | Description |
---|---|---|---|
transformationId |
string |
Template, Required | The ID of the transformation to fetch. The transformation ID is received in the response of the Transform Via File or Transform Via URL calls. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const transformationId = 'transformation_id6';
try {
const { result, ...httpResponse } = await transformationController.getATransformation(transformationId);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Delete a particular Transformation performed for an API via the Transformation endpoints.
async deleteTransformation(
transformationId: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<void>>
Parameter | Type | Tags | Description |
---|---|---|---|
transformationId |
string |
Template, Required | The ID of the transformation to delete. The transformation ID is received in the response of the Transform Via File or Transform Via URL calls. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
void
const transformationId = 'transformation_id6';
try {
const { result, ...httpResponse } = await transformationController.deleteTransformation(transformationId);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}