(ns ird.support
"Support conversations with the ird team."
(:require
[ird.transport :as transport]))
(defn list-threads
"GET /contact/threads — List your support threads.
Optional QUERY keys include :limit, :cursor.
Returns the parsed response map."
([client] (list-threads client nil))
([client query]
(transport/request client :get "/contact/threads" {:query query})))
(defn list-all-threads
"List all support threads under :threads by following cursor pagination.
QUERY may include filters; :cursor is managed automatically."
([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\").
Returns the parsed response map."
[client body]
(transport/request client :post "/contact/threads" {:body body}))
(defn get-thread
"GET /contact/threads/{id} — Read a support thread.
Returns the parsed response map."
[client id]
(transport/request client :get (str "/contact/threads/" id)))
(defn reply
"POST /contact/threads/{id}/messages — Reply on a support thread.
BODY is a plain map with :message.
Returns the parsed response map."
[client id body]
(transport/request client :post (str "/contact/threads/" id "/messages")
{:body body}))