oai-pmh
Rust library for the Open Archives Initiative Protocol for Metadata Harvesting.
The immediate need and focus is for a client only. A repository may come later.
Usage
The standard practice will be to:
- Create a client passing in the OAI endpoint
- Create query args as necessary
- Run the query
Examples use the #[tokio::main] macro to create the async runtime. The tokio dependency is not provided by this library therefore you must include it in your Cargo.toml like: tokio = { version = "1", features = ["rt-multi-thread", "macros"] }. For async runtime requirements refer to the reqwest documentation.
use ;
async
Queries that support resumption tokens return an async stream, as in client.list_records in the example.
Custom Request Headers
Use add_header to pass additional HTTP headers with every request, for example when an endpoint requires authentication:
use ;
async
Custom headers override the defaults (Accept and User-Agent) if the same header name is supplied.
Metadata
To provide flexibilty metadata is not parsed by this library. The OAI response metadata element/s are captured as strings. The expectation is you "bring your own parser" to handle whatever metadata format is supported by the server and requested via the client.
Runnable Examples
List identifiers:
# Use defaults (test.archivesspace.org, oai_ead, 5 responses/pages)
# Specify endpoint and metadata prefix
# Specify number of respones/pages to fetch
# Specify a different endpoint and metadata format
# Basic profiling
Other examples include:
- List formats and sets
- List records