January 2019
Intermediate to advanced
392 pages
10h 11m
English
To handle the comment REST APIs, we will create two HTTP requests. So we will create two POST and DELETE requests using the Retrofit annotations. Now create an interface named PostService.kt, and here is the code:
interface CommentService { // Post comment in a post by Profile ID and Post ID @POST("/comment/{user_id}/{post_id}") fun postCommentByPostId(@Path("post_id") postId: Long, @Path("user_id") userId: Long, @Query("commentText") commentText: String): Observable<Post> // Delete comment in a post by Profile ID and Post ID @DELETE("/comment/{user_id}/{post_id}") fun deleteCommentByPostId(@Path("post_id") postId: Long, @Path("user_id") userId: Long, @Query("commentText") commentText: String): Observable<Post> ...Read now
Unlock full access