Hello Lucas,
Changing the shape of your returned values depending on the parameters
is, in my opinion, not a good idea.
I see two options in your case :
1. Use a complex type to wrap the result and meta data, and use it
whatever the parameters are :
class ItemListResult(Base):
result = Item
next = text
previous = text
total = int
Note that it you do not affect a value to the metadata fields, they will
not be returned at all and the returned value will look like :
{
"result": [
{"uuid": ""},
...
]
}
2. Skip the metadata information altogether.
It will not prevent the client to use limit/offset, but the total count
will not be available.
Option 1 gives you more control, which is better if you have a lot of
item. Moverover it allows you to limit by default the returned number of
items even if no pagination parameters are given, which is almost
mandatory if you have huge number of items.
Christophe
Le 24/07/2013 20:06, Lucas Alvares Gomes a �crit :