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 "url" collection of methods. 19 * Typical usage is: 20 * <code> 21 * $urlshortenerService = new Google_UrlshortenerService(...); 22 * $url = $urlshortenerService->url; 23 * </code> 24 */ 25 class Google_UrlServiceResource extends Google_ServiceResource { 26 27 /** 28 * Expands a short URL or gets creation time and analytics. (url.get) 29 * 30 * @param string $shortUrl The short URL, including the protocol. 31 * @param array $optParams Optional parameters. 32 * 33 * @opt_param string projection Additional information to return. 34 * @return Google_Url 35 */ 36 public function get($shortUrl, $optParams = array()) { 37 $params = array('shortUrl' => $shortUrl); 38 $params = array_merge($params, $optParams); 39 $data = $this->__call('get', array($params)); 40 if ($this->useObjects()) { 41 return new Google_Url($data); 42 } else { 43 return $data; 44 } 45 } 46 /** 47 * Creates a new short URL. (url.insert) 48 * 49 * @param Google_Url $postBody 50 * @param array $optParams Optional parameters. 51 * @return Google_Url 52 */ 53 public function insert(Google_Url $postBody, $optParams = array()) { 54 $params = array('postBody' => $postBody); 55 $params = array_merge($params, $optParams); 56 $data = $this->__call('insert', array($params)); 57 if ($this->useObjects()) { 58 return new Google_Url($data); 59 } else { 60 return $data; 61 } 62 } 63 /** 64 * Retrieves a list of URLs shortened by a user. (url.list) 65 * 66 * @param array $optParams Optional parameters. 67 * 68 * @opt_param string projection Additional information to return. 69 * @opt_param string start-token Token for requesting successive pages of results. 70 * @return Google_UrlHistory 71 */ 72 public function listUrl($optParams = array()) { 73 $params = array(); 74 $params = array_merge($params, $optParams); 75 $data = $this->__call('list', array($params)); 76 if ($this->useObjects()) { 77 return new Google_UrlHistory($data); 78 } else { 79 return $data; 80 } 81 } 82 } 83 84/** 85 * Service definition for Google_Urlshortener (v1). 86 * 87 * <p> 88 * Lets you create, inspect, and manage goo.gl short URLs 89 * </p> 90 * 91 * <p> 92 * For more information about this service, see the 93 * <a href="http://code.google.com/apis/urlshortener/v1/getting_started.html" target="_blank">API Documentation</a> 94 * </p> 95 * 96 * @author Google, Inc. 97 */ 98class Google_UrlshortenerService extends Google_Service { 99 public $url; 100 /** 101 * Constructs the internal representation of the Urlshortener service. 102 * 103 * @param Google_Client $client 104 */ 105 public function __construct(Google_Client $client) { 106 $this->servicePath = 'urlshortener/v1/'; 107 $this->version = 'v1'; 108 $this->serviceName = 'urlshortener'; 109 110 $client->addService($this->serviceName, $this->version); 111 $this->url = new Google_UrlServiceResource($this, $this->serviceName, 'url', json_decode('{"methods": {"get": {"id": "urlshortener.url.get", "path": "url", "httpMethod": "GET", "parameters": {"projection": {"type": "string", "enum": ["ANALYTICS_CLICKS", "ANALYTICS_TOP_STRINGS", "FULL"], "location": "query"}, "shortUrl": {"type": "string", "required": true, "location": "query"}}, "response": {"$ref": "Url"}}, "insert": {"id": "urlshortener.url.insert", "path": "url", "httpMethod": "POST", "request": {"$ref": "Url"}, "response": {"$ref": "Url"}, "scopes": ["https://www.googleapis.com/auth/urlshortener"]}, "list": {"id": "urlshortener.url.list", "path": "url/history", "httpMethod": "GET", "parameters": {"projection": {"type": "string", "enum": ["ANALYTICS_CLICKS", "FULL"], "location": "query"}, "start-token": {"type": "string", "location": "query"}}, "response": {"$ref": "UrlHistory"}, "scopes": ["https://www.googleapis.com/auth/urlshortener"]}}}', true)); 112 113 } 114} 115 116 117 118class Google_AnalyticsSnapshot extends Google_Model { 119 protected $__browsersType = 'Google_StringCount'; 120 protected $__browsersDataType = 'array'; 121 public $browsers; 122 protected $__countriesType = 'Google_StringCount'; 123 protected $__countriesDataType = 'array'; 124 public $countries; 125 public $longUrlClicks; 126 protected $__platformsType = 'Google_StringCount'; 127 protected $__platformsDataType = 'array'; 128 public $platforms; 129 protected $__referrersType = 'Google_StringCount'; 130 protected $__referrersDataType = 'array'; 131 public $referrers; 132 public $shortUrlClicks; 133 public function setBrowsers(/* array(Google_StringCount) */ $browsers) { 134 $this->assertIsArray($browsers, 'Google_StringCount', __METHOD__); 135 $this->browsers = $browsers; 136 } 137 public function getBrowsers() { 138 return $this->browsers; 139 } 140 public function setCountries(/* array(Google_StringCount) */ $countries) { 141 $this->assertIsArray($countries, 'Google_StringCount', __METHOD__); 142 $this->countries = $countries; 143 } 144 public function getCountries() { 145 return $this->countries; 146 } 147 public function setLongUrlClicks( $longUrlClicks) { 148 $this->longUrlClicks = $longUrlClicks; 149 } 150 public function getLongUrlClicks() { 151 return $this->longUrlClicks; 152 } 153 public function setPlatforms(/* array(Google_StringCount) */ $platforms) { 154 $this->assertIsArray($platforms, 'Google_StringCount', __METHOD__); 155 $this->platforms = $platforms; 156 } 157 public function getPlatforms() { 158 return $this->platforms; 159 } 160 public function setReferrers(/* array(Google_StringCount) */ $referrers) { 161 $this->assertIsArray($referrers, 'Google_StringCount', __METHOD__); 162 $this->referrers = $referrers; 163 } 164 public function getReferrers() { 165 return $this->referrers; 166 } 167 public function setShortUrlClicks( $shortUrlClicks) { 168 $this->shortUrlClicks = $shortUrlClicks; 169 } 170 public function getShortUrlClicks() { 171 return $this->shortUrlClicks; 172 } 173} 174 175class Google_AnalyticsSummary extends Google_Model { 176 protected $__allTimeType = 'Google_AnalyticsSnapshot'; 177 protected $__allTimeDataType = ''; 178 public $allTime; 179 protected $__dayType = 'Google_AnalyticsSnapshot'; 180 protected $__dayDataType = ''; 181 public $day; 182 protected $__monthType = 'Google_AnalyticsSnapshot'; 183 protected $__monthDataType = ''; 184 public $month; 185 protected $__twoHoursType = 'Google_AnalyticsSnapshot'; 186 protected $__twoHoursDataType = ''; 187 public $twoHours; 188 protected $__weekType = 'Google_AnalyticsSnapshot'; 189 protected $__weekDataType = ''; 190 public $week; 191 public function setAllTime(Google_AnalyticsSnapshot $allTime) { 192 $this->allTime = $allTime; 193 } 194 public function getAllTime() { 195 return $this->allTime; 196 } 197 public function setDay(Google_AnalyticsSnapshot $day) { 198 $this->day = $day; 199 } 200 public function getDay() { 201 return $this->day; 202 } 203 public function setMonth(Google_AnalyticsSnapshot $month) { 204 $this->month = $month; 205 } 206 public function getMonth() { 207 return $this->month; 208 } 209 public function setTwoHours(Google_AnalyticsSnapshot $twoHours) { 210 $this->twoHours = $twoHours; 211 } 212 public function getTwoHours() { 213 return $this->twoHours; 214 } 215 public function setWeek(Google_AnalyticsSnapshot $week) { 216 $this->week = $week; 217 } 218 public function getWeek() { 219 return $this->week; 220 } 221} 222 223class Google_StringCount extends Google_Model { 224 public $count; 225 public $id; 226 public function setCount( $count) { 227 $this->count = $count; 228 } 229 public function getCount() { 230 return $this->count; 231 } 232 public function setId( $id) { 233 $this->id = $id; 234 } 235 public function getId() { 236 return $this->id; 237 } 238} 239 240class Google_Url extends Google_Model { 241 protected $__analyticsType = 'Google_AnalyticsSummary'; 242 protected $__analyticsDataType = ''; 243 public $analytics; 244 public $created; 245 public $id; 246 public $kind; 247 public $longUrl; 248 public $status; 249 public function setAnalytics(Google_AnalyticsSummary $analytics) { 250 $this->analytics = $analytics; 251 } 252 public function getAnalytics() { 253 return $this->analytics; 254 } 255 public function setCreated( $created) { 256 $this->created = $created; 257 } 258 public function getCreated() { 259 return $this->created; 260 } 261 public function setId( $id) { 262 $this->id = $id; 263 } 264 public function getId() { 265 return $this->id; 266 } 267 public function setKind( $kind) { 268 $this->kind = $kind; 269 } 270 public function getKind() { 271 return $this->kind; 272 } 273 public function setLongUrl( $longUrl) { 274 $this->longUrl = $longUrl; 275 } 276 public function getLongUrl() { 277 return $this->longUrl; 278 } 279 public function setStatus( $status) { 280 $this->status = $status; 281 } 282 public function getStatus() { 283 return $this->status; 284 } 285} 286 287class Google_UrlHistory extends Google_Model { 288 protected $__itemsType = 'Google_Url'; 289 protected $__itemsDataType = 'array'; 290 public $items; 291 public $itemsPerPage; 292 public $kind; 293 public $nextPageToken; 294 public $totalItems; 295 public function setItems(/* array(Google_Url) */ $items) { 296 $this->assertIsArray($items, 'Google_Url', __METHOD__); 297 $this->items = $items; 298 } 299 public function getItems() { 300 return $this->items; 301 } 302 public function setItemsPerPage( $itemsPerPage) { 303 $this->itemsPerPage = $itemsPerPage; 304 } 305 public function getItemsPerPage() { 306 return $this->itemsPerPage; 307 } 308 public function setKind( $kind) { 309 $this->kind = $kind; 310 } 311 public function getKind() { 312 return $this->kind; 313 } 314 public function setNextPageToken( $nextPageToken) { 315 $this->nextPageToken = $nextPageToken; 316 } 317 public function getNextPageToken() { 318 return $this->nextPageToken; 319 } 320 public function setTotalItems( $totalItems) { 321 $this->totalItems = $totalItems; 322 } 323 public function getTotalItems() { 324 return $this->totalItems; 325 } 326} 327