1
SDK API design question: why "client.request" requires a **function** as unique argument ?
Source: directus/directus#23147 · opened by @pomeh
Summary I don't understand why the client.request requires a function as argument, as this complexifies some code when you want to customize the request for example. Basic Example Using the JS SDK and according to the documentation, I need to use this syntax to get items from a collection: For some reasons, I need to edit the request before sending it, so I need to extend the result from readItems before passing it to client.request func. Basically, I would have done is this way: It turns out, the code above does not work, and it seems it's because of a simple reason: request func accepts a function as argument, and not an object. Out of curiosity, I look out the [request source code]( to understand why it was designed this way: But as we can see, we only call the getOptions function as is, without any added argument or anything else, so I guess having an object in the first place would have ended with the same result. Motivation By accept…
No pledges yet. Be the first to back this.
Comments
Similar requests
Support custom CSS classes for backend form interface and add unique identifier for interfaces
3 votes · 0 comments
Multi-Column Unique Constraint in Directus App
61 votes · 0 comments
Emit Events control via the public API (and directus/sdk)
1 vote · 0 comments
Add System Services to Sandbox SDK
1 vote · 0 comments
Enable PATCH Endpoint to Accept Arrays for Bulk Updates (Update Many Items with Unique Values Using Unique Key, Composite Key, or Query)
7 votes · 0 comments
No comments yet.