client

package
v0.0.0-...-36810e9 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDryRun

func GetDryRun() bool

GetDryRun 获取演练模式

func GetFormat

func GetFormat() string

GetFormat 获取输出格式

func GetHost

func GetHost() string

GetHost 从 baseURL 中提取 host 部分

func GetNoTrunc

func GetNoTrunc() bool

GetNoTrunc 获取是否显示完整内容

func PrintResult

func PrintResult(result map[string]interface{}) string

PrintResult 根据格式输出结果

func SetAPIKey

func SetAPIKey(apiKey string)

SetAPIKey 设置全局客户端的 API Key

func SetBaseURL

func SetBaseURL(baseURL string)

SetBaseURL 设置全局客户端的基础 URL

func SetDryRun

func SetDryRun(dry bool)

SetDryRun 设置演练模式

func SetFlags

func SetFlags(flags *pflag.FlagSet)

SetFlags 设置当前命令的 flag 集合,用于区分未设置和显式设为 false 的 bool 过滤参数。

func SetFormat

func SetFormat(format string)

SetFormat 设置输出格式

func SetNoTrunc

func SetNoTrunc(show bool)

SetNoTrunc 设置是否显示完整内容

Types

type Client

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

Client HTTP 客户端

func GetClient

func GetClient() *Client

GetClient 获取全局默认客户端

func NewClient

func NewClient(opts ...Option) *Client

NewClient 创建新的 HTTP 客户端

func (*Client) Call

func (c *Client) Call(ctx context.Context, method string, params interface{}, result interface{}) error

Call 调用 JSON-RPC 方法

type Option

type Option func(*Client)

Option 客户端配置选项

func WithAPIKey

func WithAPIKey(apiKey string) Option

WithAPIKey 设置 API Key

func WithBaseURL

func WithBaseURL(baseURL string) Option

WithBaseURL 设置基础 URL

Jump to

Keyboard shortcuts

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