services.PreferencesService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of courier-java Show documentation
Show all versions of courier-java Show documentation
Java SDK for communicating with the Courier REST API.
package services;
import models.Preference;
import models.UpdateResponseBody;
import models.Preferences;
import java.io.IOException;
public class PreferencesService {
private final PreferencesInterface preferencesInterface;
public PreferencesService() {
preferencesInterface = Courier.getRetrofit().create(PreferencesInterface.class);
}
public Preferences getPreferences(
) throws IOException {
return preferencesInterface.getPreferences(
Courier.getAuthorizationHeader(),
Courier.getUserAgent()
).execute().body();
}
public Preference getPreference(
String recipientId
) throws IOException {
return preferencesInterface.getPreference(
recipientId,
Courier.getAuthorizationHeader(),
Courier.getUserAgent()
).execute().body();
}
public UpdateResponseBody putPreference(
String recipientId,
Preference preference
) throws IOException {
return preferencesInterface.putPreference(
recipientId,
preference,
Courier.getAuthorizationHeader(),
Courier.getUserAgent()
).execute().body();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy