Note
Most of the code in this repository is automatically generated from the OpenAPI specification of the Stream API. Therefore, it does NOT make sense to try to change them manually.
Tests are written manually and more tests are always welcome.
Some parts like lib/src/main/java/io/getstream/services/framework and lib/src/main/java/io/getstream/models/framework, serve as the base and are written manually as well.
To contribute to this project, you need to have Lombok installed in your IDE. You also need to use javac >= 11 to compile (ensure that your JAVA_HOME points to such a location), even if the produced library is compatible with Java 8 (for some reasons, jdk 8 compiler fails on some Lombok annotations).
- Setup the project
- Architecture explanation
- Code rules
- How to
- Commit message convention
- Releasing a new version (for Stream developers)
The project is a Maven project.
Copy local.properties.example to local.properties and put configuration there. These properties are automatically picked up during tests execution
# Run tests
./gradlew test
# Check code style
./gradlew spotlessCheck
# Fix code style problems
./gradlew spotlessApplyThe code is composed of:
They are the data objects. They correspond to the formats of the objects contained in the API responses.
They are builders for API requests, and also contain methods to perform the calls.
They are data objects. They correspond to the formats of the API requests.
They are data objects. They correspond to the formats of the API responses.
They are the interfaces that define the API endpoints.
This class is responsible to make the Service interfaces usable to call the API. It is used by all Request classes to define the generateCall method.
It also handles authentication and logging.
StreamResponse is the interface that correspond to an API response. Most APIs responses are StreamResponseObject (mean they contain duration and rate limit data).
StreamRequest is the generic Request class, that defines the request and requestAsync methods, which call the StreamServiceHandler.
The StreamServiceHandler class defines the synchronous and asynchronous processing. It also enriched the Response object with rate limit data when available.
They are organized by model. Each endpoint has at least one test related.
- The code should be formatted using Google formatter.
- All attributes, parameters and return values should be annotated with either
@Nullableor@NotNull - New implementations should follow the same principles as the existing ones (see how to section below)
- In Models, collections of submodel should be List (other collections and arrays are not supported by RequestObjectBuilder)
- String that only can take a given set of values should be represented as enums, with an
UNKNOWNvalue marked@JsonEnumDefaultValueto avoid problem if the list of possible values changes
Logging is enabled by default in tests. If you want to create a main class and activate logging, you should do the following:
StreamServiceGenerator.logLevel = HttpLoggingInterceptor.Level.BODY;This repository follows a commit message convention in order to automatically generate the CHANGELOG. Make sure you follow the rules of conventional commits when opening a pull request.
In order to release new version you need to be a maintainer of the library.
- Kick off a job called
initiate_release(link).
The job creates a pull request with the changelog. Check if it looks good.
- Merge the pull request.
Once the PR is merged, it automatically kicks off another job which will upload the Gem to RubyGems.org and creates a GitHub release.
Push a tag (e.g. 1.0.0-beta.1), then go to GitHub Releases → Draft a new release, select the tag, check "Set as a pre-release", and publish. The CI job will trigger automatically and publish to MavenCentral.