Skip to content

Commit 4967882

Browse files
committed
Merge branch 'dev'
Release v0.2
2 parents 9a8b394 + 6c75538 commit 4967882

29 files changed

+1888
-145
lines changed

README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
Box Java SDK
22
============
33

4-
This SDK provides a Java interface for the [Box REST API](https://developers.box.com/docs/). Features from the [previous version of the Box Java SDK](https://github.com/box/box-java-sdk-v2) are being transitioned to this SDK.
4+
This SDK provides a Java interface for the [Box REST
5+
API](https://developers.box.com/docs/). Features from the [previous version of
6+
the Box Java SDK](https://github.com/box/box-java-sdk-v2) are being transitioned
7+
to this SDK.
58

69
Quickstart
710
----------
811

9-
Here is a simple example of how to authenticate with the API using a developer token and then print the ID and name of each item in your root folder.
12+
Here is a simple example of how to authenticate with the API using a developer
13+
token and then print the ID and name of each item in your root folder.
1014

1115
```java
1216
BoxAPIConnection api = new BoxAPIConnection("developer-token");
@@ -20,13 +24,19 @@ for (BoxItem item : rootFolder) {
2024
Building
2125
--------
2226

23-
The SDK uses Gradle for its build system. Running `gradle build` from the root of the repository will compile, lint, and test the SDK.
27+
The SDK uses Gradle for its build system. Running `gradle build` from the root
28+
of the repository will compile, lint, and test the SDK.
2429

2530
```bash
2631
$ gradle build
2732
```
2833

29-
The SDK also includes integration tests which make real API calls, and therefore are run separately from unit tests. Integration tests should be run against a test account since they create and delete data. To run the integration tests, remove the `.template` extension from `src/test/config/config.properties.template` and fill in your test account's information. Then run:
34+
The SDK also includes integration tests which make real API calls, and therefore
35+
are run separately from unit tests. Integration tests should be run against a
36+
test account since they create and delete data. To run the integration tests,
37+
remove the `.template` extension from
38+
`src/test/config/config.properties.template` and fill in your test account's
39+
information. Then run:
3040

3141
```bash
3242
$ gradle integrationTest
@@ -41,4 +51,7 @@ You can find guides and tutorials in the `doc` directory.
4151
* [Authentication](doc/authentication.md)
4252
* [Events Stream](doc/events.md)
4353

44-
Javadocs are also generated when `gradle build` is run and can be found in `build/doc/javadoc`.
54+
Javadoc reference documentation is [available here][1]. Javadocs are also
55+
generated when `gradle javadoc` is run and can be found in `build/doc/javadoc`.
56+
57+
[1]:https://gitenterprise.inside-box.net/pages/Box/box-java-sdk/javadoc/com/box/sdk/package-summary.html

build.gradle

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ dependencies {
1414
testCompile 'org.hamcrest:hamcrest-library:1.3'
1515
testCompile 'com.github.tomakehurst:wiremock:1.47'
1616
testCompile 'org.mockito:mockito-core:1.9.5'
17+
testCompile 'org.slf4j:slf4j-api:1.7.7'
18+
testCompile 'org.slf4j:slf4j-nop:1.7.7'
1719
}
1820

1921
tasks.withType(JavaCompile) {
@@ -60,3 +62,18 @@ task integrationTest(type: Test) {
6062
includeCategories 'com.box.sdk.IntegrationTest'
6163
}
6264
}
65+
66+
javadoc {
67+
options.windowTitle 'Box Java SDK'
68+
options.noQualifiers 'all'
69+
options.stylesheetFile file('doc/css/javadoc.css')
70+
options.noTree true
71+
options.noIndex true
72+
options.noHelp true
73+
options.noDeprecatedList true
74+
options.noNavBar true
75+
options.docEncoding 'utf-8'
76+
options.charSet 'utf-8'
77+
options.linkSource true
78+
options.links 'http://docs.oracle.com/javase/8/docs/api/'
79+
}

doc/authentication.md

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
Authentication
22
==============
33

4-
The Box API uses OAuth2 for authentication, which can be difficult to implement. The SDK makes it easier by providing classes that handle obtaining tokens and automatically refreshing them.
4+
The Box API uses OAuth2 for authentication, which can be difficult to implement.
5+
The SDK makes it easier by providing classes that handle obtaining tokens and
6+
automatically refreshing them.
57

68
Ways to Authenticate
79
--------------------
810

911
### Developer Tokens
1012

11-
The fastest way to get started using the API is with developer tokens. A developer token is simply a short-lived access token that cannot be refreshed and can only be used with your own account. Therefore, they're only useful for testing an app and aren't suitable for production. You can obtain a developer token from your application's [developer console](https://cloud.app.box.com/developers/services).
13+
The fastest way to get started using the API is with developer tokens. A
14+
developer token is simply a short-lived access token that cannot be refreshed
15+
and can only be used with your own account. Therefore, they're only useful for
16+
testing an app and aren't suitable for production. You can obtain a developer
17+
token from your application's [developer
18+
console](https://cloud.app.box.com/developers/services).
1219

1320
The following example creates an API connection with a developer token:
1421

@@ -18,17 +25,24 @@ BoxAPIConnection api = new BoxAPIConnection("YOUR-DEVELOPER-TOKEN");
1825

1926
### Normal Authentication
2027

21-
Using an auth code is the most common way of authenticating with the Box API. Your application must provide a way for the user to login to Box (usually with a browser or web view) in order to obtain an auth code.
28+
Using an auth code is the most common way of authenticating with the Box API.
29+
Your application must provide a way for the user to login to Box (usually with a
30+
browser or web view) in order to obtain an auth code.
2231

23-
After a user logs in and grants your application access to their Box account, they will be redirected to your application's `redirect_uri` which will contain an auth code. This auth code can then be used along with your client ID and client secret to establish an API connection.
32+
After a user logs in and grants your application access to their Box account,
33+
they will be redirected to your application's `redirect_uri` which will contain
34+
an auth code. This auth code can then be used along with your client ID and
35+
client secret to establish an API connection.
2436

2537
```java
2638
BoxAPIConnection api = new BoxAPIConnection("YOUR-CLIENT-ID", "YOUR-CLIENT-SECRET", "YOUR-AUTH-CODE");
2739
```
2840

2941
### Manual Authentication
3042

31-
In certain advanced scenarios, you may want to obtain an access and refresh token yourself through manual calls to the API. In this case, you can create an API connection with the tokens directly.
43+
In certain advanced scenarios, you may want to obtain an access and refresh
44+
token yourself through manual calls to the API. In this case, you can create an
45+
API connection with the tokens directly.
3246

3347
```java
3448
BoxAPIConnection api = new BoxAPIConnection("YOUR-CLIENT-ID", "YOUR-CLIENT-SECRET", "YOUR-ACCESS-TOKEN",
@@ -38,7 +52,10 @@ BoxAPIConnection api = new BoxAPIConnection("YOUR-CLIENT-ID", "YOUR-CLIENT-SECRE
3852
Auto-Refresh
3953
------------
4054

41-
By default, a `BoxAPIConnection` will automatically refresh the access token if it has expired. To disable auto-refresh, set the connection's refresh token to null. Keep in mind that you will have to manually refresh and update the access token yourself.
55+
By default, a `BoxAPIConnection` will automatically refresh the access token if
56+
it has expired. To disable auto-refresh, set the connection's refresh token to
57+
null. Keep in mind that you will have to manually refresh and update the access
58+
token yourself.
4259

4360
```java
4461
// This connection won't auto-refresh.

0 commit comments

Comments
 (0)