Skip to content

Commit 1efca59

Browse files
committed
Release version 2.0.0
1 parent 58625cc commit 1efca59

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 2.0.0
2+
- Support for include and exclude json path based on query params (Thanks to @[Husseinhj](https://github.com/Husseinhj))
3+
14
# 1.1.0
25
- Escape closing curly brace in regex to support in android
36
- Add support to retrofit HTTP annotation

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,24 @@ interface Api {
6868
@Query("page") page: Int,
6969
@Query("limit") limit: Int
7070
): Call<List<Picsum>>
71+
72+
// if you want to filter through query params
73+
@Mock("picsum_recent.json", excludeQueries = ["type=favorites"])
74+
@GET("list")
75+
fun getRecentPicsums(
76+
@Query("type") type: String,
77+
@Query("page") page: Int,
78+
@Query("limit") limit: Int
79+
): Call<List<Picsum>>
80+
81+
// if you want to filter through query params
82+
@Mock("picsum_favorites.json", includeQueries = ["type=favorites"])
83+
@GET("list")
84+
fun getFavoritePicsums(
85+
@Query("type") type: String,
86+
@Query("page") page: Int,
87+
@Query("limit") limit: Int
88+
): Call<List<Picsum>>
7189
}
7290
```
7391

@@ -92,7 +110,7 @@ class RemoteDataSource(private val context: Context) {
92110
bodyFactory = { input -> context.resources.assets.open(input) }, // read asset file
93111
logger = { tag, message -> Log.d(tag, message) }, // pass logger to log events in logcat
94112
baseUrl = BASE_URL, // base url of your api
95-
requestPathToJsonMap = REQUEST_TO_JSON, // autogenerated constant, just press build button
113+
requestPathToMockPathRule = REQUEST_TO_JSON, // autogenerated constant, just press build button
96114
mockFilesPath = MOCK_FILES_PATH, // path to json files
97115
mockFitEnable = true, // master setting to enable or disable mocking
98116
apiEnableMock = true, // enable or disable mock when there are includes and excludes configs

0 commit comments

Comments
 (0)