Octri

Languages

Java

The Java SDK publishes to Maven Central.

Install

xml
<dependency>
  <groupId>com.your-org</groupId>
  <artifactId>api-client</artifactId>
  <version>1.0.0</version>
</dependency>

Options

OptionValuesDefault
Client stylefunctions, namespaced, class, class-namespacedfunctions
Argument styleobject, positionalobject
Namespacetags, pathtags
Doc commentsfull, minimalfull
File headeromit, includeomit
Usage examplefull, concisefull
No HTTP engine choice for Java

Kotlin offers okhttp or ktor; Java does not expose the choice.

class suits Java better than functions

functions maps awkwardly onto a language with no free functions. Set Client style to class or class-namespaced for Java specifically, and leave other languages on the project default.

Package name

Maven coordinates are groupId:artifactId, and the groupId must be a domain you control:

text
com.acme:api-client
Maven Central verifies the groupId

Central requires proof you own the domain behind the groupId, and releases are signed. That's more setup than npm, and it's worth starting before the day you want to ship.

Central releases are immutable

A published version can never be changed or removed. See Publishing.

What callers write

java
import com.acme.AcmeClient;
import com.acme.models.User;

AcmeClient client = AcmeClient.builder()
    .token(System.getenv("ACME_TOKEN"))
    .build();

for (User user : client.users().list(100)) {
    System.out.println(user.getId());
}