From 1efca59e24d1dbe2134421a9e5e2d3707082fa4b Mon Sep 17 00:00:00 2001 From: Mahdi Javaheri Date: Sun, 19 Mar 2023 15:48:55 +0330 Subject: [PATCH] Release version 2.0.0 --- CHANGELOG.md | 3 +++ README.md | 20 +++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8f5edf..b532d88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index d768f53..936a824 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,24 @@ interface Api { @Query("page") page: Int, @Query("limit") limit: Int ): Call> + + // 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> + + // 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> } ``` @@ -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