How to get all records from AWS Amplify GraphQL API where the field(example busNumber) of a model matches with any item in the given list.
Note:- busNumber is of type String
I am using AWS client side library to perform this in Kotlin in android studio.
My Dependencies are:-
implementation 'com.amplifyframework:core:1.4.0'
implementation 'com.amplifyframework:aws-api:2.14.1'
This is my GraphQL Schema model which I want to retrieve
type DIMTSRealTimeGTFS @model @auth(rules: [{allow: public}]) {
id: ID!
busNumber: String
feed: Feed
}
Currently, What I am doing is with the following code
Amplify.API.query(ModelQuery.list(DIMTSRealTimeGTFS::class.java,
DIMTSRealTimeGTFS.BUS_NUMBER.contains("ABC").or(DIMTSRealTimeGTFS.BUS_NUMBER.contains("XYZ"))),{ reponse->
Log.d(TAG, "queryNotes: response = "+reponse.data)
},{
Log.d(TAG, "queryNotes: Exception = "+it.message)
})
But Here is a problem that I have to explicitly type "ABC" and "XYZ" along with .contains() and .or() functions. This is not dynamic.
I want to achieve-> Where I can send a list (say listOfBusNumbers) as argument and retrieve all records where field busNumber matches with any item in the listOfBusNumbers
Thanks in Advance.