import {z} from 'zod' export type CreateApiEventsListArgs = {body: {access_code_id?: string | undefined, access_code_ids?: Array | undefined, access_grant_id?: string | undefined, access_grant_ids?: Array | undefined, access_method_id?: string | undefined, access_method_ids?: Array | undefined, acs_access_group_id?: string | undefined, acs_credential_id?: string | undefined, acs_encoder_id?: string | undefined, acs_entrance_id?: string | undefined, acs_system_id?: string | undefined, acs_system_ids?: Array | undefined, acs_user_id?: string | undefined, between?: (Array) | undefined, connect_webview_id?: string | undefined, connected_account_id?: string | undefined, customer_key?: string | undefined, device_id?: string | undefined, device_ids?: Array | undefined, event_ids?: Array | undefined, event_type?: ('access_code.created' | 'access_code.changed' | 'access_code.name_changed' | 'access_code.code_changed' | 'access_code.time_frame_changed' | 'access_code.mutations_requested' | 'access_code.scheduled_on_device' | 'access_code.set_on_device' | 'access_code.removed_from_device' | 'access_code.delay_in_setting_on_device' | 'access_code.failed_to_set_on_device' | 'access_code.deleted' | 'access_code.delay_in_removing_from_device' | 'access_code.failed_to_remove_from_device' | 'access_code.modified_external_to_seam' | 'access_code.deleted_external_to_seam' | 'access_code.backup_access_code_pulled' | 'access_code.unmanaged.converted_to_managed' | 'access_code.unmanaged.failed_to_convert_to_managed' | 'access_code.unmanaged.created' | 'access_code.unmanaged.removed' | 'access_grant.created' | 'access_grant.deleted' | 'access_grant.access_granted_to_all_doors' | 'access_grant.access_granted_to_door' | 'access_grant.access_to_door_lost' | 'access_grant.access_times_changed' | 'access_grant.could_not_create_requested_access_methods' | 'access_method.issued' | 'access_method.revoked' | 'access_method.card_encoding_required' | 'access_method.deleted' | 'access_method.reissued' | 'access_method.created' | 'access_method.delay_in_issuing' | 'access_method.failed_to_issue' | 'acs_system.connected' | 'acs_system.added' | 'acs_system.disconnected' | 'acs_credential.deleted' | 'acs_credential.issued' | 'acs_credential.reissued' | 'acs_credential.invalidated' | 'acs_user.created' | 'acs_user.deleted' | 'acs_encoder.added' | 'acs_encoder.removed' | 'acs_access_group.deleted' | 'acs_entrance.added' | 'acs_entrance.removed' | 'client_session.deleted' | 'connected_account.connected' | 'connected_account.created' | 'connected_account.successful_login' | 'connected_account.disconnected' | 'connected_account.completed_first_sync' | 'connected_account.deleted' | 'connected_account.completed_first_sync_after_reconnection' | 'connected_account.reauthorization_requested' | 'action_attempt.lock_door.succeeded' | 'action_attempt.lock_door.failed' | 'action_attempt.unlock_door.succeeded' | 'action_attempt.unlock_door.failed' | 'action_attempt.simulate_keypad_code_entry.succeeded' | 'action_attempt.simulate_keypad_code_entry.failed' | 'action_attempt.simulate_manual_lock_via_keypad.succeeded' | 'action_attempt.simulate_manual_lock_via_keypad.failed' | 'connect_webview.login_succeeded' | 'connect_webview.login_failed' | 'device.connected' | 'device.added' | 'device.converted_to_unmanaged' | 'device.unmanaged.converted_to_managed' | 'device.unmanaged.connected' | 'device.disconnected' | 'device.unmanaged.disconnected' | 'device.tampered' | 'device.low_battery' | 'device.battery_status_changed' | 'device.removed' | 'device.deleted' | 'device.third_party_integration_detected' | 'device.third_party_integration_no_longer_detected' | 'device.salto.privacy_mode_activated' | 'device.salto.privacy_mode_deactivated' | 'device.connection_became_flaky' | 'device.connection_stabilized' | 'device.error.subscription_required' | 'device.error.subscription_required.resolved' | 'device.accessory_keypad_connected' | 'device.accessory_keypad_disconnected' | 'noise_sensor.noise_threshold_triggered' | 'lock.locked' | 'lock.unlocked' | 'lock.access_denied' | 'thermostat.climate_preset_activated' | 'thermostat.manually_adjusted' | 'thermostat.temperature_threshold_exceeded' | 'thermostat.temperature_threshold_no_longer_exceeded' | 'thermostat.temperature_reached_set_point' | 'thermostat.temperature_changed' | 'device.name_changed' | 'camera.activated' | 'device.doorbell_rang' | 'enrollment_automation.deleted' | 'phone.deactivated' | 'space.device_membership_changed' | 'space.created' | 'space.deleted') | undefined, event_types?: (Array<'access_code.created' | 'access_code.changed' | 'access_code.name_changed' | 'access_code.code_changed' | 'access_code.time_frame_changed' | 'access_code.mutations_requested' | 'access_code.scheduled_on_device' | 'access_code.set_on_device' | 'access_code.removed_from_device' | 'access_code.delay_in_setting_on_device' | 'access_code.failed_to_set_on_device' | 'access_code.deleted' | 'access_code.delay_in_removing_from_device' | 'access_code.failed_to_remove_from_device' | 'access_code.modified_external_to_seam' | 'access_code.deleted_external_to_seam' | 'access_code.backup_access_code_pulled' | 'access_code.unmanaged.converted_to_managed' | 'access_code.unmanaged.failed_to_convert_to_managed' | 'access_code.unmanaged.created' | 'access_code.unmanaged.removed' | 'access_grant.created' | 'access_grant.deleted' | 'access_grant.access_granted_to_all_doors' | 'access_grant.access_granted_to_door' | 'access_grant.access_to_door_lost' | 'access_grant.access_times_changed' | 'access_grant.could_not_create_requested_access_methods' | 'access_method.issued' | 'access_method.revoked' | 'access_method.card_encoding_required' | 'access_method.deleted' | 'access_method.reissued' | 'access_method.created' | 'access_method.delay_in_issuing' | 'access_method.failed_to_issue' | 'acs_system.connected' | 'acs_system.added' | 'acs_system.disconnected' | 'acs_credential.deleted' | 'acs_credential.issued' | 'acs_credential.reissued' | 'acs_credential.invalidated' | 'acs_user.created' | 'acs_user.deleted' | 'acs_encoder.added' | 'acs_encoder.removed' | 'acs_access_group.deleted' | 'acs_entrance.added' | 'acs_entrance.removed' | 'client_session.deleted' | 'connected_account.connected' | 'connected_account.created' | 'connected_account.successful_login' | 'connected_account.disconnected' | 'connected_account.completed_first_sync' | 'connected_account.deleted' | 'connected_account.completed_first_sync_after_reconnection' | 'connected_account.reauthorization_requested' | 'action_attempt.lock_door.succeeded' | 'action_attempt.lock_door.failed' | 'action_attempt.unlock_door.succeeded' | 'action_attempt.unlock_door.failed' | 'action_attempt.simulate_keypad_code_entry.succeeded' | 'action_attempt.simulate_keypad_code_entry.failed' | 'action_attempt.simulate_manual_lock_via_keypad.succeeded' | 'action_attempt.simulate_manual_lock_via_keypad.failed' | 'connect_webview.login_succeeded' | 'connect_webview.login_failed' | 'device.connected' | 'device.added' | 'device.converted_to_unmanaged' | 'device.unmanaged.converted_to_managed' | 'device.unmanaged.connected' | 'device.disconnected' | 'device.unmanaged.disconnected' | 'device.tampered' | 'device.low_battery' | 'device.battery_status_changed' | 'device.removed' | 'device.deleted' | 'device.third_party_integration_detected' | 'device.third_party_integration_no_longer_detected' | 'device.salto.privacy_mode_activated' | 'device.salto.privacy_mode_deactivated' | 'device.connection_became_flaky' | 'device.connection_stabilized' | 'device.error.subscription_required' | 'device.error.subscription_required.resolved' | 'device.accessory_keypad_connected' | 'device.accessory_keypad_disconnected' | 'noise_sensor.noise_threshold_triggered' | 'lock.locked' | 'lock.unlocked' | 'lock.access_denied' | 'thermostat.climate_preset_activated' | 'thermostat.manually_adjusted' | 'thermostat.temperature_threshold_exceeded' | 'thermostat.temperature_threshold_no_longer_exceeded' | 'thermostat.temperature_reached_set_point' | 'thermostat.temperature_changed' | 'device.name_changed' | 'camera.activated' | 'device.doorbell_rang' | 'enrollment_automation.deleted' | 'phone.deactivated' | 'space.device_membership_changed' | 'space.created' | 'space.deleted'>) | undefined, limit?: number | undefined, since?: string | undefined, space_id?: string | undefined, space_ids?: Array | undefined, unstable_offset?: number | undefined, user_identity_id?: string | undefined}}; export type CreateApiEventsListOptions = {baseUrl?: string | undefined, clientSession?: string | undefined, fetch?: typeof fetch | undefined}; export const event = z.discriminatedUnion("event_type", [z.object({access_code_id: z.string(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_code.created"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_code_id: z.string(), change_reason: z.string().optional(), changed_properties: z.array(z.object({from: z.string().nullable(), property: z.string(), to: z.string().nullable()})).optional(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_code.changed"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_code_id: z.string(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), description: z.string(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_code.name_changed"), from: z.object({name: z.string().nullable()}), occurred_at: z.string(), to: z.object({name: z.string().nullable()}), workspace_id: z.string()}), z.object({access_code_id: z.string(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), description: z.string(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_code.code_changed"), from: z.object({code: z.string().nullable()}), occurred_at: z.string(), to: z.object({code: z.string().nullable()}), workspace_id: z.string()}), z.object({access_code_id: z.string(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), description: z.string(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_code.time_frame_changed"), from: z.object({ends_at: z.string().nullable(), starts_at: z.string().nullable()}), occurred_at: z.string(), to: z.object({ends_at: z.string().nullable(), starts_at: z.string().nullable()}), workspace_id: z.string()}), z.object({access_code_id: z.string(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_code.mutations_requested"), occurred_at: z.string(), requested_mutations: z.array(z.object({from: z.record(z.string(), z.unknown()).optional(), mutation_code: z.enum(["updating_name", "updating_code", "updating_time_frame", "deleting", "creating", "deferring_creation"]), to: z.record(z.string(), z.unknown()).optional()})), workspace_id: z.string()}), z.object({access_code_id: z.string(), code: z.string(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_code.scheduled_on_device"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_code_id: z.string(), code: z.string(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_code.set_on_device"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_code_id: z.string(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_code.removed_from_device"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_code_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), access_code_id: z.string(), access_code_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), connected_account_id: z.string(), connected_account_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), created_at: z.string(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), device_id: z.string(), device_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_code.delay_in_setting_on_device"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_code_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), access_code_id: z.string(), access_code_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), connected_account_id: z.string(), connected_account_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), created_at: z.string(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), device_id: z.string(), device_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_code.failed_to_set_on_device"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_code_id: z.string(), code: z.string().nullable(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_code.deleted"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_code_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), access_code_id: z.string(), access_code_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), connected_account_id: z.string(), connected_account_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), created_at: z.string(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), device_id: z.string(), device_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_code.delay_in_removing_from_device"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_code_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), access_code_id: z.string(), access_code_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), connected_account_id: z.string(), connected_account_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), created_at: z.string(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), device_id: z.string(), device_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_code.failed_to_remove_from_device"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_code_id: z.string(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_code.modified_external_to_seam"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_code_id: z.string(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_code.deleted_external_to_seam"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_code_id: z.string(), backup_access_code_id: z.string(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_code.backup_access_code_pulled"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_code_id: z.string(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_code.unmanaged.converted_to_managed"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_code_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), access_code_id: z.string(), access_code_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), connected_account_id: z.string(), connected_account_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), created_at: z.string(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), device_id: z.string(), device_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_code.unmanaged.failed_to_convert_to_managed"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_code_id: z.string(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_code.unmanaged.created"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_code_id: z.string(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_code.unmanaged.removed"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_grant_id: z.string(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_grant.created"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_grant_id: z.string(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_grant.deleted"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_grant_id: z.string(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_grant.access_granted_to_all_doors"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_grant_id: z.string(), acs_entrance_id: z.string(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_grant.access_granted_to_door"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_grant_id: z.string(), acs_entrance_id: z.string(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_grant.access_to_door_lost"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_grant_id: z.string(), access_grant_key: z.string().optional(), created_at: z.string(), ends_at: z.string().optional(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_grant.access_times_changed"), occurred_at: z.string(), starts_at: z.string().optional(), workspace_id: z.string()}), z.object({access_grant_id: z.string(), created_at: z.string(), error_message: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_grant.could_not_create_requested_access_methods"), missing_device_ids: z.array(z.string()).optional(), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_grant_ids: z.array(z.string()), access_grant_keys: z.array(z.string()).optional(), access_method_id: z.string(), code: z.string().optional(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_method.issued"), is_backup_code: z.boolean().optional(), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_grant_ids: z.array(z.string()), access_grant_keys: z.array(z.string()).optional(), access_method_id: z.string(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_method.revoked"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_grant_ids: z.array(z.string()), access_grant_keys: z.array(z.string()).optional(), access_method_id: z.string(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_method.card_encoding_required"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_grant_ids: z.array(z.string()), access_grant_keys: z.array(z.string()).optional(), access_method_id: z.string(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_method.deleted"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_grant_ids: z.array(z.string()), access_grant_keys: z.array(z.string()).optional(), access_method_id: z.string(), code: z.string().optional(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_method.reissued"), is_backup_code: z.boolean().optional(), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_grant_ids: z.array(z.string()), access_grant_keys: z.array(z.string()).optional(), access_method_id: z.string(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_method.created"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_grant_ids: z.array(z.string()), access_grant_keys: z.array(z.string()).optional(), access_method_id: z.string(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_method.delay_in_issuing"), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_grant_ids: z.array(z.string()), access_grant_keys: z.array(z.string()).optional(), access_method_id: z.string(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("access_method.failed_to_issue"), occurred_at: z.string(), workspace_id: z.string()}), z.object({acs_system_id: z.string(), connected_account_id: z.string().optional(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("acs_system.connected"), occurred_at: z.string(), workspace_id: z.string()}), z.object({acs_system_id: z.string(), connected_account_id: z.string().optional(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("acs_system.added"), occurred_at: z.string(), workspace_id: z.string()}), z.object({acs_system_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), acs_system_id: z.string(), acs_system_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), connected_account_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), connected_account_id: z.string().optional(), connected_account_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("acs_system.disconnected"), occurred_at: z.string(), workspace_id: z.string()}), z.object({acs_credential_id: z.string(), acs_system_id: z.string(), connected_account_id: z.string().optional(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("acs_credential.deleted"), occurred_at: z.string(), workspace_id: z.string()}), z.object({acs_credential_id: z.string(), acs_system_id: z.string(), connected_account_id: z.string().optional(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("acs_credential.issued"), occurred_at: z.string(), workspace_id: z.string()}), z.object({acs_credential_id: z.string(), acs_system_id: z.string(), connected_account_id: z.string().optional(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("acs_credential.reissued"), occurred_at: z.string(), workspace_id: z.string()}), z.object({acs_credential_id: z.string(), acs_system_id: z.string(), connected_account_id: z.string().optional(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("acs_credential.invalidated"), occurred_at: z.string(), workspace_id: z.string()}), z.object({acs_system_id: z.string(), acs_user_id: z.string(), connected_account_id: z.string().optional(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("acs_user.created"), occurred_at: z.string(), workspace_id: z.string()}), z.object({acs_system_id: z.string(), acs_user_id: z.string(), connected_account_id: z.string().optional(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("acs_user.deleted"), occurred_at: z.string(), workspace_id: z.string()}), z.object({acs_encoder_id: z.string(), acs_system_id: z.string(), connected_account_id: z.string().optional(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("acs_encoder.added"), occurred_at: z.string(), workspace_id: z.string()}), z.object({acs_encoder_id: z.string(), acs_system_id: z.string(), connected_account_id: z.string().optional(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("acs_encoder.removed"), occurred_at: z.string(), workspace_id: z.string()}), z.object({acs_access_group_id: z.string(), acs_system_id: z.string(), connected_account_id: z.string().optional(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("acs_access_group.deleted"), occurred_at: z.string(), workspace_id: z.string()}), z.object({acs_entrance_id: z.string(), acs_system_id: z.string(), connected_account_id: z.string().optional(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("acs_entrance.added"), occurred_at: z.string(), workspace_id: z.string()}), z.object({acs_entrance_id: z.string(), acs_system_id: z.string(), connected_account_id: z.string().optional(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("acs_entrance.removed"), occurred_at: z.string(), workspace_id: z.string()}), z.object({client_session_id: z.string(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("client_session.deleted"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connect_webview_id: z.string().optional(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("connected_account.connected"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connect_webview_id: z.string(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("connected_account.created"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connect_webview_id: z.string(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("connected_account.successful_login"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), connected_account_id: z.string(), connected_account_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("connected_account.disconnected"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("connected_account.completed_first_sync"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), connected_account_type: z.string().optional(), created_at: z.string(), customer_key: z.string().optional(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("connected_account.deleted"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("connected_account.completed_first_sync_after_reconnection"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), connected_account_id: z.string(), connected_account_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("connected_account.reauthorization_requested"), occurred_at: z.string(), workspace_id: z.string()}), z.object({action_attempt_id: z.string(), action_type: z.string(), connected_account_id: z.string().optional(), created_at: z.string(), device_id: z.string().optional(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("action_attempt.lock_door.succeeded"), occurred_at: z.string(), status: z.string(), workspace_id: z.string()}), z.object({action_attempt_id: z.string(), action_type: z.string(), connected_account_id: z.string().optional(), created_at: z.string(), device_id: z.string().optional(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("action_attempt.lock_door.failed"), occurred_at: z.string(), status: z.string(), workspace_id: z.string()}), z.object({action_attempt_id: z.string(), action_type: z.string(), connected_account_id: z.string().optional(), created_at: z.string(), device_id: z.string().optional(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("action_attempt.unlock_door.succeeded"), occurred_at: z.string(), status: z.string(), workspace_id: z.string()}), z.object({action_attempt_id: z.string(), action_type: z.string(), connected_account_id: z.string().optional(), created_at: z.string(), device_id: z.string().optional(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("action_attempt.unlock_door.failed"), occurred_at: z.string(), status: z.string(), workspace_id: z.string()}), z.object({action_attempt_id: z.string(), action_type: z.string(), connected_account_id: z.string().optional(), created_at: z.string(), device_id: z.string().optional(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("action_attempt.simulate_keypad_code_entry.succeeded"), occurred_at: z.string(), status: z.string(), workspace_id: z.string()}), z.object({action_attempt_id: z.string(), action_type: z.string(), connected_account_id: z.string().optional(), created_at: z.string(), device_id: z.string().optional(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("action_attempt.simulate_keypad_code_entry.failed"), occurred_at: z.string(), status: z.string(), workspace_id: z.string()}), z.object({action_attempt_id: z.string(), action_type: z.string(), connected_account_id: z.string().optional(), created_at: z.string(), device_id: z.string().optional(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("action_attempt.simulate_manual_lock_via_keypad.succeeded"), occurred_at: z.string(), status: z.string(), workspace_id: z.string()}), z.object({action_attempt_id: z.string(), action_type: z.string(), connected_account_id: z.string().optional(), created_at: z.string(), device_id: z.string().optional(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("action_attempt.simulate_manual_lock_via_keypad.failed"), occurred_at: z.string(), status: z.string(), workspace_id: z.string()}), z.object({connect_webview_id: z.string(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("connect_webview.login_succeeded"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connect_webview_id: z.string(), created_at: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("connect_webview.login_failed"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.connected"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.added"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.converted_to_unmanaged"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.unmanaged.converted_to_managed"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.unmanaged.connected"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), connected_account_id: z.string(), connected_account_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), device_id: z.string(), device_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), error_code: z.enum(["account_disconnected", "hub_disconnected", "device_disconnected"]), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.disconnected"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), connected_account_id: z.string(), connected_account_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), device_id: z.string(), device_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), error_code: z.enum(["account_disconnected", "hub_disconnected", "device_disconnected"]), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.unmanaged.disconnected"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.tampered"), occurred_at: z.string(), workspace_id: z.string()}), z.object({battery_level: z.number().gte(0).lte(1), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.low_battery"), occurred_at: z.string(), workspace_id: z.string()}), z.object({battery_level: z.number().gte(0).lte(1), battery_status: z.enum(["critical", "low", "good", "full"]), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.battery_status_changed"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.removed"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), device_name: z.string().nullable().optional(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.deleted"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.third_party_integration_detected"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.third_party_integration_no_longer_detected"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.salto.privacy_mode_activated"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.salto.privacy_mode_deactivated"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), connected_account_id: z.string(), connected_account_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), device_id: z.string(), device_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.connection_became_flaky"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.connection_stabilized"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), connected_account_id: z.string(), connected_account_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), device_id: z.string(), device_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.error.subscription_required"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.error.subscription_required.resolved"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.accessory_keypad_connected"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), connected_account_id: z.string(), connected_account_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_errors: z.array(z.object({created_at: z.string(), error_code: z.string(), message: z.string()})), device_id: z.string(), device_warnings: z.array(z.object({created_at: z.string(), message: z.string(), warning_code: z.string()})), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.accessory_keypad_disconnected"), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("noise_sensor.noise_threshold_triggered"), minut_metadata: z.record(z.string(), z.unknown()).optional(), noise_level_decibels: z.number().optional(), noise_level_nrs: z.number().optional(), noise_threshold_id: z.string().optional(), noise_threshold_name: z.string().optional(), noiseaware_metadata: z.record(z.string(), z.unknown()).optional(), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_code_id: z.string().optional(), access_code_is_managed: z.boolean().optional(), action_attempt_id: z.string().optional(), code: z.string().optional(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("lock.locked"), is_via_bluetooth: z.boolean().optional(), is_via_nfc: z.boolean().optional(), method: z.enum(["keycode", "manual", "automatic", "unknown", "remote"]), occurred_at: z.string(), workspace_id: z.string()}), z.object({access_code_id: z.string().optional(), access_code_is_managed: z.boolean().optional(), acs_entrance_id: z.string().optional(), acs_system_id: z.string().optional(), acs_user_id: z.string().optional(), action_attempt_id: z.string().optional(), code: z.string().optional(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string().optional(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("lock.unlocked"), is_via_bluetooth: z.boolean().optional(), is_via_nfc: z.boolean().optional(), method: z.enum(["keycode", "manual", "automatic", "unknown", "remote"]), occurred_at: z.string(), user_identity_id: z.string().optional(), workspace_id: z.string()}), z.object({access_code_id: z.string().optional(), acs_entrance_id: z.string().optional(), acs_system_id: z.string().optional(), acs_user_id: z.string().optional(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string().optional(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("lock.access_denied"), occurred_at: z.string(), reason: z.object({message: z.string(), reason_code: z.enum(["unknown_code", "expired_code", "blocklisted_code", "too_many_attempts", "blocked_by_privacy_mode", "credential_error"])}).optional(), user_identity_id: z.string().optional(), workspace_id: z.string()}), z.object({climate_preset_key: z.string(), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("thermostat.climate_preset_activated"), is_fallback_climate_preset: z.boolean(), occurred_at: z.string(), thermostat_schedule_id: z.string().nullable(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), cooling_set_point_celsius: z.number().optional(), cooling_set_point_fahrenheit: z.number().optional(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("thermostat.manually_adjusted"), fan_mode_setting: z.enum(["auto", "on", "circulate"]).optional(), heating_set_point_celsius: z.number().optional(), heating_set_point_fahrenheit: z.number().optional(), hvac_mode_setting: z.enum(["off", "heat", "cool", "heat_cool", "eco"]).optional(), method: z.enum(["seam", "external"]), occurred_at: z.string(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("thermostat.temperature_threshold_exceeded"), lower_limit_celsius: z.number().nullable(), lower_limit_fahrenheit: z.number().nullable(), occurred_at: z.string(), temperature_celsius: z.number(), temperature_fahrenheit: z.number(), upper_limit_celsius: z.number().nullable(), upper_limit_fahrenheit: z.number().nullable(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("thermostat.temperature_threshold_no_longer_exceeded"), lower_limit_celsius: z.number().nullable(), lower_limit_fahrenheit: z.number().nullable(), occurred_at: z.string(), temperature_celsius: z.number(), temperature_fahrenheit: z.number(), upper_limit_celsius: z.number().nullable(), upper_limit_fahrenheit: z.number().nullable(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), desired_temperature_celsius: z.number().optional(), desired_temperature_fahrenheit: z.number().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("thermostat.temperature_reached_set_point"), occurred_at: z.string(), temperature_celsius: z.number(), temperature_fahrenheit: z.number(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("thermostat.temperature_changed"), occurred_at: z.string(), temperature_celsius: z.number(), temperature_fahrenheit: z.number(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), device_name: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.name_changed"), occurred_at: z.string(), workspace_id: z.string()}), z.object({activation_reason: z.literal("motion_detected"), connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("camera.activated"), image_url: z.string().optional(), motion_sub_type: z.enum(["human", "vehicle", "package", "other"]).optional(), occurred_at: z.string(), video_url: z.string().optional(), workspace_id: z.string()}), z.object({connected_account_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), connected_account_id: z.string(), created_at: z.string(), customer_key: z.string().optional(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("device.doorbell_rang"), image_url: z.string().optional(), occurred_at: z.string(), video_url: z.string().optional(), workspace_id: z.string()}), z.object({created_at: z.string(), enrollment_automation_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("enrollment_automation.deleted"), occurred_at: z.string(), workspace_id: z.string()}), z.object({created_at: z.string(), device_custom_metadata: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(), device_id: z.string(), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("phone.deactivated"), occurred_at: z.string(), workspace_id: z.string()}), z.object({acs_entrance_ids: z.array(z.string()), created_at: z.string(), device_ids: z.array(z.string()), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("space.device_membership_changed"), occurred_at: z.string(), space_id: z.string(), space_key: z.string().optional(), workspace_id: z.string()}), z.object({acs_entrance_ids: z.array(z.string()), created_at: z.string(), device_ids: z.array(z.string()), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("space.created"), occurred_at: z.string(), space_id: z.string(), space_key: z.string().optional(), workspace_id: z.string()}), z.object({acs_entrance_ids: z.array(z.string()), created_at: z.string(), device_ids: z.array(z.string()), event_description: z.string().optional(), event_id: z.string(), event_type: z.literal("space.deleted"), occurred_at: z.string(), space_id: z.string(), space_key: z.string().optional(), workspace_id: z.string()})]); export const createApiEventsListResponse = z.object({events: z.array(event)}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * List Events * * POST /events/list * * Also accepts auth: api_key, pat_with_workspace, console_session_with_workspace, client_session_with_customer */ export const createApiEventsList = async (args: CreateApiEventsListArgs, options?: CreateApiEventsListOptions) => { const {baseUrl = "https://connect.getseam.com", fetch: fetchFn = fetch, clientSession} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (clientSession !== undefined) headers.set('authorization', `Bearer ${clientSession}`) const url = `${baseUrl.replace(/\/+$/, '')}/events/list${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 validateResponse(createApiEventsListResponse, await res.json()) };