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

com.univapay.sdk.builders.authentication.AuthenticationBuilders Maven / Gradle / Ivy

There is a newer version: 0.2.35
Show newest version
package com.univapay.sdk.builders.authentication;

import com.univapay.sdk.builders.authentication.AbstractAuthenticationBuilders.AbstractLoginRequestBuilder;
import com.univapay.sdk.builders.authentication.AbstractAuthenticationBuilders.AbstractLogoutRequestBuilder;
import com.univapay.sdk.models.common.EmailAddress;
import com.univapay.sdk.models.common.Void;
import com.univapay.sdk.models.request.authentication.AuthenticationRequestData;
import com.univapay.sdk.models.response.authentication.LoginTokenInfo;
import com.univapay.sdk.resources.AuthenticationResource;
import retrofit2.Call;
import retrofit2.Retrofit;

public abstract class AuthenticationBuilders {

  public static class LoginRequestBuilder
      extends AbstractLoginRequestBuilder<
          LoginRequestBuilder, AuthenticationResource, LoginTokenInfo> {
    public LoginRequestBuilder(Retrofit retrofit, EmailAddress email, String password) {
      super(retrofit, email, password);
    }

    @Override
    protected Call getRequest(AuthenticationResource resource) {
      return resource.getLoginToken(new AuthenticationRequestData(email, password));
    }
  }

  public static class LogoutRequestBuilder
      extends AbstractLogoutRequestBuilder {
    public LogoutRequestBuilder(Retrofit retrofit) {
      super(retrofit);
    }

    @Override
    protected Call getRequest(AuthenticationResource resource) {
      return resource.deleteAuthToken();
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy