From 69447f1ebce5f0003c26e0bd03cb89aae0eacec7 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 13 Nov 2017 22:26:57 +0300 Subject: notifications: implement set_popular for rest service --- .../com/juick/components/service/ApiMessagesService.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'juick-notifications') diff --git a/juick-notifications/src/main/java/com/juick/components/service/ApiMessagesService.java b/juick-notifications/src/main/java/com/juick/components/service/ApiMessagesService.java index 88ffad1a..ce07b7fe 100644 --- a/juick-notifications/src/main/java/com/juick/components/service/ApiMessagesService.java +++ b/juick-notifications/src/main/java/com/juick/components/service/ApiMessagesService.java @@ -7,11 +7,9 @@ import com.juick.server.helpers.ResponseReply; import com.juick.service.BaseRestService; import com.juick.service.MessagesService; import org.springframework.core.ParameterizedTypeReference; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.MediaType; +import org.springframework.http.*; import org.springframework.web.client.RestTemplate; +import org.springframework.web.util.UriComponentsBuilder; import java.time.LocalDateTime; import java.util.Collection; @@ -184,7 +182,13 @@ public class ApiMessagesService extends BaseRestService implements MessagesServi @Override public boolean setMessagePopular(int mid, int popular) { - return false; + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON_UTF8); + return getRest().exchange(UriComponentsBuilder.fromHttpUrl("https://api.juick.com/messages/set_popular") + .queryParam("mid", mid) + .queryParam("popular", popular) + .build().toUriString(), HttpMethod.GET, new HttpEntity<>(headers), new ParameterizedTypeReference() { + }).getStatusCode().equals(HttpStatus.OK); } @Override -- cgit v1.2.3