Skip to content

Commit 558b8fb

Browse files
authored
feat(clients): add Kotlin API client (#1400)
1 parent 66d125b commit 558b8fb

File tree

145 files changed

+4722
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+4722
-6
lines changed

.github/.cache_version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.22
1+
0.0.23

.github/actions/restore-artifacts/action.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ inputs:
2121
go:
2222
description: Whether this job ran or not
2323
required: false
24+
kotlin:
25+
description: Whether this job ran or not
26+
required: false
2427

2528
runs:
2629
using: composite
@@ -87,3 +90,17 @@ runs:
8790
run: |
8891
rm -rf clients/algoliasearch-client-go
8992
unzip -q -o clients-go.zip && rm clients-go.zip
93+
94+
# Kotlin
95+
- name: Download clients-kotlin artifact
96+
if: ${{ inputs.kotlin == 'true' && inputs.type == 'all' }}
97+
uses: actions/download-artifact@v3
98+
with:
99+
name: clients-kotlin
100+
101+
- name: Unzip clients-kotlin artifact
102+
if: ${{ inputs.kotlin == 'true' && inputs.type == 'all' }}
103+
shell: bash
104+
run: |
105+
rm -rf clients/algoliasearch-client-kotlin
106+
unzip -q -o clients-kotlin.zip && rm clients-kotlin.zip

.github/actions/setup/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ outputs:
191191
RUN_GEN_GO:
192192
description: Indicates if we plan to run the job for this language
193193
value: ${{ steps.gen-matrix.outputs.RUN_GEN_GO }}
194+
RUN_GEN_KOTLIN:
195+
description: Indicates if we plan to run the job for this language
196+
value: ${{ steps.gen-matrix.outputs.RUN_GEN_KOTLIN }}
194197

195198
RUN_JS_UTILS:
196199
description: Whether to build JS client common folders when RUN_JS is false

.github/workflows/check.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ jobs:
6868
RUN_GEN_JAVA: ${{ steps.setup.outputs.RUN_GEN_JAVA }}
6969
RUN_GEN_PHP: ${{ steps.setup.outputs.RUN_GEN_PHP }}
7070
RUN_GEN_GO: ${{ steps.setup.outputs.RUN_GEN_GO }}
71+
RUN_GEN_KOTLIN: ${{ steps.setup.outputs.RUN_GEN_KOTLIN }}
7172

7273
RUN_JS_UTILS: ${{ steps.setup.outputs.RUN_JS_UTILS }}
7374

@@ -314,6 +315,7 @@ jobs:
314315
php: ${{ needs.setup.outputs.RUN_GEN_PHP }}
315316
java: ${{ needs.setup.outputs.RUN_GEN_JAVA }}
316317
go: ${{ needs.setup.outputs.RUN_GEN_GO }}
318+
kotlin: ${{ needs.setup.outputs.RUN_GEN_KOTLIN }}
317319

318320
- name: Setup
319321
uses: ./.github/actions/setup

.github/workflows/pr-title.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ jobs:
1616
- name: Pull Request title rules
1717
uses: Slashgear/action-check-pr-title@v4.3.0
1818
with:
19-
regexp: '^(docs|chore)|((?:feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)\((?:clients|generators|javascript|php|java|go|cts|specs|scripts|ci|templates|deps)\)): .+'
19+
regexp: '^(docs|chore)|((?:feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)\((?:clients|generators|javascript|php|java|go|kotlin|cts|specs|scripts|ci|templates|deps)\)): .+'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ dist
3131
generators/bin
3232

3333
**/java/bin/
34+
**/kotlin/bin/
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish Artifacts
2+
3+
on:
4+
push:
5+
branches:
6+
- next
7+
8+
jobs:
9+
publish:
10+
name: Publish to Sonatype
11+
runs-on: macos-11
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
16+
- name: Configure JDK
17+
uses: actions/setup-java@v3
18+
with:
19+
distribution: temurin
20+
java-version: 11
21+
22+
- name: Setup Gradle
23+
uses: gradle/gradle-build-action@v2
24+
25+
- name: Compile
26+
run: ./gradlew assemble
27+
28+
- name: Upload Artifacts
29+
run: ./gradlew publish
30+
env:
31+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
32+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
33+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_PRIVATE_KEY }}
34+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_PRIVATE_KEY_ID }}
35+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PRIVATE_KEY_PASSWORD }}
36+
37+
- name: Check Snapshot
38+
id: snapshot
39+
run: |
40+
if [[ $(cat ./gradle.properties | grep 'VERSION_NAME=.*-SNAPSHOT') ]]; then
41+
echo "IS_SNAPSHOT=true" >> $GITHUB_OUTPUT
42+
fi
43+
44+
- name: Release Artifacts
45+
if: ${{ steps.snapshot.outputs.IS_SNAPSHOT != 'true' }}
46+
run: ./gradlew closeAndReleaseRepository
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Gradle
2+
.gradle
3+
gradlew.bat
4+
build
5+
local.properties
6+
reports
7+
build
8+
9+
# IntelliJ IDEA
10+
.idea
11+
*.iml
12+
*.ipl
13+
*.iws
14+
classes/
15+
idea-classes/
16+
coverage-error.log
17+
18+
# Java
19+
*.hprof
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
api/**
8+
docs/**
9+
src/**
10+
README.md
11+
12+
## Gradle
13+
gradle/**
14+
gradlew.bat
15+
build.gradle.kts
16+
settings.gradle.kts
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<p align="center">
2+
<a href="https://www.algolia.com">
3+
<img alt="Algolia for Kotlin" src="https://raw.githubusercontent.com/algolia/algoliasearch-client-common/master/banners/kotlin.png" >
4+
</a>
5+
6+
<h4 align="center">The perfect starting point to integrate <a href="https://algolia.com" target="_blank">Algolia</a> within your Kotlin project</h4>
7+
8+
<p align="center">
9+
<a href="https://search.maven.org/search?q=a:algoliasearch-client-kotlin"><img src="https://img.shields.io/maven-central/v/com.algolia/algoliasearch-client-kotlin?label=Download" alt="Latest version"></img></a>
10+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="Licence"></img></a>
11+
</p>
12+
</p>
13+
14+
<p align="center">
15+
<a href="https://www.algolia.com/doc/api-client/getting-started/install/kotlin/" target="_blank">Documentation</a> •
16+
<a href="https://discourse.algolia.com" target="_blank">Community Forum</a> •
17+
<a href="http://stackoverflow.com/questions/tagged/algolia" target="_blank">Stack Overflow</a> •
18+
<a href="https://github.com/algolia/algoliasearch-client-kotlin/issues" target="_blank">Report a bug</a> •
19+
<a href="https://www.algolia.com/doc/api-client/troubleshooting/faq/kotlin/" target="_blank">FAQ</a> •
20+
<a href="https://www.algolia.com/support" target="_blank">Support</a>
21+
</p>
22+
23+
## ✨ Features
24+
25+
- The Kotlin client is compatible with Kotlin `1.6` and higher.
26+
- It is compatible with Kotlin project on the JVM, such as backend and Android applications.
27+
- It relies on the open source Kotlin libraries for seamless integration into Kotlin projects:
28+
- [Kotlin multiplatform](https://kotlinlang.org/docs/reference/multiplatform.html).
29+
- [Kotlinx serialization](https://github.com/Kotlin/kotlinx.serialization) for json parsing.
30+
- [Kotlinx coroutines](https://github.com/Kotlin/kotlinx.coroutines) for asynchronous operations.
31+
- [Ktor](https://github.com/ktorio/ktor) HTTP client.
32+
- The Kotlin client integrates the actual Algolia documentation in each source file: Request parameters, response fields, methods and concepts; all are documented and link to the corresponding url of the Algolia doc website.
33+
- The client is thread-safe. You can use `SearchClient`, `AnalyticsClient`, and `InsightsClient` in a multithreaded environment.
34+
35+
## 💡 Getting Started
36+
37+
Install the Kotlin client by adding the following dependency to your `gradle.build` file:
38+
39+
```gradle
40+
repositories {
41+
mavenCentral()
42+
}
43+
44+
dependencies {
45+
implementation "com.algolia:algoliasearch-client-kotlin:$version"
46+
}
47+
```
48+
Also, choose and add to your dependencies one of [Ktor http client engines](https://ktor.io/docs/http-client-engines.html).
49+
Alternatively, you can use [algoliasearch-client-kotlin-bom](/client-bom).
50+
For full documentation, visit the **[Algolia Kotlin API Client](https://www.algolia.com/doc/api-client/getting-started/install/kotlin/)**.
51+
52+
### Guides
53+
54+
- [Getting started](https://github.com/algolia/algoliasearch-client-kotlin/tree/master/docs/GettingStarted.md)
55+
- [DSL](https://github.com/algolia/algoliasearch-client-kotlin/tree/master/docs/DSL.md)
56+
- [Serialization](https://github.com/algolia/algoliasearch-client-kotlin/tree/master/docs/Serialization.md)
57+
- [ExceptionHandling](https://github.com/algolia/algoliasearch-client-kotlin/tree/master/docs/ExceptionHandling.md)
58+
- [Configure the HTTP client](https://github.com/algolia/algoliasearch-client-kotlin/tree/master/docs/HTTPClient.md)
59+
60+
## ❓ Troubleshooting
61+
62+
Encountering an issue? Before reaching out to support, we recommend heading to our [FAQ](https://www.algolia.com/doc/api-client/troubleshooting/faq/kotlin/) where you will find answers for the most common issues and gotchas with the client.
63+
64+
## Use the Dockerfile
65+
66+
If you want to contribute to this project without installing all its dependencies, you can use our Docker image. Please check our [dedicated guide](DOCKER_README.md) to learn more.
67+
68+
## 📄 License
69+
70+
Algolia Kotlin API Client is an open-sourced software licensed under the [MIT license](LICENSE).

0 commit comments

Comments
 (0)