NAME

WWW::Bund::Caller - Generic API call engine

VERSION

version 0.001

SYNOPSIS

use WWW::Bund::Caller;

my $caller = WWW::Bund::Caller->new(
    registry     => $registry,
    auth         => $auth,
    cache        => $cache,
    rate_limiter => $rate_limiter,
    io           => $io,
);

my $data = $caller->call('autobahn', 'autobahn_roads');
my $data = $caller->call('autobahn', 'autobahn_webcams',
    params => { roadId => 'A7' }
);

DESCRIPTION

The call engine coordinates endpoint lookup, URL building, path parameter substitution, authentication, rate limiting, caching, HTTP execution, and response parsing.

Flow:

1. Look up endpoint metadata from registry
2. Build URL with path and query parameters
3. Check rate limit
4. Check cache (GET only)
5. Add authentication headers
6. Execute HTTP request via IO adapter
7. Parse response (JSON, XML, or raw)
8. Cache response (GET only)
9. Return parsed data

registry

WWW::Bund::Registry instance for endpoint lookup. Required.

auth

WWW::Bund::Auth instance for authentication headers. Required.

cache

WWW::Bund::Cache instance for response caching. Required.

rate_limiter

WWW::Bund::RateLimit instance for rate limiting. Required.

io

HTTP client implementing WWW::Bund::Role::IO. Required.

call

my $data = $caller->call($api_id, $endpoint_name, %options);

Execute an API call. Returns parsed data (HashRef or ArrayRef).

Options:

  • params - HashRef of path and query parameters

  • base_url - Override endpoint's base URL

Path parameters ({roadId} in path) are substituted first. Remaining parameters are added as query params for GET requests.

Throws exception on HTTP errors (non-2xx status codes) or missing endpoints.

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-www-bund/issues.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.