1<?php
2/*
3 * Copyright 2014 Google Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17
18namespace Google\Service\DataLabeling\Resource;
19
20use Google\Service\DataLabeling\GoogleCloudDatalabelingV1beta1CreateDatasetRequest;
21use Google\Service\DataLabeling\GoogleCloudDatalabelingV1beta1Dataset;
22use Google\Service\DataLabeling\GoogleCloudDatalabelingV1beta1ExportDataRequest;
23use Google\Service\DataLabeling\GoogleCloudDatalabelingV1beta1ImportDataRequest;
24use Google\Service\DataLabeling\GoogleCloudDatalabelingV1beta1ListDatasetsResponse;
25use Google\Service\DataLabeling\GoogleLongrunningOperation;
26use Google\Service\DataLabeling\GoogleProtobufEmpty;
27
28/**
29 * The "datasets" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $datalabelingService = new Google\Service\DataLabeling(...);
33 *   $datasets = $datalabelingService->datasets;
34 *  </code>
35 */
36class ProjectsDatasets extends \Google\Service\Resource
37{
38  /**
39   * Creates dataset. If success return a Dataset resource. (datasets.create)
40   *
41   * @param string $parent Required. Dataset resource parent, format:
42   * projects/{project_id}
43   * @param GoogleCloudDatalabelingV1beta1CreateDatasetRequest $postBody
44   * @param array $optParams Optional parameters.
45   * @return GoogleCloudDatalabelingV1beta1Dataset
46   */
47  public function create($parent, GoogleCloudDatalabelingV1beta1CreateDatasetRequest $postBody, $optParams = [])
48  {
49    $params = ['parent' => $parent, 'postBody' => $postBody];
50    $params = array_merge($params, $optParams);
51    return $this->call('create', [$params], GoogleCloudDatalabelingV1beta1Dataset::class);
52  }
53  /**
54   * Deletes a dataset by resource name. (datasets.delete)
55   *
56   * @param string $name Required. Dataset resource name, format:
57   * projects/{project_id}/datasets/{dataset_id}
58   * @param array $optParams Optional parameters.
59   * @return GoogleProtobufEmpty
60   */
61  public function delete($name, $optParams = [])
62  {
63    $params = ['name' => $name];
64    $params = array_merge($params, $optParams);
65    return $this->call('delete', [$params], GoogleProtobufEmpty::class);
66  }
67  /**
68   * Exports data and annotations from dataset. (datasets.exportData)
69   *
70   * @param string $name Required. Dataset resource name, format:
71   * projects/{project_id}/datasets/{dataset_id}
72   * @param GoogleCloudDatalabelingV1beta1ExportDataRequest $postBody
73   * @param array $optParams Optional parameters.
74   * @return GoogleLongrunningOperation
75   */
76  public function exportData($name, GoogleCloudDatalabelingV1beta1ExportDataRequest $postBody, $optParams = [])
77  {
78    $params = ['name' => $name, 'postBody' => $postBody];
79    $params = array_merge($params, $optParams);
80    return $this->call('exportData', [$params], GoogleLongrunningOperation::class);
81  }
82  /**
83   * Gets dataset by resource name. (datasets.get)
84   *
85   * @param string $name Required. Dataset resource name, format:
86   * projects/{project_id}/datasets/{dataset_id}
87   * @param array $optParams Optional parameters.
88   * @return GoogleCloudDatalabelingV1beta1Dataset
89   */
90  public function get($name, $optParams = [])
91  {
92    $params = ['name' => $name];
93    $params = array_merge($params, $optParams);
94    return $this->call('get', [$params], GoogleCloudDatalabelingV1beta1Dataset::class);
95  }
96  /**
97   * Imports data into dataset based on source locations defined in request. It
98   * can be called multiple times for the same dataset. Each dataset can only have
99   * one long running operation running on it. For example, no labeling task (also
100   * long running operation) can be started while importing is still ongoing. Vice
101   * versa. (datasets.importData)
102   *
103   * @param string $name Required. Dataset resource name, format:
104   * projects/{project_id}/datasets/{dataset_id}
105   * @param GoogleCloudDatalabelingV1beta1ImportDataRequest $postBody
106   * @param array $optParams Optional parameters.
107   * @return GoogleLongrunningOperation
108   */
109  public function importData($name, GoogleCloudDatalabelingV1beta1ImportDataRequest $postBody, $optParams = [])
110  {
111    $params = ['name' => $name, 'postBody' => $postBody];
112    $params = array_merge($params, $optParams);
113    return $this->call('importData', [$params], GoogleLongrunningOperation::class);
114  }
115  /**
116   * Lists datasets under a project. Pagination is supported.
117   * (datasets.listProjectsDatasets)
118   *
119   * @param string $parent Required. Dataset resource parent, format:
120   * projects/{project_id}
121   * @param array $optParams Optional parameters.
122   *
123   * @opt_param string filter Optional. Filter on dataset is not supported at this
124   * moment.
125   * @opt_param int pageSize Optional. Requested page size. Server may return
126   * fewer results than requested. Default value is 100.
127   * @opt_param string pageToken Optional. A token identifying a page of results
128   * for the server to return. Typically obtained by
129   * ListDatasetsResponse.next_page_token of the previous
130   * [DataLabelingService.ListDatasets] call. Returns the first page if empty.
131   * @return GoogleCloudDatalabelingV1beta1ListDatasetsResponse
132   */
133  public function listProjectsDatasets($parent, $optParams = [])
134  {
135    $params = ['parent' => $parent];
136    $params = array_merge($params, $optParams);
137    return $this->call('list', [$params], GoogleCloudDatalabelingV1beta1ListDatasetsResponse::class);
138  }
139}
140
141// Adding a class alias for backwards compatibility with the previous class name.
142class_alias(ProjectsDatasets::class, 'Google_Service_DataLabeling_Resource_ProjectsDatasets');
143