Giter Club home page Giter Club logo

dropbox-go's Introduction

Dropbox-Go

Go library for the Dropbox API

Setup

    $ go get -u github.com/scottferg/Dropbox-Go/dropbox

Authentication

The Dropbox API uses OAuth for it's authentication mechanism. You can authenticate a session by using an instance of a Session interface:

    s := dropbox.Session{
        AppKey: "yourappkey",
        AppSecret: "yourappsecret",
        AccessType: "app_folder",
    }

Once you have initialized a Session you can then obtain a request token:

    s.ObtainRequestToken()

You will need to authorize this token with the app, which will require visiting a Dropbox URL. You can grab this URL with the following function:

    dropbox.GenerateAuthorizeUrl(s.Token.Key)

Once you have authorized the request token for use, you can obtain the access token much like you obtained the request token:

    s.ObtainAccessToken()

Your session is now authorized to make requests.

Making Requests

Most API methods take a series of optional parameters. These parameters should be sent in an instance of a package.Parameters struct (where package is files, fileops, account). If you do not wish to send any optional parameters, just pass nil for that argument. All required parameters are part of the function signature:

    p := dropbox.Parameters{
        Rev: "01b3f45a",
        FileLimit: "50",
    }

    u := dropbox.Uri{
        Root: "sandbox",
        Path: "path/to/my/file.pdf",
    }

    dropbox.GetMetadata(s, u, p) // sup?

Or:

    dropbox.GetMetadata(s, u, nil)

Any irrelevant parameters will be ignored in the request.

API Documentation:

http://go.pkgdoc.org/github.com/scottferg/Dropbox-Go/dropbox

dropbox-go's People

Contributors

scottferg avatar brackendev avatar dacort avatar kavu avatar

Watchers

James Healy avatar James Cloos avatar

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.