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

com.mypurecloud.sdk.api.GeolocationApi Maven / Gradle / Ivy

The newest version!
package com.mypurecloud.sdk.api;

import com.fasterxml.jackson.core.type.TypeReference;

import com.mypurecloud.sdk.ApiException;
import com.mypurecloud.sdk.ApiClient;
import com.mypurecloud.sdk.ApiResponse;
import com.mypurecloud.sdk.Configuration;
import com.mypurecloud.sdk.model.*;
import com.mypurecloud.sdk.Pair;

import com.mypurecloud.sdk.model.ErrorBody;
import com.mypurecloud.sdk.model.GeolocationSettings;
import com.mypurecloud.sdk.model.Geolocation;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


public class GeolocationApi {
  private ApiClient pcapiClient;

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

  public GeolocationApi(ApiClient apiClient) {
    this.pcapiClient = apiClient;
  }

  public ApiClient getApiClient() {
    return pcapiClient;
  }

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

  /**
   * Get a organization's GeolocationSettings
   * 
   * @return GeolocationSettings
   * @throws ApiException if fails to make API call
   */
  public GeolocationSettings getSettings() throws ApiException {
    return getSettingsWithHttpInfo().getResponseObject();
  }

  /**
   * Get a organization's GeolocationSettings
   * 
   * @return GeolocationSettings
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getSettingsWithHttpInfo() throws ApiException {
    Object pclocalVarPostBody = null;
    
    // create path and map variables
    String pclocalVarPath = "/api/v2/geolocations/settings".replaceAll("\\{format\\}","json");

    // query params
    List pclocalVarQueryParams = new ArrayList();
    Map pclocalVarHeaderParams = new HashMap();
    Map pclocalVarFormParams = new HashMap();


    
    
    final String[] pclocalVarAccepts = {
      "application/json"
    };
    final String pclocalVarAccept = pcapiClient.selectHeaderAccept(pclocalVarAccepts);

    final String[] pclocalVarContentTypes = {
      "application/json"
    };
    final String pclocalVarContentType = pcapiClient.selectHeaderContentType(pclocalVarContentTypes);

    String[] pclocalVarAuthNames = new String[] { "PureCloud Auth" };

    return pcapiClient.invokeAPIVerbose(pclocalVarPath, "GET", pclocalVarQueryParams, pclocalVarPostBody, pclocalVarHeaderParams, pclocalVarFormParams, pclocalVarAccept, pclocalVarContentType, pclocalVarAuthNames, new TypeReference() {});
  }
  /**
   * Get a user's Geolocation
   * 
   * @param userId user Id (required)
   * @param clientId client Id (required)
   * @return Geolocation
   * @throws ApiException if fails to make API call
   */
  public Geolocation getUserIdGeolocationsClientId(String userId, String clientId) throws ApiException {
    return getUserIdGeolocationsClientIdWithHttpInfo(userId, clientId).getResponseObject();
  }

  /**
   * Get a user's Geolocation
   * 
   * @param userId user Id (required)
   * @param clientId client Id (required)
   * @return Geolocation
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getUserIdGeolocationsClientIdWithHttpInfo(String userId, String clientId) throws ApiException {
    Object pclocalVarPostBody = null;
    
    // verify the required parameter 'userId' is set
    if (userId == null) {
      throw new ApiException(400, "Missing the required parameter 'userId' when calling getUserIdGeolocationsClientId");
    }
    
    // verify the required parameter 'clientId' is set
    if (clientId == null) {
      throw new ApiException(400, "Missing the required parameter 'clientId' when calling getUserIdGeolocationsClientId");
    }
    
    // create path and map variables
    String pclocalVarPath = "/api/v2/users/{userId}/geolocations/{clientId}".replaceAll("\\{format\\}","json")
      .replaceAll("\\{" + "userId" + "\\}", pcapiClient.escapeString(userId.toString()))
      .replaceAll("\\{" + "clientId" + "\\}", pcapiClient.escapeString(clientId.toString()));

    // query params
    List pclocalVarQueryParams = new ArrayList();
    Map pclocalVarHeaderParams = new HashMap();
    Map pclocalVarFormParams = new HashMap();


    
    
    final String[] pclocalVarAccepts = {
      "application/json"
    };
    final String pclocalVarAccept = pcapiClient.selectHeaderAccept(pclocalVarAccepts);

    final String[] pclocalVarContentTypes = {
      "application/json"
    };
    final String pclocalVarContentType = pcapiClient.selectHeaderContentType(pclocalVarContentTypes);

    String[] pclocalVarAuthNames = new String[] { "PureCloud Auth" };

    return pcapiClient.invokeAPIVerbose(pclocalVarPath, "GET", pclocalVarQueryParams, pclocalVarPostBody, pclocalVarHeaderParams, pclocalVarFormParams, pclocalVarAccept, pclocalVarContentType, pclocalVarAuthNames, new TypeReference() {});
  }
  /**
   * Patch a organization's GeolocationSettings
   * 
   * @param body Geolocation settings (required)
   * @return GeolocationSettings
   * @throws ApiException if fails to make API call
   */
  public GeolocationSettings patchSettings(GeolocationSettings body) throws ApiException {
    return patchSettingsWithHttpInfo(body).getResponseObject();
  }

  /**
   * Patch a organization's GeolocationSettings
   * 
   * @param body Geolocation settings (required)
   * @return GeolocationSettings
   * @throws ApiException if fails to make API call
   */
  public ApiResponse patchSettingsWithHttpInfo(GeolocationSettings body) throws ApiException {
    Object pclocalVarPostBody = body;
    
    // verify the required parameter 'body' is set
    if (body == null) {
      throw new ApiException(400, "Missing the required parameter 'body' when calling patchSettings");
    }
    
    // create path and map variables
    String pclocalVarPath = "/api/v2/geolocations/settings".replaceAll("\\{format\\}","json");

    // query params
    List pclocalVarQueryParams = new ArrayList();
    Map pclocalVarHeaderParams = new HashMap();
    Map pclocalVarFormParams = new HashMap();


    
    
    final String[] pclocalVarAccepts = {
      "application/json"
    };
    final String pclocalVarAccept = pcapiClient.selectHeaderAccept(pclocalVarAccepts);

    final String[] pclocalVarContentTypes = {
      "application/json"
    };
    final String pclocalVarContentType = pcapiClient.selectHeaderContentType(pclocalVarContentTypes);

    String[] pclocalVarAuthNames = new String[] { "PureCloud Auth" };

    return pcapiClient.invokeAPIVerbose(pclocalVarPath, "PATCH", pclocalVarQueryParams, pclocalVarPostBody, pclocalVarHeaderParams, pclocalVarFormParams, pclocalVarAccept, pclocalVarContentType, pclocalVarAuthNames, new TypeReference() {});
  }
  /**
   * Patch a user's Geolocation
   * The geolocation object can be patched one of three ways. Option 1: Set the 'primary' property to true. This will set the client as the user's primary geolocation source.  Option 2: Provide the 'latitude' and 'longitude' values.  This will enqueue an asynchronous update of the 'city', 'region', and 'country', generating a notification. A subsequent GET operation will include the new values for 'city', 'region' and 'country'.  Option 3:  Provide the 'city', 'region', 'country' values.  Option 1 can be combined with Option 2 or Option 3.  For example, update the client as primary and provide latitude and longitude values.
   * @param userId user Id (required)
   * @param clientId client Id (required)
   * @param body Geolocation (required)
   * @return Geolocation
   * @throws ApiException if fails to make API call
   */
  public Geolocation patchUserIdGeolocationsClientId(String userId, String clientId, Geolocation body) throws ApiException {
    return patchUserIdGeolocationsClientIdWithHttpInfo(userId, clientId, body).getResponseObject();
  }

  /**
   * Patch a user's Geolocation
   * The geolocation object can be patched one of three ways. Option 1: Set the 'primary' property to true. This will set the client as the user's primary geolocation source.  Option 2: Provide the 'latitude' and 'longitude' values.  This will enqueue an asynchronous update of the 'city', 'region', and 'country', generating a notification. A subsequent GET operation will include the new values for 'city', 'region' and 'country'.  Option 3:  Provide the 'city', 'region', 'country' values.  Option 1 can be combined with Option 2 or Option 3.  For example, update the client as primary and provide latitude and longitude values.
   * @param userId user Id (required)
   * @param clientId client Id (required)
   * @param body Geolocation (required)
   * @return Geolocation
   * @throws ApiException if fails to make API call
   */
  public ApiResponse patchUserIdGeolocationsClientIdWithHttpInfo(String userId, String clientId, Geolocation body) throws ApiException {
    Object pclocalVarPostBody = body;
    
    // verify the required parameter 'userId' is set
    if (userId == null) {
      throw new ApiException(400, "Missing the required parameter 'userId' when calling patchUserIdGeolocationsClientId");
    }
    
    // verify the required parameter 'clientId' is set
    if (clientId == null) {
      throw new ApiException(400, "Missing the required parameter 'clientId' when calling patchUserIdGeolocationsClientId");
    }
    
    // verify the required parameter 'body' is set
    if (body == null) {
      throw new ApiException(400, "Missing the required parameter 'body' when calling patchUserIdGeolocationsClientId");
    }
    
    // create path and map variables
    String pclocalVarPath = "/api/v2/users/{userId}/geolocations/{clientId}".replaceAll("\\{format\\}","json")
      .replaceAll("\\{" + "userId" + "\\}", pcapiClient.escapeString(userId.toString()))
      .replaceAll("\\{" + "clientId" + "\\}", pcapiClient.escapeString(clientId.toString()));

    // query params
    List pclocalVarQueryParams = new ArrayList();
    Map pclocalVarHeaderParams = new HashMap();
    Map pclocalVarFormParams = new HashMap();


    
    
    final String[] pclocalVarAccepts = {
      "application/json"
    };
    final String pclocalVarAccept = pcapiClient.selectHeaderAccept(pclocalVarAccepts);

    final String[] pclocalVarContentTypes = {
      "application/json"
    };
    final String pclocalVarContentType = pcapiClient.selectHeaderContentType(pclocalVarContentTypes);

    String[] pclocalVarAuthNames = new String[] { "PureCloud Auth" };

    return pcapiClient.invokeAPIVerbose(pclocalVarPath, "PATCH", pclocalVarQueryParams, pclocalVarPostBody, pclocalVarHeaderParams, pclocalVarFormParams, pclocalVarAccept, pclocalVarContentType, pclocalVarAuthNames, new TypeReference() {});
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy