aboutsummaryrefslogtreecommitdiff
path: root/juick-notifications/src/main/java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-11-13 22:26:57 +0300
committerGravatar Vitaly Takmazov2017-11-13 22:26:57 +0300
commit69447f1ebce5f0003c26e0bd03cb89aae0eacec7 (patch)
tree82c1055bfbc74c8f3173410f13d1b357d5664b3a /juick-notifications/src/main/java
parent444bfb8ab44da854672e989866e7cdd968144f9c (diff)
notifications: implement set_popular for rest service
Diffstat (limited to 'juick-notifications/src/main/java')
-rw-r--r--juick-notifications/src/main/java/com/juick/components/service/ApiMessagesService.java14
1 files changed, 9 insertions, 5 deletions
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<Void>() {
+ }).getStatusCode().equals(HttpStatus.OK);
}
@Override