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