Giter Club home page Giter Club logo

dropbox's Introduction

dropbox

Go client library for the Dropbox core and Datastore API with support for uploading and downloading encrypted files.

Support of the Datastore API should be considered as a beta version.

Prerequisite

To use this library, you must have a valid client ID (app key) and client secret (app secret) provided by Dropbox.
To register a new client application, please visit https://www.dropbox.com/developers/apps/create

Installation

This library depends on the oauth2 package, it can be installed with the go get command:

$ go get golang.org/x/oauth2

This package can be installed with the go get command:

$ go get github.com/stacktic/dropbox

Examples

This simple 4-step example will show you how to create a folder:

package main

import (
    "dropbox"
    "fmt"
)

func main() {
    var err error
    var db *dropbox.Dropbox

    var clientid, clientsecret string
    var token string

    clientid = "xxxxx"
    clientsecret = "yyyyy"
    token = "zzzz"

    // 1. Create a new dropbox object.
    db = dropbox.NewDropbox()

    // 2. Provide your clientid and clientsecret (see prerequisite).
    db.SetAppInfo(clientid, clientsecret)

    // 3. Provide the user token.
    db.SetAccessToken(token)

    // 4. Send your commands.
    // In this example, you will create a new folder named "demo".
    folder := "demo"
    if _, err = db.CreateFolder(folder); err != nil {
        fmt.Printf("Error creating folder %s: %s\n", folder, err)
    } else {
        fmt.Printf("Folder %s successfully created\n", folder)
    }
}

If you do not know the user token, you can replace step 3 by a call to the Auth method:

    // This method will ask the user to visit an URL and paste the generated code.
    if err = db.Auth(); err != nil {
        fmt.Println(err)
        return
    }
    // You can now retrieve the token if you want.
    token = db.AccessToken()

If you want a more complete example, please check the following project: https://github.com/stacktic/dbox.

Documentation

API documentation can be found here: http://godoc.org/github.com/stacktic/dropbox.

dropbox's People

Contributors

kron4eg avatar meshelton avatar ncw avatar sirwart avatar stacktic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  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.