genderapi_failed: Failed items of a batch

View source: R/response.R

genderapi_failedR Documentation

Failed items of a batch

Description

Returns the items that carry an error instead of data. Works on a genderapi_batch (partial success) and on the genderapi_http_error raised when every executed item failed. Retry failed items only after billing is confirmed, and never resubmit successful items: they would be charged again.

Usage

genderapi_failed(x)

Arguments

x

A genderapi_batch or a genderapi_http_error from genderapi_batch().

Value

A list of items, each with index, optional id, charged_credits and error (a problem with code, status, detail and action). An empty list when nothing failed.

Examples

res <- structure(
  list(data = list(
    list(index = 0L, id = "a", charged_credits = 1L,
         data = list(gender = "male", result_status = "identified")),
    list(index = 1L, id = "b", charged_credits = 0L,
         error = list(code = "ai_upstream_error", status = 502L))
  ), meta = list()),
  class = c("genderapi_batch", "genderapi_response")
)
genderapi_failed(res)

genderapi documentation built on Oct. 1, 2026, 5:13 p.m.