Skip to content

Commit 9939b5b

Browse files
authored
Reformat README in Markdown
Also add GoDoc badge
1 parent 160b787 commit 9939b5b

File tree

1 file changed

+25
-29
lines changed

1 file changed

+25
-29
lines changed
Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
1-
= Dropbox SDK for Go [UNOFFICIAL]
1+
# Dropbox SDK for Go [UNOFFICIAL] [![GoDoc](https://godoc.org/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox?status.svg)](https://godoc.org/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox)
22

33
An **UNOFFICIAL** Go SDK for integrating with the Dropbox API v2. Tested with Go 1.5+
44

55
WARNING: This SDK is **NOT yet official**. What does this mean?
66

7-
* There is no formal Dropbox https://www.dropbox.com/developers/support[support] for this SDK at this point
7+
* There is no formal Dropbox [support](https://www.dropbox.com/developers/support) for this SDK at this point
88
* Bugs may or may not get fixed
99
* Not all SDK features may be implemented and implemented features may be buggy or incorrect
1010

1111

12-
=== Uh OK, so why are you releasing this?
12+
### Uh OK, so why are you releasing this?
1313

1414
* the SDK, while unofficial, _is_ usable. See https://github.com/dropbox/dbxcli[dbxcli] for an example application built using the SDK
1515
* we would like to get feedback from the community and evaluate the level of interest/enthusiasm before investing into official supporting one more SDK
1616

17-
== Installation
17+
## Installation
1818

19-
[source,sh]
20-
----
19+
```sh
2120
$ go get github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/...
22-
----
21+
```
2322

2423
For most applications, you should just import the relevant namespace(s) only. The SDK exports the following sub-packages:
2524

@@ -31,16 +30,15 @@ For most applications, you should just import the relevant namespace(s) only. Th
3130

3231
Additionally, the base `github.com/dropbox/dropbox-sdk-go-unofficial/dropbox` package exports some configuration and helper methods.
3332

34-
== Usage
33+
## Usage
3534

36-
First, you need to https://dropbox.com/developers/apps:[register a new "app"] to start making API requests. Once you have created an app, you can either use the SDK via an access token (useful for testing) or via the regular OAuth2 flow (recommended for production).
35+
First, you need to [register a new "app"](https://dropbox.com/developers/apps) to start making API requests. Once you have created an app, you can either use the SDK via an access token (useful for testing) or via the regular OAuth2 flow (recommended for production).
3736

38-
=== Using OAuth token
37+
### Using OAuth token
3938

4039
Once you've created an app, you can get an access token from the app's console. Note that this token will only work for the Dropbox account the token is associated with.
4140

42-
[source,go]
43-
----
41+
```go
4442
import "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox"
4543
import "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users"
4644

@@ -49,51 +47,49 @@ func main() {
4947
dbx := users.New(config)
5048
// start making API calls
5149
}
52-
----
50+
```
5351

54-
=== Using OAuth2 flow
52+
### Using OAuth2 flow
5553

56-
For this, you will need your `APP_KEY` and `APP_SECRET` from the developers console. Your app will then have to take users though the oauth flow, as part of which users will explicitly grant permissions to your app. At the end of this process, users will get a token that the app can then use for subsequent authentication. See https://godoc.org/golang.org/x/oauth2#example-Config[this] for an example of oauth2 flow in Go.
54+
For this, you will need your `APP_KEY` and `APP_SECRET` from the developers console. Your app will then have to take users though the oauth flow, as part of which users will explicitly grant permissions to your app. At the end of this process, users will get a token that the app can then use for subsequent authentication. See [this](https://godoc.org/golang.org/x/oauth2#example-Config) for an example of oauth2 flow in Go.
5755

5856
Once you have the token, usage is same as above.
5957

60-
=== Making API calls
58+
### Making API calls
6159

62-
Each Dropbox API takes in a request type and returns a response type. For instance, https://www.dropbox.com/developers/documentation/http/documentation#users-get_account[/users/get_account] takes as input a `GetAccountArg` and returns a `BasicAccount`. The typical pattern for making API calls is:
60+
Each Dropbox API takes in a request type and returns a response type. For instance, [/users/get_account](https://www.dropbox.com/developers/documentation/http/documentation#users-get_account) takes as input a `GetAccountArg` and returns a `BasicAccount`. The typical pattern for making API calls is:
6361

6462
* Instantiate the argument via the `New*` convenience functions in the SDK
6563
* Invoke the API
6664
* Process the response (or handle error, as below)
6765

6866
Here's an example:
6967

70-
[source, go]
71-
----
68+
```go
7269
arg := users.NewGetAccountArg()
7370
if resp, err := dbx.GetAccount(arg); err != nil {
7471
return err
7572
}
7673
fmt.Printf("Name: %v", resp.Name)
77-
----
74+
```
7875

79-
=== Error Handling
76+
### Error Handling
8077

8178
As described in the https://www.dropbox.com/developers/documentation/http/documentation#error-handling[API docs], all HTTP errors _except_ 409 are returned as-is to the client (with a helpful text message where possible). In case of a 409, the SDK will return an endpoint-specific error as described in the API. This will be made available as `EndpointError` member in the error.
8279

83-
== Note on using the Teams API
80+
## Note on using the Teams API
8481

8582
To use the Team API, you will need to create a Dropbox Business App. The OAuth token from this app will _only_ work for the Team API.
8683

87-
Please read the https://www.dropbox.com/developers/documentation/http/teams[API docs] carefully to appropriate secure your apps and tokens when using the Team API.
84+
Please read the [API docs](https://www.dropbox.com/developers/documentation/http/teams) carefully to appropriate secure your apps and tokens when using the Team API.
8885

89-
== Code Generation
86+
## Code Generation
9087

91-
This SDK is automatically generated using the public https://github.com/dropbox/dropbox-api-spec[Dropbox API spec]
92-
and https://github.com/dropbox/stone[Stone]. See this https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/master/generator/README.asciidoc[README]
88+
This SDK is automatically generated using the public [Dropbox API spec](https://github.com/dropbox/dropbox-api-spec) and [Stone](https://github.com/dropbox/stone). See this [README](https://github.com/dropbox/dropbox-sdk-go-unofficial/blob/master/generator/README.md)
9389
for more details on how code is generated.
9490

95-
== Caveats
91+
## Caveats
9692

9793
* To re-iterate, this is an **UNOFFICIAL** SDK and thus has no official support from Dropbox
98-
* Only supports the v2 API. Parts of the v2 API are still in beta, and thus subject to change
99-
* This SDK itself is in beta, and so interfaces may change at any point
94+
* Only supports the v2 API. Parts of the v2 API are still in beta, and thus subject to change
95+
* This SDK itself is in beta, and so interfaces may change at any point

0 commit comments

Comments
 (0)