A Java SDK for easily accessing the Outseta API.
The Code is thoroughly tested to ensure reliable execution of the API endpoints. The architecture, endpoints and models are thoroughly unit tested. Furthermore, integration tests are added for the endpoints to ensure that the API endpoints are working as expected.
This library is a Java SDK for easily accessing the Outseta API. It uses Jackson to parse the requests and responses and Apache's HttpClient to make the requests. The models in this library provide a convenient mapping to the Json of the APIs. The library is built using Java 8 and is compatible with Android.
You can also refer to the unit tests in order to see how to use the library.
- Java 8 or higher
Install the library using Maven or Gradle. The library is available on Maven Central.
<dependency>
<groupId>io.github.hamadhassan3</groupId>
<artifactId>outseta-client</artifactId>
<version>3.0.0</version>
</dependency>
implementation group: 'io.github.hamadhassan3', name: 'outseta-client', version: '3.0.0'
CRM
Billing
- AddOnClient
- DiscountClient
- InvoiceClient
- PlanClient
- PlanFamilyClient
- SubscriptionClient
- UpdatePaymentInfoClient
The library provides two ways to authenticate with the Outseta API. The first way is to use the AuthenticationClient to get an auth token and then use that token to make requests to the other APIs. This provides access to user specific APIs like profile endpoints. The second way is to use the API key directly in the other API clients. This provides access to most APIs. Please note that either the API key or the Access Key needs to be specified when creating a Client object. Otherwise, client creation fails. PeopleClient can only be created using an Access Key and AuthenticationClient can be built without any keys.
AuthenticationClient client = AuthenticationClient.builder(outsetaUrl)
.apiKey(outsetaKey)
.defaultParser()
.defaultRequestMaker()
.build();
GetAuthTokenRequest request = GetAuthTokenRequest.builder()
.username(username)
.password(password)
.build();
AuthToken token = client.getAuthToken(request);
PeopleClient client = PeopleClient.builder(outsetaUrl)
.apiKey(outsetaKey)
.defaultParser()
.defaultRequestMaker()
.build();
PageRequest request = PageRequest.builder()
.page(page)
.pageSize(pageSize)
.build();
int total = 0;
ItemPage<Person> personPage = null;
do {
// Keep making requests as long as there are more pages
personPage = peopleClient.getPersonPage(request);
total = personPage.getMetadata().getTotal();
// The current page's items are aggregated
allPeople.addAll(personPage.getItems());
request = request.nextPageRequest();
}
while (allPeople.size() < total);
In addition to the regular pagination request, you can pass custom arguments for filtering, sort, etc. For example, to filter the people by email, you can pass the following custom arguments:
Map<String, Object> customParams = new HashMap<>();
customParams.put("Email", "asd@dummy.com");
PageRequest request = PageRequest.builder()
.page(page)
.pageSize(pageSize)
.customParams(customParams)
.build();
In addition to the regular Pagination request, the following customized requests are available for common use cases:
Please refer to the javadoc for each client to see the available methods.
The code is thoroughly documented. You can access the javadoc to understand the code and its usage. You can view the javadoc inside the docs folder in root directory.
The builder pattern is used to create the request and response models. This makes it easy to create the models and also makes the code more readable. This allows the user to create the models in a single line of code without worrying over case sensitivity, spellings, etc. The builder pattern is also used to create the API clients.
The code uses Checkstyle to ensure proper formatting of the code. Furthermore, the Sun coding conventions are used in the checkstyle script. This is the recommended coding convention for Java.
This project is licensed under the MIT License - see the LICENSE for details
The Outseta API: https://documenter.getpostman.com/view/3613332/outseta-rest-api-v1/7TNfr6k