Java SDK
The com.sangho:sangho-java SDK supports
Java 11+ with a synchronous interface. Compatible with Spring Boot,
Micronaut, and any standard Java project.
Installation
Add the dependency via Maven or Gradle. The SDK has no mandatory transitive dependencies beyond the standard JVM.
Initialization
Instantiate the Sangho class with your API key. All methods
follow the builder pattern for constructing parameters — ensuring
strict compile-time typing.
Declare the Sangho client as a Spring bean by reading the
key from @Value(“${sangho.secret-key}”). Inject it into
your services via @Autowired or constructor — a single
shared instance is sufficient, as the client is thread-safe.
Installation
Initialization & first call
Error handling
All exceptions inherit from com.sangho.exception.SanghoException. Catch specific
subclasses to handle each business case.
Pagination
List endpoints return a SanghoCollection<T> object with methods getData(), getCount(), and hasMore().
The SDK automatically retries 429 and 5xx errors. Configure via SanghoOptions.builder().setMaxNetworkRetries(3) passed to
the constructor.