Skip to content

Commit

Permalink
Fix wrong /api-version path and development response field type
Browse files Browse the repository at this point in the history
  • Loading branch information
spoonman01 committed Sep 25, 2024
1 parent 0b9c8a5 commit 1f362b2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 29 deletions.
19 changes: 9 additions & 10 deletions src/main/java/com/wire/helium/API.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,15 @@ public API(Client client, QualifiedId convId, String token) {
this.convId = convId;
this.token = token;

WebTarget target = client
.target(host());

conversationsPath = target.path("conversations");
usersPath = target.path("users");
assetsPath = target.path("assets");
teamsPath = target.path("teams");
connectionsPath = target.path("connections");
selfPath = target.path("self");
notificationsPath = target.path("notifications");
WebTarget versionedTarget = client.target(host()).path(BACKEND_API_VERSION);

conversationsPath = versionedTarget.path("conversations");
usersPath = versionedTarget.path("users");
assetsPath = versionedTarget.path("assets");
teamsPath = versionedTarget.path("teams");
connectionsPath = versionedTarget.path("connections");
selfPath = versionedTarget.path("self");
notificationsPath = versionedTarget.path("notifications");
}

/**
Expand Down
26 changes: 9 additions & 17 deletions src/main/java/com/wire/helium/LoginClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,29 +40,21 @@
public class LoginClient {
private static final String LABEL = "wbots";
private static final String COOKIE_NAME = "zuid";
protected static final String BACKEND_API_VERSION = "v6";
protected final WebTarget apiVersionPath;
protected final WebTarget clientsPath;
private final WebTarget loginPath;
private final WebTarget accessPath;
private final WebTarget cookiesPath;

public LoginClient(Client client) {
String host = host();
apiVersionPath = client
.target(host)
.path("api-version");
loginPath = client
.target(host)
.path("login");
clientsPath = client
.target(host)
.path("clients");
accessPath = client
.target(host)
.path("access");
cookiesPath = client
.target(host)
.path("cookies");
WebTarget baseTarget = client.target(host());
WebTarget versionedTarget = baseTarget.path(BACKEND_API_VERSION);
apiVersionPath = baseTarget.path("api-version");
loginPath = versionedTarget.path("login");
clientsPath = versionedTarget.path("clients");
accessPath = versionedTarget.path("access");
cookiesPath = versionedTarget.path("cookies");
}

public static String bearer(String token) {
Expand All @@ -71,7 +63,7 @@ public static String bearer(String token) {

public String host() {
String host = System.getProperty(Const.WIRE_BOTS_SDK_API, System.getenv("WIRE_API_HOST"));
return host != null ? host : "https://prod-nginz-https.wire.com/v6";
return host != null ? host : "https://prod-nginz-https.wire.com";
}

public Access login(String email, String password) throws HttpException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

@JsonIgnoreProperties(ignoreUnknown = true)
public class BackendConfiguration {
//Api version currently in dev stage and not production ready
//Api versions currently in dev stage and not production ready
@JsonProperty
@NotNull
public Integer development;
public List<Integer> development = new ArrayList<>();

@JsonProperty
@NotNull
Expand Down

0 comments on commit 1f362b2

Please sign in to comment.