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

com.mypurecloud.sdk.api.ScriptsApi 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.ScriptEntityListing;
import com.mypurecloud.sdk.model.ErrorBody;
import com.mypurecloud.sdk.model.Script;
import com.mypurecloud.sdk.model.Page;


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


public class ScriptsApi {
  private ApiClient pcapiClient;

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

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

  public ApiClient getApiClient() {
    return pcapiClient;
  }

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

  /**
   * Get the published scripts.
   * 
   * @param pageSize Page size (optional, default to 25)
   * @param pageNumber Page number (optional, default to 1)
   * @param expand Expand (optional)
   * @param name Name filter (optional)
   * @param feature Feature filter (optional)
   * @param flowId Secure flow id filter (optional)
   * @return ScriptEntityListing
   * @throws ApiException if fails to make API call
   */
  public ScriptEntityListing getPublished(Integer pageSize, Integer pageNumber, String expand, String name, String feature, String flowId) throws ApiException {
    return getPublishedWithHttpInfo(pageSize, pageNumber, expand, name, feature, flowId).getResponseObject();
  }

  /**
   * Get the published scripts.
   * 
   * @param pageSize Page size (optional, default to 25)
   * @param pageNumber Page number (optional, default to 1)
   * @param expand Expand (optional)
   * @param name Name filter (optional)
   * @param feature Feature filter (optional)
   * @param flowId Secure flow id filter (optional)
   * @return ScriptEntityListing
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getPublishedWithHttpInfo(Integer pageSize, Integer pageNumber, String expand, String name, String feature, String flowId) throws ApiException {
    Object pclocalVarPostBody = null;
    
    // create path and map variables
    String pclocalVarPath = "/api/v2/scripts/published".replaceAll("\\{format\\}","json");

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

    pclocalVarQueryParams.addAll(pcapiClient.parameterToPairs("", "pageSize", pageSize));
    pclocalVarQueryParams.addAll(pcapiClient.parameterToPairs("", "pageNumber", pageNumber));
    pclocalVarQueryParams.addAll(pcapiClient.parameterToPairs("", "expand", expand));
    pclocalVarQueryParams.addAll(pcapiClient.parameterToPairs("", "name", name));
    pclocalVarQueryParams.addAll(pcapiClient.parameterToPairs("", "feature", feature));
    pclocalVarQueryParams.addAll(pcapiClient.parameterToPairs("", "flowId", flowId));

    
    
    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 the published script.
   * 
   * @param scriptId Script ID (required)
   * @return Script
   * @throws ApiException if fails to make API call
   */
  public Script getPublishedScriptId(String scriptId) throws ApiException {
    return getPublishedScriptIdWithHttpInfo(scriptId).getResponseObject();
  }

  /**
   * Get the published script.
   * 
   * @param scriptId Script ID (required)
   * @return Script
   * @throws ApiException if fails to make API call
   */
  public ApiResponse