Part
annotation class Part(val value: String = KTORGEN_DEFAULT_NAME, val encoding: String = "binary")(source)
Annotate a single part of a multipart request.
Where the name of the parameter is used as the name of the part (or the value if set), the value of the parameter is used as the body of the part.
If the type is PartData the value will be used directly with its content type.
@POST("upload")
@Multipart
suspend fun uploadFile(
@Part(value = "other_name") description: String,
@Part data: List<PartData>,
): String
// Generated code
val _content = formData {
this.append(key = """other_name""", value = """$description""")
}
this.setBody(MultiPartFormDataContent(listOf(data) + _content))Content copied to clipboard