| 1 |
<?php |
| 2 |
/* |
| 3 |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 4 |
* use this file except in compliance with the License. You may obtain a copy of |
| 5 |
* the License at |
| 6 |
* |
| 7 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
* |
| 9 |
* Unless required by applicable law or agreed to in writing, software |
| 10 |
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 |
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 |
* License for the specific language governing permissions and limitations under |
| 13 |
* the License. |
| 14 |
*/ |
| 15 |
|
| 16 |
|
| 17 |
/** |
| 18 |
* The "text" collection of methods. |
| 19 |
* Typical usage is: |
| 20 |
* <code> |
| 21 |
* $freebaseService = new Google_FreebaseService(...); |
| 22 |
* $text = $freebaseService->text; |
| 23 |
* </code> |
| 24 |
*/ |
| 25 |
class Google_TextServiceResource extends Google_ServiceResource { |
| 26 |
|
| 27 |
|
| 28 |
/** |
| 29 |
* Returns blob attached to node at specified id as HTML (text.get) |
| 30 |
* |
| 31 |
* @param string $id The id of the item that you want data about |
| 32 |
* @param array $optParams Optional parameters. |
| 33 |
* |
| 34 |
* @opt_param string maxlength The max number of characters to return. Valid only for 'plain' format. |
| 35 |
* @opt_param string format Sanitizing transformation. |
| 36 |
* @return Google_ContentserviceGet |
| 37 |
*/ |
| 38 |
public function get($id, $optParams = array()) { |
| 39 |
$params = array('id' => $id); |
| 40 |
$params = array_merge($params, $optParams); |
| 41 |
$data = $this->__call('get', array($params)); |
| 42 |
if ($this->useObjects()) { |
| 43 |
return new Google_ContentserviceGet($data); |
| 44 |
} else { |
| 45 |
return $data; |
| 46 |
} |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
/** |
| 51 |
* Service definition for Google_Freebase (v1). |
| 52 |
* |
| 53 |
* <p> |
| 54 |
* Lets you access the Freebase repository of open data. |
| 55 |
* </p> |
| 56 |
* |
| 57 |
* <p> |
| 58 |
* For more information about this service, see the |
| 59 |
* <a href="http://wiki.freebase.com/wiki/API" target="_blank">API Documentation</a> |
| 60 |
* </p> |
| 61 |
* |
| 62 |
* @author Google, Inc. |
| 63 |
*/ |
| 64 |
class Google_FreebaseService extends Google_Service { |
| 65 |
public $text; |
| 66 |
/** |
| 67 |
* Constructs the internal representation of the Freebase service. |
| 68 |
* |
| 69 |
* @param Google_Client $client |
| 70 |
*/ |
| 71 |
public function __construct(Google_Client $client) { |
| 72 |
$this->servicePath = 'freebase/v1/'; |
| 73 |
$this->version = 'v1'; |
| 74 |
$this->serviceName = 'freebase'; |
| 75 |
|
| 76 |
$client->addService($this->serviceName, $this->version); |
| 77 |
$this->text = new Google_TextServiceResource($this, $this->serviceName, 'text', json_decode('{"methods": {"get": {"httpMethod": "GET", "response": {"$ref": "ContentserviceGet"}, "id": "freebase.text.get", "parameters": {"maxlength": {"type": "integer", "location": "query", "format": "uint32"}, "id": {"repeated": true, "required": true, "type": "string", "location": "path"}, "format": {"default": "plain", "enum": ["html", "plain", "raw"], "type": "string", "location": "query"}}, "path": "text{/id*}"}}}', true)); |
| 78 |
} |
| 79 |
} |
| 80 |
|
| 81 |
class Google_ContentserviceGet extends Google_Model { |
| 82 |
public $result; |
| 83 |
public function setResult($result) { |
| 84 |
$this->result = $result; |
| 85 |
} |
| 86 |
public function getResult() { |
| 87 |
return $this->result; |
| 88 |
} |
| 89 |
} |
| 90 |
|