All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.cloudinary.http.MultipartEntity.kt Maven / Gradle / Ivy

Go to download

Cloudinary is a cloud service that offers a solution to a web application's entire image management pipeline. Upload images to the cloud. Automatically perform smart image resizing, cropping and conversion without installing any complex software. Integrate Facebook or Twitter profile image extraction in a snap, in any dimension and style to match your website’s graphics requirements. Images are seamlessly delivered through a fast CDN, and much much more. This Java library allows to easily integrate with Cloudinary in Kotlin applications.

The newest version!
package com.cloudinary.http

import com.cloudinary.upload.request.Payload

interface MultipartEntity {
    val parts: MutableList>
    fun addTextPart(name: String, value: String): MultipartEntity
    fun addPayloadPart(payload: Payload<*>, forcedName: String? = null): MultipartEntity
}

class MultipartEntityImpl : MultipartEntity {
    override val parts = mutableListOf>()

    override fun addTextPart(name: String, value: String): MultipartEntity {
        parts.add(Pair(name, value))
        return this
    }

    override fun addPayloadPart(payload: Payload<*>, forcedName: String?) = apply {
        payload.value?.let { value ->
            parts.add(Pair(forcedName ?: payload.name, value))
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy