Skip to content
This repository was archived by the owner on Jul 7, 2024. It is now read-only.

Commit 8c862bd

Browse files
committed
use get_graphql more
1 parent 64962b1 commit 8c862bd

File tree

1 file changed

+9
-24
lines changed

1 file changed

+9
-24
lines changed

src/plugins/leetcode.rs

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -108,31 +108,16 @@ impl LeetCode {
108108
.await
109109
}
110110

111-
/// TODO: check if refer is necessary
112-
#[named]
113111
pub async fn get_question_ids_by_tag(&self, slug: &str) -> Result<Response, Error> {
114-
trace!("Requesting {} ref problems...", &slug);
115-
let url = &self.conf.sys.urls.get("graphql").ok_or(Error::NoneError)?;
116-
let mut json: Json = HashMap::new();
117-
json.insert("operationName", "a".to_string());
118-
json.insert("variables", r#"{"slug": "$slug"}"#.replace("$slug", slug));
119-
json.insert(
120-
"query",
121-
"query a($slug: String!) {
122-
topicTag(slug: $slug) {
123-
questions {
124-
questionId
125-
}
126-
}
127-
}".to_owned()
128-
);
129-
130-
let mut req = make_req!(self, url.to_string());
131-
req.mode = Mode::Post(json);
132-
req.refer = Some((self.conf.sys.urls.get("tag").ok_or(Error::NoneError)?).replace("$slug", slug));
133-
req
134-
.send(&self.client)
135-
.await
112+
self.get_graphql("query a {
113+
topicTag(slug: \"$slug\") {
114+
questions {
115+
questionId
116+
}
117+
}
118+
}"
119+
.replace("$slug", slug),
120+
None).await
136121
}
137122

138123
/// Get user info

0 commit comments

Comments
 (0)