Skip to content

Commit c2aefb4

Browse files
committed
fix compile
1 parent 1390c16 commit c2aefb4

File tree

2 files changed

+24
-40
lines changed

2 files changed

+24
-40
lines changed

README.md

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ API documentation is available at <https://docs.ravenapp.dev/introduction>.
1414
Add this dependency to your project's build file:
1515

1616
```groovy
17-
implementation "dev.ravenapp:raven-java:0.0.33"
17+
implementation "dev.ravenapp:raven-java:0.0.50"
1818
```
1919

2020
### Maven users
@@ -25,28 +25,25 @@ Add this dependency to your project's POM:
2525
<dependency>
2626
<groupId>dev.ravenapp</groupId>
2727
<artifactId>raven-java</artifactId>
28-
<version>0.0.33</version>
28+
<version>0.0.50</version>
2929
</dependency>
3030
```
3131

3232
## Usage
3333

3434
```java
35-
RavenApiClient ravenApiClient = new RavenApiClient(Authorization.of("AuthKey <auth>"));
36-
try {
37-
var response = client.send(Send.Request.builder()
38-
.appId("<app_id>")
39-
.body(SendEventRequest.builder()
40-
.event("payment_alert")
41-
.data(Map.of("name", "Adam"))
42-
.user(User.builder().mobile("+1234567890").build())
43-
.build())
44-
.build());
45-
46-
System.out.println(response.getId());
47-
} catch (SendException e) {
48-
System.out.println("Failed to send request" + e.getMessage());
49-
}
35+
36+
RavenApiClient ravenApiClient = RavenApiClient.builder()
37+
.authKey(System.getenv("RAVEN_TOKEN"))
38+
.build();
39+
40+
var response = client.send("appId", SendEventRequest.builder()
41+
.event("payment_alert")
42+
.data(Map.of("name", "Adam"))
43+
.user(User.builder().mobile("+1234567890").build())
44+
.build());
45+
46+
System.out.println(response.getId());
5047
```
5148

5249
## Sample app
Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,19 @@
11
package sample;
22

33
import com.raven.api.RavenApiClient;
4-
import com.raven.api.client.Authorization;
5-
import com.raven.api.client.device.endpoints.Add;
6-
import com.raven.api.client.device.exceptions.AddException;
7-
import com.raven.api.client.device.types.Device;
4+
import com.raven.api.resources.device.types.Device;
85

96
public final class App {
107
public static void main(String[] args) {
11-
String appId = System.getenv("RAVEN_APP_ID");
12-
String authKey = System.getenv("RAVEN_TOKEN");
13-
Authorization auth = Authorization.of(authKey);
8+
RavenApiClient ravenApiClient = RavenApiClient.builder()
9+
.authKey(System.getenv("RAVEN_TOKEN"))
10+
.build();
1411

15-
RavenApiClient ravenApiClient = new RavenApiClient(auth);
16-
17-
try {
18-
Device device = ravenApiClient.device().add(Add.Request.builder()
19-
.appId(appId)
20-
.userId("userid")
21-
.body(Device.builder()
22-
.fcmToken("abc123")
23-
.id("cdf456")
24-
.notificationsDisabled(false)
25-
.build())
26-
.build());
27-
System.out.println("Created a device! The device's Raven ID is " + device.getRavenId());
28-
} catch (AddException e) {
29-
System.out.println("Failed to create a device" + e.getMessage());
30-
}
12+
Device device = ravenApiClient.device().add("app-id","user-id", Device.builder()
13+
.fcmToken("abc123")
14+
.id("cdf456")
15+
.notificationsDisabled(false)
16+
.build());
17+
System.out.println("Created a device! The device's Raven ID is " + device.getRavenId());
3118
}
3219
}

0 commit comments

Comments
 (0)