All files / src/lib/api/pro/crm messages.ts

100% Statements 3/3
100% Branches 0/0
100% Functions 2/2
100% Lines 3/3

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      94x   2x           2x            
import { request } from "../../base";
import type { LeadMessagesData, Message } from "./types";
 
export const crmMessagesApi = {
	async getLeadMessages(proId: string, leadId: number) {
		return request<LeadMessagesData>(
			`/api/pro/${proId}/crm/leads/${leadId}/messages`,
		);
	},
 
	async sendLeadMessage(proId: string, leadId: number, body: string) {
		return request<Message>(
			`/api/pro/${proId}/crm/leads/${leadId}/messages`,
			{ method: "POST", body: { body } },
		);
	},
};