Expand description
§Guts Compatibility Layer
Git and GitHub compatibility layer for the Guts code collaboration platform.
This crate provides:
- User Accounts: User registration and profile management
- Personal Access Tokens: Token-based authentication for API and Git operations
- SSH Keys: SSH key management for future SSH protocol support
- Releases: Release and asset management
- Contents API: Repository file browsing
- Archive Downloads: Tarball and zipball generation
- Rate Limiting: GitHub-compatible rate limiting
- Pagination: GitHub-style Link header pagination
§Example
use guts_compat::{CompatStore, TokenScope};
// Create a store
let store = CompatStore::new();
// Create a user
let user = store.users.create(
"alice".to_string(),
"ed25519_pubkey_hex".to_string(),
).unwrap();
// Create a personal access token
let (token, plaintext) = store.tokens.create(
user.id,
"CI/CD Token".to_string(),
vec![TokenScope::RepoRead, TokenScope::RepoWrite],
None, // No expiration
).unwrap();
println!("Token: {}", plaintext);
// Verify the token later
let (user_id, scopes) = store.tokens.verify(&plaintext).unwrap();
assert_eq!(user_id, user.id);§Authentication
Tokens can be used in several ways:
# Bearer token (recommended)
curl -H "Authorization: Bearer guts_abc12345_XXXXX" https://api.guts.network/user
# Token header (GitHub-style)
curl -H "Authorization: token guts_abc12345_XXXXX" https://api.guts.network/user
# Basic auth (username:token)
curl -u "alice:guts_abc12345_XXXXX" https://api.guts.network/user§Rate Limiting
All API responses include rate limit headers:
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
X-RateLimit-Reset: 1234567890
X-RateLimit-Used: 1
X-RateLimit-Resource: coreRe-exports§
pub use archive::create_archive;pub use archive::ArchiveEntry;pub use archive::ArchiveFormat;pub use archive::TarGzBuilder;pub use archive::ZipBuilder;pub use contents::base64_encode;pub use contents::detect_spdx_id;pub use contents::is_readme_file;pub use contents::recognize_license_file;pub use contents::ContentEntry;pub use contents::ContentType;pub use contents::ContentsQuery;pub use contents::LicenseResponse;pub use contents::ReadmeResponse;pub use error::CompatError;pub use error::Result;pub use middleware::resource_from_path;pub use middleware::AuthContext;pub use middleware::AuthorizationValue;pub use middleware::ErrorResponse;pub use middleware::ResponseHeaders;pub use middleware::ValidationError;pub use middleware::ValidationErrorCode;pub use pagination::paginate;pub use pagination::PaginatedResponse;pub use pagination::PaginationLinks;pub use pagination::PaginationParams;pub use pagination::DEFAULT_PER_PAGE;pub use pagination::MAX_PER_PAGE;pub use rate_limit::RateLimitHeaders;pub use rate_limit::RateLimitInfo;pub use rate_limit::RateLimitResource;pub use rate_limit::RateLimitResources;pub use rate_limit::RateLimitResponse;pub use rate_limit::RateLimitState;pub use rate_limit::RateLimiter;pub use rate_limit::DEFAULT_RATE_LIMIT;pub use rate_limit::UNAUTHENTICATED_RATE_LIMIT;pub use release::AssetId;pub use release::AssetResponse;pub use release::AuthorInfo;pub use release::CreateReleaseRequest;pub use release::Release;pub use release::ReleaseAsset;pub use release::ReleaseId;pub use release::ReleaseResponse;pub use release::UpdateReleaseRequest;pub use ssh_key::AddSshKeyRequest;pub use ssh_key::SshKey;pub use ssh_key::SshKeyId;pub use ssh_key::SshKeyResponse;pub use ssh_key::SshKeyType;pub use store::CompatStats;pub use store::CompatStore;pub use store::ReleaseStore;pub use store::SshKeyStore;pub use store::TokenStore;pub use store::UserStore;pub use token::CreateTokenRequest;pub use token::PersonalAccessToken;pub use token::TokenId;pub use token::TokenResponse;pub use token::TokenScope;pub use token::TokenValue;pub use user::CreateUserRequest;pub use user::UpdateUserRequest;pub use user::User;pub use user::UserId;pub use user::UserProfile;
Modules§
- archive
- Archive generation for repository downloads.
- contents
- Repository contents API types.
- error
- Error types for the compatibility layer.
- middleware
- HTTP middleware for GitHub API compatibility.
- pagination
- GitHub-style pagination with Link headers.
- rate_
limit - Rate limiting with GitHub-compatible headers.
- release
- Release and tag management types.
- ssh_key
- SSH key management types.
- store
- Storage for compatibility layer data.
- token
- Personal Access Token types and authentication.
- user
- User account types and management.
Constants§
- VERSION
- Version of the compatibility layer.