export type CreateApiProjectsProjectIdFigmaAttachmentsFigmaAttachmentIdKeysArgs = {'X-PhraseApp-OTP'?: string | undefined, project_id: string, figma_attachment_id: string, id: string, branch?: string | undefined}; export type CreateApiProjectsProjectIdFigmaAttachmentsFigmaAttachmentIdKeysOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Attach the Figma attachment to a key * * POST /projects/{project_id}/figma_attachments/{figma_attachment_id}/keys */ export const createApiProjectsProjectIdFigmaAttachmentsFigmaAttachmentIdKeys = async (args: CreateApiProjectsProjectIdFigmaAttachmentsFigmaAttachmentIdKeysArgs, options?: CreateApiProjectsProjectIdFigmaAttachmentsFigmaAttachmentIdKeysOptions) => { const {baseUrl = "https://eu.phrase.com/control-hub", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['X-PhraseApp-OTP'] != null) headers.set("X-PhraseApp-OTP", String(args['X-PhraseApp-OTP'])) if (args.branch != null) query.append("branch", String(args.branch)) const url = `${baseUrl.replace(/\/+$/, '')}/projects/${encodeURIComponent(String(args.project_id))}/figma_attachments/${encodeURIComponent(String(args.figma_attachment_id))}/keys${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };