Expand description
§Tango — Rust SDK for the Tango federal-contracting API
The Tango API gives programmatic access to federal-contracting data — contracts, IDVs, entities, opportunities, grants, vehicles, protests, and more — with dynamic response shaping so callers fetch only the fields they need.
This crate is the official, async-first Rust SDK. It mirrors the surface of the Node, Python, and Go SDKs while leaning into Rust idioms (async streams, typed errors, compile-time-checked builders).
§Quick start
use tango::Client;
let client = Client::builder().api_key("your-api-key").build()?;
let page = client
.list_contracts(
tango::ListContractsOptions::builder()
.awarding_agency("9700")
.shape(tango::SHAPE_CONTRACTS_MINIMAL)
.limit(25u32)
.build(),
)
.await?;
for record in page.results {
println!("{:?}", record.get("piid"));
}Or walk every page with the async stream API:
use futures::TryStreamExt;
let mut stream = client.iterate_contracts(
tango::ListContractsOptions::builder()
.awarding_agency("9700")
.build(),
);
while let Some(record) = stream.try_next().await? {
// process one contract at a time
let _ = record;
}§Authentication
Pass an API key via Client::builder().api_key(...), or set
TANGO_API_KEY in the environment and call Client::from_env.
§Error handling
Every fallible call returns Result<T, Error>. Match on the variant to
dispatch on the failure mode:
match client.get_agency("9700", None).await {
Ok(agency) => println!("{}", agency.name.unwrap_or_default()),
Err(Error::NotFound { .. }) => println!("not found"),
Err(Error::RateLimit { retry_after, .. }) => println!("retry in {retry_after}s"),
Err(e) => return Err(e),
}§Response shaping
List endpoints accept a shape parameter that picks which fields the API
returns. The SDK exposes ready-made presets — e.g.
SHAPE_CONTRACTS_MINIMAL — and you can also pass a custom field list.
See the shapes module.
§Webhook signing
Webhook delivery verification is in the separate makegov-tango-webhooks
crate so a verifier service doesn’t have to pull in the full SDK. See
<https://docs.rs/makegov-tango-webhooks> for HMAC-SHA256 signing and
verification.
Re-exports§
pub use shapes::DEFAULT_BASE_URL;pub use shapes::SHAPE_BUDGET_ACCOUNTS_MINIMAL;pub use shapes::SHAPE_CONTRACTS_MINIMAL;pub use shapes::SHAPE_CONTRACT_APPEALS_MINIMAL;pub use shapes::SHAPE_DIBBS_AWARDS_MINIMAL;pub use shapes::SHAPE_DIBBS_RFPS_MINIMAL;pub use shapes::SHAPE_DIBBS_RFQS_MINIMAL;pub use shapes::SHAPE_EBUY_REQUESTS_MINIMAL;pub use shapes::SHAPE_ENTITIES_COMPREHENSIVE;pub use shapes::SHAPE_ENTITIES_MINIMAL;pub use shapes::SHAPE_EXCLUSIONS_MINIMAL;pub use shapes::SHAPE_FEDERAL_REGISTER_COMPREHENSIVE;pub use shapes::SHAPE_FEDERAL_REGISTER_MINIMAL;pub use shapes::SHAPE_FORECASTS_MINIMAL;pub use shapes::SHAPE_GRANTS_MINIMAL;pub use shapes::SHAPE_GSA_ELIBRARY_CONTRACTS_MINIMAL;pub use shapes::SHAPE_IDVS_COMPREHENSIVE;pub use shapes::SHAPE_IDVS_MINIMAL;pub use shapes::SHAPE_ITDASHBOARD_INVESTMENTS_COMPREHENSIVE;pub use shapes::SHAPE_ITDASHBOARD_INVESTMENTS_MINIMAL;pub use shapes::SHAPE_NOTICES_MINIMAL;pub use shapes::SHAPE_OPPORTUNITIES_MINIMAL;pub use shapes::SHAPE_ORGANIZATIONS_MINIMAL;pub use shapes::SHAPE_OTAS_MINIMAL;pub use shapes::SHAPE_OTIDVS_MINIMAL;pub use shapes::SHAPE_PROTESTS_MINIMAL;pub use shapes::SHAPE_SBIR_SOLICITATIONS_MINIMAL;pub use shapes::SHAPE_SBIR_TOPICS_MINIMAL;pub use shapes::SHAPE_SLED_FORECASTS_COMPREHENSIVE;pub use shapes::SHAPE_SLED_FORECASTS_MINIMAL;pub use shapes::SHAPE_SLED_OPPORTUNITIES_COMPREHENSIVE;pub use shapes::SHAPE_SLED_OPPORTUNITIES_MINIMAL;pub use shapes::SHAPE_SLED_REVISIONS_MINIMAL;pub use shapes::SHAPE_SUBAWARDS_MINIMAL;pub use shapes::SHAPE_VEHICLES_COMPREHENSIVE;pub use shapes::SHAPE_VEHICLES_MINIMAL;pub use shapes::SHAPE_VEHICLE_AWARDEES_MINIMAL;pub use shapes::SHAPE_VEHICLE_ORDERS_MINIMAL;
Modules§
- models
- Typed response and input models for fixed-schema Tango endpoints.
- shapes
- Shape presets for the Tango API’s dynamic response-shaping feature.
Structs§
- Agency
Contracts Options - Options for the agency contract sub-resources
(
list_agency_awarding_contracts/list_agency_funding_contracts). - Budget
Account Quarters Options - Options for
Client::get_budget_account_quarters. - Budget
Account Recipients Options - Options for
Client::get_budget_account_recipients. - Client
- The Tango API client. Cheap to clone — all state is behind an
Arc. - Entity
Budget Flows Options - Options for
Client::get_entity_budget_flows. - Entity
Subresource Options - Options shared by every entity sub-resource list endpoint
(
/api/entities/{uei}/contracts/,/idvs/,/otas/,/otidvs/,/subawards/,/lcats/). - Error
Body - A parsed Tango API error body. Carried on the API-error variants so callers can introspect the server’s structured error response without re-parsing.
- GetAgency
Options - Per-agency get options.
- GetContract
Appeal Options - Options for
Client::get_contract_appeal. The detail endpoint returns a typedContractAppealRecord;shapelets callers override the server’s default. - GetDibbs
Options - Options for
Client::get_dibbs_rfq,Client::get_dibbs_rfp,Client::get_dibbs_award. - GetEbuy
Request Options - Options for
Client::get_ebuy_request. - GetEntity
Options - Options for
Client::get_entity. - GetExclusion
Options - Options for
Client::get_exclusion. - GetFederal
Register Document Options - Options for
Client::get_federal_register_document. - GetGsa
Elibrary Contract Options - Options for
Client::get_gsa_elibrary_contract. - GetIDV
Options - Options for
Client::get_idv. - GetItdashboard
Options - Options for
Client::get_itdashboard. - GetOTA
Options - Options for
Client::get_ota. - GetOTIDV
Options - Options for
Client::get_otidv. - GetProtest
Options - Options for
Client::get_protest. The detail endpoint returns a typedProtestRecord;shapelets callers override the server’s default. - GetSbir
Options - Options for
Client::get_sbir_topic,Client::get_sbir_solicitation. - GetSled
Options - Options for
Client::get_sled_opportunityandClient::get_sled_forecast. - GetVehicle
Options - Options for
Client::get_vehicle. Mirrors the Go SDK’sGetEntityOptionsfor the vehicle detail endpoint. - IdvSubresource
Options - Options shared by every IDV sub-resource list endpoint
(
/api/idvs/{key}/awards/,/child-idvs/,/transactions/,/lcats/). - List
Agencies Options - Options for
Client::list_agencies. - List
ApiKeys Options - Options for
Client::list_api_keys. - List
Assistance Listings Options - Options for
Client::list_assistance_listings/Client::iterate_assistance_listings. - List
Budget Accounts Options - Options for
Client::list_budget_accountsandClient::iterate_budget_accounts. - List
Business Types Options - Options for
Client::list_business_types/Client::iterate_business_types. - List
Contract Appeals Options - Options for
Client::list_contract_appealsandClient::iterate_contract_appeals. - List
Contracts Options - Options for
Client::list_contractsandClient::iterate_contracts. - List
Departments Options - Options for
Client::list_departments/Client::iterate_departments. - List
Dibbs Awards Options - Options for
Client::list_dibbs_awardsandClient::iterate_dibbs_awards. - List
Dibbs Rfps Options - Options for
Client::list_dibbs_rfpsandClient::iterate_dibbs_rfps. - List
Dibbs Rfqs Options - Options for
Client::list_dibbs_rfqsandClient::iterate_dibbs_rfqs. - List
Ebuy Requests Options - Options for
Client::list_ebuy_requestsandClient::iterate_ebuy_requests. - List
Entities Options - Options for
Client::list_entitiesandClient::iterate_entities. - List
Exclusions Options - Options for
Client::list_exclusionsandClient::iterate_exclusions. - List
Federal Register Documents Options - Options for
Client::list_federal_register_documentsandClient::iterate_federal_register_documents. - List
Forecasts Options - Options for
Client::list_forecastsandClient::iterate_forecasts. MirrorsListForecastsOptionsin the Go SDK. - List
Grants Options - Options for
Client::list_grantsandClient::iterate_grants. MirrorsListGrantsOptionsin the Go SDK. - List
GsaElibrary Contracts Options - Options for
Client::list_gsa_elibrary_contractsandClient::iterate_gsa_elibrary_contracts. - ListID
VsOptions - Options for
Client::list_idvsandClient::iterate_idvs. - List
Itdashboard Options - Options for
Client::list_itdashboardandClient::iterate_itdashboard. - List
Lcats Options - Options for
Client::list_lcatsandClient::iterate_lcats. - List
MasSins Options - Options for
Client::list_mas_sins/Client::iterate_mas_sins. - List
Metrics Options - Options for the
Client::list_metricsdispatcher. - List
Naics Options - Options for
Client::list_naics/Client::iterate_naics. - List
Notices Options - Options for
Client::list_noticesandClient::iterate_notices. MirrorsListNoticesOptionsin the Go SDK. The server rejects every?ordering=value on this endpoint, so the field is intentionally omitted. - ListOT
AsOptions - Options for
Client::list_otasandClient::iterate_otas. - ListOTIDV
Awards Options - Options for
Client::list_otidv_awardsandClient::iterate_otidv_awards. - ListOTID
VsOptions - Options for
Client::list_otidvsandClient::iterate_otidvs. - List
Offices Options - Options for
Client::list_offices/Client::iterate_offices. - List
Opportunities Options - Options for
Client::list_opportunitiesandClient::iterate_opportunities. MirrorsListOpportunitiesOptionsin the Go SDK. - List
Options - Pagination, shape, and flattening options common to every list endpoint.
- List
Organizations Options - Options for
Client::list_organizations/Client::iterate_organizations. - List
Protests Options - Options for
Client::list_protestsandClient::iterate_protests. - List
PscOptions - Options for
Client::list_psc/Client::iterate_psc. - List
Sbir Solicitations Options - Options for
Client::list_sbir_solicitationsandClient::iterate_sbir_solicitations. - List
Sbir Topics Options - Options for
Client::list_sbir_topicsandClient::iterate_sbir_topics. - List
Sled Forecasts Options - Options for
Client::list_sled_forecastsandClient::iterate_sled_forecasts. - List
Sled Opportunities Options - Options for
Client::list_sled_opportunitiesandClient::iterate_sled_opportunities. - List
Sled Opportunity Revisions Options - Options for
Client::list_sled_opportunity_revisions, the nested/revisions/route. - List
Subawards Options - Options for
Client::list_subawardsandClient::iterate_subawards. - List
Vehicle Awardees Options - Options for
Client::list_vehicle_awardeesandClient::iterate_vehicle_awardees. - List
Vehicle Orders Options - Options for
Client::list_vehicle_ordersandClient::iterate_vehicle_orders. - List
Vehicles Options - Options for
Client::list_vehiclesandClient::iterate_vehicles. - Page
- A single page of results from a list endpoint.
- Page
Stream - An async stream over every result of a paginated list endpoint.
- Rate
Limit Info - A snapshot of the rate-limit headers from the most recent response.
Enums§
- Error
- The error type returned by all fallible SDK calls.
Constants§
- DEFAULT_
RETRIES - Default retry count when none is set.
- DEFAULT_
RETRY_ BACKOFF - Default initial retry backoff (doubles each attempt up to 10s) when none is set.
- DEFAULT_
TIMEOUT - Default per-request timeout when none is set.
- METRICS_
OWNER_ ENTITY - Owner-type discriminant for
ListMetricsOptions::owner_type. - METRICS_
OWNER_ NAICS - Owner-type discriminant for
ListMetricsOptions::owner_type. - METRICS_
OWNER_ PSC - Owner-type discriminant for
ListMetricsOptions::owner_type. - VERSION
- The current SDK version. Kept in sync with
Cargo.tomland theCHANGELOG.
Type Aliases§
- List
Agency Awarding Contracts Options - Alias matching the plan’s
R-01naming — same asAgencyContractsOptions. - List
Agency Funding Contracts Options - Alias matching the plan’s
R-01naming — same asAgencyContractsOptions. - Record
- A free-form list result record. Used as the
Tfor shape-driven list endpoints whose response schema depends on the requestedshape. - Result
- Alias for the SDK’s standard
Resulttype.