export type CreateApiApiV1ClientTicketsArgs = {'Api-Key': string, 'Api-Secret': string, body: {accessToken?: string | undefined}}; export type CreateApiApiV1ClientTicketsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Danh sách yêu cầu hỗ trợ * * POST /api/v1/client-tickets */ export const createApiApiV1ClientTickets = async (args: CreateApiApiV1ClientTicketsArgs, options?: CreateApiApiV1ClientTicketsOptions) => { const {baseUrl = "http://baovothuat.net", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/x-www-form-urlencoded") headers.set('accept', "application/x-www-form-urlencoded;charset=utf-8;") if (args['Api-Key'] != null) headers.set("Api-Key", String(args['Api-Key'])) if (args['Api-Secret'] != null) headers.set("Api-Secret", String(args['Api-Secret'])) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/client-tickets${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: new URLSearchParams(Object.entries(args.body).flatMap(([key, value]) => (value == null ? [] : [[key, String(value)]])))}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };