
com.factset.sdk.FactSetFundamentals.api.SegmentsApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of factsetfundamentals Show documentation
Show all versions of factsetfundamentals Show documentation
FactSet SDK for Java - factsetfundamentals
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.BatchStatusResponse;
import com.factset.sdk.FactSetFundamentals.models.ErrorResponse;
import com.factset.sdk.FactSetFundamentals.models.SegmentsRequest;
import com.factset.sdk.FactSetFundamentals.models.SegmentsResponse;
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class SegmentsApi {
private ApiClient apiClient;
public SegmentsApi() {
this(Configuration.getDefaultApiClient());
}
public SegmentsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
private static final Map getFdsSegmentsForListResponseTypeMap = new HashMap();
static {
getFdsSegmentsForListResponseTypeMap.put(200, new GenericType(){});
getFdsSegmentsForListResponseTypeMap.put(202, new GenericType(){});
getFdsSegmentsForListResponseTypeMap.put(400, new GenericType(){});
getFdsSegmentsForListResponseTypeMap.put(401, new GenericType(){});
getFdsSegmentsForListResponseTypeMap.put(403, new GenericType(){});
getFdsSegmentsForListResponseTypeMap.put(415, new GenericType(){});
getFdsSegmentsForListResponseTypeMap.put(500, new GenericType(){});
}
/**
* Wrapper to support POST /segments returning different types
* per status code.
*
*
* Responses:
*
* - 200 : {@code SegmentsResponse }
Segment data items
*
* - 202 : {@code BatchStatusResponse }
Batch request has been accepted.
*
*
*
* Example:
*
{@code
* GetFdsSegmentsForListResponseWrapper response = ...;
* switch (response.statusCode) {
* case 200:
* SegmentsResponse data200 = response.getResponse200();
* break;
* case 202:
* BatchStatusResponse data202 = response.getResponse202();
* break;
* }
* }
*/
public static class GetFdsSegmentsForListResponseWrapper {
public final int statusCode;
public final Object response;
public GetFdsSegmentsForListResponseWrapper(int statusCode, Object response) {
this.statusCode = statusCode;
this.response = response;
}
public int getStatusCode() { return statusCode; }
public Object getResponse() { return response; }
public SegmentsResponse getResponse200() throws ApiException {
if (this.statusCode != 200) {
throw new ApiException(500, "Invalid response getter called. getResponse200 can't return a " + this.statusCode + " response");
}
return (SegmentsResponse) 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;
}
GetFdsSegmentsForListResponseWrapper other = (GetFdsSegmentsForListResponseWrapper) 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 GetFdsSegmentsForListResponseWrapper {\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 Company Segment Data.
* Retrieves Sales Metrics data for specified companies. The ```/segments``` endpoint currently supports Long Running asynchronous requests up to **20 minutes** via batch parameter. Id limits are increased to 30000 ids per request when using batch capability.This 30000 id limit has been derived based on single metric for one day. This feature is available for all users.
* @param segmentsRequest Request object for requesting segments data (required)
* @return GetFdsSegmentsForListResponseWrapper
* @throws ApiException if fails to make API call
* @http.response.details
Status Code Description Response Headers
200 Segment data items -
202 Batch request has been accepted. * Location - Path to Batch Request result.
400 Bad Request. This can occur for several reasons. Please review the \"message\" for more details. -
401 Unauthenticated USERNAME-SERIAL. Ensure you are logged in and have successfully generated an API KEY for the IP range you are connecting from. For more help, select the **Report Issue** in the top right corner of this Developer Portal specification card and choose Connectivity 401 or 403 Responses. -
403 The USERNAME-SERIAL attempted to request the endpoint is not authorized to access. The request was legal, but the server is refusing to respond. Please reach out to FactSet Account Team for assistance with authorization. -
415 Unsupported Media Type. This error may be returned when the caller sends a resource in a format that is not accepted by the server. This can be fixed by ensuring that the Content-Type header is set to the correct value. In this instance, \"application/json\" would be the appropriate value. -
500 Internal Server Error. -
*/
public GetFdsSegmentsForListResponseWrapper getFdsSegmentsForList(SegmentsRequest segmentsRequest) throws ApiException {
return getFdsSegmentsForListWithHttpInfo(segmentsRequest).getData();
}
/**
* Returns Company Segment Data.
* Retrieves Sales Metrics data for specified companies. The ```/segments``` endpoint currently supports Long Running asynchronous requests up to **20 minutes** via batch parameter. Id limits are increased to 30000 ids per request when using batch capability.This 30000 id limit has been derived based on single metric for one day. This feature is available for all users.
* @param segmentsRequest Request object for requesting segments data (required)
* @return ApiResponse<GetFdsSegmentsForListResponseWrapper>
* @throws ApiException if fails to make API call
* @http.response.details
Status Code Description Response Headers
200 Segment data items -
202 Batch request has been accepted. * Location - Path to Batch Request result.
400 Bad Request. This can occur for several reasons. Please review the \"message\" for more details. -
401 Unauthenticated USERNAME-SERIAL. Ensure you are logged in and have successfully generated an API KEY for the IP range you are connecting from. For more help, select the **Report Issue** in the top right corner of this Developer Portal specification card and choose Connectivity 401 or 403 Responses. -
403 The USERNAME-SERIAL attempted to request the endpoint is not authorized to access. The request was legal, but the server is refusing to respond. Please reach out to FactSet Account Team for assistance with authorization. -
415 Unsupported Media Type. This error may be returned when the caller sends a resource in a format that is not accepted by the server. This can be fixed by ensuring that the Content-Type header is set to the correct value. In this instance, \"application/json\" would be the appropriate value. -
500 Internal Server Error. -
*/
public ApiResponse getFdsSegmentsForListWithHttpInfo(SegmentsRequest segmentsRequest) throws ApiException {
Object localVarPostBody = segmentsRequest;
// verify the required parameter 'segmentsRequest' is set
if (segmentsRequest == null) {
throw new ApiException(400, "Missing the required parameter 'segmentsRequest' when calling getFdsSegmentsForList");
}
// create path and map variables
String localVarPath = "/segments";
// 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();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "FactSetApiKey", "FactSetOAuth2", "FactSetOAuth2Client" };
ApiResponse<
Object
> apiResponse = apiClient.invokeAPI("SegmentsApi.getFdsSegmentsForList", localVarPath, "POST", localVarQueryParams, localVarPostBody,
localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType,
localVarAuthNames, getFdsSegmentsForListResponseTypeMap, false);
int statusCode = apiResponse.getStatusCode();
GetFdsSegmentsForListResponseWrapper responseWrapper = new GetFdsSegmentsForListResponseWrapper(
statusCode,
apiResponse.getData()
);
return new ApiResponse(statusCode, apiResponse.getHeaders(), responseWrapper);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy