export type CscRevokeTokenRequest = {token: string, token_type_hint?: string | undefined, client_data?: string | undefined}; export type CreateApiCscV1AuthRevokeArgs = {body: CscRevokeTokenRequest}; export type CreateApiCscV1AuthRevokeOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Revokes the access token * * POST /csc/v1/auth/revoke * * Also accepts auth: OAuth2_clientCredentials, OAuth2_authorizationCode */ export const createApiCscV1AuthRevoke = async (args: CreateApiCscV1AuthRevokeArgs, options?: CreateApiCscV1AuthRevokeOptions) => { 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 (ApiKeyAuth !== undefined) headers.set("X-API-Key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/csc/v1/auth/revoke${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 };