Add separate trait for creating a single item
wjoel opened this issue · comments
Some, or maybe only Files, of our resource only support creating a single item per request. Currently we handle this with a runtime check on the length of the items passed to create
, but it would be better if we handled this in a separate createOne
method: it would remove the need for the runtime check, and it would allow the method to return the single response without wrapping it in a sequence/array.
Add a CreateOne
trait for this method, which can easily be implemented in terms of create
for resource types that support it (wrapping and unwrapping the single item in a sequence and using create
), and have Files implement that trait directly (but not the Create
trait).