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