PageRenderTime 46ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/webui/google-api/contrib/apiSiteVerificationService.php

https://bitbucket.org/sailsdigital/piler-remi
PHP | 292 lines | 187 code | 15 blank | 90 comment | 12 complexity | 8ba0796ebef36f563a00a8b68bde8418 MD5 | raw file
Possible License(s): GPL-3.0
  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. require_once 'service/apiModel.php';
  18. require_once 'service/apiService.php';
  19. require_once 'service/apiServiceRequest.php';
  20. /**
  21. * The "webResource" collection of methods.
  22. * Typical usage is:
  23. * <code>
  24. * $siteVerificationService = new apiSiteVerificationService(...);
  25. * $webResource = $siteVerificationService->webResource;
  26. * </code>
  27. */
  28. class WebResourceServiceResource extends apiServiceResource {
  29. /**
  30. * Attempt verification of a website or domain. (webResource.insert)
  31. *
  32. * @param string $verificationMethod The method to use for verifying a site or domain.
  33. * @param SiteVerificationWebResourceResource $postBody
  34. * @return SiteVerificationWebResourceResource
  35. */
  36. public function insert($verificationMethod, SiteVerificationWebResourceResource $postBody, $optParams = array()) {
  37. $params = array('verificationMethod' => $verificationMethod, 'postBody' => $postBody);
  38. $params = array_merge($params, $optParams);
  39. $data = $this->__call('insert', array($params));
  40. if ($this->useObjects()) {
  41. return new SiteVerificationWebResourceResource($data);
  42. } else {
  43. return $data;
  44. }
  45. }
  46. /**
  47. * Get the most current data for a website or domain. (webResource.get)
  48. *
  49. * @param string $id The id of a verified site or domain.
  50. * @return SiteVerificationWebResourceResource
  51. */
  52. public function get($id, $optParams = array()) {
  53. $params = array('id' => $id);
  54. $params = array_merge($params, $optParams);
  55. $data = $this->__call('get', array($params));
  56. if ($this->useObjects()) {
  57. return new SiteVerificationWebResourceResource($data);
  58. } else {
  59. return $data;
  60. }
  61. }
  62. /**
  63. * Get the list of your verified websites and domains. (webResource.list)
  64. *
  65. * @return SiteVerificationWebResourceListResponse
  66. */
  67. public function listWebResource($optParams = array()) {
  68. $params = array();
  69. $params = array_merge($params, $optParams);
  70. $data = $this->__call('list', array($params));
  71. if ($this->useObjects()) {
  72. return new SiteVerificationWebResourceListResponse($data);
  73. } else {
  74. return $data;
  75. }
  76. }
  77. /**
  78. * Modify the list of owners for your website or domain. (webResource.update)
  79. *
  80. * @param string $id The id of a verified site or domain.
  81. * @param SiteVerificationWebResourceResource $postBody
  82. * @return SiteVerificationWebResourceResource
  83. */
  84. public function update($id, SiteVerificationWebResourceResource $postBody, $optParams = array()) {
  85. $params = array('id' => $id, 'postBody' => $postBody);
  86. $params = array_merge($params, $optParams);
  87. $data = $this->__call('update', array($params));
  88. if ($this->useObjects()) {
  89. return new SiteVerificationWebResourceResource($data);
  90. } else {
  91. return $data;
  92. }
  93. }
  94. /**
  95. * Modify the list of owners for your website or domain. This method supports patch semantics.
  96. * (webResource.patch)
  97. *
  98. * @param string $id The id of a verified site or domain.
  99. * @param SiteVerificationWebResourceResource $postBody
  100. * @return SiteVerificationWebResourceResource
  101. */
  102. public function patch($id, SiteVerificationWebResourceResource $postBody, $optParams = array()) {
  103. $params = array('id' => $id, 'postBody' => $postBody);
  104. $params = array_merge($params, $optParams);
  105. $data = $this->__call('patch', array($params));
  106. if ($this->useObjects()) {
  107. return new SiteVerificationWebResourceResource($data);
  108. } else {
  109. return $data;
  110. }
  111. }
  112. /**
  113. * Get a verification token for placing on a website or domain. (webResource.getToken)
  114. *
  115. * @param array $optParams Optional parameters. Valid optional parameters are listed below.
  116. *
  117. * @opt_param string verificationMethod The method to use for verifying a site or domain.
  118. * @opt_param string identifier The URL or domain to verify.
  119. * @opt_param string type Type of resource to verify. Can be 'site' (URL) or 'inet_domain' (domain name).
  120. * @return SiteVerificationWebResourceGettokenResponse
  121. */
  122. public function getToken($optParams = array()) {
  123. $params = array();
  124. $params = array_merge($params, $optParams);
  125. $data = $this->__call('getToken', array($params));
  126. if ($this->useObjects()) {
  127. return new SiteVerificationWebResourceGettokenResponse($data);
  128. } else {
  129. return $data;
  130. }
  131. }
  132. /**
  133. * Relinquish ownership of a website or domain. (webResource.delete)
  134. *
  135. * @param string $id The id of a verified site or domain.
  136. */
  137. public function delete($id, $optParams = array()) {
  138. $params = array('id' => $id);
  139. $params = array_merge($params, $optParams);
  140. $data = $this->__call('delete', array($params));
  141. return $data;
  142. }
  143. }
  144. /**
  145. * Service definition for SiteVerification (v1).
  146. *
  147. * <p>
  148. * Lets you programatically verify ownership of websites or domains with Google.
  149. * </p>
  150. *
  151. * <p>
  152. * For more information about this service, see the
  153. * <a href="http://code.google.com/apis/siteverification/" target="_blank">API Documentation</a>
  154. * </p>
  155. *
  156. * @author Google, Inc.
  157. */
  158. class apiSiteVerificationService extends apiService {
  159. public $webResource;
  160. /**
  161. * Constructs the internal representation of the SiteVerification service.
  162. *
  163. * @param apiClient apiClient
  164. */
  165. public function __construct(apiClient $apiClient) {
  166. $this->rpcPath = '/rpc';
  167. $this->restBasePath = '/siteVerification/v1/';
  168. $this->version = 'v1';
  169. $this->serviceName = 'siteVerification';
  170. $apiClient->addService($this->serviceName, $this->version);
  171. $this->webResource = new WebResourceServiceResource($this, $this->serviceName, 'webResource', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/siteverification"], "parameters": {"verificationMethod": {"required": true, "type": "string", "location": "query"}}, "request": {"$ref": "SiteVerificationWebResourceResource"}, "id": "siteVerification.webResource.insert", "httpMethod": "POST", "path": "webResource", "response": {"$ref": "SiteVerificationWebResourceResource"}}, "get": {"scopes": ["https://www.googleapis.com/auth/siteverification"], "parameters": {"id": {"required": true, "type": "string", "location": "path"}}, "id": "siteVerification.webResource.get", "httpMethod": "GET", "path": "webResource/{id}", "response": {"$ref": "SiteVerificationWebResourceResource"}}, "list": {"scopes": ["https://www.googleapis.com/auth/siteverification"], "id": "siteVerification.webResource.list", "httpMethod": "GET", "path": "webResource", "response": {"$ref": "SiteVerificationWebResourceListResponse"}}, "update": {"scopes": ["https://www.googleapis.com/auth/siteverification"], "parameters": {"id": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "SiteVerificationWebResourceResource"}, "id": "siteVerification.webResource.update", "httpMethod": "PUT", "path": "webResource/{id}", "response": {"$ref": "SiteVerificationWebResourceResource"}}, "patch": {"scopes": ["https://www.googleapis.com/auth/siteverification"], "parameters": {"id": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "SiteVerificationWebResourceResource"}, "id": "siteVerification.webResource.patch", "httpMethod": "PATCH", "path": "webResource/{id}", "response": {"$ref": "SiteVerificationWebResourceResource"}}, "getToken": {"scopes": ["https://www.googleapis.com/auth/siteverification"], "parameters": {"type": {"type": "string", "location": "query"}, "identifier": {"type": "string", "location": "query"}, "verificationMethod": {"type": "string", "location": "query"}}, "response": {"$ref": "SiteVerificationWebResourceGettokenResponse"}, "httpMethod": "GET", "path": "token", "id": "siteVerification.webResource.getToken"}, "delete": {"scopes": ["https://www.googleapis.com/auth/siteverification"], "parameters": {"id": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE", "path": "webResource/{id}", "id": "siteVerification.webResource.delete"}}}', true));
  172. }
  173. }
  174. class SiteVerificationWebResourceGettokenRequest extends apiModel {
  175. public $verificationMethod;
  176. protected $__siteType = 'SiteVerificationWebResourceGettokenRequestSite';
  177. protected $__siteDataType = '';
  178. public $site;
  179. public function setVerificationMethod($verificationMethod) {
  180. $this->verificationMethod = $verificationMethod;
  181. }
  182. public function getVerificationMethod() {
  183. return $this->verificationMethod;
  184. }
  185. public function setSite(SiteVerificationWebResourceGettokenRequestSite $site) {
  186. $this->site = $site;
  187. }
  188. public function getSite() {
  189. return $this->site;
  190. }
  191. }
  192. class SiteVerificationWebResourceGettokenRequestSite extends apiModel {
  193. public $identifier;
  194. public $type;
  195. public function setIdentifier($identifier) {
  196. $this->identifier = $identifier;
  197. }
  198. public function getIdentifier() {
  199. return $this->identifier;
  200. }
  201. public function setType($type) {
  202. $this->type = $type;
  203. }
  204. public function getType() {
  205. return $this->type;
  206. }
  207. }
  208. class SiteVerificationWebResourceGettokenResponse extends apiModel {
  209. public $token;
  210. public $method;
  211. public function setToken($token) {
  212. $this->token = $token;
  213. }
  214. public function getToken() {
  215. return $this->token;
  216. }
  217. public function setMethod($method) {
  218. $this->method = $method;
  219. }
  220. public function getMethod() {
  221. return $this->method;
  222. }
  223. }
  224. class SiteVerificationWebResourceListResponse extends apiModel {
  225. protected $__itemsType = 'SiteVerificationWebResourceResource';
  226. protected $__itemsDataType = 'array';
  227. public $items;
  228. public function setItems(/* array(SiteVerificationWebResourceResource) */ $items) {
  229. $this->assertIsArray($items, 'SiteVerificationWebResourceResource', __METHOD__);
  230. $this->items = $items;
  231. }
  232. public function getItems() {
  233. return $this->items;
  234. }
  235. }
  236. class SiteVerificationWebResourceResource extends apiModel {
  237. public $owners;
  238. public $id;
  239. protected $__siteType = 'SiteVerificationWebResourceResourceSite';
  240. protected $__siteDataType = '';
  241. public $site;
  242. public function setOwners(/* array(string) */ $owners) {
  243. $this->assertIsArray($owners, 'string', __METHOD__);
  244. $this->owners = $owners;
  245. }
  246. public function getOwners() {
  247. return $this->owners;
  248. }
  249. public function setId($id) {
  250. $this->id = $id;
  251. }
  252. public function getId() {
  253. return $this->id;
  254. }
  255. public function setSite(SiteVerificationWebResourceResourceSite $site) {
  256. $this->site = $site;
  257. }
  258. public function getSite() {
  259. return $this->site;
  260. }
  261. }
  262. class SiteVerificationWebResourceResourceSite extends apiModel {
  263. public $identifier;
  264. public $type;
  265. public function setIdentifier($identifier) {
  266. $this->identifier = $identifier;
  267. }
  268. public function getIdentifier() {
  269. return $this->identifier;
  270. }
  271. public function setType($type) {
  272. $this->type = $type;
  273. }
  274. public function getType() {
  275. return $this->type;
  276. }
  277. }