UNPKG

picasa

Version:

Picasa web albums client for node

113 lines (76 loc) 6.34 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>Home - Documentation</title> <script src="scripts/prettify/prettify.js"></script> <script src="scripts/prettify/lang-css.js"></script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css"> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <input type="checkbox" id="nav-trigger" class="nav-trigger" /> <label for="nav-trigger" class="navicon-button x"> <div class="navicon"></div> </label> <label for="nav-trigger" class="overlay"></label> <nav> <li class="nav-link nav-home-link"><a href="index.html">Home</a></li><li class="nav-heading">Classes</li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="Picasa.html">Picasa</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Picasa.html#createAlbum">createAlbum</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Picasa.html#deletePhoto">deletePhoto</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Picasa.html#getAlbums">getAlbums</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Picasa.html#getAuthURL">getAuthURL</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Picasa.html#getPhotos">getPhotos</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Picasa.html#getTokens">getTokens</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Picasa.html#postPhoto">postPhoto</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Picasa.html#renewAccessToken">renewAccessToken</a></span></li><li class="nav-heading"><a href="global.html">Globals</a></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#getAccessToken">getAccessToken</a></span></li> </nav> <div id="main"> <section class="readme"> <article><p><a href="https://travis-ci.org/esteban-uo/picasa"><img src="https://travis-ci.org/esteban-uo/picasa.svg" alt="Build Status"></a></p> <p>A simple <strong>Google Photos</strong>, formally <strong>Picasa</strong> Web Albums client (2.0) for nodejs (&gt;= 4.8.7). Includes Auth helpers.</p> <p><img src="https://www.wptribe.net/wp-content/uploads/2013/01/Picasa_Logo.jpg" /></p> <h3>Install</h3><pre class="prettyprint source"><code>$ yarn add picasa</code></pre><p>or</p> <pre class="prettyprint source"><code>$ npm install --save picasa</code></pre><h3>Usage</h3><pre class="prettyprint source lang-js"><code>const Picasa = require('picasa') const picasa = new Picasa()</code></pre><h3>Docs</h3><p>API for Photos, Albums and Auth can be found <a href="./docs">here</a>. Please check out also the examples dir for more detailed examples. Rename <code>config.example.json</code> to <code>config.json</code> and add your own config data.</p> <h3>Auth</h3><p>To get an access token follow the next flow:</p> <p>1.Get the Auth URL and redirect the user to it.</p> <pre class="prettyprint source lang-js"><code>// Get config here API Manager > Credentials https://console.developers.google.com/home/dashboard const config = { clientId : 'yourClientId', redirectURI : 'redirectURI' } const authURL = picasa.getAuthURL(config)</code></pre><p>2.Google displays a consent screen to the user, asking them to authorize your application to request some of their data.</p> <p>3.Google redirects a code to your redirectURI.</p> <p>4.Use the code given as GET param in order to get an access token:</p> <pre class="prettyprint source lang-js"><code>// Get config here API Manager > Credentials https://console.developers.google.com/home/dashboard const config = { clientId : 'yourClientId', redirectURI : 'redirectURI' clientSecret : 'yourClientSecret' } picasa.getTokens(config, code).then(tokens => { /* use tokens.accessToken or tokens.refreshToken */ })</code></pre><p>5.If you need to renew an expired <code>accessToken</code>, use the <code>refreshToken</code> with <code>picasa.renewAccessToken</code>:</p> <pre class="prettyprint source lang-js"><code>const config = { clientId : 'yourClientId', redirectURI : 'redirectURI' clientSecret : 'yourClientSecret' } picasa.renewAccessToken(config, refreshToken).then(renewedAccessToken => { /* do something with renewedAccessToken */ })</code></pre><h2>Change Log</h2><p><strong><em>1.0.7</em></strong> Functions return a Promise if callback is not provided. Use <code>getTokens</code> if you want to use Promises instead <code>getAccessToken</code>.</p> <p><strong><em>1.0.6</em></strong> Get album, Create Album, Renew access token added. Get Photos can get all photos from an album id or all.</p> <h2>Contributors</h2><p>Thanks to <a href="https://github.com/z1c0">z1c0</a>, <a href="https://github.com/hbakhtiyor">hbakhtiyor</a>, <a href="https://github.com/pauarge">pauarge</a>, <a href="https://github.com/wreuven">wreuven</a></p> <h2>License</h2><p>MIT ©</p> <hr> <p>Play around https://developers.google.com/oauthplayground/?code=4/usq8QmuezR3Au_0UKyj9-UXmf6Bw_ij8KFWgIziYbpM#</p> <p>Picasa Docs https://developers.google.com/picasa-web/docs/2.0/developers_guide_protocol</p></article> </section> </div> <br class="clear"> <footer> Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Mar 04 2018 20:34:29 GMT+0100 (CET) using the Minami theme. </footer> <script>prettyPrint();</script> <script src="scripts/linenumber.js"></script> </body> </html>