{"id":50283132,"url":"https://github.com/hexqnt/cbr-client","last_synced_at":"2026-05-28T01:03:59.030Z","repository":{"id":348325867,"uuid":"1197607690","full_name":"hexqnt/cbr-client","owner":"hexqnt","description":"Strictly-typed, unofficial Rust client for downloading CBR data.","archived":false,"fork":false,"pushed_at":"2026-03-31T18:46:09.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-31T18:51:14.931Z","etag":null,"topics":["api","bank-of-russia","cbr","http-client"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hexqnt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-31T18:10:46.000Z","updated_at":"2026-03-31T18:46:13.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/hexqnt/cbr-client","commit_stats":null,"previous_names":["hexqnt/cbr-client"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/hexqnt/cbr-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexqnt%2Fcbr-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexqnt%2Fcbr-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexqnt%2Fcbr-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexqnt%2Fcbr-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hexqnt","download_url":"https://codeload.github.com/hexqnt/cbr-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexqnt%2Fcbr-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33589685,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-27T02:00:06.184Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","bank-of-russia","cbr","http-client"],"created_at":"2026-05-28T01:03:53.244Z","updated_at":"2026-05-28T01:03:59.024Z","avatar_url":"https://github.com/hexqnt.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cbr-client\n\n[![CI](https://github.com/hexqnt/cbr-client/actions/workflows/ci.yml/badge.svg)](https://github.com/hexqnt/cbr-client/actions/workflows/ci.yml)\n[![crates.io](https://img.shields.io/crates/v/cbr-client.svg)](https://crates.io/crates/cbr-client)\n[![docs.rs](https://docs.rs/cbr-client/badge.svg)](https://docs.rs/cbr-client)\n\nНеофициальная Rust-библиотека для работы с API сервиса статистических данных Банка России:\n`https://www.cbr.ru/statistics/data-service/APIdocumentation/`.\n\n## Установка\n\n```toml\n[dependencies]\ncbr-client = \"0.1.0\"\n```\n\n## Пример (async)\n\n```rust\nuse cbr_client::{CategoryId, CbrClient, DataNewQuery, IndicatorId, Year, YearSpan};\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let client = CbrClient::new()?;\n\n    let years = YearSpan::new(Year::new(2021), Year::new(2021))?;\n    let data = client\n        .data_new(\n            DataNewQuery::new(CategoryId::new(5)?, years)\n                .with_i_ids([IndicatorId::new(7)?, IndicatorId::new(8)?]),\n        )\n        .await?;\n\n    println!(\"rows: {}\", data.row_data.len());\n    Ok(())\n}\n```\n\n## Пример (blocking)\n\n```rust\nuse cbr_client::{\n    BlockingCbrClient, DataQuery, DatasetId, MeasureId, PublicationId, Year, YearSpan,\n};\n\nfn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let client = BlockingCbrClient::new()?;\n    let years = YearSpan::new(Year::new(2021), Year::new(2021))?;\n\n    let data = client.data(\n        DataQuery::new(years, DatasetId::new(38)?, PublicationId::new(18)?)\n            .with_measure_id(MeasureId::new(2)?),\n    )?;\n\n    println!(\"raw rows: {}\", data.raw_data.len());\n    Ok(())\n}\n```\n\n## Пример: временной ряд USD/RUB\n\nГотовый пример находится в `examples/usd_rub_time_series.rs`.\n\nВ модуле `cbr_client::presets::fx` доступны:\n\n- константные пресеты (`SeriesPreset`)\n- параметризованный runtime-резолвер:\n  - `resolve_fx_series(client, FxPeriodicity, FxMetric)`\n  - `resolve_fx_series_blocking(...)` (с feature `blocking`)\n\n## Настройка клиента\n\n```rust\nuse std::time::Duration;\nuse cbr_client::CbrClient;\n\nlet client = CbrClient::builder()\n    .base_url(\"https://www.cbr.ru/dataservice\")\n    .timeout(Duration::from_secs(15))\n    .user_agent(\"my-app/1.0\")\n    .build()?;\n```\n\n## Advanced API (кастомные типы)\n\nЕсли нужно десериализовать ответ сразу в собственную структуру, используйте generic-методы:\n\n- async: `request_json\u003cT\u003e(path)` и `request_json_with_query\u003cT, Q\u003e(path, \u0026query)`\n- blocking (feature `blocking`): `request_json\u003cT\u003e(path)` и `request_json_with_query\u003cT, Q\u003e(path, \u0026query)`\n\n`path` задаётся относительно `base_url`, ведущий `/` необязателен.\n\n```rust\nuse serde::{Deserialize, Serialize};\nuse cbr_client::CbrClient;\n\n#[derive(Debug, Deserialize)]\nstruct MyPayload {\n    value: i32,\n}\n\n#[derive(Debug, Serialize)]\nstruct MyQuery {\n    page: u32,\n}\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let client = CbrClient::new()?;\n    let _payload: MyPayload = client\n        .request_json_with_query(\"/some-endpoint\", \u0026MyQuery { page: 1 })\n        .await?;\n    Ok(())\n}\n```\n\n### Работа через proxy\n\n```rust\nuse cbr_client::CbrClient;\n\nlet client = CbrClient::builder()\n    .proxy(\"http://127.0.0.1:8080\")\n    // Использование системных proxy-переменных окружения:\n    //.use_system_proxy(true)\n    .build()?;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexqnt%2Fcbr-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhexqnt%2Fcbr-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexqnt%2Fcbr-client/lists"}