Skip to content

Commit d24320b

Browse files
committed
Release 0.0.43
1 parent 7f1cde3 commit d24320b

19 files changed

+136
-136
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ publishing {
3636
maven(MavenPublication) {
3737
groupId = 'dev.ravenapp'
3838
artifactId = 'raven-java'
39-
version = '0.0.42'
39+
version = '0.0.43'
4040
from components.java
4141
}
4242
}

src/main/java/com/raven/api/RavenApiClient.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package com.raven.api;
22

3-
import com.raven.api.client.Authorization;
3+
import com.raven.api.client.AuthKey;
44
import com.raven.api.client.ServiceClient;
5-
import com.raven.api.client.device.deviceServiceClient;
6-
import com.raven.api.client.user.userServiceClient;
5+
import com.raven.api.client.device.DeviceServiceClient;
6+
import com.raven.api.client.user.UserServiceClient;
77
import com.raven.api.core.Environment;
88
import java.util.Objects;
99
import java.util.concurrent.atomic.AtomicReference;
@@ -12,29 +12,29 @@
1212
public final class RavenApiClient {
1313
private final Supplier<ServiceClient> serviceClient;
1414

15-
private final Supplier<deviceServiceClient> deviceServiceClient;
15+
private final Supplier<DeviceServiceClient> deviceServiceClient;
1616

17-
private final Supplier<userServiceClient> userServiceClient;
17+
private final Supplier<UserServiceClient> userServiceClient;
1818

19-
public RavenApiClient(Authorization auth) {
19+
public RavenApiClient(AuthKey auth) {
2020
this(Environment.PROD, auth);
2121
}
2222

23-
public RavenApiClient(Environment environment, Authorization auth) {
24-
this.userServiceClient = memoize(() -> new userServiceClient(environment.getUrl(), auth));
23+
public RavenApiClient(Environment environment, AuthKey auth) {
24+
this.userServiceClient = memoize(() -> new UserServiceClient(environment.getUrl(), auth));
2525
this.serviceClient = memoize(() -> new ServiceClient(environment.getUrl(), auth));
26-
this.deviceServiceClient = memoize(() -> new deviceServiceClient(environment.getUrl(), auth));
26+
this.deviceServiceClient = memoize(() -> new DeviceServiceClient(environment.getUrl(), auth));
2727
}
2828

2929
public final ServiceClient service() {
3030
return this.serviceClient.get();
3131
}
3232

33-
public final deviceServiceClient device() {
33+
public final DeviceServiceClient device() {
3434
return this.deviceServiceClient.get();
3535
}
3636

37-
public final userServiceClient user() {
37+
public final UserServiceClient user() {
3838
return this.userServiceClient.get();
3939
}
4040

src/main/java/com/raven/api/client/Authorization.java renamed to src/main/java/com/raven/api/client/AuthKey.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
import java.lang.Override;
77
import java.lang.String;
88

9-
public final class Authorization {
9+
public final class AuthKey {
1010
private final String value;
1111

12-
private Authorization(String value) {
12+
private AuthKey(String value) {
1313
this.value = value;
1414
}
1515

@@ -20,7 +20,7 @@ public String get() {
2020

2121
@Override
2222
public boolean equals(Object other) {
23-
return this == other || (other instanceof Authorization && this.value.equals(((Authorization) other).value));
23+
return this == other || (other instanceof AuthKey && this.value.equals(((AuthKey) other).value));
2424
}
2525

2626
@Override
@@ -36,11 +36,11 @@ public String toString() {
3636
@JsonCreator(
3737
mode = JsonCreator.Mode.DELEGATING
3838
)
39-
public static Authorization of(String value) {
40-
return new Authorization(value);
39+
public static AuthKey of(String value) {
40+
return new AuthKey(value);
4141
}
4242

43-
public static Authorization valueOf(String value) {
43+
public static AuthKey valueOf(String value) {
4444
return of(value);
4545
}
4646
}

src/main/java/com/raven/api/client/Service.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
interface Service {
2828
@POST
2929
@Path("/{app_id}/events/send")
30-
SendEventResponse send(@HeaderParam("Authorization") Authorization auth,
30+
SendEventResponse send(@HeaderParam("Authorization") AuthKey auth,
3131
@HeaderParam("Idempotency-Key") Optional<String> idempotencyKey,
3232
@PathParam("app_id") String appId, SendEventRequest body) throws SendException;
3333

3434
@POST
3535
@Path("/{app_id}/events/bulk_send")
36-
SendEventResponse sendBulk(@HeaderParam("Authorization") Authorization auth,
36+
SendEventResponse sendBulk(@HeaderParam("Authorization") AuthKey auth,
3737
@HeaderParam("Idempotency-Key") Optional<String> idempotencyKey,
3838
@PathParam("app_id") String appId, BulkSendEventRequest body) throws SendBulkException;
3939

src/main/java/com/raven/api/client/ServiceClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
public final class ServiceClient {
1313
private final Service service;
1414

15-
private final Optional<Authorization> auth;
15+
private final Optional<AuthKey> auth;
1616

1717
public ServiceClient(String url) {
1818
this.service = Service.getClient(url);
1919
this.auth = Optional.empty();
2020
}
2121

22-
public ServiceClient(String url, Authorization auth) {
22+
public ServiceClient(String url, AuthKey auth) {
2323
this.service = Service.getClient(url);
2424
this.auth = Optional.of(auth);
2525
}
@@ -31,12 +31,12 @@ public ServiceClient(String url, Authorization auth) {
3131
* @return SendEventResponse
3232
*/
3333
public SendEventResponse send(Send.Request request) throws SendException {
34-
Authorization authValue = request.getAuthOverride().orElseGet(() -> this.auth.orElseThrow(() -> new RuntimeException("Auth is required")));
34+
AuthKey authValue = request.getAuthOverride().orElseGet(() -> this.auth.orElseThrow(() -> new RuntimeException("Auth is required")));
3535
return this.service.send(authValue, request.getIdempotencyKey(), request.getAppId(), request.getBody());
3636
}
3737

3838
public SendEventResponse sendBulk(SendBulk.Request request) throws SendBulkException {
39-
Authorization authValue = request.getAuthOverride().orElseGet(() -> this.auth.orElseThrow(() -> new RuntimeException("Auth is required")));
39+
AuthKey authValue = request.getAuthOverride().orElseGet(() -> this.auth.orElseThrow(() -> new RuntimeException("Auth is required")));
4040
return this.service.sendBulk(authValue, request.getIdempotencyKey(), request.getAppId(), request.getBody());
4141
}
4242
}

src/main/java/com/raven/api/client/device/deviceService.java renamed to src/main/java/com/raven/api/client/device/DeviceService.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.raven.api.client.device;
22

33
import com.fern.java.jersey.contracts.OptionalAwareContract;
4-
import com.raven.api.client.Authorization;
4+
import com.raven.api.client.AuthKey;
55
import com.raven.api.client.device.exceptions.AddException;
66
import com.raven.api.client.device.exceptions.DeleteException;
77
import com.raven.api.client.device.exceptions.GetDeviceException;
@@ -27,35 +27,35 @@
2727
@Consumes(MediaType.APPLICATION_JSON)
2828
@Produces(MediaType.APPLICATION_JSON)
2929
@Path("/v1/apps")
30-
interface deviceService {
30+
interface DeviceService {
3131
@POST
3232
@Path("/{app_id}/users/{user_id}/devices")
33-
Device add(@HeaderParam("Authorization") Authorization auth, @PathParam("app_id") String appId,
33+
Device add(@HeaderParam("Authorization") AuthKey auth, @PathParam("app_id") String appId,
3434
@PathParam("user_id") String userId, Device body) throws AddException;
3535

3636
@PUT
3737
@Path("/{app_id}/users/{user_id}/devices/{device_id}")
38-
Device update(@HeaderParam("Authorization") Authorization auth, @PathParam("app_id") String appId,
38+
Device update(@HeaderParam("Authorization") AuthKey auth, @PathParam("app_id") String appId,
3939
@PathParam("user_id") String userId, @PathParam("device_id") String deviceId, Device body)
4040
throws UpdateException;
4141

4242
@DELETE
4343
@Path("/{app_id}/users/{user_id}/devices/{device_id}")
44-
void delete(@HeaderParam("Authorization") Authorization auth, @PathParam("app_id") String appId,
44+
void delete(@HeaderParam("Authorization") AuthKey auth, @PathParam("app_id") String appId,
4545
@PathParam("user_id") String userId, @PathParam("device_id") String deviceId) throws
4646
DeleteException;
4747

4848
@GET
4949
@Path("/{app_id}/users/{user_id}/devices/{device_id}")
50-
Device getDevice(@HeaderParam("Authorization") Authorization auth,
51-
@PathParam("app_id") String appId, @PathParam("user_id") String userId,
52-
@PathParam("device_id") String deviceId) throws GetDeviceException;
50+
Device getDevice(@HeaderParam("Authorization") AuthKey auth, @PathParam("app_id") String appId,
51+
@PathParam("user_id") String userId, @PathParam("device_id") String deviceId) throws
52+
GetDeviceException;
5353

54-
static deviceService getClient(String url) {
54+
static DeviceService getClient(String url) {
5555
return Feign.builder()
5656
.contract(new OptionalAwareContract(new JAXRSContract()))
5757
.decoder(new JacksonDecoder(ObjectMappers.JSON_MAPPER))
5858
.encoder(new JacksonEncoder(ObjectMappers.JSON_MAPPER))
59-
.errorDecoder(new deviceServiceErrorDecoder()).target(deviceService.class, url);
59+
.errorDecoder(new DeviceServiceErrorDecoder()).target(DeviceService.class, url);
6060
}
6161
}

src/main/java/com/raven/api/client/device/deviceServiceClient.java renamed to src/main/java/com/raven/api/client/device/DeviceServiceClient.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.raven.api.client.device;
22

3-
import com.raven.api.client.Authorization;
3+
import com.raven.api.client.AuthKey;
44
import com.raven.api.client.device.endpoints.Add;
55
import com.raven.api.client.device.endpoints.Delete;
66
import com.raven.api.client.device.endpoints.GetDevice;
@@ -14,18 +14,18 @@
1414
import java.lang.String;
1515
import java.util.Optional;
1616

17-
public final class deviceServiceClient {
18-
private final deviceService service;
17+
public final class DeviceServiceClient {
18+
private final DeviceService service;
1919

20-
private final Optional<Authorization> auth;
20+
private final Optional<AuthKey> auth;
2121

22-
public deviceServiceClient(String url) {
23-
this.service = deviceService.getClient(url);
22+
public DeviceServiceClient(String url) {
23+
this.service = DeviceService.getClient(url);
2424
this.auth = Optional.empty();
2525
}
2626

27-
public deviceServiceClient(String url, Authorization auth) {
28-
this.service = deviceService.getClient(url);
27+
public DeviceServiceClient(String url, AuthKey auth) {
28+
this.service = DeviceService.getClient(url);
2929
this.auth = Optional.of(auth);
3030
}
3131

@@ -38,7 +38,7 @@ public deviceServiceClient(String url, Authorization auth) {
3838
* @return <p>the updated Device</p>
3939
*/
4040
public Device add(Add.Request request) throws AddException {
41-
Authorization authValue = request.getAuthOverride().orElseGet(() -> this.auth.orElseThrow(() -> new RuntimeException("Auth is required")));
41+
AuthKey authValue = request.getAuthOverride().orElseGet(() -> this.auth.orElseThrow(() -> new RuntimeException("Auth is required")));
4242
return this.service.add(authValue, request.getAppId(), request.getUserId(), request.getBody());
4343
}
4444

@@ -49,7 +49,7 @@ public Device add(Add.Request request) throws AddException {
4949
* @return <p>the updated Device</p>
5050
*/
5151
public Device update(Update.Request request) throws UpdateException {
52-
Authorization authValue = request.getAuthOverride().orElseGet(() -> this.auth.orElseThrow(() -> new RuntimeException("Auth is required")));
52+
AuthKey authValue = request.getAuthOverride().orElseGet(() -> this.auth.orElseThrow(() -> new RuntimeException("Auth is required")));
5353
return this.service.update(authValue, request.getAppId(), request.getUserId(), request.getDeviceId(), request.getBody());
5454
}
5555

@@ -59,7 +59,7 @@ public Device update(Update.Request request) throws UpdateException {
5959
* @throws DeleteException Exception that wraps all possible endpoint errors
6060
*/
6161
public void delete(Delete.Request request) throws DeleteException {
62-
Authorization authValue = request.getAuthOverride().orElseGet(() -> this.auth.orElseThrow(() -> new RuntimeException("Auth is required")));
62+
AuthKey authValue = request.getAuthOverride().orElseGet(() -> this.auth.orElseThrow(() -> new RuntimeException("Auth is required")));
6363
this.service.delete(authValue, request.getAppId(), request.getUserId(), request.getDeviceId());
6464
}
6565

@@ -70,7 +70,7 @@ public void delete(Delete.Request request) throws DeleteException {
7070
* @return Device
7171
*/
7272
public Device getDevice(GetDevice.Request request) throws GetDeviceException {
73-
Authorization authValue = request.getAuthOverride().orElseGet(() -> this.auth.orElseThrow(() -> new RuntimeException("Auth is required")));
73+
AuthKey authValue = request.getAuthOverride().orElseGet(() -> this.auth.orElseThrow(() -> new RuntimeException("Auth is required")));
7474
return this.service.getDevice(authValue, request.getAppId(), request.getUserId(), request.getDeviceId());
7575
}
7676
}

src/main/java/com/raven/api/client/device/deviceServiceErrorDecoder.java renamed to src/main/java/com/raven/api/client/device/DeviceServiceErrorDecoder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import java.lang.RuntimeException;
1515
import java.lang.String;
1616

17-
final class deviceServiceErrorDecoder implements ErrorDecoder {
17+
final class DeviceServiceErrorDecoder implements ErrorDecoder {
1818
@Override
1919
public Exception decode(String methodKey, Response response) {
2020
try {

src/main/java/com/raven/api/client/device/endpoints/Add.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.raven.api.client.device.endpoints;
22

3-
import com.raven.api.client.Authorization;
3+
import com.raven.api.client.AuthKey;
44
import com.raven.api.client.device.types.Device;
55
import java.lang.Object;
66
import java.lang.Override;
@@ -19,11 +19,11 @@ public static final class Request {
1919

2020
private final Device body;
2121

22-
private final Optional<Authorization> authOverride;
22+
private final Optional<AuthKey> authOverride;
2323

2424
private int _cachedHashCode;
2525

26-
Request(String appId, String userId, Device body, Optional<Authorization> authOverride) {
26+
Request(String appId, String userId, Device body, Optional<AuthKey> authOverride) {
2727
this.appId = appId;
2828
this.userId = userId;
2929
this.body = body;
@@ -48,7 +48,7 @@ public Device getBody() {
4848
return body;
4949
}
5050

51-
public Optional<Authorization> getAuthOverride() {
51+
public Optional<AuthKey> getAuthOverride() {
5252
return authOverride;
5353
}
5454

@@ -96,9 +96,9 @@ public interface BodyStage {
9696
public interface _FinalStage {
9797
Request build();
9898

99-
_FinalStage authOverride(Optional<Authorization> authOverride);
99+
_FinalStage authOverride(Optional<AuthKey> authOverride);
100100

101-
_FinalStage authOverride(Authorization authOverride);
101+
_FinalStage authOverride(AuthKey authOverride);
102102
}
103103

104104
public static final class Builder implements AppIdStage, UserIdStage, BodyStage, _FinalStage {
@@ -108,7 +108,7 @@ public static final class Builder implements AppIdStage, UserIdStage, BodyStage,
108108

109109
private Device body;
110110

111-
private Optional<Authorization> authOverride = Optional.empty();
111+
private Optional<AuthKey> authOverride = Optional.empty();
112112

113113
private Builder() {
114114
}
@@ -149,13 +149,13 @@ public _FinalStage body(Device body) {
149149
}
150150

151151
@Override
152-
public _FinalStage authOverride(Authorization authOverride) {
152+
public _FinalStage authOverride(AuthKey authOverride) {
153153
this.authOverride = Optional.of(authOverride);
154154
return this;
155155
}
156156

157157
@Override
158-
public _FinalStage authOverride(Optional<Authorization> authOverride) {
158+
public _FinalStage authOverride(Optional<AuthKey> authOverride) {
159159
this.authOverride = authOverride;
160160
return this;
161161
}

0 commit comments

Comments
 (0)