com.bitmovin.api.sdk.analytics.exports.ExportsApi Maven / Gradle / Ivy
package com.bitmovin.api.sdk.analytics.exports;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import feign.Param;
import feign.QueryMap;
import feign.RequestLine;
import feign.Body;
import feign.Headers;
import com.bitmovin.api.sdk.model.*;
import com.bitmovin.api.sdk.common.BitmovinException;
import static com.bitmovin.api.sdk.common.BitmovinExceptionFactory.buildBitmovinException;
import com.bitmovin.api.sdk.common.BitmovinDateExpander;
import com.bitmovin.api.sdk.common.QueryMapWrapper;
import com.bitmovin.api.sdk.common.BitmovinApiBuilder;
import com.bitmovin.api.sdk.common.BitmovinApiClientFactory;
public class ExportsApi {
private final ExportsApiClient apiClient;
public ExportsApi(BitmovinApiClientFactory clientFactory) {
if (clientFactory == null)
{
throw new IllegalArgumentException("Parameter 'clientFactory' may not be null.");
}
this.apiClient = clientFactory.createApiClient(ExportsApiClient.class);
}
/**
* Fluent builder for creating an instance of ExportsApi
*/
public static BitmovinApiBuilder builder() {
return new BitmovinApiBuilder<>(ExportsApi.class);
}
/**
* Create Export Task
*
* @param analyticsExportTask The export task to be created (required)
* @return AnalyticsExportTask
* @throws BitmovinException if fails to make API call
*/
public AnalyticsExportTask create(AnalyticsExportTask analyticsExportTask) throws BitmovinException {
try {
return this.apiClient.create(analyticsExportTask).getData().getResult();
} catch (Exception ex) {
throw buildBitmovinException(ex);
}
}
/**
* Get export task
*
* @param exportTaskId Export task id (required)
* @return AnalyticsExportTask
* @throws BitmovinException if fails to make API call
*/
public AnalyticsExportTask get(String exportTaskId) throws BitmovinException {
try {
return this.apiClient.get(exportTaskId).getData().getResult();
} catch (Exception ex) {
throw buildBitmovinException(ex);
}
}
/**
* List Export Tasks
*
* @return List<AnalyticsExportTask>
* @throws BitmovinException if fails to make API call
*/
public PaginationResponse list() throws BitmovinException {
try {
return this.apiClient.list(new QueryMapWrapper()).getData().getResult();
} catch (Exception ex) {
throw buildBitmovinException(ex);
}
}
/**
* List Export Tasks
*
* @param queryParams The query parameters for sorting, filtering and paging options (optional)
* @return List<AnalyticsExportTask>
* @throws BitmovinException if fails to make API call
*/
public PaginationResponse list(AnalyticsExportTaskListQueryParams queryParams) throws BitmovinException {
try {
return this.apiClient.list(new QueryMapWrapper(queryParams)).getData().getResult();
} catch (Exception ex) {
throw buildBitmovinException(ex);
}
}
interface ExportsApiClient {
@RequestLine("POST /analytics/exports")
ResponseEnvelope create(AnalyticsExportTask analyticsExportTask) throws BitmovinException;
@RequestLine("GET /analytics/exports/{export_task_id}")
ResponseEnvelope get(@Param(value = "export_task_id") String exportTaskId) throws BitmovinException;
@RequestLine("GET /analytics/exports")
ResponseEnvelope> list(@QueryMap QueryMapWrapper queryParams) throws BitmovinException;
}
}