export type Version = {type?: string | undefined, id?: string | undefined, attributes?: ({protocols?: string | undefined, versionNumber?: string | undefined}) | undefined, relationships?: ({implementation?: ({id?: string | undefined, type?: 'implementation' | undefined}) | undefined, provider?: ({id?: string | undefined, type?: 'provider' | undefined}) | undefined}) | undefined}; export type PatchApiImplementationImplementationIdVersionVersionIdArgs = {body: {data?: Version | undefined}}; export type PatchApiImplementationImplementationIdVersionVersionIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Modifies an instance of type version * * PATCH /implementation/{implementationId}/version/{versionId} */ export const patchApiImplementationImplementationIdVersionVersionId = async (args: PatchApiImplementationImplementationIdVersionVersionIdArgs, options: PatchApiImplementationImplementationIdVersionVersionIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/vnd.api+json") const url = `${baseUrl.replace(/\/+$/, '')}/implementation/${encodeURIComponent(String(args.implementationId))}/version/${encodeURIComponent(String(args.versionId))}${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 };