Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ This project follows [Semantic Versioning](https://semver.org/).

## [Unreleased]

### Added

- **Opportunities `Domain` filter:** `ListOpportunitiesOptions` gains `Domain`, sent as `domain`, which picks which listing to search. The API defaults to `"sam"` and returns `*ValidationError` (HTTP 400) for a value it doesn't accept. Empty by default, so existing calls send the same request.

## [0.4.0] - 2026-10-29

### Added
Expand Down
4 changes: 3 additions & 1 deletion docs/API_REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,9 @@ All return `*PaginatedResponse[Record]`. Empty UEI is rejected client-side as `*

### `ListOpportunities(ctx, *ListOpportunitiesOptions) (*PaginatedResponse[Record], error)`

`GET /api/opportunities/`. SAM.gov opportunities. Filters: `Active *bool`, `Agency`, `FirstNoticeDate[After/Before]`, `LastNoticeDate[After/Before]`, `NAICS`, `NoticeType`, `Ordering`, `PlaceOfPerformance`, `PSC`, `ResponseDeadline[After/Before]`, `Search`, `SetAside`, `SolicitationNumber`, `OpportunityID`, `Awarded *bool`, `AwardeeUEI`.
`GET /api/opportunities/`. SAM.gov opportunities. Filters: `Active *bool`, `Agency`, `FirstNoticeDate[After/Before]`, `LastNoticeDate[After/Before]`, `NAICS`, `NoticeType`, `Ordering`, `PlaceOfPerformance`, `PSC`, `ResponseDeadline[After/Before]`, `Search`, `SetAside`, `SolicitationNumber`, `OpportunityID`, `Awarded *bool`, `AwardeeUEI`, `Domain`.

`Domain` picks which listing to search; the API defaults to `"sam"` and returns `*ValidationError` (HTTP 400) for a value it doesn't accept.

**Award fields** (Tango API 5.5.0). None is in a `Shape*` preset, so name the fields you want:

Expand Down
3 changes: 3 additions & 0 deletions opportunities.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ type ListOpportunitiesOptions struct {
Awarded *bool
// AwardeeUEI matches the awardee's UEI, case-insensitive; join several with "|". It searches every opportunity rather than only active ones. Tango API 5.5.0 and later.
AwardeeUEI string
// Domain picks which listing to search; the API defaults to "sam" and returns *ValidationError (HTTP 400) for a value it doesn't accept.
Domain string

Extra map[string]any
}
Expand Down Expand Up @@ -62,6 +64,7 @@ func (o *ListOpportunitiesOptions) toQuery() url.Values {
setIfNotEmpty(q, "solicitation_number", o.SolicitationNumber)
setIfNotNilBool(q, "awarded", o.Awarded)
setIfNotEmpty(q, "awardee_uei", o.AwardeeUEI)
setIfNotEmpty(q, "domain", o.Domain)
for k, v := range o.Extra {
q.Set(k, valueToString(v))
}
Expand Down
10 changes: 10 additions & 0 deletions opportunities_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,3 +387,13 @@ func TestListOpportunitiesForwardsAwardFilters(t *testing.T) {
_, _ = c.ListOpportunities(context.Background(), &ListOpportunitiesOptions{Search: "radar"})
assertQueryContains(t, capturedURL, map[string]string{"search": "radar"}, []string{"awarded", "awardee_uei"})
}

func TestListOpportunitiesForwardsDomain(t *testing.T) {
var capturedURL string
c, _ := newTestClient(t, captureURLHandler(&capturedURL))
_, _ = c.ListOpportunities(context.Background(), &ListOpportunitiesOptions{Domain: "sam"})
assertQueryContains(t, capturedURL, map[string]string{"domain": "sam"}, nil)

_, _ = c.ListOpportunities(context.Background(), &ListOpportunitiesOptions{Search: "radar"})
assertQueryContains(t, capturedURL, map[string]string{"search": "radar"}, []string{"domain"})
}
Loading