export type SynchronizeCollectionKeyframesSchema = {asset_ids?: (Array | null) | undefined}; export type CreateApiV1CollectionsCollectionIdKeyframesArgs = {'App-ID': string, 'Auth-Token': string, collection_id: string, body: SynchronizeCollectionKeyframesSchema}; export type CreateApiV1CollectionsCollectionIdKeyframesOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Pick up to three asset_ids for collection keyframes * * POST /v1/collections/{collection_id}/keyframes/ */ export const createApiV1CollectionsCollectionIdKeyframes = async (args: CreateApiV1CollectionsCollectionIdKeyframesArgs, options: CreateApiV1CollectionsCollectionIdKeyframesOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['App-ID'] != null) headers.set("App-ID", String(args['App-ID'])) if (args['Auth-Token'] != null) headers.set("Auth-Token", String(args['Auth-Token'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1/collections/${encodeURIComponent(String(args.collection_id))}/keyframes/${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 };