delight-im / Android-DDP

[UNMAINTAINED] Meteor's Distributed Data Protocol (DDP) for clients on Android
Apache License 2.0
274 stars 54 forks source link

How to call methods with array of objects with keys #141

Closed jahirfiquitiva closed 7 years ago

jahirfiquitiva commented 7 years ago

On the Meteor side, there's some code similar to this:

const data = [{
            item: 1,
            email: "something",
            name: "John Doe"
          }];

connector.ddpclient.call('method', data, (err, success) => {
    // Code
}

The method will check the items in the array just like: data.item, data.email, data.name ....

How can I call that method with the named items?

The current call method only accepts a simple array of objects, so I cannot use a HashMap or something :/

Thanks in advance

ocram commented 7 years ago

In JavaScript you don’t have that HashMap / map / dictionary / object only, either. You first have an array and then, inside that, your map. Why not do the same on Android? The data types are documented in the README.