mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-07 16:06:08 +00:00
Single location for OCS_API_HEADER constants and identation fails fixed
This commit is contained in:
parent
bb950b7483
commit
1dbc9a121e
@ -55,6 +55,12 @@ public abstract class RemoteOperation implements Runnable {
|
||||
|
||||
private static final String TAG = RemoteOperation.class.getSimpleName();
|
||||
|
||||
/** OCS API header name */
|
||||
public static final String OCS_API_HEADER = "OCS-APIREQUEST";
|
||||
|
||||
/** OCS API header value */
|
||||
public static final String OCS_API_HEADER_VALUE = "true";
|
||||
|
||||
/** ownCloud account in the remote ownCloud server to operate */
|
||||
private Account mAccount = null;
|
||||
|
||||
|
@ -48,10 +48,6 @@ public class CreateRemoteShareOperation extends RemoteOperation {
|
||||
|
||||
private static final String TAG = CreateRemoteShareOperation.class.getSimpleName();
|
||||
|
||||
// OCS API header
|
||||
private static final String HEADER_OCS_API = "OCS-APIREQUEST";
|
||||
private static final String HEADER_OCS_API_VALUE = "true";
|
||||
|
||||
private static final String PARAM_PATH = "path";
|
||||
private static final String PARAM_SHARE_TYPE = "shareType";
|
||||
private static final String PARAM_SHARE_WITH = "shareWith";
|
||||
@ -119,7 +115,7 @@ public class CreateRemoteShareOperation extends RemoteOperation {
|
||||
}
|
||||
post.addParameter(PARAM_PERMISSIONS, Integer.toString(mPermissions));
|
||||
|
||||
post.addRequestHeader(HEADER_OCS_API, HEADER_OCS_API_VALUE);
|
||||
post.addRequestHeader(OCS_API_HEADER, OCS_API_HEADER_VALUE);
|
||||
|
||||
status = client.executeMethod(post);
|
||||
|
||||
|
@ -52,10 +52,6 @@ public class GetRemoteSharesForFileOperation extends RemoteOperation {
|
||||
|
||||
private static final String TAG = GetRemoteSharesForFileOperation.class.getSimpleName();
|
||||
|
||||
// OCS API header
|
||||
private static final String HEADER_OCS_API = "OCS-APIREQUEST";
|
||||
private static final String HEADER_OCS_API_VALUE = "true";
|
||||
|
||||
private static final String PARAM_PATH = "path";
|
||||
private static final String PARAM_RESHARES = "reshares";
|
||||
private static final String PARAM_SUBFILES = "subfiles";
|
||||
@ -100,7 +96,7 @@ public class GetRemoteSharesForFileOperation extends RemoteOperation {
|
||||
new NameValuePair(PARAM_SUBFILES, String.valueOf(mSubfiles))
|
||||
});
|
||||
|
||||
get.addRequestHeader(HEADER_OCS_API, HEADER_OCS_API_VALUE);
|
||||
get.addRequestHeader(OCS_API_HEADER, OCS_API_HEADER_VALUE);
|
||||
|
||||
status = client.executeMethod(get);
|
||||
|
||||
|
@ -50,10 +50,6 @@ public class GetRemoteSharesOperation extends RemoteOperation {
|
||||
|
||||
private static final String TAG = GetRemoteSharesOperation.class.getSimpleName();
|
||||
|
||||
// OCS API header
|
||||
private static final String HEADER_OCS_API = "OCS-APIREQUEST";
|
||||
private static final String HEADER_OCS_API_VALUE = "true";
|
||||
|
||||
private ArrayList<OCShare> mShares; // List of shares for result
|
||||
|
||||
|
||||
@ -72,7 +68,7 @@ public class GetRemoteSharesOperation extends RemoteOperation {
|
||||
try{
|
||||
get = new GetMethod(client.getBaseUri() + ShareUtils.SHARING_API_PATH);
|
||||
Log.d(TAG, "URL ------> " + client.getBaseUri() + ShareUtils.SHARING_API_PATH);
|
||||
get.addRequestHeader(HEADER_OCS_API, HEADER_OCS_API_VALUE);
|
||||
get.addRequestHeader(OCS_API_HEADER, OCS_API_HEADER_VALUE);
|
||||
status = client.executeMethod(get);
|
||||
if(isSuccess(status)) {
|
||||
Log.d(TAG, "Obtain RESPONSE");
|
||||
|
@ -48,10 +48,6 @@ public class RemoveRemoteShareOperation extends RemoteOperation {
|
||||
|
||||
private static final String TAG = RemoveRemoteShareOperation.class.getSimpleName();
|
||||
|
||||
// OCS API header
|
||||
private static final String HEADER_OCS_API = "OCS-APIREQUEST";
|
||||
private static final String HEADER_OCS_API_VALUE = "true";
|
||||
|
||||
private int mRemoteShareId;
|
||||
|
||||
/**
|
||||
@ -77,7 +73,7 @@ public class RemoveRemoteShareOperation extends RemoteOperation {
|
||||
delete = new DeleteMethod(client.getBaseUri() + ShareUtils.SHARING_API_PATH + id);
|
||||
Log.d(TAG, "URL ------> " + client.getBaseUri() + ShareUtils.SHARING_API_PATH + id);
|
||||
|
||||
delete.addRequestHeader(HEADER_OCS_API, HEADER_OCS_API_VALUE);
|
||||
delete.addRequestHeader(OCS_API_HEADER, OCS_API_HEADER_VALUE);
|
||||
|
||||
status = client.executeMethod(delete);
|
||||
|
||||
|
@ -48,10 +48,6 @@ public class GetRemoteUserNameOperation extends RemoteOperation {
|
||||
|
||||
private static final String TAG = GetRemoteUserNameOperation.class.getSimpleName();
|
||||
|
||||
// OCS API header
|
||||
private static final String HEADER_OCS_API = "OCS-APIREQUEST";
|
||||
private static final String HEADER_OCS_API_VALUE = "true";
|
||||
|
||||
// OCS Route
|
||||
private static final String OCS_ROUTE ="/index.php/ocs/cloud/user?format=json";
|
||||
|
||||
@ -81,11 +77,7 @@ public class GetRemoteUserNameOperation extends RemoteOperation {
|
||||
//Get the user
|
||||
try {
|
||||
get = new GetMethod(client.getWebdavUri() + OCS_ROUTE);
|
||||
//get = new GetMethod(client.getBaseUri() + OCS_ROUTE); // need to fix the semantics of getBaseUri and getWebdavUri
|
||||
//Log.e(TAG, "Getting OC user information from " + client.getBaseUri() + OCS_ROUTE);
|
||||
//Log.e(TAG, "Getting OC user information from " + client.getWebdavUri() + OCS_ROUTE);
|
||||
// Add the Header
|
||||
get.addRequestHeader(HEADER_OCS_API, HEADER_OCS_API_VALUE);
|
||||
get.addRequestHeader(OCS_API_HEADER, OCS_API_HEADER_VALUE);
|
||||
status = client.executeMethod(get);
|
||||
if(isSuccess(status)) {
|
||||
String response = get.getResponseBodyAsString();
|
||||
|
Loading…
x
Reference in New Issue
Block a user