[e3d4e0a] | 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 |
|
---|
| 18 | namespace Google\Service\Translate\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Translate\Dataset;
|
---|
| 21 | use Google\Service\Translate\ExportDataRequest;
|
---|
| 22 | use Google\Service\Translate\ImportDataRequest;
|
---|
| 23 | use Google\Service\Translate\ListDatasetsResponse;
|
---|
| 24 | use Google\Service\Translate\Operation;
|
---|
| 25 |
|
---|
| 26 | /**
|
---|
| 27 | * The "datasets" collection of methods.
|
---|
| 28 | * Typical usage is:
|
---|
| 29 | * <code>
|
---|
| 30 | * $translateService = new Google\Service\Translate(...);
|
---|
| 31 | * $datasets = $translateService->projects_locations_datasets;
|
---|
| 32 | * </code>
|
---|
| 33 | */
|
---|
| 34 | class ProjectsLocationsDatasets extends \Google\Service\Resource
|
---|
| 35 | {
|
---|
| 36 | /**
|
---|
| 37 | * Creates a Dataset. (datasets.create)
|
---|
| 38 | *
|
---|
| 39 | * @param string $parent Required. The project name.
|
---|
| 40 | * @param Dataset $postBody
|
---|
| 41 | * @param array $optParams Optional parameters.
|
---|
| 42 | * @return Operation
|
---|
| 43 | * @throws \Google\Service\Exception
|
---|
| 44 | */
|
---|
| 45 | public function create($parent, Dataset $postBody, $optParams = [])
|
---|
| 46 | {
|
---|
| 47 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 48 | $params = array_merge($params, $optParams);
|
---|
| 49 | return $this->call('create', [$params], Operation::class);
|
---|
| 50 | }
|
---|
| 51 | /**
|
---|
| 52 | * Deletes a dataset and all of its contents. (datasets.delete)
|
---|
| 53 | *
|
---|
| 54 | * @param string $name Required. The name of the dataset to delete.
|
---|
| 55 | * @param array $optParams Optional parameters.
|
---|
| 56 | * @return Operation
|
---|
| 57 | * @throws \Google\Service\Exception
|
---|
| 58 | */
|
---|
| 59 | public function delete($name, $optParams = [])
|
---|
| 60 | {
|
---|
| 61 | $params = ['name' => $name];
|
---|
| 62 | $params = array_merge($params, $optParams);
|
---|
| 63 | return $this->call('delete', [$params], Operation::class);
|
---|
| 64 | }
|
---|
| 65 | /**
|
---|
| 66 | * Exports dataset's data to the provided output location. (datasets.exportData)
|
---|
| 67 | *
|
---|
| 68 | * @param string $dataset Required. Name of the dataset. In form of
|
---|
| 69 | * `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-
|
---|
| 70 | * id}`
|
---|
| 71 | * @param ExportDataRequest $postBody
|
---|
| 72 | * @param array $optParams Optional parameters.
|
---|
| 73 | * @return Operation
|
---|
| 74 | * @throws \Google\Service\Exception
|
---|
| 75 | */
|
---|
| 76 | public function exportData($dataset, ExportDataRequest $postBody, $optParams = [])
|
---|
| 77 | {
|
---|
| 78 | $params = ['dataset' => $dataset, 'postBody' => $postBody];
|
---|
| 79 | $params = array_merge($params, $optParams);
|
---|
| 80 | return $this->call('exportData', [$params], Operation::class);
|
---|
| 81 | }
|
---|
| 82 | /**
|
---|
| 83 | * Gets a Dataset. (datasets.get)
|
---|
| 84 | *
|
---|
| 85 | * @param string $name Required. The resource name of the dataset to retrieve.
|
---|
| 86 | * @param array $optParams Optional parameters.
|
---|
| 87 | * @return Dataset
|
---|
| 88 | * @throws \Google\Service\Exception
|
---|
| 89 | */
|
---|
| 90 | public function get($name, $optParams = [])
|
---|
| 91 | {
|
---|
| 92 | $params = ['name' => $name];
|
---|
| 93 | $params = array_merge($params, $optParams);
|
---|
| 94 | return $this->call('get', [$params], Dataset::class);
|
---|
| 95 | }
|
---|
| 96 | /**
|
---|
| 97 | * Import sentence pairs into translation Dataset. (datasets.importData)
|
---|
| 98 | *
|
---|
| 99 | * @param string $dataset Required. Name of the dataset. In form of
|
---|
| 100 | * `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-
|
---|
| 101 | * id}`
|
---|
| 102 | * @param ImportDataRequest $postBody
|
---|
| 103 | * @param array $optParams Optional parameters.
|
---|
| 104 | * @return Operation
|
---|
| 105 | * @throws \Google\Service\Exception
|
---|
| 106 | */
|
---|
| 107 | public function importData($dataset, ImportDataRequest $postBody, $optParams = [])
|
---|
| 108 | {
|
---|
| 109 | $params = ['dataset' => $dataset, 'postBody' => $postBody];
|
---|
| 110 | $params = array_merge($params, $optParams);
|
---|
| 111 | return $this->call('importData', [$params], Operation::class);
|
---|
| 112 | }
|
---|
| 113 | /**
|
---|
| 114 | * Lists datasets. (datasets.listProjectsLocationsDatasets)
|
---|
| 115 | *
|
---|
| 116 | * @param string $parent Required. Name of the parent project. In form of
|
---|
| 117 | * `projects/{project-number-or-id}/locations/{location-id}`
|
---|
| 118 | * @param array $optParams Optional parameters.
|
---|
| 119 | *
|
---|
| 120 | * @opt_param int pageSize Optional. Requested page size. The server can return
|
---|
| 121 | * fewer results than requested.
|
---|
| 122 | * @opt_param string pageToken Optional. A token identifying a page of results
|
---|
| 123 | * for the server to return. Typically obtained from next_page_token field in
|
---|
| 124 | * the response of a ListDatasets call.
|
---|
| 125 | * @return ListDatasetsResponse
|
---|
| 126 | * @throws \Google\Service\Exception
|
---|
| 127 | */
|
---|
| 128 | public function listProjectsLocationsDatasets($parent, $optParams = [])
|
---|
| 129 | {
|
---|
| 130 | $params = ['parent' => $parent];
|
---|
| 131 | $params = array_merge($params, $optParams);
|
---|
| 132 | return $this->call('list', [$params], ListDatasetsResponse::class);
|
---|
| 133 | }
|
---|
| 134 | }
|
---|
| 135 |
|
---|
| 136 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 137 | class_alias(ProjectsLocationsDatasets::class, 'Google_Service_Translate_Resource_ProjectsLocationsDatasets');
|
---|