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\Speech\Resource; 19 20use Google\Service\Speech\CreatePhraseSetRequest; 21use Google\Service\Speech\ListPhraseSetResponse; 22use Google\Service\Speech\PhraseSet; 23use Google\Service\Speech\SpeechEmpty; 24 25/** 26 * The "phraseSets" collection of methods. 27 * Typical usage is: 28 * <code> 29 * $speechService = new Google\Service\Speech(...); 30 * $phraseSets = $speechService->phraseSets; 31 * </code> 32 */ 33class ProjectsLocationsPhraseSets extends \Google\Service\Resource 34{ 35 /** 36 * Create a set of phrase hints. Each item in the set can be a single word or a 37 * multi-word phrase. The items in the PhraseSet are favored by the recognition 38 * model when you send a call that includes the PhraseSet. (phraseSets.create) 39 * 40 * @param string $parent Required. The parent resource where this phrase set 41 * will be created. Format: `projects/{project}/locations/{location}/phraseSets` 42 * Speech-to-Text supports three locations: `global`, `us` (US North America), 43 * and `eu` (Europe). If you are calling the `speech.googleapis.com` endpoint, 44 * use the `global` location. To specify a region, use a [regional endpoint 45 * ](/speech-to-text/docs/endpoints) with matching `us` or `eu` location value. 46 * @param CreatePhraseSetRequest $postBody 47 * @param array $optParams Optional parameters. 48 * @return PhraseSet 49 */ 50 public function create($parent, CreatePhraseSetRequest $postBody, $optParams = []) 51 { 52 $params = ['parent' => $parent, 'postBody' => $postBody]; 53 $params = array_merge($params, $optParams); 54 return $this->call('create', [$params], PhraseSet::class); 55 } 56 /** 57 * Delete a phrase set. (phraseSets.delete) 58 * 59 * @param string $name Required. The name of the phrase set to delete. Format: 60 * `projects/{project}/locations/{location}/phraseSets/{phrase_set}` 61 * @param array $optParams Optional parameters. 62 * @return SpeechEmpty 63 */ 64 public function delete($name, $optParams = []) 65 { 66 $params = ['name' => $name]; 67 $params = array_merge($params, $optParams); 68 return $this->call('delete', [$params], SpeechEmpty::class); 69 } 70 /** 71 * Get a phrase set. (phraseSets.get) 72 * 73 * @param string $name Required. The name of the phrase set to retrieve. Format: 74 * `projects/{project}/locations/{location}/phraseSets/{phrase_set}` Speech-to- 75 * Text supports three locations: `global`, `us` (US North America), and `eu` 76 * (Europe). If you are calling the `speech.googleapis.com` endpoint, use the 77 * `global` location. To specify a region, use a [regional endpoint](/speech-to- 78 * text/docs/endpoints) with matching `us` or `eu` location value. 79 * @param array $optParams Optional parameters. 80 * @return PhraseSet 81 */ 82 public function get($name, $optParams = []) 83 { 84 $params = ['name' => $name]; 85 $params = array_merge($params, $optParams); 86 return $this->call('get', [$params], PhraseSet::class); 87 } 88 /** 89 * List phrase sets. (phraseSets.listProjectsLocationsPhraseSets) 90 * 91 * @param string $parent Required. The parent, which owns this collection of 92 * phrase set. Format: `projects/{project}/locations/{location}` Speech-to-Text 93 * supports three locations: `global`, `us` (US North America), and `eu` 94 * (Europe). If you are calling the `speech.googleapis.com` endpoint, use the 95 * `global` location. To specify a region, use a [regional endpoint](/speech-to- 96 * text/docs/endpoints) with matching `us` or `eu` location value. 97 * @param array $optParams Optional parameters. 98 * 99 * @opt_param int pageSize The maximum number of phrase sets to return. The 100 * service may return fewer than this value. If unspecified, at most 50 phrase 101 * sets will be returned. The maximum value is 1000; values above 1000 will be 102 * coerced to 1000. 103 * @opt_param string pageToken A page token, received from a previous 104 * `ListPhraseSet` call. Provide this to retrieve the subsequent page. When 105 * paginating, all other parameters provided to `ListPhraseSet` must match the 106 * call that provided the page token. 107 * @return ListPhraseSetResponse 108 */ 109 public function listProjectsLocationsPhraseSets($parent, $optParams = []) 110 { 111 $params = ['parent' => $parent]; 112 $params = array_merge($params, $optParams); 113 return $this->call('list', [$params], ListPhraseSetResponse::class); 114 } 115 /** 116 * Update a phrase set. (phraseSets.patch) 117 * 118 * @param string $name The resource name of the phrase set. 119 * @param PhraseSet $postBody 120 * @param array $optParams Optional parameters. 121 * 122 * @opt_param string updateMask The list of fields to be updated. 123 * @return PhraseSet 124 */ 125 public function patch($name, PhraseSet $postBody, $optParams = []) 126 { 127 $params = ['name' => $name, 'postBody' => $postBody]; 128 $params = array_merge($params, $optParams); 129 return $this->call('patch', [$params], PhraseSet::class); 130 } 131} 132 133// Adding a class alias for backwards compatibility with the previous class name. 134class_alias(ProjectsLocationsPhraseSets::class, 'Google_Service_Speech_Resource_ProjectsLocationsPhraseSets'); 135