Skip to content

Commit e59b8e1

Browse files
committed
refactor: use name send instead as it functions as get and post
1 parent 29c49cc commit e59b8e1

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/app_ui/helpers/tasks.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub async fn get_question_details(
1515
client: &reqwest::Client,
1616
_conn: &DatabaseConnection,
1717
) -> TaskResponse {
18-
match QuestionGQLQuery::new(slug).post(client).await {
18+
match QuestionGQLQuery::new(slug).send(client).await {
1919
Ok(resp) => {
2020
let query_response = resp;
2121
TaskResponse::QuestionDetail(Response {
@@ -39,7 +39,7 @@ pub async fn get_editor_data(
3939
client: &reqwest::Client,
4040
_conn: &DatabaseConnection,
4141
) -> TaskResponse {
42-
match QuestionEditorDataQuery::new(slug).post(client).await {
42+
match QuestionEditorDataQuery::new(slug).send(client).await {
4343
Ok(data) => TaskResponse::QuestionEditorData(Response {
4444
request_id,
4545
content: data.data.question,
@@ -109,7 +109,7 @@ pub async fn run_or_submit_question(
109109
}) = &mut run_or_submit_code
110110
{
111111
match graphql::console_panel_config::Query::new(slug.clone())
112-
.post(client)
112+
.send(client)
113113
.await
114114
{
115115
Ok(resp) => {

src/graphql/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub trait GQLLeetcodeQuery: Serialize + Sync {
3030
"https://leetcode.com/graphql".to_string()
3131
}
3232

33-
async fn post(&self, client: &reqwest::Client) -> AppResult<Self::T> {
33+
async fn send(&self, client: &reqwest::Client) -> AppResult<Self::T> {
3434
let request = if self.is_post() {
3535
client.post(self.get_endpoint()).json(&self.get_body())
3636
} else {
@@ -64,9 +64,9 @@ impl RunOrSubmitCode {
6464
client: &reqwest::Client,
6565
body: &impl GQLLeetcodeQuery<T = T>,
6666
) -> AppResult<ParsedResponse> {
67-
let run_response: T = body.post(client).await?;
67+
let run_response: T = body.send(client).await?;
6868
loop {
69-
let status_check = run_response.post(client).await?;
69+
let status_check = run_response.send(client).await?;
7070
let parsed_response = status_check.to_parsed_response()?;
7171
match parsed_response {
7272
ParsedResponse::Pending => {}

src/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub async fn update_database_questions(
1010
database_client: &DatabaseConnection,
1111
) -> AppResult<()> {
1212
let query = QuestionDbQuery::default();
13-
let query_response = query.post(client).await?;
13+
let query_response = query.send(client).await?;
1414
let total_questions = query_response.get_total_questions();
1515
let chunk_size: usize = 100;
1616
let total_range = (0..total_questions).collect::<Vec<_>>();
@@ -19,7 +19,7 @@ pub async fn update_database_questions(
1919
let client_copy = client.clone();
2020
let db_client_copy = database_client.clone();
2121
let resp = QuestionDbQuery::new(chunk.len() as i32, *skip)
22-
.post(&client_copy)
22+
.send(&client_copy)
2323
.await?;
2424
let questions = resp.get_questions();
2525
Question::multi_insert(&db_client_copy, questions).await?;

0 commit comments

Comments
 (0)