com.google.api.services.pubsub.model.Topic

Here are the examples of the java api class com.google.api.services.pubsub.model.Topic taken from open source projects.

1. PubsubJsonClient#listTopics()

Project: incubator-beam
File: PubsubJsonClient.java
@Override
public List<TopicPath> listTopics(ProjectPath project) throws IOException {
    ListTopicsResponse response = pubsub.projects().topics().list(project.getPath()).execute();
    if (response.getTopics() == null || response.getTopics().isEmpty()) {
        return ImmutableList.of();
    }
    List<TopicPath> topics = new ArrayList<>(response.getTopics().size());
    for (Topic topic : response.getTopics()) {
        topics.add(topicPathFromPath(topic.getName()));
    }
    return topics;
}

2. PubsubJsonClient#listTopics()

Project: DataflowJavaSDK
File: PubsubJsonClient.java
@Override
public List<TopicPath> listTopics(ProjectPath project) throws IOException {
    ListTopicsResponse response = pubsub.projects().topics().list(project.getPath()).execute();
    if (response.getTopics() == null || response.getTopics().isEmpty()) {
        return ImmutableList.of();
    }
    List<TopicPath> topics = new ArrayList<>(response.getTopics().size());
    for (Topic topic : response.getTopics()) {
        topics.add(topicPathFromPath(topic.getName()));
    }
    return topics;
}