proto

package
v0.0.3-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package proto is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	API_TransferByCustomer_FullMethodName = "/core.channel_transfer.API/TransferByCustomer"
	API_TransferByAdmin_FullMethodName    = "/core.channel_transfer.API/TransferByAdmin"
	API_TransferStatus_FullMethodName     = "/core.channel_transfer.API/TransferStatus"
)

Variables

View Source
var (
	TransferStatusResponse_Status_name = map[int32]string{
		0: "STATUS_IN_PROCESS",
		1: "STATUS_UNDEFINED",
		2: "STATUS_COMPLETED",
		3: "STATUS_CANCELED",
		4: "STATUS_ERROR",
	}
	TransferStatusResponse_Status_value = map[string]int32{
		"STATUS_IN_PROCESS": 0,
		"STATUS_UNDEFINED":  1,
		"STATUS_COMPLETED":  2,
		"STATUS_CANCELED":   3,
		"STATUS_ERROR":      4,
	}
)

Enum value maps for TransferStatusResponse_Status.

View Source
var API_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "core.channel_transfer.API",
	HandlerType: (*APIServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "TransferByCustomer",
			Handler:    _API_TransferByCustomer_Handler,
		},
		{
			MethodName: "TransferByAdmin",
			Handler:    _API_TransferByAdmin_Handler,
		},
		{
			MethodName: "TransferStatus",
			Handler:    _API_TransferStatus_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "service.proto",
}

API_ServiceDesc is the grpc.ServiceDesc for API service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_service_proto protoreflect.FileDescriptor
View Source
var SwaggerJSON []byte

Functions

func RegisterAPIHandler

func RegisterAPIHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterAPIHandler registers the http handlers for service API to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterAPIHandlerClient

func RegisterAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client APIClient) error

RegisterAPIHandlerClient registers the http handlers for service API to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "APIClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "APIClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "APIClient" to call the correct interceptors.

func RegisterAPIHandlerFromEndpoint

func RegisterAPIHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterAPIHandlerFromEndpoint is same as RegisterAPIHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterAPIHandlerServer

func RegisterAPIHandlerServer(ctx context.Context, mux *runtime.ServeMux, server APIServer) error

RegisterAPIHandlerServer registers the http handlers for service API to "mux". UnaryRPC :call APIServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAPIHandlerFromEndpoint instead.

func RegisterAPIServer

func RegisterAPIServer(s grpc.ServiceRegistrar, srv APIServer)

Types

type APIClient

type APIClient interface {
	TransferByCustomer(ctx context.Context, in *TransferBeginCustomerRequest, opts ...grpc.CallOption) (*TransferStatusResponse, error)
	TransferByAdmin(ctx context.Context, in *TransferBeginAdminRequest, opts ...grpc.CallOption) (*TransferStatusResponse, error)
	TransferStatus(ctx context.Context, in *TransferStatusRequest, opts ...grpc.CallOption) (*TransferStatusResponse, error)
}

APIClient is the client API for API service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewAPIClient

func NewAPIClient(cc grpc.ClientConnInterface) APIClient

type APIServer

type APIServer interface {
	TransferByCustomer(context.Context, *TransferBeginCustomerRequest) (*TransferStatusResponse, error)
	TransferByAdmin(context.Context, *TransferBeginAdminRequest) (*TransferStatusResponse, error)
	TransferStatus(context.Context, *TransferStatusRequest) (*TransferStatusResponse, error)
	// contains filtered or unexported methods
}

APIServer is the server API for API service. All implementations must embed UnimplementedAPIServer for forward compatibility

type ErrorResponse

type ErrorResponse struct {
	Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` // error message
	// contains filtered or unexported fields
}

ErrorResponse response with an error

func (*ErrorResponse) Descriptor deprecated

func (*ErrorResponse) Descriptor() ([]byte, []int)

Deprecated: Use ErrorResponse.ProtoReflect.Descriptor instead.

func (*ErrorResponse) GetError

func (x *ErrorResponse) GetError() string

func (*ErrorResponse) ProtoMessage

func (*ErrorResponse) ProtoMessage()

func (*ErrorResponse) ProtoReflect

func (x *ErrorResponse) ProtoReflect() protoreflect.Message

func (*ErrorResponse) Reset

func (x *ErrorResponse) Reset()

func (*ErrorResponse) String

func (x *ErrorResponse) String() string

type GeneralParams

type GeneralParams struct {
	MethodName string           `protobuf:"bytes,1,opt,name=method_name,json=methodName,proto3" json:"method_name,omitempty"` // method name
	RequestId  string           `protobuf:"bytes,2,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`    // request ID (may be empty)
	Chaincode  string           `protobuf:"bytes,3,opt,name=chaincode,proto3" json:"chaincode,omitempty"`                     // chaincode name
	Channel    string           `protobuf:"bytes,4,opt,name=channel,proto3" json:"channel,omitempty"`                         // channel name
	Nonce      string           `protobuf:"bytes,5,opt,name=nonce,proto3" json:"nonce,omitempty"`                             // request nonce
	PublicKey  string           `protobuf:"bytes,6,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`    // public key of user, signed the request
	Sign       string           `protobuf:"bytes,7,opt,name=sign,proto3" json:"sign,omitempty"`                               // request sign
	Options    []*typepb.Option `protobuf:"bytes,8,rep,name=options,proto3" json:"options,omitempty"`
	// contains filtered or unexported fields
}

GeneralParams general parameters for every request

func (*GeneralParams) Descriptor deprecated

func (*GeneralParams) Descriptor() ([]byte, []int)

Deprecated: Use GeneralParams.ProtoReflect.Descriptor instead.

func (*GeneralParams) GetChaincode

func (x *GeneralParams) GetChaincode() string

func (*GeneralParams) GetChannel

func (x *GeneralParams) GetChannel() string

func (*GeneralParams) GetMethodName

func (x *GeneralParams) GetMethodName() string

func (*GeneralParams) GetNonce

func (x *GeneralParams) GetNonce() string

func (*GeneralParams) GetOptions

func (x *GeneralParams) GetOptions() []*typepb.Option

func (*GeneralParams) GetPublicKey

func (x *GeneralParams) GetPublicKey() string

func (*GeneralParams) GetRequestId

func (x *GeneralParams) GetRequestId() string

func (*GeneralParams) GetSign

func (x *GeneralParams) GetSign() string

func (*GeneralParams) ProtoMessage

func (*GeneralParams) ProtoMessage()

func (*GeneralParams) ProtoReflect

func (x *GeneralParams) ProtoReflect() protoreflect.Message

func (*GeneralParams) Reset

func (x *GeneralParams) Reset()

func (*GeneralParams) String

func (x *GeneralParams) String() string

type TransferBeginAdminRequest

type TransferBeginAdminRequest struct {
	Generals   *GeneralParams   `protobuf:"bytes,1,opt,name=generals,proto3" json:"generals,omitempty"`                       // general parameters
	IdTransfer string           `protobuf:"bytes,2,opt,name=id_transfer,json=idTransfer,proto3" json:"id_transfer,omitempty"` // transfer ID (should be unique)
	ChannelTo  string           `protobuf:"bytes,3,opt,name=channel_to,json=channelTo,proto3" json:"channel_to,omitempty"`    // destination channel
	Address    string           `protobuf:"bytes,4,opt,name=address,proto3" json:"address,omitempty"`                         // token's owner address
	Token      string           `protobuf:"bytes,5,opt,name=token,proto3" json:"token,omitempty"`                             // tokens to transfer
	Amount     string           `protobuf:"bytes,6,opt,name=amount,proto3" json:"amount,omitempty"`                           // amount of tokens to transfer
	Options    []*typepb.Option `protobuf:"bytes,7,rep,name=options,proto3" json:"options,omitempty"`
	// contains filtered or unexported fields
}

TransferBeginAdminRequest request for tokens transfer by platform administrator

func (*TransferBeginAdminRequest) Descriptor deprecated

func (*TransferBeginAdminRequest) Descriptor() ([]byte, []int)

Deprecated: Use TransferBeginAdminRequest.ProtoReflect.Descriptor instead.

func (*TransferBeginAdminRequest) GetAddress

func (x *TransferBeginAdminRequest) GetAddress() string

func (*TransferBeginAdminRequest) GetAmount

func (x *TransferBeginAdminRequest) GetAmount() string

func (*TransferBeginAdminRequest) GetChannelTo

func (x *TransferBeginAdminRequest) GetChannelTo() string

func (*TransferBeginAdminRequest) GetGenerals

func (x *TransferBeginAdminRequest) GetGenerals() *GeneralParams

func (*TransferBeginAdminRequest) GetIdTransfer

func (x *TransferBeginAdminRequest) GetIdTransfer() string

func (*TransferBeginAdminRequest) GetOptions

func (x *TransferBeginAdminRequest) GetOptions() []*typepb.Option

func (*TransferBeginAdminRequest) GetToken

func (x *TransferBeginAdminRequest) GetToken() string

func (*TransferBeginAdminRequest) ProtoMessage

func (*TransferBeginAdminRequest) ProtoMessage()

func (*TransferBeginAdminRequest) ProtoReflect

func (*TransferBeginAdminRequest) Reset

func (x *TransferBeginAdminRequest) Reset()

func (*TransferBeginAdminRequest) String

func (x *TransferBeginAdminRequest) String() string

type TransferBeginCustomerRequest

type TransferBeginCustomerRequest struct {
	Generals   *GeneralParams   `protobuf:"bytes,1,opt,name=generals,proto3" json:"generals,omitempty"`                       // general parameters
	IdTransfer string           `protobuf:"bytes,2,opt,name=id_transfer,json=idTransfer,proto3" json:"id_transfer,omitempty"` // transfer ID (should be unique)
	ChannelTo  string           `protobuf:"bytes,3,opt,name=channel_to,json=channelTo,proto3" json:"channel_to,omitempty"`    // destination channel
	Token      string           `protobuf:"bytes,4,opt,name=token,proto3" json:"token,omitempty"`                             // Tokens to transfer
	Amount     string           `protobuf:"bytes,5,opt,name=amount,proto3" json:"amount,omitempty"`                           // Amount of tokens to transfer
	Options    []*typepb.Option `protobuf:"bytes,6,rep,name=options,proto3" json:"options,omitempty"`
	// contains filtered or unexported fields
}

TransferBeginAdminRequest request for tokens transfer by tokens owner

func (*TransferBeginCustomerRequest) Descriptor deprecated

func (*TransferBeginCustomerRequest) Descriptor() ([]byte, []int)

Deprecated: Use TransferBeginCustomerRequest.ProtoReflect.Descriptor instead.

func (*TransferBeginCustomerRequest) GetAmount

func (x *TransferBeginCustomerRequest) GetAmount() string

func (*TransferBeginCustomerRequest) GetChannelTo

func (x *TransferBeginCustomerRequest) GetChannelTo() string

func (*TransferBeginCustomerRequest) GetGenerals

func (x *TransferBeginCustomerRequest) GetGenerals() *GeneralParams

func (*TransferBeginCustomerRequest) GetIdTransfer

func (x *TransferBeginCustomerRequest) GetIdTransfer() string

func (*TransferBeginCustomerRequest) GetOptions

func (x *TransferBeginCustomerRequest) GetOptions() []*typepb.Option

func (*TransferBeginCustomerRequest) GetToken

func (x *TransferBeginCustomerRequest) GetToken() string

func (*TransferBeginCustomerRequest) ProtoMessage

func (*TransferBeginCustomerRequest) ProtoMessage()

func (*TransferBeginCustomerRequest) ProtoReflect

func (*TransferBeginCustomerRequest) Reset

func (x *TransferBeginCustomerRequest) Reset()

func (*TransferBeginCustomerRequest) String

type TransferStatusRequest

type TransferStatusRequest struct {
	IdTransfer string           `protobuf:"bytes,1,opt,name=id_transfer,json=idTransfer,proto3" json:"id_transfer,omitempty"` // transfer ID
	Options    []*typepb.Option `protobuf:"bytes,2,rep,name=options,proto3" json:"options,omitempty"`
	// contains filtered or unexported fields
}

TransferStatusRequest request for transfer status

func (*TransferStatusRequest) Descriptor deprecated

func (*TransferStatusRequest) Descriptor() ([]byte, []int)

Deprecated: Use TransferStatusRequest.ProtoReflect.Descriptor instead.

func (*TransferStatusRequest) GetIdTransfer

func (x *TransferStatusRequest) GetIdTransfer() string

func (*TransferStatusRequest) GetOptions

func (x *TransferStatusRequest) GetOptions() []*typepb.Option

func (*TransferStatusRequest) ProtoMessage

func (*TransferStatusRequest) ProtoMessage()

func (*TransferStatusRequest) ProtoReflect

func (x *TransferStatusRequest) ProtoReflect() protoreflect.Message

func (*TransferStatusRequest) Reset

func (x *TransferStatusRequest) Reset()

func (*TransferStatusRequest) String

func (x *TransferStatusRequest) String() string

type TransferStatusResponse

type TransferStatusResponse struct {
	IdTransfer string                        `protobuf:"bytes,1,opt,name=id_transfer,json=idTransfer,proto3" json:"id_transfer,omitempty"`                                 // transfer ID
	Status     TransferStatusResponse_Status `protobuf:"varint,2,opt,name=status,proto3,enum=core.channel_transfer.TransferStatusResponse_Status" json:"status,omitempty"` // transfer status
	Message    string                        `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`                                                         // error message (may be empty)
	// contains filtered or unexported fields
}

TransferStatusResponse response for TransferStatus transaction

func (*TransferStatusResponse) Descriptor deprecated

func (*TransferStatusResponse) Descriptor() ([]byte, []int)

Deprecated: Use TransferStatusResponse.ProtoReflect.Descriptor instead.

func (*TransferStatusResponse) GetIdTransfer

func (x *TransferStatusResponse) GetIdTransfer() string

func (*TransferStatusResponse) GetMessage

func (x *TransferStatusResponse) GetMessage() string

func (*TransferStatusResponse) GetStatus

func (*TransferStatusResponse) ProtoMessage

func (*TransferStatusResponse) ProtoMessage()

func (*TransferStatusResponse) ProtoReflect

func (x *TransferStatusResponse) ProtoReflect() protoreflect.Message

func (*TransferStatusResponse) Reset

func (x *TransferStatusResponse) Reset()

func (*TransferStatusResponse) String

func (x *TransferStatusResponse) String() string

type TransferStatusResponse_Status

type TransferStatusResponse_Status int32
const (
	TransferStatusResponse_STATUS_IN_PROCESS TransferStatusResponse_Status = 0
	TransferStatusResponse_STATUS_UNDEFINED  TransferStatusResponse_Status = 1
	TransferStatusResponse_STATUS_COMPLETED  TransferStatusResponse_Status = 2
	TransferStatusResponse_STATUS_CANCELED   TransferStatusResponse_Status = 3
	TransferStatusResponse_STATUS_ERROR      TransferStatusResponse_Status = 4
)

func (TransferStatusResponse_Status) Descriptor

func (TransferStatusResponse_Status) Enum

func (TransferStatusResponse_Status) EnumDescriptor deprecated

func (TransferStatusResponse_Status) EnumDescriptor() ([]byte, []int)

Deprecated: Use TransferStatusResponse_Status.Descriptor instead.

func (TransferStatusResponse_Status) Number

func (TransferStatusResponse_Status) String

func (TransferStatusResponse_Status) Type

type UnimplementedAPIServer

type UnimplementedAPIServer struct {
}

UnimplementedAPIServer must be embedded to have forward compatible implementations.

func (UnimplementedAPIServer) TransferStatus

type UnsafeAPIServer

type UnsafeAPIServer interface {
	// contains filtered or unexported methods
}

UnsafeAPIServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to APIServer will result in compilation errors.

Jump to

Keyboard shortcuts

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