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\CloudSearch\Resource; 19 20use Google\Service\CloudSearch\SearchRequest; 21use Google\Service\CloudSearch\SearchResponse; 22use Google\Service\CloudSearch\SuggestRequest; 23use Google\Service\CloudSearch\SuggestResponse; 24 25/** 26 * The "query" collection of methods. 27 * Typical usage is: 28 * <code> 29 * $cloudsearchService = new Google\Service\CloudSearch(...); 30 * $query = $cloudsearchService->query; 31 * </code> 32 */ 33class Query extends \Google\Service\Resource 34{ 35 /** 36 * The Cloud Search Query API provides the search method, which returns the most 37 * relevant results from a user query. The results can come from Google 38 * Workspace apps, such as Gmail or Google Drive, or they can come from data 39 * that you have indexed from a third party. **Note:** This API requires a 40 * standard end user account to execute. A service account can't perform Query 41 * API requests directly; to use a service account to perform queries, set up 42 * [Google Workspace domain-wide delegation of 43 * authority](https://developers.google.com/cloud- 44 * search/docs/guides/delegation/). (query.search) 45 * 46 * @param SearchRequest $postBody 47 * @param array $optParams Optional parameters. 48 * @return SearchResponse 49 */ 50 public function search(SearchRequest $postBody, $optParams = []) 51 { 52 $params = ['postBody' => $postBody]; 53 $params = array_merge($params, $optParams); 54 return $this->call('search', [$params], SearchResponse::class); 55 } 56 /** 57 * Provides suggestions for autocompleting the query. **Note:** This API 58 * requires a standard end user account to execute. A service account can't 59 * perform Query API requests directly; to use a service account to perform 60 * queries, set up [Google Workspace domain-wide delegation of 61 * authority](https://developers.google.com/cloud- 62 * search/docs/guides/delegation/). (query.suggest) 63 * 64 * @param SuggestRequest $postBody 65 * @param array $optParams Optional parameters. 66 * @return SuggestResponse 67 */ 68 public function suggest(SuggestRequest $postBody, $optParams = []) 69 { 70 $params = ['postBody' => $postBody]; 71 $params = array_merge($params, $optParams); 72 return $this->call('suggest', [$params], SuggestResponse::class); 73 } 74} 75 76// Adding a class alias for backwards compatibility with the previous class name. 77class_alias(Query::class, 'Google_Service_CloudSearch_Resource_Query'); 78