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

services.ProfilesService Maven / Gradle / Ivy

There is a newer version: 3.3.0
Show newest version
package services;

import models.PatchRequestBody;
import models.Profile;
import models.ProfileLists;
import models.UpdateResponseBody;

import java.io.IOException;

public class ProfilesService {
    private final ProfilesInterface profilesInterface;

    public ProfilesService() {
        profilesInterface = Courier.getRetrofit().create(ProfilesInterface.class);
    }

    public Profile getProfile(
            String recipientId
    ) throws IOException {
        return profilesInterface.getProfile(
                recipientId,
                Courier.getAuthorizationHeader(),
                Courier.getUserAgent()
        ).execute().body();
    }

    public UpdateResponseBody postProfile(
            String recipientId,
            Profile profile
    ) throws IOException {
        return profilesInterface.postProfile(
                recipientId,
                profile,
                Courier.getAuthorizationHeader(),
                Courier.getUserAgent()
        ).execute().body();
    }

    public UpdateResponseBody patchProfile(
            String recipientId,
            PatchRequestBody patchRequestBody
    ) throws IOException {
        return profilesInterface.patchProfile(
                recipientId,
                patchRequestBody,
                Courier.getAuthorizationHeader(),
                Courier.getUserAgent()
        ).execute().body();
    }

    public UpdateResponseBody putProfile(
            String recipientId,
            Profile profile
    ) throws IOException {
        return profilesInterface.putProfile(
                recipientId,
                profile,
                Courier.getAuthorizationHeader(),
                Courier.getUserAgent()
        ).execute().body();
    }

    public ProfileLists getProfileLists(
            String recipientId,
            String cursor
    ) throws IOException {
        return profilesInterface.getProfileLists(
                recipientId,
                cursor,
                Courier.getAuthorizationHeader(),
                Courier.getUserAgent()
        ).execute().body();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy