api

package
v0.0.0-...-75f766f Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ApiServer string

Functions

func AddGroupConfig

func AddGroupConfig(groupId, key, tp, value, memo string) (*handlers.AppConfigResult, error)

func AnnouncedProducers

func AnnouncedProducers(groupId string) ([]*handlers.AnnouncedProducerListItem, error)

func AnnouncedUsers

func AnnouncedUsers(groupId string) ([]*handlers.AnnouncedUserListItem, error)

func ApproveAnnouncedProducer

func ApproveAnnouncedProducer(groupId string, user *handlers.AnnouncedProducerListItem, removal bool) (*handlers.GrpProducerResult, error)

func Content

func Content(groupId string, opt PagerOpt) (contents *[]ContentStruct, err error)

func CreateGroup

func CreateGroup(data CreateGroupReqStruct) ([]byte, error)

func DelGroupConfig

func DelGroupConfig(groupId, key, tp, value, memo string) (*handlers.AppConfigResult, error)

func GetBlockById

func GetBlockById(groupId string, id string) (*pb.Block, error)

func GetChainAllowList

func GetChainAllowList(groupId string) ([]*handlers.ChainSendTrxRuleListItem, error)

/v1/group/:group_id/trx/allowlist

func GetChainAuthMode

func GetChainAuthMode(groupId, trxType string) (*handlers.TrxAuthItem, error)

/v1/group/:group_id/trx/auth/:trx_type

func GetChainDenyList

func GetChainDenyList(groupId string) ([]*handlers.ChainSendTrxRuleListItem, error)

/v1/group/:group_id/trx/denylist

func GetGroupConfig

func GetGroupConfig(groupId, key string) (*handlers.AppConfigKeyItem, error)

func GetGroupConfigList

func GetGroupConfigList(groupId string) ([]*handlers.AppConfigKeyListItem, error)

func GetGroupSeed

func GetGroupSeed(gid string) (*handlers.GroupSeed, error)

func GetPubQueue

func GetPubQueue(groupId string, trxId string, status string) (*handlers.PubQueueInfo, error)

func Groups

func Groups() (groupsInfo *qApi.GroupInfoList, err error)

func IsQuorumContentMessage

func IsQuorumContentMessage(content ContentStruct) bool

func IsQuorumContentUserInfo

func IsQuorumContentUserInfo(content ContentStruct) bool

func IsValidApiServer

func IsValidApiServer() bool

func ModifyGroupConfig

func ModifyGroupConfig(action, groupId, key, tp, value, memo string) (*handlers.AppConfigResult, error)

func Ping

func Ping() (res *map[string]PingInfoItemStruct, err error)

func PubQueueAck

func PubQueueAck(trxIds []string) ([]string, error)

func SetApiServer

func SetApiServer(apiServer string)

func TrxInfo

func TrxInfo(groupId string, trxId string) (trx *pb.Trx, err error)

func UpdateChainConfig

func UpdateChainConfig(groupId, tp, config, memo string) (*handlers.ChainConfigResult, error)

/v1/group/chainconfig

Types

type ApproveGrpUserParam

type ApproveGrpUserParam struct {
	Action     string `from:"action"          json:"action"           validate:"required,oneof=add remove"`
	UserPubkey string `from:"user_pubkey" json:"user_pubkey"  validate:"required"`
	GroupId    string `from:"group_id"        json:"group_id"         validate:"required"`
	Memo       string `from:"memo"            json:"memo"`
}

POST approve user

type ApproveGrpUserResult

type ApproveGrpUserResult struct {
	GroupId       string `json:"group_id"`
	UserPubkey    string `json:"user_pubkey"`
	EncryptPubkey string `json:"encrypt_pubkey"`
	OwnerPubkey   string `json:"owner_pubkey"`
	Sign          string `json:"sign"`
	TrxId         string `json:"trx_id"`
	Memo          string `json:"memo"`
	Action        string `json:"action"`
}

func ApproveAnnouncedUser

func ApproveAnnouncedUser(groupId string, user *handlers.AnnouncedUserListItem, removal bool) (*ApproveGrpUserResult, error)

type BackupResult

type BackupResult struct {
	// encrypt json.Marshal([]GroupSeed)
	Seeds    string `json:"seeds"`
	Keystore string `json:"keystore"`
	Config   string `json:"config" validate:"required"`
}

func DoBackup

func DoBackup() (*BackupResult, error)

type ContentInnerMsgStruct

type ContentInnerMsgStruct struct {
	Name    string        `json:"name"`
	Content string        `json:"content"`
	ReplyTo ReplyToStruct `json:"inreplyto"`
}

type ContentInnerProfileStruct

type ContentInnerProfileStruct struct {
	Name   string         `json:"name"`
	Wallet []WalletStruct `json:"wallet"`
}

type ContentInnerStruct

type ContentInnerStruct map[string]interface{}

/api/v1/group/$group/content

type ContentList

type ContentList []ContentStruct

func (ContentList) Len

func (a ContentList) Len() int

func (ContentList) Less

func (a ContentList) Less(i, j int) bool

func (ContentList) Swap

func (a ContentList) Swap(i, j int)

type ContentReqObjectStruct

type ContentReqObjectStruct struct {
	Content string `json:"content"`
	Name    string `json:"name"`
	Type    string `json:"type"`
}

POST /api/v1/group/content

type ContentReqStruct

type ContentReqStruct struct {
	Object ContentReqObjectStruct `json:"object"`
	Target ContentReqTargetStruct `json:"target"`
	Type   string                 `json:"type"`
}

type ContentReqTargetStruct

type ContentReqTargetStruct struct {
	Id   string `json:"id"`
	Type string `json:"type"`
}

type ContentRespStruct

type ContentRespStruct TrxRespStruct

func CreateContent

func CreateContent(groupId string, content string) (*ContentRespStruct, error)

type ContentStruct

type ContentStruct struct {
	TrxId     string             `json:"TrxId"`
	Publisher string             `json:"Publisher"`
	Content   ContentInnerStruct `json:"Content"`
	TypeUrl   string             `json:"TypeUrl"`
	TimeStamp int64              `json:"TimeStamp"`
}

type CreateGroupReqStruct

type CreateGroupReqStruct struct {
	Name           string `json:"group_name"`
	ConsensusType  string `json:"consensus_type"`  // poa(proof of authority)
	EncryptionType string `json:"encryption_type"` // public | private
	AppKey         string `json:"app_key"`         // mode
}

POST /api/v1/group

type DeleteGroupReqStruct

type DeleteGroupReqStruct struct {
	GroupId string `json:"group_id"`
}

type GenesisBlockStruct

type GenesisBlockStruct struct {
	BlockId        string `json:"BlockId"`
	GroupId        string `json:"GroupId"`
	BlockNum       int    `json:"BlockNum"`
	TimeStamp      int64  `json:"TimeStamp"`
	ProducerId     string `json:"ProducerId"`
	ProducerPubKey string `json:"ProducerPubKey"`
	Hash           string `json:"Hash"`
	Signature      string `json:"Signature"`
}

type GroupDelRetStruct

type GroupDelRetStruct struct {
	GroupId     string `json:"group_id"`
	OwnerPubKey string `json:"owner_pubkey"`
	Signature   string `json:"signature"`
}

func DelGroup

func DelGroup(gid string) (*GroupDelRetStruct, error)

type GroupForceSyncRetStruct

type GroupForceSyncRetStruct struct {
	GroupId string `json:"GroupId"`
	Error   string `json:"Error"`
}

func ForceSyncGroup

func ForceSyncGroup(groupId string) (syncRes *GroupForceSyncRetStruct, err error)

type GroupLeaveRetStruct

type GroupLeaveRetStruct struct {
	GroupId   string `json:"group_id"`
	Signature string `json:"signature"`
}

func LeaveGroup

func LeaveGroup(gid string) (*GroupLeaveRetStruct, error)

type JoinRespStruct

type JoinRespStruct struct {
	GroupId   string `json:"group_id"`
	Signature string `json:"signature"`
}

POST /api/v1/group/join

func JoinGroup

func JoinGroup(seed string) (*JoinRespStruct, error)

type LeaveGroupReqStruct

type LeaveGroupReqStruct struct {
	GroupId string `json:"group_id"`
}

type NetworkInfoGroupStruct

type NetworkInfoGroupStruct struct {
	GroupId   string   `json:"GroupId"`
	GroupName string   `json:"GroupName"`
	Peers     []string `json:"Peers"`
}

/api/v1/network

type NetworkInfoNodeStruct

type NetworkInfoNodeStruct struct {
	Addrs      []string `json:"addrs"`
	EthAddr    string   `json:"ethaddr"`
	NatEnabled bool     `json:"nat_enabled"`
	NatType    string   `json:"nat_type"`
	PeerId     string   `json:"peerid"`
}

type NetworkInfoStruct

type NetworkInfoStruct struct {
	Groups []NetworkInfoGroupStruct `json:"groups"`
	Node   NetworkInfoNodeStruct    `json:"node"`
}

func Network

func Network() (networkInfo *NetworkInfoStruct, err error)

type NickReqStruct

type NickReqStruct struct {
	Person QuorumPersonStruct `json:"person"`
	Target QuorumTargetStruct `json:"target"`
	Type   string             `json:"type"`
}

type NickRespStruct

type NickRespStruct TrxRespStruct

func Nick

func Nick(groupId string, nick string) (*NickRespStruct, error)

type NodeInfoStruct

type NodeInfoStruct struct {
	NodeId      string              `json:"node_id"`
	NodePubKey  string              `json:"node_publickey"`
	NodeStatus  string              `json:"node_status"`
	NodeType    string              `json:"node_type"`
	NodeVersion string              `json:"node_version"`
	Peers       map[string][]string `json:"peers"`
}

/api/v1/node

func Node

func Node() (*NodeInfoStruct, error)

type PagerOpt

type PagerOpt struct {
	StartTrxId string
	Reverse    bool
	Page       int
}

type PingInfoItemStruct

type PingInfoItemStruct struct {
	Addrs       []string             `json:"addrs"`
	Protocols   []string             `json:"protocols"`
	RTT         [10]int64            `json:"rtt"`
	Connections []qApi.AddrProtoPair `json:"connections"`
}

GET /api/v1/network/peers/ping

type QuorumPersonStruct

type QuorumPersonStruct struct {
	Name string `json:"name"`
}

/api/v1/group/profile

type QuorumTargetStruct

type QuorumTargetStruct struct {
	Id   string `json:"id"`
	Type string `json:"type"`
}

type ReplyToStruct

type ReplyToStruct struct {
	TrxId string `json:"trxid"`
}

type TokenRespStruct

type TokenRespStruct struct {
	Token string `json:"token"`
}

func TokenApply

func TokenApply() (*TokenRespStruct, error)

type TrxRespStruct

type TrxRespStruct struct {
	TrxId string `json:"trx_id"`
}

type WalletStruct

type WalletStruct struct {
	Id   string `json:"id"`
	Type string `json:"type"`
	Name string `json:"name"`
}

Jump to

Keyboard shortcuts

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