Repository navigation
Add a client builder, optional HTTP stack and account endpoints - #5
Conversation
Client::builder(environment) accepts an injected reqwest::Client, a user agent, an explicit base URL (which skips SIGIT_HOST) and a client name that is sent in the x-sigit-client header. Client::new and with_token keep working as before. The crate now has a default `client` feature. Without it only the wire types remain (models, ErrorResponse, error::codes, Environment, CLIENT_HEADER), with no reqwest dependency, so code that serves or proxies the API can share them. ErrorResponse, AccountStatus, BillingUrl and GitCredential now implement Serialize. The TLS backend is selectable: rustls-tls-native-roots (default), rustls-tls-webpki-roots or native-tls. With none enabled and no injected client, HTTPS requests fail. New endpoints: sign_up, resend_confirmation and delete_account. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The workflow is dispatched by hand, picks one of the two crates and can do a dry run. It exchanges its OIDC token for a short-lived crates.io token instead of using a stored API key. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
There was a problem hiding this comment.
This change introduces a builder pattern for the sigit-si-api Client, allowing for injection of a custom reqwest::Client, user agent, explicit base URL, client name, and token. The new builder enables more flexible configuration, including support for disabling all TLS features and requiring an injected client for HTTPS. The default features and TLS backend selection are now explicit in Cargo.toml, and the API crate can be built without the HTTP client for proxy/server use cases. New account endpoints (sign_up, resend_confirmation, delete_account) are added. Several wire types now implement Serialize. The workspace and CLI dependencies are updated to match the new API version and TLS handling. A new GitHub workflow for trusted publishing is included. The README and crate docs are updated to reflect these changes. All previous findings appear addressed, and the new code is covered by unit tests for builder behavior and header injection.
Automated review by siGit Code Review · commit 6907b93 · see the review dashboard
This is a semver-minor release of
sigit-si-api(1.2.0). Everything is additive, andClient::newandwith_tokenbehave as before, so thesiCLI is unchanged.What changes
Client::builder(environment)takes an injectedreqwest::Client, a user agent, an explicit base URL, a client name and a token. An explicit base URL replaces the environment default, soSIGIT_HOSThas no effect on it..client_name(..)sends the newCLIENT_HEADER(x-sigit-client) on every request.clientfeature gatesreqwest,Client,ApiErrorand the endpoint modules. Withdefault-features = falseonly the wire types remain (models,ErrorResponse,error::codes,Environment,CLIENT_HEADER) andcargo treeshows no reqwest.rustls-tls-native-roots(default),rustls-tls-webpki-rootsornative-tls. With none enabled and no injected client, HTTPS requests fail. This is documented in the crate docs.ErrorResponse,AccountStatus,BillingUrlandGitCredentialnow implementSerialize.sign_up,resend_confirmationanddelete_account.reqwestno longer enables a TLS feature. The CLI addsrustls-tls-native-rootsitself.release-crates.ymlworkflow publishes a chosen crate with crates.io Trusted Publishing (dispatch only, with a dry run option). Both crates have a trusted publisher entry for it.Checks
cargo test --workspace,cargo clippy --workspace --all-targets -- -D warningscargo check -p sigit-si-apiwith default features,--no-default-features,--no-default-features --features clientand--no-default-features --features native-tlscargo build -p sigit-si-cliI did not run the
si auth loginandsi repo listsmoke test.Before publishing
GitHub can only dispatch a workflow that exists on the default branch, so
release-crates.ymlhas to reachmainbefore the first trusted publish. Publishsigit-si-apifirst; the CLI depends on it.server.jsonstill says 1.1.0 and should move with the CLI release.