Java Code Examples for com.google.api.services.youtube.model.Channel#setId()

The following examples show how to use com.google.api.services.youtube.model.Channel#setId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: YoutubeChannelDeserializer.java    From streams with Apache License 2.0 6 votes vote down vote up
@Override
public Channel deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
  JsonNode node = jp.getCodec().readTree(jp);
  try {
    Channel channel = new Channel();
    if (node.findPath("etag") != null) {
      channel.setEtag(node.get("etag").asText());
    }
    if (node.findPath("kind") != null) {
      channel.setKind(node.get("kind").asText());
    }
    channel.setId(node.get("id").asText());
    channel.setTopicDetails(setTopicDetails(node.findValue("topicDetails")));
    channel.setStatistics(setChannelStatistics(node.findValue("statistics")));
    channel.setContentDetails(setContentDetails(node.findValue("contentDetails")));
    channel.setSnippet(setChannelSnippet(node.findValue("snippet")));
    return channel;
  } catch (Throwable throwable) {
    throw new IOException(throwable);
  }
}
 
Example 2
Source File: YoutubeChannelDataCollectorTest.java    From streams with Apache License 2.0 5 votes vote down vote up
private ChannelListResponse createMockResponse() {
  ChannelListResponse response = new ChannelListResponse();
  List<Channel> channelList = new LinkedList<>();
  response.setItems(channelList);
  Channel channel = new Channel();
  channel.setId(ID);
  channelList.add(channel);
  return response;
}