This repository contains an auto-generated ANTS Platform API client for Java based on our API specification. See the ANTS Platform API reference for more details on the available endpoints.
The recommended way to install the ants-platform-java API client is via Maven Central:
<dependency>
<groupId>ai.agenticants</groupId>
<artifactId>ants-platform-java</artifactId>
<version>0.1.1</version>
</dependency>Instantiate the ANTS Platform Client with the respective endpoint and your API Keys.
import com.ants.platform.client.AntsPlatformClient;
AntsPlatformClient client = AntsPlatformClient.builder()
.url("https://api.agenticants.ai")
.credentials("your-public-key", "your-secret-key")
.build();Make requests using the clients:
import com.ants.platform.client.core.AntsPlatformClientApiException;
import com.ants.platform.client.resources.prompts.types.PromptMetaListResponse;
try {
PromptMetaListResponse prompts = client.prompts().list();
} catch (AntsPlatformClientApiException error) {
System.out.println(error.getBody());
System.out.println(error.getStatusCode());
}Run ./mvnw release:prepare -DreleaseVersion= with the version you want to create.
Push the changes including the tag.
This project is configured to publish to Maven Central. To publish to Maven Central, you need to configure the following secrets in your GitHub repository:
OSSRH_USERNAME: Your Sonatype OSSRH usernameOSSRH_PASSWORD: Your Sonatype OSSRH passwordGPG_PRIVATE_KEY: Your GPG private key for signing artifactsGPG_PASSPHRASE: The passphrase for your GPG private key
- Ensure that ants-platform-java is placed in the same directory as the main API specification repository.
- Setup a new Java fern generator using
- name: fernapi/fern-java-sdk version: 2.20.1 output: location: local-file-system path: ../../../../ants-platform-java/src/main/java/com/ants/platform/client/ config: client-class-name: AntsPlatformClient
- Generate the new client code using
npx fern-api generate --api server. - Manually set the
packageacross all files tocom.ants.platform.client. - Overwrite
this.clientOptionsBuilder.addHeader("Authorization", "Bearer " + encodedToken);toBasicin AntsPlatformClientBuilder.java. - Commit the changes in ants-platform-java and push them to the repository.