All files / app/service threads.ts

24% Statements 6/25
0% Branches 0/2
0% Functions 0/4
24% Lines 6/25

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41          107x   107x   106x                   106x               106x               106x          
import {
  DeleteReplyReq,
  GetThreadReq,
  PostReplyReq,
  UpdateReplyReq,
} from "proto/threads_pb";
 
import client from "./client";
 
export async function getThread(threadId: number, pageToken?: string) {
  const req = new GetThreadReq();
  req.setThreadId(threadId);
  if (pageToken) {
    req.setPageToken(pageToken);
  }
  const response = await client.threads.getThread(req);
  return response.toObject();
}
 
export async function postReply(threadId: number, content: string) {
  const req = new PostReplyReq();
  req.setThreadId(threadId);
  req.setContent(content);
  const response = await client.threads.postReply(req);
  return response.toObject();
}
 
export async function updateReply(threadId: number, content: string) {
  const req = new UpdateReplyReq();
  req.setThreadId(threadId);
  req.setContent(content);
  const response = await client.threads.updateReply(req);
  return response.toObject();
}
 
export async function deleteReply(threadId: number) {
  const req = new DeleteReplyReq();
  req.setThreadId(threadId);
  await client.threads.deleteReply(req);
}