public function actionDefault() { $google_config = NEnvironment::getConfig()->google; require_once LIBS_DIR . '/google-api-php-client/src/apiClient.php'; require_once LIBS_DIR . '/google-api-php-client/src/contrib/apiOauth2Service.php'; require_once LIBS_DIR . '/google-api-php-client/src/contrib/apiAnalyticsService.php'; $client = new apiClient(); $client->setApplicationName('Google+ PHP Starter Application'); // Visit https://code.google.com/apis/console?api=plus to generate your // client id, client secret, and to register your redirect uri. // $client->setClientId( $google_config['client_id'] ); // $client->setClientSecret( $google_config['client_secret'] ); $client->setRedirectUri($google_config['redirect_url']); // $client->setDeveloperKey('AIzaSyCrViGDrmXAiLsQAoW1aOzkHddH9gHYzzs'); // [8] => Array // ( // [title] => www.propagacnepredmety.sk // [entryid] => http://www.google.com/analytics/feeds/accounts/ga:43556790 // [accountId] => 17205615 // [accountName] => www.vizion.sk // [profileId] => 43556790 // [webPropertyId] => UA-17205615-3 // [tableId] => ga:43556790 // ) $ga = new apiAnalyticsService($client); if (isset($_GET['code'])) { $ga->authenticate(); $_SESSION['token'] = $client->getAccessToken(); header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']); } if (isset($_SESSION['token'])) { $client->setAccessToken($_SESSION['token']); } if ($client->getAccessToken()) { $activities = $plus->activities->listActivities('me', 'public'); print 'Your Activities: <pre>' . print_r($activities, true) . '</pre>'; // The access token may have been updated. $_SESSION['token'] = $client->getAccessToken(); } else { $authUrl = $client->createAuthUrl(); print "<a class='login' href='{$authUrl}'>Connect Me!</a>"; } // $_SESSION['token'] = $client->getAccessToken(); $data = $ga->data_ga; $d = $data->get('17205615', date('Y-m-d', time() - 60 * 60 * 24 * 40), date('Y-m-d', time() - 60 * 60 * 24 * 1), 'ga:visits,ga:pageviews'); print_r($d); exit; }
/** * Constructs the internal service representations and does the auto-magic configuration required to drive them */ public function __construct(apiClient $apiClient) { $apiClient->addService('prediction', 'v1.1'); $this->io = $apiClient->getIo(); $this->training = new apiServiceResource($this, $this->serviceName, 'training', json_decode('{"methods":{"insert":{"pathUrl":"prediction\\/v1.1\\/training","rpcName":"prediction.training.insert","httpMethod":"POST","methodType":"rest","parameters":{"data":{"parameterType":"query","required":false}}},"delete":{"pathUrl":"prediction\\/v1.1\\/training\\/{data}","rpcName":"prediction.training.delete","httpMethod":"DELETE","methodType":"rest","parameters":{"data":{"parameterType":"path","pattern":"[^\\/]+","required":true}}},"get":{"pathUrl":"prediction\\/v1.1\\/training\\/{data}","rpcName":"prediction.training.get","httpMethod":"GET","methodType":"rest","parameters":{"data":{"parameterType":"path","pattern":"[^\\/]+","required":true}}}}}', true)); $this->prediction = new apiServiceResource($this, $this->serviceName, 'prediction', json_decode('{"methods":{"predict":{"pathUrl":"prediction\\/v1.1\\/training\\/{data}\\/predict","rpcName":"prediction.predict","httpMethod":"POST","methodType":"rest","parameters":{"input":{"parameterType":"query","required":false},"data":{"parameterType":"path","pattern":"[^\\/]+","required":true}}}}}', true)); }
/** * Constructs the internal service representations and does the auto-magic configuration required to drive them */ public function __construct(apiClient $apiClient) { $apiClient->addService('easyhybrid', 'v1'); $this->io = $apiClient->getIo(); $this->useremail = new apiServiceResource($this, $this->serviceName, 'useremail', json_decode('{"methods":{"get":{"pathUrl":"userinfo\\/email","rpcName":"auth.useremail.get","httpMethod":"GET","methodType":"rest"}}}', true)); $this->userinfo = new apiServiceResource($this, $this->serviceName, 'userinfo', json_decode('{"methods":{"get":{"pathUrl":"easyhybrid\\/userinfo","rpcName":"auth.userinfo.get","httpMethod":"GET","methodType":"rest"}}}', true)); }
public function __construct() { global $apiConfig, $apiBuzzTest_apiClient, $apiBuzzTest_buzz; parent::__construct(); if (! $apiBuzzTest_apiClient || ! $apiBuzzTest_buzz) { $this->origConfig = $apiConfig; // Set up a predictable, default environment so the test results are predictable //$apiConfig['oauth2_client_id'] = 'INSERT_CLIENT_ID'; //$apiConfig['oauth2_client_secret'] = 'INSERT_CLIENT_SECRET'; $apiConfig['authClass'] = 'apiOAuth2'; $apiConfig['ioClass'] = 'apiCurlIO'; $apiConfig['cacheClass'] = 'apiFileCache'; $apiConfig['ioFileCache_directory'] = '/tmp/googleApiTests'; // create the global api and buzz clients (which are shared between the various buzz test suites for performance reasons) $apiBuzzTest_apiClient = new apiClient(); $apiBuzzTest_buzz = new apiBuzzService($apiBuzzTest_apiClient); $apiBuzzTest_apiClient->setAccessToken($apiConfig['oauth_test_token']); } $this->apiClient = $apiBuzzTest_apiClient; $this->buzz = $apiBuzzTest_buzz; }
/** * Load the list of upcoming events in the UPL and return an array containing * an array of each event's information. */ function loadEvents() { if (!class_exists('apiClient')) { return array(); } // Load up the Google API client $client = new apiClient(); $client->setApplicationName('UPL Website'); $client->setUseObjects(true); apiKey($client); $cal = new apiCalendarService($client); // List all events in the UPL calendar $calendarId = '*****@*****.**'; $args = array('singleEvents' => true, 'orderBy' => 'startTime', 'maxResults' => 5, 'timeMin' => date(DateTime::RFC3339)); $events = $cal->events->listEvents($calendarId, $args); // Make sure that we at least have some events if (!$events) { return array(); } $events = $events->getItems(); if (!is_array($events)) { return array(); } // Just a little helper to convert dates function makeDate($evtDate) { return DateTime::createFromFormat(DateTime::RFC3339, $evtDate->getDateTime()); } function mapEvent($event) { return array('summary' => $event->getSummary(), 'start' => makeDate($event->getStart()), 'end' => makeDate($event->getEnd()), 'description' => $event->getDescription(), 'link' => $event->getHtmlLink()); } // Retrieve all our events return array_map(mapEvent, $events); }
/** * Constructs the internal service representations and does the auto-magic configuration required to drive them */ public function __construct(apiClient $apiClient) { $apiClient->addService('latitude', 'v1'); $this->io = $apiClient->getIo(); $this->location = new apiServiceResource($this, $this->serviceName, 'location', json_decode('{"methods":{"insert":{"pathUrl":"latitude\\/v1\\/location","rpcName":"latitude.location.insert","httpMethod":"POST","methodType":"rest"},"list":{"pathUrl":"latitude\\/v1\\/location","rpcName":"latitude.location.list","httpMethod":"GET","methodType":"rest","parameters":{"max-time":{"parameterType":"query","required":false},"min-time":{"parameterType":"query","required":false},"max-results":{"parameterType":"query","required":false},"granularity":{"parameterType":"query","required":false}}},"get":{"pathUrl":"latitude\\/v1\\/location\\/{locationId}","rpcName":"latitude.location.get","httpMethod":"GET","methodType":"rest","parameters":{"granularity":{"parameterType":"query","required":false},"locationId":{"parameterType":"path","pattern":"[^\\/]+","required":true}}},"delete":{"pathUrl":"latitude\\/v1\\/location\\/{locationId}","rpcName":"latitude.location.delete","httpMethod":"DELETE","methodType":"rest","parameters":{"locationId":{"parameterType":"path","pattern":"[^\\/]+","required":true}}}}}', true)); $this->currentLocation = new apiServiceResource($this, $this->serviceName, 'currentLocation', json_decode('{"methods":{"insert":{"pathUrl":"latitude\\/v1\\/currentLocation","rpcName":"latitude.currentLocation.insert","httpMethod":"POST","methodType":"rest"},"delete":{"pathUrl":"latitude\\/v1\\/currentLocation","rpcName":"latitude.currentLocation.delete","httpMethod":"DELETE","methodType":"rest"},"get":{"pathUrl":"latitude\\/v1\\/currentLocation","rpcName":"latitude.currentLocation.get","httpMethod":"GET","methodType":"rest","parameters":{"granularity":{"parameterType":"query","required":false}}}}}', true)); }
/** * Constructs the internal representation of the Pagespeedonline service. * * @param apiClient apiClient */ public function __construct(apiClient $apiClient) { $this->restBasePath = '/pagespeedonline/v1/'; $this->version = 'v1'; $this->serviceName = 'pagespeedonline'; $apiClient->addService($this->serviceName, $this->version); $this->pagespeedapi = new PagespeedapiServiceResource($this, $this->serviceName, 'pagespeedapi', json_decode('{"methods": {"runpagespeed": {"parameters": {"locale": {"type": "string", "location": "query"}, "url": {"required": true, "type": "string", "location": "query"}, "rule": {"repeated": true, "type": "string", "location": "query"}, "strategy": {"enum": ["desktop", "mobile"], "type": "string", "location": "query"}}, "id": "pagespeedonline.pagespeedapi.runpagespeed", "httpMethod": "GET", "path": "runPagespeed", "response": {"$ref": "Result"}}}}', true)); }
/** * Constructs the internal representation of the Webfonts service. * * @param apiClient apiClient */ public function __construct(apiClient $apiClient) { $this->restBasePath = '/webfonts/v1/'; $this->version = 'v1'; $this->serviceName = 'webfonts'; $apiClient->addService($this->serviceName, $this->version); $this->webfonts = new WebfontsServiceResource($this, $this->serviceName, 'webfonts', json_decode('{"methods": {"list": {"parameters": {"sort": {"enum": ["alpha", "date", "popularity", "style", "trending"], "type": "string", "location": "query"}}, "id": "webfonts.webfonts.list", "httpMethod": "GET", "path": "webfonts", "response": {"$ref": "WebfontList"}}}}', true)); }
/** * Constructs the internal representation of the Autocompleteapi service. * * @param apiClient apiClient */ public function __construct(apiClient $apiClient) { $this->rpcPath = '/rpc'; $this->restBasePath = '/search/v2/'; $this->version = '1.0'; $this->serviceName = 'autocompleteapi'; $this->io = $apiClient->getIo(); $apiClient->addService($this->serviceName, $this->version); $this->AutocompleteMethods = new AutocompleteMethodsServiceResource($this, $this->serviceName, 'AutocompleteMethods', json_decode('{"methods": {"Autocomplete": {"path": "{endpoint}/autocomplete", "httpMethod": "GET", "id": "AutocompleteAPI.Autocomplete", "parameters": {"endpoint": {"required": true, "default": "music", "enum": ["music", "amgvideo", "video"], "location": "path", "type": "string"}, "language": {"default": "en", "required": false, "type": "string", "location": "query"}, "format": {"required": false, "default": "json", "enum": ["json", "xml"], "location": "query", "type": "string"}, "country": {"default": "US", "required": false, "type": "string", "location": "query"}, "entitytype": {"required": true, "default": "", "enum": ["album", "song", "artist", "movie", "tvseries", "credit", "movie", "tvseries", "onetimeonly", "credit"], "location": "query", "type": "string"}, "filter": {"default": "", "required": false, "type": "string", "location": "query"}, "query": {"default": "", "required": true, "type": "string", "location": "query"}, "size": {"default": 20, "required": false, "type": "integer", "location": "query"}}}}}', true)); }
/** * Constructs the internal service representations and does the auto-magic configuration required to drive them */ public function __construct(apiClient $apiClient) { $apiClient->addService('buzz', 'v1'); $this->io = $apiClient->getIo(); $this->photos = new apiServiceResource($this, $this->serviceName, 'photos', json_decode('{"methods":{"insert":{"pathUrl":"buzz\\/v1\\/photos\\/{userId}\\/{albumId}","rpcName":"buzz.photos.insert","httpMethod":"POST","methodType":"rest","parameters":{"albumId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"hl":{"parameterType":"query","required":false}}}}}', true)); $this->feeds = new apiServiceResource($this, $this->serviceName, 'feeds', json_decode('{"methods":{"insert":{"pathUrl":"buzz\\/v1\\/feeds\\/{userId}\\/@self","rpcName":"buzz.feeds.insert","httpMethod":"POST","methodType":"rest","parameters":{"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"hl":{"parameterType":"query","required":false}}},"update":{"pathUrl":"buzz\\/v1\\/feeds\\/{userId}\\/@self\\/{siteId}","rpcName":"buzz.feeds.update","httpMethod":"PUT","methodType":"rest","parameters":{"siteId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"max-results":{"parameterType":"query","required":false},"c":{"parameterType":"query","required":false},"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"hl":{"parameterType":"query","required":false}}},"list":{"pathUrl":"buzz\\/v1\\/feeds\\/{userId}\\/{scope}","rpcName":"buzz.feeds.list","httpMethod":"GET","methodType":"rest","parameters":{"scope":{"parameterType":"path","pattern":"@.*","required":true},"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"hl":{"parameterType":"query","required":false}}},"delete":{"pathUrl":"buzz\\/v1\\/feeds\\/{userId}\\/@self\\/{siteId}","rpcName":"buzz.feeds.delete","httpMethod":"DELETE","methodType":"rest","parameters":{"siteId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"hl":{"parameterType":"query","required":false}}}}}', true)); $this->activities = new apiServiceResource($this, $this->serviceName, 'activities', json_decode('{"methods":{"update":{"pathUrl":"buzz\\/v1\\/activities\\/{userId}\\/{scope}\\/{postId}","rpcName":"buzz.activities.update","httpMethod":"PUT","methodType":"rest","parameters":{"scope":{"parameterType":"path","pattern":"@.*","required":true},"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"postId":{"parameterType":"path","pattern":".*","required":true},"hl":{"parameterType":"query","required":false},"abuseType":{"parameterType":"query","required":false}}},"extractPeopleFromSearch":{"pathUrl":"buzz\\/v1\\/activities\\/search\\/@people","rpcName":"buzz.activities.extractPeopleFromSearch","httpMethod":"POST","methodType":"rest","parameters":{"lon":{"parameterType":"query","required":false},"max-results":{"parameterType":"query","required":false},"c":{"parameterType":"query","required":false},"bbox":{"parameterType":"query","required":false},"q":{"parameterType":"query","required":false},"alt":{"parameterType":"query","required":false},"pid":{"parameterType":"query","required":false},"radius":{"parameterType":"query","required":false},"lat":{"parameterType":"query","required":false},"hl":{"parameterType":"query","required":false}}},"delete":{"pathUrl":"buzz\\/v1\\/activities\\/{userId}\\/{scope}\\/{postId}","rpcName":"buzz.activities.delete","httpMethod":"DELETE","methodType":"rest","parameters":{"scope":{"parameterType":"path","pattern":"@.*","required":true},"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"postId":{"parameterType":"path","pattern":".*","required":true},"hl":{"parameterType":"query","required":false}}},"insert":{"pathUrl":"buzz\\/v1\\/activities\\/{userId}\\/@self","rpcName":"buzz.activities.insert","httpMethod":"POST","methodType":"rest","parameters":{"preview":{"parameterType":"query","required":false},"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"photo":{"parameterType":"query","required":false},"hl":{"parameterType":"query","required":false}}},"list":{"pathUrl":"buzz\\/v1\\/activities\\/{userId}\\/{scope}","rpcName":"buzz.activities.list","httpMethod":"GET","methodType":"rest","parameters":{"max-comments":{"parameterType":"query","required":false},"scope":{"parameterType":"path","pattern":"@(self|public|consumption|liked|comments)*","required":true},"max-results":{"parameterType":"query","required":false},"c":{"parameterType":"query","required":false},"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"max-liked":{"parameterType":"query","required":false},"hl":{"parameterType":"query","required":false}}},"get":{"pathUrl":"buzz\\/v1\\/activities\\/{userId}\\/@self\\/{postId}","rpcName":"buzz.activities.get","httpMethod":"GET","methodType":"rest","parameters":{"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"postId":{"parameterType":"path","pattern":".*","required":true},"hl":{"parameterType":"query","required":false}}},"search":{"pathUrl":"buzz\\/v1\\/activities\\/search","rpcName":"buzz.activities.search","httpMethod":"POST","methodType":"rest","parameters":{"lon":{"parameterType":"query","required":false},"max-results":{"parameterType":"query","required":false},"c":{"parameterType":"query","required":false},"bbox":{"parameterType":"query","required":false},"q":{"parameterType":"query","required":false},"alt":{"parameterType":"query","required":false},"pid":{"parameterType":"query","required":false},"radius":{"parameterType":"query","required":false},"lat":{"parameterType":"query","required":false},"hl":{"parameterType":"query","required":false}}}}}', true)); $this->people = new apiServiceResource($this, $this->serviceName, 'people', json_decode('{"methods":{"get":{"pathUrl":"buzz\\/v1\\/people\\/{userId}\\/@self","rpcName":"buzz.people.get","httpMethod":"GET","methodType":"rest","parameters":{"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"hl":{"parameterType":"query","required":false}}},"search":{"pathUrl":"buzz\\/v1\\/people\\/search","rpcName":"buzz.people.search","httpMethod":"POST","methodType":"rest","parameters":{"max-results":{"parameterType":"query","required":false},"c":{"parameterType":"query","required":false},"q":{"parameterType":"query","required":false},"alt":{"parameterType":"query","required":false},"hl":{"parameterType":"query","required":false}}},"list":{"pathUrl":"buzz\\/v1\\/people\\/{userId}\\/@groups\\/{groupId}","rpcName":"buzz.people.list","httpMethod":"GET","methodType":"rest","parameters":{"groupId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"max-results":{"parameterType":"query","required":false},"c":{"parameterType":"query","required":false},"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"hl":{"parameterType":"query","required":false}}},"relatedToUri":{"pathUrl":"buzz\\/v1\\/people\\/{userId}\\/@related","rpcName":"buzz.people.relatedToUri","httpMethod":"POST","methodType":"rest","parameters":{"alt":{"parameterType":"query","required":false},"uri":{"parameterType":"query","required":false},"hl":{"parameterType":"query","required":false}}},"reshared":{"pathUrl":"buzz\\/v1\\/activities\\/{userId}\\/{scope}\\/{postId}\\/{groupId}","rpcName":"buzz.people.reshared","httpMethod":"POST","methodType":"rest","parameters":{"groupId":{"parameterType":"path","pattern":"@reshared","required":true},"max-results":{"parameterType":"query","required":false},"c":{"parameterType":"query","required":false},"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"postId":{"parameterType":"path","pattern":".*","required":true},"hl":{"parameterType":"query","required":false}}},"delete":{"pathUrl":"buzz\\/v1\\/people\\/{userId}\\/@groups\\/{groupId}\\/{personId}","rpcName":"buzz.people.delete","httpMethod":"DELETE","methodType":"rest","parameters":{"groupId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"personId":{"parameterType":"path","pattern":"(?!@self).*","required":true},"hl":{"parameterType":"query","required":false}}},"update":{"pathUrl":"buzz\\/v1\\/people\\/{userId}\\/@groups\\/{groupId}\\/{personId}","rpcName":"buzz.people.update","httpMethod":"PUT","methodType":"rest","parameters":{"groupId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"personId":{"parameterType":"path","pattern":"(?!@self).*","required":true},"hl":{"parameterType":"query","required":false}}},"liked":{"pathUrl":"buzz\\/v1\\/activities\\/{userId}\\/{scope}\\/{postId}\\/{groupId}","rpcName":"buzz.people.liked","httpMethod":"POST","methodType":"rest","parameters":{"groupId":{"parameterType":"path","pattern":"@liked","required":true},"max-results":{"parameterType":"query","required":false},"c":{"parameterType":"query","required":false},"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"postId":{"parameterType":"path","pattern":".*","required":true},"hl":{"parameterType":"query","required":false}}}}}', true)); $this->groups = new apiServiceResource($this, $this->serviceName, 'groups', json_decode('{"methods":{"get":{"pathUrl":"buzz\\/v1\\/people\\/{userId}\\/@groups\\/{groupId}\\/@self","rpcName":"buzz.groups.get","httpMethod":"GET","methodType":"rest","parameters":{"groupId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"hl":{"parameterType":"query","required":false}}},"list":{"pathUrl":"buzz\\/v1\\/people\\/{userId}\\/@groups","rpcName":"buzz.groups.list","httpMethod":"GET","methodType":"rest","parameters":{"max-results":{"parameterType":"query","required":false},"c":{"parameterType":"query","required":false},"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"hl":{"parameterType":"query","required":false}}},"delete":{"pathUrl":"buzz\\/v1\\/people\\/{userId}\\/@groups\\/{groupId}","rpcName":"buzz.groups.delete","httpMethod":"DELETE","methodType":"rest","parameters":{"groupId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"hl":{"parameterType":"query","required":false}}},"update":{"pathUrl":"buzz\\/v1\\/people\\/{userId}\\/@groups\\/{groupId}\\/@self","rpcName":"buzz.groups.update","httpMethod":"PUT","methodType":"rest","parameters":{"groupId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"hl":{"parameterType":"query","required":false}}},"insert":{"pathUrl":"buzz\\/v1\\/people\\/{userId}\\/@groups","rpcName":"buzz.groups.insert","httpMethod":"POST","methodType":"rest","parameters":{"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"hl":{"parameterType":"query","required":false}}}}}', true)); $this->comments = new apiServiceResource($this, $this->serviceName, 'comments', json_decode('{"methods":{"update":{"pathUrl":"buzz\\/v1\\/activities\\/{userId}\\/{scope}\\/{postId}\\/@comments\\/{commentId}","rpcName":"buzz.comments.update","httpMethod":"PUT","methodType":"rest","parameters":{"scope":{"parameterType":"path","pattern":"@.*","required":true},"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"commentId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"postId":{"parameterType":"path","pattern":".*","required":true},"hl":{"parameterType":"query","required":false},"abuseType":{"parameterType":"query","required":false}}},"list":{"pathUrl":"buzz\\/v1\\/activities\\/{userId}\\/{scope}\\/{postId}\\/@comments","rpcName":"buzz.comments.list","httpMethod":"GET","methodType":"rest","parameters":{"scope":{"parameterType":"path","pattern":"@.*","required":true},"max-results":{"parameterType":"query","required":false},"c":{"parameterType":"query","required":false},"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"postId":{"parameterType":"path","pattern":".*","required":true},"hl":{"parameterType":"query","required":false}}},"delete":{"pathUrl":"buzz\\/v1\\/activities\\/{userId}\\/@self\\/{postId}\\/@comments\\/{commentId}","rpcName":"buzz.comments.delete","httpMethod":"DELETE","methodType":"rest","parameters":{"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"commentId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"postId":{"parameterType":"path","pattern":".*","required":true},"hl":{"parameterType":"query","required":false}}},"insert":{"pathUrl":"buzz\\/v1\\/activities\\/{userId}\\/@self\\/{postId}\\/@comments","rpcName":"buzz.comments.insert","httpMethod":"POST","methodType":"rest","parameters":{"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"postId":{"parameterType":"path","pattern":".*","required":true},"hl":{"parameterType":"query","required":false}}},"get":{"pathUrl":"buzz\\/v1\\/activities\\/{userId}\\/@self\\/{postId}\\/@comments\\/{commentId}","rpcName":"buzz.comments.get","httpMethod":"GET","methodType":"rest","parameters":{"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"commentId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"postId":{"parameterType":"path","pattern":".*","required":true},"hl":{"parameterType":"query","required":false}}}}}', true)); $this->related = new apiServiceResource($this, $this->serviceName, 'related', json_decode('{"methods":{"list":{"pathUrl":"buzz\\/v1\\/activities\\/{userId}\\/{scope}\\/{postId}\\/@related","rpcName":"buzz.related.list","httpMethod":"GET","methodType":"rest","parameters":{"scope":{"parameterType":"path","pattern":"@.*","required":true},"max-results":{"parameterType":"query","required":false},"c":{"parameterType":"query","required":false},"alt":{"parameterType":"query","required":false},"userId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"hl":{"parameterType":"query","required":false},"postId":{"parameterType":"path","pattern":".*","required":true}}}}}', true)); }
/** * Constructs the internal service representations and does the auto-magic configuration required to drive them */ public function __construct(apiClient $apiClient) { $apiClient->addService('moderator', 'v1'); $this->io = $apiClient->getIo(); $this->tags = new apiServiceResource($this, $this->serviceName, 'tags', json_decode('{"methods":{"delete":{"pathUrl":"moderator\\/v1\\/series\\/{seriesId}\\/submissions\\/{submissionId}\\/tags\\/{tagId}","rpcName":"moderator.tags.delete","httpMethod":"DELETE","methodType":"rest","parameters":{"tagId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"seriesId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"submissionId":{"parameterType":"path","pattern":"[^\\/]+","required":true}}},"list":{"pathUrl":"moderator\\/v1\\/series\\/{seriesId}\\/submissions\\/{submissionId}\\/tags","rpcName":"moderator.tags.list","httpMethod":"GET","methodType":"rest","parameters":{"seriesId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"submissionId":{"parameterType":"path","pattern":"[^\\/]+","required":true}}},"insert":{"pathUrl":"moderator\\/v1\\/series\\/{seriesId}\\/submissions\\/{submissionId}\\/tags","rpcName":"moderator.tags.insert","httpMethod":"POST","methodType":"rest","parameters":{"seriesId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"submissionId":{"parameterType":"path","pattern":"[^\\/]+","required":true}}}}}', true)); $this->series = new apiServiceResource($this, $this->serviceName, 'series', json_decode('{"methods":{"list":{"pathUrl":"moderator\\/v1\\/series\\/featured","rpcName":"moderator.featured.series.list","httpMethod":"GET","methodType":"rest"},"update":{"pathUrl":"moderator\\/v1\\/series\\/{seriesId}","rpcName":"moderator.series.update","httpMethod":"PUT","methodType":"rest","parameters":{"seriesId":{"parameterType":"path","pattern":"[^\\/]+","required":true}}},"insert":{"pathUrl":"moderator\\/v1\\/series","rpcName":"moderator.series.insert","httpMethod":"POST","methodType":"rest"},"get":{"pathUrl":"moderator\\/v1\\/series\\/{seriesId}","rpcName":"moderator.series.get","httpMethod":"GET","methodType":"rest","parameters":{"seriesId":{"parameterType":"path","pattern":"[^\\/]+","required":true}}}}}', true)); $this->topics = new apiServiceResource($this, $this->serviceName, 'topics', json_decode('{"methods":{"list":{"pathUrl":"moderator\\/v1\\/series\\/{seriesId}\\/topics","rpcName":"moderator.topics.list","httpMethod":"GET","methodType":"rest","parameters":{"max-results":{"parameterType":"query","required":false},"start-index":{"parameterType":"query","required":false},"seriesId":{"parameterType":"path","pattern":"[^\\/]+","required":true}}},"insert":{"pathUrl":"moderator\\/v1\\/series\\/{seriesId}\\/topics","rpcName":"moderator.topics.insert","httpMethod":"POST","methodType":"rest","parameters":{"seriesId":{"parameterType":"path","pattern":"[^\\/]+","required":true}}},"get":{"pathUrl":"moderator\\/v1\\/series\\/{seriesId}\\/topics\\/{topicId}","rpcName":"moderator.topics.get","httpMethod":"GET","methodType":"rest","parameters":{"topicId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"seriesId":{"parameterType":"path","pattern":"[^\\/]+","required":true}}}}}', true)); $this->votes = new apiServiceResource($this, $this->serviceName, 'votes', json_decode('{"methods":{"update":{"pathUrl":"moderator\\/v1\\/series\\/{seriesId}\\/submissions\\/{submissionId}\\/votes\\/@me","rpcName":"moderator.votes.update","httpMethod":"PUT","methodType":"rest","parameters":{"userId":{"parameterType":"query","required":false},"seriesId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"submissionId":{"parameterType":"path","pattern":"[^\\/]+","required":true}}},"list":{"pathUrl":"moderator\\/v1\\/series\\/{seriesId}\\/votes\\/@me","rpcName":"moderator.votes.list","httpMethod":"GET","methodType":"rest","parameters":{"max-results":{"parameterType":"query","required":false},"start-index":{"parameterType":"query","required":false},"seriesId":{"parameterType":"path","pattern":"[^\\/]+","required":true}}},"get":{"pathUrl":"moderator\\/v1\\/series\\/{seriesId}\\/submissions\\/{submissionId}\\/votes\\/@me","rpcName":"moderator.votes.get","httpMethod":"GET","methodType":"rest","parameters":{"userId":{"parameterType":"query","required":false},"seriesId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"submissionId":{"parameterType":"path","pattern":"[^\\/]+","required":true}}},"insert":{"pathUrl":"moderator\\/v1\\/series\\/{seriesId}\\/submissions\\/{submissionId}\\/votes\\/@me","rpcName":"moderator.votes.insert","httpMethod":"POST","methodType":"rest","parameters":{"seriesId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"submissionId":{"parameterType":"path","pattern":"[^\\/]+","required":true}}}}}', true)); $this->submissions = new apiServiceResource($this, $this->serviceName, 'submissions', json_decode('{"methods":{"get":{"pathUrl":"moderator\\/v1\\/series\\/{seriesId}\\/submissions\\/{submissionId}","rpcName":"moderator.submissions.get","httpMethod":"GET","methodType":"rest","parameters":{"seriesId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"submissionId":{"parameterType":"path","pattern":"[^\\/]+","required":true}}},"list":{"pathUrl":"moderator\\/v1\\/series\\/{seriesId}\\/topics\\/{topicId}\\/submissions","rpcName":"moderator.topics.submissions.list","httpMethod":"GET","methodType":"rest","parameters":{"author":{"parameterType":"query","required":false},"hasAttachedVideo":{"parameterType":"query","required":false},"sort":{"parameterType":"query","required":false},"max-results":{"parameterType":"query","required":false},"q":{"parameterType":"query","required":false},"topicId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"start-index":{"parameterType":"query","required":false},"seriesId":{"parameterType":"path","pattern":"[^\\/]+","required":true}}},"insert":{"pathUrl":"moderator\\/v1\\/series\\/{seriesId}\\/topics\\/{topicId}\\/submissions","rpcName":"moderator.submissions.insert","httpMethod":"POST","methodType":"rest","parameters":{"topicId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"seriesId":{"parameterType":"path","pattern":"[^\\/]+","required":true}}}}}', true)); $this->profiles = new apiServiceResource($this, $this->serviceName, 'profiles', json_decode('{"methods":{"get":{"pathUrl":"moderator\\/v1\\/profiles\\/@me","rpcName":"moderator.profiles.get","httpMethod":"GET","methodType":"rest"},"update":{"pathUrl":"moderator\\/v1\\/profiles\\/@me","rpcName":"moderator.profiles.update","httpMethod":"PUT","methodType":"rest"}}}', true)); $this->responses = new apiServiceResource($this, $this->serviceName, 'responses', json_decode('{"methods":{"insert":{"pathUrl":"moderator\\/v1\\/series\\/{seriesId}\\/topics\\/{topicId}\\/submissions\\/{parentSubmissionId}\\/responses","rpcName":"moderator.responses.insert","httpMethod":"POST","methodType":"rest","parameters":{"parentSubmissionId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"topicId":{"parameterType":"path","pattern":"[^\\/]+","required":true},"seriesId":{"parameterType":"path","pattern":"[^\\/]+","required":true}}},"list":{"pathUrl":"moderator\\/v1\\/series\\/{seriesId}\\/responses","rpcName":"moderator.series.responses.list","httpMethod":"GET","methodType":"rest","parameters":{"author":{"parameterType":"query","required":false},"hasAttachedVideo":{"parameterType":"query","required":false},"sort":{"parameterType":"query","required":false},"max-results":{"parameterType":"query","required":false},"q":{"parameterType":"query","required":false},"start-index":{"parameterType":"query","required":false},"seriesId":{"parameterType":"path","pattern":"[^\\/]+","required":true}}}}}', true)); }
/** * Build a Drive service object for interacting with the Google Drive API. * * @return apiDriveService service object */ function BuildService($credentials) { $client = new apiClient(); // return data from API calls as PHP objects instead of arrays $client->setUseObjects(true); $client->setAccessToken($credentials->toJson()); // set clientId and clientSecret in case token is expired // and refresh is needed $client->setClientId($credentials->clientId); $client->setClientSecret($credentials->clientSecret); return new apiDriveService($client); }
public function index() { $this->id = "content"; $this->template = "login/login.tpl"; $this->layout = "common/layout-empty"; if (Registry::get('username')) { header("Location: search.php"); exit; } $request = Registry::get('request'); $session = Registry::get('session'); $db = Registry::get('db'); $this->load->model('user/auth'); $this->load->model('user/user'); $this->load->model('user/prefs'); $this->load->model('domain/domain'); $this->load->model('folder/folder'); if (ENABLE_SAAS == 1) { $this->load->model('saas/ldap'); $this->load->model('saas/customer'); } $this->data['title'] = $this->data['text_login']; $this->data['title_prefix'] = TITLE_PREFIX; $this->data['failed_login_count'] = $this->model_user_auth->get_failed_login_count(); if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate() == true) { if ($this->model_user_auth->checkLogin($this->request->post['username'], $_POST['password']) == 1) { if ($session->get("ga_block") == 1) { header("Location: " . SITE_URL . "index.php?route=login/ga"); exit; } else { $this->model_user_prefs->get_user_preferences($session->get('username')); if (ENABLE_SAAS == 1) { $this->model_saas_customer->online($session->get('email')); } LOGGER('logged in'); if (isAdminUser() == 1) { header("Location: " . SITE_URL . "index.php?route=health/health"); exit; } header("Location: " . SITE_URL . "search.php"); exit; } } else { $this->model_user_auth->increment_failed_login_count($this->data['failed_login_count']); $this->data['failed_login_count']++; } $this->data['x'] = $this->data['text_invalid_email_or_password']; } if (ENABLE_GOOGLE_LOGIN == 1) { $client = new apiClient(); $client->setApplicationName(GOOGLE_APPLICATION_NAME); $client->setScopes(array('https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile', 'https://mail.google.com/')); $client->setClientId(GOOGLE_CLIENT_ID); $client->setClientSecret(GOOGLE_CLIENT_SECRET); $client->setRedirectUri(GOOGLE_REDIRECT_URL); $client->setDeveloperKey(GOOGLE_DEVELOPER_KEY); $this->data['auth_url'] = $client->createAuthUrl(); } $this->render(); }
public function __construct($serviceName, $version) { parent::__construct(); $this->serviceName = $serviceName; $this->version = $version; $this->discoveryUrl = 'http://www.googleapis.com/discovery/' . $this->discoveryVersion . '/describe?api=' . urlencode($this->serviceName) . '&apiVersion=' . urlencode($this->version); }
/** * Constructs the internal representation of the Customsearch service. * * @param apiClient apiClient */ public function __construct(apiClient $apiClient) { $this->rpcPath = '/rpc'; $this->restBasePath = '/customsearch/'; $this->version = 'v1'; $this->serviceName = 'customsearch'; $apiClient->addService($this->serviceName, $this->version); $this->cse = new CseServiceResource($this, $this->serviceName, 'cse', json_decode('{"methods": {"list": {"parameters": {"sort": {"type": "string", "location": "query"}, "filter": {"enum": ["0", "1"], "type": "string", "location": "query"}, "cx": {"type": "string", "location": "query"}, "googlehost": {"type": "string", "location": "query"}, "safe": {"default": "off", "enum": ["high", "medium", "off"], "location": "query", "type": "string"}, "q": {"required": true, "type": "string", "location": "query"}, "start": {"type": "string", "location": "query"}, "num": {"default": "10", "type": "string", "location": "query"}, "lr": {"enum": ["lang_ar", "lang_bg", "lang_ca", "lang_cs", "lang_da", "lang_de", "lang_el", "lang_en", "lang_es", "lang_et", "lang_fi", "lang_fr", "lang_hr", "lang_hu", "lang_id", "lang_is", "lang_it", "lang_iw", "lang_ja", "lang_ko", "lang_lt", "lang_lv", "lang_nl", "lang_no", "lang_pl", "lang_pt", "lang_ro", "lang_ru", "lang_sk", "lang_sl", "lang_sr", "lang_sv", "lang_tr", "lang_zh-CN", "lang_zh-TW"], "type": "string", "location": "query"}, "cr": {"type": "string", "location": "query"}, "gl": {"type": "string", "location": "query"}, "cref": {"type": "string", "location": "query"}}, "id": "search.cse.list", "httpMethod": "GET", "path": "v1", "response": {"$ref": "Search"}}}}', true)); }
/** * Constructs the internal representation of the Diacritize service. * * @param apiClient apiClient */ public function __construct(apiClient $apiClient) { $this->rpcPath = '/rpc'; $this->restBasePath = '/language/diacritize/'; $this->version = 'v1'; $this->serviceName = 'diacritize'; $this->io = $apiClient->getIo(); $apiClient->addService($this->serviceName, $this->version); $this->diacritize = new DiacritizeServiceResource($this, $this->serviceName, 'diacritize', json_decode('{"resources": {"corpus": {"methods": {"get": {"parameters": {"lang": {"required": true, "type": "string", "location": "query"}, "message": {"required": true, "type": "string", "location": "query"}, "last_letter": {"required": true, "type": "boolean", "location": "query"}}, "id": "language.diacritize.corpus.get", "httpMethod": "GET", "path": "v1", "response": {"$ref": "LanguageDiacritizeCorpusResource"}}}}}}', true)); }
public function __construct() { global $apiConfig, $apiClient, $taskService; parent::__construct(); if (! $apiClient || ! $taskService) { $this->origConfig = $apiConfig; // Set up a predictable, default environment so the test results are predictable //$apiConfig['oauth2_client_id'] = 'INSERT_CLIENT_ID'; //$apiConfig['oauth2_client_secret'] = 'INSERT_CLIENT_SECRET'; $apiConfig['authClass'] = 'apiOAuth2'; $apiConfig['ioClass'] = 'apiCurlIO'; $apiConfig['cacheClass'] = 'apiFileCache'; $apiConfig['ioFileCache_directory'] = '/tmp/googleApiTests'; $apiClient = new apiClient(); $taskService = new apiTasksService($apiClient); $apiClient->setAccessToken($apiConfig['oauth_test_token']); } $this->apiClient = $apiClient; $this->taskService = $taskService; }
private function init() { $client = new \apiClient(); $client->setApplicationName("Share1Book Test Page"); $client->setDeveloperKey($this->apiKey); $service = new \apiBooksService($client); $volumes = $service->volumes; $optParams['maxResults'] = 1; $optParams['country'] = 'FR'; $optParams['fields'] = 'kind,totalItems,items(volumeInfo(title,authors,imageLinks,description,publisher,publishedDate,industryIdentifiers))'; $q = $this->isbn10 ? $this->isbn10 : ($this->isbn13 ? $this->isbn13 : ($this->asin ? $this->asin : "")); \Sb\Trace\Trace::addItem("requetage de google avec {$q}"); $this->results = $volumes->listVolumes($q, $optParams); if ($this->results && count($this->results) > 0) { if (array_key_exists('items', $this->results)) { if (count($this->results['items']) > 0) { $bookInfo = $this->results['items'][0]; $this->volumeInfo = $bookInfo['volumeInfo']; } } } }
private function getGoogleClient($config) { require_once LIBS_DIR . '/google-api-php-client/src/apiClient.php'; require_once LIBS_DIR . '/google-api-php-client/src/contrib/apiOauth2Service.php'; $client = new apiClient(); $client->setApplicationName($config['application_name']); $client->setClientId($config['client_id']); $client->setClientSecret($config['client_secret']); $client->setRedirectUri($config['redirect_url']); $client->setScopes(array('https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email')); return $client; }
/** * connect */ protected function connect() { $client = new apiClient(); $client->setApplicationName("Google Application"); //*********** Replace with Your API Credentials ************** $client->setClientId($this->clientId); $client->setClientSecret($this->clientSecret); $client->setRedirectUri($this->redirectUri); // $client->setDeveloperKey('AIzaSyBiUF9NmJKGwbJCDOQIoF2NxMgtYjwI1c8'); //************************************************************ $client->setScopes(array('https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/userinfo.email')); return $client; }
/** * Constructor and Login * @param $buy * @return Oara_Network_Publisher_Buy_Api */ public function __construct($credentials) { $client = new apiClient(); $client->setApplicationName("AffJet"); $client->setClientId($credentials['clientId']); $client->setClientSecret($credentials['clientSecret']); $client->setAccessToken($credentials['oauth2']); $client->setAccessType('offline'); $this->_client = $client; $this->_gan = new apiGanService($client); }
/** * @return apiClient */ private function createClient() { require_once 'apiClient.php'; $client = new apiClient(); /*$client->setClientId($this->getClientID()); $client->setClientSecret($this->getClientSecret()); $client->setRedirectUri($this->getRedirectUri()); $client->setDeveloperKey($this->getDeveloperKey()); $client->setApplicationName(yii::app()->name);*/ $client->setClientId(Yii::app()->functions->getOptionAdmin("google_client_id")); $client->setClientSecret(Yii::app()->functions->getOptionAdmin("google_client_secret")); $client->setRedirectUri(Yii::app()->functions->getOptionAdmin("google_client_redirect_ulr")); $client->setDeveloperKey($this->getDeveloperKey()); $client->setApplicationName(yii::app()->name); return $client; }
public function refresh_access_token($email = '') { if ($email == '') { return ''; } $query = $this->db->query("SELECT refresh_token FROM " . TABLE_GOOGLE . " WHERE email=?", array($email)); if (!isset($query->row['refresh_token'])) { return ''; } $client = new apiClient(); $client->setApplicationName(GOOGLE_APPLICATION_NAME); $client->setClientId(GOOGLE_CLIENT_ID); $client->setClientSecret(GOOGLE_CLIENT_SECRET); $client->setRedirectUri(GOOGLE_REDIRECT_URL); $client->setDeveloperKey(GOOGLE_DEVELOPER_KEY); $client->refreshToken($query->row['refresh_token']); $s = $client->getAccessToken(); $a = json_decode($s); if (isset($a->{'access_token'})) { return $a->{'access_token'}; } return ''; }
/** * Constructs the internal representation of the Plus service. * * @param apiClient apiClient */ public function __construct(apiClient $apiClient) { $this->rpcPath = '/rpc'; $this->restBasePath = '/plus/v1/'; $this->version = 'v1'; $this->serviceName = 'plus'; $apiClient->addService($this->serviceName, $this->version); $this->activities = new ActivitiesServiceResource($this, $this->serviceName, 'activities', json_decode('{"methods": {"search": {"scopes": ["https://www.googleapis.com/auth/plus.me"], "parameters": {"orderBy": {"default": "recent", "enum": ["best", "recent"], "location": "query", "type": "string"}, "pageToken": {"type": "string", "location": "query"}, "language": {"default": "", "type": "string", "location": "query"}, "maxResults": {"format": "uint32", "default": "10", "maximum": "20", "minimum": "1", "location": "query", "type": "integer"}, "query": {"required": true, "type": "string", "location": "query"}}, "id": "plus.activities.search", "httpMethod": "GET", "path": "activities", "response": {"$ref": "ActivityFeed"}}, "list": {"scopes": ["https://www.googleapis.com/auth/plus.me"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "alt": {"default": "json", "enum": ["json"], "location": "query", "type": "string"}, "userId": {"required": true, "type": "string", "location": "path"}, "collection": {"required": true, "enum": ["public"], "location": "path", "type": "string"}, "maxResults": {"format": "uint32", "default": "20", "maximum": "100", "minimum": "1", "location": "query", "type": "integer"}}, "id": "plus.activities.list", "httpMethod": "GET", "path": "people/{userId}/activities/{collection}", "response": {"$ref": "ActivityFeed"}}, "get": {"scopes": ["https://www.googleapis.com/auth/plus.me"], "parameters": {"activityId": {"required": true, "type": "string", "location": "path"}, "alt": {"default": "json", "enum": ["json"], "location": "query", "type": "string"}}, "id": "plus.activities.get", "httpMethod": "GET", "path": "activities/{activityId}", "response": {"$ref": "Activity"}}}}', true)); $this->comments = new CommentsServiceResource($this, $this->serviceName, 'comments', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/plus.me"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "activityId": {"required": true, "type": "string", "location": "path"}, "alt": {"default": "json", "enum": ["json"], "location": "query", "type": "string"}, "maxResults": {"format": "uint32", "default": "20", "maximum": "100", "minimum": "0", "location": "query", "type": "integer"}}, "id": "plus.comments.list", "httpMethod": "GET", "path": "activities/{activityId}/comments", "response": {"$ref": "CommentFeed"}}, "get": {"scopes": ["https://www.googleapis.com/auth/plus.me"], "parameters": {"commentId": {"required": true, "type": "string", "location": "path"}}, "id": "plus.comments.get", "httpMethod": "GET", "path": "comments/{commentId}", "response": {"$ref": "Comment"}}}}', true)); $this->people = new PeopleServiceResource($this, $this->serviceName, 'people', json_decode('{"methods": {"listByActivity": {"scopes": ["https://www.googleapis.com/auth/plus.me"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "activityId": {"required": true, "type": "string", "location": "path"}, "collection": {"required": true, "enum": ["plusoners", "resharers"], "location": "path", "type": "string"}, "maxResults": {"format": "uint32", "default": "20", "maximum": "100", "minimum": "1", "location": "query", "type": "integer"}}, "id": "plus.people.listByActivity", "httpMethod": "GET", "path": "activities/{activityId}/people/{collection}", "response": {"$ref": "PeopleFeed"}}, "search": {"scopes": ["https://www.googleapis.com/auth/plus.me"], "parameters": {"pageToken": {"type": "string", "location": "query"}, "language": {"default": "", "type": "string", "location": "query"}, "maxResults": {"format": "uint32", "default": "10", "maximum": "20", "minimum": "1", "location": "query", "type": "integer"}, "query": {"required": true, "type": "string", "location": "query"}}, "id": "plus.people.search", "httpMethod": "GET", "path": "people", "response": {"$ref": "PeopleFeed"}}, "get": {"scopes": ["https://www.googleapis.com/auth/plus.me", "https://www.googleapis.com/auth/userinfo.email"], "parameters": {"userId": {"required": true, "type": "string", "location": "path"}}, "id": "plus.people.get", "httpMethod": "GET", "path": "people/{userId}", "response": {"$ref": "Person"}}}}', true)); }
<?php require_once 'src/apiClient.php'; require_once 'src/contrib/apiPlusService.php'; session_start(); $client = new apiClient(); $client->setApplicationName("Kindle Reader"); $client->setScopes(array('https://www.google.com/reader/api')); if (isset($_REQUEST['logout'])) { unset($_SESSION['access_token']); } if (isset($_GET['code'])) { $client->authenticate(); $_SESSION['access_token'] = $client->getAccessToken(); $redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); } if (isset($_SESSION['access_token'])) { $client->setAccessToken($_SESSION['access_token']); } if ($client->getAccessToken()) { $_SESSION['access_token'] = $client->getAccessToken(); header('Location: sender.php'); } else { $status = "Logged Out"; $authUrl = $client->createAuthUrl(); header('Location: ' . $authUrl); }
/** * Constructs the internal representation of the Buzz service. * * @param apiClient apiClient */ public function __construct(apiClient $apiClient) { $this->rpcPath = '/rpc'; $this->restBasePath = '/buzz/v1/'; $this->version = 'v1'; $this->serviceName = 'buzz'; $this->io = $apiClient->getIo(); $apiClient->addService($this->serviceName, $this->version); $this->activities = new ActivitiesServiceResource($this, $this->serviceName, 'activities', json_decode('{"methods": {"count": {"scopes": ["https://www.googleapis.com/auth/buzz", "https://www.googleapis.com/auth/buzz.readonly"], "parameters": {"url": {"repeated": true, "type": "string", "location": "query"}, "hl": {"type": "string", "location": "query"}}, "response": {"$ref": "CountFeed"}, "httpMethod": "GET", "path": "activities/count", "id": "chili.activities.count"}, "insert": {"scopes": ["https://www.googleapis.com/auth/buzz"], "parameters": {"alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "preview": {"default": "false", "type": "boolean", "location": "query"}, "userId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "mediaUpload": {"maxSize": "10MB", "accept": ["image/*"], "protocols": {"simple": {"path": "upload/activities/{userId}/@self", "multipart": true}, "resumable": {"path": "resumable/upload/activities/{userId}/@self", "multipart": true}}}, "request": {"$ref": "Activity"}, "id": "chili.activities.insert", "httpMethod": "POST", "path": "activities/{userId}/@self", "response": {"$ref": "Activity"}}, "search": {"scopes": ["https://www.googleapis.com/auth/buzz", "https://www.googleapis.com/auth/buzz.readonly"], "parameters": {"max-results": {"default": "20", "format": "uint32", "type": "integer", "location": "query"}, "c": {"type": "string", "location": "query"}, "pid": {"type": "string", "location": "query"}, "lon": {"type": "string", "location": "query"}, "q": {"type": "string", "location": "query"}, "truncateAtom": {"type": "boolean", "location": "query"}, "radius": {"type": "string", "location": "query"}, "bbox": {"type": "string", "location": "query"}, "hl": {"type": "string", "location": "query"}, "lat": {"type": "string", "location": "query"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}}, "response": {"$ref": "ActivityFeed"}, "httpMethod": "GET", "path": "activities/search", "id": "chili.activities.search"}, "get": {"scopes": ["https://www.googleapis.com/auth/buzz", "https://www.googleapis.com/auth/buzz.readonly"], "parameters": {"userId": {"required": true, "type": "string", "location": "path"}, "truncateAtom": {"type": "boolean", "location": "query"}, "max-comments": {"default": "0", "format": "uint32", "type": "integer", "location": "query"}, "hl": {"type": "string", "location": "query"}, "max-liked": {"default": "0", "format": "uint32", "type": "integer", "location": "query"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "postId": {"required": true, "type": "string", "location": "path"}}, "id": "chili.activities.get", "httpMethod": "GET", "path": "activities/{userId}/@self/{postId}", "response": {"$ref": "Activity"}}, "track": {"scopes": ["https://www.googleapis.com/auth/buzz", "https://www.googleapis.com/auth/buzz.readonly"], "parameters": {"max-results": {"default": "20", "format": "uint32", "type": "integer", "location": "query"}, "c": {"type": "string", "location": "query"}, "pid": {"type": "string", "location": "query"}, "lon": {"type": "string", "location": "query"}, "q": {"type": "string", "location": "query"}, "radius": {"type": "string", "location": "query"}, "bbox": {"type": "string", "location": "query"}, "hl": {"type": "string", "location": "query"}, "lat": {"type": "string", "location": "query"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}}, "response": {"$ref": "ActivityFeed"}, "httpMethod": "GET", "path": "activities/track", "id": "chili.activities.track"}, "list": {"scopes": ["https://www.googleapis.com/auth/buzz", "https://www.googleapis.com/auth/buzz.readonly"], "parameters": {"max-results": {"default": "20", "format": "uint32", "type": "integer", "location": "query"}, "c": {"type": "string", "location": "query"}, "userId": {"required": true, "type": "string", "location": "path"}, "truncateAtom": {"type": "boolean", "location": "query"}, "max-comments": {"default": "0", "format": "uint32", "type": "integer", "location": "query"}, "hl": {"type": "string", "location": "query"}, "max-liked": {"default": "0", "format": "uint32", "type": "integer", "location": "query"}, "scope": {"required": true, "enum": ["@comments", "@consumption", "@liked", "@public", "@self"], "location": "path", "type": "string"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}}, "id": "chili.activities.list", "httpMethod": "GET", "path": "activities/{userId}/{scope}", "response": {"$ref": "ActivityFeed"}}, "update": {"scopes": ["https://www.googleapis.com/auth/buzz"], "parameters": {"userId": {"required": true, "type": "string", "location": "path"}, "abuseType": {"type": "string", "location": "query"}, "hl": {"type": "string", "location": "query"}, "scope": {"required": true, "enum": ["@abuse", "@liked", "@muted", "@self"], "location": "path", "type": "string"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "postId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Activity"}, "id": "chili.activities.update", "httpMethod": "PUT", "path": "activities/{userId}/{scope}/{postId}", "response": {"$ref": "Activity"}}, "patch": {"scopes": ["https://www.googleapis.com/auth/buzz"], "parameters": {"userId": {"required": true, "type": "string", "location": "path"}, "abuseType": {"type": "string", "location": "query"}, "hl": {"type": "string", "location": "query"}, "scope": {"required": true, "enum": ["@abuse", "@liked", "@muted", "@self"], "location": "path", "type": "string"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "postId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Activity"}, "id": "chili.activities.patch", "httpMethod": "PATCH", "path": "activities/{userId}/{scope}/{postId}", "response": {"$ref": "Activity"}}, "extractPeopleFromSearch": {"scopes": ["https://www.googleapis.com/auth/buzz", "https://www.googleapis.com/auth/buzz.readonly"], "parameters": {"max-results": {"default": "20", "format": "uint32", "type": "integer", "location": "query"}, "c": {"type": "string", "location": "query"}, "pid": {"type": "string", "location": "query"}, "lon": {"type": "string", "location": "query"}, "q": {"type": "string", "location": "query"}, "radius": {"type": "string", "location": "query"}, "bbox": {"type": "string", "location": "query"}, "hl": {"type": "string", "location": "query"}, "lat": {"type": "string", "location": "query"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}}, "response": {"$ref": "PeopleFeed"}, "httpMethod": "GET", "path": "activities/search/@people", "id": "chili.activities.extractPeopleFromSearch"}, "delete": {"scopes": ["https://www.googleapis.com/auth/buzz"], "parameters": {"scope": {"required": true, "enum": ["@liked", "@muted", "@self"], "location": "path", "type": "string"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "postId": {"required": true, "type": "string", "location": "path"}, "userId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "httpMethod": "DELETE", "path": "activities/{userId}/{scope}/{postId}", "id": "chili.activities.delete"}}}', true)); $this->people = new PeopleServiceResource($this, $this->serviceName, 'people', json_decode('{"methods": {"search": {"scopes": ["https://www.googleapis.com/auth/buzz", "https://www.googleapis.com/auth/buzz.readonly"], "parameters": {"max-results": {"default": "20", "format": "uint32", "type": "integer", "location": "query"}, "q": {"type": "string", "location": "query"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "c": {"type": "string", "location": "query"}, "hl": {"type": "string", "location": "query"}}, "response": {"$ref": "PeopleFeed"}, "httpMethod": "GET", "path": "people/search", "id": "chili.people.search"}, "get": {"scopes": ["https://www.googleapis.com/auth/buzz", "https://www.googleapis.com/auth/buzz.readonly"], "parameters": {"alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "userId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "id": "chili.people.get", "httpMethod": "GET", "path": "people/{userId}/@self", "response": {"$ref": "Person"}}, "update": {"scopes": ["https://www.googleapis.com/auth/buzz"], "parameters": {"personId": {"required": true, "type": "string", "location": "path"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "userId": {"required": true, "type": "string", "location": "path"}, "groupId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "request": {"$ref": "Person"}, "id": "chili.people.update", "httpMethod": "PUT", "path": "people/{userId}/@groups/{groupId}/{personId}", "response": {"$ref": "Person"}}, "list": {"scopes": ["https://www.googleapis.com/auth/buzz", "https://www.googleapis.com/auth/buzz.readonly"], "parameters": {"max-results": {"default": "20", "format": "uint32", "type": "integer", "location": "query"}, "c": {"type": "string", "location": "query"}, "userId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "groupId": {"required": true, "type": "string", "location": "path"}}, "id": "chili.people.list", "httpMethod": "GET", "path": "people/{userId}/@groups/{groupId}", "response": {"$ref": "PeopleFeed"}}, "liked": {"scopes": ["https://www.googleapis.com/auth/buzz", "https://www.googleapis.com/auth/buzz.readonly"], "parameters": {"max-results": {"default": "20", "format": "uint32", "type": "integer", "location": "query"}, "c": {"type": "string", "location": "query"}, "userId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}, "scope": {"required": true, "type": "string", "location": "path"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "postId": {"required": true, "type": "string", "location": "path"}, "groupId": {"required": true, "type": "string", "location": "path", "enum": ["@liked"]}}, "id": "chili.people.liked", "httpMethod": "GET", "path": "activities/{userId}/{scope}/{postId}/{groupId}", "response": {"$ref": "PeopleFeed"}}, "patch": {"scopes": ["https://www.googleapis.com/auth/buzz"], "parameters": {"personId": {"required": true, "type": "string", "location": "path"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "userId": {"required": true, "type": "string", "location": "path"}, "groupId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "request": {"$ref": "Person"}, "id": "chili.people.patch", "httpMethod": "PATCH", "path": "people/{userId}/@groups/{groupId}/{personId}", "response": {"$ref": "Person"}}, "reshared": {"scopes": ["https://www.googleapis.com/auth/buzz", "https://www.googleapis.com/auth/buzz.readonly"], "parameters": {"max-results": {"default": "20", "format": "uint32", "type": "integer", "location": "query"}, "c": {"type": "string", "location": "query"}, "userId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}, "scope": {"required": true, "type": "string", "location": "path"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "postId": {"required": true, "type": "string", "location": "path"}, "groupId": {"required": true, "type": "string", "location": "path", "enum": ["@reshared"]}}, "id": "chili.people.reshared", "httpMethod": "GET", "path": "activities/{userId}/{scope}/{postId}/{groupId}", "response": {"$ref": "PeopleFeed"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/buzz"], "parameters": {"personId": {"required": true, "type": "string", "location": "path"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "userId": {"required": true, "type": "string", "location": "path"}, "groupId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "httpMethod": "DELETE", "path": "people/{userId}/@groups/{groupId}/{personId}", "id": "chili.people.delete"}}}', true)); $this->photoAlbums = new PhotoAlbumsServiceResource($this, $this->serviceName, 'photoAlbums', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/picasa"], "parameters": {"alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "userId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "request": {"$ref": "Album"}, "id": "chili.photoAlbums.insert", "httpMethod": "POST", "path": "photos/{userId}/@self", "response": {"$ref": "Album"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/picasa"], "parameters": {"albumId": {"required": true, "type": "string", "location": "path"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "userId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "httpMethod": "DELETE", "path": "photos/{userId}/@self/{albumId}", "id": "chili.photoAlbums.delete"}, "list": {"scopes": ["https://www.googleapis.com/auth/picasa"], "parameters": {"max-results": {"default": "20", "format": "uint32", "type": "integer", "location": "query"}, "c": {"type": "string", "location": "query"}, "userId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}, "scope": {"required": true, "enum": ["@self"], "location": "path", "type": "string"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}}, "id": "chili.photoAlbums.list", "httpMethod": "GET", "path": "photos/{userId}/{scope}", "response": {"$ref": "AlbumsFeed"}}, "get": {"scopes": ["https://www.googleapis.com/auth/picasa"], "parameters": {"albumId": {"required": true, "type": "string", "location": "path"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "userId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "id": "chili.photoAlbums.get", "httpMethod": "GET", "path": "photos/{userId}/@self/{albumId}", "response": {"$ref": "Album"}}}}', true)); $this->comments = new CommentsServiceResource($this, $this->serviceName, 'comments', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/buzz"], "parameters": {"alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "postId": {"required": true, "type": "string", "location": "path"}, "userId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "request": {"$ref": "Comment"}, "id": "chili.comments.insert", "httpMethod": "POST", "path": "activities/{userId}/@self/{postId}/@comments", "response": {"$ref": "Comment"}}, "get": {"scopes": ["https://www.googleapis.com/auth/buzz", "https://www.googleapis.com/auth/buzz.readonly"], "parameters": {"commentId": {"required": true, "type": "string", "location": "path"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "postId": {"required": true, "type": "string", "location": "path"}, "userId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "id": "chili.comments.get", "httpMethod": "GET", "path": "activities/{userId}/@self/{postId}/@comments/{commentId}", "response": {"$ref": "Comment"}}, "list": {"scopes": ["https://www.googleapis.com/auth/buzz", "https://www.googleapis.com/auth/buzz.readonly"], "parameters": {"max-results": {"default": "20", "format": "uint32", "type": "integer", "location": "query"}, "c": {"type": "string", "location": "query"}, "userId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}, "scope": {"required": true, "enum": ["@self"], "location": "path", "type": "string"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "postId": {"required": true, "type": "string", "location": "path"}}, "id": "chili.comments.list", "httpMethod": "GET", "path": "activities/{userId}/{scope}/{postId}/@comments", "response": {"$ref": "CommentFeed"}}, "update": {"scopes": ["https://www.googleapis.com/auth/buzz"], "parameters": {"userId": {"required": true, "type": "string", "location": "path"}, "abuseType": {"type": "string", "location": "query"}, "hl": {"type": "string", "location": "query"}, "commentId": {"required": true, "type": "string", "location": "path"}, "scope": {"required": true, "enum": ["@abuse", "@self"], "location": "path", "type": "string"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "postId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Comment"}, "id": "chili.comments.update", "httpMethod": "PUT", "path": "activities/{userId}/{scope}/{postId}/@comments/{commentId}", "response": {"$ref": "Comment"}}, "patch": {"scopes": ["https://www.googleapis.com/auth/buzz"], "parameters": {"userId": {"required": true, "type": "string", "location": "path"}, "abuseType": {"type": "string", "location": "query"}, "hl": {"type": "string", "location": "query"}, "commentId": {"required": true, "type": "string", "location": "path"}, "scope": {"required": true, "enum": ["@abuse", "@self"], "location": "path", "type": "string"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "postId": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Comment"}, "id": "chili.comments.patch", "httpMethod": "PATCH", "path": "activities/{userId}/{scope}/{postId}/@comments/{commentId}", "response": {"$ref": "Comment"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/buzz"], "parameters": {"commentId": {"required": true, "type": "string", "location": "path"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "postId": {"required": true, "type": "string", "location": "path"}, "userId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "httpMethod": "DELETE", "path": "activities/{userId}/@self/{postId}/@comments/{commentId}", "id": "chili.comments.delete"}}}', true)); $this->photos = new PhotosServiceResource($this, $this->serviceName, 'photos', json_decode('{"methods": {"insert2": {"scopes": ["https://www.googleapis.com/auth/picasa"], "parameters": {"albumId": {"required": true, "type": "string", "location": "path"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "userId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "mediaUpload": {"maxSize": "30MB", "accept": ["image/*"], "protocols": {"simple": {"path": "upload/photos/{userId}/@self/{albumId}/@photos", "multipart": true}, "resumable": {"path": "resumable/upload/photos/{userId}/@self/{albumId}/@photos", "multipart": true}}}, "request": {"$ref": "ChiliPhotosResourceJson"}, "id": "chili.photos.insert2", "httpMethod": "POST", "path": "photos/{userId}/@self/{albumId}/@photos", "response": {"$ref": "ChiliPhotosResourceJson"}}, "insert": {"scopes": ["https://www.googleapis.com/auth/buzz"], "parameters": {"albumId": {"required": true, "type": "string", "location": "path"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "userId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "mediaUpload": {"maxSize": "30MB", "accept": ["image/*"], "protocols": {"simple": {"path": "upload/photos/{userId}/{albumId}", "multipart": true}, "resumable": {"path": "resumable/upload/photos/{userId}/{albumId}", "multipart": true}}}, "request": {"$ref": "AlbumLite"}, "id": "chili.photos.insert", "httpMethod": "POST", "path": "photos/{userId}/{albumId}", "response": {"$ref": "AlbumLite"}}, "get": {"scopes": ["https://www.googleapis.com/auth/picasa"], "parameters": {"albumId": {"required": true, "type": "string", "location": "path"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "photoId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}, "userId": {"required": true, "type": "string", "location": "path"}}, "id": "chili.photos.get", "httpMethod": "GET", "path": "photos/{userId}/@self/{albumId}/@photos/{photoId}", "response": {"$ref": "ChiliPhotosResourceJson"}}, "listByScope": {"scopes": ["https://www.googleapis.com/auth/picasa"], "parameters": {"max-results": {"default": "20", "format": "uint32", "type": "integer", "location": "query"}, "c": {"type": "string", "location": "query"}, "userId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}, "scope": {"required": true, "enum": ["@recent"], "location": "path", "type": "string"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}}, "id": "chili.photos.listByScope", "httpMethod": "GET", "path": "photos/{userId}/@self/{scope}/@photos", "response": {"$ref": "PhotosFeed"}}, "listByAlbum": {"scopes": ["https://www.googleapis.com/auth/picasa"], "parameters": {"max-results": {"default": "20", "format": "uint32", "type": "integer", "location": "query"}, "c": {"type": "string", "location": "query"}, "userId": {"required": true, "type": "string", "location": "path"}, "albumId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}}, "id": "chili.photos.listByAlbum", "httpMethod": "GET", "path": "photos/{userId}/@self/{albumId}/@photos", "response": {"$ref": "PhotosFeed"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/picasa"], "parameters": {"albumId": {"required": true, "type": "string", "location": "path"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "photoId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}, "userId": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE", "path": "photos/{userId}/@self/{albumId}/@photos/{photoId}", "id": "chili.photos.delete"}}}', true)); $this->related = new RelatedServiceResource($this, $this->serviceName, 'related', json_decode('{"methods": {"list": {"scopes": ["https://www.googleapis.com/auth/buzz", "https://www.googleapis.com/auth/buzz.readonly"], "parameters": {"scope": {"required": true, "enum": ["@self"], "location": "path", "type": "string"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "postId": {"required": true, "type": "string", "location": "path"}, "userId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "id": "chili.related.list", "httpMethod": "GET", "path": "activities/{userId}/{scope}/{postId}/@related", "response": {"$ref": "RelatedFeed"}}}}', true)); $this->groups = new GroupsServiceResource($this, $this->serviceName, 'groups', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/buzz"], "parameters": {"alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "userId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "request": {"$ref": "Group"}, "id": "chili.groups.insert", "httpMethod": "POST", "path": "people/{userId}/@groups", "response": {"$ref": "Group"}}, "get": {"scopes": ["https://www.googleapis.com/auth/buzz", "https://www.googleapis.com/auth/buzz.readonly"], "parameters": {"alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "userId": {"required": true, "type": "string", "location": "path"}, "groupId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "id": "chili.groups.get", "httpMethod": "GET", "path": "people/{userId}/@groups/{groupId}/@self", "response": {"$ref": "Group"}}, "list": {"scopes": ["https://www.googleapis.com/auth/buzz", "https://www.googleapis.com/auth/buzz.readonly"], "parameters": {"max-results": {"default": "20", "format": "uint32", "type": "integer", "location": "query"}, "alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "userId": {"required": true, "type": "string", "location": "path"}, "c": {"type": "string", "location": "query"}, "hl": {"type": "string", "location": "query"}}, "id": "chili.groups.list", "httpMethod": "GET", "path": "people/{userId}/@groups", "response": {"$ref": "GroupFeed"}}, "update": {"scopes": ["https://www.googleapis.com/auth/buzz"], "parameters": {"alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "userId": {"required": true, "type": "string", "location": "path"}, "groupId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "request": {"$ref": "Group"}, "id": "chili.groups.update", "httpMethod": "PUT", "path": "people/{userId}/@groups/{groupId}/@self", "response": {"$ref": "Group"}}, "patch": {"scopes": ["https://www.googleapis.com/auth/buzz"], "parameters": {"alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "userId": {"required": true, "type": "string", "location": "path"}, "groupId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "request": {"$ref": "Group"}, "id": "chili.groups.patch", "httpMethod": "PATCH", "path": "people/{userId}/@groups/{groupId}/@self", "response": {"$ref": "Group"}}, "delete": {"scopes": ["https://www.googleapis.com/auth/buzz"], "parameters": {"alt": {"default": "atom", "enum": ["atom", "json"], "location": "query", "type": "string"}, "userId": {"required": true, "type": "string", "location": "path"}, "groupId": {"required": true, "type": "string", "location": "path"}, "hl": {"type": "string", "location": "query"}}, "httpMethod": "DELETE", "path": "people/{userId}/@groups/{groupId}", "id": "chili.groups.delete"}}}', true)); }
<?php session_start(); require_once "../src/apiClient.php"; $client = new apiClient(); $client->discover('plus'); $client->setScopes(array('https://www.googleapis.com/auth/plus.me')); if (isset($_GET['logout'])) { unset($_SESSION['token']); } if (isset($_GET['code'])) { $client->authenticate(); $_SESSION['token'] = $client->getAccessToken(); header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']); } if (isset($_SESSION['token'])) { $client->setAccessToken($_SESSION['token']); $ret = apiBatch::execute($client->plus->activities->list(array('userId' => 'me', 'collection' => 'public'), 'listActivities'), $client->plus->people->get(array('userId' => 'me'), 'getPerson')); print "<pre>" . print_r($ret, true) . "</pre>"; } else { $client->authenticate(); }
private function discoverService($serviceName, $serviceURI) { $request = self::$io->makeRequest(new apiHttpRequest($serviceURI)); if ($request->getResponseHttpCode() != 200) { throw new apiException("Could not fetch discovery document for {$serviceName}, code: " . $request->getResponseHttpCode() . ", response: " . $request->getResponseBody()); } $discoveryResponse = $request->getResponseBody(); $discoveryDocument = json_decode($discoveryResponse, true); if ($discoveryDocument == NULL) { throw new apiException("Invalid json returned for {$serviceName}"); } return new apiService($serviceName, $discoveryDocument, apiClient::getIo()); }
* * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ if (ini_get('register_globals') === "1") { die("register_globals must be turned off before using the starter application"); } require_once 'google-api-php-client/src/apiClient.php'; require_once 'google-api-php-client/src/contrib/apiPlusService.php'; session_start(); $client = new apiClient(); $client->setApplicationName("Google+ PHP Starter Application"); $client->setClientId('583952610464-skm0ipo4hms1qleut4jinp106fnf0daf.apps.googleusercontent.com'); $client->setClientSecret('FijubFKkMgXvH-UQV4SfEypV'); $client->setRedirectUri('http://localhost/googleplus/index.php'); $client->setDeveloperKey('AIzaSyDidZKyQlgizNL3lgPRHDyucL5sOxqGqXg'); $client->setScopes(array('https://www.googleapis.com/auth/plus.me', 'https://picasaweb.google.com/data/')); $plus = new apiPlusService($client); if (isset($_REQUEST['logout'])) { $files = glob('images/*'); // get all file names foreach ($files as $file) { // iterate files if (is_file($file)) { unlink($file); }
/** * Constructs the internal representation of the Gan service. * * @param apiClient apiClient */ public function __construct(apiClient $apiClient) { $this->rpcPath = '/rpc'; $this->restBasePath = '/gan/v1beta1/'; $this->version = 'v1beta1'; $this->serviceName = 'gan'; $apiClient->addService($this->serviceName, $this->version); $this->advertisers = new AdvertisersServiceResource($this, $this->serviceName, 'advertisers', json_decode('{"methods": {"list": {"parameters": {"relationshipStatus": {"enum": ["approved", "available", "deactivated", "declined", "pending"], "type": "string", "location": "query"}, "minSevenDayEpc": {"format": "double", "type": "number", "location": "query"}, "advertiserCategory": {"type": "string", "location": "query"}, "minNinetyDayEpc": {"format": "double", "type": "number", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "role": {"required": true, "enum": ["advertisers", "publishers"], "location": "path", "type": "string"}, "maxResults": {"format": "uint32", "maximum": "100", "minimum": "0", "location": "query", "type": "integer"}, "roleId": {"required": true, "type": "string", "location": "path"}, "minPayoutRank": {"format": "int32", "maximum": "4", "minimum": "1", "location": "query", "type": "integer"}}, "id": "gan.advertisers.list", "httpMethod": "GET", "path": "{role}/{roleId}/advertisers", "response": {"$ref": "Advertisers"}}, "get": {"parameters": {"advertiserId": {"type": "string", "location": "query"}, "roleId": {"required": true, "type": "string", "location": "path"}, "role": {"required": true, "enum": ["advertisers", "publishers"], "location": "path", "type": "string"}}, "id": "gan.advertisers.get", "httpMethod": "GET", "path": "{role}/{roleId}/advertiser", "response": {"$ref": "Advertiser"}}}}', true)); $this->ccOffers = new CcOffersServiceResource($this, $this->serviceName, 'ccOffers', json_decode('{"methods": {"list": {"parameters": {"advertiser": {"repeated": true, "type": "string", "location": "query"}, "projection": {"enum": ["full", "summary"], "type": "string", "location": "query"}, "publisher": {"required": true, "type": "string", "location": "path"}}, "id": "gan.ccOffers.list", "httpMethod": "GET", "path": "publishers/{publisher}/ccOffers", "response": {"$ref": "CcOffers"}}}}', true)); $this->events = new EventsServiceResource($this, $this->serviceName, 'events', json_decode('{"methods": {"list": {"parameters": {"orderId": {"type": "string", "location": "query"}, "sku": {"type": "string", "location": "query"}, "eventDateMax": {"type": "string", "location": "query"}, "linkId": {"type": "string", "location": "query"}, "eventDateMin": {"type": "string", "location": "query"}, "memberId": {"type": "string", "location": "query"}, "maxResults": {"format": "uint32", "maximum": "100", "minimum": "0", "location": "query", "type": "integer"}, "advertiserId": {"type": "string", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "publisherId": {"type": "string", "location": "query"}, "status": {"enum": ["active", "canceled"], "type": "string", "location": "query"}, "productCategory": {"type": "string", "location": "query"}, "chargeType": {"enum": ["credit", "debit", "monthly_minimum", "other", "slotting_fee", "tier_bonus"], "type": "string", "location": "query"}, "roleId": {"required": true, "type": "string", "location": "path"}, "role": {"required": true, "enum": ["advertisers", "publishers"], "location": "path", "type": "string"}, "type": {"enum": ["action", "charge", "transaction"], "type": "string", "location": "query"}}, "id": "gan.events.list", "httpMethod": "GET", "path": "{role}/{roleId}/events", "response": {"$ref": "Events"}}}}', true)); $this->publishers = new PublishersServiceResource($this, $this->serviceName, 'publishers', json_decode('{"methods": {"list": {"parameters": {"publisherCategory": {"type": "string", "location": "query"}, "relationshipStatus": {"enum": ["approved", "available", "deactivated", "declined", "pending"], "type": "string", "location": "query"}, "minSevenDayEpc": {"format": "double", "type": "number", "location": "query"}, "minNinetyDayEpc": {"format": "double", "type": "number", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "role": {"required": true, "enum": ["advertisers", "publishers"], "location": "path", "type": "string"}, "maxResults": {"format": "uint32", "maximum": "100", "minimum": "0", "location": "query", "type": "integer"}, "roleId": {"required": true, "type": "string", "location": "path"}, "minPayoutRank": {"format": "int32", "maximum": "4", "minimum": "1", "location": "query", "type": "integer"}}, "id": "gan.publishers.list", "httpMethod": "GET", "path": "{role}/{roleId}/publishers", "response": {"$ref": "Publishers"}}, "get": {"parameters": {"publisherId": {"type": "string", "location": "query"}, "role": {"required": true, "enum": ["advertisers", "publishers"], "location": "path", "type": "string"}, "roleId": {"required": true, "type": "string", "location": "path"}}, "id": "gan.publishers.get", "httpMethod": "GET", "path": "{role}/{roleId}/publisher", "response": {"$ref": "Publisher"}}}}', true)); }