The Message Batches API: many message requests processed together, asynchronously. Like cl4cl.core, every function takes and returns plain data in the API's own shape, and takes the same optional opts.
(def batch (create client {:requests [{:custom_id "a" :params {...}}]})) (retrieve client (:id batch)) ; until :processing_status is "ended" (into [] (results client (:id batch)))
The Message Batches API: many message requests processed together,
asynchronously. Like cl4cl.core, every function takes and returns plain
data in the API's own shape, and takes the same optional opts.
(def batch (create client {:requests [{:custom_id "a" :params {...}}]}))
(retrieve client (:id batch)) ; until :processing_status is "ended"
(into [] (results client (:id batch)))(cancel client id)(cancel client id opts)Ask for a batch to stop: POST /v1/messages/batches/{id}/cancel. Returns the batch, which keeps processing until its status is "ended".
Ask for a batch to stop: POST /v1/messages/batches/{id}/cancel. Returns
the batch, which keeps processing until its status is "ended".(create client body)(create client body opts)Create a batch: POST /v1/messages/batches. body is {:requests [...]}, each request a {:custom_id s :params message-request-body}. Returns the batch.
Create a batch: POST /v1/messages/batches. body is {:requests [...]},
each request a {:custom_id s :params message-request-body}. Returns the
batch.(delete client id)(delete client id opts)Delete an ended batch: DELETE /v1/messages/batches/{id}.
Delete an ended batch: DELETE /v1/messages/batches/{id}.
(list client)(list client query)(list client query opts)A page of batches, newest first: GET /v1/messages/batches. query may hold :limit, :after_id and :before_id. Returns {:data [...] :has_more :first_id :last_id}; pass :last_id as :after_id for the next page.
A page of batches, newest first: GET /v1/messages/batches. query may
hold :limit, :after_id and :before_id. Returns {:data [...] :has_more
:first_id :last_id}; pass :last_id as :after_id for the next page.(results client id)(results client id opts)The results of an ended batch: GET /v1/messages/batches/{id}/results. Returns a reducible of maps {:custom_id s :result {:type ...}}, in no particular order, so match them to requests by :custom_id. A result of type "succeeded" holds the :message. It behaves as cl4cl.core/lines describes.
The results of an ended batch: GET /v1/messages/batches/{id}/results.
Returns a reducible of maps {:custom_id s :result {:type ...}}, in no
particular order, so match them to requests by :custom_id. A result of
type "succeeded" holds the :message. It behaves as cl4cl.core/lines
describes.(retrieve client id)(retrieve client id opts)The batch with this id: GET /v1/messages/batches/{id}.
The batch with this id: GET /v1/messages/batches/{id}.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |