Skip to content

Commit c6259f8

Browse files
docs: updates the readme: LENS-979 (#96)
* updates the README * Apply suggestions from code review Co-authored-by: Benjamin Taillon <[email protected]> * updates formatting * Update README.md * Update README.md --------- Co-authored-by: Benjamin Taillon <[email protected]>
1 parent d68d86c commit c6259f8

File tree

1 file changed

+83
-63
lines changed

1 file changed

+83
-63
lines changed

README.md

Lines changed: 83 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,67 @@
11
# Push API Client
22

3-
A Coveo Push API Client in Java
3+
A [Coveo Push API](https://docs.coveo.com/en/12/api-reference/push-api) client library for Java.
4+
5+
## Prerequisites
6+
7+
The Coveo `push-api-client.java` package is stored on GitHub packages.
8+
You will need a personal access token (classic) with at least `read:packages` scope to install this dependency.
9+
10+
For details, see [Authenticating to GitHub Packages](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry#authenticating-to-github-packages)
411

512
## Installation
613

7-
### Step 1: Prerequisites
8-
The Coveo `push-api-client.java` package is stored on Github packages. You will need a personal access token (classic) with at least `read:packages` scope to install this dependency.
14+
### Step 1: Update `settings.xml`
915

10-
More info, visit [Authenticating to GitHub Packages](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry#authenticating-to-github-packages)
16+
You can install this GitHub Package with [Apache Maven](https://maven.apache.org/) by editing the `~/.m2/settings.xml` file:
1117

12-
### Step 2: Update `settings.xml`
13-
You can install this GitHub Package with Apache Maven by editing your `~/.m2/settings.xml`:
18+
1. Add a repository definition to the GitHub Package.
1419

15-
#### The repository to the package
16-
Add a definition to the Github Package
20+
```xml
21+
<repository>
22+
<id>github</id>
23+
<url>https://maven.pkg.github.com/coveo/push-api-client.java</url>
24+
<snapshots>
25+
<enabled>true</enabled>
26+
</snapshots>
27+
</repository>
28+
```
1729

18-
```xml
19-
<repository>
20-
<id>github</id>
21-
<url>https://maven.pkg.github.com/coveo/push-api-client.java</url>
22-
<snapshots>
23-
<enabled>true</enabled>
24-
</snapshots>
25-
</repository>
26-
```
30+
1. Add your GitHub personal access token to install packages from GitHub Packages.
31+
32+
```xml
33+
<servers>
34+
<server>
35+
<id>github</id>
36+
<username>USERNAME</username>
37+
<password>TOKEN</password>
38+
</server>
39+
</servers>
40+
```
2741

28-
#### Your GitHub personal access token
29-
Your personal access token required to install packages from Github Packages
42+
### Step 2: Add a Coveo dependency to project
43+
44+
Add a Coveo dependency to your Maven project by editing the `pom.xml` file.
3045

3146
```xml
32-
<servers>
33-
<server>
34-
<id>github</id>
35-
<username>USERNAME</username>
36-
<password>TOKEN</password>
37-
</server>
38-
</servers>
47+
<dependency>
48+
<groupId>com.coveo</groupId>
49+
<artifactId>push-api-client.java</artifactId>
50+
<version>2.3.0</version>
51+
</dependency>
3952
```
4053

41-
### Step 3: Add Coveo dependency to project
42-
Using Maven:
43-
54+
### Step 3: Install the project files
4455

45-
Add Coveo dependency to your maven project. Instructions on how to do that available in this [URL](https://github.com/coveo/push-api-client.java/packages/1884180).
56+
To install the updated project files, build the Maven project.
4657

47-
### Step 4: Install
48-
Run via command line
4958
```bash
5059
mvn install
5160
```
5261

5362
## Usage
5463

55-
See more examples in the `./samples` folder.
64+
> See more examples in the `./samples` folder.
5665
5766
```java
5867
import com.coveo.pushapiclient.DocumentBuilder;
@@ -82,45 +91,56 @@ public class PushOneDocument {
8291
```
8392

8493
## Logging
85-
When pushing multiple documents into your source using a service (e.g. `PushService`, `StreamService`), make sure to configure a **logger** to be able to see what happens.
86-
to do so .. in your `resources` folder.
8794

88-
### Log4j2 XML Configuration Example
89-
To log execution output into the console, use the below `log4j2.xml` configuration:
90-
```xml
91-
<!-- log4j2.xml -->
92-
<?xml version="1.0" encoding="UTF-8"?>
93-
<Configuration>
94-
<Appenders>
95-
<Console name="ConsoleAppender" target="SYSTEM_OUT">
96-
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
97-
</Console>
98-
</Appenders>
99-
<Loggers>
100-
<Root level="debug">
101-
<AppenderRef ref="ConsoleAppender" />
102-
</Root>
103-
</Loggers>
104-
</Configuration>
105-
```
95+
If you want to push multiple documents to your Coveo organization and use a service for that (e.g. `PushService`, `StreamService`), you may find it useful to configure a **logger** to catch error and warning messages.
96+
97+
1. Go to your project's root folder.
10698

107-
See [Log4j2 configuration](https://logging.apache.org/log4j/2.x/manual/configuration.html) for more details.
99+
1. Update the Apache Log4j2 configuration by editing the `log4j2.xml` file.
100+
The following example will print the log execution to the console.
108101

109-
## Local Setup to Contribute
102+
```xml
103+
<?xml version="1.0" encoding="UTF-8"?>
104+
<Configuration>
105+
<Appenders>
106+
<Console name="ConsoleAppender" target="SYSTEM_OUT">
107+
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
108+
</Console>
109+
</Appenders>
110+
<Loggers>
111+
<Root level="debug">
112+
<AppenderRef ref="ConsoleAppender" />
113+
</Root>
114+
</Loggers>
115+
</Configuration>
116+
```
110117

111-
### Formatting
118+
For more details, see [Log4j2 configuration](https://logging.apache.org/log4j/2.x/manual/configuration.html).
119+
120+
## Formatting the code before contributing
112121

113122
This project uses [Google Java Format](https://github.com/google/google-java-format), so make sure your code is properly formatted before opening a pull request.
123+
124+
To enforce code style and formatting rules, run the Maven Spotless plugin:
125+
114126
```bash
115127
mvn spotless:apply
116128
```
117129

118130
## Release
119131

120-
* Tag the commit following semver.
121-
* Bump version in pom.xml
122-
* mvn -P release clean deploy
123-
* cd into ./target
124-
* 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
125-
* Log into https://oss.sonatype.org/
126-
* Upload newly created bundle.jar
132+
1. Tag the commit according to the [semantic versioning](https://semver.org/).
133+
134+
1. Bump version in `pom.xml`.
135+
136+
1. Run the following commands:
137+
138+
1. `mvn -P release clean deploy`.
139+
140+
1. `cd ./target`.
141+
142+
1. `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`
143+
144+
1. Log in to https://oss.sonatype.org/.
145+
146+
1. Upload the newly created `bundle.jar` file.

0 commit comments

Comments
 (0)