client

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppCredentialConfig

type AppCredentialConfig struct {
	ClientId     string `json:"clientKey" yaml:"clientKey"`       //自建应用appKey; 三方应用suiteKey
	ClientSecret string `json:"clientSecret" yaml:"clientSecret"` //自建应用appSecret; 三方应用suiteSecret
}

应用秘钥信息

func NewAppCredentialConfig

func NewAppCredentialConfig(clientId, clientSecret string) *AppCredentialConfig

func (*AppCredentialConfig) Valid

func (c *AppCredentialConfig) Valid() error

type ClientOption

type ClientOption func(*StreamClient)

func WithAppCredential

func WithAppCredential(cred *AppCredentialConfig) ClientOption

func WithAutoReconnect

func WithAutoReconnect(autoReconnect bool) ClientOption

func WithExtras

func WithExtras(extras map[string]string) ClientOption

func WithOpenApiHost

func WithOpenApiHost(host string) ClientOption

func WithProxy

func WithProxy(proxy string) ClientOption

func WithSubscription

func WithSubscription(stype, stopic string, frameHandler handler.IFrameHandler) ClientOption

func WithUserAgent

func WithUserAgent(ua *UserAgentConfig) ClientOption

type StreamClient

type StreamClient struct {
	AppCredential *AppCredentialConfig
	UserAgent     *UserAgentConfig
	AutoReconnect bool
	// contains filtered or unexported fields
}

func NewStreamClient

func NewStreamClient(options ...ClientOption) *StreamClient

func (*StreamClient) CheckConfigValid

func (cli *StreamClient) CheckConfigValid() error

func (*StreamClient) Close

func (cli *StreamClient) Close()

func (*StreamClient) GetConnectionEndpoint

func (cli *StreamClient) GetConnectionEndpoint(ctx context.Context) (*payload.ConnectionEndpointResponse, error)

func (*StreamClient) GetHandler

func (cli *StreamClient) GetHandler(stype, stopic string) (handler.IFrameHandler, error)

func (*StreamClient) OnDisconnect

func (cli *StreamClient) OnDisconnect(ctx context.Context, df *payload.DataFrame) (*payload.DataFrameResponse, error)

func (*StreamClient) OnPing

func (*StreamClient) RegisterAllEventRouter

func (cli *StreamClient) RegisterAllEventRouter(frameHandler handler.IFrameHandler)

所有事件的注册函数

func (*StreamClient) RegisterCallbackRouter

func (cli *StreamClient) RegisterCallbackRouter(topic string, frameHandler handler.IFrameHandler)

callback类型注册函数

func (*StreamClient) RegisterCardCallbackRouter

func (cli *StreamClient) RegisterCardCallbackRouter(messageHandler card.ICardCallbackHandler)

互动卡片的注册函数

func (*StreamClient) RegisterChatBotCallbackRouter

func (cli *StreamClient) RegisterChatBotCallbackRouter(messageHandler chatbot.IChatBotMessageHandler)

聊天机器人的注册函数

func (*StreamClient) RegisterEventRouter

func (cli *StreamClient) RegisterEventRouter(topic string, frameHandler handler.IFrameHandler)

事件类型的注册函数

func (*StreamClient) RegisterPluginCallbackRouter

func (cli *StreamClient) RegisterPluginCallbackRouter(messageHandler plugin.IPluginMessageHandler)

AI插件的注册函数

func (*StreamClient) RegisterRouter

func (cli *StreamClient) RegisterRouter(stype, stopic string, frameHandler handler.IFrameHandler)

通用注册函数

func (*StreamClient) SendDataFrameResponse

func (cli *StreamClient) SendDataFrameResponse(ctx context.Context, resp *payload.DataFrameResponse) error

返回正常数据包

func (*StreamClient) Start

func (cli *StreamClient) Start(ctx context.Context) error

type UserAgentConfig

type UserAgentConfig struct {
	UserAgent string `json:"user_agent"`
}

UA信息

func NewDingtalkGoSDKUserAgent

func NewDingtalkGoSDKUserAgent() *UserAgentConfig

func (*UserAgentConfig) Valid

func (c *UserAgentConfig) Valid() error

Jump to

Keyboard shortcuts

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