Repository navigation
Rewrite for the v1 API #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
5396b4d
chore: scaffold the v1 rewrite
Zingzy 20f3bf9
feat: transport core with retries and typed errors
Zingzy 8455dff
feat: v1 resource surface
Zingzy c5ae3ac
feat: sign in with spoo behind the oauth feature
Zingzy cef77ad
test: wiremock suite asserting wire bytes
Zingzy 4310184
docs: README, migration guide, examples, MIT license
Zingzy c11680d
ci: full gate and trusted publishing
Zingzy 878ddfb
fix: stable filter ordering and wasm transport retries
Zingzy 668b577
fix: silence the unused timeout field on wasm
Zingzy c18d4a2
fix: wire getrandom's wasm backend for the oauth feature
Zingzy 3f764c4
fix: harden the transport
Zingzy 8ca8bfb
fix: redact tokens and unblock the session lock
Zingzy d1852c8
docs: review follow-ups
Zingzy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| RUSTFLAGS: -D warnings | ||
|
|
||
| jobs: | ||
| fmt: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| components: rustfmt | ||
| - run: cargo fmt --check | ||
|
|
||
| clippy: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| components: clippy | ||
| - uses: Swatinem/rust-cache@v2 | ||
| - run: cargo clippy --all-features --all-targets -- -D warnings | ||
| - run: cargo clippy --no-default-features --all-targets -- -D warnings | ||
|
|
||
| test: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| toolchain: [stable, "1.85"] | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - uses: dtolnay/rust-toolchain@master | ||
| with: | ||
| toolchain: ${{ matrix.toolchain }} | ||
| - uses: Swatinem/rust-cache@v2 | ||
| - uses: taiki-e/install-action@nextest | ||
| - run: cargo nextest run --all-features | ||
| # nextest does not run doctests; the README compiles here. | ||
| - run: cargo test --all-features --doc | ||
|
|
||
| features: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| - uses: Swatinem/rust-cache@v2 | ||
| - run: cargo check --no-default-features | ||
| - run: cargo check --no-default-features --features oauth | ||
| - run: cargo check --no-default-features --features tracing | ||
| - run: cargo check --all-features | ||
| - run: cargo check --no-default-features --features native-tls | ||
|
|
||
| wasm: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| targets: wasm32-unknown-unknown | ||
| - uses: Swatinem/rust-cache@v2 | ||
| - run: cargo check --target wasm32-unknown-unknown | ||
| # getrandom's wasm backend is chosen by the final binary via RUSTFLAGS; | ||
| # this check builds the way a wasm consumer of the oauth feature must. | ||
| - run: cargo check --target wasm32-unknown-unknown --features oauth | ||
| env: | ||
| RUSTFLAGS: -D warnings --cfg getrandom_backend="wasm_js" | ||
|
|
||
| docs: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| - uses: Swatinem/rust-cache@v2 | ||
| - run: cargo doc --all-features --no-deps | ||
| env: | ||
| RUSTDOCFLAGS: -D warnings | ||
|
|
||
| deny: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - uses: EmbarkStudios/cargo-deny-action@v2 | ||
|
|
||
| semver: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - uses: obi1kenobi/cargo-semver-checks-action@v2 | ||
| with: | ||
| feature-group: all-features | ||
|
|
||
| spec-drift: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - name: Compare committed openapi.json with the backend's | ||
| run: | | ||
| curl -fsSL https://raw.githubusercontent.com/spoo-me/spoo/main/openapi.json -o upstream-openapi.json | ||
| diff -q openapi.json upstream-openapi.json | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| name: Release | ||
|
|
||
| # Publishes to crates.io via Trusted Publishing (OIDC) when a GitHub | ||
| # release is published. Requires the crates.io trusted-publisher | ||
| # configuration for this repository. | ||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| environment: release | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| - run: cargo test --all-features | ||
| - uses: rust-lang/crates-io-auth-action@v1 | ||
| id: auth | ||
| - run: cargo publish | ||
| env: | ||
| CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1 @@ | ||
| /target | ||
| Cargo.lock |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # Changelog | ||
|
|
||
| ## 0.2.0 (unreleased) | ||
|
|
||
| Rewrite against the spoo.me v1 API. Every endpoint the 0.1.x crate called | ||
| was removed in the platform's v1 overhaul, so this is a clean break; see | ||
| MIGRATION.md. The design language of the original crate by | ||
| [rdni](https://github.com/rdni) carries over: consuming builders, layered | ||
| errors, documentation on every public item. | ||
|
|
||
| - v1 coverage: shorten (alphanumeric and emoji aliases), alias check, link | ||
| management (list/get/get-by-address/update/set-status/delete), bulk | ||
| delete/status/expiry/domain, claiming anonymous links, account and | ||
| per-link statistics, streaming exports, public stats and previews, the | ||
| emoji catalogue (ETag-cached), identity read. | ||
| - Authentication: API keys, anonymous mode, and Sign in with Spoo behind | ||
| the `oauth` feature (PKCE, device-code exchange, self-refreshing | ||
| single-flight sessions). | ||
| - Tri-state PATCH updates: untouched fields keep their stored values, | ||
| `remove_*` methods clear a setting explicitly. | ||
| - Typed errors with the backend's machine-readable codes, rate-limit | ||
| metadata, and predicates (`is_not_found`, `is_rate_limited`, | ||
| `is_blocked`, `is_password_required`). | ||
| - Automatic retries with jittered backoff capped at 8 seconds, honoring | ||
| both legal `Retry-After` forms; POST and PATCH replay only where the | ||
| server provably did no work. | ||
| - Server-suggested export filenames are sanitized to safe bare names. | ||
| - Raw typed passthroughs (`client.get/post/patch/delete`) for endpoints the | ||
| SDK does not cover yet. | ||
| - `#![forbid(unsafe_code)]`, panic-free library paths enforced by lints, | ||
| wasm32 support, `stream`/`oauth`/`tracing`/`native-tls` features. | ||
| - License changed to MIT (0.1.x releases remain Apache-2.0). | ||
|
|
||
| ## 0.1.1 and earlier | ||
|
|
||
| The original crate by rdni, targeting the pre-2026 spoo.me API | ||
| (form-encoded shorten/stats/export endpoints). Apache-2.0. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.