/plugins/google/api/contrib/Google_Oauth2Service.php

https://bitbucket.org/zeroonea/rerephpfw · PHP · 265 lines · 183 code · 14 blank · 68 comment · 4 complexity · 9273a2ae188738ccd091017212495197 MD5 · raw file

  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. * The "userinfo" collection of methods.
  17. * Typical usage is:
  18. * <code>
  19. * $oauth2Service = new Google_Oauth2Service(...);
  20. * $userinfo = $oauth2Service->userinfo;
  21. * </code>
  22. */
  23. class Google_UserinfoServiceResource extends Google_ServiceResource {
  24. /**
  25. * (userinfo.get)
  26. *
  27. * @param array $optParams Optional parameters.
  28. * @return Google_Userinfo
  29. */
  30. public function get($optParams = array()) {
  31. $params = array();
  32. $params = array_merge($params, $optParams);
  33. $data = $this->__call('get', array($params));
  34. if ($this->useObjects()) {
  35. return new Google_Userinfo($data);
  36. } else {
  37. return $data;
  38. }
  39. }
  40. }
  41. /**
  42. * The "v2" collection of methods.
  43. * Typical usage is:
  44. * <code>
  45. * $oauth2Service = new Google_Oauth2Service(...);
  46. * $v2 = $oauth2Service->v2;
  47. * </code>
  48. */
  49. class Google_UserinfoV2ServiceResource extends Google_ServiceResource {
  50. }
  51. /**
  52. * The "me" collection of methods.
  53. * Typical usage is:
  54. * <code>
  55. * $oauth2Service = new Google_Oauth2Service(...);
  56. * $me = $oauth2Service->me;
  57. * </code>
  58. */
  59. class Google_UserinfoV2MeServiceResource extends Google_ServiceResource {
  60. /**
  61. * (me.get)
  62. *
  63. * @param array $optParams Optional parameters.
  64. * @return Google_Userinfo
  65. */
  66. public function get($optParams = array()) {
  67. $params = array();
  68. $params = array_merge($params, $optParams);
  69. $data = $this->__call('get', array($params));
  70. if ($this->useObjects()) {
  71. return new Google_Userinfo($data);
  72. } else {
  73. return $data;
  74. }
  75. }
  76. }
  77. /**
  78. * Service definition for Google_Oauth2 (v2).
  79. *
  80. * <p>
  81. * OAuth2 API
  82. * </p>
  83. *
  84. * <p>
  85. * For more information about this service, see the
  86. * <a href="" target="_blank">API Documentation</a>
  87. * </p>
  88. *
  89. * @author Google, Inc.
  90. */
  91. class Google_Oauth2Service extends Google_Service {
  92. public $userinfo;
  93. public $userinfo_v2_me;
  94. /**
  95. * Constructs the internal representation of the Oauth2 service.
  96. *
  97. * @param Google_Client $client
  98. */
  99. public function __construct(Google_Client $client) {
  100. $this->servicePath = '';
  101. $this->version = 'v2';
  102. $this->serviceName = 'oauth2';
  103. $client->addService($this->serviceName, $this->version);
  104. $this->userinfo = new Google_UserinfoServiceResource($this, $this->serviceName, 'userinfo', json_decode('{"methods": {"get": {"path": "oauth2/v2/userinfo", "scopes": ["https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile"], "id": "oauth2.userinfo.get", "httpMethod": "GET", "response": {"$ref": "Userinfo"}}}}', true));
  105. $this->userinfo_v2_me = new Google_UserinfoV2MeServiceResource($this, $this->serviceName, 'me', json_decode('{"methods": {"get": {"path": "userinfo/v2/me", "scopes": ["https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile"], "id": "oauth2.userinfo.v2.me.get", "httpMethod": "GET", "response": {"$ref": "Userinfo"}}}}', true));
  106. }
  107. }
  108. class Google_Tokeninfo extends Google_Model {
  109. public $issued_to;
  110. public $user_id;
  111. public $expires_in;
  112. public $access_type;
  113. public $audience;
  114. public $scope;
  115. public $email;
  116. public $verified_email;
  117. public function setIssued_to($issued_to) {
  118. $this->issued_to = $issued_to;
  119. }
  120. public function getIssued_to() {
  121. return $this->issued_to;
  122. }
  123. public function setUser_id($user_id) {
  124. $this->user_id = $user_id;
  125. }
  126. public function getUser_id() {
  127. return $this->user_id;
  128. }
  129. public function setExpires_in($expires_in) {
  130. $this->expires_in = $expires_in;
  131. }
  132. public function getExpires_in() {
  133. return $this->expires_in;
  134. }
  135. public function setAccess_type($access_type) {
  136. $this->access_type = $access_type;
  137. }
  138. public function getAccess_type() {
  139. return $this->access_type;
  140. }
  141. public function setAudience($audience) {
  142. $this->audience = $audience;
  143. }
  144. public function getAudience() {
  145. return $this->audience;
  146. }
  147. public function setScope($scope) {
  148. $this->scope = $scope;
  149. }
  150. public function getScope() {
  151. return $this->scope;
  152. }
  153. public function setEmail($email) {
  154. $this->email = $email;
  155. }
  156. public function getEmail() {
  157. return $this->email;
  158. }
  159. public function setVerified_email($verified_email) {
  160. $this->verified_email = $verified_email;
  161. }
  162. public function getVerified_email() {
  163. return $this->verified_email;
  164. }
  165. }
  166. class Google_Userinfo extends Google_Model {
  167. public $family_name;
  168. public $name;
  169. public $picture;
  170. public $locale;
  171. public $gender;
  172. public $email;
  173. public $birthday;
  174. public $link;
  175. public $given_name;
  176. public $timezone;
  177. public $id;
  178. public $verified_email;
  179. public function setFamily_name($family_name) {
  180. $this->family_name = $family_name;
  181. }
  182. public function getFamily_name() {
  183. return $this->family_name;
  184. }
  185. public function setName($name) {
  186. $this->name = $name;
  187. }
  188. public function getName() {
  189. return $this->name;
  190. }
  191. public function setPicture($picture) {
  192. $this->picture = $picture;
  193. }
  194. public function getPicture() {
  195. return $this->picture;
  196. }
  197. public function setLocale($locale) {
  198. $this->locale = $locale;
  199. }
  200. public function getLocale() {
  201. return $this->locale;
  202. }
  203. public function setGender($gender) {
  204. $this->gender = $gender;
  205. }
  206. public function getGender() {
  207. return $this->gender;
  208. }
  209. public function setEmail($email) {
  210. $this->email = $email;
  211. }
  212. public function getEmail() {
  213. return $this->email;
  214. }
  215. public function setBirthday($birthday) {
  216. $this->birthday = $birthday;
  217. }
  218. public function getBirthday() {
  219. return $this->birthday;
  220. }
  221. public function setLink($link) {
  222. $this->link = $link;
  223. }
  224. public function getLink() {
  225. return $this->link;
  226. }
  227. public function setGiven_name($given_name) {
  228. $this->given_name = $given_name;
  229. }
  230. public function getGiven_name() {
  231. return $this->given_name;
  232. }
  233. public function setTimezone($timezone) {
  234. $this->timezone = $timezone;
  235. }
  236. public function getTimezone() {
  237. return $this->timezone;
  238. }
  239. public function setId($id) {
  240. $this->id = $id;
  241. }
  242. public function getId() {
  243. return $this->id;
  244. }
  245. public function setVerified_email($verified_email) {
  246. $this->verified_email = $verified_email;
  247. }
  248. public function getVerified_email() {
  249. return $this->verified_email;
  250. }
  251. }