Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ we should rename this section to "Unreleased" -->

### Breaking Changes

- Removed the `sentry-cli sourcemaps explain` command ([#2947](https://github.com/getsentry/sentry-cli/pull/2947)). The command had been deprecated for some time, since Sentry now has a better in-product debugging flow for source map problems via the "Unminify Code" button, which is displayed on any JavaScript issues which could not be unminified.
- Removed support for the legacy API key authentication method ([#2935](https://github.com/getsentry/sentry-cli/pull/2935)). Sentry CLI now only supports authenticating with Auth Tokens. If you are using API key authentication via any of the following methods, you need to generate and use an [Auth Token](https://docs.sentry.io/account/auth-tokens/), instead:
- `--api-key` CLI flag
- `SENTRY_API_KEY` environment variable
Expand Down
109 changes: 4 additions & 105 deletions src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ use log::{debug, info, warn};
use parking_lot::Mutex;
use regex::{Captures, Regex};
use secrecy::ExposeSecret as _;
use sentry::protocol::{Exception, Values};
use serde::de::DeserializeOwned;
use serde::{Deserialize, Serialize};
use sha1_smol::Digest;
Expand Down Expand Up @@ -286,6 +285,10 @@ impl Api {
}

/// Convenience method that downloads a file into the given file object.
///
/// Currently only used on macOS, but we could make it available on other platforms
/// if needed.
#[cfg(target_os = "macos")]
pub fn download(&self, url: &str, dst: &mut File) -> ApiResult<ApiResponse> {
self.request(Method::Get, url, None)?
.follow_location(true)?
Expand Down Expand Up @@ -551,73 +554,6 @@ impl<'a> AuthenticatedApi<'a> {
self.list_release_files_by_checksum(org, project, release, &[])
}

/// Get a single release file and store it inside provided descriptor.
pub fn get_release_file(
&self,
org: &str,
project: Option<&str>,
version: &str,
file_id: &str,
file_desc: &mut File,
) -> Result<(), ApiError> {
let path = if let Some(project) = project {
format!(
"/projects/{}/{}/releases/{}/files/{}/?download=1",
PathArg(org),
PathArg(project),
PathArg(version),
PathArg(file_id)
)
} else {
format!(
"/organizations/{}/releases/{}/files/{}/?download=1",
PathArg(org),
PathArg(version),
PathArg(file_id)
)
};

let resp = self.api.download(&path, file_desc)?;
if resp.status() == 404 {
resp.convert_rnf(ApiErrorKind::ResourceNotFound)
} else {
Ok(())
}
}

/// Get a single release file metadata.
pub fn get_release_file_metadata(
&self,
org: &str,
project: Option<&str>,
version: &str,
file_id: &str,
) -> ApiResult<Option<Artifact>> {
let path = if let Some(project) = project {
format!(
"/projects/{}/{}/releases/{}/files/{}/",
PathArg(org),
PathArg(project),
PathArg(version),
PathArg(file_id)
)
} else {
format!(
"/organizations/{}/releases/{}/files/{}/",
PathArg(org),
PathArg(version),
PathArg(file_id)
)
};

let resp = self.get(&path)?;
if resp.status() == 404 {
Ok(None)
} else {
resp.convert()
}
}

/// Deletes a single release file. Returns `true` if the file was
/// deleted or `false` otherwise.
pub fn delete_release_file(
Expand Down Expand Up @@ -1302,37 +1238,6 @@ impl<'a> AuthenticatedApi<'a> {
Ok(rv)
}

/// Looks up an event, which was already processed by Sentry and returns it.
/// If it does not exist `None` will be returned.
pub fn get_event(
&self,
org: &str,
project: Option<&str>,
event_id: &str,
) -> ApiResult<Option<ProcessedEvent>> {
let path = if let Some(project) = project {
format!(
"/projects/{}/{}/events/{}/json/",
PathArg(org),
PathArg(project),
PathArg(event_id)
)
} else {
format!(
"/organizations/{}/events/{}/json/",
PathArg(org),
PathArg(event_id)
)
};

let resp = self.get(&path)?;
if resp.status() == 404 {
Ok(None)
} else {
resp.convert()
}
}

fn get_region_url(&self, org: &str) -> ApiResult<String> {
self.get(&format!("/organizations/{org}/region/"))
.and_then(|resp| resp.convert::<Region>())
Expand Down Expand Up @@ -2383,12 +2288,6 @@ pub struct ProcessedEvent {
#[expect(dead_code)]
pub project: Option<u64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub release: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub dist: Option<String>,
#[serde(default, skip_serializing_if = "Values::is_empty")]
pub exception: Values<Exception>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub user: Option<ProcessedEventUser>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<ProcessedEventTag>>,
Expand Down
Loading
Loading