export type UpdateApiV4SubmissionsSubmissionIdLabelsLabelIdArgs = {submissionId: string, labelId: string}; export type UpdateApiV4SubmissionsSubmissionIdLabelsLabelIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Apply a label to a submission * * PUT /v4/submissions/{submissionId}/labels/{labelId} */ export const updateApiV4SubmissionsSubmissionIdLabelsLabelId = async (args: UpdateApiV4SubmissionsSubmissionIdLabelsLabelIdArgs, options?: UpdateApiV4SubmissionsSubmissionIdLabelsLabelIdOptions) => { const {baseUrl = "https://submittable-api.submittable.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/v4/submissions/${encodeURIComponent(String(args.submissionId))}/labels/${encodeURIComponent(String(args.labelId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };