Search in sources :

Example 1 with ListDatasetsResponse

use of com.google.api.services.healthcare.v1.model.ListDatasetsResponse in project java-docs-samples by GoogleCloudPlatform.

the class DatasetList method datasetList.

public static void datasetList(String projectId, String regionId) throws IOException {
    // String projectId = "your-project-id";
    // String regionId = "us-central1";
    // Initialize the client, which will be used to interact with the service.
    CloudHealthcare client = createClient();
    // Results are paginated, so multiple queries may be required.
    String parentName = String.format("projects/%s/locations/%s", projectId, regionId);
    String pageToken = null;
    List<Dataset> datasets = new ArrayList<>();
    do {
        // Create request and configure any parameters.
        Datasets.List request = client.projects().locations().datasets().list(parentName).setPageSize(// Specify pageSize up to 1000
        100).setPageToken(pageToken);
        // Execute response and collect results.
        ListDatasetsResponse response = request.execute();
        datasets.addAll(response.getDatasets());
        // Update the page token for the next request.
        pageToken = response.getNextPageToken();
    } while (pageToken != null);
    // Print results.
    System.out.printf("Retrieved %s datasets: \n", datasets.size());
    for (Dataset data : datasets) {
        System.out.println("\t" + data.toPrettyString());
    }
}
Also used : Datasets(com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets) Dataset(com.google.api.services.healthcare.v1.model.Dataset) ArrayList(java.util.ArrayList) CloudHealthcare(com.google.api.services.healthcare.v1.CloudHealthcare) ListDatasetsResponse(com.google.api.services.healthcare.v1.model.ListDatasetsResponse)

Aggregations

CloudHealthcare (com.google.api.services.healthcare.v1.CloudHealthcare)1 Datasets (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets)1 Dataset (com.google.api.services.healthcare.v1.model.Dataset)1 ListDatasetsResponse (com.google.api.services.healthcare.v1.model.ListDatasetsResponse)1 ArrayList (java.util.ArrayList)1