Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
JPPortier committed Aug 30, 2024
2 parents d81b3cb + 5db2ca1 commit fdc30a0
Show file tree
Hide file tree
Showing 50 changed files with 140 additions and 149 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ public interface ContactService {
/**
* Updates a contact as specified by the contact ID.
*
* @param contact Contact information to be updated. {@link Contact#getId() #Id} have to set and
* will be used to identify Contact to be updated
* @param contactId Contact ID to be updated
* @param contact Contact information to be updated
* @return Updated contact information
* @since _NEXT_VERSION_
*/
Contact update(Contact contact);
Contact update(String contactId, Contact contact);

/**
* Merge two Contacts.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ public void delete(String contactId) {
getApi().contactDeleteContact(uriUUID, contactId);
}

public Contact update(Contact client) {
public Contact update(String contactId, Contact client) {

return getApi().contactUpdateContact(uriUUID, client.getId(), client, null);
return getApi().contactUpdateContact(uriUUID, contactId, client, null);
}

public Contact mergeContact(String destinationId, String sourceId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public ConversationsListResponse list(ConversationsListRequest parameters) {
ListConversationsResponseInternal response =
getApi()
.conversationListConversations(
uriUUID, onlyActive, appId, contactId, pageSize, pageToken, activeChannel);
uriUUID, appId, contactId, onlyActive, pageSize, pageToken, activeChannel);

return mapForPaging(parameters, response);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ void update() throws ApiException {
eq(null)))
.thenReturn(ContactDtoTest.expectedContactResponseDto);

Contact response = service.update(ContactDtoTest.expectedContactResponseDto);
Contact response =
service.update(
ContactDtoTest.expectedContactResponseDto.getId(),
ContactDtoTest.expectedContactResponseDto);

Assertions.assertThat(response)
.usingRecursiveComparison()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,36 +112,35 @@ void list() throws ApiException {

when(api.conversationListConversations(
eq(uriPartID),
eq(true),
eq("conversation app Id"),
eq("contact id"),
eq(null),
eq(1),
eq(null),
eq(ConversationChannel.MESSENGER)))
.thenReturn(conversationsListPage0);

when(api.conversationListConversations(
eq(uriPartID),
eq(true),
eq("conversation app Id"),
eq("contact id"),
eq(null),
eq(1),
eq("ChowMUo1NUVOVERUSFlGQVlKMFE1WFpaSktSVhIaMDFITkIzMzY0UFdCQkcyR1paV1ZWVDNERDI="),
eq(ConversationChannel.MESSENGER)))
.thenReturn(conversationsListPage1);

when(api.conversationListConversations(
eq(uriPartID),
eq(true),
eq("conversation app Id"),
eq("contact id"),
eq(null),
eq(1),
eq("ChowMUo1NUVBSk1FNDZQMlI4SFIxRjVZRjYxWhIaMDFITkIzMzY0UFdCQkcyR1paV1ZWVDNERDI="),
eq(ConversationChannel.MESSENGER)))
.thenReturn(conversationsListPage2);
ConversationsListRequest request =
ConversationsListRequest.builder()
.setOnlyActive(true)
.setAppId("conversation app Id")
.setContactId("contact id")
.setPageSize(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,13 +423,13 @@ private HttpRequest conversationInjectMessageRequestBuilder(
*
* @param projectId The unique ID of the project. You can find this on the [Sinch
* Dashboard](https://dashboard.sinch.com/convapi/apps). (required)
* @param onlyActive Required. True if only active conversations should be listed. (required)
* @param appId The ID of the app involved in the conversations. Note that either
* `app_id` or `contact_id` is required in order for the operation to
* function correctly. (optional)
* @param contactId Resource name (ID) of the contact. Note that either `app_id` or
* `contact_id` is required in order for the operation to function correctly.
* (optional)
* @param onlyActive True if only active conversations should be listed. (optional)
* @param pageSize The maximum number of conversations to fetch. Defaults to 10 and the maximum is
* 20. (optional)
* @param pageToken Next page token previously returned if any. (optional)
Expand All @@ -439,9 +439,9 @@ private HttpRequest conversationInjectMessageRequestBuilder(
*/
public ListConversationsResponseInternal conversationListConversations(
String projectId,
Boolean onlyActive,
String appId,
String contactId,
Boolean onlyActive,
Integer pageSize,
String pageToken,
ConversationChannel activeChannel)
Expand All @@ -453,15 +453,15 @@ public ListConversationsResponseInternal conversationListConversations(
+ "projectId: "
+ projectId
+ ", "
+ "onlyActive: "
+ onlyActive
+ ", "
+ "appId: "
+ appId
+ ", "
+ "contactId: "
+ contactId
+ ", "
+ "onlyActive: "
+ onlyActive
+ ", "
+ "pageSize: "
+ pageSize
+ ", "
Expand All @@ -473,7 +473,7 @@ public ListConversationsResponseInternal conversationListConversations(

HttpRequest httpRequest =
conversationListConversationsRequestBuilder(
projectId, onlyActive, appId, contactId, pageSize, pageToken, activeChannel);
projectId, appId, contactId, onlyActive, pageSize, pageToken, activeChannel);
HttpResponse response =
httpClient.invokeAPI(
this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest);
Expand All @@ -494,9 +494,9 @@ public ListConversationsResponseInternal conversationListConversations(

private HttpRequest conversationListConversationsRequestBuilder(
String projectId,
Boolean onlyActive,
String appId,
String contactId,
Boolean onlyActive,
Integer pageSize,
String pageToken,
ConversationChannel activeChannel)
Expand All @@ -507,12 +507,6 @@ private HttpRequest conversationListConversationsRequestBuilder(
400,
"Missing the required parameter 'projectId' when calling conversationListConversations");
}
// verify the required parameter 'onlyActive' is set
if (onlyActive == null) {
throw new ApiException(
400,
"Missing the required parameter 'onlyActive' when calling conversationListConversations");
}

String localVarPath =
"/v1/projects/{project_id}/conversations"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ public interface Coordinates {
*
* @return latitude
*/
Float getLatitude();
Double getLatitude();

/**
* The longitude.
*
* @return longitude
*/
Float getLongitude();
Double getLongitude();

/**
* Getting builder
Expand All @@ -49,7 +49,7 @@ interface Builder {
* @return Current builder
* @see #getLatitude
*/
Builder setLatitude(Float latitude);
Builder setLatitude(Double latitude);

/**
* see getter
Expand All @@ -58,7 +58,7 @@ interface Builder {
* @return Current builder
* @see #getLongitude
*/
Builder setLongitude(Float longitude);
Builder setLongitude(Double longitude);

/**
* Create instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,38 +20,38 @@ public class CoordinatesImpl implements Coordinates {

public static final String JSON_PROPERTY_LATITUDE = "latitude";

private OptionalValue<Float> latitude;
private OptionalValue<Double> latitude;

public static final String JSON_PROPERTY_LONGITUDE = "longitude";

private OptionalValue<Float> longitude;
private OptionalValue<Double> longitude;

public CoordinatesImpl() {}

protected CoordinatesImpl(OptionalValue<Float> latitude, OptionalValue<Float> longitude) {
protected CoordinatesImpl(OptionalValue<Double> latitude, OptionalValue<Double> longitude) {
this.latitude = latitude;
this.longitude = longitude;
}

@JsonIgnore
public Float getLatitude() {
public Double getLatitude() {
return latitude.orElse(null);
}

@JsonProperty(JSON_PROPERTY_LATITUDE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public OptionalValue<Float> latitude() {
public OptionalValue<Double> latitude() {
return latitude;
}

@JsonIgnore
public Float getLongitude() {
public Double getLongitude() {
return longitude.orElse(null);
}

@JsonProperty(JSON_PROPERTY_LONGITUDE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public OptionalValue<Float> longitude() {
public OptionalValue<Double> longitude() {
return longitude;
}

Expand Down Expand Up @@ -96,17 +96,17 @@ private String toIndentedString(Object o) {

@JsonPOJOBuilder(withPrefix = "set")
static class Builder implements Coordinates.Builder {
OptionalValue<Float> latitude = OptionalValue.empty();
OptionalValue<Float> longitude = OptionalValue.empty();
OptionalValue<Double> latitude = OptionalValue.empty();
OptionalValue<Double> longitude = OptionalValue.empty();

@JsonProperty(JSON_PROPERTY_LATITUDE)
public Builder setLatitude(Float latitude) {
public Builder setLatitude(Double latitude) {
this.latitude = OptionalValue.of(latitude);
return this;
}

@JsonProperty(JSON_PROPERTY_LONGITUDE)
public Builder setLongitude(Float longitude) {
public Builder setLongitude(Double longitude) {
this.longitude = OptionalValue.of(longitude);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public class CoordinatesDtoTest extends ConversationBaseTest {

public static Coordinates coordinatesDto =
Coordinates.builder().setLatitude(47.627980F).setLongitude(-2.822915F).build();
Coordinates.builder().setLatitude(47.6279809).setLongitude(-2.8229159).build();

@GivenTextResource("/domains/conversation/v1/messages/types/location/CoordinatesDto.json")
String jsonCoordinatesDto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class LocationMessageDtoTest extends ConversationBaseTest {
public static LocationMessage locationMessageDto =
LocationMessage.builder()
.setCoordinates(
Coordinates.builder().setLatitude(47.627980F).setLongitude(-2.822915F).build())
Coordinates.builder().setLatitude(47.6279809).setLongitude(-2.8229159).build())
.setTitle("title value")
.setLabel("label value")
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
{
"location_message": {
"coordinates": {
"latitude": 47.62798,
"longitude": -2.822915
"latitude": 47.6279809,
"longitude": -2.8229159
},
"label": "label value",
"title": "title value"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"contact_message": {
"location_message": {
"coordinates": {
"latitude": 47.627980,
"longitude": -2.822915
"latitude": 47.6279809,
"longitude": -2.8229159
},
"title": "title value",
"label": "label value"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"contact_message": {
"location_message": {
"coordinates": {
"latitude": 47.627980,
"longitude": -2.822915
"latitude": 47.6279809,
"longitude": -2.8229159
},
"title": "title value",
"label": "label value"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"contact_message": {
"location_message": {
"coordinates": {
"latitude": 47.627980,
"longitude": -2.822915
"latitude": 47.6279809,
"longitude": -2.8229159
},
"title": "title value",
"label": "label value"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
{
"location_message": {
"coordinates": {
"latitude": 47.627980,
"longitude": -2.822915
"latitude": 47.6279809,
"longitude": -2.8229159
},
"title": "title value",
"label": "label value"
Expand Down Expand Up @@ -60,8 +60,8 @@
{
"location_message": {
"coordinates": {
"latitude": 47.627980,
"longitude": -2.822915
"latitude": 47.6279809,
"longitude": -2.8229159
},
"title": "title value",
"label": "label value"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
{
"location_message": {
"coordinates": {
"latitude": 47.627980,
"longitude": -2.822915
"latitude": 47.6279809,
"longitude": -2.8229159
},
"title": "title value",
"label": "label value"
Expand Down Expand Up @@ -54,8 +54,8 @@
{
"location_message": {
"coordinates": {
"latitude": 47.627980,
"longitude": -2.822915
"latitude": 47.6279809,
"longitude": -2.8229159
},
"title": "title value",
"label": "label value"
Expand Down Expand Up @@ -98,8 +98,8 @@
{
"location_message": {
"coordinates": {
"latitude": 47.627980,
"longitude": -2.822915
"latitude": 47.6279809,
"longitude": -2.8229159
},
"title": "title value",
"label": "label value"
Expand Down
Loading

0 comments on commit fdc30a0

Please sign in to comment.