Generate APIs
Creating APIs to your use case using our AI based service API Builder, through user description using both SDKs and APIs. It returns you the swagger documentation.
Usage 🚀
Refer to Setup Guide for installing dependecies for both Java and Python.
JAVA
There are 2 clients available with the Java SDK: SyncClient and AsyncClient
Java Client Code
# for async client
import org.qyrus.ai_sdk.Clients.AsyncClient;
AsyncClient client = new AsyncClient(<API_TOKEN>, null);
# for sync client
import org.qyrus.ai_sdk.Clients.SyncClient;
SyncClient client = new SyncClient(<API_TOKEN>, null);Using SyncClient
Here's an example of utilizing API Builder via use case description to build apis with SyncClient.
Java SyncClient Code
private static void testAPIBuilder() {
Dotenv dotenv = Dotenv.load();
String QYRUS_AI_SDK_API_TOKEN = dotenv.get("QYRUS_AI_SDK_API_TOKEN");
SyncClient client = new SyncClient(QYRUS_AI_SDK_API_TOKEN, null);
String userInputDescription = "hello world get api"; // Your input to the function.
long startTime = System.currentTimeMillis();
int numberOfRequests = 2;
for (int i = 0; i < numberOfRequests; i++) {
try {
// Assuming there is an api_builder field in SyncClient and a create method that matches the described input
APIBuilder.APIBuilderResponse response = client.api_builder.build(userInputDescription);
// Assuming the APIBuilderResponse class has a getSwaggerJson method to retrieve the swagger json
String swaggerJson = response.getSwaggerJson();
System.out.println("Generated Swagger JSON: " + swaggerJson);
} catch (Exception e) {
e.printStackTrace();
}
}
long endTime = System.currentTimeMillis();
System.out.println("Synchronous Total time for API Builder request: " + (endTime - startTime) + " ms");
}
Using AsyncClient
Here's an example of utilizing API Builder via use case description to build apis with AsyncClient.
PYTHON
There are two clients available with the Python SDK: SyncQyrusAI and AsyncQyrusAI.
Using SyncQyrusAI
Here's an example of utilizing API Builder via use case description to build apis with SyncQyrusAI.
Using AsyncQyrusAI
Here's an example of utilizing API Builder via use case description to build apis with AsyncQyrusAI.
Rest APIs
Endpoint: POST {{GATEWAY_URL}}/api-builder-sdk/v1/api/build
Headers:
Authorization: [Your Authorization Token]
Custom: [Your Custom Header Value]
Request Body: { "email": "", "user_description": "Create APIs for TODO application" }
Response:
Last updated