export type CreateApiV2VideosCollectionsIdArgs = {id: string, body: {name: string}}; export type CreateApiV2VideosCollectionsIdOptions = {baseUrl?: string | undefined, customerAccessCode?: string | undefined, fetch?: typeof fetch | undefined}; /** * Rename video collections * * POST /v2/videos/collections/{id} */ export const createApiV2VideosCollectionsId = async (args: CreateApiV2VideosCollectionsIdArgs, options?: CreateApiV2VideosCollectionsIdOptions) => { const {baseUrl = "https://api.shutterstock.com", fetch: fetchFn = fetch, customerAccessCode} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (customerAccessCode !== undefined) headers.set('authorization', `Bearer ${customerAccessCode}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/videos/collections/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };