Field
A named pair for a form-encoded request.
Needs to be used in combination with @FormUrlEncoded
@POST
@FormUrlEncoded
suspend fun example(@Field name: String, @Field("job") occupation: String): Employee
foo.example("Bob Smith", "President")
// Generate name=Bob+Smith&job=President
Content copied to clipboard
Arrays/vararg example:
@POST
@FormUrlEncoded
suspend fun example(@Field vararg name: String): List<Employee>
example("Bob Smith", "Jane Doe")
// Generate name=Bob+Smith&name=Jane+Doe
Content copied to clipboard