export type Metadata = {metadata?: ({name?: string | undefined, imageUrl?: string | undefined, description?: string | undefined}) | undefined}; export type Supply = {supply?: ({limit?: number | undefined}) | undefined}; export type PatchApi20220609CollectionsCollectionIdTemplatesTemplateIdArgs = {collectionId: string, templateId: string, body: Metadata | Supply}; export type PatchApi20220609CollectionsCollectionIdTemplatesTemplateIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Edit Template * * PATCH /2022-06-09/collections/{collectionId}/templates/{templateId} */ export const patchApi20220609CollectionsCollectionIdTemplatesTemplateId = async (args: PatchApi20220609CollectionsCollectionIdTemplatesTemplateIdArgs, options?: PatchApi20220609CollectionsCollectionIdTemplatesTemplateIdOptions) => { const {baseUrl = "https://staging.crossmint.com/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/2022-06-09/collections/${encodeURIComponent(String(args.collectionId))}/templates/${encodeURIComponent(String(args.templateId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };