Skip to content
This repository was archived by the owner on Jul 6, 2022. It is now read-only.

Commit c7cfadb

Browse files
committed
Merge branch 'release/v1.0.0'
2 parents 69c4577 + 7ee68e6 commit c7cfadb

File tree

28 files changed

+884
-972
lines changed

28 files changed

+884
-972
lines changed

README.md

Lines changed: 45 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -4,95 +4,87 @@ This is the Storyblok Android client for easy access of the publishing api.
44

55
# More about Storyblok
66
- **WEBSITE** https://www.storyblok.com/
7-
- **API DOC** https://www.storyblok.com/docs/Delivery-Api/introduction
7+
- **API DOC** https://www.storyblok.com/docs/api/content-delivery
88

99
# Include in your project
1010
## Using Maven
1111

1212
```gradle
13-
implementation "com.mikepenz:storyblok-android-sdk:0.5.0"
13+
implementation "com.mikepenz:storyblok-android-sdk:1.0.0"
1414
```
1515

16+
> Note starting with v1.0.0 this library uses kotlin. See older versions for java only.
17+
1618
## How to use
1719
### Init client
1820

19-
```java
20-
Storyblok client = Storyblok.init("your-storyblok-token");
21+
```kotlin
22+
val client = Storyblok.init("your-storyblok-token")
2123
```
2224

2325
### Load a story
24-
```java
25-
client.getStory("fullSlug", new Storyblok.SuccessCallback<Story>() {
26-
@Override
27-
public void onResponse(final Result<Story> result) {
26+
```kotlin
27+
client.getStory("fullSlug", object : Storyblok.SuccessCallback<Story> {
28+
override fun onResponse(result: Result<Story>) {
2829
//on success
2930
}
30-
}, new Storyblok.ErrorCallback() {
31-
@Override
32-
public void onFailure(@Nullable IOException exception, @Nullable String response) {
33-
//on error
34-
}
35-
});
31+
}, object : Storyblok.ErrorCallback {
32+
override fun onFailure(exception: IOException?, response: String?) {
33+
// empty
34+
}
35+
})
3636
```
3737

3838
### Load a list of stories
39-
```java
40-
client.getStories(startsWith, withTag, sortBy, perPage, page, new Storyblok.SuccessCallback<List<Story>>() {
41-
@Override
42-
public void onResponse(final Result<List<Story>> result) {
39+
```kotlin
40+
client.getStories(startsWith, withTag, sortBy, perPage, page, object : Storyblok.SuccessCallback<List<Story>> {
41+
override fun onResponse(result: Result<List<Story>>) {
4342
//on success
4443
}
45-
}, new Storyblok.ErrorCallback() {
46-
@Override
47-
public void onFailure(@Nullable IOException exception, @Nullable String response) {
48-
//on error
49-
}
50-
});
44+
}, object : Storyblok.ErrorCallback {
45+
override fun onFailure(exception: IOException?, response: String?) {
46+
// empty
47+
}
48+
})
5149
```
5250

5351
### Load a list of tags
54-
```java
55-
client.getTags(startsWith, new Storyblok.SuccessCallback<List<Tag>>() {
56-
@Override
57-
public void onResponse(final Result<List<Tag>> result) {
52+
```kotlin
53+
client.getTags(startsWith, object : Storyblok.SuccessCallback<List<Tag>> {
54+
override fun onResponse(result: Result<List<Tag>>) {
5855
//on success
5956
}
60-
}, new Storyblok.ErrorCallback() {
61-
@Override
62-
public void onFailure(@Nullable IOException exception, @Nullable String response) {
63-
//on error
64-
}
65-
});
57+
}, object : Storyblok.ErrorCallback {
58+
override fun onFailure(exception: IOException?, response: String?) {
59+
// empty
60+
}
61+
})
6662
```
6763

6864
### Load a map of links
69-
```java
70-
client.getLinks(new Storyblok.SuccessCallback<Map<String, Link>>() {
71-
@Override
72-
public void onResponse(final Result<Map<String, Link>> result) {
65+
```kotlin
66+
client.getLinks(object : Storyblok.SuccessCallback<Map<String, Link>> {
67+
override fun onResponse(result: Result<Map<String, Link>>) {
7368
//on success
7469
}
75-
}, new Storyblok.ErrorCallback() {
76-
@Override
77-
public void onFailure(@Nullable IOException exception, @Nullable String response) {
78-
//on error
79-
}
80-
});
70+
}, object : Storyblok.ErrorCallback {
71+
override fun onFailure(exception: IOException?, response: String?) {
72+
// empty
73+
}
74+
})
8175
```
8276

8377
### Load a list of datasources
84-
```java
85-
client.getDatasource(datasource, new Storyblok.SuccessCallback<List<Datasource>>() {
86-
@Override
87-
public void onResponse(final Result<List<Datasource>> result) {
78+
```kotlin
79+
client.getDatasource(datasource, object : Storyblok.SuccessCallback<List<Datasource>> {
80+
override fun onResponse(result: Result<List<Datasource>>) {
8881
//on success
8982
}
90-
}, new Storyblok.ErrorCallback() {
91-
@Override
92-
public void onFailure(@Nullable IOException exception, @Nullable String response) {
93-
//on error
83+
}, object : Storyblok.ErrorCallback {
84+
override fun onFailure(exception: IOException?, response: String?) {
85+
// empty
9486
}
95-
});
87+
})
9688
```
9789

9890

app/build.gradle

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1+
plugins {
2+
id "org.jetbrains.kotlin.kapt"
3+
}
14
apply plugin: 'com.android.application'
5+
apply plugin: 'kotlin-android-extensions'
6+
apply plugin: 'kotlin-android'
27
//wrap with try and catch so the build is working even if the signing stuff is missing
38
try {
49
apply from: '../../../signing.gradle'
@@ -83,7 +88,7 @@ dependencies {
8388

8489
//https://github.com/JakeWharton/butterknife
8590
implementation 'com.jakewharton:butterknife:10.0.0'
86-
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
91+
kapt 'com.jakewharton:butterknife-compiler:10.0.0'
8792
}
8893

8994
def getProps(String propName) {

app/src/main/java/com/mikepenz/storyblok/app/SampleActivity.java

Lines changed: 0 additions & 176 deletions
This file was deleted.

0 commit comments

Comments
 (0)