export type ViewerAccessLevel = 'FULL_ACCESS' | 'PARTIAL_ACCESS'; export type ApproveTrustCenterAccessRequestInput = {expirationDate?: string | undefined, isNdaRequired?: boolean | undefined, resourceIds?: Array | undefined, accessLevel?: ViewerAccessLevel | undefined}; export type CreateApiTrustCentersSlugIdAccessRequestsAccessRequestIdApproveArgs = {slugId: string, accessRequestId: string, body: ApproveTrustCenterAccessRequestInput}; export type CreateApiTrustCentersSlugIdAccessRequestsAccessRequestIdApproveOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Approve Trust Center access request * * POST /trust-centers/{slugId}/access-requests/{accessRequestId}/approve */ export const createApiTrustCentersSlugIdAccessRequestsAccessRequestIdApprove = async (args: CreateApiTrustCentersSlugIdAccessRequestsAccessRequestIdApproveArgs, options?: CreateApiTrustCentersSlugIdAccessRequestsAccessRequestIdApproveOptions) => { const {baseUrl = "https://api.vanta.com", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/trust-centers/${encodeURIComponent(String(args.slugId))}/access-requests/${encodeURIComponent(String(args.accessRequestId))}/approve${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 };