|
2 | 2 |
|
3 | 3 | A Coveo Push API Client in Java |
4 | 4 |
|
5 | | -## Work in progress |
| 5 | +## Installation |
6 | 6 |
|
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 |
0 commit comments