I want to sent a simple POST request with one actual parameter:
@POST(\"/token\")
@FormUrlEncoded
void extendSession(@Field(\"refresh_token\")final String refres
You may use Java Method Invocation Builder for this.
@GenerateMethodInvocationBuilder
public interface ServiceApi {
@POST("/token")
@FormUrlEncoded
void extendSession(
@Default("theToken") @Field("refresh_token") final String refreshToken,
@Default("theId") @Field("client_id") final String clientId,
@Default("theSecret") @Field("client_secret") final String clientSecret,
@Default("theType") @Field("grant_type") final String grantType);
}
And then you can invoke the api like:
ServiceApiExtendedSessionBuilder.extendedSession()
.withRefreshToken("theRefreshToken")
.invoke(serviceApi);