export type Account = {id: string, name?: string | undefined}; export type UpdateCredentialRequest = {account?: Account | undefined, label?: string | undefined}; export type UpdateApiApiV1CredentialCredentialIdArgs = {credentialId: string, user_id: string, body: UpdateCredentialRequest}; export type UpdateApiApiV1CredentialCredentialIdOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update credential * * PUT /api/v1/credential/{credentialId} */ export const updateApiApiV1CredentialCredentialId = async (args: UpdateApiApiV1CredentialCredentialIdArgs, options?: UpdateApiApiV1CredentialCredentialIdOptions) => { const {baseUrl = "https://one.digicert.com/documentmanager", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.user_id != null) query.append("user_id", String(args.user_id)) if (ApiKeyAuth !== undefined) headers.set("X-API-Key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/credential/${encodeURIComponent(String(args.credentialId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };