Giter VIP home page Giter VIP logo

dribbble-oauth2's Introduction

Dribble-OAUTH2

Library to easy access and use dribbble OAuth2 api.

Getting Started

const settings = {
  'client_id': YOUR_CLIENT_ID,
  'client_secret': YOUR_CLIENT_SECRET
};
const dribble = require('./dribbble-oauth2/index')(settings); // return instance of dribble (singleton)
Dribbble instance can init later. Just call setSettings mehtod/
const dribble = require('dribbble-oauth2')();
// ... another code 
    const settings = {
        'client_id': YOUR_CLIENT_ID,
        'client_secret': YOUR_CLIENT_SECRET
  };
  dribble.setSettings(settings);

  const url = dribble.authorize(REDIRECT_URL, 'public+upload');
Init dribble and set local url when you will get code (note, redirect url should be save in a dribble account)

Scope can be 'public', 'upload' or 'public+upload';

const url = dribble.authorize(redirectUrl, scope); // return link (type = string);

Go to link returned from the authorize method and login into Dribbble using your credentials. After this you will be redirected to the setted url. Use code in params and get the access_token.

app.get('/redirect', (req, res) => {     // Example route
  const code = req.query.code;           // Get the code from url params

  dribble.getToken(code)                    
    .then(response => {
      if (response.status) {                
        res.json(response.statusText)
      } else {
        res.json(response)               // Contains an access_token which you can use in future requests
      }                                     
    });
});
Use predefined access_token
const dribble = DribbleOauth()();
dribble.setAccessToken(ACCESS_TOKEN);

API

Shots

Get all shots

dribble.api.shot.getAll();

Get shot by id

Name Type Description
id number Shot id
dribble.api.shot.get(id);   

Create a shot

Name Type Description
image file Required. The image file must be exactly 400x300 or 800x600 resolution, no larger than 8 megabytes, and be a GIF, JPG or PNG.
title string Required. The title of the shot.
description string The shot description.
low_profile boolean Specify true if the shot is Low Profile.
rebound_source_id integer An ID of a shot that the new shot is a rebound of.

The authenticated user must either be a member of the team or be authenticated as the same team.

dribble.api.shot.create(settings);

Update a shot

Name Type Description
id number Shot Id.
description string Shot description.
low_profile boolean Specify true if the shot is Low Profile.
scheduled_for timestamp If the shot is not already published, will reschedule the shot to publish at the timestamp provided. Timestamp must be in ISO 8601 format. The authenticated user must be a pro, a team, or a member of a team.
tags array Tags for the shot. Limited to a maximum of 12 tags. If any existing tags are not provided they will be removed.
team_id integer An ID of a team to associate the shot with. The authenticated user must be on the team. If any empty value is provided the team association will be removed.
title string The title of the shot.
dribble.api.shot.update(id, settings);

Delete shot by id

Name Type Description
id number Shot id.
dribble.api.shot.delete(id);   

User

Get the authenticated user

dribble.api.user.get();   

Projects

List projects

dribble.api.project.getAll();   

Create a project

Name Type Description
name string Required. The name of the project.
description string The project description.
dribble.api.project.create(settings);   

Update a project

Name Type Description
id number Project id.
name string The name of the project.
description string The project description.
dribble.api.project.update(id, settings);   

Delete a project

Name Type Description
id number Project id.
dribble.api.user.delete(id);   

Attachments

Create an attachment

Name Type Description
file file Required. The attachment file must be no larger than 10 megabytes.
dribble.api.attachment.create(shotId, settings);   

Delete an attachment

dribble.api.attachment.delete(shotId, attachmentId);   

dribbble-oauth2's People

Contributors

akvhesik avatar kpoddubnyi avatar sgurin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

kirillpd andr-xxx

dribbble-oauth2's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.