Please wait. This can take some minutes ...
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.
com.messente.api.ContactsApi Maven / Gradle / Ivy
/*
* Messente API
* [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
*
* The version of the OpenAPI document: 2.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.messente.api;
import com.messente.ApiCallback;
import com.messente.ApiClient;
import com.messente.ApiException;
import com.messente.ApiResponse;
import com.messente.Configuration;
import com.messente.Pair;
import com.messente.ProgressRequestBody;
import com.messente.ProgressResponseBody;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import com.messente.api.ContactEnvelope;
import com.messente.api.ContactFields;
import com.messente.api.ContactListEnvelope;
import com.messente.api.ContactUpdateFields;
import com.messente.api.ErrorPhonebook;
import com.messente.api.GroupListEnvelope;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ContactsApi {
private ApiClient localVarApiClient;
private int localHostIndex;
private String localCustomBaseUrl;
public ContactsApi() {
this(Configuration.getDefaultApiClient());
}
public ContactsApi(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 addContactToGroup
* @param groupId String in UUID format (required)
* @param phone A phone number (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
201 An empty object -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact or group is missing -
409 Contact already added to group -
0 General error -
*/
public okhttp3.Call addContactToGroupCall(String groupId, String phone, final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };
// 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 = "/phonebook/groups/{groupId}/contacts/{phone}"
.replace("{" + "groupId" + "}", localVarApiClient.escapeString(groupId.toString()))
.replace("{" + "phone" + "}", localVarApiClient.escapeString(phone.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[] { "basicAuth" };
return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call addContactToGroupValidateBeforeCall(String groupId, String phone, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'groupId' is set
if (groupId == null) {
throw new ApiException("Missing the required parameter 'groupId' when calling addContactToGroup(Async)");
}
// verify the required parameter 'phone' is set
if (phone == null) {
throw new ApiException("Missing the required parameter 'phone' when calling addContactToGroup(Async)");
}
return addContactToGroupCall(groupId, phone, _callback);
}
/**
* Adds a contact to a group
*
* @param groupId String in UUID format (required)
* @param phone A phone number (required)
* @return Object
* @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
201 An empty object -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact or group is missing -
409 Contact already added to group -
0 General error -
*/
public Object addContactToGroup(String groupId, String phone) throws ApiException {
ApiResponse localVarResp = addContactToGroupWithHttpInfo(groupId, phone);
return localVarResp.getData();
}
/**
* Adds a contact to a group
*
* @param groupId String in UUID format (required)
* @param phone A phone number (required)
* @return ApiResponse<Object>
* @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
201 An empty object -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact or group is missing -
409 Contact already added to group -
0 General error -
*/
public ApiResponse addContactToGroupWithHttpInfo(String groupId, String phone) throws ApiException {
okhttp3.Call localVarCall = addContactToGroupValidateBeforeCall(groupId, phone, null);
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* Adds a contact to a group (asynchronously)
*
* @param groupId String in UUID format (required)
* @param phone A phone number (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
201 An empty object -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact or group is missing -
409 Contact already added to group -
0 General error -
*/
public okhttp3.Call addContactToGroupAsync(String groupId, String phone, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = addContactToGroupValidateBeforeCall(groupId, phone, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for createContact
* @param contactFields (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
201 An object containing a contact object -
400 Invalid phone number provided -
401 Unauthorized -
409 Contact with phone already created -
0 General error -
*/
public okhttp3.Call createContactCall(ContactFields contactFields, final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };
// Determine Base Path to Use
if (localCustomBaseUrl != null){
basePath = localCustomBaseUrl;
} else if ( localBasePaths.length > 0 ) {
basePath = localBasePaths[localHostIndex];
} else {
basePath = null;
}
Object localVarPostBody = contactFields;
// create path and map variables
String localVarPath = "/phonebook/contacts";
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[] { "basicAuth" };
return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call createContactValidateBeforeCall(ContactFields contactFields, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'contactFields' is set
if (contactFields == null) {
throw new ApiException("Missing the required parameter 'contactFields' when calling createContact(Async)");
}
return createContactCall(contactFields, _callback);
}
/**
* Creates a new contact
*
* @param contactFields (required)
* @return ContactEnvelope
* @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
201 An object containing a contact object -
400 Invalid phone number provided -
401 Unauthorized -
409 Contact with phone already created -
0 General error -
*/
public ContactEnvelope createContact(ContactFields contactFields) throws ApiException {
ApiResponse localVarResp = createContactWithHttpInfo(contactFields);
return localVarResp.getData();
}
/**
* Creates a new contact
*
* @param contactFields (required)
* @return ApiResponse<ContactEnvelope>
* @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
201 An object containing a contact object -
400 Invalid phone number provided -
401 Unauthorized -
409 Contact with phone already created -
0 General error -
*/
public ApiResponse createContactWithHttpInfo(ContactFields contactFields) throws ApiException {
okhttp3.Call localVarCall = createContactValidateBeforeCall(contactFields, null);
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* Creates a new contact (asynchronously)
*
* @param contactFields (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
201 An object containing a contact object -
400 Invalid phone number provided -
401 Unauthorized -
409 Contact with phone already created -
0 General error -
*/
public okhttp3.Call createContactAsync(ContactFields contactFields, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = createContactValidateBeforeCall(contactFields, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for deleteContact
* @param phone A phone number (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
204 Contact deleted -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact missing -
0 General error -
*/
public okhttp3.Call deleteContactCall(String phone, final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };
// 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 = "/phonebook/contacts/{phone}"
.replace("{" + "phone" + "}", localVarApiClient.escapeString(phone.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[] { "basicAuth" };
return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call deleteContactValidateBeforeCall(String phone, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'phone' is set
if (phone == null) {
throw new ApiException("Missing the required parameter 'phone' when calling deleteContact(Async)");
}
return deleteContactCall(phone, _callback);
}
/**
* Deletes a contact
*
* @param phone A phone number (required)
* @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
204 Contact deleted -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact missing -
0 General error -
*/
public void deleteContact(String phone) throws ApiException {
deleteContactWithHttpInfo(phone);
}
/**
* Deletes a contact
*
* @param phone A phone number (required)
* @return ApiResponse<Void>
* @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
204 Contact deleted -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact missing -
0 General error -
*/
public ApiResponse deleteContactWithHttpInfo(String phone) throws ApiException {
okhttp3.Call localVarCall = deleteContactValidateBeforeCall(phone, null);
return localVarApiClient.execute(localVarCall);
}
/**
* Deletes a contact (asynchronously)
*
* @param phone A phone number (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
204 Contact deleted -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact missing -
0 General error -
*/
public okhttp3.Call deleteContactAsync(String phone, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = deleteContactValidateBeforeCall(phone, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
/**
* Build call for fetchContact
* @param phone A phone number (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 An object containing a contact object -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact missing -
*/
public okhttp3.Call fetchContactCall(String phone, final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };
// 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 = "/phonebook/contacts/{phone}"
.replace("{" + "phone" + "}", localVarApiClient.escapeString(phone.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[] { "basicAuth" };
return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call fetchContactValidateBeforeCall(String phone, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'phone' is set
if (phone == null) {
throw new ApiException("Missing the required parameter 'phone' when calling fetchContact(Async)");
}
return fetchContactCall(phone, _callback);
}
/**
* Lists a contact
*
* @param phone A phone number (required)
* @return ContactEnvelope
* @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 An object containing a contact object -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact missing -
*/
public ContactEnvelope fetchContact(String phone) throws ApiException {
ApiResponse localVarResp = fetchContactWithHttpInfo(phone);
return localVarResp.getData();
}
/**
* Lists a contact
*
* @param phone A phone number (required)
* @return ApiResponse<ContactEnvelope>
* @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 An object containing a contact object -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact missing -
*/
public ApiResponse fetchContactWithHttpInfo(String phone) throws ApiException {
okhttp3.Call localVarCall = fetchContactValidateBeforeCall(phone, null);
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* Lists a contact (asynchronously)
*
* @param phone A phone number (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 An object containing a contact object -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact missing -
*/
public okhttp3.Call fetchContactAsync(String phone, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = fetchContactValidateBeforeCall(phone, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for fetchContactGroups
* @param phone A phone number (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 An object containing a list of group objects -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact missing -
*/
public okhttp3.Call fetchContactGroupsCall(String phone, final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };
// 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 = "/phonebook/contacts/{phone}/groups"
.replace("{" + "phone" + "}", localVarApiClient.escapeString(phone.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[] { "basicAuth" };
return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call fetchContactGroupsValidateBeforeCall(String phone, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'phone' is set
if (phone == null) {
throw new ApiException("Missing the required parameter 'phone' when calling fetchContactGroups(Async)");
}
return fetchContactGroupsCall(phone, _callback);
}
/**
* Lists groups of a contact
*
* @param phone A phone number (required)
* @return GroupListEnvelope
* @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 An object containing a list of group objects -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact missing -
*/
public GroupListEnvelope fetchContactGroups(String phone) throws ApiException {
ApiResponse localVarResp = fetchContactGroupsWithHttpInfo(phone);
return localVarResp.getData();
}
/**
* Lists groups of a contact
*
* @param phone A phone number (required)
* @return ApiResponse<GroupListEnvelope>
* @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 An object containing a list of group objects -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact missing -
*/
public ApiResponse fetchContactGroupsWithHttpInfo(String phone) throws ApiException {
okhttp3.Call localVarCall = fetchContactGroupsValidateBeforeCall(phone, null);
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* Lists groups of a contact (asynchronously)
*
* @param phone A phone number (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 An object containing a list of group objects -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact missing -
*/
public okhttp3.Call fetchContactGroupsAsync(String phone, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = fetchContactGroupsValidateBeforeCall(phone, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for fetchContacts
* @param groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional)
* @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 An object containing a list of contact objects -
400 Invalid \"groupIds\" parameters provided -
401 Unauthorized -
0 General error -
*/
public okhttp3.Call fetchContactsCall(List groupIds, final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };
// 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 = "/phonebook/contacts";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
if (groupIds != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "groupIds", groupIds));
}
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[] { "basicAuth" };
return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call fetchContactsValidateBeforeCall(List groupIds, final ApiCallback _callback) throws ApiException {
return fetchContactsCall(groupIds, _callback);
}
/**
* Returns all contacts
*
* @param groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional)
* @return ContactListEnvelope
* @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 An object containing a list of contact objects -
400 Invalid \"groupIds\" parameters provided -
401 Unauthorized -
0 General error -
*/
public ContactListEnvelope fetchContacts(List groupIds) throws ApiException {
ApiResponse localVarResp = fetchContactsWithHttpInfo(groupIds);
return localVarResp.getData();
}
/**
* Returns all contacts
*
* @param groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional)
* @return ApiResponse<ContactListEnvelope>
* @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 An object containing a list of contact objects -
400 Invalid \"groupIds\" parameters provided -
401 Unauthorized -
0 General error -
*/
public ApiResponse fetchContactsWithHttpInfo(List groupIds) throws ApiException {
okhttp3.Call localVarCall = fetchContactsValidateBeforeCall(groupIds, null);
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* Returns all contacts (asynchronously)
*
* @param groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional)
* @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 An object containing a list of contact objects -
400 Invalid \"groupIds\" parameters provided -
401 Unauthorized -
0 General error -
*/
public okhttp3.Call fetchContactsAsync(List groupIds, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = fetchContactsValidateBeforeCall(groupIds, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for removeContactFromGroup
* @param groupId String in UUID format (required)
* @param phone A phone number (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
204 Contact removed from group -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact or group is missing or contact is missing from group -
0 General error -
*/
public okhttp3.Call removeContactFromGroupCall(String groupId, String phone, final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };
// 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 = "/phonebook/groups/{groupId}/contacts/{phone}"
.replace("{" + "groupId" + "}", localVarApiClient.escapeString(groupId.toString()))
.replace("{" + "phone" + "}", localVarApiClient.escapeString(phone.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[] { "basicAuth" };
return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call removeContactFromGroupValidateBeforeCall(String groupId, String phone, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'groupId' is set
if (groupId == null) {
throw new ApiException("Missing the required parameter 'groupId' when calling removeContactFromGroup(Async)");
}
// verify the required parameter 'phone' is set
if (phone == null) {
throw new ApiException("Missing the required parameter 'phone' when calling removeContactFromGroup(Async)");
}
return removeContactFromGroupCall(groupId, phone, _callback);
}
/**
* Removes a contact from a group
*
* @param groupId String in UUID format (required)
* @param phone A phone number (required)
* @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
204 Contact removed from group -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact or group is missing or contact is missing from group -
0 General error -
*/
public void removeContactFromGroup(String groupId, String phone) throws ApiException {
removeContactFromGroupWithHttpInfo(groupId, phone);
}
/**
* Removes a contact from a group
*
* @param groupId String in UUID format (required)
* @param phone A phone number (required)
* @return ApiResponse<Void>
* @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
204 Contact removed from group -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact or group is missing or contact is missing from group -
0 General error -
*/
public ApiResponse removeContactFromGroupWithHttpInfo(String groupId, String phone) throws ApiException {
okhttp3.Call localVarCall = removeContactFromGroupValidateBeforeCall(groupId, phone, null);
return localVarApiClient.execute(localVarCall);
}
/**
* Removes a contact from a group (asynchronously)
*
* @param groupId String in UUID format (required)
* @param phone A phone number (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
204 Contact removed from group -
400 Invalid phone number provided -
401 Unauthorized -
404 Contact or group is missing or contact is missing from group -
0 General error -
*/
public okhttp3.Call removeContactFromGroupAsync(String groupId, String phone, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = removeContactFromGroupValidateBeforeCall(groupId, phone, _callback);
localVarApiClient.executeAsync(localVarCall, _callback);
return localVarCall;
}
/**
* Build call for updateContact
* @param phone A phone number (required)
* @param contactUpdateFields (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 An object containing a contact object -
400 Invalid phone number or empty patch body or unknown fields provided -
401 Unauthorized -
404 Contact missing -
0 General error -
*/
public okhttp3.Call updateContactCall(String phone, ContactUpdateFields contactUpdateFields, final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };
// Determine Base Path to Use
if (localCustomBaseUrl != null){
basePath = localCustomBaseUrl;
} else if ( localBasePaths.length > 0 ) {
basePath = localBasePaths[localHostIndex];
} else {
basePath = null;
}
Object localVarPostBody = contactUpdateFields;
// create path and map variables
String localVarPath = "/phonebook/contacts/{phone}"
.replace("{" + "phone" + "}", localVarApiClient.escapeString(phone.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[] { "basicAuth" };
return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call updateContactValidateBeforeCall(String phone, ContactUpdateFields contactUpdateFields, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'phone' is set
if (phone == null) {
throw new ApiException("Missing the required parameter 'phone' when calling updateContact(Async)");
}
// verify the required parameter 'contactUpdateFields' is set
if (contactUpdateFields == null) {
throw new ApiException("Missing the required parameter 'contactUpdateFields' when calling updateContact(Async)");
}
return updateContactCall(phone, contactUpdateFields, _callback);
}
/**
* Updates a contact
*
* @param phone A phone number (required)
* @param contactUpdateFields (required)
* @return ContactEnvelope
* @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 An object containing a contact object -
400 Invalid phone number or empty patch body or unknown fields provided -
401 Unauthorized -
404 Contact missing -
0 General error -
*/
public ContactEnvelope updateContact(String phone, ContactUpdateFields contactUpdateFields) throws ApiException {
ApiResponse localVarResp = updateContactWithHttpInfo(phone, contactUpdateFields);
return localVarResp.getData();
}
/**
* Updates a contact
*
* @param phone A phone number (required)
* @param contactUpdateFields (required)
* @return ApiResponse<ContactEnvelope>
* @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 An object containing a contact object -
400 Invalid phone number or empty patch body or unknown fields provided -
401 Unauthorized -
404 Contact missing -
0 General error -
*/
public ApiResponse updateContactWithHttpInfo(String phone, ContactUpdateFields contactUpdateFields) throws ApiException {
okhttp3.Call localVarCall = updateContactValidateBeforeCall(phone, contactUpdateFields, null);
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* Updates a contact (asynchronously)
*
* @param phone A phone number (required)
* @param contactUpdateFields (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 An object containing a contact object -
400 Invalid phone number or empty patch body or unknown fields provided -
401 Unauthorized -
404 Contact missing -
0 General error -
*/
public okhttp3.Call updateContactAsync(String phone, ContactUpdateFields contactUpdateFields, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = updateContactValidateBeforeCall(phone, contactUpdateFields, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
}