{"id":13726769,"url":"https://github.com/line/centraldogma-rs","last_synced_at":"2025-05-07T22:30:32.648Z","repository":{"id":45149934,"uuid":"371315035","full_name":"line/centraldogma-rs","owner":"line","description":"Official Rust client for Central Dogma","archived":false,"fork":false,"pushed_at":"2023-03-21T06:45:14.000Z","size":116,"stargazers_count":47,"open_issues_count":1,"forks_count":6,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-04-30T21:41:57.063Z","etag":null,"topics":["centraldogma","reqwest","rust","rust-library","tokio-rs"],"latest_commit_sha":null,"homepage":"https://docs.rs/centraldogma","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/line.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-05-27T09:17:18.000Z","updated_at":"2025-03-09T11:54:41.000Z","dependencies_parsed_at":"2024-01-06T07:48:42.300Z","dependency_job_id":"07b632d2-0286-4302-96b0-d6c03927f9a8","html_url":"https://github.com/line/centraldogma-rs","commit_stats":{"total_commits":51,"total_committers":7,"mean_commits":7.285714285714286,"dds":0.3137254901960784,"last_synced_commit":"311ba7e7bfbbac1d3d362c14dfa024b70f4dd83d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/line%2Fcentraldogma-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/line%2Fcentraldogma-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/line%2Fcentraldogma-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/line%2Fcentraldogma-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/line","download_url":"https://codeload.github.com/line/centraldogma-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252965070,"owners_count":21832817,"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":["centraldogma","reqwest","rust","rust-library","tokio-rs"],"created_at":"2024-08-03T01:03:20.737Z","updated_at":"2025-05-07T22:30:32.176Z","avatar_url":"https://github.com/line.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# centraldogma-rs\n\nOfficial Rust Client for [Central Dogma](https://line.github.io/centraldogma/).\n\nFull documentation is available at \u003chttps://docs.rs/centraldogma\u003e\n\n## Getting started\n\n### Installing\n\nAdd `centraldogma` crate and version to Cargo.toml.\n\n```toml\ncentraldogma = \"0.1\"\n```\n\n#### Async support with tokio\nThe client uses [`reqwest`](https://crates.io/crates/reqwest) to make HTTP calls, which internally uses\nthe [`tokio`](https://crates.io/crates/tokio) runtime for async support. As such, you may require to take\na dependency on `tokio` in order to use the client.\n\n```toml\ntokio = { version = \"1.2.0\", features = [\"full\"] }\n```\n\n### Create a client\n\nCreate a new client to make API to CentralDogma using the `Client` struct.\n\n```rust,no_run\nuse centraldogma::Client;\n\n#[tokio::main]\nasync fn main() {\n    // with token\n    let client = Client::new(\"http://localhost:36462\", Some(\"token\")).await.unwrap();\n    // without token\n    let client = Client::new(\"http://localhost:36462\", None).await.unwrap();\n    // your code ...\n}\n```\n\n### Making typed API calls\n\nTyped API calls are provided behind traits:\n\n* [`ProjectService`](https://docs.rs/centraldogma/0.1.0/centraldogma/trait.ProjectService.html)\n* [`RepoService`](https://docs.rs/centraldogma/0.1.0/centraldogma/trait.RepoService.html)\n* [`ContentService`](https://docs.rs/centraldogma/0.1.0/centraldogma/trait.ContentService.html)\n* [`WatchService`](https://docs.rs/centraldogma/0.1.0/centraldogma/trait.WatchService.html)\n\n#### Examples\n\n##### Get File\n\n```rust,no_run\nuse centraldogma::{\n    Client, ContentService,\n    model::{Revision, Query},\n};\n\n#[tokio::main]\nasync fn main() {\n    // without token\n    let client = Client::new(\"http://localhost:36462\", None).await.unwrap();\n\n    let file = client\n        .repo(\"project\", \"repository\")\n        .get_file(Revision::HEAD, \u0026Query::of_text(\"/a.yml\").unwrap())\n        .await\n        .unwrap();\n    // your code ...\n}\n```\n\n##### Push\n\n```rust,no_run\nuse centraldogma::{\n    Client, ContentService,\n    model::{Revision, Change, ChangeContent, CommitMessage},\n};\nuse serde_json;\n\n#[tokio::main]\nasync fn main() {\n    let client = Client::new(\"http://localhost:36462\", None).await.unwrap();\n    let changes = vec![Change {\n        path: \"/a.json\".to_string(),\n        content: ChangeContent::UpsertJson(serde_json::json!({\"a\":\"b\"})),\n    }];\n    let result = client\n        .repo(\"foo\", \"bar\")\n        .push(\n            Revision::HEAD,\n            CommitMessage::only_summary(\"Add a.json\"),\n            changes,\n        )\n        .await\n        .unwrap();\n}\n```\n\n##### Watch file change\n\n```rust,no_run\nuse centraldogma::{Client, WatchService, model::Query};\nuse futures::StreamExt;\n\n#[tokio::main]\nasync fn main() {\n    let client = Client::new(\"http://localhost:36462\", None).await.unwrap();\n    let mut stream = client\n        .repo(\"foo\", \"bar\")\n        .watch_file_stream(\u0026Query::identity(\"/a.json\").unwrap())\n        .unwrap();\n\n    tokio::spawn(async move {\n        while let Some(result) = stream.next().await {\n            // your code ...\n        }\n    });\n}\n```\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fline%2Fcentraldogma-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fline%2Fcentraldogma-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fline%2Fcentraldogma-rs/lists"}