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

com.sinch.sdk.domains.verification.adapters.VerificationStatusService Maven / Gradle / Ivy

There is a newer version: 1.4.0
Show newest version
package com.sinch.sdk.domains.verification.adapters;

import com.sinch.sdk.core.http.AuthManager;
import com.sinch.sdk.core.http.HttpClient;
import com.sinch.sdk.core.http.HttpMapper;
import com.sinch.sdk.domains.verification.adapters.api.v1.QueryVerificationsApi;
import com.sinch.sdk.domains.verification.adapters.converters.VerificationsDtoConverter;
import com.sinch.sdk.domains.verification.models.NumberIdentity;
import com.sinch.sdk.domains.verification.models.VerificationId;
import com.sinch.sdk.domains.verification.models.VerificationMethodType;
import com.sinch.sdk.domains.verification.models.VerificationReference;
import com.sinch.sdk.domains.verification.models.VerificationReport;
import com.sinch.sdk.models.Configuration;
import java.util.Map;

public class VerificationStatusService
    implements com.sinch.sdk.domains.verification.VerificationStatusService {

  private final QueryVerificationsApi api;

  public VerificationStatusService(
      Configuration configuration, HttpClient httpClient, Map authManagers) {
    this.api =
        new QueryVerificationsApi(
            httpClient, configuration.getVerificationServer(), authManagers, new HttpMapper());
  }

  protected QueryVerificationsApi getApi() {
    return this.api;
  }

  public VerificationReport get(NumberIdentity identity, VerificationMethodType method) {

    return VerificationsDtoConverter.convert(
        getApi().verificationStatusByIdentity("number", identity.getEndpoint(), method.value()));
  }

  public VerificationReport get(VerificationId id) {

    return VerificationsDtoConverter.convert(getApi().verificationStatusById(id.getId()));
  }

  public VerificationReport get(VerificationReference reference) {

    return VerificationsDtoConverter.convert(
        getApi().verificationStatusByReference(reference.getReference()));
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy