Ruhrpottpatriot / GW2.NET

A user friendly wrapper around the official GW2 API
GNU General Public License v2.0
17 stars 17 forks source link

Support empty parameters #8

Open SamHurne opened 9 years ago

SamHurne commented 9 years ago

[Moved from Codeplex: https://gw2dotnet.codeplex.com/workitem/1342]

The API will soon support empty query parameters. This means that we don't have to check for that case anymore, and just let the API deal with it.

See: https://github.com/arenanet/api-cdi/issues/24

TODO (up for grabs): remove all code that checks for empty parameters

NOTE: the code should still assert that collection types are not null. For collections, the only change is that a collection argument with Count == 0 is now a valid argument.

Ruhrpottpatriot commented 9 years ago

As per https://github.com/arenanet/api-cdi/issues/24 empty parameters now return an error, so we need to watch for that.

sliekens commented 9 years ago

Right now we handle this case by throwing an ArgumentException when a user passes an empty list to the FindAll(...) method, but I think that letting the API handle input validation is better. All HTTP errors are wrapped in a ServiceException, which is what we want.

Ruhrpottpatriot commented 9 years ago

Hm, however that would mean doing an api call for a thing we could validate for ourselves. I'm not agreeing, that we should let the api handle everything. Things that can be done locally should be done locally. Even more from a mobile application point of view.

sliekens commented 9 years ago

With server validation, if they ever decide that &ids=<empty> is a valid argument then we don't need to change anything on our side to get the benefits. They might decide to change it to return the same results as &ids=all