From 9255dc4b4d5db342c52913493cd5974691f84c25 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Fri, 17 Aug 2018 09:49:37 -0700 Subject: [PATCH] fix: remove urlshortener from the samples and docs (#1284) --- README.md | 39 ++++++++++++------------ samples/README.md | 15 ---------- samples/urlshortener/README.md | 9 ------ samples/urlshortener/urlshortener.js | 45 ---------------------------- 4 files changed, 19 insertions(+), 89 deletions(-) delete mode 100644 samples/urlshortener/README.md delete mode 100644 samples/urlshortener/urlshortener.js diff --git a/README.md b/README.md index 02c03c8b255..e4e854ab696 100644 --- a/README.md +++ b/README.md @@ -52,38 +52,38 @@ $ npm install googleapis ``` ### First example -This is a very simple example. This creates a URL Shortener client and retrieves the long url of the given short url: +This is a very simple example. This creates a Blogger client and retrieves the details of a blog given the blog Id: ``` js const {google} = require('googleapis'); // Each API may support multiple version. With this sample, we're getting -// v1 of the urlshortener API, and using an API key to authenticate. -const urlshortener = google.urlshortener({ - version: 'v1', +// v3 of the blogger API, and using an API key to authenticate. +const blogger = google.blogger({ + version: 'v3', auth: 'YOUR API KEY' }); const params = { - shortUrl: 'http://goo.gl/xKbRu3' + blogId: 3213900 }; -// get the long url of a shortened url -urlshortener.url.get(params, (err, res) => { +// get the blog details +blogger.blogs.get(params, (err, res) => { if (err) { console.error(err); throw err; } - console.log(`Long url is ${res.data.longUrl}`); + console.log(`The blog url is ${res.data.url}`); }); ``` Instead of using callbacks you can also use promises! ``` js -urlshortener.url.get(params) +blogger.blogs.get(params) .then(res => { - console.log(`Long url is ${res.data.longUrl}`); + console.log(`The blog url is ${res.data.url}`); }) .catch(error => { console.error(error); @@ -94,8 +94,8 @@ Or async/await: ``` js async function runSample() { - const res = await urlshortener.url.get(params); - console.log(`Long url is ${res.data.longUrl}`); + const res = await blogger.blogs.get(params); + console.log(`The blog url is ${res.data.url}`); } runSample().catch(console.error); ``` @@ -390,8 +390,8 @@ google.options({ You can also specify options when creating a service client. ```js -const urlshortener = google.urlshortener({ - version: 'v1', +const blogger = google.blogger({ + version: 'v3', // All requests made with this object will use the specified auth. auth: 'API KEY'; }); @@ -404,16 +404,16 @@ By doing this, every API call made with this service client will use `'API KEY'` Similar to the examples above, you can also modify the parameters used for every call of a given service: ```js -const urlshortener = google.urlshortener({ - version: 'v1', +const blogger = google.blogger({ + version: 'v3', // All requests made with this service client will contain the - // quotaUser query parameter unless overridden in individual API calls. + // blogId query parameter unless overridden in individual API calls. params: { - quotaUser: 'user123@example.com' + blogId: 3213900 } }); -// Calls with this drive client will NOT contain the quotaUser query parameter. +// Calls with this drive client will NOT contain the blogId query parameter. const drive = google.drive('v3'); ... @@ -522,7 +522,6 @@ We love contributions! Before submitting a Pull Request, it's always good to sta [node]: http://nodejs.org/ [stackoverflow]: http://stackoverflow.com/questions/tagged/google-api-nodejs-client [apiexplorer]: https://developers.google.com/apis-explorer -[urlshort]: https://developers.google.com/url-shortener/ [usingkeys]: https://support.google.com/cloud/answer/6158862?hl=en [contributing]: https://github.com/google/google-api-nodejs-client/blob/master/.github/CONTRIBUTING.md [copying]: https://github.com/google/google-api-nodejs-client/tree/master/COPYING diff --git a/samples/README.md b/samples/README.md index b72a4c476c6..5251cb42dde 100644 --- a/samples/README.md +++ b/samples/README.md @@ -76,21 +76,6 @@ Documentation for the Glass Mirror API in -## ![](http://www.google.com/images/icons/product/shortlinks-32.png) URL Shortener API - -Lets you create, inspect, and manage `goo.gl` short URLs. - -Documentation for the URL Shortener API in -[JSDoc](http://google.github.io/google-api-nodejs-client/classes/_apis_urlshortener_v1_.urlshortener.html). - - - - - - -
samples/urlshortenerShortens a URL with the URL Shortener API
- - ## ![](http://www.google.com/images/icons/product/youtube-32.png) YouTube API With the YouTube Data API, you can add a variety of YouTube features to your application. Use the API to upload videos, manage playlists and subscriptions, update channel settings, and more. diff --git a/samples/urlshortener/README.md b/samples/urlshortener/README.md deleted file mode 100644 index d8b061c28bc..00000000000 --- a/samples/urlshortener/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Url Shortener Samples - -The Google URL Shortener at goo.gl is a service that takes long URLs and squeezes them into fewer characters to make a link that is easier to share, tweet, or email to friends. - -[Getting Started](https://developers.google.com/url-shortener/) - -## Running the sample - -`node urlshortener.js` \ No newline at end of file diff --git a/samples/urlshortener/urlshortener.js b/samples/urlshortener/urlshortener.js deleted file mode 100644 index ed3d50297fa..00000000000 --- a/samples/urlshortener/urlshortener.js +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2012-2016, Google, Inc. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -'use strict'; - -const {google} = require('googleapis'); -const path = require('path'); -const nconf = require('nconf'); - -nconf.argv().env().file(path.join(__dirname, '../config.json')); - -const urlshortener = google.urlshortener({ - version: 'v1', - auth: nconf.get('api_key') -}); - -urlshortener.url.get({ - shortUrl: 'http://goo.gl/DdUKX' -}, (err, res) => { - if (err) { - throw err; - } - console.log(res.data); -}); - -urlshortener.url.insert({ - requestBody: { - longUrl: 'http://somelongurl.com' - } -}, (err, res) => { - if (err) { - throw err; - } - console.log(res.data); -});