Skip to content

Commit 206621c

Browse files
authored
feat: java client APIC-160 (#29)
1 parent fba3068 commit 206621c

File tree

95 files changed

+26153
-16
lines changed

Some content is hidden

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

95 files changed

+26153
-16
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ yarn-error.log
1414
**/dist
1515

1616
.vscode
17+
target
18+
19+
**/.DS_Store
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
*.class
2+
3+
# Mobile Tools for Java (J2ME)
4+
.mtj.tmp/
5+
6+
# Package Files #
7+
*.jar
8+
*.war
9+
*.ear
10+
11+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
12+
hs_err_pid*
13+
14+
# build files
15+
**/target
16+
target
17+
.gradle
18+
build
19+
20+
.openapi-generator
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
gradle/**
10+
src/**
11+
12+
.travis.yml
13+
build.gradle
14+
build.sbt
15+
git_push.sh
16+
gradle*
17+
settings.gradle
18+
19+
# Selective source file
20+
algoliasearch-core/com/algolia/auth/**
21+
algoliasearch-core/com/algolia/Configuration.java
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# algoliasearch-client-java-2
2+
3+
Search API
4+
- API version: 0.1.0
5+
6+
API powering the Search feature of Algolia.
7+
8+
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
9+
10+
## Requirements
11+
12+
Building the API client library requires:
13+
1. Java 1.8+
14+
2. Maven/Gradle
15+
16+
## Installation
17+
18+
To install the API client library to your local Maven repository, simply execute:
19+
20+
```shell
21+
mvn clean install
22+
```
23+
24+
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
25+
26+
```shell
27+
mvn clean deploy
28+
```
29+
30+
Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
31+
32+
### Maven users
33+
34+
Add this dependency to your project's POM:
35+
36+
```xml
37+
<dependency>
38+
<groupId>com.algolia</groupId>
39+
<artifactId>algoliasearch-client-java-2</artifactId>
40+
<version>0.1.0</version>
41+
<scope>compile</scope>
42+
</dependency>
43+
```
44+
45+
### Gradle users
46+
47+
Add this dependency to your project's build file:
48+
49+
```groovy
50+
compile "com.algolia:algoliasearch-client-java-2:0.1.0"
51+
```
52+
53+
### Others
54+
55+
At first generate the JAR by executing:
56+
57+
```shell
58+
mvn clean package
59+
```
60+
61+
Then manually install the following JARs:
62+
63+
* `target/algoliasearch-client-java-2-0.1.0.jar`
64+
* `target/lib/*.jar`
65+
66+
## Getting Started
67+
68+
Checkout the playground.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package com.algolia;
2+
3+
import java.util.List;
4+
import java.util.Map;
5+
6+
/**
7+
* Callback for asynchronous API call.
8+
*
9+
* @param <T> The return type
10+
*/
11+
public interface ApiCallback<T> {
12+
/**
13+
* This is called when the API call fails.
14+
*
15+
* @param e The exception causing the failure
16+
* @param statusCode Status code of the response if available, otherwise it would be 0
17+
* @param responseHeaders Headers of the response if available, otherwise it would be null
18+
*/
19+
void onFailure(
20+
ApiException e,
21+
int statusCode,
22+
Map<String, List<String>> responseHeaders
23+
);
24+
25+
/**
26+
* This is called when the API call succeeded.
27+
*
28+
* @param result The result deserialized from response
29+
* @param statusCode Status code of the response
30+
* @param responseHeaders Headers of the response
31+
*/
32+
void onSuccess(
33+
T result,
34+
int statusCode,
35+
Map<String, List<String>> responseHeaders
36+
);
37+
38+
/**
39+
* This is called when the API upload processing.
40+
*
41+
* @param bytesWritten bytes Written
42+
* @param contentLength content length of request body
43+
* @param done write end
44+
*/
45+
void onUploadProgress(long bytesWritten, long contentLength, boolean done);
46+
47+
/**
48+
* This is called when the API download processing.
49+
*
50+
* @param bytesRead bytes Read
51+
* @param contentLength content length of the response
52+
* @param done Read end
53+
*/
54+
void onDownloadProgress(long bytesRead, long contentLength, boolean done);
55+
}

0 commit comments

Comments
 (0)