Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

1.3 KB
Raw Blame
// SiYuan - https://github.com/siyuan-note/siyuan
// Copyright (c) 2020-present, b3log.org
// SPDX-License-Identifier: AGPL-3.0-or-later

package apicontract

type BroadcastMessageRequest struct {
	Message string `json:"message" api:"trim"`
	Channel string `json:"channel" api:"trim"`
}

type BroadcastChannelRequest struct {
	Name string `json:"name" api:"trim"`
}

type BroadcastChannel struct {
	Name  string `json:"name"`
	Count int    `json:"count"`
}

type BroadcastChannelData struct {
	Channel *BroadcastChannel `json:"channel"`
}

type BroadcastChannelsData struct {
	Channels []*BroadcastChannel `json:"channels" api:"nonnullable"`
}

type BroadcastPublishMessage struct {
	Type     string `json:"type" api:"enum=string|binary"`
	Size     int    `json:"size"`
	Filename string `json:"filename"`
}

type BroadcastPublishResult struct {
	Code    int                     `json:"code"`
	Msg     string                  `json:"msg"`
	Channel BroadcastChannel        `json:"channel"`
	Message BroadcastPublishMessage `json:"message"`
}

type BroadcastPublishData struct {
	Results []*BroadcastPublishResult `json:"results" api:"nonnullable"`
}

func init() {
	BroadcastPublish.decodeFailure = func(err error) Response[BroadcastPublishData] {
		return Failure[BroadcastPublishData](1, err.Error())
	}
}