InsionInsion
Go

Errors and raw responses

Handle structured errors and inspect response headers

All methods return (*Response, error). API failures are compatible with errors.As.

response, err := client.ModerateARecord(ctx, request)
if err != nil {
  var apiError *core.APIError
  if errors.As(err, &apiError) { /* inspect the API failure */ }
  return err
}

Use client.WithRawResponse.Method(...) to access Header, StatusCode, and Body in the wrapped HTTP response.