PageRenderTime 81ms CodeModel.GetById 28ms RepoModel.GetById 1ms app.codeStats 0ms

/content/plugins/w3-total-cache/lib/Google/Service/Oauth2.php

https://gitlab.com/karlen/ayo_wp
PHP | 409 lines | 285 code | 39 blank | 85 comment | 0 complexity | 6bb0781187bbd800a8c0f1740b9cd92e MD5 | raw file
  1. <?php
  2. /*
  3. * Copyright 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. * Service definition for Oauth2 (v2).
  19. *
  20. * <p>
  21. * Lets you access OAuth2 protocol related APIs.
  22. * </p>
  23. *
  24. * <p>
  25. * For more information about this service, see the API
  26. * <a href="https://developers.google.com/accounts/docs/OAuth2" target="_blank">Documentation</a>
  27. * </p>
  28. *
  29. * @author Google, Inc.
  30. */
  31. class W3TCG_Google_Service_Oauth2 extends W3TCG_Google_Service
  32. {
  33. /** Know your basic profile info and list of people in your circles.. */
  34. const PLUS_LOGIN = "https://www.googleapis.com/auth/plus.login";
  35. /** Know who you are on Google. */
  36. const PLUS_ME = "https://www.googleapis.com/auth/plus.me";
  37. /** View your email address. */
  38. const USERINFO_EMAIL = "https://www.googleapis.com/auth/userinfo.email";
  39. /** View your basic profile info. */
  40. const USERINFO_PROFILE = "https://www.googleapis.com/auth/userinfo.profile";
  41. public $userinfo;
  42. public $userinfo_v2_me;
  43. private $base_methods;
  44. /**
  45. * Constructs the internal representation of the Oauth2 service.
  46. *
  47. * @param W3TCG_Google_Client $client
  48. */
  49. public function __construct(W3TCG_Google_Client $client)
  50. {
  51. parent::__construct($client);
  52. $this->servicePath = '';
  53. $this->version = 'v2';
  54. $this->serviceName = 'oauth2';
  55. $this->userinfo = new W3TCG_Google_Service_Oauth2_Userinfo_Resource(
  56. $this,
  57. $this->serviceName,
  58. 'userinfo',
  59. array(
  60. 'methods' => array(
  61. 'get' => array(
  62. 'path' => 'oauth2/v2/userinfo',
  63. 'httpMethod' => 'GET',
  64. 'parameters' => array(),
  65. ),
  66. )
  67. )
  68. );
  69. $this->userinfo_v2_me = new W3TCG_Google_Service_Oauth2_UserinfoV2Me_Resource(
  70. $this,
  71. $this->serviceName,
  72. 'me',
  73. array(
  74. 'methods' => array(
  75. 'get' => array(
  76. 'path' => 'userinfo/v2/me',
  77. 'httpMethod' => 'GET',
  78. 'parameters' => array(),
  79. ),
  80. )
  81. )
  82. );
  83. $this->base_methods = new W3TCG_Google_Service_Resource(
  84. $this,
  85. $this->serviceName,
  86. '',
  87. array(
  88. 'methods' => array(
  89. 'tokeninfo' => array(
  90. 'path' => 'oauth2/v2/tokeninfo',
  91. 'httpMethod' => 'POST',
  92. 'parameters' => array(
  93. 'access_token' => array(
  94. 'location' => 'query',
  95. 'type' => 'string',
  96. ),
  97. 'id_token' => array(
  98. 'location' => 'query',
  99. 'type' => 'string',
  100. ),
  101. ),
  102. ),
  103. )
  104. )
  105. );
  106. }
  107. /**
  108. * (tokeninfo)
  109. *
  110. * @param array $optParams Optional parameters.
  111. *
  112. * @opt_param string access_token
  113. *
  114. * @opt_param string id_token
  115. *
  116. * @return W3TCG_Google_Service_Oauth2_Tokeninfo
  117. */
  118. public function tokeninfo($optParams = array())
  119. {
  120. $params = array();
  121. $params = array_merge($params, $optParams);
  122. return $this->base_methods->call('tokeninfo', array($params), "W3TCG_Google_Service_Oauth2_Tokeninfo");
  123. }
  124. }
  125. /**
  126. * The "userinfo" collection of methods.
  127. * Typical usage is:
  128. * <code>
  129. * $oauth2Service = new W3TCG_Google_Service_Oauth2(...);
  130. * $userinfo = $oauth2Service->userinfo;
  131. * </code>
  132. */
  133. class W3TCG_Google_Service_Oauth2_Userinfo_Resource extends W3TCG_Google_Service_Resource
  134. {
  135. /**
  136. * (userinfo.get)
  137. *
  138. * @param array $optParams Optional parameters.
  139. * @return W3TCG_Google_Service_Oauth2_Userinfoplus
  140. */
  141. public function get($optParams = array())
  142. {
  143. $params = array();
  144. $params = array_merge($params, $optParams);
  145. return $this->call('get', array($params), "W3TCG_Google_Service_Oauth2_Userinfoplus");
  146. }
  147. }
  148. /**
  149. * The "v2" collection of methods.
  150. * Typical usage is:
  151. * <code>
  152. * $oauth2Service = new W3TCG_Google_Service_Oauth2(...);
  153. * $v2 = $oauth2Service->v2;
  154. * </code>
  155. */
  156. class W3TCG_Google_Service_Oauth2_UserinfoV2_Resource extends W3TCG_Google_Service_Resource
  157. {
  158. }
  159. /**
  160. * The "me" collection of methods.
  161. * Typical usage is:
  162. * <code>
  163. * $oauth2Service = new W3TCG_Google_Service_Oauth2(...);
  164. * $me = $oauth2Service->me;
  165. * </code>
  166. */
  167. class W3TCG_Google_Service_Oauth2_UserinfoV2Me_Resource extends W3TCG_Google_Service_Resource
  168. {
  169. /**
  170. * (me.get)
  171. *
  172. * @param array $optParams Optional parameters.
  173. * @return W3TCG_Google_Service_Oauth2_Userinfoplus
  174. */
  175. public function get($optParams = array())
  176. {
  177. $params = array();
  178. $params = array_merge($params, $optParams);
  179. return $this->call('get', array($params), "W3TCG_Google_Service_Oauth2_Userinfoplus");
  180. }
  181. }
  182. class W3TCG_Google_Service_Oauth2_Tokeninfo extends W3TCG_Google_Model
  183. {
  184. protected $internal_gapi_mappings = array(
  185. "accessType" => "access_type",
  186. "expiresIn" => "expires_in",
  187. "issuedTo" => "issued_to",
  188. "userId" => "user_id",
  189. "verifiedEmail" => "verified_email",
  190. );
  191. public $accessType;
  192. public $audience;
  193. public $email;
  194. public $expiresIn;
  195. public $issuedTo;
  196. public $scope;
  197. public $userId;
  198. public $verifiedEmail;
  199. public function setAccessType($accessType)
  200. {
  201. $this->accessType = $accessType;
  202. }
  203. public function getAccessType()
  204. {
  205. return $this->accessType;
  206. }
  207. public function setAudience($audience)
  208. {
  209. $this->audience = $audience;
  210. }
  211. public function getAudience()
  212. {
  213. return $this->audience;
  214. }
  215. public function setEmail($email)
  216. {
  217. $this->email = $email;
  218. }
  219. public function getEmail()
  220. {
  221. return $this->email;
  222. }
  223. public function setExpiresIn($expiresIn)
  224. {
  225. $this->expiresIn = $expiresIn;
  226. }
  227. public function getExpiresIn()
  228. {
  229. return $this->expiresIn;
  230. }
  231. public function setIssuedTo($issuedTo)
  232. {
  233. $this->issuedTo = $issuedTo;
  234. }
  235. public function getIssuedTo()
  236. {
  237. return $this->issuedTo;
  238. }
  239. public function setScope($scope)
  240. {
  241. $this->scope = $scope;
  242. }
  243. public function getScope()
  244. {
  245. return $this->scope;
  246. }
  247. public function setUserId($userId)
  248. {
  249. $this->userId = $userId;
  250. }
  251. public function getUserId()
  252. {
  253. return $this->userId;
  254. }
  255. public function setVerifiedEmail($verifiedEmail)
  256. {
  257. $this->verifiedEmail = $verifiedEmail;
  258. }
  259. public function getVerifiedEmail()
  260. {
  261. return $this->verifiedEmail;
  262. }
  263. }
  264. class W3TCG_Google_Service_Oauth2_Userinfoplus extends W3TCG_Google_Model
  265. {
  266. protected $internal_gapi_mappings = array(
  267. "familyName" => "family_name",
  268. "givenName" => "given_name",
  269. "verifiedEmail" => "verified_email",
  270. );
  271. public $email;
  272. public $familyName;
  273. public $gender;
  274. public $givenName;
  275. public $hd;
  276. public $id;
  277. public $link;
  278. public $locale;
  279. public $name;
  280. public $picture;
  281. public $verifiedEmail;
  282. public function setEmail($email)
  283. {
  284. $this->email = $email;
  285. }
  286. public function getEmail()
  287. {
  288. return $this->email;
  289. }
  290. public function setFamilyName($familyName)
  291. {
  292. $this->familyName = $familyName;
  293. }
  294. public function getFamilyName()
  295. {
  296. return $this->familyName;
  297. }
  298. public function setGender($gender)
  299. {
  300. $this->gender = $gender;
  301. }
  302. public function getGender()
  303. {
  304. return $this->gender;
  305. }
  306. public function setGivenName($givenName)
  307. {
  308. $this->givenName = $givenName;
  309. }
  310. public function getGivenName()
  311. {
  312. return $this->givenName;
  313. }
  314. public function setHd($hd)
  315. {
  316. $this->hd = $hd;
  317. }
  318. public function getHd()
  319. {
  320. return $this->hd;
  321. }
  322. public function setId($id)
  323. {
  324. $this->id = $id;
  325. }
  326. public function getId()
  327. {
  328. return $this->id;
  329. }
  330. public function setLink($link)
  331. {
  332. $this->link = $link;
  333. }
  334. public function getLink()
  335. {
  336. return $this->link;
  337. }
  338. public function setLocale($locale)
  339. {
  340. $this->locale = $locale;
  341. }
  342. public function getLocale()
  343. {
  344. return $this->locale;
  345. }
  346. public function setName($name)
  347. {
  348. $this->name = $name;
  349. }
  350. public function getName()
  351. {
  352. return $this->name;
  353. }
  354. public function setPicture($picture)
  355. {
  356. $this->picture = $picture;
  357. }
  358. public function getPicture()
  359. {
  360. return $this->picture;
  361. }
  362. public function setVerifiedEmail($verifiedEmail)
  363. {
  364. $this->verifiedEmail = $verifiedEmail;
  365. }
  366. public function getVerifiedEmail()
  367. {
  368. return $this->verifiedEmail;
  369. }
  370. }