Skip to content

Commit

Permalink
fix: remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
mertakman committed Nov 11, 2024
1 parent 1145ea5 commit 8bd86b3
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 39 deletions.
2 changes: 1 addition & 1 deletion examples/messages/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use http::{
header::{AUTHORIZATION, CONTENT_TYPE},
header::CONTENT_TYPE,
HeaderValue,
};
use qstash_rs::{client::QstashClient, message_types::MessageResponseResult};
Expand Down
9 changes: 1 addition & 8 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ impl QstashClient {
}
}

#[derive(Default)]
pub struct QstashClientBuilder {
base_url: Option<Url>,
api_key: Option<String>,
Expand Down Expand Up @@ -64,11 +65,3 @@ impl QstashClientBuilder {
}
}

impl Default for QstashClientBuilder {
fn default() -> Self {
Self {
base_url: None,
api_key: None,
}
}
}
6 changes: 3 additions & 3 deletions src/dead_letter_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl QstashClient {
.await?
.json::<DLQMessagesList>()
.await
.map_err(|e| QstashError::ResponseBodyParseError(e))?;
.map_err(QstashError::ResponseBodyParseError)?;

Ok(response)
}
Expand All @@ -45,7 +45,7 @@ impl QstashClient {
.await?
.json::<DLQMessage>()
.await
.map_err(|e| QstashError::ResponseBodyParseError(e))?;
.map_err(QstashError::ResponseBodyParseError)?;

Ok(response)
}
Expand Down Expand Up @@ -84,7 +84,7 @@ impl QstashClient {
.await?
.json::<DLQDeleteMessagesResponse>()
.await
.map_err(|e| QstashError::ResponseBodyParseError(e))?;
.map_err(QstashError::ResponseBodyParseError)?;

Ok(response)
}
Expand Down
2 changes: 1 addition & 1 deletion src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl QstashClient {
.await?
.json::<EventsResponse>()
.await
.map_err(|e| QstashError::ResponseBodyParseError(e))?;
.map_err(QstashError::ResponseBodyParseError)?;

Ok(response)
}
Expand Down
2 changes: 1 addition & 1 deletion src/events_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ mod tests {
#[test]
fn test_deserialize_minimal_event() {
let json_str = json!({
"time": 1645564800000 as i64,
"time": 1645564800000_i64,
"messageId": "msg_123",
"header": {},
"body": "SGVsbG8=",
Expand Down
6 changes: 3 additions & 3 deletions src/llm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ impl QstashClient {

match chat_completion_request.stream {
Some(true) => {
return Ok(ChatCompletionResponse::Stream(StreamResponse::new(
Ok(ChatCompletionResponse::Stream(StreamResponse::new(
response,
)));
)))
}
_ => {
let response = response
.json::<DirectResponse>()
.await
.map_err(|e| QstashError::ResponseBodyParseError(e))?;
.map_err(QstashError::ResponseBodyParseError)?;
Ok(ChatCompletionResponse::Direct(response))
}
}
Expand Down
26 changes: 13 additions & 13 deletions src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl QstashClient {
.await?
.json::<MessageResponseResult>()
.await
.map_err(|e| QstashError::ResponseBodyParseError(e))?;
.map_err(QstashError::ResponseBodyParseError)?;

Ok(response)
}
Expand Down Expand Up @@ -58,7 +58,7 @@ impl QstashClient {
.await?
.json::<MessageResponseResult>()
.await
.map_err(|e| QstashError::ResponseBodyParseError(e))?;
.map_err(QstashError::ResponseBodyParseError)?;

Ok(response)
}
Expand All @@ -83,7 +83,7 @@ impl QstashClient {
.await?
.json::<Vec<MessageResponseResult>>()
.await
.map_err(|e| QstashError::ResponseBodyParseError(e))?;
.map_err(QstashError::ResponseBodyParseError)?;

Ok(response)
}
Expand All @@ -102,7 +102,7 @@ impl QstashClient {
.await?
.json::<Message>()
.await
.map_err(|e| QstashError::ResponseBodyParseError(e))?;
.map_err(QstashError::ResponseBodyParseError)?;

Ok(response)
}
Expand Down Expand Up @@ -310,7 +310,7 @@ mod tests {
});
let enqueue_mock = server.mock(|when, then| {
when.method(POST)
.path(&format!(
.path(format!(
"/v2/enqueue/{}/https://example.com/enqueue",
queue_name
))
Expand Down Expand Up @@ -346,7 +346,7 @@ mod tests {
let body = b"{\"key\":\"value\"}".to_vec();
let enqueue_mock = server.mock(|when, then| {
when.method(POST)
.path(&format!(
.path(format!(
"/v2/enqueue/{}/https://example.com/enqueue",
queue_name
))
Expand Down Expand Up @@ -382,7 +382,7 @@ mod tests {
let body = b"{\"key\":\"value\"}".to_vec();
let enqueue_mock = server.mock(|when, then| {
when.method(POST)
.path(&format!(
.path(format!(
"/v2/enqueue/{}/https://example.com/enqueue",
queue_name
))
Expand Down Expand Up @@ -600,7 +600,7 @@ mod tests {
};
let get_mock = server.mock(|when, then| {
when.method(GET)
.path(&format!("/v2/messages/{}", message_id))
.path(format!("/v2/messages/{}", message_id))
.header("Authorization", "Bearer test_api_key");
then.status(StatusCode::OK.as_u16())
.header("content-type", "application/json")
Expand All @@ -625,7 +625,7 @@ mod tests {
let message_id = "msg123";
let get_mock = server.mock(|when, then| {
when.method(GET)
.path(&format!("/v2/messages/{}", message_id))
.path(format!("/v2/messages/{}", message_id))
.header("Authorization", "Bearer test_api_key");
then.status(StatusCode::TOO_MANY_REQUESTS.as_u16())
.header("RateLimit-Limit", "1000")
Expand All @@ -652,7 +652,7 @@ mod tests {
let message_id = "msg123";
let get_mock = server.mock(|when, then| {
when.method(GET)
.path(&format!("/v2/messages/{}", message_id))
.path(format!("/v2/messages/{}", message_id))
.header("Authorization", "Bearer test_api_key");
then.status(StatusCode::OK.as_u16())
.header("content-type", "application/json")
Expand All @@ -678,7 +678,7 @@ mod tests {
let message_id = "msg123";
let cancel_mock = server.mock(|when, then| {
when.method(DELETE)
.path(&format!("/v2/messages/{}", message_id))
.path(format!("/v2/messages/{}", message_id))
.header("Authorization", "Bearer test_api_key");
then.status(StatusCode::NO_CONTENT.as_u16());
});
Expand All @@ -699,7 +699,7 @@ mod tests {
let message_id = "msg123";
let cancel_mock = server.mock(|when, then| {
when.method(DELETE)
.path(&format!("/v2/messages/{}", message_id))
.path(format!("/v2/messages/{}", message_id))
.header("Authorization", "Bearer test_api_key");
then.status(StatusCode::TOO_MANY_REQUESTS.as_u16())
.header("RateLimit-Limit", "1000")
Expand Down Expand Up @@ -832,7 +832,7 @@ mod tests {
});
let enqueue_mock = server.mock(|when, then| {
when.method(POST)
.path(&format!(
.path(format!(
"/v2/enqueue/{}/https://example.com/enqueue",
queue_name
))
Expand Down
4 changes: 2 additions & 2 deletions src/queues.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl QstashClient {
.await?
.json::<Vec<Queue>>()
.await
.map_err(|e| QstashError::ResponseBodyParseError(e))?;
.map_err(QstashError::ResponseBodyParseError)?;

Ok(response)
}
Expand All @@ -67,7 +67,7 @@ impl QstashClient {
.await?
.json::<Queue>()
.await
.map_err(|e| QstashError::ResponseBodyParseError(e))?;
.map_err(QstashError::ResponseBodyParseError)?;

Ok(response)
}
Expand Down
6 changes: 3 additions & 3 deletions src/schedules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl QstashClient {
.await?
.json::<CreateScheduleResponse>()
.await
.map_err(|e| QstashError::ResponseBodyParseError(e))?;
.map_err(QstashError::ResponseBodyParseError)?;

Ok(response)
}
Expand All @@ -50,7 +50,7 @@ impl QstashClient {
.await?
.json::<Schedule>()
.await
.map_err(|e| QstashError::ResponseBodyParseError(e))?;
.map_err(QstashError::ResponseBodyParseError)?;

Ok(response)
}
Expand All @@ -69,7 +69,7 @@ impl QstashClient {
.await?
.json::<Vec<Schedule>>()
.await
.map_err(|e| QstashError::ResponseBodyParseError(e))?;
.map_err(QstashError::ResponseBodyParseError)?;

Ok(response)
}
Expand Down
4 changes: 2 additions & 2 deletions src/signing_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl QstashClient {
.await?
.json::<Signature>()
.await
.map_err(|e| QstashError::ResponseBodyParseError(e))?;
.map_err(QstashError::ResponseBodyParseError)?;

Ok(response)
}
Expand All @@ -38,7 +38,7 @@ impl QstashClient {
.await?
.json::<Signature>()
.await
.map_err(|e| QstashError::ResponseBodyParseError(e))?;
.map_err(QstashError::ResponseBodyParseError)?;

Ok(response)
}
Expand Down
4 changes: 2 additions & 2 deletions src/url_groups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl QstashClient {
.await?
.json::<UrlGroup>()
.await
.map_err(|e| QstashError::ResponseBodyParseError(e))?;
.map_err(QstashError::ResponseBodyParseError)?;

Ok(response)
}
Expand All @@ -58,7 +58,7 @@ impl QstashClient {
.await?
.json::<Vec<UrlGroup>>()
.await
.map_err(|e| QstashError::ResponseBodyParseError(e))?;
.map_err(QstashError::ResponseBodyParseError)?;

Ok(response)
}
Expand Down

0 comments on commit 8bd86b3

Please sign in to comment.