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

com.bitmovin.api.sdk.analytics.licenses.LicensesApi Maven / Gradle / Ivy

There is a newer version: 1.205.0
Show newest version
package com.bitmovin.api.sdk.analytics.licenses;

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;
import com.bitmovin.api.sdk.analytics.licenses.domains.DomainsApi;

public class LicensesApi {
    public final DomainsApi domains;

    private final LicensesApiClient apiClient;

    public LicensesApi(BitmovinApiClientFactory clientFactory) {
        if (clientFactory == null)
        {
            throw new IllegalArgumentException("Parameter 'clientFactory' may not be null.");
        }

        this.apiClient = clientFactory.createApiClient(LicensesApiClient.class);

        this.domains = new DomainsApi(clientFactory);
    }

    /**
     * Fluent builder for creating an instance of LicensesApi
     */
    public static BitmovinApiBuilder builder() {
        return new BitmovinApiBuilder<>(LicensesApi.class);
    }

    /**
     * Create Analytics License
     * 
     * @param analyticsLicense Analytics License to be created (required)
     * @return AnalyticsLicense
     * @throws BitmovinException if fails to make API call
     */
    public AnalyticsLicense create(AnalyticsLicense analyticsLicense) throws BitmovinException {
        try {
            return this.apiClient.create(analyticsLicense).getData().getResult();
        } catch (Exception ex) {
            throw buildBitmovinException(ex);
        }
    }

    /**
     * Get License
     * 
     * @param licenseId License id (required)
     * @return AnalyticsLicense
     * @throws BitmovinException if fails to make API call
     */
    public AnalyticsLicense get(String licenseId) throws BitmovinException {
        try {
            return this.apiClient.get(licenseId).getData().getResult();
        } catch (Exception ex) {
            throw buildBitmovinException(ex);
        }
    }

    /**
     * List Analytics Licenses
     * 
     * @return List<AnalyticsLicense>
     * @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 Analytics Licenses
     * 
     * @param queryParams The query parameters for sorting, filtering and paging options (optional)
     * @return List<AnalyticsLicense>
     * @throws BitmovinException if fails to make API call
     */
    public PaginationResponse list(AnalyticsLicenseListQueryParams queryParams) throws BitmovinException {
        try {
            return this.apiClient.list(new QueryMapWrapper(queryParams)).getData().getResult();
        } catch (Exception ex) {
            throw buildBitmovinException(ex);
        }
    }

    /**
     * Update Analytics License
     * 
     * @param licenseId License id (required)
     * @param analyticsLicense Analytics License details to be updated (required)
     * @return AnalyticsLicense
     * @throws BitmovinException if fails to make API call
     */
    public AnalyticsLicense update(String licenseId, AnalyticsLicense analyticsLicense) throws BitmovinException {
        try {
            return this.apiClient.update(licenseId, analyticsLicense).getData().getResult();
        } catch (Exception ex) {
            throw buildBitmovinException(ex);
        }
    }

    interface LicensesApiClient {

        @RequestLine("POST /analytics/licenses")
        ResponseEnvelope create(AnalyticsLicense analyticsLicense) throws BitmovinException;
    
        @RequestLine("GET /analytics/licenses/{license_id}")
        ResponseEnvelope get(@Param(value = "license_id") String licenseId) throws BitmovinException;
    
        @RequestLine("GET /analytics/licenses")
        ResponseEnvelope> list(@QueryMap QueryMapWrapper queryParams) throws BitmovinException;
    
        @RequestLine("PUT /analytics/licenses/{license_id}")
        ResponseEnvelope update(@Param(value = "license_id") String licenseId, AnalyticsLicense analyticsLicense) throws BitmovinException;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy