Waits for Dropbox asynchronous jobs to complete.
Batch endpoints (copy_batch, move_batch, delete_batch,
create_folder_batch, share_folder, ...) may return
%{".tag" => "async_job_id", "async_job_id" => id} instead of a final
result, expecting you to poll the matching check endpoint until the job
leaves the "in_progress" state. await/4 runs that loop with
exponential backoff:
{:ok, launch} = Magpie.Files.MoveBatch.move_batch(client, entries)
{:ok, result} = Magpie.Async.await(client, launch, &Magpie.Files.MoveBatch.check/2)await/4 also accepts the job id directly, and passes through launches
that completed synchronously (%{".tag" => "complete"}), so it can be
piped unconditionally after any batch call.
Summary
Functions
Polls check_fun until the job completes, fails, or :timeout elapses.
Functions
Polls check_fun until the job completes, fails, or :timeout elapses.
launch_or_id— the result map of a batch call (%{".tag" => ...}) or anasync_job_idstringcheck_fun— two-arity function(client, async_job_id)hitting the job's check endpoint, e.g.&Magpie.Files.MoveBatch.check/2opts::interval— initial poll interval in ms (default500):max_interval— backoff cap in ms (default5_000); each poll doubles the interval up to this value:timeout— overall deadline in ms (default60_000)
Returns {:ok, result} when the job reports "complete",
{:error, :timeout} on deadline, or the job's error/failed response
as-is.