DownloadFileToDiskEventSchema

@Serializable
@SerialName(value = "DownloadFileToDisk")
data class DownloadFileToDiskEventSchema(val id: String, val trigger: EventTrigger, val events: SerializableImmutableList<EventSchema>?, val url: String, val method: HttpMethod, val body: AnySerializable?, val headers: Map<String, String>?, val targetFileName: String, val timeouts: TimeoutsSchema? = null) : EventSchema

Downloads url into the client's own file storage under targetFileName, where GetFile and DeleteFiles can reach it afterwards. method, headers and body shape the request; timeouts overrides the client's timeouts for this transfer. On the web only requestTimeoutMillis applies, and without it the transfer has no timeout.

incomingData consumed: not used.

Triggers fired:

  • OnStartEventTrigger — before the download begins.

  • OnDownloadProgressEventTrigger — repeatedly while downloading, with the progress passed as incomingData.

  • OnDownloadFinishEventTrigger then OnSuccessEventTrigger — when the download completed, both carrying targetFileName as incomingData.

  • OnDownloadFailureEventTrigger then OnFailureEventTrigger — when the download failed, both carrying the Throwable; the error is logged.

  • OnInsufficientDiskSpaceEventTrigger — when the download failed because the device ran out of storage; it fires instead of OnDownloadFailureEventTrigger and OnFailureEventTrigger, carrying the Throwable (an InsufficientDiskSpaceException) as incomingData, and the error is logged. The partially written file is deleted first. The out-of-space detection matches the platform error message, so an unrecognized message falls back to the regular failure triggers.

Constructors

Link copied to clipboard
constructor(id: String, trigger: EventTrigger, events: SerializableImmutableList<EventSchema>?, url: String, method: HttpMethod, body: AnySerializable?, headers: Map<String, String>?, targetFileName: String, timeouts: TimeoutsSchema? = null)

Properties

Link copied to clipboard
@SerialName(value = "body")
val body: AnySerializable?
Link copied to clipboard
@SerialName(value = "events")
open override val events: SerializableImmutableList<EventSchema>?

This event's own children — each declaring, via its own trigger, which of this event's outgoing triggers runs it. null when this event declares no children.

Link copied to clipboard
@SerialName(value = "headers")
val headers: Map<String, String>?
Link copied to clipboard
@SerialName(value = "id")
open override val id: String

Unique identifier — how TriggerEvent/UpdateEvents address this event by id. Defaults to a random id when omitted from the DSL.

Link copied to clipboard
@SerialName(value = "method")
val method: HttpMethod
Link copied to clipboard
@SerialName(value = "targetFileName")
val targetFileName: String
Link copied to clipboard
@SerialName(value = "timeouts")
val timeouts: TimeoutsSchema?
Link copied to clipboard
@SerialName(value = "trigger")
open override val trigger: EventTrigger

The condition that must occur for this event to run — matched by structural equality (data class/data object equality) against whatever trigger value fired, never by any kind of subscription or listener registry.

Link copied to clipboard
@SerialName(value = "url")
val url: String