ts / src / support.ts
159 words
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/** Support conversations with the ird team. */
import type { Client } from './client.js';
import * as http from './http.js';
import type { Body, Query } from './types.js';

/** GET /contact/threads — List your support threads (cursor-paginated). */
export const listThreads = (client: Client, query?: Query<'/contact/threads', 'get'>) =>
  http.get(client, '/contact/threads', { query });

/** Every support thread, following cursor pagination. */
export const listAllThreads = (client: Client, query?: Query<'/contact/threads', 'get'>) =>
  http.paginate(client, '/contact/threads', 'threads', { query });

/** POST /contact/threads — Open a support thread. */
export const createThread = (client: Client, body: Body<'/contact/threads', 'post'>) =>
  http.post(client, '/contact/threads', { body });

/** GET /contact/threads/{id} — Read a support thread. */
export const getThread = (client: Client, id: string) =>
  http.get(client, '/contact/threads/{id}', { params: { id } });

/** POST /contact/threads/{id}/messages — Reply on a support thread. */
export const reply = (client: Client, id: string, body: Body<'/contact/threads/{id}/messages', 'post'>) =>
  http.post(client, '/contact/threads/{id}/messages', { params: { id }, body });

static mirror of HEAD · about · clone: git clone https://ird.cod-sursa.ro/ts.git