Final batch of API version injection

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2021-05-03 17:50:23 +02:00
parent 1766125149
commit 33de3ed330
No known key found for this signature in database
GPG key ID: 7076EA9751AACDDA
8 changed files with 142 additions and 74 deletions

View file

@ -231,9 +231,16 @@ class MainActivity : BaseActivity(), ActionBarProvider {
val roomType = "1" val roomType = "1"
val currentUser = userUtils.currentUser ?: return val currentUser = userUtils.currentUser ?: return
val apiVersion = ApiUtils.getApiVersion(currentUser, "conversation", intArrayOf(1))
if (apiVersion == null) {
Log.e(TAG, "No supported API version found")
return
}
val credentials = ApiUtils.getCredentials(currentUser.username, currentUser.token) val credentials = ApiUtils.getCredentials(currentUser.username, currentUser.token)
val retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom( val retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(
currentUser.baseUrl, roomType, apiVersion, currentUser.baseUrl, roomType,
userId, null userId, null
) )
ncApi.createRoom( ncApi.createRoom(

View file

@ -441,7 +441,14 @@ public class CallController extends BaseController {
} }
private void handleFromNotification() { private void handleFromNotification() {
ncApi.getRooms(credentials, ApiUtils.getUrlForGetRooms(baseUrl)) Integer apiVersion = ApiUtils.getApiVersion(conversationUser, "conversation", new int[] {1});
if (apiVersion == null) {
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
return;
}
ncApi.getRooms(credentials, ApiUtils.getUrlForRooms(apiVersion, baseUrl))
.retry(3) .retry(3)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
@ -1234,9 +1241,16 @@ public class CallController extends BaseController {
private void joinRoomAndCall() { private void joinRoomAndCall() {
callSession = ApplicationWideCurrentRoomHolder.getInstance().getSession(); callSession = ApplicationWideCurrentRoomHolder.getInstance().getSession();
Integer apiVersion = ApiUtils.getApiVersion(conversationUser, "conversation",
new int[] {1});
if (apiVersion == null) {
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
return;
}
if (TextUtils.isEmpty(callSession)) { if (TextUtils.isEmpty(callSession)) {
ncApi.joinRoom(credentials, ApiUtils.getUrlForSettingMyselfAsActiveParticipant(baseUrl, ncApi.joinRoom(credentials, ApiUtils.getUrlForParticipantsActive(apiVersion, baseUrl, roomToken),
roomToken), conversationPassword) conversationPassword)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.retry(3) .retry(3)
@ -1648,7 +1662,14 @@ public class CallController extends BaseController {
} }
private void leaveRoom(boolean shutDownView) { private void leaveRoom(boolean shutDownView) {
ncApi.leaveRoom(credentials, ApiUtils.getUrlForSettingMyselfAsActiveParticipant(baseUrl, roomToken)) Integer apiVersion = ApiUtils.getApiVersion(conversationUser, "conversation",
new int[] {1});
if (apiVersion == null) {
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
return;
}
ncApi.leaveRoom(credentials, ApiUtils.getUrlForParticipantsActive(apiVersion, baseUrl, roomToken))
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<GenericOverall>() { .subscribe(new Observer<GenericOverall>() {

View file

@ -977,9 +977,17 @@ class ChatController(args: Bundle) :
if (currentConversation == null || TextUtils.isEmpty(currentConversation?.sessionId) || if (currentConversation == null || TextUtils.isEmpty(currentConversation?.sessionId) ||
currentConversation?.sessionId == "0" currentConversation?.sessionId == "0"
) { ) {
val apiVersion = ApiUtils.getApiVersion(conversationUser, "conversation", intArrayOf(1))
if (apiVersion == null) {
Log.e(TAG, "No supported API version found")
return
}
ncApi?.joinRoom( ncApi?.joinRoom(
credentials, credentials,
ApiUtils.getUrlForSettingMyselfAsActiveParticipant(conversationUser?.baseUrl, roomToken), roomPassword ApiUtils.getUrlForParticipantsActive(apiVersion, conversationUser?.baseUrl, roomToken),
roomPassword
) )
?.subscribeOn(Schedulers.io()) ?.subscribeOn(Schedulers.io())
?.observeOn(AndroidSchedulers.mainThread()) ?.observeOn(AndroidSchedulers.mainThread())
@ -1043,9 +1051,17 @@ class ChatController(args: Bundle) :
} }
private fun leaveRoom() { private fun leaveRoom() {
val apiVersion = ApiUtils.getApiVersion(conversationUser, "conversation", intArrayOf(1))
if (apiVersion == null) {
Log.e(TAG, "No supported API version found")
return
}
ncApi?.leaveRoom( ncApi?.leaveRoom(
credentials, credentials,
ApiUtils.getUrlForSettingMyselfAsActiveParticipant( ApiUtils.getUrlForParticipantsActive(
apiVersion,
conversationUser?.baseUrl, conversationUser?.baseUrl,
roomToken roomToken
) )
@ -1762,8 +1778,16 @@ class ChatController(args: Bundle) :
if (currentConversation?.type != Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL || if (currentConversation?.type != Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL ||
currentConversation?.name != userMentionClickEvent.userId currentConversation?.name != userMentionClickEvent.userId
) { ) {
val apiVersion = ApiUtils.getApiVersion(conversationUser, "conversation", intArrayOf(1))
if (apiVersion == null) {
Log.e(TAG, "No supported API version found")
return
}
val retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom( val retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(
conversationUser?.baseUrl, "1", apiVersion, conversationUser?.baseUrl, "1",
userMentionClickEvent.userId, null userMentionClickEvent.userId, null
) )

View file

@ -288,8 +288,18 @@ public class ContactsController extends BaseController implements SearchView.OnQ
userId = selectedUserIds.iterator().next(); userId = selectedUserIds.iterator().next();
} }
RetrofitBucket retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(currentUser.getBaseUrl(), roomType, Integer apiVersion = ApiUtils.getApiVersion(currentUser, "conversation", new int[] {1});
userId, null);
if (apiVersion == null) {
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
return;
}
RetrofitBucket retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(apiVersion,
currentUser.getBaseUrl(),
roomType,
userId,
null);
ncApi.createRoom(credentials, ncApi.createRoom(credentials,
retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
@ -851,7 +861,18 @@ public class ContactsController extends BaseController implements SearchView.OnQ
roomType = "2"; roomType = "2";
} }
RetrofitBucket retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(currentUser.getBaseUrl(), roomType, userItem.getModel().getUserId(), null); Integer apiVersion = ApiUtils.getApiVersion(currentUser, "conversation", new int[] {1});
if (apiVersion == null) {
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
return false;
}
RetrofitBucket retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(apiVersion,
currentUser.getBaseUrl(),
roomType,
userItem.getModel().getUserId(),
null);
ncApi.createRoom(credentials, ncApi.createRoom(credentials,
retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) retrofitBucket.getUrl(), retrofitBucket.getQueryMap())

View file

@ -196,7 +196,7 @@ public class OperationsMenuController extends BaseController {
Integer apiVersion = ApiUtils.getApiVersion(currentUser, "conversation", Integer apiVersion = ApiUtils.getApiVersion(currentUser, "conversation",
new int[] {1}); new int[] {1});
if(apiVersion == null) { if (apiVersion == null) {
Log.e(TAG, "No supported API version found", new Exception("No supported API version found")); Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
return; return;
} }
@ -285,7 +285,7 @@ public class OperationsMenuController extends BaseController {
if (conversationType.equals(Conversation.ConversationType.ROOM_PUBLIC_CALL) || if (conversationType.equals(Conversation.ConversationType.ROOM_PUBLIC_CALL) ||
!currentUser.hasSpreedFeatureCapability("empty-group-room")) { !currentUser.hasSpreedFeatureCapability("empty-group-room")) {
retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(currentUser.getBaseUrl(), retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(apiVersion, currentUser.getBaseUrl(),
"3", invite, conversationName); "3", invite, conversationName);
} else { } else {
String roomType = "2"; String roomType = "2";
@ -294,7 +294,7 @@ public class OperationsMenuController extends BaseController {
roomType = "3"; roomType = "3";
} }
retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(currentUser.getBaseUrl(), retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(apiVersion, currentUser.getBaseUrl(),
roomType, invite, conversationName); roomType, invite, conversationName);
} }
@ -405,7 +405,7 @@ public class OperationsMenuController extends BaseController {
Integer apiVersion = ApiUtils.getApiVersion(currentUser, "conversation", Integer apiVersion = ApiUtils.getApiVersion(currentUser, "conversation",
new int[] {1}); new int[] {1});
if(apiVersion == null) { if (apiVersion == null) {
Log.e(TAG, "No supported API version found", new Exception("No supported API version found")); Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
return; return;
} }
@ -558,6 +558,7 @@ public class OperationsMenuController extends BaseController {
}); });
} }
@SuppressLint("LongLogTag")
private void inviteUsersToAConversation() { private void inviteUsersToAConversation() {
RetrofitBucket retrofitBucket; RetrofitBucket retrofitBucket;
final ArrayList<String> localInvitedUsers = invitedUsers; final ArrayList<String> localInvitedUsers = invitedUsers;
@ -566,11 +567,20 @@ public class OperationsMenuController extends BaseController {
localInvitedGroups.remove(0); localInvitedGroups.remove(0);
} }
Integer apiVersion = ApiUtils.getApiVersion(currentUser, "conversation", new int[] {1});
if (apiVersion == null) {
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
return;
}
if (localInvitedUsers.size() > 0 || (localInvitedGroups.size() > 0 && currentUser.hasSpreedFeatureCapability("invite-groups-and-mails"))) { if (localInvitedUsers.size() > 0 || (localInvitedGroups.size() > 0 && currentUser.hasSpreedFeatureCapability("invite-groups-and-mails"))) {
if ((localInvitedGroups.size() > 0 && currentUser.hasSpreedFeatureCapability("invite-groups-and-mails"))) { if ((localInvitedGroups.size() > 0 && currentUser.hasSpreedFeatureCapability("invite-groups-and-mails"))) {
for (int i = 0; i < localInvitedGroups.size(); i++) { for (int i = 0; i < localInvitedGroups.size(); i++) {
final String groupId = localInvitedGroups.get(i); final String groupId = localInvitedGroups.get(i);
retrofitBucket = ApiUtils.getRetrofitBucketForAddGroupParticipant(currentUser.getBaseUrl(), conversation.getToken(), retrofitBucket = ApiUtils.getRetrofitBucketForAddGroupParticipant(apiVersion,
currentUser.getBaseUrl(),
conversation.getToken(),
groupId); groupId);
ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
@ -610,8 +620,10 @@ public class OperationsMenuController extends BaseController {
for (int i = 0; i < localInvitedUsers.size(); i++) { for (int i = 0; i < localInvitedUsers.size(); i++) {
final String userId = invitedUsers.get(i); final String userId = invitedUsers.get(i);
retrofitBucket = ApiUtils.getRetrofitBucketForAddParticipant(currentUser.getBaseUrl(), conversation.getToken(), retrofitBucket = ApiUtils.getRetrofitBucketForAddParticipant(apiVersion,
userId); currentUser.getBaseUrl(),
conversation.getToken(),
userId);
ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())

View file

@ -20,7 +20,9 @@
package com.nextcloud.talk.jobs; package com.nextcloud.talk.jobs;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.util.Log;
import com.nextcloud.talk.api.NcApi; import com.nextcloud.talk.api.NcApi;
import com.nextcloud.talk.application.NextcloudTalkApplication; import com.nextcloud.talk.application.NextcloudTalkApplication;
@ -46,6 +48,8 @@ import io.reactivex.schedulers.Schedulers;
@AutoInjector(NextcloudTalkApplication.class) @AutoInjector(NextcloudTalkApplication.class)
public class AddParticipantsToConversation extends Worker { public class AddParticipantsToConversation extends Worker {
private static final String TAG = "AddParticipantsToConversation";
@Inject @Inject
NcApi ncApi; NcApi ncApi;
@ -60,19 +64,29 @@ public class AddParticipantsToConversation extends Worker {
NextcloudTalkApplication.Companion.getSharedApplication().getComponentApplication().inject(this); NextcloudTalkApplication.Companion.getSharedApplication().getComponentApplication().inject(this);
} }
@SuppressLint("LongLogTag")
@NonNull @NonNull
@Override @Override
public Result doWork() { public Result doWork() {
UserEntity user = userUtils.getUserWithInternalId(data.getLong(BundleKeys.INSTANCE.getKEY_INTERNAL_USER_ID(), -1));
Integer apiVersion = ApiUtils.getApiVersion(user, "conversation", new int[] {1});
if (apiVersion == null) {
Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
return Result.failure();
}
Data data = getInputData(); Data data = getInputData();
String[] selectedUserIds = data.getStringArray(BundleKeys.INSTANCE.getKEY_SELECTED_USERS()); String[] selectedUserIds = data.getStringArray(BundleKeys.INSTANCE.getKEY_SELECTED_USERS());
String[] selectedGroupIds = data.getStringArray(BundleKeys.INSTANCE.getKEY_SELECTED_GROUPS()); String[] selectedGroupIds = data.getStringArray(BundleKeys.INSTANCE.getKEY_SELECTED_GROUPS());
UserEntity user = userUtils.getUserWithInternalId(data.getLong(BundleKeys.INSTANCE.getKEY_INTERNAL_USER_ID(), -1));
String conversationToken = data.getString(BundleKeys.INSTANCE.getKEY_TOKEN()); String conversationToken = data.getString(BundleKeys.INSTANCE.getKEY_TOKEN());
String credentials = ApiUtils.getCredentials(user.getUsername(), user.getToken()); String credentials = ApiUtils.getCredentials(user.getUsername(), user.getToken());
RetrofitBucket retrofitBucket; RetrofitBucket retrofitBucket;
for (String userId : selectedUserIds) { for (String userId : selectedUserIds) {
retrofitBucket = ApiUtils.getRetrofitBucketForAddParticipant(user.getBaseUrl(), conversationToken, retrofitBucket = ApiUtils.getRetrofitBucketForAddParticipant(apiVersion, user.getBaseUrl(),
conversationToken,
userId); userId);
ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
@ -81,7 +95,7 @@ public class AddParticipantsToConversation extends Worker {
} }
for (String groupId : selectedGroupIds) { for (String groupId : selectedGroupIds) {
retrofitBucket = ApiUtils.getRetrofitBucketForAddGroupParticipant(user.getBaseUrl(), conversationToken, retrofitBucket = ApiUtils.getRetrofitBucketForAddGroupParticipant(apiVersion, user.getBaseUrl(), conversationToken,
groupId); groupId);
ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap())

View file

@ -90,7 +90,7 @@ public class LeaveConversationWorker extends Worker {
Integer apiVersion = ApiUtils.getApiVersion(operationUser, "conversation", Integer apiVersion = ApiUtils.getApiVersion(operationUser, "conversation",
new int[] {1}); new int[] {1});
if(apiVersion == null) { if (apiVersion == null) {
Log.e(TAG, "No supported API version found", new Exception("No supported API version found")); Log.e(TAG, "No supported API version found", new Exception("No supported API version found"));
return Result.failure(); return Result.failure();
} }

View file

@ -29,10 +29,7 @@ import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.models.RetrofitBucket; import com.nextcloud.talk.models.RetrofitBucket;
import com.nextcloud.talk.models.database.UserEntity; import com.nextcloud.talk.models.database.UserEntity;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import androidx.annotation.DimenRes; import androidx.annotation.DimenRes;
@ -41,18 +38,18 @@ import okhttp3.Credentials;
public class ApiUtils { public class ApiUtils {
private static final String TAG = "ApiUtils"; private static final String TAG = "ApiUtils";
private static String ocsApiVersion = "/ocs/v2.php"; private static final String ocsApiVersion = "/ocs/v2.php";
private static String spreedApiVersion = "/apps/spreed/api/v1"; private static final String spreedApiVersion = "/apps/spreed/api/v1";
private static String spreedApiBase = ocsApiVersion + "/apps/spreed/api/v"; private static final String spreedApiBase = ocsApiVersion + "/apps/spreed/api/v";
private static String userAgent = "Mozilla/5.0 (Android) Nextcloud-Talk v"; private static final String userAgent = "Mozilla/5.0 (Android) Nextcloud-Talk v";
public static String getUserAgent() { public static String getUserAgent() {
return userAgent + BuildConfig.VERSION_NAME; return userAgent + BuildConfig.VERSION_NAME;
} }
/** /**
* @deprecated Please specify the api version you want to use via * @deprecated This is only supported on API v1-3, in API v4+ please use
* {@link ApiUtils#getUrlForAttendees(int, String, String)} instead. * {@link ApiUtils#getUrlForAttendees(int, String, String)} instead.
*/ */
@Deprecated @Deprecated
@ -108,28 +105,10 @@ public class ApiUtils {
return retrofitBucket; return retrofitBucket;
} }
/**
* @deprecated Please specify the api version you want to use via
* {@link ApiUtils#getUrlForParticipantsActive(int, String, String)} instead.
*/
@Deprecated
public static String getUrlForSettingMyselfAsActiveParticipant(String baseUrl, String token) {
return getUrlForParticipantsActive(1, baseUrl, token);
}
public static String getUrlForCapabilities(String baseUrl) { public static String getUrlForCapabilities(String baseUrl) {
return baseUrl + ocsApiVersion + "/cloud/capabilities"; return baseUrl + ocsApiVersion + "/cloud/capabilities";
} }
/**
* @deprecated Please specify the api version you want to use via
* {@link ApiUtils#getUrlForRooms(int, String)} instead.
*/
@Deprecated
public static String getUrlForGetRooms(String baseUrl) {
return getUrlForRooms(1, baseUrl);
}
public static Integer getApiVersion(UserEntity capabilities, String apiName, int[] versions) { public static Integer getApiVersion(UserEntity capabilities, String apiName, int[] versions) {
if (apiName.equals("conversation")) { if (apiName.equals("conversation")) {
boolean hasApiV4 = false; boolean hasApiV4 = false;
@ -217,12 +196,11 @@ public class ApiUtils {
return getUrlForRoom(version, baseUrl, token) + "/webinary/lobby"; return getUrlForRoom(version, baseUrl, token) + "/webinary/lobby";
} }
@Deprecated public static RetrofitBucket getRetrofitBucketForCreateRoom(int version, String baseUrl, String roomType,
public static RetrofitBucket getRetrofitBucketForCreateRoom(String baseUrl, String roomType,
@Nullable String invite, @Nullable String invite,
@Nullable String conversationName) { @Nullable String conversationName) {
RetrofitBucket retrofitBucket = new RetrofitBucket(); RetrofitBucket retrofitBucket = new RetrofitBucket();
retrofitBucket.setUrl(baseUrl + ocsApiVersion + spreedApiVersion + "/room"); retrofitBucket.setUrl(getUrlForRooms(version, baseUrl));
Map<String, String> queryMap = new HashMap<>(); Map<String, String> queryMap = new HashMap<>();
queryMap.put("roomType", roomType); queryMap.put("roomType", roomType);
@ -239,10 +217,9 @@ public class ApiUtils {
return retrofitBucket; return retrofitBucket;
} }
@Deprecated public static RetrofitBucket getRetrofitBucketForAddParticipant(int version, String baseUrl, String token, String user) {
public static RetrofitBucket getRetrofitBucketForAddParticipant(String baseUrl, String token, String user) {
RetrofitBucket retrofitBucket = new RetrofitBucket(); RetrofitBucket retrofitBucket = new RetrofitBucket();
retrofitBucket.setUrl(baseUrl + ocsApiVersion + spreedApiVersion + "/room/" + token + "/participants"); retrofitBucket.setUrl(getUrlForParticipants(version, baseUrl, token));
Map<String, String> queryMap = new HashMap<>(); Map<String, String> queryMap = new HashMap<>();
@ -254,46 +231,46 @@ public class ApiUtils {
} }
public static RetrofitBucket getRetrofitBucketForAddGroupParticipant(String baseUrl, String token, String group) { public static RetrofitBucket getRetrofitBucketForAddGroupParticipant(int version, String baseUrl, String token, String group) {
RetrofitBucket retrofitBucket = getRetrofitBucketForAddParticipant(baseUrl, token, group); RetrofitBucket retrofitBucket = getRetrofitBucketForAddParticipant(version, baseUrl, token, group);
retrofitBucket.getQueryMap().put("source", "groups"); retrofitBucket.getQueryMap().put("source", "groups");
return retrofitBucket; return retrofitBucket;
} }
public static RetrofitBucket getRetrofitBucketForAddMailParticipant(String baseUrl, String token, String mail) { public static RetrofitBucket getRetrofitBucketForAddMailParticipant(int version, String baseUrl, String token, String mail) {
RetrofitBucket retrofitBucket = getRetrofitBucketForAddParticipant(baseUrl, token, mail); RetrofitBucket retrofitBucket = getRetrofitBucketForAddParticipant(version, baseUrl, token, mail);
retrofitBucket.getQueryMap().put("source", "emails"); retrofitBucket.getQueryMap().put("source", "emails");
return retrofitBucket; return retrofitBucket;
} }
@Deprecated
public static String getUrlForCall(String baseUrl, String token) { public static String getUrlForCall(String baseUrl, String token) {
// FIXME user APIv4 // FIXME Introduce API version
return baseUrl + ocsApiVersion + spreedApiVersion + "/call/" + token; return baseUrl + ocsApiVersion + spreedApiVersion + "/call/" + token;
} }
@Deprecated
public static String getUrlForCallPing(String baseUrl, String token) { public static String getUrlForCallPing(String baseUrl, String token) {
// FIXME Introduce API version
return getUrlForCall(baseUrl, token) + "/ping"; return getUrlForCall(baseUrl, token) + "/ping";
} }
public static String getUrlForChat(String baseUrl, String token) { public static String getUrlForChat(String baseUrl, String token) {
// FIXME Introduce API version
return baseUrl + ocsApiVersion + spreedApiVersion + "/chat/" + token; return baseUrl + ocsApiVersion + spreedApiVersion + "/chat/" + token;
} }
@Deprecated
public static String getUrlForExternalServerAuthBackend(String baseUrl) { public static String getUrlForExternalServerAuthBackend(String baseUrl) {
// FIXME Introduce API version
return getUrlForSignaling(baseUrl, null) + "/backend"; return getUrlForSignaling(baseUrl, null) + "/backend";
} }
public static String getUrlForMentionSuggestions(String baseUrl, String token) { public static String getUrlForMentionSuggestions(String baseUrl, String token) {
// FIXME Introduce API version
return getUrlForChat(baseUrl, token) + "/mentions"; return getUrlForChat(baseUrl, token) + "/mentions";
} }
@Deprecated
public static String getUrlForSignaling(String baseUrl, @Nullable String token) { public static String getUrlForSignaling(String baseUrl, @Nullable String token) {
// FIXME use APIv2 ? // FIXME Introduce API version
String signalingUrl = baseUrl + ocsApiVersion + spreedApiVersion + "/signaling"; String signalingUrl = baseUrl + ocsApiVersion + spreedApiVersion + "/signaling";
if (token == null) { if (token == null) {
return signalingUrl; return signalingUrl;
@ -302,17 +279,8 @@ public class ApiUtils {
} }
} }
/**
* @deprecated Please specify the api version you want to use via
* {@link ApiUtils#getUrlForRoomModerators(int, String, String)} instead.
*/
@Deprecated
public static String getUrlForModerators(String baseUrl, String roomToken) {
return getUrlForRoomModerators(1, baseUrl, roomToken);
}
@Deprecated
public static String getUrlForSignalingSettings(String baseUrl) { public static String getUrlForSignalingSettings(String baseUrl) {
// FIXME Introduce API version
return getUrlForSignaling(baseUrl, null) + "/settings"; return getUrlForSignaling(baseUrl, null) + "/settings";
} }
@ -326,6 +294,7 @@ public class ApiUtils {
} }
public static String getUrlForUserSettings(String baseUrl) { public static String getUrlForUserSettings(String baseUrl) {
// FIXME Introduce API version
return baseUrl + ocsApiVersion + spreedApiVersion + "/settings/user"; return baseUrl + ocsApiVersion + spreedApiVersion + "/settings/user";
} }