@@ -0,0 +1,2945 @@
+package org.sagebionetworks.bridge.android.manager;%0A%0Aimport android.support.annotation.NonNull;%0Aimport android.support.annotation.Nullable;%0A%0Aimport org.joda.time.LocalDate;%0Aimport org.sagebionetworks.bridge.android.util.retrofit.RxUtils;%0Aimport org.sagebionetworks.bridge.rest.api.ForConsentedUsersApi;%0Aimport org.sagebionetworks.bridge.rest.model.ConsentSignature;%0Aimport org.sagebionetworks.bridge.rest.model.SharingScope;%0Aimport org.sagebionetworks.bridge.rest.model.Withdrawal;%0A%0Aimport rx.Completable;%0Aimport rx.Single;%0A%0Aimport static com.google.common.base.Preconditions.checkNotNull;%0A%0A/**%0A * Created by jyliu on 1/27/2017.%0A */%0Apublic class ConsentManager %7B%0A%0A    private final ForConsentedUsersApi forConsentedUsersApi;%0A%0A    public ConsentManager(@NonNull ForConsentedUsersApi forConsentedUsersApi) %7B%0A        this.forConsentedUsersApi = forConsentedUsersApi;%0A    %7D%0A%0A    @NonNull%0A    public Completable giveConsent(@NonNull String subpopulationGuid, @NonNull String name,%0A                                   @NonNull LocalDate birthdate,%0A                                   @NonNull String base64Image, @NonNull String imageMimeType,%0A                                   @Nullable SharingScope sharingScope) %7B%0A        checkNotNull(subpopulationGuid);%0A        checkNotNull(name);%0A        checkNotNull(birthdate);%0A        checkNotNull(base64Image);%0A        checkNotNull(imageMimeType);%0A%0A        return RxUtils.toBodySingle(forConsentedUsersApi.createConsentSignature%0A                (subpopulationGuid, new ConsentSignature()%0A                        .name(name)%0A                        .birthdate(birthdate)%0A                        .imageData(base64Image)%0A                        .imageMimeType(imageMimeType)%0A                        .scope(sharingScope))).toCompletable();%0A    %7D%0A%0A    @NonNull%0A    public Completable emailConsent(@NonNull String subpopulationGuid) %7B%0A        checkNotNull(subpopulationGuid);%0A        %0A        return RxUtils.toBodySingle(forConsentedUsersApi.emailConsentAgreement(subpopulationGuid))%0A                .toCompletable();%0A    %7D%0A%0A    @NonNull%0A    public Single%3CConsentSignature%3E getConsentSignature(@NonNull String subpopulationGuid) %7B%0A        checkNotNull(subpopulationGuid);%0A%0A        return RxUtils.toBodySingle(forConsentedUsersApi.getConsentSignature(subpopulationGuid));%0A    %7D%0A%0A    @NonNull%0A    public Completable withdrawAll(@Nullable String reason) %7B%0A%0A        return RxUtils.toBodySingle(%0A                forConsentedUsersApi.withdrawAllConsents(%0A                        new Withdrawal().reason(reason)%0A                )).toCompletable();%0A%0A    %7D%0A%0A    @NonNull%0A    public Completable withdrawConsent(@NonNull String subpopulationGuid, @Nullable String reason) %7B%0A        checkNotNull(subpopulationGuid);%0A%0A        return RxUtils.toBodySingle(forConsentedUsersApi.withdrawConsentFromSubpopulation%0A                (subpopulationGuid, new Withdrawal()%0A                        .reason(reason))).toCompletable();%0A    %7D%0A%7D%0A

Implement basic API