@@ -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