mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-24 06:25:47 +00:00
added GetMachineByPublicKey query and adjusted asset test cases
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
parent
3edac9aea1
commit
31f52b9317
36
docs/static/openapi.yml
vendored
36
docs/static/openapi.yml
vendored
@ -43900,6 +43900,40 @@ paths:
|
|||||||
additionalProperties: {}
|
additionalProperties: {}
|
||||||
tags:
|
tags:
|
||||||
- Query
|
- Query
|
||||||
|
/planetmint-go/machine/get_machine_by_public_key/{publicKey}:
|
||||||
|
get:
|
||||||
|
summary: Queries a list of GetMachineByPublicKey items.
|
||||||
|
operationId: PlanetmintgoMachineGetMachineByPublicKey
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: A successful response.
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
default:
|
||||||
|
description: An unexpected error response.
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
code:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
|
details:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
'@type':
|
||||||
|
type: string
|
||||||
|
additionalProperties: {}
|
||||||
|
parameters:
|
||||||
|
- name: publicKey
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
tags:
|
||||||
|
- Query
|
||||||
/planetmint-go/machine/params:
|
/planetmint-go/machine/params:
|
||||||
get:
|
get:
|
||||||
summary: Parameters queries the parameters of the module.
|
summary: Parameters queries the parameters of the module.
|
||||||
@ -71543,6 +71577,8 @@ definitions:
|
|||||||
planetmintgo.machine.Params:
|
planetmintgo.machine.Params:
|
||||||
type: object
|
type: object
|
||||||
description: Params defines the parameters for the module.
|
description: Params defines the parameters for the module.
|
||||||
|
planetmintgo.machine.QueryGetMachineByPublicKeyResponse:
|
||||||
|
type: object
|
||||||
planetmintgo.machine.QueryParamsResponse:
|
planetmintgo.machine.QueryParamsResponse:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
package planetmintgo.machine;
|
package planetmintgo.machine;
|
||||||
|
|
||||||
import "gogoproto/gogo.proto";
|
import "gogoproto/gogo.proto";
|
||||||
@ -10,17 +11,32 @@ option go_package = "planetmint-go/x/machine/types";
|
|||||||
|
|
||||||
// Query defines the gRPC querier service.
|
// Query defines the gRPC querier service.
|
||||||
service Query {
|
service Query {
|
||||||
|
|
||||||
// Parameters queries the parameters of the module.
|
// Parameters queries the parameters of the module.
|
||||||
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
|
rpc Params (QueryParamsRequest) returns (QueryParamsResponse) {
|
||||||
option (google.api.http).get = "/planetmint-go/machine/params";
|
option (google.api.http).get = "/planetmint-go/machine/params";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Queries a list of GetMachineByPublicKey items.
|
||||||
|
rpc GetMachineByPublicKey (QueryGetMachineByPublicKeyRequest) returns (QueryGetMachineByPublicKeyResponse) {
|
||||||
|
option (google.api.http).get = "/planetmint-go/machine/get_machine_by_public_key/{publicKey}";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryParamsRequest is request type for the Query/Params RPC method.
|
// QueryParamsRequest is request type for the Query/Params RPC method.
|
||||||
message QueryParamsRequest {}
|
message QueryParamsRequest {}
|
||||||
|
|
||||||
// QueryParamsResponse is response type for the Query/Params RPC method.
|
// QueryParamsResponse is response type for the Query/Params RPC method.
|
||||||
message QueryParamsResponse {
|
message QueryParamsResponse {
|
||||||
|
|
||||||
// params holds all the parameters of this module.
|
// params holds all the parameters of this module.
|
||||||
Params params = 1 [(gogoproto.nullable) = false];
|
Params params = 1 [(gogoproto.nullable) = false];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message QueryGetMachineByPublicKeyRequest {
|
||||||
|
string publicKey = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message QueryGetMachineByPublicKeyResponse {}
|
||||||
|
|
||||||
|
|||||||
@ -48,7 +48,10 @@ func AssetKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
|
|||||||
ctrl := gomock.NewController(t)
|
ctrl := gomock.NewController(t)
|
||||||
mk := assettestutils.NewMockMachineKeeper(ctrl)
|
mk := assettestutils.NewMockMachineKeeper(ctrl)
|
||||||
sk, pk := sample.KeyPair()
|
sk, pk := sample.KeyPair()
|
||||||
mk.EXPECT().GetMachine(ctx, pk).Return(sample.Machine(pk, pk, pk), true).AnyTimes()
|
id := sample.MachineIndex(pk, pk, pk)
|
||||||
|
mk.EXPECT().GetMachineIndex(ctx, pk).Return(id, true).AnyTimes()
|
||||||
|
mk.EXPECT().GetMachineIndex(ctx, sk).Return(id, false).AnyTimes()
|
||||||
|
mk.EXPECT().GetMachine(ctx, id).Return(sample.Machine(pk, pk, pk), true).AnyTimes()
|
||||||
mk.EXPECT().GetMachine(ctx, sk).Return(sample.Machine(pk, pk, pk), false).AnyTimes()
|
mk.EXPECT().GetMachine(ctx, sk).Return(sample.Machine(pk, pk, pk), false).AnyTimes()
|
||||||
|
|
||||||
k := keeper.NewKeeper(
|
k := keeper.NewKeeper(
|
||||||
|
|||||||
@ -37,6 +37,14 @@ func Machine(machineId string, pkPM string, pkL string) machinetypes.Machine {
|
|||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func MachineIndex(machineId string, pkPM string, pkL string) machinetypes.MachineIndex {
|
||||||
|
return machinetypes.MachineIndex{
|
||||||
|
MachineId: machineId,
|
||||||
|
IssuerPlanetmint: pkPM,
|
||||||
|
IssuerLiquid: pkL,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func Metadata() machinetypes.Metadata {
|
func Metadata() machinetypes.Metadata {
|
||||||
return machinetypes.Metadata{
|
return machinetypes.Metadata{
|
||||||
Gps: map[string]string{
|
Gps: map[string]string{
|
||||||
|
|||||||
@ -15,12 +15,14 @@ import (
|
|||||||
func (k msgServer) NotarizeAsset(goCtx context.Context, msg *types.MsgNotarizeAsset) (*types.MsgNotarizeAssetResponse, error) {
|
func (k msgServer) NotarizeAsset(goCtx context.Context, msg *types.MsgNotarizeAsset) (*types.MsgNotarizeAssetResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|
||||||
machine, found := k.machineKeeper.GetMachine(ctx, msg.Creator)
|
machineIndex, found := k.machineKeeper.GetMachineIndex(ctx, msg.Creator)
|
||||||
|
|
||||||
if !found {
|
if !found {
|
||||||
return &types.MsgNotarizeAssetResponse{}, errors.New("machine not found")
|
return &types.MsgNotarizeAssetResponse{}, errors.New("machine not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
machine, _ := k.machineKeeper.GetMachine(ctx, machineIndex)
|
||||||
|
|
||||||
valid := ValidateSignature(msg.CidHash, msg.Sign, msg.Creator)
|
valid := ValidateSignature(msg.CidHash, msg.Sign, msg.Creator)
|
||||||
if !valid {
|
if !valid {
|
||||||
return &types.MsgNotarizeAssetResponse{}, errors.New("invalid signature")
|
return &types.MsgNotarizeAssetResponse{}, errors.New("invalid signature")
|
||||||
|
|||||||
@ -111,16 +111,31 @@ func (m *MockMachineKeeper) EXPECT() *MockMachineKeeperMockRecorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetMachine mocks base method.
|
// GetMachine mocks base method.
|
||||||
func (m *MockMachineKeeper) GetMachine(ctx types.Context, pubKey string) (types1.Machine, bool) {
|
func (m *MockMachineKeeper) GetMachine(ctx types.Context, index types1.MachineIndex) (types1.Machine, bool) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "GetMachine", ctx, pubKey)
|
ret := m.ctrl.Call(m, "GetMachine", ctx, index)
|
||||||
ret0, _ := ret[0].(types1.Machine)
|
ret0, _ := ret[0].(types1.Machine)
|
||||||
ret1, _ := ret[1].(bool)
|
ret1, _ := ret[1].(bool)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMachine indicates an expected call of GetMachine.
|
// GetMachine indicates an expected call of GetMachine.
|
||||||
func (mr *MockMachineKeeperMockRecorder) GetMachine(ctx, pubKey interface{}) *gomock.Call {
|
func (mr *MockMachineKeeperMockRecorder) GetMachine(ctx, index interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMachine", reflect.TypeOf((*MockMachineKeeper)(nil).GetMachine), ctx, pubKey)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMachine", reflect.TypeOf((*MockMachineKeeper)(nil).GetMachine), ctx, index)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetMachineIndex mocks base method.
|
||||||
|
func (m *MockMachineKeeper) GetMachineIndex(ctx types.Context, pubKey string) (types1.MachineIndex, bool) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "GetMachineIndex", ctx, pubKey)
|
||||||
|
ret0, _ := ret[0].(types1.MachineIndex)
|
||||||
|
ret1, _ := ret[1].(bool)
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetMachineIndex indicates an expected call of GetMachineIndex.
|
||||||
|
func (mr *MockMachineKeeperMockRecorder) GetMachineIndex(ctx, pubKey interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMachineIndex", reflect.TypeOf((*MockMachineKeeper)(nil).GetMachineIndex), ctx, pubKey)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,5 +20,6 @@ type BankKeeper interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type MachineKeeper interface {
|
type MachineKeeper interface {
|
||||||
GetMachine(ctx sdk.Context, pubKey string) (val machinetypes.Machine, found bool)
|
GetMachine(ctx sdk.Context, index machinetypes.MachineIndex) (val machinetypes.Machine, found bool)
|
||||||
|
GetMachineIndex(ctx sdk.Context, pubKey string) (val machinetypes.MachineIndex, found bool)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,8 @@ func GetQueryCmd(queryRoute string) *cobra.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd.AddCommand(CmdQueryParams())
|
cmd.AddCommand(CmdQueryParams())
|
||||||
|
cmd.AddCommand(CmdGetMachineByPublicKey())
|
||||||
|
|
||||||
// this line is used by starport scaffolding # 1
|
// this line is used by starport scaffolding # 1
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
|
|||||||
46
x/machine/client/cli/query_get_machine_by_public_key.go
Normal file
46
x/machine/client/cli/query_get_machine_by_public_key.go
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
package cli
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/cosmos/cosmos-sdk/client"
|
||||||
|
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
"planetmint-go/x/machine/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ = strconv.Itoa(0)
|
||||||
|
|
||||||
|
func CmdGetMachineByPublicKey() *cobra.Command {
|
||||||
|
cmd := &cobra.Command{
|
||||||
|
Use: "get-machine-by-public-key [public-key]",
|
||||||
|
Short: "Query get-machine-by-public-key",
|
||||||
|
Args: cobra.ExactArgs(1),
|
||||||
|
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||||
|
reqPublicKey := args[0]
|
||||||
|
|
||||||
|
clientCtx, err := client.GetClientQueryContext(cmd)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
queryClient := types.NewQueryClient(clientCtx)
|
||||||
|
|
||||||
|
params := &types.QueryGetMachineByPublicKeyRequest{
|
||||||
|
|
||||||
|
PublicKey: reqPublicKey,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := queryClient.GetMachineByPublicKey(cmd.Context(), params)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return clientCtx.PrintProto(res)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
flags.AddQueryFlagsToCmd(cmd)
|
||||||
|
|
||||||
|
return cmd
|
||||||
|
}
|
||||||
23
x/machine/keeper/query_get_machine_by_public_key.go
Normal file
23
x/machine/keeper/query_get_machine_by_public_key.go
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package keeper
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
|
"planetmint-go/x/machine/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (k Keeper) GetMachineByPublicKey(goCtx context.Context, req *types.QueryGetMachineByPublicKeyRequest) (*types.QueryGetMachineByPublicKeyResponse, error) {
|
||||||
|
if req == nil {
|
||||||
|
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|
||||||
|
// TODO: Process the query
|
||||||
|
_ = ctx
|
||||||
|
|
||||||
|
return &types.QueryGetMachineByPublicKeyResponse{}, nil
|
||||||
|
}
|
||||||
@ -113,34 +113,122 @@ func (m *QueryParamsResponse) GetParams() Params {
|
|||||||
return Params{}
|
return Params{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type QueryGetMachineByPublicKeyRequest struct {
|
||||||
|
PublicKey string `protobuf:"bytes,1,opt,name=publicKey,proto3" json:"publicKey,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *QueryGetMachineByPublicKeyRequest) Reset() { *m = QueryGetMachineByPublicKeyRequest{} }
|
||||||
|
func (m *QueryGetMachineByPublicKeyRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*QueryGetMachineByPublicKeyRequest) ProtoMessage() {}
|
||||||
|
func (*QueryGetMachineByPublicKeyRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_bf7841d43d757203, []int{2}
|
||||||
|
}
|
||||||
|
func (m *QueryGetMachineByPublicKeyRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return m.Unmarshal(b)
|
||||||
|
}
|
||||||
|
func (m *QueryGetMachineByPublicKeyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
if deterministic {
|
||||||
|
return xxx_messageInfo_QueryGetMachineByPublicKeyRequest.Marshal(b, m, deterministic)
|
||||||
|
} else {
|
||||||
|
b = b[:cap(b)]
|
||||||
|
n, err := m.MarshalToSizedBuffer(b)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return b[:n], nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (m *QueryGetMachineByPublicKeyRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_QueryGetMachineByPublicKeyRequest.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *QueryGetMachineByPublicKeyRequest) XXX_Size() int {
|
||||||
|
return m.Size()
|
||||||
|
}
|
||||||
|
func (m *QueryGetMachineByPublicKeyRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_QueryGetMachineByPublicKeyRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_QueryGetMachineByPublicKeyRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *QueryGetMachineByPublicKeyRequest) GetPublicKey() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.PublicKey
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type QueryGetMachineByPublicKeyResponse struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *QueryGetMachineByPublicKeyResponse) Reset() { *m = QueryGetMachineByPublicKeyResponse{} }
|
||||||
|
func (m *QueryGetMachineByPublicKeyResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*QueryGetMachineByPublicKeyResponse) ProtoMessage() {}
|
||||||
|
func (*QueryGetMachineByPublicKeyResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_bf7841d43d757203, []int{3}
|
||||||
|
}
|
||||||
|
func (m *QueryGetMachineByPublicKeyResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return m.Unmarshal(b)
|
||||||
|
}
|
||||||
|
func (m *QueryGetMachineByPublicKeyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
if deterministic {
|
||||||
|
return xxx_messageInfo_QueryGetMachineByPublicKeyResponse.Marshal(b, m, deterministic)
|
||||||
|
} else {
|
||||||
|
b = b[:cap(b)]
|
||||||
|
n, err := m.MarshalToSizedBuffer(b)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return b[:n], nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (m *QueryGetMachineByPublicKeyResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_QueryGetMachineByPublicKeyResponse.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *QueryGetMachineByPublicKeyResponse) XXX_Size() int {
|
||||||
|
return m.Size()
|
||||||
|
}
|
||||||
|
func (m *QueryGetMachineByPublicKeyResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_QueryGetMachineByPublicKeyResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_QueryGetMachineByPublicKeyResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
proto.RegisterType((*QueryParamsRequest)(nil), "planetmintgo.machine.QueryParamsRequest")
|
proto.RegisterType((*QueryParamsRequest)(nil), "planetmintgo.machine.QueryParamsRequest")
|
||||||
proto.RegisterType((*QueryParamsResponse)(nil), "planetmintgo.machine.QueryParamsResponse")
|
proto.RegisterType((*QueryParamsResponse)(nil), "planetmintgo.machine.QueryParamsResponse")
|
||||||
|
proto.RegisterType((*QueryGetMachineByPublicKeyRequest)(nil), "planetmintgo.machine.QueryGetMachineByPublicKeyRequest")
|
||||||
|
proto.RegisterType((*QueryGetMachineByPublicKeyResponse)(nil), "planetmintgo.machine.QueryGetMachineByPublicKeyResponse")
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { proto.RegisterFile("planetmintgo/machine/query.proto", fileDescriptor_bf7841d43d757203) }
|
func init() { proto.RegisterFile("planetmintgo/machine/query.proto", fileDescriptor_bf7841d43d757203) }
|
||||||
|
|
||||||
var fileDescriptor_bf7841d43d757203 = []byte{
|
var fileDescriptor_bf7841d43d757203 = []byte{
|
||||||
// 292 bytes of a gzipped FileDescriptorProto
|
// 391 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x90, 0x31, 0x4b, 0x03, 0x31,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xcf, 0x6a, 0x1a, 0x41,
|
||||||
0x18, 0x86, 0x2f, 0xa2, 0x1d, 0xe2, 0x16, 0x6f, 0x90, 0xa3, 0x4d, 0xeb, 0x81, 0x50, 0x05, 0x2f,
|
0x1c, 0xc7, 0x77, 0xa5, 0x15, 0x9c, 0xde, 0xa6, 0x16, 0xca, 0xa2, 0xab, 0x2e, 0x2d, 0xd8, 0x42,
|
||||||
0xb4, 0x0e, 0x82, 0x63, 0x7f, 0x81, 0xed, 0xe8, 0x96, 0x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e, 0xbc, 0x5f, 0x68, 0x3a, 0xef, 0xaa, 0xce, 0xff, 0xe1,
|
||||||
|
0xbf, 0x57, 0x3a, 0x47, 0x44, 0x06, 0xe6, 0x1c, 0x84, 0x69, 0xa0, 0x97, 0x1f, 0x1c, 0x93, 0x14,
|
||||||
|
0x9d, 0x2d, 0x7f, 0xc4, 0x79, 0xbb, 0x35, 0x99, 0xb9, 0xf6, 0x74, 0xe6, 0xda, 0xf7, 0x33, 0xd7,
|
||||||
|
0xbe, 0x9a, 0xbb, 0xd6, 0x74, 0xee, 0x5a, 0xb7, 0x73, 0xd7, 0x3a, 0x2c, 0xaf, 0xdb, 0x9e, 0x2e,
|
||||||
|
0x8d, 0x65, 0xca, 0x89, 0x08, 0xf3, 0xea, 0xd5, 0xfd, 0x7e, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x05,
|
||||||
|
0xe2, 0x2b, 0xbf, 0x32, 0x03, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
@ -157,6 +245,8 @@ const _ = grpc.SupportPackageIsVersion4
|
|||||||
type QueryClient interface {
|
type QueryClient interface {
|
||||||
// Parameters queries the parameters of the module.
|
// Parameters queries the parameters of the module.
|
||||||
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
|
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
|
||||||
|
// Queries a list of GetMachineByPublicKey items.
|
||||||
|
GetMachineByPublicKey(ctx context.Context, in *QueryGetMachineByPublicKeyRequest, opts ...grpc.CallOption) (*QueryGetMachineByPublicKeyResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type queryClient struct {
|
type queryClient struct {
|
||||||
@ -176,10 +266,21 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts .
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *queryClient) GetMachineByPublicKey(ctx context.Context, in *QueryGetMachineByPublicKeyRequest, opts ...grpc.CallOption) (*QueryGetMachineByPublicKeyResponse, error) {
|
||||||
|
out := new(QueryGetMachineByPublicKeyResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/planetmintgo.machine.Query/GetMachineByPublicKey", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
// QueryServer is the server API for Query service.
|
// QueryServer is the server API for Query service.
|
||||||
type QueryServer interface {
|
type QueryServer interface {
|
||||||
// Parameters queries the parameters of the module.
|
// Parameters queries the parameters of the module.
|
||||||
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
|
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
|
||||||
|
// Queries a list of GetMachineByPublicKey items.
|
||||||
|
GetMachineByPublicKey(context.Context, *QueryGetMachineByPublicKeyRequest) (*QueryGetMachineByPublicKeyResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
|
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
|
||||||
@ -189,6 +290,9 @@ type UnimplementedQueryServer struct {
|
|||||||
func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) {
|
func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
|
||||||
}
|
}
|
||||||
|
func (*UnimplementedQueryServer) GetMachineByPublicKey(ctx context.Context, req *QueryGetMachineByPublicKeyRequest) (*QueryGetMachineByPublicKeyResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetMachineByPublicKey not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
|
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
|
||||||
s.RegisterService(&_Query_serviceDesc, srv)
|
s.RegisterService(&_Query_serviceDesc, srv)
|
||||||
@ -212,6 +316,24 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _Query_GetMachineByPublicKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(QueryGetMachineByPublicKeyRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(QueryServer).GetMachineByPublicKey(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/planetmintgo.machine.Query/GetMachineByPublicKey",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(QueryServer).GetMachineByPublicKey(ctx, req.(*QueryGetMachineByPublicKeyRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
var _Query_serviceDesc = grpc.ServiceDesc{
|
var _Query_serviceDesc = grpc.ServiceDesc{
|
||||||
ServiceName: "planetmintgo.machine.Query",
|
ServiceName: "planetmintgo.machine.Query",
|
||||||
HandlerType: (*QueryServer)(nil),
|
HandlerType: (*QueryServer)(nil),
|
||||||
@ -220,6 +342,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "Params",
|
MethodName: "Params",
|
||||||
Handler: _Query_Params_Handler,
|
Handler: _Query_Params_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetMachineByPublicKey",
|
||||||
|
Handler: _Query_GetMachineByPublicKey_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "planetmintgo/machine/query.proto",
|
Metadata: "planetmintgo/machine/query.proto",
|
||||||
@ -281,6 +407,59 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||||||
return len(dAtA) - i, nil
|
return len(dAtA) - i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *QueryGetMachineByPublicKeyRequest) Marshal() (dAtA []byte, err error) {
|
||||||
|
size := m.Size()
|
||||||
|
dAtA = make([]byte, size)
|
||||||
|
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return dAtA[:n], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *QueryGetMachineByPublicKeyRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
size := m.Size()
|
||||||
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *QueryGetMachineByPublicKeyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||||
|
i := len(dAtA)
|
||||||
|
_ = i
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if len(m.PublicKey) > 0 {
|
||||||
|
i -= len(m.PublicKey)
|
||||||
|
copy(dAtA[i:], m.PublicKey)
|
||||||
|
i = encodeVarintQuery(dAtA, i, uint64(len(m.PublicKey)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0xa
|
||||||
|
}
|
||||||
|
return len(dAtA) - i, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *QueryGetMachineByPublicKeyResponse) Marshal() (dAtA []byte, err error) {
|
||||||
|
size := m.Size()
|
||||||
|
dAtA = make([]byte, size)
|
||||||
|
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return dAtA[:n], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *QueryGetMachineByPublicKeyResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
size := m.Size()
|
||||||
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *QueryGetMachineByPublicKeyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||||
|
i := len(dAtA)
|
||||||
|
_ = i
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
return len(dAtA) - i, nil
|
||||||
|
}
|
||||||
|
|
||||||
func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
|
func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
|
||||||
offset -= sovQuery(v)
|
offset -= sovQuery(v)
|
||||||
base := offset
|
base := offset
|
||||||
@ -312,6 +491,28 @@ func (m *QueryParamsResponse) Size() (n int) {
|
|||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *QueryGetMachineByPublicKeyRequest) Size() (n int) {
|
||||||
|
if m == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
l = len(m.PublicKey)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovQuery(uint64(l))
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *QueryGetMachineByPublicKeyResponse) Size() (n int) {
|
||||||
|
if m == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
func sovQuery(x uint64) (n int) {
|
func sovQuery(x uint64) (n int) {
|
||||||
return (math_bits.Len64(x|1) + 6) / 7
|
return (math_bits.Len64(x|1) + 6) / 7
|
||||||
}
|
}
|
||||||
@ -451,6 +652,138 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
func (m *QueryGetMachineByPublicKeyRequest) Unmarshal(dAtA []byte) error {
|
||||||
|
l := len(dAtA)
|
||||||
|
iNdEx := 0
|
||||||
|
for iNdEx < l {
|
||||||
|
preIndex := iNdEx
|
||||||
|
var wire uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowQuery
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
wire |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fieldNum := int32(wire >> 3)
|
||||||
|
wireType := int(wire & 0x7)
|
||||||
|
if wireType == 4 {
|
||||||
|
return fmt.Errorf("proto: QueryGetMachineByPublicKeyRequest: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: QueryGetMachineByPublicKeyRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
|
}
|
||||||
|
switch fieldNum {
|
||||||
|
case 1:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowQuery
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthQuery
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthQuery
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.PublicKey = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
default:
|
||||||
|
iNdEx = preIndex
|
||||||
|
skippy, err := skipQuery(dAtA[iNdEx:])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
|
return ErrInvalidLengthQuery
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx += skippy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if iNdEx > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (m *QueryGetMachineByPublicKeyResponse) Unmarshal(dAtA []byte) error {
|
||||||
|
l := len(dAtA)
|
||||||
|
iNdEx := 0
|
||||||
|
for iNdEx < l {
|
||||||
|
preIndex := iNdEx
|
||||||
|
var wire uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowQuery
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
wire |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fieldNum := int32(wire >> 3)
|
||||||
|
wireType := int(wire & 0x7)
|
||||||
|
if wireType == 4 {
|
||||||
|
return fmt.Errorf("proto: QueryGetMachineByPublicKeyResponse: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: QueryGetMachineByPublicKeyResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
|
}
|
||||||
|
switch fieldNum {
|
||||||
|
default:
|
||||||
|
iNdEx = preIndex
|
||||||
|
skippy, err := skipQuery(dAtA[iNdEx:])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
|
return ErrInvalidLengthQuery
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx += skippy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if iNdEx > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
func skipQuery(dAtA []byte) (n int, err error) {
|
func skipQuery(dAtA []byte) (n int, err error) {
|
||||||
l := len(dAtA)
|
l := len(dAtA)
|
||||||
iNdEx := 0
|
iNdEx := 0
|
||||||
|
|||||||
@ -51,6 +51,60 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func request_Query_GetMachineByPublicKey_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var protoReq QueryGetMachineByPublicKeyRequest
|
||||||
|
var metadata runtime.ServerMetadata
|
||||||
|
|
||||||
|
var (
|
||||||
|
val string
|
||||||
|
ok bool
|
||||||
|
err error
|
||||||
|
_ = err
|
||||||
|
)
|
||||||
|
|
||||||
|
val, ok = pathParams["publicKey"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "publicKey")
|
||||||
|
}
|
||||||
|
|
||||||
|
protoReq.PublicKey, err = runtime.String(val)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "publicKey", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
msg, err := client.GetMachineByPublicKey(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||||
|
return msg, metadata, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func local_request_Query_GetMachineByPublicKey_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var protoReq QueryGetMachineByPublicKeyRequest
|
||||||
|
var metadata runtime.ServerMetadata
|
||||||
|
|
||||||
|
var (
|
||||||
|
val string
|
||||||
|
ok bool
|
||||||
|
err error
|
||||||
|
_ = err
|
||||||
|
)
|
||||||
|
|
||||||
|
val, ok = pathParams["publicKey"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "publicKey")
|
||||||
|
}
|
||||||
|
|
||||||
|
protoReq.PublicKey, err = runtime.String(val)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "publicKey", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
msg, err := server.GetMachineByPublicKey(ctx, &protoReq)
|
||||||
|
return msg, metadata, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
|
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
|
||||||
// UnaryRPC :call QueryServer directly.
|
// UnaryRPC :call QueryServer directly.
|
||||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||||
@ -80,6 +134,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mux.Handle("GET", pattern_Query_GetMachineByPublicKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
var stream runtime.ServerTransportStream
|
||||||
|
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := local_request_Query_GetMachineByPublicKey_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||||
|
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||||
|
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
forward_Query_GetMachineByPublicKey_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,13 +218,37 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mux.Handle("GET", pattern_Query_GetMachineByPublicKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := request_Query_GetMachineByPublicKey_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||||
|
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
forward_Query_GetMachineByPublicKey_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"planetmint-go", "machine", "params"}, "", runtime.AssumeColonVerbOpt(true)))
|
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"planetmint-go", "machine", "params"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||||
|
|
||||||
|
pattern_Query_GetMachineByPublicKey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"planetmint-go", "machine", "get_machine_by_public_key", "publicKey"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
forward_Query_Params_0 = runtime.ForwardResponseMessage
|
forward_Query_Params_0 = runtime.ForwardResponseMessage
|
||||||
|
|
||||||
|
forward_Query_GetMachineByPublicKey_0 = runtime.ForwardResponseMessage
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user