% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fetch.R
\name{af_fetch_all}
\alias{af_fetch_all}
\title{Fetch all data from an API in chunks}
\usage{
af_fetch_all(
  api,
  name,
  total_limit = Inf,
  chunk_size = 50000L,
  query = list(),
  verbosity = 0L
)
}
\arguments{
\item{api}{An \code{apifetch_api} object (see \code{\link[=af_api]{af_api()}}).}

\item{name}{The token name to authenticate with (looked up via the API's
\code{service}).}

\item{total_limit}{Maximum number of records to retrieve in total. Default
\code{Inf} (all available).}

\item{chunk_size}{Records to request per chunk. Default \code{50000}.}

\item{query}{A named list of additional query-string filters. Default empty.}

\item{verbosity}{\code{0} (silent, default), \code{1} (progress messages), or \code{2}
(progress plus full HTTP request/response details).}
}
\value{
A tibble with all retrieved records.
}
\description{
Iteratively calls \code{\link[=af_fetch]{af_fetch()}} with an advancing \code{offset}, stopping when a
chunk comes back empty or \code{total_limit} is reached, then row-binds the chunks
into one tibble. Columns listed in the API profile's \code{drop_cols} are removed.
}
\examples{
\dontrun{
api <- af_api("https://www.bigdata.pe.gov.br/api/buscar",
              service = "BigDataPE", auth = af_auth_raw(),
              pagination = af_paginate_offset("header"),
              drop_cols = "Mensagem")
af_fetch_all(api, "dengue", total_limit = 500, chunk_size = 100)
}
}
