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

io.induct.yle.api.media.YleMediaApi Maven / Gradle / Ivy

The newest version!
package io.induct.yle.api.media;

import com.fasterxml.jackson.core.type.TypeReference;
import io.induct.rest.ApiResponse;
import io.induct.rest.Request;
import io.induct.yle.api.StandardizedApi;
import io.induct.yle.api.YleId;
import io.induct.yle.api.media.domain.EncryptedPlayout;

import java.util.List;

/**
 * @since 2015-08-25
 */
public class YleMediaApi extends StandardizedApi {

    public static final String MEDIA_BASE_URL = "https://external.api.yle.fi";
    private TypeReference>> listOfPlayouts = new TypeReference>>() {};

    public YleMediaApi() {
        super(MEDIA_BASE_URL);
    }

    public ApiResponse> getPlayouts(YleId programId, YleId mediaId, EncryptedPlayout.Protocol protocol) {
        Request request = createRequestBuilder()
                .withPath("/v1/media/playouts.json")
                .withParams(params -> {
                    params.put("program_id", programId.identity());
                    params.put("media_id", mediaId.identity());
                    params.put("protocol", protocol.toString());
                })
                .build();

        return handleApiCall(request, listOfPlayouts);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy