const codeGenerationExternalApisController = new CodeGenerationExternalApisController(client);
CodeGenerationExternalApisController
- Generate SDK Via File
- Generate SDK Via URL
- Download SDK
- List All Code Generations
- Download Input File
- Get a Code Generation
- Delete Code Generation 1
Generate an SDK for an API by by uploading the API specification file.
This endpoint generates and then uploads the generated SDK to APIMatic's cloud storage. An ID for the generation performed is returned as part of the response.
This endpoint does not import an API into APIMatic.
async generateSDKViaFile(
file: FileWrapper,
template: Platforms,
requestOptions?: RequestOptions
): Promise<ApiResponse<UserCodeGeneration>>
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. |
template |
Platforms |
Form, Required | The structure contains platforms that APIMatic CodeGen can generate SDKs and Docs in. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const contentType = null;
const file = new FileWrapper(fs.createReadStream('dummy_file'));
const template = 'PHP_GENERIC_LIB';
try {
const { result, ...httpResponse } = await codeGenerationExternalApisController.generateSDKViaFile(file, template);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Generate an SDK for an API by providing the URL of the API specification file.
This endpoint generates and then uploads the generated SDK to APIMatic's cloud storage. An ID for the generation performed is returned as part of the response.
This endpoint does not import an API into APIMatic.
async generateSDKViaURL(
body: GenerateSdkViaUrlRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<UserCodeGeneration>>
Parameter | Type | Tags | Description |
---|---|---|---|
body |
GenerateSdkViaUrlRequest |
Body, Required | Request Body |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const contentType = null;
const body: GenerateSdkViaUrlRequest = {
url: 'http://petstore.swagger.io/v2/swagger.json',
template: 'CS_NET_STANDARD_LIB',
};
try {
const { result, ...httpResponse } = await codeGenerationExternalApisController.generateSDKViaURL(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 SDK generated via the Generate SDK endpoints.
async downloadSDK(
codegenId: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<NodeJS.ReadableStream | Blob>>
Parameter | Type | Tags | Description |
---|---|---|---|
codegenId |
string |
Template, Required | The ID of code generation received in the response of the Generate SDK Via File or Generate SDK Via URL calls. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
NodeJS.ReadableStream | Blob
const codegenId = 'codegen_id6';
try {
const { result, ...httpResponse } = await codeGenerationExternalApisController.downloadSDK(codegenId);
// 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 SDK generations performed with external APIs via the Generate SDK endpoints.
async listAllCodeGenerations(
requestOptions?: RequestOptions
): Promise<ApiResponse<UserCodeGeneration[]>>
Parameter | Type | Tags | Description |
---|---|---|---|
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
try {
const { result, ...httpResponse } = await codeGenerationExternalApisController.listAllCodeGenerations();
// 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 specific SDK generation performed via the Generate SDK endpoints.
async downloadInputFile(
codegenId: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<NodeJS.ReadableStream | Blob>>
Parameter | Type | Tags | Description |
---|---|---|---|
codegenId |
string |
Template, Required | The ID of the code generation to download the API specification for. The code generation ID is received in the response of the Generate SDK Via File or Generate SDK Via URL calls |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
NodeJS.ReadableStream | Blob
const codegenId = 'codegen_id6';
try {
const { result, ...httpResponse } = await codeGenerationExternalApisController.downloadInputFile(codegenId);
// 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 an SDK generation performed for an external API via the Generate SDK endpoints.
async getACodeGeneration(
codegenId: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<UserCodeGeneration>>
Parameter | Type | Tags | Description |
---|---|---|---|
codegenId |
string |
Template, Required | The ID of the code generation to fetch. The code generation ID is received in the response of the Generate SDK Via File or Generate SDK Via URL calls. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const codegenId = 'codegen_id6';
try {
const { result, ...httpResponse } = await codeGenerationExternalApisController.getACodeGeneration(codegenId);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Delete an SDK generation performed for an API via the Generate SDK endpoints.
async deleteCodeGeneration1(
codegenId: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<void>>
Parameter | Type | Tags | Description |
---|---|---|---|
codegenId |
string |
Template, Required | The ID of the code generation to delete. The code generation ID is received in the response of the Generate SDK Via File or Generate SDK Via URL calls. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
void
const codegenId = 'codegen_id6';
try {
const { result, ...httpResponse } = await codeGenerationExternalApisController.deleteCodeGeneration1(codegenId);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}