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

com.factset.sdk.FactSetFundamentals.api.BatchProcessingApi Maven / Gradle / Ivy

There is a newer version: 3.1.1
Show newest version
package com.factset.sdk.FactSetFundamentals.api;

import com.factset.sdk.FactSetFundamentals.ApiException;
import com.factset.sdk.FactSetFundamentals.ApiClient;
import com.factset.sdk.FactSetFundamentals.ApiResponse;
import com.factset.sdk.FactSetFundamentals.Configuration;
import com.factset.sdk.FactSetFundamentals.Pair;

import jakarta.ws.rs.core.GenericType;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

import com.factset.sdk.FactSetFundamentals.models.BatchResultResponse;
import com.factset.sdk.FactSetFundamentals.models.BatchStatusResponse;
import com.factset.sdk.FactSetFundamentals.models.ErrorResponse;

@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")

public class BatchProcessingApi {
  private ApiClient apiClient;

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

  public BatchProcessingApi(ApiClient apiClient) {
    this.apiClient = apiClient;
  }
  
  private static final Map getBatchDataResponseTypeMap = new HashMap();
  static {
    getBatchDataResponseTypeMap.put(200, new GenericType(){});
    getBatchDataResponseTypeMap.put(202, new GenericType(){});
    getBatchDataResponseTypeMap.put(404, new GenericType(){});
  }

  private static final Map getBatchStatusResponseTypeMap = new HashMap();
  static {
    getBatchStatusResponseTypeMap.put(201, new GenericType(){});
    getBatchStatusResponseTypeMap.put(202, new GenericType(){});
    getBatchStatusResponseTypeMap.put(404, new GenericType(){});
  }

  
 /**
   * Wrapper to support GET /batch-result returning different types
   * per status code.
   *
   * 

* Responses: *

    *
  • 200 : {@code BatchResultResponse }
    Request Response Object when the batch request has been completed and the response is created
  • * *
  • 202 : {@code BatchStatusResponse }
    The batch Request has not finished and the result has NOT been created.
  • *
* *

* Example: *

{@code
   * GetBatchDataResponseWrapper response = ...;
   * switch (response.statusCode) {
   *   case 200:
   *     BatchResultResponse data200 = response.getResponse200();
   *     break;
   *   case 202:
   *     BatchStatusResponse data202 = response.getResponse202();
   *     break;
   *  }
   * }
*/ public static class GetBatchDataResponseWrapper { public final int statusCode; public final Object response; public GetBatchDataResponseWrapper(int statusCode, Object response) { this.statusCode = statusCode; this.response = response; } public int getStatusCode() { return statusCode; } public Object getResponse() { return response; } public BatchResultResponse getResponse200() throws ApiException { if (this.statusCode != 200) { throw new ApiException(500, "Invalid response getter called. getResponse200 can't return a " + this.statusCode + " response"); } return (BatchResultResponse) this.response; } public BatchStatusResponse getResponse202() throws ApiException { if (this.statusCode != 202) { throw new ApiException(500, "Invalid response getter called. getResponse202 can't return a " + this.statusCode + " response"); } return (BatchStatusResponse) this.response; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } GetBatchDataResponseWrapper other = (GetBatchDataResponseWrapper) o; return this.statusCode == other.statusCode && Objects.equals(this.response, other.response); } @Override public int hashCode() { return Objects.hash(statusCode, response); } @Override public String toString() { return "class GetBatchDataResponseWrapper {\n" + " statusCode: " + statusCode + "\n" + " response: " + Objects.toString(response).replace("\n", "\n ") + "\n}"; } } /** * Get the API client * * @return API client */ public ApiClient getApiClient() { return apiClient; } /** * Set the API client * * @param apiClient an instance of API client */ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } /** * Returns the response for a Batch Request * Returns the response data for the underlying batch request that is specified by the id. By default, this endpoint will return data as JSON. If you wish to receive your data in CSV format, you can edit the header to have the \"accept\" parameter as \"text/csv\" instead of \"application/json\". * @param id Batch Request identifier. (required) * @return GetBatchDataResponseWrapper * @throws ApiException if fails to make API call * @http.response.details
Status Code Description Response Headers
200 Request Response Object when the batch request has been completed and the response is created -
202 The batch Request has not finished and the result has NOT been created. -
404 Resource not found. -
*/ public GetBatchDataResponseWrapper getBatchData(java.util.UUID id) throws ApiException { return getBatchDataWithHttpInfo(id).getData(); } /** * Returns the response for a Batch Request * Returns the response data for the underlying batch request that is specified by the id. By default, this endpoint will return data as JSON. If you wish to receive your data in CSV format, you can edit the header to have the \"accept\" parameter as \"text/csv\" instead of \"application/json\". * @param id Batch Request identifier. (required) * @return ApiResponse<GetBatchDataResponseWrapper> * @throws ApiException if fails to make API call * @http.response.details
Status Code Description Response Headers
200 Request Response Object when the batch request has been completed and the response is created -
202 The batch Request has not finished and the result has NOT been created. -
404 Resource not found. -
*/ public ApiResponse getBatchDataWithHttpInfo(java.util.UUID id) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'id' is set if (id == null) { throw new ApiException(400, "Missing the required parameter 'id' when calling getBatchData"); } // create path and map variables String localVarPath = "/batch-result"; // query params java.util.List localVarQueryParams = new java.util.ArrayList(); java.util.Map localVarHeaderParams = new java.util.HashMap(); java.util.Map localVarCookieParams = new java.util.HashMap(); java.util.Map localVarFormParams = new java.util.HashMap(); localVarQueryParams.addAll(apiClient.parameterToPairs("", "id", id)); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "FactSetApiKey", "FactSetOAuth2", "FactSetOAuth2Client" }; ApiResponse< Object > apiResponse = apiClient.invokeAPI("BatchProcessingApi.getBatchData", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, getBatchDataResponseTypeMap, false); int statusCode = apiResponse.getStatusCode(); GetBatchDataResponseWrapper responseWrapper = new GetBatchDataResponseWrapper( statusCode, apiResponse.getData() ); return new ApiResponse(statusCode, apiResponse.getHeaders(), responseWrapper); } /** * Returns the status for a Batch Request * Return the status for the underlying batch request that is specified by the id. * @param id Batch Request identifier. (required) * @return BatchStatusResponse * @throws ApiException if fails to make API call * @http.response.details
Status Code Description Response Headers
201 The batch Request has been completed and the response has been created. * Location - Path to Batch Request result.
202 The batch Request has not finished and the result has NOT been created. -
404 Resource not found. -
*/ public BatchStatusResponse getBatchStatus(java.util.UUID id) throws ApiException { return getBatchStatusWithHttpInfo(id).getData(); } /** * Returns the status for a Batch Request * Return the status for the underlying batch request that is specified by the id. * @param id Batch Request identifier. (required) * @return ApiResponse<BatchStatusResponse> * @throws ApiException if fails to make API call * @http.response.details
Status Code Description Response Headers
201 The batch Request has been completed and the response has been created. * Location - Path to Batch Request result.
202 The batch Request has not finished and the result has NOT been created. -
404 Resource not found. -
*/ public ApiResponse getBatchStatusWithHttpInfo(java.util.UUID id) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'id' is set if (id == null) { throw new ApiException(400, "Missing the required parameter 'id' when calling getBatchStatus"); } // create path and map variables String localVarPath = "/batch-status"; // query params java.util.List localVarQueryParams = new java.util.ArrayList(); java.util.Map localVarHeaderParams = new java.util.HashMap(); java.util.Map localVarCookieParams = new java.util.HashMap(); java.util.Map localVarFormParams = new java.util.HashMap(); localVarQueryParams.addAll(apiClient.parameterToPairs("", "id", id)); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "FactSetApiKey", "FactSetOAuth2", "FactSetOAuth2Client" }; ApiResponse< BatchStatusResponse > apiResponse = apiClient.invokeAPI("BatchProcessingApi.getBatchStatus", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, getBatchStatusResponseTypeMap, false); return apiResponse; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy