mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-11 10:18:28 +09:00
242 lines
9.4 KiB
Go
242 lines
9.4 KiB
Go
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
|
// source: service.proto
|
|
|
|
package lib
|
|
|
|
import (
|
|
fmt "fmt"
|
|
pb "github.com/anytypeio/go-anytype-middleware/pb"
|
|
proto "github.com/gogo/protobuf/proto"
|
|
math "math"
|
|
)
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ = proto.Marshal
|
|
var _ = fmt.Errorf
|
|
var _ = math.Inf
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the proto package it is being compiled against.
|
|
// A compilation error at this line likely means your copy of the
|
|
// proto package needs to be updated.
|
|
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
|
|
|
func init() { proto.RegisterFile("service.proto", fileDescriptor_a0b84a42fa06f626) }
|
|
|
|
var fileDescriptor_a0b84a42fa06f626 = []byte{
|
|
// 369 bytes of a gzipped FileDescriptorProto
|
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x93, 0x4b, 0x4e, 0xc3, 0x30,
|
|
0x10, 0x86, 0x55, 0x21, 0x51, 0xe1, 0x3e, 0x24, 0xbc, 0x01, 0xd2, 0x36, 0xdc, 0xa0, 0x0b, 0xd8,
|
|
0xb2, 0x21, 0x15, 0x2a, 0xa8, 0x15, 0x8f, 0x56, 0x80, 0xc4, 0x2e, 0x71, 0x87, 0xca, 0xaa, 0x63,
|
|
0x87, 0xd8, 0x2d, 0xea, 0x3d, 0x38, 0x14, 0x4b, 0x8e, 0x80, 0x7a, 0x12, 0x44, 0x6d, 0xe7, 0x9d,
|
|
0x9d, 0xf3, 0x7f, 0x33, 0x5f, 0x32, 0x9a, 0x18, 0x75, 0x24, 0xc4, 0x1b, 0x4a, 0x60, 0x18, 0xc5,
|
|
0x42, 0x09, 0xdc, 0xf4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8, 0x02, 0x9f, 0x24, 0x75, 0x26, 0xb1, 0x82, 0xd3, 0x32, 0x30, 0xdd,
|
|
0x1e, 0x3a, 0xf2, 0xfe, 0xff, 0xc1, 0x87, 0x08, 0x38, 0x3e, 0x4b, 0xca, 0x92, 0xcc, 0x1a, 0x9c,
|
|
0x2a, 0x64, 0x1c, 0xb7, 0xa8, 0xb5, 0x0f, 0xcd, 0xce, 0x7a, 0xf9, 0xd2, 0xfc, 0xc6, 0xfa, 0xd5,
|
|
0xb0, 0x60, 0x7a, 0x8e, 0x16, 0x15, 0x26, 0x9d, 0xd6, 0x98, 0x2c, 0x4c, 0x4d, 0x53, 0xca, 0x57,
|
|
0x8f, 0x31, 0x6c, 0x28, 0x7c, 0x66, 0x4c, 0x99, 0xb4, 0x6c, 0xca, 0x41, 0x6d, 0xf2, 0x8e, 0xbf,
|
|
0x77, 0x6e, 0xe3, 0x67, 0xe7, 0x36, 0x7e, 0x77, 0x6e, 0xe3, 0xed, 0x80, 0xd1, 0x20, 0x38, 0xdc,
|
|
0x5f, 0xd8, 0xcb, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1b, 0x82, 0x8a, 0xe6, 0xfe, 0x03, 0x00,
|
|
0x00,
|
|
}
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the gomobile package it is being compiled against.
|
|
|
|
// ClientCommandsHandler is the handler API for ClientCommands service.
|
|
var clientCommandsHandler ClientCommandsHandler
|
|
|
|
type ClientCommandsHandler interface {
|
|
WalletCreate(*pb.WalletCreateRequest) *pb.WalletCreateResponse
|
|
WalletRecover(*pb.WalletRecoverRequest) *pb.WalletRecoverResponse
|
|
AccountRecover(*pb.AccountRecoverRequest) *pb.AccountRecoverResponse
|
|
AccountCreate(*pb.AccountCreateRequest) *pb.AccountCreateResponse
|
|
AccountSelect(*pb.AccountSelectRequest) *pb.AccountSelectResponse
|
|
ImageGetBlob(*pb.ImageGetBlobRequest) *pb.ImageGetBlobResponse
|
|
VersionGet(*pb.VersionGetRequest) *pb.VersionGetResponse
|
|
LogSend(*pb.LogSendRequest) *pb.LogSendResponse
|
|
BlockOpen(*pb.BlockOpenRequest) *pb.BlockOpenResponse
|
|
BlockCreate(*pb.BlockCreateRequest) *pb.BlockCreateResponse
|
|
BlockUpdate(*pb.BlockUpdateRequest) *pb.BlockUpdateResponse
|
|
LinkPreview(*pb.LinkPreviewRequest) *pb.LinkPreviewResponse
|
|
}
|
|
|
|
func registerClientCommandsHandler(srv ClientCommandsHandler) {
|
|
clientCommandsHandler = srv
|
|
}
|
|
|
|
func WalletCreate(b []byte) []byte {
|
|
in := new(pb.WalletCreateRequest)
|
|
if err := in.Unmarshal(b); err != nil {
|
|
resp, _ := (&pb.WalletCreateResponse{Error: &pb.WalletCreateResponse_Error{Code: pb.WalletCreateResponse_Error_BAD_INPUT, Description: err.Error()}}).Marshal()
|
|
return resp
|
|
}
|
|
resp, _ := clientCommandsHandler.WalletCreate(in).Marshal()
|
|
return resp
|
|
}
|
|
|
|
func WalletRecover(b []byte) []byte {
|
|
in := new(pb.WalletRecoverRequest)
|
|
if err := in.Unmarshal(b); err != nil {
|
|
resp, _ := (&pb.WalletRecoverResponse{Error: &pb.WalletRecoverResponse_Error{Code: pb.WalletRecoverResponse_Error_BAD_INPUT, Description: err.Error()}}).Marshal()
|
|
return resp
|
|
}
|
|
resp, _ := clientCommandsHandler.WalletRecover(in).Marshal()
|
|
return resp
|
|
}
|
|
|
|
func AccountRecover(b []byte) []byte {
|
|
in := new(pb.AccountRecoverRequest)
|
|
if err := in.Unmarshal(b); err != nil {
|
|
resp, _ := (&pb.AccountRecoverResponse{Error: &pb.AccountRecoverResponse_Error{Code: pb.AccountRecoverResponse_Error_BAD_INPUT, Description: err.Error()}}).Marshal()
|
|
return resp
|
|
}
|
|
resp, _ := clientCommandsHandler.AccountRecover(in).Marshal()
|
|
return resp
|
|
}
|
|
|
|
func AccountCreate(b []byte) []byte {
|
|
in := new(pb.AccountCreateRequest)
|
|
if err := in.Unmarshal(b); err != nil {
|
|
resp, _ := (&pb.AccountCreateResponse{Error: &pb.AccountCreateResponse_Error{Code: pb.AccountCreateResponse_Error_BAD_INPUT, Description: err.Error()}}).Marshal()
|
|
return resp
|
|
}
|
|
resp, _ := clientCommandsHandler.AccountCreate(in).Marshal()
|
|
return resp
|
|
}
|
|
|
|
func AccountSelect(b []byte) []byte {
|
|
in := new(pb.AccountSelectRequest)
|
|
if err := in.Unmarshal(b); err != nil {
|
|
resp, _ := (&pb.AccountSelectResponse{Error: &pb.AccountSelectResponse_Error{Code: pb.AccountSelectResponse_Error_BAD_INPUT, Description: err.Error()}}).Marshal()
|
|
return resp
|
|
}
|
|
resp, _ := clientCommandsHandler.AccountSelect(in).Marshal()
|
|
return resp
|
|
}
|
|
|
|
func ImageGetBlob(b []byte) []byte {
|
|
in := new(pb.ImageGetBlobRequest)
|
|
if err := in.Unmarshal(b); err != nil {
|
|
resp, _ := (&pb.ImageGetBlobResponse{Error: &pb.ImageGetBlobResponse_Error{Code: pb.ImageGetBlobResponse_Error_BAD_INPUT, Description: err.Error()}}).Marshal()
|
|
return resp
|
|
}
|
|
resp, _ := clientCommandsHandler.ImageGetBlob(in).Marshal()
|
|
return resp
|
|
}
|
|
|
|
func VersionGet(b []byte) []byte {
|
|
in := new(pb.VersionGetRequest)
|
|
if err := in.Unmarshal(b); err != nil {
|
|
resp, _ := (&pb.VersionGetResponse{Error: &pb.VersionGetResponse_Error{Code: pb.VersionGetResponse_Error_BAD_INPUT, Description: err.Error()}}).Marshal()
|
|
return resp
|
|
}
|
|
resp, _ := clientCommandsHandler.VersionGet(in).Marshal()
|
|
return resp
|
|
}
|
|
|
|
func LogSend(b []byte) []byte {
|
|
in := new(pb.LogSendRequest)
|
|
if err := in.Unmarshal(b); err != nil {
|
|
resp, _ := (&pb.LogSendResponse{Error: &pb.LogSendResponse_Error{Code: pb.LogSendResponse_Error_BAD_INPUT, Description: err.Error()}}).Marshal()
|
|
return resp
|
|
}
|
|
resp, _ := clientCommandsHandler.LogSend(in).Marshal()
|
|
return resp
|
|
}
|
|
|
|
func BlockOpen(b []byte) []byte {
|
|
in := new(pb.BlockOpenRequest)
|
|
if err := in.Unmarshal(b); err != nil {
|
|
resp, _ := (&pb.BlockOpenResponse{Error: &pb.BlockOpenResponse_Error{Code: pb.BlockOpenResponse_Error_BAD_INPUT, Description: err.Error()}}).Marshal()
|
|
return resp
|
|
}
|
|
resp, _ := clientCommandsHandler.BlockOpen(in).Marshal()
|
|
return resp
|
|
}
|
|
|
|
func BlockCreate(b []byte) []byte {
|
|
in := new(pb.BlockCreateRequest)
|
|
if err := in.Unmarshal(b); err != nil {
|
|
resp, _ := (&pb.BlockCreateResponse{Error: &pb.BlockCreateResponse_Error{Code: pb.BlockCreateResponse_Error_BAD_INPUT, Description: err.Error()}}).Marshal()
|
|
return resp
|
|
}
|
|
resp, _ := clientCommandsHandler.BlockCreate(in).Marshal()
|
|
return resp
|
|
}
|
|
|
|
func BlockUpdate(b []byte) []byte {
|
|
in := new(pb.BlockUpdateRequest)
|
|
if err := in.Unmarshal(b); err != nil {
|
|
resp, _ := (&pb.BlockUpdateResponse{Error: &pb.BlockUpdateResponse_Error{Code: pb.BlockUpdateResponse_Error_BAD_INPUT, Description: err.Error()}}).Marshal()
|
|
return resp
|
|
}
|
|
resp, _ := clientCommandsHandler.BlockUpdate(in).Marshal()
|
|
return resp
|
|
}
|
|
|
|
func LinkPreview(b []byte) []byte {
|
|
in := new(pb.LinkPreviewRequest)
|
|
if err := in.Unmarshal(b); err != nil {
|
|
resp, _ := (&pb.LinkPreviewResponse{Error: &pb.LinkPreviewResponse_Error{Code: pb.LinkPreviewResponse_Error_BAD_INPUT, Description: err.Error()}}).Marshal()
|
|
return resp
|
|
}
|
|
resp, _ := clientCommandsHandler.LinkPreview(in).Marshal()
|
|
return resp
|
|
}
|
|
|
|
func CommandAsync(cmd string, data []byte, callback func(data []byte)) {
|
|
go func() {
|
|
var cd []byte
|
|
switch cmd {
|
|
case "WalletCreate":
|
|
cd = WalletCreate(data)
|
|
case "WalletRecover":
|
|
cd = WalletRecover(data)
|
|
case "AccountRecover":
|
|
cd = AccountRecover(data)
|
|
case "AccountCreate":
|
|
cd = AccountCreate(data)
|
|
case "AccountSelect":
|
|
cd = AccountSelect(data)
|
|
case "ImageGetBlob":
|
|
cd = ImageGetBlob(data)
|
|
case "VersionGet":
|
|
cd = VersionGet(data)
|
|
case "LogSend":
|
|
cd = LogSend(data)
|
|
case "BlockOpen":
|
|
cd = BlockOpen(data)
|
|
case "BlockCreate":
|
|
cd = BlockCreate(data)
|
|
case "BlockUpdate":
|
|
cd = BlockUpdate(data)
|
|
case "LinkPreview":
|
|
cd = LinkPreview(data)
|
|
default:
|
|
log.Errorf("unknown command type: %s\n", cmd)
|
|
}
|
|
if callback != nil {
|
|
callback(cd)
|
|
}
|
|
}()
|
|
}
|
|
|
|
type MessageHandler interface {
|
|
Handle(b []byte)
|
|
}
|
|
|
|
func CommandMobile(cmd string, data []byte, callback MessageHandler) {
|
|
CommandAsync(cmd, data, callback.Handle)
|
|
}
|