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\CustomSearchAPI\Resource; 19 20use Google\Service\CustomSearchAPI\Search; 21 22/** 23 * The "cse" collection of methods. 24 * Typical usage is: 25 * <code> 26 * $customsearchService = new Google\Service\CustomSearchAPI(...); 27 * $cse = $customsearchService->cse; 28 * </code> 29 */ 30class Cse extends \Google\Service\Resource 31{ 32 /** 33 * Returns metadata about the search performed, metadata about the engine used 34 * for the search, and the search results. (cse.listCse) 35 * 36 * @param array $optParams Optional parameters. 37 * 38 * @opt_param string c2coff Enables or disables [Simplified and Traditional 39 * Chinese Search](https://developers.google.com/custom- 40 * search/docs/json_api_reference#chineseSearch). The default value for this 41 * parameter is 0 (zero), meaning that the feature is enabled. Supported values 42 * are: * `1`: Disabled * `0`: Enabled (default) 43 * @opt_param string cr Restricts search results to documents originating in a 44 * particular country. You may use [Boolean 45 * operators](https://developers.google.com/custom- 46 * search/docs/json_api_reference#booleanOperators) in the cr parameter's value. 47 * Google Search determines the country of a document by analyzing: * the top- 48 * level domain (TLD) of the document's URL * the geographic location of the Web 49 * server's IP address See the [Country Parameter 50 * Values](https://developers.google.com/custom- 51 * search/docs/json_api_reference#countryCollections) page for a list of valid 52 * values for this parameter. 53 * @opt_param string cx The Programmable Search Engine ID to use for this 54 * request. 55 * @opt_param string dateRestrict Restricts results to URLs based on date. 56 * Supported values include: * `d[number]`: requests results from the specified 57 * number of past days. * `w[number]`: requests results from the specified 58 * number of past weeks. * `m[number]`: requests results from the specified 59 * number of past months. * `y[number]`: requests results from the specified 60 * number of past years. 61 * @opt_param string exactTerms Identifies a phrase that all documents in the 62 * search results must contain. 63 * @opt_param string excludeTerms Identifies a word or phrase that should not 64 * appear in any documents in the search results. 65 * @opt_param string fileType Restricts results to files of a specified 66 * extension. A list of file types indexable by Google can be found in Search 67 * Console [Help Center](https://support.google.com/webmasters/answer/35287). 68 * @opt_param string filter Controls turning on or off the duplicate content 69 * filter. * See [Automatic Filtering](https://developers.google.com/custom- 70 * search/docs/json_api_reference#automaticFiltering) for more information about 71 * Google's search results filters. Note that host crowding filtering applies 72 * only to multi-site searches. * By default, Google applies filtering to all 73 * search results to improve the quality of those results. Acceptable values 74 * are: * `0`: Turns off duplicate content filter. * `1`: Turns on duplicate 75 * content filter. 76 * @opt_param string gl Geolocation of end user. * The `gl` parameter value is a 77 * two-letter country code. The `gl` parameter boosts search results whose 78 * country of origin matches the parameter value. See the [Country 79 * Codes](https://developers.google.com/custom- 80 * search/docs/json_api_reference#countryCodes) page for a list of valid values. 81 * * Specifying a `gl` parameter value should lead to more relevant results. 82 * This is particularly true for international customers and, even more 83 * specifically, for customers in English- speaking countries other than the 84 * United States. 85 * @opt_param string googlehost **Deprecated**. Use the `gl` parameter for a 86 * similar effect. The local Google domain (for example, google.com, google.de, 87 * or google.fr) to use to perform the search. 88 * @opt_param string highRange Specifies the ending value for a search range. * 89 * Use `lowRange` and `highRange` to append an inclusive search range of 90 * `lowRange...highRange` to the query. 91 * @opt_param string hl Sets the user interface language. * Explicitly setting 92 * this parameter improves the performance and the quality of your search 93 * results. * See the [Interface Languages](https://developers.google.com 94 * /custom-search/docs/json_api_reference#wsInterfaceLanguages) section of 95 * [Internationalizing Queries and Results 96 * Presentation](https://developers.google.com/custom- 97 * search/docs/json_api_reference#wsInternationalizing) for more information, 98 * and [Supported Interface Languages](https://developers.google.com/custom- 99 * search/docs/json_api_reference#interfaceLanguages) for a list of supported 100 * languages. 101 * @opt_param string hq Appends the specified query terms to the query, as if 102 * they were combined with a logical AND operator. 103 * @opt_param string imgColorType Returns black and white, grayscale, 104 * transparent, or color images. Acceptable values are: * `"color"` * `"gray"` * 105 * `"mono"`: black and white * `"trans"`: transparent background 106 * @opt_param string imgDominantColor Returns images of a specific dominant 107 * color. Acceptable values are: * `"black"` * `"blue"` * `"brown"` * `"gray"` * 108 * `"green"` * `"orange"` * `"pink"` * `"purple"` * `"red"` * `"teal"` * 109 * `"white"` * `"yellow"` 110 * @opt_param string imgSize Returns images of a specified size. Acceptable 111 * values are: * `"huge"` * `"icon"` * `"large"` * `"medium"` * `"small"` * 112 * `"xlarge"` * `"xxlarge"` 113 * @opt_param string imgType Returns images of a type. Acceptable values are: * 114 * `"clipart"` * `"face"` * `"lineart"` * `"stock"` * `"photo"` * `"animated"` 115 * @opt_param string linkSite Specifies that all search results should contain a 116 * link to a particular URL. 117 * @opt_param string lowRange Specifies the starting value for a search range. 118 * Use `lowRange` and `highRange` to append an inclusive search range of 119 * `lowRange...highRange` to the query. 120 * @opt_param string lr Restricts the search to documents written in a 121 * particular language (e.g., `lr=lang_ja`). Acceptable values are: * 122 * `"lang_ar"`: Arabic * `"lang_bg"`: Bulgarian * `"lang_ca"`: Catalan * 123 * `"lang_cs"`: Czech * `"lang_da"`: Danish * `"lang_de"`: German * `"lang_el"`: 124 * Greek * `"lang_en"`: English * `"lang_es"`: Spanish * `"lang_et"`: Estonian * 125 * `"lang_fi"`: Finnish * `"lang_fr"`: French * `"lang_hr"`: Croatian * 126 * `"lang_hu"`: Hungarian * `"lang_id"`: Indonesian * `"lang_is"`: Icelandic * 127 * `"lang_it"`: Italian * `"lang_iw"`: Hebrew * `"lang_ja"`: Japanese * 128 * `"lang_ko"`: Korean * `"lang_lt"`: Lithuanian * `"lang_lv"`: Latvian * 129 * `"lang_nl"`: Dutch * `"lang_no"`: Norwegian * `"lang_pl"`: Polish * 130 * `"lang_pt"`: Portuguese * `"lang_ro"`: Romanian * `"lang_ru"`: Russian * 131 * `"lang_sk"`: Slovak * `"lang_sl"`: Slovenian * `"lang_sr"`: Serbian * 132 * `"lang_sv"`: Swedish * `"lang_tr"`: Turkish * `"lang_zh-CN"`: Chinese 133 * (Simplified) * `"lang_zh-TW"`: Chinese (Traditional) 134 * @opt_param int num Number of search results to return. * Valid values are 135 * integers between 1 and 10, inclusive. 136 * @opt_param string orTerms Provides additional search terms to check for in a 137 * document, where each document in the search results must contain at least one 138 * of the additional search terms. 139 * @opt_param string q Query 140 * @opt_param string relatedSite Specifies that all search results should be 141 * pages that are related to the specified URL. 142 * @opt_param string rights Filters based on licensing. Supported values 143 * include: `cc_publicdomain`, `cc_attribute`, `cc_sharealike`, 144 * `cc_noncommercial`, `cc_nonderived` and combinations of these. See [typical 145 * combinations](https://wiki.creativecommons.org/wiki/CC_Search_integration). 146 * @opt_param string safe Search safety level. Acceptable values are: * 147 * `"active"`: Enables SafeSearch filtering. * `"off"`: Disables SafeSearch 148 * filtering. (default) 149 * @opt_param string searchType Specifies the search type: `image`. If 150 * unspecified, results are limited to webpages. Acceptable values are: * 151 * `"image"`: custom image search. 152 * @opt_param string siteSearch Specifies a given site which should always be 153 * included or excluded from results (see `siteSearchFilter` parameter, below). 154 * @opt_param string siteSearchFilter Controls whether to include or exclude 155 * results from the site named in the `siteSearch` parameter. Acceptable values 156 * are: * `"e"`: exclude * `"i"`: include 157 * @opt_param string sort The sort expression to apply to the results. The sort 158 * parameter specifies that the results be sorted according to the specified 159 * expression i.e. sort by date. [Example: 160 * sort=date](https://developers.google.com/custom-search/docs/structured_search 161 * #sort-by-attribute). 162 * @opt_param string start The index of the first result to return. The default 163 * number of results per page is 10, so `=11` would start at the top of the 164 * second page of results. **Note**: The JSON API will never return more than 165 * 100 results, even if more than 100 documents match the query, so setting the 166 * sum of `start + num` to a number greater than 100 will produce an error. Also 167 * note that the maximum value for `num` is 10. 168 * @return Search 169 */ 170 public function listCse($optParams = []) 171 { 172 $params = []; 173 $params = array_merge($params, $optParams); 174 return $this->call('list', [$params], Search::class); 175 } 176} 177 178// Adding a class alias for backwards compatibility with the previous class name. 179class_alias(Cse::class, 'Google_Service_CustomSearchAPI_Resource_Cse'); 180