{"id":20195893,"url":"https://github.com/chenaoxd/gritea","last_synced_at":"2025-04-10T10:14:17.061Z","repository":{"id":62439794,"uuid":"434703726","full_name":"chenaoxd/gritea","owner":"chenaoxd","description":"Gritea is a async gitea API sdk.","archived":false,"fork":false,"pushed_at":"2022-06-14T18:13:51.000Z","size":109,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T09:05:30.234Z","etag":null,"topics":["gitea","gitea-api","rust"],"latest_commit_sha":null,"homepage":"","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/chenaoxd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-03T19:00:42.000Z","updated_at":"2023-08-04T14:35:09.000Z","dependencies_parsed_at":"2022-11-01T23:18:10.046Z","dependency_job_id":null,"html_url":"https://github.com/chenaoxd/gritea","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenaoxd%2Fgritea","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenaoxd%2Fgritea/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenaoxd%2Fgritea/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenaoxd%2Fgritea/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chenaoxd","download_url":"https://codeload.github.com/chenaoxd/gritea/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248198892,"owners_count":21063628,"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":["gitea","gitea-api","rust"],"created_at":"2024-11-14T04:19:59.264Z","updated_at":"2025-04-10T10:14:17.033Z","avatar_url":"https://github.com/chenaoxd.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gritea\n\n`Gritea` is a async gitea API sdk.\n\n\n[![Crates.io][crates-badge]][crates-url]\n[![MIT licensed][mit-badge]][mit-url]\n\n[crates-badge]: https://img.shields.io/crates/v/gritea.svg\n[crates-url]: https://crates.io/crates/gritea\n[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg\n[mit-url]: https://github.com/chenaoxd/gritea/blob/master/LICENSE\n\n\n## Usage example\n\n```rust\nuse anyhow::Context;\nuse gritea::{client::Gritea, pagination::Pagination, repo::CreateHookOption, Result};\nuse maplit::hashmap;\nuse std::env;\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c()\u003e {\n    let cli =\n        Gritea::builder(\"git.dreamszl.cc\")\n            .token(env::var(\"ACCESS_TOKEN\").with_context(|| {\n                format!(\"get environment variable ACCESS_TOKEN failed\")\n            })?)\n            .build()?;\n\n    let user = cli.current_user().await?;\n    println!(\"{:#?}\", user);\n\n    let repo = cli.get_repo(\"op\", \"jarvis\").await?;\n    println!(\"{:#?}\", repo);\n\n    let _repos = cli.list_repos(\u0026Pagination::default()).await?;\n    // println!(\"{:#?}\", _repos);\n\n    let hook = cli\n        .create_hook(\n            \"op\",\n            \"jarvis\",\n            \u0026CreateHookOption {\n                type_: \"gitea\".to_string(),\n                config: hashmap! {\n                    \"url\".to_string() =\u003e \"http://foo.bar/hook\".to_string(),\n                    \"content_type\".to_string() =\u003e \"json\".to_string(),\n                    \"secret\".to_string() =\u003e \"foo\".to_string(),\n                },\n                events: vec![\"push\".to_string()],\n                branch_filter: \"*\".to_string(),\n                active: true,\n            },\n        )\n        .await?;\n    println!(\"{:#?}\", hook);\n\n    Ok(())\n}\n```\n\n## License\n\nThis project is licensed under the [MIT license](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchenaoxd%2Fgritea","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchenaoxd%2Fgritea","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchenaoxd%2Fgritea/lists"}