-
Notifications
You must be signed in to change notification settings - Fork 645
Add POST /api/v1/crates/{name}/{version}/rebuild_docs
API endpoint
#11169
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
6 commits
Select commit
Hold shift + click to select a range
948e79d
Add `POST /api/v1/crates/{name}/{version}/rebuild_docs` API endpoint
syphar a29c7ed
docs.rs: Simplify `base_url` argument
Turbo87 e099f8f
docs.rs: Extract `DEFAULT_BASE_URL` constant
Turbo87 ca72085
bin/background-worker: Simplify `RealDocsRsClient` construction
Turbo87 cc8d771
controllers/version/docs: Simplify return type
Turbo87 dc403b0
controllers/version/docs: Simplify error handling
Turbo87 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,31 @@ | ||
[package] | ||
name = "crates_io_docs_rs" | ||
version = "0.0.0" | ||
license = "MIT OR Apache-2.0" | ||
edition = "2024" | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[features] | ||
mock = ["dep:mockall"] | ||
|
||
[dependencies] | ||
anyhow = "=1.0.98" | ||
async-trait = "=0.1.88" | ||
crates_io_env_vars = { path = "../crates_io_env_vars" } | ||
http = "=1.3.1" | ||
mockall = { version = "=0.13.1", optional = true } | ||
reqwest = { version = "=0.12.15", features = ["json"] } | ||
serde = { version = "=1.0.219", features = ["derive"] } | ||
thiserror = "=2.0.12" | ||
tracing = "=0.1.41" | ||
url = "=2.5.4" | ||
|
||
[dev-dependencies] | ||
claims = "=0.8.0" | ||
serde_json = "=1.0.140" | ||
mockito = "=1.7.0" | ||
test-case = "=3.3.1" | ||
tokio = { version = "=1.45.0", features = ["macros", "rt-multi-thread"] } | ||
tracing-subscriber = "=0.3.19" |
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,12 @@ | ||
# crates_io_docs_rs | ||
|
||
This package implements functionality for interacting with the docs.rs API. | ||
|
||
It contains a `DocsRsClient` trait that defines the supported operations, that | ||
the crates.io codebase needs to interact with docs.rs. The `RealDocsRsClient` | ||
struct is an implementation of this trait that uses the `reqwest` crate to | ||
perform the actual HTTP requests. | ||
|
||
If the `mock` feature is enabled, a `MockDocsRsClient` struct is available, | ||
which can be used for testing purposes. This struct is generated automatically | ||
by the [`mockall`](https://docs.rs/mockall) crate. |
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,19 @@ | ||
use anyhow::{Result, anyhow}; | ||
use crates_io_docs_rs::{DEFAULT_BASE_URL, DocsRsClient, RealDocsRsClient}; | ||
use std::env; | ||
use url::Url; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<()> { | ||
tracing_subscriber::fmt::init(); | ||
|
||
let access_token = env::args() | ||
.nth(1) | ||
.ok_or_else(|| anyhow!("Missing access token"))?; | ||
|
||
let docs_rs = RealDocsRsClient::new(Url::parse(DEFAULT_BASE_URL)?, access_token); | ||
|
||
docs_rs.rebuild_docs("empty-library", "1.0.0").await?; | ||
|
||
Ok(()) | ||
} |
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.