mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 09:28:11 +00:00
refactor
This commit is contained in:
1 parent
853047433b
commit
fad7931b26
4 files changed
+5
-37
No files matched your search
+2
-27
@@ -1,12 +1,6 @@
|
||||
use crate::error::classify_fal_error::classify_fal_error;
|
||||
use crate::error::fal_error_plus::FalErrorPlus;
|
||||
use crate::requests::api::image::angle::flux_2_lora_edit_image_angle::http::Flux2LoraEditImageAngleOutput;
|
||||
use crate::requests::core_api::fal_request::FalRequest;
|
||||
use crate::requests::core_api::webhook_response::WebhookResponse;
|
||||
use crate::requests::http::image::angle::http_flux_2_lora_edit_image_angle::{http_flux_2_lora_edit_image_angle, Flux2LoraEditImageAngleInput};
|
||||
use crate::requests::api::image::angle::flux_2_lora_edit_image_angle::raw_request::{Flux2LoraEditImageAngleInput, Flux2LoraEditImageAngleOutput};
|
||||
use crate::requests::traits::fal_endpoint_trait::FalEndpoint;
|
||||
use crate::requests::traits::fal_request_cost_calculator_trait::FalRequestCostCalculator;
|
||||
use reqwest::IntoUrl;
|
||||
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
@@ -51,10 +45,6 @@ impl FalEndpoint for Flux2LoraEditImageAngleRequest {
|
||||
type RawRequest = Flux2LoraEditImageAngleInput;
|
||||
type RawResponse = Flux2LoraEditImageAngleOutput;
|
||||
|
||||
fn get_endpoint() -> &'static str {
|
||||
ENDPOINT
|
||||
}
|
||||
|
||||
fn to_raw_request(&self) -> Result<Self::RawRequest, FalErrorPlus> {
|
||||
let num_images = self.num_images
|
||||
.map(|n| match n {
|
||||
@@ -75,7 +65,7 @@ impl FalEndpoint for Flux2LoraEditImageAngleRequest {
|
||||
})
|
||||
.map(|s| s.to_string());
|
||||
|
||||
Ok(Flux2LoraEditImageAngleInput {
|
||||
Ok(Self::RawRequest {
|
||||
image_urls: self.image_urls.clone(),
|
||||
horizontal_angle: self.horizontal_angle,
|
||||
vertical_angle: self.vertical_angle,
|
||||
@@ -92,24 +82,9 @@ impl FalEndpoint for Flux2LoraEditImageAngleRequest {
|
||||
seed: None,
|
||||
})
|
||||
}
|
||||
|
||||
fn to_request(&self) -> Result<FalRequest<Self::RawRequest, Self::RawResponse>, FalErrorPlus> {
|
||||
let fal_request = FalRequest::new(ENDPOINT, self.to_raw_request()?);
|
||||
Ok(fal_request)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub async fn enqueue_flux_2_lora_edit_image_angle_webhook<R: IntoUrl>(
|
||||
args: EnqueueFlux2LoraEditImageAngleArgs<'_, R>
|
||||
) -> Result<WebhookResponse, FalErrorPlus> {
|
||||
|
||||
let req = args.request;
|
||||
|
||||
|
||||
result.map_err(|err| classify_fal_error(err))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::creds::fal_api_key::FalApiKey;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
use crate::requests::api::image::angle::flux_2_lora_edit_image_angle::binding::{Flux2LoraAngleNumImages, Flux2LoraEditImageAngleRequest};
|
||||
use crate::requests::api::image::angle::flux_2_lora_edit_image_angle::api_request::{Flux2LoraAngleNumImages, Flux2LoraEditImageAngleRequest};
|
||||
use crate::requests::traits::fal_request_cost_calculator_trait::{FalRequestCostCalculator, UsdCents};
|
||||
|
||||
impl FalRequestCostCalculator for Flux2LoraEditImageAngleRequest {
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
pub mod binding;
|
||||
mod http;
|
||||
pub mod api_request;
|
||||
mod raw_request;
|
||||
mod cost;
|
||||
-7
@@ -1,4 +1,3 @@
|
||||
use crate::requests::core_api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
@@ -74,9 +73,3 @@ pub struct Flux2LoraEditImageAngleOutput {
|
||||
pub seed: u64,
|
||||
pub prompt: Option<String>,
|
||||
}
|
||||
|
||||
pub fn http_flux_2_lora_edit_image_angle(
|
||||
params: Flux2LoraEditImageAngleInput,
|
||||
) -> FalRequest<Flux2LoraEditImageAngleInput, Flux2LoraEditImageAngleOutput> {
|
||||
FalRequest::new(, params)
|
||||
}
|
||||
Reference in new issue
Block a user