How to upload File using kotlin coroutines (retrofit).
Is it possible that i send using syntax similar to this for sending files to server? The current multipart upload seems to be taking a lot of extra code for creating MultipartBody.body and sending to server. Is there any reason for the same ?
Code syntax that i am trying.
data class AddCategoryRequest(
val name: String,
val image: File?,
val subCategory: Boolean,
val parentCategoryId: Int
)
/**
* Category Create API Call
*/
@POST(Urls.SUB_URL_CREATE_CATEGORY)
suspend fun createCategory(
@Body createCategoryRequest: AddCategoryRequest
): Category