export type SetEndEntityStatusRestRequest = {password?: string | undefined, token?: 'USERGENERATED, P12, BCFKS, JKS, PEM' | undefined, status?: 'NEW, FAILED, INITIALIZED, INPROCESS, GENERATED, REVOKED, HISTORICAL, KEYRECOVERY, WAITINGFORADDAPPROVAL' | undefined}; export type CreateApiV1EndentityEndentityNameSetstatusArgs = {endentity_name: string, body: SetEndEntityStatusRestRequest}; export type CreateApiV1EndentityEndentityNameSetstatusOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Edits end entity setting new status * * POST /v1/endentity/{endentity_name}/setstatus */ export const createApiV1EndentityEndentityNameSetstatus = async (args: CreateApiV1EndentityEndentityNameSetstatusArgs, options: CreateApiV1EndentityEndentityNameSetstatusOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v1/endentity/${encodeURIComponent(String(args.endentity_name))}/setstatus${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 };