/*
*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017 Mario Danic (mario@lovelyhq.com)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package com.nextcloud.talk.api;
import android.support.annotation.Nullable;
import com.nextcloud.talk.models.json.call.CallOverall;
import com.nextcloud.talk.models.json.capabilities.CapabilitiesOverall;
import com.nextcloud.talk.models.json.chat.ChatOverall;
import com.nextcloud.talk.models.json.generic.GenericOverall;
import com.nextcloud.talk.models.json.generic.Status;
import com.nextcloud.talk.models.json.mention.MentionOverall;
import com.nextcloud.talk.models.json.participants.AddParticipantOverall;
import com.nextcloud.talk.models.json.participants.ParticipantsOverall;
import com.nextcloud.talk.models.json.push.PushRegistrationOverall;
import com.nextcloud.talk.models.json.rooms.RoomOverall;
import com.nextcloud.talk.models.json.rooms.RoomsOverall;
import com.nextcloud.talk.models.json.sharees.ShareesOverall;
import com.nextcloud.talk.models.json.signaling.SignalingOverall;
import com.nextcloud.talk.models.json.signaling.settings.SignalingSettingsOverall;
import com.nextcloud.talk.models.json.userprofile.UserProfileOverall;
import java.util.Map;
import io.reactivex.Observable;
import retrofit2.Response;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
import retrofit2.http.Url;
public interface NcApi {
/*
QueryMap items are as follows:
- "format" : "json"
- "search" : ""
- "perPage" : "200"
- "itemType" : "call"
Server URL is: baseUrl + ocsApiVersion + /apps/files_sharing/api/v1/sharees
*/
@GET
Observable> getContactsWithSearchParam(@Header("Authorization") String authorization, @Url String url,
@QueryMap Map options);
/*
Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /room
*/
@GET
Observable getRooms(@Header("Authorization") String authorization, @Url String url);
/*
Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /room/roomToken
*/
@GET
Observable getRoom(@Header("Authorization") String authorization, @Url String url);
/*
QueryMap items are as follows:
- "roomType" : ""
- "invite" : ""
Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /room
*/
@POST
Observable createRoom(@Header("Authorization") String authorization, @Url String url,
@QueryMap Map options);
/*
QueryMap items are as follows:
- "roomName" : "newName"
Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /room/roomToken
*/
@FormUrlEncoded
@PUT
Observable renameRoom(@Header("Authorization") String authorization, @Url String url,
@Field("roomName") String roomName);
/*
QueryMap items are as follows:
- "newParticipant" : "user"
Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /room/roomToken/participants
*/
@POST
Observable addParticipant(@Header("Authorization") String authorization, @Url String url,
@QueryMap Map options);
/*
Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /room/roomToken/participants/self
*/
@DELETE
Observable removeSelfFromRoom(@Header("Authorization") String authorization, @Url String url);
/*
Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /room/roomToken/public
*/
@POST
Observable makeRoomPublic(@Header("Authorization") String authorization, @Url String url);
/*
Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /room/roomToken/public
*/
@DELETE
Observable makeRoomPrivate(@Header("Authorization") String authorization, @Url String url);
@DELETE
Observable deleteRoom(@Header("Authorization") String authorization, @Url String url);
/*
Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /call/callToken
*/
@GET
Observable getPeersForCall(@Header("Authorization") String authorization, @Url String url);
@FormUrlEncoded
@POST
Observable joinRoom(@Nullable @Header("Authorization") String authorization, @Url String url,
@Nullable @Field("password") String password);
@DELETE
Observable leaveRoom(@Nullable @Header("Authorization") String authorization, @Url String url);
/*
Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /call/callToken
*/
@POST
Observable joinCall(@Nullable @Header("Authorization") String authorization, @Url String url);
/*
Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /call/callToken
*/
@DELETE
Observable leaveCall(@Nullable @Header("Authorization") String authorization, @Url String url);
/*
Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /call/callToken/ping
*/
@POST
Observable pingCall(@Nullable @Header("Authorization") String authorization, @Url String url);
@GET
Observable getSignalingSettings(@Nullable @Header("Authorization") String authorization,
@Url String url);
/*
QueryMap items are as follows:
- "messages" : "message"
Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /signaling
*/
@FormUrlEncoded
@POST
Observable sendSignalingMessages(@Nullable @Header("Authorization") String authorization, @Url String url,
@Field("messages") String messages);
/*
Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /signaling
*/
@GET
Observable pullSignalingMessages(@Nullable @Header("Authorization") String authorization, @Url
String
url);
/*
QueryMap items are as follows:
- "format" : "json"
Server URL is: baseUrl + ocsApiVersion + "/cloud/user"
*/
@GET
Observable getUserProfile(@Header("Authorization") String authorization, @Url String url);
/*
Server URL is: baseUrl + /status.php
*/
@GET
Observable getServerStatus(@Url String url);
/*
QueryMap items are as follows:
- "format" : "json"
- "pushTokenHash" : ""
- "devicePublicKey" : ""
- "proxyServer" : ""
Server URL is: baseUrl + ocsApiVersion + "/apps/notifications/api/v2/push
*/
@POST
Observable registerDeviceForNotificationsWithNextcloud(@Header("Authorization")
String authorization,
@Url String url,
@QueryMap Map options);
@DELETE
Observable unregisterDeviceForNotificationsWithNextcloud(@Header("Authorization")
String authorization,
@Url String url);
@FormUrlEncoded
@POST
Observable registerDeviceForNotificationsWithProxy(@Header("Authorization") String authorization,
@Url String url,
@FieldMap Map fields);
/*
QueryMap items are as follows:
- "deviceIdentifier": "{{deviceIdentifier}}",
- "deviceIdentifierSignature": "{{signature}}",
- "userPublicKey": "{{userPublicKey}}"
*/
@DELETE
Observable unregisterDeviceForNotificationsWithProxy(@Header("Authorization") String authorization,
@Url String url,
@QueryMap Map fields);
@FormUrlEncoded
@PUT
Observable setPassword(@Header("Authorization") String authorization, @Url String url,
@Field("password") String password);
@GET
Observable getCapabilities(@Header("Authorization") String authorization, @Url String url);
/*
QueryMap items are as follows:
- "lookIntoFuture": int (0 or 1),
- "limit" : int, range 100-200,
- "timeout": used with look into future, 30 default, 60 at most
- "lastKnownMessageId", int, use one from X-Chat-Last-Given
*/
@GET
Observable> pullChatMessages(@Header("Authorization") String authorization, @Url String url,
@QueryMap Map fields);
/*
Fieldmap items are as follows:
- "message": ,
- "actorDisplayName"
*/
@FormUrlEncoded
@POST
Observable sendChatMessage(@Header("Authorization") String authorization, @Url String url,
@Field("message") CharSequence message,
@Field("actorDisplayName") String actorDisplayName);
@GET
Observable getMentionAutocompleteSuggestions(@Header("Authorization") String authorization,
@Url String url, @Query("search") String query,
@Nullable @Query("limit") Integer limit);
}