Skip to content

Add filtered variants - #3

Merged
digizeph merged 1 commit into
bgpkit:mainfrom
hellerve:add-query-params
Aug 10, 2026
Merged

digizeph merged 1 commit into
bgpkit:mainfrom
hellerve:add-query-params

Conversation

@hellerve

Copy link
Copy Markdown
Contributor

This PR adds a variant of the API calls that allow for filters, such that we can allow for filtering on the peeringdb side instead of having to query everything and do client-side filtering.

Cheers

@digizeph digizeph left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review (via Hermes Agent)

Feature is useful and the API design (a _filtered sibling per loader, delegating to get_reader_with_params) is clean. Blocking issues below; also needs a rebase on top of PR #1 and PR #2.

  1. netixlan endpoint bug carried over (inline) — the filtered netixlan variant still fetches /api/org; PR #1 fixes this in the unfiltered loader. Merging as-is means load_peeringdb_netixlan_filtered returns org objects (silently deserialized, asn = None).
  2. Clippy fails (inline) — get_reader is now dead code; CI runs cargo clippy -- -D warnings, so this blocks merge.
  3. Conflicts with PR #1 (netixlan.rs) and PR #2 (utils.rs) — PR #3 was branched from pre-fix main. PR #2 removed the unconditional empty Authorization: Api-Key header; PR #3's utils.rs still contains that logic and would revert the fix if resolved naively. Please rebase onto main after #1 and #2 merge.

Non-blocking: consider a unit test for the filtered path (e.g. fetch with ix_id filter and assert all records match).

Comment thread src/data/netixlan.rs Outdated
///
/// [api]: https://www.peeringdb.com/apidocs/#tag/api/operation/list%20netixlan
pub fn load_peeringdb_netixlan_filtered(params: &[(&str, &str)]) -> Result<Vec<PeeringdbNetixlan>> {
let mut reader = get_reader_with_params("https://www.peeringdb.com/api/org", params)?;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still points at /api/org — this is exactly the bug PR #1 fixes. Must be https://www.peeringdb.com/api/netixlan (will also conflict with PR #1 on merge).

Comment thread src/data/utils.rs Outdated
@@ -4,6 +4,13 @@ use std::io::Read;
use tracing::warn;

pub(crate) fn get_reader(url: &str) -> Result<Box<dyn Read + Send>> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_reader is now unused (all callers go through get_reader_with_params) and the crate CI runs cargo clippy --all-features -- -D warnings, so this fails the build. Either drop the wrapper and have base loaders call get_reader_with_params(url, &[]), or keep it referenced.

@digizeph
digizeph merged commit 6292f22 into bgpkit:main Aug 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants