export type SendOtpRequest = {clientData?: string | undefined, credentialID: string}; export type CreateApiCscV1CredentialsSendOTPArgs = {body: SendOtpRequest}; export type CreateApiCscV1CredentialsSendOTPOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Send credential OTP * * POST /csc/v1/credentials/sendOTP * * Also accepts auth: OAuth2_clientCredentials, OAuth2_authorizationCode */ export const createApiCscV1CredentialsSendOTP = async (args: CreateApiCscV1CredentialsSendOTPArgs, options?: CreateApiCscV1CredentialsSendOTPOptions) => { 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") headers.set('accept', "application/json") if (ApiKeyAuth !== undefined) headers.set("X-API-Key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/csc/v1/credentials/sendOTP${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 (await res.json()) as unknown };