{"id":13569541,"url":"https://github.com/H1rono/traq-bot-http-rs","last_synced_at":"2025-04-04T05:33:10.379Z","repository":{"id":74493621,"uuid":"602030256","full_name":"H1rono/traq-bot-http-rs","owner":"H1rono","description":"traQ BOTのHTTPリクエストパーサー","archived":false,"fork":false,"pushed_at":"2024-11-01T13:42:28.000Z","size":501,"stargazers_count":4,"open_issues_count":17,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-01T14:31:43.506Z","etag":null,"topics":["rust","traq","traq-bot"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/traq-bot-http","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/H1rono.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2023-02-15T10:55:28.000Z","updated_at":"2024-11-01T13:42:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"e5c834bf-5c4c-49db-857b-c050e5e670d7","html_url":"https://github.com/H1rono/traq-bot-http-rs","commit_stats":{"total_commits":53,"total_committers":2,"mean_commits":26.5,"dds":0.07547169811320753,"last_synced_commit":"6a61244aed543452214b8375d655af888e052273"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/H1rono%2Ftraq-bot-http-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/H1rono%2Ftraq-bot-http-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/H1rono%2Ftraq-bot-http-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/H1rono%2Ftraq-bot-http-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/H1rono","download_url":"https://codeload.github.com/H1rono/traq-bot-http-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223100124,"owners_count":17087387,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["rust","traq","traq-bot"],"created_at":"2024-08-01T14:00:41.202Z","updated_at":"2025-04-04T05:33:10.372Z","avatar_url":"https://github.com/H1rono.png","language":"Rust","funding_links":[],"categories":["Libraries"],"sub_categories":[],"readme":"# traq-bot-http-rs\n\n[![Rust](https://github.com/H1rono/traq-bot-http-rs/actions/workflows/rust.yml/badge.svg)](https://github.com/H1rono/traq-bot-http-rs/actions/workflows/rust.yml)\n[![codecov](https://codecov.io/gh/H1rono/traq-bot-http-rs/branch/main/graph/badge.svg?token=UEA9118L9I)](https://codecov.io/gh/H1rono/traq-bot-http-rs)\n[![Release](https://github.com/H1rono/traq-bot-http-rs/actions/workflows/release.yml/badge.svg)](https://github.com/H1rono/traq-bot-http-rs/actions/workflows/release.yml)\n[![docs.rs](https://img.shields.io/docsrs/traq-bot-http?logo=docsdotrs)](https://docs.rs/traq-bot-http/latest/traq_bot_http/)\n\n[![GitHub](https://img.shields.io/github/license/H1rono/traq-bot-http-rs?logo=github)](https://github.com/H1rono/traq-bot-http-rs/blob/main/LICENSE)\n[![Crates.io](https://img.shields.io/crates/l/traq-bot-http?logo=docsdotrs)](https://crates.io/crates/traq-bot-http)\n[![GitHub release (with filter)](https://img.shields.io/github/v/release/h1rono/traq-bot-http-rs?logo=github)](https://github.com/H1rono/traq-bot-http-rs/releases/latest)\n[![Crates.io](https://img.shields.io/crates/v/traq-bot-http?logo=rust)](https://crates.io/crates/traq-bot-http)\n\ntraQ BOTのPOSTリクエストをパースするライブラリです。\n\n## example\n\n`Cargo.toml`\n\n```toml\n# ...\n\n[dependencies]\nhttp = \"1\"\ntower = \"0.4\"\naxum = \"0.7\"\ntokio = { version = \"1\", features = [\"full\"] }\ntraq-bot-http = { version = \"0.11\", features = [\"tower\"] }\n```\n\n`main.rs`\n\n```rust\nuse std::{env, net::SocketAddr};\n\nuse axum::{routing::post_service, Router};\nuse http::StatusCode;\nuse tokio::net::TcpListener;\nuse tower::service_fn;\n\nuse traq_bot_http::{payloads, RequestParser};\n\n#[tokio::main]\nasync fn main() {\n    let verification_token = env::var(\"VERIFICATION_TOKEN\").unwrap();\n    let parser = RequestParser::new(\u0026verification_token);\n    let handler = parser\n        .into_handler()\n        .on_message_created(service_fn(on_message_created));\n    let app = Router::new().route(\n        \"/\",\n        post_service(handler).handle_error(|_| async { StatusCode::INTERNAL_SERVER_ERROR }),\n    );\n    let addr = SocketAddr::from(([127, 0, 0, 1], 8080));\n    let server = TcpListener::bind(addr).await.unwrap();\n    axum::serve(server, app).await.unwrap();\n}\n\nasync fn on_message_created(\n    payload: payloads::MessageCreatedPayload,\n) -\u003e Result\u003c(), std::convert::Infallible\u003e {\n    print!(\n        \"{}さんがメッセージを投稿しました。\\n内容: {}\\n\",\n        payload.message.user.display_name, payload.message.text\n    );\n    Ok(())\n}\n```\n\n## Features\n\nfeature | 機能 | バージョン\n:-- | :-- | :--\n`uuid` | ペイロードのUUID値が[`uuid::Uuid`](https://docs.rs/uuid/latest/uuid/struct.Uuid.html)型に | [v0.4.0](https://github.com/H1rono/traq-bot-http-rs/releases/tag/v0.4.0)から\n`time` | ペイロードのタイムスタンプ値([RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.6))が[`time::OffsetDateTime`](https://docs.rs/time/latest/time/struct.OffsetDateTime.html)型に | [v0.5.0](https://github.com/H1rono/traq-bot-http-rs/releases/tag/v0.5.0)から\n`chrono` | ペイロードのタイムスタンプ値が[`chrono::DateTime\u003cchrono::Utc\u003e`](https://docs.rs/chrono/latest/chrono/struct.DateTime.html)型に | [v0.6.0](https://github.com/H1rono/traq-bot-http-rs/releases/tag/v0.6.0)から\n`http` | [`http::Request`](https://docs.rs/http/latest/http/request/struct.Request.html)型のサポート | [v0.10.0](https://github.com/H1rono/traq-bot-http-rs/releases/tag/v0.10.0)から\n`tower` | [`Handler`](https://docs.rs/traq-bot-http/latest/traq_bot_http/struct.Handler.html)構造体 | [v0.10.1](https://github.com/H1rono/traq-bot-http-rs/releases/tag/v0.10.1)から\n\n※`time`よりも`chrono`の方が優先されます\n\n## Supported Rust Version\n\n現行の MSRV(Minimum Supported Rust Version) は **1.76.0** です。\n\n将来的にMSRVは変更される可能性がありますが、minorバージョンの更新で導入されます。\n\n## Contributing\n\nIssue, Pull Requestは大歓迎です。\n\n## Blogs about this repository\n\n- [Rustでライブラリを作った | 東京科学大学デジタル創作同好会traP](https://trap.jp/post/1819/)\n- [Rustでライブラリを作った 続編 | 東京科学大学デジタル創作同好会traP](https://trap.jp/post/2438/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FH1rono%2Ftraq-bot-http-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FH1rono%2Ftraq-bot-http-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FH1rono%2Ftraq-bot-http-rs/lists"}