Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* 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.CreateLookupResponse;
import com.bandwidth.sdk.model.LookupRequest;
import com.bandwidth.sdk.model.LookupStatus;
import com.bandwidth.sdk.model.TnLookupRequestError;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class PhoneNumberLookupApi {
private ApiClient localVarApiClient;
private int localHostIndex;
private String localCustomBaseUrl;
public PhoneNumberLookupApi() {
this(Configuration.getDefaultApiClient());
}
public PhoneNumberLookupApi(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 createLookup
* @param accountId Your Bandwidth Account ID. (required)
* @param lookupRequest Phone number lookup request. (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
202
Accepted
-
400
Bad Request
-
401
Unauthorized
-
403
Forbidden
-
415
Unsupported Media Type
-
429
Too Many Requests
-
500
Internal Server Error
-
*/
public okhttp3.Call createLookupCall(String accountId, LookupRequest lookupRequest, final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { "https://numbers.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 = lookupRequest;
// create path and map variables
String localVarPath = "/accounts/{accountId}/tnlookup"
.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 createLookupValidateBeforeCall(String accountId, LookupRequest lookupRequest, 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 createLookup(Async)");
}
// verify the required parameter 'lookupRequest' is set
if (lookupRequest == null) {
throw new ApiException("Missing the required parameter 'lookupRequest' when calling createLookup(Async)");
}
return createLookupCall(accountId, lookupRequest, _callback);
}
/**
* Create Lookup
* Create a Phone Number Lookup Request.
* @param accountId Your Bandwidth Account ID. (required)
* @param lookupRequest Phone number lookup request. (required)
* @return CreateLookupResponse
* @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
202
Accepted
-
400
Bad Request
-
401
Unauthorized
-
403
Forbidden
-
415
Unsupported Media Type
-
429
Too Many Requests
-
500
Internal Server Error
-
*/
public CreateLookupResponse createLookup(String accountId, LookupRequest lookupRequest) throws ApiException {
ApiResponse localVarResp = createLookupWithHttpInfo(accountId, lookupRequest);
return localVarResp.getData();
}
/**
* Create Lookup
* Create a Phone Number Lookup Request.
* @param accountId Your Bandwidth Account ID. (required)
* @param lookupRequest Phone number lookup request. (required)
* @return ApiResponse<CreateLookupResponse>
* @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
202
Accepted
-
400
Bad Request
-
401
Unauthorized
-
403
Forbidden
-
415
Unsupported Media Type
-
429
Too Many Requests
-
500
Internal Server Error
-
*/
public ApiResponse createLookupWithHttpInfo(String accountId, LookupRequest lookupRequest) throws ApiException {
okhttp3.Call localVarCall = createLookupValidateBeforeCall(accountId, lookupRequest, null);
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* Create Lookup (asynchronously)
* Create a Phone Number Lookup Request.
* @param accountId Your Bandwidth Account ID. (required)
* @param lookupRequest Phone number lookup request. (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
202
Accepted
-
400
Bad Request
-
401
Unauthorized
-
403
Forbidden
-
415
Unsupported Media Type
-
429
Too Many Requests
-
500
Internal Server Error
-
*/
public okhttp3.Call createLookupAsync(String accountId, LookupRequest lookupRequest, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = createLookupValidateBeforeCall(accountId, lookupRequest, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for getLookupStatus
* @param accountId Your Bandwidth Account ID. (required)
* @param requestId The phone number lookup request ID from Bandwidth. (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
-
404
Not Found
-
429
Too Many Requests
-
500
Internal Server Error
-
*/
public okhttp3.Call getLookupStatusCall(String accountId, String requestId, final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { "https://numbers.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 = null;
// create path and map variables
String localVarPath = "/accounts/{accountId}/tnlookup/{requestId}"
.replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString()))
.replace("{" + "requestId" + "}", localVarApiClient.escapeString(requestId.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 = {
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
localVarHeaderParams.put("Content-Type", localVarContentType);
}
String[] localVarAuthNames = new String[] { "Basic" };
return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getLookupStatusValidateBeforeCall(String accountId, String requestId, 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 getLookupStatus(Async)");
}
// verify the required parameter 'requestId' is set
if (requestId == null) {
throw new ApiException("Missing the required parameter 'requestId' when calling getLookupStatus(Async)");
}
return getLookupStatusCall(accountId, requestId, _callback);
}
/**
* Get Lookup Request Status
* Get an existing Phone Number Lookup Request.
* @param accountId Your Bandwidth Account ID. (required)
* @param requestId The phone number lookup request ID from Bandwidth. (required)
* @return LookupStatus
* @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
-
404
Not Found
-
429
Too Many Requests
-
500
Internal Server Error
-
*/
public LookupStatus getLookupStatus(String accountId, String requestId) throws ApiException {
ApiResponse localVarResp = getLookupStatusWithHttpInfo(accountId, requestId);
return localVarResp.getData();
}
/**
* Get Lookup Request Status
* Get an existing Phone Number Lookup Request.
* @param accountId Your Bandwidth Account ID. (required)
* @param requestId The phone number lookup request ID from Bandwidth. (required)
* @return ApiResponse<LookupStatus>
* @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
-
404
Not Found
-
429
Too Many Requests
-
500
Internal Server Error
-
*/
public ApiResponse getLookupStatusWithHttpInfo(String accountId, String requestId) throws ApiException {
okhttp3.Call localVarCall = getLookupStatusValidateBeforeCall(accountId, requestId, null);
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* Get Lookup Request Status (asynchronously)
* Get an existing Phone Number Lookup Request.
* @param accountId Your Bandwidth Account ID. (required)
* @param requestId The phone number lookup request ID from Bandwidth. (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
-
404
Not Found
-
429
Too Many Requests
-
500
Internal Server Error
-
*/
public okhttp3.Call getLookupStatusAsync(String accountId, String requestId, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = getLookupStatusValidateBeforeCall(accountId, requestId, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
}