wvteijlingen / Spine

A Swift library for working with JSON:API APIs. It supports mapping to custom model classes, fetching, advanced querying, linking and persisting.
MIT License
264 stars 109 forks source link

Query parameters #169

Open Croge32 opened 7 years ago

Croge32 commented 7 years ago

How would I deal with something like an optional (or required) query parameter in a call?

Something like: v1/meal_plans?date=2016-01-01

This is assuming that date may or may not necessarily be an attribute of meal_plan. Perhaps for instance, meal_plan contains a field called meal_date and I want my call to GET meal_plans within a range that looks like this: v1/meal_plans?start_date=2016-01-01&end_date=2016-01-03

I saw you mention the Query object in another answer, but the suggestion you gave was to use an internal version of the Query(url:) initializer.

Any help would be appreciated!