export type ResourceTypeInput = 'organization' | 'user' | 'api_key' | 'namespace' | 'collection' | 'document' | 'bucket' | 'retriever' | 'cluster' | 'taxonomy' | 'storage_connection' | 'alert' | 'annotation' | 'secret' | 'webhook'; export type AuditAction = 'user_created' | 'user_updated' | 'user_deleted' | 'api_key_created' | 'api_key_rotated' | 'api_key_revoked' | 'api_key_scope_updated' | 'api_key_internal_flagged' | 'permission_updated' | 'storage_connection_created' | 'storage_connection_updated' | 'storage_connection_deleted' | 'storage_connection_tested' | 'storage_connection_failed' | 'namespace_created' | 'namespace_updated' | 'namespace_deleted' | 'namespace_accessed' | 'collection_created' | 'collection_updated' | 'collection_deleted' | 'collection_accessed' | 'document_deleted' | 'document_bulk_soft_deleted' | 'bucket_created' | 'bucket_updated' | 'bucket_deleted' | 'bucket_accessed' | 'retriever_created' | 'retriever_updated' | 'retriever_deleted' | 'retriever_accessed' | 'retriever_queried' | 'cluster_created' | 'cluster_updated' | 'cluster_deleted' | 'cluster_executed' | 'cluster_accessed' | 'taxonomy_created' | 'taxonomy_updated' | 'taxonomy_deleted' | 'taxonomy_accessed' | 'alert_created' | 'alert_updated' | 'alert_deleted' | 'alert_accessed' | 'alert_triggered' | 'annotation_created' | 'annotation_updated' | 'annotation_deleted' | 'secret_created' | 'secret_updated' | 'secret_deleted' | 'secret_accessed' | 'webhook_created' | 'webhook_updated' | 'webhook_deleted'; export type GetApiV1OrganizationsAuditLogsExportArgs = {resource_type?: (ResourceTypeInput | null) | undefined, resource_id?: (string | null) | undefined, actor_id?: (string | null) | undefined, action?: (AuditAction | null) | undefined, start?: (string | null) | undefined, end?: (string | null) | undefined, max_events?: number | undefined}; export type GetApiV1OrganizationsAuditLogsExportOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export Audit Logs * * GET /v1/organizations/audit/logs/export */ export const getApiV1OrganizationsAuditLogsExport = async (args: GetApiV1OrganizationsAuditLogsExportArgs, options?: GetApiV1OrganizationsAuditLogsExportOptions) => { const {baseUrl = "https://api.mixpeek.com", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/x-ndjson") if (args.resource_type != null) query.append("resource_type", String(args.resource_type)) if (args.resource_id != null) query.append("resource_id", String(args.resource_id)) if (args.actor_id != null) query.append("actor_id", String(args.actor_id)) if (args.action != null) query.append("action", String(args.action)) if (args.start != null) query.append("start", String(args.start)) if (args.end != null) query.append("end", String(args.end)) if (args.max_events != null) query.append("max_events", String(args.max_events)) if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/organizations/audit/logs/export${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };