Skip to content

Commit

Permalink
Release version 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
javaherisaber committed Mar 19, 2023
1 parent 58625cc commit 1efca59
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 2.0.0
- Support for include and exclude json path based on query params (Thanks to @[Husseinhj](https://github.com/Husseinhj))

# 1.1.0
- Escape closing curly brace in regex to support in android
- Add support to retrofit HTTP annotation
Expand Down
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,24 @@ interface Api {
@Query("page") page: Int,
@Query("limit") limit: Int
): Call<List<Picsum>>

// if you want to filter through query params
@Mock("picsum_recent.json", excludeQueries = ["type=favorites"])
@GET("list")
fun getRecentPicsums(
@Query("type") type: String,
@Query("page") page: Int,
@Query("limit") limit: Int
): Call<List<Picsum>>

// if you want to filter through query params
@Mock("picsum_favorites.json", includeQueries = ["type=favorites"])
@GET("list")
fun getFavoritePicsums(
@Query("type") type: String,
@Query("page") page: Int,
@Query("limit") limit: Int
): Call<List<Picsum>>
}
```

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

0 comments on commit 1efca59

Please sign in to comment.