1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

Migrate http methods to kotlin

This commit is contained in:
agarcia 2020-06-26 00:10:36 +02:00
parent aebd7288cd
commit c5cf0a8c0f
4 changed files with 45 additions and 68 deletions

View File

@ -21,29 +21,22 @@
* THE SOFTWARE. * THE SOFTWARE.
* *
*/ */
package com.owncloud.android.lib.common.http.methods.nonwebdav
package com.owncloud.android.lib.common.http.methods.nonwebdav; import java.io.IOException
import java.net.URL
import java.io.IOException;
import java.net.URL;
/** /**
* OkHttp delete calls wrapper * OkHttp delete calls wrapper
* *
* @author David González Verdugo * @author David González Verdugo
*/ */
public class DeleteMethod extends HttpMethod { class DeleteMethod(url: URL?) : HttpMethod(url) {
@Throws(IOException::class)
public DeleteMethod(URL url) { override fun onExecute(): Int {
super(url);
}
@Override
public int onExecute() throws IOException {
mRequest = mRequest.newBuilder() mRequest = mRequest.newBuilder()
.delete() .delete()
.build(); .build()
return super.onExecute()
return super.onExecute();
} }
} }

View File

@ -21,29 +21,22 @@
* THE SOFTWARE. * THE SOFTWARE.
* *
*/ */
package com.owncloud.android.lib.common.http.methods.nonwebdav
package com.owncloud.android.lib.common.http.methods.nonwebdav; import java.io.IOException
import java.net.URL
import java.io.IOException;
import java.net.URL;
/** /**
* OkHttp get calls wrapper * OkHttp get calls wrapper
* *
* @author David González Verdugo * @author David González Verdugo
*/ */
public class GetMethod extends HttpMethod { class GetMethod(url: URL?) : HttpMethod(url) {
@Throws(IOException::class)
public GetMethod(URL url) { override fun onExecute(): Int {
super(url);
}
@Override
public int onExecute() throws IOException {
mRequest = mRequest.newBuilder() mRequest = mRequest.newBuilder()
.get() .get()
.build(); .build()
return super.onExecute()
return super.onExecute();
} }
} }

View File

@ -21,29 +21,22 @@
* THE SOFTWARE. * THE SOFTWARE.
* *
*/ */
package com.owncloud.android.lib.common.http.methods.nonwebdav
package com.owncloud.android.lib.common.http.methods.nonwebdav; import java.io.IOException
import java.net.URL
import java.io.IOException;
import java.net.URL;
/** /**
* OkHttp post calls wrapper * OkHttp post calls wrapper
* *
* @author David González Verdugo * @author David González Verdugo
*/ */
public class PostMethod extends HttpMethod { class PostMethod(url: URL?) : HttpMethod(url) {
@Throws(IOException::class)
public PostMethod(URL url) { override fun onExecute(): Int {
super(url);
}
@Override
public int onExecute() throws IOException {
mRequest = mRequest.newBuilder() mRequest = mRequest.newBuilder()
.post(mRequestBody) .post(mRequestBody)
.build(); .build()
return super.onExecute()
return super.onExecute();
} }
} }

View File

@ -21,24 +21,22 @@
* THE SOFTWARE. * THE SOFTWARE.
* *
*/ */
package com.owncloud.android.lib.common.http.methods.nonwebdav
package com.owncloud.android.lib.common.http.methods.nonwebdav; import java.io.IOException
import java.net.URL
import java.io.IOException; /**
import java.net.URL; * OkHttp put calls wrapper
*
public class PutMethod extends HttpMethod { * @author David González Verdugo
*/
public PutMethod(URL url) { class PutMethod(url: URL?) : HttpMethod(url) {
super(url); @Throws(IOException::class)
} override fun onExecute(): Int {
@Override
public int onExecute() throws IOException {
mRequest = mRequest.newBuilder() mRequest = mRequest.newBuilder()
.put(mRequestBody) .put(mRequestBody)
.build(); .build()
return super.onExecute()
return super.onExecute();
} }
} }