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\LongRunningRecognizeRequest; 21use Google\Service\Speech\Operation; 22use Google\Service\Speech\RecognizeRequest; 23use Google\Service\Speech\RecognizeResponse; 24 25/** 26 * The "speech" collection of methods. 27 * Typical usage is: 28 * <code> 29 * $speechService = new Google\Service\Speech(...); 30 * $speech = $speechService->speech; 31 * </code> 32 */ 33class Speech extends \Google\Service\Resource 34{ 35 /** 36 * Performs asynchronous speech recognition: receive results via the 37 * google.longrunning.Operations interface. Returns either an `Operation.error` 38 * or an `Operation.response` which contains a `LongRunningRecognizeResponse` 39 * message. For more information on asynchronous speech recognition, see the 40 * [how-to](https://cloud.google.com/speech-to-text/docs/async-recognize). 41 * (speech.longrunningrecognize) 42 * 43 * @param LongRunningRecognizeRequest $postBody 44 * @param array $optParams Optional parameters. 45 * @return Operation 46 */ 47 public function longrunningrecognize(LongRunningRecognizeRequest $postBody, $optParams = []) 48 { 49 $params = ['postBody' => $postBody]; 50 $params = array_merge($params, $optParams); 51 return $this->call('longrunningrecognize', [$params], Operation::class); 52 } 53 /** 54 * Performs synchronous speech recognition: receive results after all audio has 55 * been sent and processed. (speech.recognize) 56 * 57 * @param RecognizeRequest $postBody 58 * @param array $optParams Optional parameters. 59 * @return RecognizeResponse 60 */ 61 public function recognize(RecognizeRequest $postBody, $optParams = []) 62 { 63 $params = ['postBody' => $postBody]; 64 $params = array_merge($params, $optParams); 65 return $this->call('recognize', [$params], RecognizeResponse::class); 66 } 67} 68 69// Adding a class alias for backwards compatibility with the previous class name. 70class_alias(Speech::class, 'Google_Service_Speech_Resource_Speech'); 71