Skip to content

Commit 5bab9be

Browse files
committed
finish README
1 parent c6cb826 commit 5bab9be

File tree

2 files changed

+53
-4
lines changed

2 files changed

+53
-4
lines changed

README.md

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,55 @@
22

33
A Coveo Push API Client in Java
44

5-
## Work in progress
5+
## Installation
66

7-
Stay tuned !
7+
Using Maven:
8+
9+
```
10+
<dependency>
11+
<groupId>com.coveo</groupId>
12+
<artifactId>push-api-client.java</artifactId>
13+
<version>1.0.0</version>
14+
</dependency>
15+
```
16+
17+
## Usage
18+
19+
See more examples in the `./samples` folder.
20+
21+
```java
22+
import com.coveo.pushapiclient.DocumentBuilder;
23+
import com.coveo.pushapiclient.Source;
24+
25+
import java.io.IOException;
26+
import java.net.http.HttpResponse;
27+
28+
public class PushOneDocument {
29+
public static void main(String[] args) {
30+
Source source = new Source("my_api_key", "my_org_id");
31+
DocumentBuilder documentBuilder = new DocumentBuilder("https://my.document.uri", "My document title")
32+
.withData("these words will be searchable");
33+
34+
try {
35+
HttpResponse<String> response = source.addOrUpdateDocument("my_source_id", documentBuilder);
36+
System.out.println(String.format("Source creation status: %s", response.statusCode()));
37+
System.out.println(String.format("Source creation response: %s", response.body()));
38+
} catch (IOException e) {
39+
e.printStackTrace();
40+
} catch (InterruptedException e) {
41+
e.printStackTrace();
42+
}
43+
}
44+
}
45+
46+
```
47+
48+
## Release
49+
50+
* Tag the commit following semver.
51+
* Bump version in pom.xml
52+
* mvn -P release clean deploy
53+
* cd into ./target
54+
* jar -cvf bundle.jar push-api-client.java-1.0.0-javadoc.jar push-api-client.java-1.0.0-javadoc.jar.asc push-api-client.java-1.0.0-sources.jar push-api-client.java-1.0.0-sources.jar.asc push-api-client.java-1.0.0.jar push-api-client.java-1.0.0.jar.asc push-api-client.java-1.0.0.pom push-api-client.java-1.0.0.pom.asc
55+
* Log into https://oss.sonatype.org/
56+
* Upload newly created bundle.jar

samples/PushOneDocument.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ public static void main(String[] args) {
1212

1313
try {
1414
HttpResponse<String> response = source.addOrUpdateDocument("my_source_id", documentBuilder);
15-
System.out.println(String.format("Source creation status: %s", response.statusCode()));
16-
System.out.println(String.format("Source creation response: %s", response.body()));
15+
System.out.println(String.format("Push document status: %s", response.statusCode()));
16+
System.out.println(String.format("Push document response: %s", response.body()));
1717
} catch (IOException e) {
1818
e.printStackTrace();
1919
} catch (InterruptedException e) {

0 commit comments

Comments
 (0)