PluginProbe
Gianism / 1.1
Gianism v1.1
4.3.0 4.3.1 4.3.2 4.3.3 4.3.4 4.4.0 5.0.0 5.0.1 5.0.2 5.1.0 5.2.1 5.2.2 5.3.0 6.0.0 6.0.1 trunk 1.0 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 All 65 releases
gianism / sdks / google / contrib / apiCustomsearchService.php

apiCustomsearchService.php in Gianism 1.1, at sdks/google/contrib/apiCustomsearchService.php

489 lines 13.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * Copyright (c) 2010 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 require_once 'service/apiModel.php';
19 require_once 'service/apiService.php';
20 require_once 'service/apiServiceRequest.php';
21
22
23 /**
24 * The "cse" collection of methods.
25 * Typical usage is:
26 * <code>
27 * $customsearchService = new apiCustomsearchService(...);
28 * $cse = $customsearchService->cse;
29 * </code>
30 */
31 class CseServiceResource extends apiServiceResource {
32
33
34 /**
35 * Returns metadata about the search performed, metadata about the custom search engine used for the
36 * search, and the search results. (cse.list)
37 *
38 * @param string $q Query
39 * @param array $optParams Optional parameters. Valid optional parameters are listed below.
40 *
41 * @opt_param string sort The sort expression to apply to the results
42 * @opt_param string num Number of search results to return
43 * @opt_param string googlehost The local Google domain to use to perform the search.
44 * @opt_param string safe Search safety level
45 * @opt_param string filter Controls turning on or off the duplicate content filter.
46 * @opt_param string start The index of the first result to return
47 * @opt_param string cx The custom search engine ID to scope this search query
48 * @opt_param string lr The language restriction for the search results
49 * @opt_param string cr Country restrict(s).
50 * @opt_param string gl Geolocation of end user.
51 * @opt_param string cref The URL of a linked custom search engine
52 * @return Search
53 */
54 public function listCse($q, $optParams = array()) {
55 $params = array('q' => $q);
56 $params = array_merge($params, $optParams);
57 $data = $this->__call('list', array($params));
58 if ($this->useObjects()) {
59 return new Search($data);
60 } else {
61 return $data;
62 }
63 }
64 }
65
66
67
68 /**
69 * Service definition for Customsearch (v1).
70 *
71 * <p>
72 * Lets you search over a website or collection of websites
73 * </p>
74 *
75 * <p>
76 * For more information about this service, see the
77 * <a href="http://code.google.com/apis/customsearch/v1/using_rest.html" target="_blank">API Documentation</a>
78 * </p>
79 *
80 * @author Google, Inc.
81 */
82 class apiCustomsearchService extends apiService {
83 public $cse;
84 /**
85 * Constructs the internal representation of the Customsearch service.
86 *
87 * @param apiClient apiClient
88 */
89 public function __construct(apiClient $apiClient) {
90 $this->rpcPath = '/rpc';
91 $this->restBasePath = '/customsearch/';
92 $this->version = 'v1';
93 $this->serviceName = 'customsearch';
94
95 $apiClient->addService($this->serviceName, $this->version);
96 $this->cse = new CseServiceResource($this, $this->serviceName, 'cse', json_decode('{"methods": {"list": {"parameters": {"sort": {"type": "string", "location": "query"}, "filter": {"enum": ["0", "1"], "type": "string", "location": "query"}, "cx": {"type": "string", "location": "query"}, "googlehost": {"type": "string", "location": "query"}, "safe": {"default": "off", "enum": ["high", "medium", "off"], "location": "query", "type": "string"}, "q": {"required": true, "type": "string", "location": "query"}, "start": {"type": "string", "location": "query"}, "num": {"default": "10", "type": "string", "location": "query"}, "lr": {"enum": ["lang_ar", "lang_bg", "lang_ca", "lang_cs", "lang_da", "lang_de", "lang_el", "lang_en", "lang_es", "lang_et", "lang_fi", "lang_fr", "lang_hr", "lang_hu", "lang_id", "lang_is", "lang_it", "lang_iw", "lang_ja", "lang_ko", "lang_lt", "lang_lv", "lang_nl", "lang_no", "lang_pl", "lang_pt", "lang_ro", "lang_ru", "lang_sk", "lang_sl", "lang_sr", "lang_sv", "lang_tr", "lang_zh-CN", "lang_zh-TW"], "type": "string", "location": "query"}, "cr": {"type": "string", "location": "query"}, "gl": {"type": "string", "location": "query"}, "cref": {"type": "string", "location": "query"}}, "id": "search.cse.list", "httpMethod": "GET", "path": "v1", "response": {"$ref": "Search"}}}}', true));
97 }
98 }
99
100 class Context extends apiModel {
101 protected $__facetsType = 'ContextFacets';
102 protected $__facetsDataType = 'array';
103 public $facets;
104 public $title;
105 public function setFacets(/* array(ContextFacets) */ $facets) {
106 $this->assertIsArray($facets, 'ContextFacets', __METHOD__);
107 $this->facets = $facets;
108 }
109 public function getFacets() {
110 return $this->facets;
111 }
112 public function setTitle($title) {
113 $this->title = $title;
114 }
115 public function getTitle() {
116 return $this->title;
117 }
118 }
119
120 class ContextFacets extends apiModel {
121 public $anchor;
122 public $label;
123 public function setAnchor($anchor) {
124 $this->anchor = $anchor;
125 }
126 public function getAnchor() {
127 return $this->anchor;
128 }
129 public function setLabel($label) {
130 $this->label = $label;
131 }
132 public function getLabel() {
133 return $this->label;
134 }
135 }
136
137 class Promotion extends apiModel {
138 public $link;
139 public $displayLink;
140 protected $__imageType = 'PromotionImage';
141 protected $__imageDataType = '';
142 public $image;
143 protected $__bodyLinesType = 'PromotionBodyLines';
144 protected $__bodyLinesDataType = 'array';
145 public $bodyLines;
146 public $title;
147 public function setLink($link) {
148 $this->link = $link;
149 }
150 public function getLink() {
151 return $this->link;
152 }
153 public function setDisplayLink($displayLink) {
154 $this->displayLink = $displayLink;
155 }
156 public function getDisplayLink() {
157 return $this->displayLink;
158 }
159 public function setImage(PromotionImage $image) {
160 $this->image = $image;
161 }
162 public function getImage() {
163 return $this->image;
164 }
165 public function setBodyLines(/* array(PromotionBodyLines) */ $bodyLines) {
166 $this->assertIsArray($bodyLines, 'PromotionBodyLines', __METHOD__);
167 $this->bodyLines = $bodyLines;
168 }
169 public function getBodyLines() {
170 return $this->bodyLines;
171 }
172 public function setTitle($title) {
173 $this->title = $title;
174 }
175 public function getTitle() {
176 return $this->title;
177 }
178 }
179
180 class PromotionBodyLines extends apiModel {
181 public $url;
182 public $link;
183 public $title;
184 public function setUrl($url) {
185 $this->url = $url;
186 }
187 public function getUrl() {
188 return $this->url;
189 }
190 public function setLink($link) {
191 $this->link = $link;
192 }
193 public function getLink() {
194 return $this->link;
195 }
196 public function setTitle($title) {
197 $this->title = $title;
198 }
199 public function getTitle() {
200 return $this->title;
201 }
202 }
203
204 class PromotionImage extends apiModel {
205 public $source;
206 public $width;
207 public $height;
208 public function setSource($source) {
209 $this->source = $source;
210 }
211 public function getSource() {
212 return $this->source;
213 }
214 public function setWidth($width) {
215 $this->width = $width;
216 }
217 public function getWidth() {
218 return $this->width;
219 }
220 public function setHeight($height) {
221 $this->height = $height;
222 }
223 public function getHeight() {
224 return $this->height;
225 }
226 }
227
228 class Query extends apiModel {
229 public $count;
230 public $sort;
231 public $outputEncoding;
232 public $language;
233 public $title;
234 public $googleHost;
235 public $safe;
236 public $searchTerms;
237 public $filter;
238 public $startIndex;
239 public $cx;
240 public $startPage;
241 public $inputEncoding;
242 public $cr;
243 public $gl;
244 public $totalResults;
245 public $cref;
246 public function setCount($count) {
247 $this->count = $count;
248 }
249 public function getCount() {
250 return $this->count;
251 }
252 public function setSort($sort) {
253 $this->sort = $sort;
254 }
255 public function getSort() {
256 return $this->sort;
257 }
258 public function setOutputEncoding($outputEncoding) {
259 $this->outputEncoding = $outputEncoding;
260 }
261 public function getOutputEncoding() {
262 return $this->outputEncoding;
263 }
264 public function setLanguage($language) {
265 $this->language = $language;
266 }
267 public function getLanguage() {
268 return $this->language;
269 }
270 public function setTitle($title) {
271 $this->title = $title;
272 }
273 public function getTitle() {
274 return $this->title;
275 }
276 public function setGoogleHost($googleHost) {
277 $this->googleHost = $googleHost;
278 }
279 public function getGoogleHost() {
280 return $this->googleHost;
281 }
282 public function setSafe($safe) {
283 $this->safe = $safe;
284 }
285 public function getSafe() {
286 return $this->safe;
287 }
288 public function setSearchTerms($searchTerms) {
289 $this->searchTerms = $searchTerms;
290 }
291 public function getSearchTerms() {
292 return $this->searchTerms;
293 }
294 public function setFilter($filter) {
295 $this->filter = $filter;
296 }
297 public function getFilter() {
298 return $this->filter;
299 }
300 public function setStartIndex($startIndex) {
301 $this->startIndex = $startIndex;
302 }
303 public function getStartIndex() {
304 return $this->startIndex;
305 }
306 public function setCx($cx) {
307 $this->cx = $cx;
308 }
309 public function getCx() {
310 return $this->cx;
311 }
312 public function setStartPage($startPage) {
313 $this->startPage = $startPage;
314 }
315 public function getStartPage() {
316 return $this->startPage;
317 }
318 public function setInputEncoding($inputEncoding) {
319 $this->inputEncoding = $inputEncoding;
320 }
321 public function getInputEncoding() {
322 return $this->inputEncoding;
323 }
324 public function setCr($cr) {
325 $this->cr = $cr;
326 }
327 public function getCr() {
328 return $this->cr;
329 }
330 public function setGl($gl) {
331 $this->gl = $gl;
332 }
333 public function getGl() {
334 return $this->gl;
335 }
336 public function setTotalResults($totalResults) {
337 $this->totalResults = $totalResults;
338 }
339 public function getTotalResults() {
340 return $this->totalResults;
341 }
342 public function setCref($cref) {
343 $this->cref = $cref;
344 }
345 public function getCref() {
346 return $this->cref;
347 }
348 }
349
350 class Result extends apiModel {
351 public $kind;
352 public $title;
353 public $displayLink;
354 public $cacheId;
355 public $pagemap;
356 public $snippet;
357 public $htmlSnippet;
358 public $link;
359 public $htmlTitle;
360 public function setKind($kind) {
361 $this->kind = $kind;
362 }
363 public function getKind() {
364 return $this->kind;
365 }
366 public function setTitle($title) {
367 $this->title = $title;
368 }
369 public function getTitle() {
370 return $this->title;
371 }
372 public function setDisplayLink($displayLink) {
373 $this->displayLink = $displayLink;
374 }
375 public function getDisplayLink() {
376 return $this->displayLink;
377 }
378 public function setCacheId($cacheId) {
379 $this->cacheId = $cacheId;
380 }
381 public function getCacheId() {
382 return $this->cacheId;
383 }
384 public function setPagemap($pagemap) {
385 $this->pagemap = $pagemap;
386 }
387 public function getPagemap() {
388 return $this->pagemap;
389 }
390 public function setSnippet($snippet) {
391 $this->snippet = $snippet;
392 }
393 public function getSnippet() {
394 return $this->snippet;
395 }
396 public function setHtmlSnippet($htmlSnippet) {
397 $this->htmlSnippet = $htmlSnippet;
398 }
399 public function getHtmlSnippet() {
400 return $this->htmlSnippet;
401 }
402 public function setLink($link) {
403 $this->link = $link;
404 }
405 public function getLink() {
406 return $this->link;
407 }
408 public function setHtmlTitle($htmlTitle) {
409 $this->htmlTitle = $htmlTitle;
410 }
411 public function getHtmlTitle() {
412 return $this->htmlTitle;
413 }
414 }
415
416 class Search extends apiModel {
417 protected $__promotionsType = 'Promotion';
418 protected $__promotionsDataType = 'array';
419 public $promotions;
420 public $kind;
421 protected $__urlType = 'SearchUrl';
422 protected $__urlDataType = '';
423 public $url;
424 protected $__itemsType = 'Result';
425 protected $__itemsDataType = 'array';
426 public $items;
427 protected $__contextType = 'Context';
428 protected $__contextDataType = '';
429 public $context;
430 protected $__queriesType = 'Query';
431 protected $__queriesDataType = 'map';
432 public $queries;
433 public function setPromotions(/* array(Promotion) */ $promotions) {
434 $this->assertIsArray($promotions, 'Promotion', __METHOD__);
435 $this->promotions = $promotions;
436 }
437 public function getPromotions() {
438 return $this->promotions;
439 }
440 public function setKind($kind) {
441 $this->kind = $kind;
442 }
443 public function getKind() {
444 return $this->kind;
445 }
446 public function setUrl(SearchUrl $url) {
447 $this->url = $url;
448 }
449 public function getUrl() {
450 return $this->url;
451 }
452 public function setItems(/* array(Result) */ $items) {
453 $this->assertIsArray($items, 'Result', __METHOD__);
454 $this->items = $items;
455 }
456 public function getItems() {
457 return $this->items;
458 }
459 public function setContext(Context $context) {
460 $this->context = $context;
461 }
462 public function getContext() {
463 return $this->context;
464 }
465 public function setQueries(Query $queries) {
466 $this->queries = $queries;
467 }
468 public function getQueries() {
469 return $this->queries;
470 }
471 }
472
473 class SearchUrl extends apiModel {
474 public $type;
475 public $template;
476 public function setType($type) {
477 $this->type = $type;
478 }
479 public function getType() {
480 return $this->type;
481 }
482 public function setTemplate($template) {
483 $this->template = $template;
484 }
485 public function getTemplate() {
486 return $this->template;
487 }
488 }
489