-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(add-api-v1) Add new resources handling qualified id requests fro…
…m the backend * Refactor resources and models in specific packages * Add /api-version endpoint return version 0 and 1 * Add DeviceManagementService, shared service between resources, also abstracting database access from api layer * Basic integration tests for the new api layer
- Loading branch information
1 parent
7f59827
commit bae2b46
Showing
38 changed files
with
851 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/com/wire/bots/hold/DAO/AccessResultSetMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/main/java/com/wire/bots/hold/model/api/shared/ApiVersionResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.wire.bots.hold.model.api.shared; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import java.util.List; | ||
|
||
public class ApiVersionResponse { | ||
@JsonProperty(access = JsonProperty.Access.READ_ONLY) | ||
private final List<Integer> supported; | ||
|
||
public ApiVersionResponse(List<Integer> supported) { | ||
this.supported = supported; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...om/wire/bots/hold/model/InitResponse.java → ...s/hold/model/api/shared/InitResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/java/com/wire/bots/hold/model/api/v1/ConfirmPayloadV1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.wire.bots.hold.model.api.v1; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.wire.xenon.backend.models.QualifiedId; | ||
|
||
import javax.validation.constraints.NotNull; | ||
import java.util.UUID; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class ConfirmPayloadV1 { | ||
@JsonProperty("refresh_token") | ||
@NotNull | ||
public String refreshToken; | ||
|
||
@JsonProperty("client_id") | ||
@NotNull | ||
public String clientId; | ||
|
||
@JsonProperty("qualified_user_id") | ||
@NotNull | ||
public QualifiedId userId; | ||
|
||
@JsonProperty("team_id") | ||
@NotNull | ||
public UUID teamId; | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/wire/bots/hold/model/api/v1/InitPayloadV1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.wire.bots.hold.model.api.v1; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.wire.xenon.backend.models.QualifiedId; | ||
|
||
import javax.validation.constraints.NotNull; | ||
import java.util.UUID; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class InitPayloadV1 { | ||
@JsonProperty("qualified_user_id") | ||
@NotNull | ||
public QualifiedId userId; | ||
|
||
@JsonProperty("team_id") | ||
@NotNull | ||
public UUID teamId; | ||
} |
2 changes: 1 addition & 1 deletion
2
.../java/com/wire/bots/hold/model/Event.java → .../wire/bots/hold/model/database/Event.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.wire.bots.hold.model; | ||
package com.wire.bots.hold.model.database; | ||
|
||
import java.util.UUID; | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...va/com/wire/bots/hold/model/LHAccess.java → ...re/bots/hold/model/database/LHAccess.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.wire.bots.hold.model; | ||
package com.wire.bots.hold.model.database; | ||
|
||
import java.util.UUID; | ||
|
||
|
29 changes: 29 additions & 0 deletions
29
src/main/java/com/wire/bots/hold/model/dto/InitializedDeviceDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.wire.bots.hold.model.dto; | ||
|
||
import com.wire.xenon.models.otr.PreKey; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class InitializedDeviceDTO { | ||
private final ArrayList<PreKey> preKeys; | ||
private final PreKey lastPreKey; | ||
private final String fingerprint; | ||
|
||
public InitializedDeviceDTO(ArrayList<PreKey> preKeys, PreKey lastPreKey, String fingerprint) { | ||
this.preKeys = preKeys; | ||
this.lastPreKey = lastPreKey; | ||
this.fingerprint = fingerprint; | ||
} | ||
|
||
public ArrayList<PreKey> getPreKeys() { | ||
return preKeys; | ||
} | ||
|
||
public PreKey getLastPreKey() { | ||
return lastPreKey; | ||
} | ||
|
||
public String getFingerprint() { | ||
return fingerprint; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/main/java/com/wire/bots/hold/monitoring/ApiVersionResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// | ||
// Wire | ||
// Copyright (C) 2016 Wire Swiss GmbH | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see http://www.gnu.org/licenses/. | ||
// | ||
|
||
package com.wire.bots.hold.monitoring; | ||
|
||
import com.wire.bots.hold.model.api.shared.ApiVersionResponse; | ||
import io.swagger.annotations.Api; | ||
import io.swagger.annotations.ApiOperation; | ||
|
||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
import javax.ws.rs.core.Response; | ||
import java.util.List; | ||
|
||
@Api | ||
@Path("/api-version") | ||
@Produces(MediaType.APPLICATION_JSON) | ||
public class ApiVersionResource { | ||
@GET | ||
@ApiOperation(value = "Api version") | ||
public Response apiVersion() { | ||
ApiVersionResponse response = new ApiVersionResponse(List.of(0,1)); | ||
|
||
return Response | ||
.ok(response) | ||
.build(); | ||
} | ||
} |
Oops, something went wrong.