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

com.mypurecloud.sdk.api.OrganizationApi 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.FieldConfig;
import com.mypurecloud.sdk.model.Organization;
import com.mypurecloud.sdk.model.OrganizationFeatures;
import com.mypurecloud.sdk.model.FeatureState;


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


public class OrganizationApi {
  private ApiClient pcapiClient;

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

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

  public ApiClient getApiClient() {
    return pcapiClient;
  }

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

  /**
   * Fetch field config for an entity type
   * 
   * @param type Field type (required)
   * @return FieldConfig
   * @throws ApiException if fails to make API call
   */
  public FieldConfig getFieldconfig(String type) throws ApiException {
    return getFieldconfigWithHttpInfo(type).getResponseObject();
  }

  /**
   * Fetch field config for an entity type
   * 
   * @param type Field type (required)
   * @return FieldConfig
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getFieldconfigWithHttpInfo(String type) throws ApiException {
    Object pclocalVarPostBody = null;
    
    // verify the required parameter 'type' is set
    if (type == null) {
      throw new ApiException(400, "Missing the required parameter 'type' when calling getFieldconfig");
    }
    
    // create path and map variables
    String pclocalVarPath = "/api/v2/fieldconfig".replaceAll("\\{format\\}","json");

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

    pclocalVarQueryParams.addAll(pcapiClient.parameterToPairs("", "type", type));

    
    
    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 organization.
   * 
   * @return Organization
   * @throws ApiException if fails to make API call
   */
  public Organization getMe() throws ApiException {
    return getMeWithHttpInfo().getResponseObject();
  }

  /**
   * Get organization.
   * 
   * @return Organization
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getMeWithHttpInfo() throws ApiException {
    Object pclocalVarPostBody = null;
    
    // create path and map variables
    String pclocalVarPath = "/api/v2/organizations/me".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() {});
  }
  /**
   * Update organization
   * 
   * @param featureName Organization feature (required)
   * @param enabled New state of feature (required)
   * @return OrganizationFeatures
   * @throws ApiException if fails to make API call
   */
  public OrganizationFeatures patchFeaturesFeaturename(String featureName, FeatureState enabled) throws ApiException {
    return patchFeaturesFeaturenameWithHttpInfo(featureName, enabled).getResponseObject();
  }

  /**
   * Update organization
   * 
   * @param featureName Organization feature (required)
   * @param enabled New state of feature (required)
   * @return OrganizationFeatures
   * @throws ApiException if fails to make API call
   */
  public ApiResponse patchFeaturesFeaturenameWithHttpInfo(String featureName, FeatureState enabled) throws ApiException {
    Object pclocalVarPostBody = enabled;
    
    // verify the required parameter 'featureName' is set
    if (featureName == null) {
      throw new ApiException(400, "Missing the required parameter 'featureName' when calling patchFeaturesFeaturename");
    }
    
    // verify the required parameter 'enabled' is set
    if (enabled == null) {
      throw new ApiException(400, "Missing the required parameter 'enabled' when calling patchFeaturesFeaturename");
    }
    
    // create path and map variables
    String pclocalVarPath = "/api/v2/organizations/features/{featureName}".replaceAll("\\{format\\}","json")
      .replaceAll("\\{" + "featureName" + "\\}", pcapiClient.escapeString(featureName.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() {});
  }
  /**
   * Update organization.
   * 
   * @param body Organization (optional)
   * @return Organization
   * @throws ApiException if fails to make API call
   */
  public Organization putMe(Organization body) throws ApiException {
    return putMeWithHttpInfo(body).getResponseObject();
  }

  /**
   * Update organization.
   * 
   * @param body Organization (optional)
   * @return Organization
   * @throws ApiException if fails to make API call
   */
  public ApiResponse putMeWithHttpInfo(Organization body) throws ApiException {
    Object pclocalVarPostBody = body;
    
    // create path and map variables
    String pclocalVarPath = "/api/v2/organizations/me".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, "PUT", pclocalVarQueryParams, pclocalVarPostBody, pclocalVarHeaderParams, pclocalVarFormParams, pclocalVarAccept, pclocalVarContentType, pclocalVarAuthNames, new TypeReference() {});
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy