refactor: add Ext postfix for APIExt types
This commit is contained in:
@@ -4,9 +4,9 @@ use crate::title::methods::{APIExt, APIMethod};
|
|||||||
fn api_implement(api_names: Vec<String>) {
|
fn api_implement(api_names: Vec<String>) {
|
||||||
for api_name in api_names {
|
for api_name in api_names {
|
||||||
crabtime::output!(
|
crabtime::output!(
|
||||||
pub struct {{api_name}};
|
pub struct {{api_name}}Ext;
|
||||||
|
|
||||||
impl APIExt for {{api_name}} {
|
impl APIExt for {{api_name}}Ext {
|
||||||
const METHOD: APIMethod = APIMethod::{{api_name}};
|
const METHOD: APIMethod = APIMethod::{{api_name}};
|
||||||
type Payload = crate::title::model::{{api_name}};
|
type Payload = crate::title::model::{{api_name}};
|
||||||
type Response = crate::title::model::{{api_name}}Resp;
|
type Response = crate::title::model::{{api_name}}Resp;
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
|
|||||||
#[cfg(feature = "fetchall")]
|
#[cfg(feature = "fetchall")]
|
||||||
Commands::ListAllUser { concurrency } => {
|
Commands::ListAllUser { concurrency } => {
|
||||||
use crate::{cache::PLAYERS, utils::helpers::cached_concurrent_fetch};
|
use crate::{cache::PLAYERS, utils::helpers::cached_concurrent_fetch};
|
||||||
use sdgb_api::title::methods::GetUserPreviewApi;
|
use sdgb_api::title::methods::GetUserPreviewApiExt;
|
||||||
use std::io::BufRead as _;
|
use std::io::BufRead as _;
|
||||||
|
|
||||||
let mut user_ids = Vec::new();
|
let mut user_ids = Vec::new();
|
||||||
@@ -222,8 +222,13 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cached_concurrent_fetch::<GetUserPreviewApi>(user_ids, &client, concurrency, PLAYERS)
|
cached_concurrent_fetch::<GetUserPreviewApiExt>(
|
||||||
.await?;
|
user_ids,
|
||||||
|
&client,
|
||||||
|
concurrency,
|
||||||
|
PLAYERS,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "fetchall")]
|
#[cfg(feature = "fetchall")]
|
||||||
@@ -232,7 +237,7 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
|
|||||||
min_rating,
|
min_rating,
|
||||||
max_rating,
|
max_rating,
|
||||||
} => {
|
} => {
|
||||||
use sdgb_api::title::methods;
|
use sdgb_api::title::methods::GetUserRatingApiExt;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
cache::{PLAYER_B50, PLAYERS},
|
cache::{PLAYER_B50, PLAYERS},
|
||||||
@@ -242,7 +247,7 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
|
|||||||
let mut players: Vec<GetUserPreviewApiResp> = read_cache(PLAYERS)?;
|
let mut players: Vec<GetUserPreviewApiResp> = read_cache(PLAYERS)?;
|
||||||
players.retain(|p| p.player_rating >= min_rating && p.player_rating <= max_rating);
|
players.retain(|p| p.player_rating >= min_rating && p.player_rating <= max_rating);
|
||||||
|
|
||||||
cached_concurrent_fetch::<methods::GetUserRatingApi>(
|
cached_concurrent_fetch::<GetUserRatingApiExt>(
|
||||||
players.iter().map(|p| p.user_id).collect::<Vec<u32>>(),
|
players.iter().map(|p| p.user_id).collect::<Vec<u32>>(),
|
||||||
&client,
|
&client,
|
||||||
concurrency,
|
concurrency,
|
||||||
|
|||||||
Reference in New Issue
Block a user