client

package
v0.0.0-...-d97e320 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package client 提供无需 CGO 的 T2I HTTP 客户端。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client 通过 HTTP 请求图片,可被多个 goroutine 共享。

func New

func New(config Config) (*Client, error)

New 创建持有配置快照和独立连接池的客户端。

func (*Client) Close

func (c *Client) Close() error

Close 释放此客户端的空闲连接;共享服务保持运行。

func (*Client) Render

func (c *Client) Render(ctx context.Context, request t2i.Request) (t2i.Result, error)

Render 提交与本地 Renderer 相同的请求,返回图片和实际引擎信息。

type Config

type Config struct {
	Endpoint string
	Token    string
}

Config 指定独立服务地址与可选 Bearer 凭据。

type HTTPError

type HTTPError struct {
	StatusCode int
	Body       string
}

HTTPError 保留服务响应状态和完整错误正文。

func (*HTTPError) Error

func (e *HTTPError) Error() string

Jump to

Keyboard shortcuts

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