Module client

Source
Expand description

This module contains the implementation of the Dify client.

The client module provides a Client struct that represents a client for interacting with the Dify API. It also includes a Config struct that holds the configuration for the client. The client supports creating requests, executing them, and returning the response. Additionally, it provides methods for creating form requests and handling multipart data.

§Examples

Creating a new client with default configuration:

use dify_client::client::Client;

let client = Client::new("https://api.dify.ai", "API_KEY");

Creating a new client with custom configuration:

use dify_client::client::{Client, Config};
use std::time::Duration;

let config = Config {
    base_url: "https://api.dify.ai".into(),
    api_key: "API_KEY".into(),
    timeout: Duration::from_secs(30),
};

let client = Client::new_with_config(config);

Structs§

Client
The Client struct represents a client for interacting with the Dify API.
Config
The configuration for the Dify client.