api

package
v0.0.0-...-4036a8b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package api provides a client for interacting with Dify.AI API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppInfo

type AppInfo struct {
	ID        string      `json:"id"`
	Name      string      `json:"name"`
	UpdatedAt interface{} `json:"updated_at"` // Changed to interface{} to handle both string and numeric types
}

AppInfo represents the basic information about a Dify application

type Client

type Client struct {
	BaseURL    string
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Client represents a Dify API client

func NewClient

func NewClient(baseURL string) *Client

NewClient creates a new Dify API client

func (*Client) DoesDSLExist

func (c *Client) DoesDSLExist(appID string) (bool, error)

DoesDSLExist checks if a DSL exists in Dify for the given app ID

func (*Client) GetAppInfo

func (c *Client) GetAppInfo(appID string) (*AppInfo, error)

GetAppInfo fetches application information from Dify

func (*Client) GetAppList

func (c *Client) GetAppList() ([]AppInfo, error)

GetAppList fetches all applications from Dify

func (*Client) GetDSL

func (c *Client) GetDSL(appID string) ([]byte, error)

GetDSL fetches the DSL for a specific app from Dify

func (*Client) Login

func (c *Client) Login(email, password string) error

Login authenticates with Dify API using email and password

type LoginResponse

type LoginResponse struct {
	Status string `json:"status"`
	Data   struct {
		AccessToken string `json:"access_token"`
	} `json:"data"`
}

LoginResponse represents the response from the login API

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL