2019-04-22 11:00:45 +00:00
|
|
|
package eu.siacs.conversations.http.services;
|
|
|
|
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Set;
|
|
|
|
|
2019-11-02 08:43:37 +00:00
|
|
|
import eu.siacs.conversations.entities.Room;
|
2019-04-22 11:00:45 +00:00
|
|
|
import retrofit2.Call;
|
|
|
|
import retrofit2.http.Body;
|
|
|
|
import retrofit2.http.GET;
|
|
|
|
import retrofit2.http.POST;
|
|
|
|
import retrofit2.http.Query;
|
|
|
|
|
|
|
|
public interface MuclumbusService {
|
|
|
|
|
|
|
|
@GET("/api/1.0/rooms/unsafe")
|
|
|
|
Call<Rooms> getRooms(@Query("p") int page);
|
|
|
|
|
|
|
|
@POST("/api/1.0/search")
|
|
|
|
Call<SearchResult> search(@Body SearchRequest searchRequest);
|
|
|
|
|
|
|
|
class Rooms {
|
|
|
|
int page;
|
|
|
|
int total;
|
|
|
|
int pages;
|
|
|
|
public List<Room> items;
|
|
|
|
}
|
|
|
|
|
|
|
|
class SearchRequest {
|
|
|
|
|
2019-09-18 09:04:36 +00:00
|
|
|
public final Set<String> keywords;
|
2019-04-22 11:00:45 +00:00
|
|
|
|
|
|
|
public SearchRequest(String keyword) {
|
|
|
|
this.keywords = Collections.singleton(keyword);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class SearchResult {
|
|
|
|
|
|
|
|
public Result result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
class Result {
|
|
|
|
|
|
|
|
public List<Room> items;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|