pub struct ClientBuilder { /* private fields */ }Expand description
A builder for creating a ComfyUIClient instance.
This builder helps initialize the client with the provided base URL and sets up a websocket connection to stream events.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn new(base_url: impl IntoUrl) -> ClientResult<Self>
pub fn new(base_url: impl IntoUrl) -> ClientResult<Self>
Creates a new ClientBuilder instance.
§Parameters
base_url: The base URL of the ComfyUI service.
§Returns
A new instance of ClientBuilder wrapped in a ClientResult, or an
error if the URL is invalid.
Sourcepub async fn build(self) -> ClientResult<(ComfyUIClient, EventStream)>
pub async fn build(self) -> ClientResult<(ComfyUIClient, EventStream)>
Builds the ComfyUIClient along with an associated EventStream.
This method establishes a websocket connection and spawns an asynchronous task to process incoming messages.
§Returns
A tuple containing the ComfyUIClient and EventStream on success,
or an error.
Sourcepub async fn build_only_http(self) -> ClientResult<ComfyUIClient>
pub async fn build_only_http(self) -> ClientResult<ComfyUIClient>
Builds a ComfyUIClient instance configured for HTTP-only
communication.
This method initializes the client without establishing a websocket connection, enabling you to interact with the ComfyUI service using only HTTP (REST) requests.
§Returns
A ComfyUIClient instance on success, or an error.