Siesta iOS GET request with MULTIPLE url parameters

450 Views Asked by At

I'm trying to use Siesta for sending POST request with multiple url parameters.

The problem is even though the solution is presented here, it only shows example for a single parameter. So my question is, is there any other ways to add multiple parameters or should I just use the withParam() multiple times?

E.g. .withParam("myparam", "1").withParam("myparam2", "1").withParam("myparam3", "1")...

I'm asking because using withParam() multiple times kinda look messy although it works =)

1

There are 1 best solutions below

1
On BEST ANSWER

You’ve answered your own question: withParam is chainable, and that is the correct way to add multiple params.

It’s quite possible to format it in a tidy way, as in this snippet from the example project:

var activeRepositories: Resource {
    return service
        .resource("/search/repositories")
        .withParam("q", "stars:>0")
        .withParam("sort", "updated")
        .withParam("order", "desc")
}

I would welcome a feature request for a flavor that takes a dictionary if you or others think that would be useful.