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>) {
|
||||
for api_name in api_names {
|
||||
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}};
|
||||
type Payload = crate::title::model::{{api_name}};
|
||||
type Response = crate::title::model::{{api_name}}Resp;
|
||||
|
||||
@@ -203,7 +203,7 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
|
||||
#[cfg(feature = "fetchall")]
|
||||
Commands::ListAllUser { concurrency } => {
|
||||
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 _;
|
||||
|
||||
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)
|
||||
.await?;
|
||||
cached_concurrent_fetch::<GetUserPreviewApiExt>(
|
||||
user_ids,
|
||||
&client,
|
||||
concurrency,
|
||||
PLAYERS,
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
|
||||
#[cfg(feature = "fetchall")]
|
||||
@@ -232,7 +237,7 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
|
||||
min_rating,
|
||||
max_rating,
|
||||
} => {
|
||||
use sdgb_api::title::methods;
|
||||
use sdgb_api::title::methods::GetUserRatingApiExt;
|
||||
|
||||
use crate::{
|
||||
cache::{PLAYER_B50, PLAYERS},
|
||||
@@ -242,7 +247,7 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
|
||||
let mut players: Vec<GetUserPreviewApiResp> = read_cache(PLAYERS)?;
|
||||
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>>(),
|
||||
&client,
|
||||
concurrency,
|
||||
|
||||
Reference in New Issue
Block a user