mirror of
https://github.com/atlanticbiomedical/biomedjs.git
synced 2025-07-02 00:47:26 -04:00
51 lines
8.6 KiB
JSON
51 lines
8.6 KiB
JSON
{
|
|
"name": "googleapis",
|
|
"version": "0.2.13-alpha",
|
|
"author": {
|
|
"name": "Google Inc."
|
|
},
|
|
"description": "Google APIs Client Library for Node.js",
|
|
"contributors": [
|
|
{
|
|
"name": "Burcu Dogan",
|
|
"email": "jbd@google.com"
|
|
},
|
|
{
|
|
"name": "Monsur Hossain",
|
|
"email": "monsur@google.com"
|
|
}
|
|
],
|
|
"main": "./lib/googleapis",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "https://github.com/google/google-api-nodejs-client.git"
|
|
},
|
|
"keywords": [
|
|
"google",
|
|
"api",
|
|
"google apis",
|
|
"client",
|
|
"client library"
|
|
],
|
|
"dependencies": {
|
|
"request": "2.14.0",
|
|
"async": "0.2.6"
|
|
},
|
|
"devDependencies": {
|
|
"mocha": "1.8.1",
|
|
"url": "0.7.9"
|
|
},
|
|
"scripts": {
|
|
"test": "mocha tests/* --reporter spec --timeout 40000"
|
|
},
|
|
"license": "Apache 2",
|
|
"readme": "# google-api-nodejs-client [alpha]\n\n[](https://travis-ci.org/google/google-api-nodejs-client)\n\n`google-api-nodejs-client` is Google's officially supported\n[node.js](http://nodejs.org/) client\nlibrary for accessing Google APIs, it also supports authorization and\nauthentication with OAuth 2.0.\n\n**Note**: This library is currently in *alpha* status, meaning that we can make\nchanges in the future that *may not be compatible* with the previous versions.\n\n## Installation\n\nThe library is distributed on `npm`. In order to add it as a dependency,\nrun the following command:\n\n $ npm install googleapis\n\n## Guide\n\n### Discover APIs\n\nDynamically load Google APIs and start making requests:\n\n~~~~ js\nvar googleapis = require('googleapis');\n\ngoogleapis\n .discover('urlshortener', 'v1')\n .discover('plus', 'v1')\n .execute(function(err, client) {\n var params = { shortUrl: 'http://goo.gl/DdUKX' };\n var req1 = client.urlshortener.url.get(params);\n req1.execute(function (err, response) {\n console.log('Long url is', response.longUrl);\n });\n\n var req2 = client.plus.people.get({ userId: '+BurcuDogan' });\n req2.execute();\n});\n~~~~\n\nSupported APIs are listed on\n[Google APIs Explorer](https://developers.google.com/apis-explorer).\n\n#### Discovery Document Caching\n\nDiscovery documents are being cached for 5 minutes locally.\nYou can configure the directory used to store cached discovery\nfiles by using the `cache.path` option.\n\n~~~~ js\ngoogleapis\n .discover('plus', 'v3')\n .withOpts({ cache: { path: '<path>' }))\n .execute();\n~~~~\n\n### API Client\n\nClient libraries are generated during runtime by metadata provided by Google\nAPIs Discovery Service. Metadata provided by Discovery Service is cached,\nand won't be requested each time you load a client. Below, there is an\nexample of loading a client for\n[URL Shortener API](https://developers.google.com/url-shortener/).\n\n~~~~ js\ngoogleapis\n .discover('urlshortener', 'v1')\n .execute(function(err, client) {\n // make requests\n });\n~~~~\n\n### Requests\n\nThe following sample loads a client for URL Shortener and retrieves the long url\nof the given short url:\n\n~~~~ js\ngoogleapis.discover('urlshortener', 'v1').execute(function(err, client) {\n client.urlshortener.url.get({ shortUrl: 'http://goo.gl/DdUKX' })\n .execute(function(err, result) {\n // result.longUrl contains the long url.\n });\n });\n~~~~\n\nAlternatively, you may need to send an API key with the\nrequest you are going to make. The following creates and executes a request from the Google+ API service to retrieve a person profile given a userId:\n\n~~~~ js\ngoogleapis\n .discover('plus', 'v1')\n .execute(function(err, client) {\n var request1 = client.plus.people.get({ userId: '+BurcuDogan' })\n .withApiKey(API_KEY);\n\n request1.execute(function(err, result) {\n console.log(\"Result: \" + (err ? err.message : result.displayName));\n });\n });\n~~~~\n\nTo learn more about API keys, please see the [documentation](https://developers.google.com/console/help/#UsingKeys).\n\n### Batch requests\n\nYou can combine multiple requests in a single one by using batch requests.\n\n~~~~ js\nvar request1 =\n client.plus.people.get({ userId: '+BurcuDogan' });\n\nvar request2 =\n client.urlshortener.url.insert({ longUrl: 'http://google.com' });\n\n// Create from client service using the raw action name\nvar request3 = client.urlshortener.newRequest(\n 'urlshortener.url.get', { shortUrl: 'http://goo.gl/DdUKX' });\n\nclient\n .newBatchRequest()\n .add(request1)\n .add(request2)\n .add(request3)\n .execute(function(err, results) {\n\n });\n~~~~\n\n### Authorization and Authentication\n\nThis client comes with an OAuth2 client that allows you to retrieve an access token and\nrefreshes the token and re-try the request seamlessly if token is expired. The\nbasics of Google's OAuth 2.0 implementation is explained on\n[Google Authorization and Authentication\ndocumentation](https://developers.google.com/accounts/docs/OAuth2Login).\n\nA complete sample application that authorizes and authenticates with OAuth2.0\nclient is available at `examples/oauth2.js`.\n\n#### Consent Page Url\n\nIn order to ask for permissions from a user to retrieve an access token, you\nshould redirect them to a consent page. In order to create a consent page\nURL:\n\n~~~~ js\nvar googleapis = require('googleapis'),\n OAuth2Client = googleapis.OAuth2Client;\n\nvar oauth2Client =\n new OAuth2Client(CLIENT_ID, CLIENT_SECRET, REDIRECT_URL);\n\n// generates a url that allows offline access and asks permissions\n// for Google+ scope.\nvar url = oauth2Client.generateAuthUrl({\n access_type: 'offline',\n scope: 'https://www.googleapis.com/auth/plus.me'\n});\n~~~~\n\n#### Retrieving Tokens\nOnce a user has given permissions on the consent page, Google will redirect\nthe page to the redirect url you have provided with a code query parameter.\n\n GET /oauthcallback?code={authorizationCode}\n\nWith the code returned, you can ask for an access token as shown below:\n\n~~~~ js\noauth2Client.getToken(code, function(err, tokens) {\n // contains an access_token and optionally a refresh_token.\n // save them permanently.\n});\n~~~~\n\n#### Making Authenticated Requests\n\nAnd you can start using oauth2Client to authorize and authenticate your\nrequests to Google APIs with the retrieved tokens. If you provide a\nrefresh_token, in cases when access_token is expired, it asks for a new\naccess_token and replays the request.\n\nFollowing sample retrieves Google+ profile of the authenticated user.\n\n~~~~ js\noauth2Client.credentials = {\n access_token: 'ACCESS TOKEN HERE',\n refresh_token: 'REFRESH TOKEN HERE'\n};\n\nclient\n .plus.people.get({ userId: 'me' })\n .withAuthClient(oauth2Client)\n .execute(callback);\n~~~~\n\n## License\n\n`google-api-nodejs-client` is licensed with Apache 2.0. Full license text is\navailable on COPYING file.\n\n## Contributors\n\nBefore making any contributions, please sign one of the contributor\nlicense agreements below.\n\nFork the repo, develop and test your code changes.\n\nInstall all dependencies including development requirements by running:\n\n $ npm install -d\n\nTests use mocha. To run all tests you can use\n\n $ npm test\n\nwhich looks for tests in the `./tests` directory.\n\nYour code should honor the\n[Google JavaScript Style Guide](http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml).\nYou can use\n[Closure Linter](https://code.google.com/p/closure-linter/)\nto detect style issues.\n\nSubmit a pull request. The repo owner will review your request. If it is\napproved, the change will be merged. If it needs additional work, the repo\nowner will respond with useful comments.\n\n#### Contributor License Agreements\n\nBefore creating a pull request, please fill out either the individual or\ncorporate Contributor License Agreement.\n\n* If you are an individual writing original source code and you're sure you\nown the intellectual property, then you'll need to sign an\n[individual CLA](http://code.google.com/legal/individual-cla-v1.0.html).\n* If you work for a company that wants to allow you to contribute your work\nto this client library, then you'll need to sign a\n[corporate CLA](http://code.google.com/legal/corporate-cla-v1.0.html).\n\nFollow either of the two links above to access the appropriate CLA and\ninstructions for how to sign and return it. Once we receive it, we'll add you\nto the official list of contributors and be able to accept your patches.\n",
|
|
"readmeFilename": "README.md",
|
|
"_id": "googleapis@0.2.13-alpha",
|
|
"dist": {
|
|
"shasum": "8f226e77499d78225edf42fd1e0b3b7cb06259f3"
|
|
},
|
|
"_from": "googleapis@",
|
|
"_resolved": "https://registry.npmjs.org/googleapis/-/googleapis-0.2.13-alpha.tgz"
|
|
}
|