package com.github.metaprgmr.gapi_flat.samples;

import static java.lang.System.out;
import static com.github.metaprgmr.util.Helper.*;

import java.util.List;
import com.github.metaprgmr.gapi_flat.YouTubeService;
import com.github.metaprgmr.gapi_flat.rt.GoogleAPIBase;
import com.google.api.services.youtube.model.LiveBroadcast;
import com.google.api.services.youtube.model.LiveBroadcastListResponse;

public class YouTubeDemo extends GoogleAPIBase {

	public static void main(String[] args) throws Exception {
    	YouTubeService service = new YouTubeService(getYouTube());
    	LiveBroadcastListResponse response =
    			service.LiveBroadcasts_list(createAttrs("broadcastStatus", "all"), "id,snippet");

    	out.println("\n================== Returned Broadcasts ==================\n");
        List<LiveBroadcast> returnedList = response.getItems();
        for (LiveBroadcast broadcast : returnedList) {
            out.println("  - Id: " + broadcast.getId());
            out.println("  - Title: " + broadcast.getSnippet().getTitle());
            out.println("  - Description: " + broadcast.getSnippet().getDescription());
            out.println("  - Published At: " + broadcast.getSnippet().getPublishedAt());
            out.println("  - Scheduled Start Time: " + broadcast.getSnippet().getScheduledStartTime());
            out.println("  - Scheduled End Time: " + broadcast.getSnippet().getScheduledEndTime());
            out.println("\n-------------------------------------------------------------\n");
        }
	}

} // end of class.