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

com.bandwidth.sdk.api.MfaApi Maven / Gradle / Ivy

Go to download

The official client SDK for Bandwidth's Voice, Messaging, MFA, and WebRTC APIs

The newest version!
/*
 * Bandwidth
 * Bandwidth's Communication APIs
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: [email protected]
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package com.bandwidth.sdk.api;

import com.bandwidth.sdk.ApiCallback;
import com.bandwidth.sdk.ApiClient;
import com.bandwidth.sdk.ApiException;
import com.bandwidth.sdk.ApiResponse;
import com.bandwidth.sdk.Configuration;
import com.bandwidth.sdk.Pair;
import com.bandwidth.sdk.ProgressRequestBody;
import com.bandwidth.sdk.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import com.bandwidth.sdk.model.CodeRequest;
import com.bandwidth.sdk.model.MessagingCodeResponse;
import com.bandwidth.sdk.model.MfaForbiddenRequestError;
import com.bandwidth.sdk.model.MfaRequestError;
import com.bandwidth.sdk.model.MfaUnauthorizedRequestError;
import com.bandwidth.sdk.model.VerifyCodeRequest;
import com.bandwidth.sdk.model.VerifyCodeResponse;
import com.bandwidth.sdk.model.VoiceCodeResponse;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class MfaApi {
    private ApiClient localVarApiClient;
    private int localHostIndex;
    private String localCustomBaseUrl;

    public MfaApi() {
        this(Configuration.getDefaultApiClient());
    }

    public MfaApi(ApiClient apiClient) {
        this.localVarApiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return localVarApiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.localVarApiClient = apiClient;
    }

    public int getHostIndex() {
        return localHostIndex;
    }

    public void setHostIndex(int hostIndex) {
        this.localHostIndex = hostIndex;
    }

    public String getCustomBaseUrl() {
        return localCustomBaseUrl;
    }

    public void setCustomBaseUrl(String customBaseUrl) {
        this.localCustomBaseUrl = customBaseUrl;
    }

    /**
     * Build call for generateMessagingCode
     * @param accountId Your Bandwidth Account ID. (required)
     * @param codeRequest MFA code request body. (required)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
500 Internal Server Error -
*/ public okhttp3.Call generateMessagingCodeCall(String accountId, CodeRequest codeRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { "https://mfa.bandwidth.com/api/v1" }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = codeRequest; // create path and map variables String localVarPath = "/accounts/{accountId}/code/messaging" .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "Basic" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call generateMessagingCodeValidateBeforeCall(String accountId, CodeRequest codeRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException("Missing the required parameter 'accountId' when calling generateMessagingCode(Async)"); } // verify the required parameter 'codeRequest' is set if (codeRequest == null) { throw new ApiException("Missing the required parameter 'codeRequest' when calling generateMessagingCode(Async)"); } return generateMessagingCodeCall(accountId, codeRequest, _callback); } /** * Messaging Authentication Code * Send an MFA code via text message (SMS). * @param accountId Your Bandwidth Account ID. (required) * @param codeRequest MFA code request body. (required) * @return MessagingCodeResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
500 Internal Server Error -
*/ public MessagingCodeResponse generateMessagingCode(String accountId, CodeRequest codeRequest) throws ApiException { ApiResponse localVarResp = generateMessagingCodeWithHttpInfo(accountId, codeRequest); return localVarResp.getData(); } /** * Messaging Authentication Code * Send an MFA code via text message (SMS). * @param accountId Your Bandwidth Account ID. (required) * @param codeRequest MFA code request body. (required) * @return ApiResponse<MessagingCodeResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
500 Internal Server Error -
*/ public ApiResponse generateMessagingCodeWithHttpInfo(String accountId, CodeRequest codeRequest) throws ApiException { okhttp3.Call localVarCall = generateMessagingCodeValidateBeforeCall(accountId, codeRequest, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Messaging Authentication Code (asynchronously) * Send an MFA code via text message (SMS). * @param accountId Your Bandwidth Account ID. (required) * @param codeRequest MFA code request body. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
500 Internal Server Error -
*/ public okhttp3.Call generateMessagingCodeAsync(String accountId, CodeRequest codeRequest, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = generateMessagingCodeValidateBeforeCall(accountId, codeRequest, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for generateVoiceCode * @param accountId Your Bandwidth Account ID. (required) * @param codeRequest MFA code request body. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
500 Internal Server Error -
*/ public okhttp3.Call generateVoiceCodeCall(String accountId, CodeRequest codeRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { "https://mfa.bandwidth.com/api/v1" }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = codeRequest; // create path and map variables String localVarPath = "/accounts/{accountId}/code/voice" .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "Basic" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call generateVoiceCodeValidateBeforeCall(String accountId, CodeRequest codeRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException("Missing the required parameter 'accountId' when calling generateVoiceCode(Async)"); } // verify the required parameter 'codeRequest' is set if (codeRequest == null) { throw new ApiException("Missing the required parameter 'codeRequest' when calling generateVoiceCode(Async)"); } return generateVoiceCodeCall(accountId, codeRequest, _callback); } /** * Voice Authentication Code * Send an MFA Code via a phone call. * @param accountId Your Bandwidth Account ID. (required) * @param codeRequest MFA code request body. (required) * @return VoiceCodeResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
500 Internal Server Error -
*/ public VoiceCodeResponse generateVoiceCode(String accountId, CodeRequest codeRequest) throws ApiException { ApiResponse localVarResp = generateVoiceCodeWithHttpInfo(accountId, codeRequest); return localVarResp.getData(); } /** * Voice Authentication Code * Send an MFA Code via a phone call. * @param accountId Your Bandwidth Account ID. (required) * @param codeRequest MFA code request body. (required) * @return ApiResponse<VoiceCodeResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
500 Internal Server Error -
*/ public ApiResponse generateVoiceCodeWithHttpInfo(String accountId, CodeRequest codeRequest) throws ApiException { okhttp3.Call localVarCall = generateVoiceCodeValidateBeforeCall(accountId, codeRequest, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Voice Authentication Code (asynchronously) * Send an MFA Code via a phone call. * @param accountId Your Bandwidth Account ID. (required) * @param codeRequest MFA code request body. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
500 Internal Server Error -
*/ public okhttp3.Call generateVoiceCodeAsync(String accountId, CodeRequest codeRequest, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = generateVoiceCodeValidateBeforeCall(accountId, codeRequest, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for verifyCode * @param accountId Your Bandwidth Account ID. (required) * @param verifyCodeRequest MFA code verify request body. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too Many Requests -
500 Internal Server Error -
*/ public okhttp3.Call verifyCodeCall(String accountId, VerifyCodeRequest verifyCodeRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { "https://mfa.bandwidth.com/api/v1" }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = verifyCodeRequest; // create path and map variables String localVarPath = "/accounts/{accountId}/code/verify" .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "Basic" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call verifyCodeValidateBeforeCall(String accountId, VerifyCodeRequest verifyCodeRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException("Missing the required parameter 'accountId' when calling verifyCode(Async)"); } // verify the required parameter 'verifyCodeRequest' is set if (verifyCodeRequest == null) { throw new ApiException("Missing the required parameter 'verifyCodeRequest' when calling verifyCode(Async)"); } return verifyCodeCall(accountId, verifyCodeRequest, _callback); } /** * Verify Authentication Code * Verify a previously sent MFA code. * @param accountId Your Bandwidth Account ID. (required) * @param verifyCodeRequest MFA code verify request body. (required) * @return VerifyCodeResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too Many Requests -
500 Internal Server Error -
*/ public VerifyCodeResponse verifyCode(String accountId, VerifyCodeRequest verifyCodeRequest) throws ApiException { ApiResponse localVarResp = verifyCodeWithHttpInfo(accountId, verifyCodeRequest); return localVarResp.getData(); } /** * Verify Authentication Code * Verify a previously sent MFA code. * @param accountId Your Bandwidth Account ID. (required) * @param verifyCodeRequest MFA code verify request body. (required) * @return ApiResponse<VerifyCodeResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too Many Requests -
500 Internal Server Error -
*/ public ApiResponse verifyCodeWithHttpInfo(String accountId, VerifyCodeRequest verifyCodeRequest) throws ApiException { okhttp3.Call localVarCall = verifyCodeValidateBeforeCall(accountId, verifyCodeRequest, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Verify Authentication Code (asynchronously) * Verify a previously sent MFA code. * @param accountId Your Bandwidth Account ID. (required) * @param verifyCodeRequest MFA code verify request body. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too Many Requests -
500 Internal Server Error -
*/ public okhttp3.Call verifyCodeAsync(String accountId, VerifyCodeRequest verifyCodeRequest, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = verifyCodeValidateBeforeCall(accountId, verifyCodeRequest, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy