Skip to content

Commit

Permalink
Fix broken Markdown headings
Browse files Browse the repository at this point in the history
  • Loading branch information
bryant1410 committed Apr 16, 2017
1 parent 55d9e79 commit 5cde4ac
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# ApiClient
A easy to use api client that combines the power of Retrofit, Realm, Gson, Rxjava and Retrolambda in a library for Java and Android

#####Add to build.gradle
##### Add to build.gradle

```groovy
compile 'io.fabianterhorst:apiclient:0.4'
compile 'io.fabianterhorst:apiclient-accountmanager:0.1'
compile 'io.fabianterhorst:apiclient-components:0.1'
```

####First Step
#### First Step

Create your Api Class

Expand Down Expand Up @@ -38,7 +38,7 @@ public class Twitter extends ApiClient<TwitterApi> implements TwitterApi {
}
```

####Second Step
#### Second Step

Create your Api Interface (The Retrofit way)

Expand All @@ -53,7 +53,7 @@ public interface TwitterApi {
}
```

####Third Step
#### Third Step

Initiate the Singleton in the Application onCreate

Expand All @@ -72,7 +72,7 @@ public class MyApplication extends Application {
}
```

####Fourth Step
#### Fourth Step

Use it and have fun. The library is handling the saving, the loading and the refreshing for you.

Expand All @@ -82,9 +82,9 @@ Twitter twitter = Twitter.getInstance();
twitter.getTweets().subscribe(tweets-> System.out.println(tweets));
```

###FAQ
### FAQ

#####How to handle Android Activity lifecycle
##### How to handle Android Activity lifecycle

You can use the ApiClient component module to get access to RxActivity and RxFragment

Expand All @@ -96,7 +96,7 @@ Twitter twitter = Twitter.getInstance(bindToLifecycle());

And thats everythink you have to do to prevent memory leaks.

#####RealmList doesn´t support null objects. How can i ignore null object inside the response json?
##### RealmList doesn´t support null objects. How can i ignore null object inside the response json?

You can override the gson builder inside your api class and add custom deserializer adapters to avoid adding null objects.

Expand All @@ -110,15 +110,15 @@ public GsonBuilder getGsonBuilder(GsonBuilder gsonBuilder) {
}
```

#####How to change the api key from everywhere?
##### How to change the api key from everywhere?

You can use the ```setApiKey``` method.

```java
Twitter.getInstance().setApiKey("9876543210");
```

#####How to add other query parameters?
##### How to add other query parameters?

You can override the ```getHttpUrlBuilder(HttpUrl.Builder builder)``` method from the api client.

Expand All @@ -129,7 +129,7 @@ public HttpUrl.Builder getHttpUrlBuilder(HttpUrl.Builder builder) {
}
```

#####How to use a authentication
##### How to use a authentication

The easiest way is to use the AuthUtils to add a authentication via the request builder for post parameters and headers or the http url builder for query parameter

Expand Down

0 comments on commit 5cde4ac

Please sign in to comment.