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