protocol

package
v0.0.0-...-116c032 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2025 License: GPL-3.0 Imports: 1 Imported by: ? 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

Index

Constants

View Source
const (
	GetLatestEventsAction     = "get_latest_events"
	GetSupportedActionsAction = "get_supported_actions"
	GetStatusAction           = "get_status"
	GetVersionAction          = "get_version"

	SendMessageAction = "send_message"

	GetUserInfoAction = "get_user_info"

	CreateChannelAction  = "create_channel"
	GetChannelInfoAction = "get_channel_info"
	GetChannelListAction = "get_channel_list"
)

Variables

View Source
var ErrAccessDenied = NewError(60007, "access denied")

ErrAccessDenied Access Denied

View Source
var ErrBadHandler = NewError(20001, "bad handler")

ErrBadHandler Response status not set correctly, etc.

View Source
var ErrBadParam = NewError(10003, "bad parameter")

ErrBadParam Missing parameter or wrong parameter type

View Source
var ErrBadRequest = NewError(10001, "bad request")

ErrBadRequest Formatting errors (including implementations that do not support MessagePack), missing required fields, or incorrect field types

View Source
var ErrBadSegmentData = NewError(10007, "bad segment data")

ErrBadSegmentData The Chatbot implementation does not implement the semantics of this parameter

View Source
var ErrBadSegmentType = NewError(10006, "bad segment type")

ErrBadSegmentType Missing parameter or wrong parameter type

View Source
var ErrDatabaseError = NewError(31001, "database error")

ErrDatabaseError Such as database query failure

View Source
var ErrDatabaseReadError = NewError(31002, "database read error")

ErrDatabaseReadError Such as database read failure

View Source
var ErrDatabaseWriteError = NewError(31003, "database write error")

ErrDatabaseWriteError Such as database write failure

View Source
var ErrEmitEventError = NewError(37001, "emit event error")

ErrEmitEventError Emit event error

View Source
var ErrFilesystemError = NewError(32001, "filesystem error")

ErrFilesystemError If reading or writing a file fails, etc.

View Source
var ErrFlagError = NewError(60003, "flag error")

ErrFlagError Flag error

View Source
var ErrFlagExpired = NewError(60004, "flag expired")

ErrFlagExpired Flag expired

View Source
var ErrIAmTired = NewError(36001, "i am tired")

ErrIAmTired A Chatbot realizes the decision to strike.

View Source
var ErrInternalHandler = NewError(20002, "internal handler")

ErrInternalHandler An uncaught and unexpected exception has occurred within the Chatbot implementation.

View Source
var ErrInternalServerError = NewError(10000, "internal server error")

ErrInternalServerError Internal server error

View Source
var ErrLoginError = NewError(35001, "login error")

ErrLoginError Such as trying to send a message to a non-existent user

View Source
var ErrMethodNotAllowed = NewError(10008, "invalid http method")

ErrMethodNotAllowed Invalid HTTP method

View Source
var ErrNetworkError = NewError(33001, "network error")

ErrNetworkError e.g. failed to download a file, etc.

View Source
var ErrNotAuthorized = NewError(60005, "not authorized")

ErrNotAuthorized Not authorized

View Source
var ErrNotFound = NewError(10009, "not found")

ErrNotFound not found

View Source
var ErrOAuthError = NewError(60006, "oauth error")

ErrOAuthError OAuth error

View Source
var ErrParamVerificationFailed = NewError(10031, "parameter verification failed")

ErrParamVerificationFailed Missing parameter or wrong parameter type

View Source
var ErrPlatformError = NewError(34001, "platform error")

ErrPlatformError e.g. failure to send messages due to bot platform limitations, etc.

View Source
var ErrSendMessageFailed = NewError(60002, "send message failed")

ErrSendMessageFailed Failed to send a message

View Source
var ErrShutdownError = NewError(38001, "shutdown error")

ErrShutdownError Shutdown error

View Source
var ErrTokenError = NewError(60001, "missing, invalid or expired access token")

ErrTokenError missing, invalid or expired access token

View Source
var ErrUnknownSelf = NewError(10102, "unknown self")

ErrUnknownSelf The bot account specified by the action request does not exist

View Source
var ErrUnsupported = NewError(10004, "unsupported")

ErrUnsupported The Chatbot implementation does not implement the semantics of this parameter

View Source
var ErrUnsupportedAction = NewError(10002, "unsupported action")

ErrUnsupportedAction The Chatbot implementation does not implement this action

View Source
var ErrUnsupportedSegment = NewError(10005, "unsupported segment")

ErrUnsupportedSegment The Chatbot implementation does not implement this segment type.

View Source
var ErrWhoAmI = NewError(10101, "who am i")

ErrWhoAmI Chatbot implements support for multiple bot accounts on a single Chatbot Connect connection, but the action request does not specify the account to be used

Functions

This section is empty.

Types

type Error

type Error struct {
	Code    int64  `json:"code"`
	Message string `json:"message"`
}

func NewError

func NewError(code int64, message string) *Error

func (Error) Error

func (e Error) Error() string

func (Error) GetCode

func (e Error) GetCode() int64

func (Error) GetMessage

func (e Error) GetMessage() string

type Request

type Request struct {
	Action string         `json:"action"`
	Params map[string]any `json:"params"`
}

type Response

type Response struct {
	// Execution status (success or failure), must be one of ok and failed,
	// indicating successful and unsuccessful execution, respectively.
	Status ResponseStatus `json:"status"`
	// The return code, which must conform to the return code rules defined later on this page
	RetCode int64 `json:"retcode,omitempty"`
	// Response data
	Data any `json:"data,omitempty"`
	// Error message, it is recommended to fill in a human-readable error message when the action fails to execute,
	// or an empty string when it succeeds.
	Message string `json:"message,omitempty"`
}

func NewFailedResponse

func NewFailedResponse(e *Error) Response

func NewFailedResponseWithError

func NewFailedResponseWithError(e *Error, err error) Response

func NewSuccessResponse

func NewSuccessResponse(data any) Response

type ResponseStatus

type ResponseStatus string
const (
	Success ResponseStatus = "ok"
	Failed  ResponseStatus = "failed"

	SuccessCode = int64(0)
)

Jump to

Keyboard shortcuts

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