(ns ird.support
"Support conversations with the ird team. Every function returns a channel
(see ird.async)."
(:require [ird.transport :as transport]))
(defn list-threads
"GET /contact/threads — List your support threads.
Optional QUERY keys include :limit, :cursor."
([client] (list-threads client nil))
([client query]
(transport/request client :get "/contact/threads" {:query query})))
(defn list-all-threads
"Every support thread under :threads, following cursor pagination. QUERY
may include filters; :cursor is managed automatically. Delivers a vector."
([client] (list-all-threads client nil))
([client query]
(transport/paginate client :get "/contact/threads" :threads query)))
(defn create-thread
"POST /contact/threads — Open a support thread.
BODY is a plain map with :title, :service and :message (all required;
:service is one of the service enum values, e.g. \"domains\")."
[client body]
(transport/request client :post "/contact/threads" {:body body}))
(defn get-thread
"GET /contact/threads/{id} — Read a support thread."
[client id]
(transport/request client :get ["contact" "threads" id]))
(defn reply
"POST /contact/threads/{id}/messages — Reply on a support thread.
BODY is a plain map with :message."
[client id body]
(transport/request client :post ["contact" "threads" id "messages"] {:body body}))