From bb1fdb9e8f102fd7868b4157e40848a121101742 Mon Sep 17 00:00:00 2001 From: Edward McFarlane Date: Tue, 9 May 2023 16:30:06 +0100 Subject: [PATCH 1/4] Tidy go modules --- go.sum | 2 -- 1 file changed, 2 deletions(-) diff --git a/go.sum b/go.sum index a7501e7..1860a03 100644 --- a/go.sum +++ b/go.sum @@ -26,7 +26,5 @@ google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.30.1-0.20230501154320-cf06b0c33cda h1:CGKs/jtLmFiQ0tmmt8ykIoaKqn+yi8T/reVFvwOR5aY= google.golang.org/protobuf v1.30.1-0.20230501154320-cf06b0c33cda/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= From e93acc24d51c69d5ee2725c8316cbdaa58545ffc Mon Sep 17 00:00:00 2001 From: Edward McFarlane Date: Tue, 19 Oct 2021 00:36:22 +0100 Subject: [PATCH 2/4] GraphQL init --- api/graphql.pb.go | 831 ++++++++++++++++++++++ api/graphql.proto | 113 +++ api/graphql_grpc.pb.go | 218 ++++++ graphql.go | 50 ++ graphql_test.go | 229 ++++++ testpb/starwars.pb.go | 553 +++++++++++++++ testpb/starwars.proto | 116 +++ testpb/starwars_grpc.pb.go | 173 +++++ testpb/test.pb.go | 1357 ++++++++++++++++++++++++++++++++++++ 9 files changed, 3640 insertions(+) create mode 100644 api/graphql.pb.go create mode 100644 api/graphql.proto create mode 100644 api/graphql_grpc.pb.go create mode 100644 graphql.go create mode 100644 graphql_test.go create mode 100644 testpb/starwars.pb.go create mode 100644 testpb/starwars.proto create mode 100644 testpb/starwars_grpc.pb.go create mode 100644 testpb/test.pb.go diff --git a/api/graphql.pb.go b/api/graphql.pb.go new file mode 100644 index 0000000..7e06ab2 --- /dev/null +++ b/api/graphql.pb.go @@ -0,0 +1,831 @@ +// Copyright 2021 Edward McFarlane. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.17.0 +// source: api/graphql.proto + +package api + +import ( + _ "google.golang.org/genproto/googleapis/api/annotations" + httpbody "google.golang.org/genproto/googleapis/api/httpbody" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + descriptorpb "google.golang.org/protobuf/types/descriptorpb" + anypb "google.golang.org/protobuf/types/known/anypb" + structpb "google.golang.org/protobuf/types/known/structpb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// GraphQL bindings. +type GraphQLRule struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Pattern: + // *GraphQLRule_Query + // *GraphQLRule_Mutation + // *GraphQLRule_Subscription + Pattern isGraphQLRule_Pattern `protobuf_oneof:"pattern"` + // Args is a mapping of fields. + Args []*Arg `protobuf:"bytes,4,rep,name=args,proto3" json:"args,omitempty"` + // Controls the Relay NodeID binding. + NodeId string `protobuf:"bytes,5,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + // Additional GraphQL bindings for the selector. Nested bindings must + // not contain an `additional_bindings` field themselves (that is, + // the nesting may only be one level deep). + AdditionalBindings []*GraphQLRule `protobuf:"bytes,6,rep,name=additional_bindings,json=additionalBindings,proto3" json:"additional_bindings,omitempty"` +} + +func (x *GraphQLRule) Reset() { + *x = GraphQLRule{} + if protoimpl.UnsafeEnabled { + mi := &file_api_graphql_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GraphQLRule) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphQLRule) ProtoMessage() {} + +func (x *GraphQLRule) ProtoReflect() protoreflect.Message { + mi := &file_api_graphql_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphQLRule.ProtoReflect.Descriptor instead. +func (*GraphQLRule) Descriptor() ([]byte, []int) { + return file_api_graphql_proto_rawDescGZIP(), []int{0} +} + +func (m *GraphQLRule) GetPattern() isGraphQLRule_Pattern { + if m != nil { + return m.Pattern + } + return nil +} + +func (x *GraphQLRule) GetQuery() string { + if x, ok := x.GetPattern().(*GraphQLRule_Query); ok { + return x.Query + } + return "" +} + +func (x *GraphQLRule) GetMutation() string { + if x, ok := x.GetPattern().(*GraphQLRule_Mutation); ok { + return x.Mutation + } + return "" +} + +func (x *GraphQLRule) GetSubscription() string { + if x, ok := x.GetPattern().(*GraphQLRule_Subscription); ok { + return x.Subscription + } + return "" +} + +func (x *GraphQLRule) GetArgs() []*Arg { + if x != nil { + return x.Args + } + return nil +} + +func (x *GraphQLRule) GetNodeId() string { + if x != nil { + return x.NodeId + } + return "" +} + +func (x *GraphQLRule) GetAdditionalBindings() []*GraphQLRule { + if x != nil { + return x.AdditionalBindings + } + return nil +} + +type isGraphQLRule_Pattern interface { + isGraphQLRule_Pattern() +} + +type GraphQLRule_Query struct { + Query string `protobuf:"bytes,1,opt,name=query,proto3,oneof"` +} + +type GraphQLRule_Mutation struct { + Mutation string `protobuf:"bytes,2,opt,name=mutation,proto3,oneof"` +} + +type GraphQLRule_Subscription struct { + Subscription string `protobuf:"bytes,3,opt,name=subscription,proto3,oneof"` +} + +func (*GraphQLRule_Query) isGraphQLRule_Pattern() {} + +func (*GraphQLRule_Mutation) isGraphQLRule_Pattern() {} + +func (*GraphQLRule_Subscription) isGraphQLRule_Pattern() {} + +type Arg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Field string `protobuf:"bytes,2,opt,name=field,proto3" json:"field,omitempty"` +} + +func (x *Arg) Reset() { + *x = Arg{} + if protoimpl.UnsafeEnabled { + mi := &file_api_graphql_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Arg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Arg) ProtoMessage() {} + +func (x *Arg) ProtoReflect() protoreflect.Message { + mi := &file_api_graphql_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Arg.ProtoReflect.Descriptor instead. +func (*Arg) Descriptor() ([]byte, []int) { + return file_api_graphql_proto_rawDescGZIP(), []int{1} +} + +func (x *Arg) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Arg) GetField() string { + if x != nil { + return x.Field + } + return "" +} + +// Connection +// https://relay.dev/graphql/connections.htm# +// A field that returns a Connection Type must include forward pagination +// arguments, backward pagination arguments, or both. These pagination arguments +// allow the client to slice the set of edges before it is returned. +// +// Forward Arguments: +// - first takes a non-negative integer. +// - after takes the cursor type as described in the cursor field section. +// +// Backward Arguments: +// - last takes a non-negative integer. +// - before takes the cursor type as described in the cursor field section. +type MessageConnection struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // TODO + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Method string `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"` + Args []*Arg `protobuf:"bytes,3,rep,name=args,proto3" json:"args,omitempty"` +} + +func (x *MessageConnection) Reset() { + *x = MessageConnection{} + if protoimpl.UnsafeEnabled { + mi := &file_api_graphql_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MessageConnection) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessageConnection) ProtoMessage() {} + +func (x *MessageConnection) ProtoReflect() protoreflect.Message { + mi := &file_api_graphql_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MessageConnection.ProtoReflect.Descriptor instead. +func (*MessageConnection) Descriptor() ([]byte, []int) { + return file_api_graphql_proto_rawDescGZIP(), []int{2} +} + +func (x *MessageConnection) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *MessageConnection) GetMethod() string { + if x != nil { + return x.Method + } + return "" +} + +func (x *MessageConnection) GetArgs() []*Arg { + if x != nil { + return x.Args + } + return nil +} + +// https://relay.dev/graphql/connections.htm +type PageInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + HasNextPage bool `protobuf:"varint,1,opt,name=has_next_page,json=hasNextPage,proto3" json:"has_next_page,omitempty"` + HasPreviousPage bool `protobuf:"varint,2,opt,name=has_previous_page,json=hasPreviousPage,proto3" json:"has_previous_page,omitempty"` + StartCursor []byte `protobuf:"bytes,3,opt,name=start_cursor,json=startCursor,proto3" json:"start_cursor,omitempty"` + EndCursor []byte `protobuf:"bytes,4,opt,name=end_cursor,json=endCursor,proto3" json:"end_cursor,omitempty"` +} + +func (x *PageInfo) Reset() { + *x = PageInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_api_graphql_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PageInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PageInfo) ProtoMessage() {} + +func (x *PageInfo) ProtoReflect() protoreflect.Message { + mi := &file_api_graphql_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PageInfo.ProtoReflect.Descriptor instead. +func (*PageInfo) Descriptor() ([]byte, []int) { + return file_api_graphql_proto_rawDescGZIP(), []int{3} +} + +func (x *PageInfo) GetHasNextPage() bool { + if x != nil { + return x.HasNextPage + } + return false +} + +func (x *PageInfo) GetHasPreviousPage() bool { + if x != nil { + return x.HasPreviousPage + } + return false +} + +func (x *PageInfo) GetStartCursor() []byte { + if x != nil { + return x.StartCursor + } + return nil +} + +func (x *PageInfo) GetEndCursor() []byte { + if x != nil { + return x.EndCursor + } + return nil +} + +type Connection struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Edges []*anypb.Any `protobuf:"bytes,1,rep,name=edges,proto3" json:"edges,omitempty"` + PageInfo *PageInfo `protobuf:"bytes,2,opt,name=page_info,json=pageInfo,proto3" json:"page_info,omitempty"` +} + +func (x *Connection) Reset() { + *x = Connection{} + if protoimpl.UnsafeEnabled { + mi := &file_api_graphql_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Connection) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Connection) ProtoMessage() {} + +func (x *Connection) ProtoReflect() protoreflect.Message { + mi := &file_api_graphql_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Connection.ProtoReflect.Descriptor instead. +func (*Connection) Descriptor() ([]byte, []int) { + return file_api_graphql_proto_rawDescGZIP(), []int{4} +} + +func (x *Connection) GetEdges() []*anypb.Any { + if x != nil { + return x.Edges + } + return nil +} + +func (x *Connection) GetPageInfo() *PageInfo { + if x != nil { + return x.PageInfo + } + return nil +} + +type GraphQLResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data *structpb.Struct `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + Errors []*anypb.Any `protobuf:"bytes,2,rep,name=errors,proto3" json:"errors,omitempty"` +} + +func (x *GraphQLResponse) Reset() { + *x = GraphQLResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_graphql_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GraphQLResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphQLResponse) ProtoMessage() {} + +func (x *GraphQLResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_graphql_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphQLResponse.ProtoReflect.Descriptor instead. +func (*GraphQLResponse) Descriptor() ([]byte, []int) { + return file_api_graphql_proto_rawDescGZIP(), []int{5} +} + +func (x *GraphQLResponse) GetData() *structpb.Struct { + if x != nil { + return x.Data + } + return nil +} + +func (x *GraphQLResponse) GetErrors() []*anypb.Any { + if x != nil { + return x.Errors + } + return nil +} + +type GetRelayNodeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *GetRelayNodeRequest) Reset() { + *x = GetRelayNodeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_graphql_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRelayNodeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRelayNodeRequest) ProtoMessage() {} + +func (x *GetRelayNodeRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_graphql_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRelayNodeRequest.ProtoReflect.Descriptor instead. +func (*GetRelayNodeRequest) Descriptor() ([]byte, []int) { + return file_api_graphql_proto_rawDescGZIP(), []int{6} +} + +func (x *GetRelayNodeRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +var file_api_graphql_proto_extTypes = []protoimpl.ExtensionInfo{ + { + ExtendedType: (*descriptorpb.MethodOptions)(nil), + ExtensionType: (*GraphQLRule)(nil), + Field: 72222228, + Name: "larking.api.relay", + Tag: "bytes,72222228,opt,name=relay", + Filename: "api/graphql.proto", + }, + { + ExtendedType: (*descriptorpb.FieldOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 70000, + Name: "larking.api.relay_id", + Tag: "varint,70000,opt,name=relay_id", + Filename: "api/graphql.proto", + }, + { + ExtendedType: (*descriptorpb.MessageOptions)(nil), + ExtensionType: (*MessageConnection)(nil), + Field: 70000, + Name: "larking.api.connection", + Tag: "bytes,70000,opt,name=connection", + Filename: "api/graphql.proto", + }, +} + +// Extension fields to descriptorpb.MethodOptions. +var ( + // Adds a method to the GraphQL query root. + // + // optional larking.api.GraphQLRule relay = 72222228; + E_Relay = &file_api_graphql_proto_extTypes[0] +) + +// Extension fields to descriptorpb.FieldOptions. +var ( + // Adds relay + // + // optional bool relay_id = 70000; + E_RelayId = &file_api_graphql_proto_extTypes[1] +) + +// Extension fields to descriptorpb.MessageOptions. +var ( + // optional larking.api.MessageConnection connection = 70000; + E_Connection = &file_api_graphql_proto_extTypes[2] +) + +var File_api_graphql_proto protoreflect.FileDescriptor + +var file_api_graphql_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x68, 0x71, 0x6c, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, + 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, + 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x68, 0x74, 0x74, 0x70, 0x62, + 0x6f, 0x64, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfe, 0x01, 0x0a, 0x0b, 0x47, 0x72, 0x61, 0x70, 0x68, 0x51, 0x4c, + 0x52, 0x75, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x08, + 0x6d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x08, 0x6d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x24, 0x0a, 0x0c, 0x73, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x48, 0x00, 0x52, 0x0c, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x24, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, + 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x72, 0x67, + 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, + 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, + 0x49, 0x0a, 0x13, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x62, 0x69, + 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6c, + 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x72, 0x61, 0x70, 0x68, + 0x51, 0x4c, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x12, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x61, 0x6c, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x22, 0x2f, 0x0a, 0x03, 0x41, 0x72, 0x67, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x14, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x65, 0x0a, 0x11, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x24, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x41, 0x72, 0x67, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x9c, 0x01, + 0x0a, 0x08, 0x50, 0x61, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x22, 0x0a, 0x0d, 0x68, 0x61, + 0x73, 0x5f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x0b, 0x68, 0x61, 0x73, 0x4e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x12, 0x2a, + 0x0a, 0x11, 0x68, 0x61, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x5f, 0x70, + 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x68, 0x61, 0x73, 0x50, 0x72, + 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x50, 0x61, 0x67, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x5f, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x43, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x12, 0x1d, 0x0a, + 0x0a, 0x65, 0x6e, 0x64, 0x5f, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x09, 0x65, 0x6e, 0x64, 0x43, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x22, 0x6c, 0x0a, 0x0a, + 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x64, + 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, + 0x05, 0x65, 0x64, 0x67, 0x65, 0x73, 0x12, 0x32, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x69, + 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6c, 0x61, 0x72, 0x6b, + 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, + 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x6c, 0x0a, 0x0f, 0x47, 0x72, + 0x61, 0x70, 0x68, 0x51, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, + 0x72, 0x75, 0x63, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2c, 0x0a, 0x06, 0x65, 0x72, + 0x72, 0x6f, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, + 0x52, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x22, 0x25, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x52, + 0x65, 0x6c, 0x61, 0x79, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x32, + 0x5a, 0x0a, 0x07, 0x47, 0x72, 0x61, 0x70, 0x68, 0x51, 0x4c, 0x12, 0x4f, 0x0a, 0x05, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x12, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x48, 0x74, 0x74, 0x70, 0x42, 0x6f, 0x64, 0x79, 0x1a, 0x1c, 0x2e, 0x6c, 0x61, 0x72, 0x6b, + 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x72, 0x61, 0x70, 0x68, 0x51, 0x4c, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x10, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0a, 0x22, + 0x08, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x68, 0x71, 0x6c, 0x30, 0x01, 0x32, 0x4f, 0x0a, 0x05, 0x52, + 0x65, 0x6c, 0x61, 0x79, 0x12, 0x46, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, + 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4e, 0x6f, 0x64, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x3a, 0x51, 0x0a, 0x05, + 0x72, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x94, 0x8c, 0xb8, 0x22, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x72, 0x61, + 0x70, 0x68, 0x51, 0x4c, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x05, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x3a, + 0x3d, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x69, 0x64, 0x12, 0x1d, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, + 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xf0, 0xa2, 0x04, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x49, 0x64, 0x88, 0x01, 0x01, 0x3a, 0x61, + 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xf0, 0xa2, + 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x65, 0x6d, 0x63, 0x66, 0x61, 0x72, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x6c, 0x61, 0x72, 0x6b, 0x69, + 0x6e, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x3b, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_api_graphql_proto_rawDescOnce sync.Once + file_api_graphql_proto_rawDescData = file_api_graphql_proto_rawDesc +) + +func file_api_graphql_proto_rawDescGZIP() []byte { + file_api_graphql_proto_rawDescOnce.Do(func() { + file_api_graphql_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_graphql_proto_rawDescData) + }) + return file_api_graphql_proto_rawDescData +} + +var file_api_graphql_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_api_graphql_proto_goTypes = []interface{}{ + (*GraphQLRule)(nil), // 0: larking.api.GraphQLRule + (*Arg)(nil), // 1: larking.api.Arg + (*MessageConnection)(nil), // 2: larking.api.MessageConnection + (*PageInfo)(nil), // 3: larking.api.PageInfo + (*Connection)(nil), // 4: larking.api.Connection + (*GraphQLResponse)(nil), // 5: larking.api.GraphQLResponse + (*GetRelayNodeRequest)(nil), // 6: larking.api.GetRelayNodeRequest + (*anypb.Any)(nil), // 7: google.protobuf.Any + (*structpb.Struct)(nil), // 8: google.protobuf.Struct + (*descriptorpb.MethodOptions)(nil), // 9: google.protobuf.MethodOptions + (*descriptorpb.FieldOptions)(nil), // 10: google.protobuf.FieldOptions + (*descriptorpb.MessageOptions)(nil), // 11: google.protobuf.MessageOptions + (*httpbody.HttpBody)(nil), // 12: google.api.HttpBody +} +var file_api_graphql_proto_depIdxs = []int32{ + 1, // 0: larking.api.GraphQLRule.args:type_name -> larking.api.Arg + 0, // 1: larking.api.GraphQLRule.additional_bindings:type_name -> larking.api.GraphQLRule + 1, // 2: larking.api.MessageConnection.args:type_name -> larking.api.Arg + 7, // 3: larking.api.Connection.edges:type_name -> google.protobuf.Any + 3, // 4: larking.api.Connection.page_info:type_name -> larking.api.PageInfo + 8, // 5: larking.api.GraphQLResponse.data:type_name -> google.protobuf.Struct + 7, // 6: larking.api.GraphQLResponse.errors:type_name -> google.protobuf.Any + 9, // 7: larking.api.relay:extendee -> google.protobuf.MethodOptions + 10, // 8: larking.api.relay_id:extendee -> google.protobuf.FieldOptions + 11, // 9: larking.api.connection:extendee -> google.protobuf.MessageOptions + 0, // 10: larking.api.relay:type_name -> larking.api.GraphQLRule + 2, // 11: larking.api.connection:type_name -> larking.api.MessageConnection + 12, // 12: larking.api.GraphQL.Query:input_type -> google.api.HttpBody + 6, // 13: larking.api.Relay.GetRelayNode:input_type -> larking.api.GetRelayNodeRequest + 5, // 14: larking.api.GraphQL.Query:output_type -> larking.api.GraphQLResponse + 7, // 15: larking.api.Relay.GetRelayNode:output_type -> google.protobuf.Any + 14, // [14:16] is the sub-list for method output_type + 12, // [12:14] is the sub-list for method input_type + 10, // [10:12] is the sub-list for extension type_name + 7, // [7:10] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_api_graphql_proto_init() } +func file_api_graphql_proto_init() { + if File_api_graphql_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_api_graphql_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GraphQLRule); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_graphql_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Arg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_graphql_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MessageConnection); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_graphql_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PageInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_graphql_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Connection); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_graphql_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GraphQLResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_graphql_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRelayNodeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_api_graphql_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*GraphQLRule_Query)(nil), + (*GraphQLRule_Mutation)(nil), + (*GraphQLRule_Subscription)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_graphql_proto_rawDesc, + NumEnums: 0, + NumMessages: 7, + NumExtensions: 3, + NumServices: 2, + }, + GoTypes: file_api_graphql_proto_goTypes, + DependencyIndexes: file_api_graphql_proto_depIdxs, + MessageInfos: file_api_graphql_proto_msgTypes, + ExtensionInfos: file_api_graphql_proto_extTypes, + }.Build() + File_api_graphql_proto = out.File + file_api_graphql_proto_rawDesc = nil + file_api_graphql_proto_goTypes = nil + file_api_graphql_proto_depIdxs = nil +} diff --git a/api/graphql.proto b/api/graphql.proto new file mode 100644 index 0000000..e19daf7 --- /dev/null +++ b/api/graphql.proto @@ -0,0 +1,113 @@ +// Copyright 2021 Edward McFarlane. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto3"; + +package larking.api; + +import "google/api/annotations.proto"; +import "google/api/httpbody.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/descriptor.proto"; +import "google/protobuf/struct.proto"; + +option go_package = "github.com/emcfarlane/larking/api;api"; + +// Relay GraphQL implementation +// https://relay.dev/docs/guides/graphql-server-specification/ +// http://spec.graphql.org/draft/ +// +// Cursor implementation +// https://relay.dev/assets/files/connections-932f4f2cdffd79724ac76373deb30dc8.htm# + +extend google.protobuf.MethodOptions { + // Adds a method to the GraphQL query root. + GraphQLRule relay = 72222228; +} + +extend google.protobuf.FieldOptions { + // Adds relay + optional bool relay_id = 70000; +} + +// GraphQL bindings. +message GraphQLRule { + oneof pattern { + string query = 1; + string mutation = 2; + string subscription = 3; + } + + // Args is a mapping of fields. + repeated Arg args = 4; + + // Controls the Relay NodeID binding. + string node_id = 5; + + // Additional GraphQL bindings for the selector. Nested bindings must + // not contain an `additional_bindings` field themselves (that is, + // the nesting may only be one level deep). + repeated GraphQLRule additional_bindings = 6; +} + +extend google.protobuf.MessageOptions { MessageConnection connection = 70000; } + +message Arg { + string name = 1; + string field = 2; +} + +// Connection +// https://relay.dev/graphql/connections.htm# +// A field that returns a Connection Type must include forward pagination +// arguments, backward pagination arguments, or both. These pagination arguments +// allow the client to slice the set of edges before it is returned. +// +// Forward Arguments: +// - first takes a non-negative integer. +// - after takes the cursor type as described in the cursor field section. +// +// Backward Arguments: +// - last takes a non-negative integer. +// - before takes the cursor type as described in the cursor field section. +message MessageConnection { + // TODO + string name = 1; + string method = 2; + repeated Arg args = 3; +} + +// https://relay.dev/graphql/connections.htm +message PageInfo { + bool has_next_page = 1; + bool has_previous_page = 2; + bytes start_cursor = 3; + bytes end_cursor = 4; +} + +message Connection { + repeated google.protobuf.Any edges = 1; + PageInfo page_info = 2; +} + +message GraphQLResponse { + google.protobuf.Struct data = 1; + repeated google.protobuf.Any errors = 2; +} + +service GraphQL { + rpc Query(google.api.HttpBody) returns (stream GraphQLResponse) { + option (google.api.http) = { + post : "/graphql" + }; + } +} + +message GetRelayNodeRequest { string id = 1; } + +// Relay service is a client required service for GraphQL options. +service Relay { + // GetRelayNode exposes ID! querying capabilities to the GraphQL service. + rpc GetRelayNode(GetRelayNodeRequest) returns (google.protobuf.Any); +} diff --git a/api/graphql_grpc.pb.go b/api/graphql_grpc.pb.go new file mode 100644 index 0000000..8081cb9 --- /dev/null +++ b/api/graphql_grpc.pb.go @@ -0,0 +1,218 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package api + +import ( + context "context" + httpbody "google.golang.org/genproto/googleapis/api/httpbody" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + anypb "google.golang.org/protobuf/types/known/anypb" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// GraphQLClient is the client API for GraphQL 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. +type GraphQLClient interface { + Query(ctx context.Context, in *httpbody.HttpBody, opts ...grpc.CallOption) (GraphQL_QueryClient, error) +} + +type graphQLClient struct { + cc grpc.ClientConnInterface +} + +func NewGraphQLClient(cc grpc.ClientConnInterface) GraphQLClient { + return &graphQLClient{cc} +} + +func (c *graphQLClient) Query(ctx context.Context, in *httpbody.HttpBody, opts ...grpc.CallOption) (GraphQL_QueryClient, error) { + stream, err := c.cc.NewStream(ctx, &GraphQL_ServiceDesc.Streams[0], "/larking.api.GraphQL/Query", opts...) + if err != nil { + return nil, err + } + x := &graphQLQueryClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type GraphQL_QueryClient interface { + Recv() (*GraphQLResponse, error) + grpc.ClientStream +} + +type graphQLQueryClient struct { + grpc.ClientStream +} + +func (x *graphQLQueryClient) Recv() (*GraphQLResponse, error) { + m := new(GraphQLResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// GraphQLServer is the server API for GraphQL service. +// All implementations must embed UnimplementedGraphQLServer +// for forward compatibility +type GraphQLServer interface { + Query(*httpbody.HttpBody, GraphQL_QueryServer) error + mustEmbedUnimplementedGraphQLServer() +} + +// UnimplementedGraphQLServer must be embedded to have forward compatible implementations. +type UnimplementedGraphQLServer struct { +} + +func (UnimplementedGraphQLServer) Query(*httpbody.HttpBody, GraphQL_QueryServer) error { + return status.Errorf(codes.Unimplemented, "method Query not implemented") +} +func (UnimplementedGraphQLServer) mustEmbedUnimplementedGraphQLServer() {} + +// UnsafeGraphQLServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to GraphQLServer will +// result in compilation errors. +type UnsafeGraphQLServer interface { + mustEmbedUnimplementedGraphQLServer() +} + +func RegisterGraphQLServer(s grpc.ServiceRegistrar, srv GraphQLServer) { + s.RegisterService(&GraphQL_ServiceDesc, srv) +} + +func _GraphQL_Query_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(httpbody.HttpBody) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(GraphQLServer).Query(m, &graphQLQueryServer{stream}) +} + +type GraphQL_QueryServer interface { + Send(*GraphQLResponse) error + grpc.ServerStream +} + +type graphQLQueryServer struct { + grpc.ServerStream +} + +func (x *graphQLQueryServer) Send(m *GraphQLResponse) error { + return x.ServerStream.SendMsg(m) +} + +// GraphQL_ServiceDesc is the grpc.ServiceDesc for GraphQL service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var GraphQL_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "larking.api.GraphQL", + HandlerType: (*GraphQLServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "Query", + Handler: _GraphQL_Query_Handler, + ServerStreams: true, + }, + }, + Metadata: "api/graphql.proto", +} + +// RelayClient is the client API for Relay 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. +type RelayClient interface { + // GetRelayNode exposes ID! querying capabilities to the GraphQL service. + GetRelayNode(ctx context.Context, in *GetRelayNodeRequest, opts ...grpc.CallOption) (*anypb.Any, error) +} + +type relayClient struct { + cc grpc.ClientConnInterface +} + +func NewRelayClient(cc grpc.ClientConnInterface) RelayClient { + return &relayClient{cc} +} + +func (c *relayClient) GetRelayNode(ctx context.Context, in *GetRelayNodeRequest, opts ...grpc.CallOption) (*anypb.Any, error) { + out := new(anypb.Any) + err := c.cc.Invoke(ctx, "/larking.api.Relay/GetRelayNode", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// RelayServer is the server API for Relay service. +// All implementations must embed UnimplementedRelayServer +// for forward compatibility +type RelayServer interface { + // GetRelayNode exposes ID! querying capabilities to the GraphQL service. + GetRelayNode(context.Context, *GetRelayNodeRequest) (*anypb.Any, error) + mustEmbedUnimplementedRelayServer() +} + +// UnimplementedRelayServer must be embedded to have forward compatible implementations. +type UnimplementedRelayServer struct { +} + +func (UnimplementedRelayServer) GetRelayNode(context.Context, *GetRelayNodeRequest) (*anypb.Any, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRelayNode not implemented") +} +func (UnimplementedRelayServer) mustEmbedUnimplementedRelayServer() {} + +// UnsafeRelayServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to RelayServer will +// result in compilation errors. +type UnsafeRelayServer interface { + mustEmbedUnimplementedRelayServer() +} + +func RegisterRelayServer(s grpc.ServiceRegistrar, srv RelayServer) { + s.RegisterService(&Relay_ServiceDesc, srv) +} + +func _Relay_GetRelayNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRelayNodeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RelayServer).GetRelayNode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/larking.api.Relay/GetRelayNode", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RelayServer).GetRelayNode(ctx, req.(*GetRelayNodeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Relay_ServiceDesc is the grpc.ServiceDesc for Relay service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Relay_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "larking.api.Relay", + HandlerType: (*RelayServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetRelayNode", + Handler: _Relay_GetRelayNode_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "api/graphql.proto", +} diff --git a/graphql.go b/graphql.go new file mode 100644 index 0000000..d2ba134 --- /dev/null +++ b/graphql.go @@ -0,0 +1,50 @@ +// Copyright 2021 Edward McFarlane. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package larking + +import ( + "encoding/json" + "fmt" + "log" + "net/http" + + "github.com/graphql-go/graphql" +) + +func (m *Mux) serveGraphQL(w http.ResponseWriter, r *http.Request) error { + fmt.Println("serve graphQL") + + // Schema + fields := graphql.Fields{ + "hello": &graphql.Field{ + Type: graphql.String, + Resolve: func(p graphql.ResolveParams) (interface{}, error) { + return "world", nil + }, + }, + } + rootQuery := graphql.ObjectConfig{Name: "RootQuery", Fields: fields} + schemaConfig := graphql.SchemaConfig{Query: graphql.NewObject(rootQuery)} + schema, err := graphql.NewSchema(schemaConfig) + if err != nil { + log.Fatalf("failed to create new schema, error: %v", err) + } + + // Query + query := ` + { + hello + } + ` + params := graphql.Params{Schema: schema, RequestString: query} + res := graphql.Do(params) + if len(res.Errors) > 0 { + log.Printf("failed to execute graphql operation, errors: %v", res.Errors) + return fmt.Errorf("%v", res.Errors) + } + rJSON, err := json.Marshal(r) + fmt.Printf("%s \n", rJSON) // {"data":{"hello":"world"}} + return err +} diff --git a/graphql_test.go b/graphql_test.go new file mode 100644 index 0000000..5d4436d --- /dev/null +++ b/graphql_test.go @@ -0,0 +1,229 @@ +// Copyright 2021 Edward McFarlane. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package larking + +import ( + "context" + "io/ioutil" + "net/http" + "net/http/httptest" + "strings" + "testing" + + "github.com/emcfarlane/larking/testpb" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type starWarsServer struct { + factions map[string]*testpb.Faction + ships map[string]*testpb.Ship + factionShips map[string][]*testpb.Ship +} + +func newStarWarsServer(t *testing.T) *starWarsServer { + var ( + xwing = &testpb.Ship{ + Name: "factions/1/ships/1", + DisplayName: "X-Wing", + } + ywing = &testpb.Ship{ + Name: "factions/1/ships/2", + DisplayName: "Y-Wing", + } + awing = &testpb.Ship{ + Name: "factions/1/ships/3", + DisplayName: "A-Wing", + } + falcon = &testpb.Ship{ + Name: "factions/1/ships/4", + DisplayName: "Millenium Falcon", + } + homeOne = &testpb.Ship{ + Name: "factions/1/ships/5", + DisplayName: "Home One", + } + tieFighter = &testpb.Ship{ + Name: "factions/2/ships/6", + DisplayName: "TIE Fighter", + } + tieInterceptor = &testpb.Ship{ + Name: "factions/2/ships/7", + DisplayName: "TIE Interceptor", + } + executor = &testpb.Ship{ + Name: "factions/2/ships/8", + DisplayName: "Executor", + } + + rebels = &testpb.Faction{ + Name: "factions/1", + DisplayName: "Alliance to Restore the Republic", + } + empire = &testpb.Faction{ + Name: "factions/2", + DisplayName: "Galactic Empire", + } + ) + + return &starWarsServer{ + factions: map[string]*testpb.Faction{ + "factions/1": rebels, + "factions/2": empire, + }, + ships: map[string]*testpb.Ship{ + "factions/1/ships/1": xwing, + "factions/1/ships/2": ywing, + "factions/1/ships/3": awing, + "factions/1/ships/4": falcon, + "factions/1/ships/5": homeOne, + "factions/2/ships/6": tieFighter, + "factions/2/ships/7": tieInterceptor, + "factions/2/ships/8": executor, + }, + factionShips: map[string][]*testpb.Ship{ + "factions/1": {xwing, ywing, awing, falcon, homeOne}, + "factions/2": {tieFighter, tieInterceptor, executor}, + }, + } +} + +func (s *starWarsServer) GetFaction(ctx context.Context, req *testpb.GetFactionRequest) (*testpb.Faction, error) { + //id := strings.TrimPrefix("factions/", req.Name) + v, ok := s.factions[req.Name] + if !ok { + return nil, status.Errorf(codes.NotFound, "missing faction: %s", req.Name) + } + return v, nil +} + +func (s *starWarsServer) GetShip(ctx context.Context, req *testpb.GetShipRequest) (*testpb.Ship, error) { + //id := strings.TrimPrefix("ships/", req.Name) + v, ok := s.ships[req.Name] + if !ok { + return nil, status.Errorf(codes.NotFound, "missing ship: %s", req.Name) + } + return v, nil +} + +func (s *starWarsServer) ListShips(ctx context.Context, req *testpb.ListShipsRequest) (*testpb.ListShipsResponse, error) { + //pid := strings.TrimPrefix(req.Parent, "factions/") + vs, ok := s.factionShips[req.Parent] + if !ok { + return nil, status.Errorf(codes.NotFound, "missing factions ships: %s", req.Parent) + } + pageSize := int(req.PageSize) + if pageSize <= 0 { + pageSize = 10 + } + pageToken := req.PageToken + + if pageToken != "" { + for i, v := range vs { + if v.Name == pageToken { + vs = vs[i+1:] + break + } + } + } + + if len(vs) > pageSize { + vs = vs[:pageSize] + } + + var nextPageToken string + if len(vs) > 0 { + nextPageToken = vs[len(vs)-1].Name + } + + return &testpb.ListShipsResponse{ + Ships: vs, + NextPageToken: nextPageToken, + }, nil +} + +//func (s *starWarsServer) GetRelayNode(ctx context.Context, req *api.GetRelayNodeRequest) (*anypb.Any, error) { +// ps := strings.Split(req.Id, "/") +// if len(ps) != 2 { +// return nil, status.Errorf(codes.InvalidArgument, "invalid name: %v", req.Id) +// } +// switch pfx := ps[0]; pfx { +// case "factions": +// v, err := s.GetFaction(ctx, &testpb.GetFactionRequest{Name: req.Id}) +// if err != nil { +// return nil, err +// } +// return anypb.New(v) +// case "ships": +// v, err := s.GetShip(ctx, &testpb.GetShipRequest{Name: req.Id}) +// if err != nil { +// return nil, err +// } +// return anypb.New(v) +// default: +// return nil, status.Errorf(codes.NotFound, "missing node: %s", req.Id) +// } +//} + +func TestGraphQLStarWars(t *testing.T) { + ss := newStarWarsServer(t) + + m, err := NewMux() + if err != nil { + t.Fatal(err) + } + if err := m.RegisterServiceByName("larking.testpb.StarWars", ss); err != nil { + t.Fatal(err) + } + + tests := []struct { + name string + query string + want string + wantErr error + }{{ + name: "getRebels", + query: `query RebelsQuery { + rebels { + id + name + } +}`, + want: `{ + "rebels": { + "id": "RmFjdGlvbjox", + "name": "Alliance to Restore the Republic" + } +}`, + }} + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + r := httptest.NewRequest( + http.MethodPost, "/graphql", strings.NewReader(tt.query), + ) + r.Header.Set("Content-Type", "application/json") + w := httptest.NewRecorder() + + m.ServeHTTP(w, r) + t.Log(w) + res := w.Result() + if res.StatusCode != 200 { + t.Fatal(res.Status) + } + + data, err := ioutil.ReadAll(r.Body) + if err != nil { + t.Fatal(err) + } + t.Log(string(data)) + + if rsp := string(data); rsp != tt.want { + t.Fatalf("response mismatch: %s != %s", rsp, tt.want) + } + + }) + } +} diff --git a/testpb/starwars.pb.go b/testpb/starwars.pb.go new file mode 100644 index 0000000..653fa93 --- /dev/null +++ b/testpb/starwars.pb.go @@ -0,0 +1,553 @@ +// Copyright 2021 Edward McFarlane. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.17.0 +// source: testpb/starwars.proto + +package testpb + +import ( + _ "github.com/emcfarlane/larking/api" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Faction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + //[ (larking.api.relay).node = { + // method : "/larking.testpb.StarWars/GetFaction/" + // matches : "{name=factions/*}" + //} ]; + DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` +} + +func (x *Faction) Reset() { + *x = Faction{} + if protoimpl.UnsafeEnabled { + mi := &file_testpb_starwars_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Faction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Faction) ProtoMessage() {} + +func (x *Faction) ProtoReflect() protoreflect.Message { + mi := &file_testpb_starwars_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Faction.ProtoReflect.Descriptor instead. +func (*Faction) Descriptor() ([]byte, []int) { + return file_testpb_starwars_proto_rawDescGZIP(), []int{0} +} + +func (x *Faction) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Faction) GetDisplayName() string { + if x != nil { + return x.DisplayName + } + return "" +} + +type GetFactionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *GetFactionRequest) Reset() { + *x = GetFactionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_testpb_starwars_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetFactionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFactionRequest) ProtoMessage() {} + +func (x *GetFactionRequest) ProtoReflect() protoreflect.Message { + mi := &file_testpb_starwars_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFactionRequest.ProtoReflect.Descriptor instead. +func (*GetFactionRequest) Descriptor() ([]byte, []int) { + return file_testpb_starwars_proto_rawDescGZIP(), []int{1} +} + +func (x *GetFactionRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type Ship struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` +} + +func (x *Ship) Reset() { + *x = Ship{} + if protoimpl.UnsafeEnabled { + mi := &file_testpb_starwars_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Ship) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Ship) ProtoMessage() {} + +func (x *Ship) ProtoReflect() protoreflect.Message { + mi := &file_testpb_starwars_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Ship.ProtoReflect.Descriptor instead. +func (*Ship) Descriptor() ([]byte, []int) { + return file_testpb_starwars_proto_rawDescGZIP(), []int{2} +} + +func (x *Ship) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Ship) GetDisplayName() string { + if x != nil { + return x.DisplayName + } + return "" +} + +type GetShipRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *GetShipRequest) Reset() { + *x = GetShipRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_testpb_starwars_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetShipRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetShipRequest) ProtoMessage() {} + +func (x *GetShipRequest) ProtoReflect() protoreflect.Message { + mi := &file_testpb_starwars_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetShipRequest.ProtoReflect.Descriptor instead. +func (*GetShipRequest) Descriptor() ([]byte, []int) { + return file_testpb_starwars_proto_rawDescGZIP(), []int{3} +} + +func (x *GetShipRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type ListShipsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` +} + +func (x *ListShipsRequest) Reset() { + *x = ListShipsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_testpb_starwars_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListShipsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListShipsRequest) ProtoMessage() {} + +func (x *ListShipsRequest) ProtoReflect() protoreflect.Message { + mi := &file_testpb_starwars_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListShipsRequest.ProtoReflect.Descriptor instead. +func (*ListShipsRequest) Descriptor() ([]byte, []int) { + return file_testpb_starwars_proto_rawDescGZIP(), []int{4} +} + +func (x *ListShipsRequest) GetParent() string { + if x != nil { + return x.Parent + } + return "" +} + +func (x *ListShipsRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListShipsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +type ListShipsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ships []*Ship `protobuf:"bytes,1,rep,name=ships,proto3" json:"ships,omitempty"` + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListShipsResponse) Reset() { + *x = ListShipsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_testpb_starwars_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListShipsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListShipsResponse) ProtoMessage() {} + +func (x *ListShipsResponse) ProtoReflect() protoreflect.Message { + mi := &file_testpb_starwars_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListShipsResponse.ProtoReflect.Descriptor instead. +func (*ListShipsResponse) Descriptor() ([]byte, []int) { + return file_testpb_starwars_proto_rawDescGZIP(), []int{5} +} + +func (x *ListShipsResponse) GetShips() []*Ship { + if x != nil { + return x.Ships + } + return nil +} + +func (x *ListShipsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +var File_testpb_starwars_proto protoreflect.FileDescriptor + +var file_testpb_starwars_proto_rawDesc = []byte{ + 0x0a, 0x15, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2f, 0x73, 0x74, 0x61, 0x72, 0x77, 0x61, 0x72, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x68, + 0x71, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x40, 0x0a, 0x07, 0x46, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x70, 0x6c, + 0x61, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, + 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x27, 0x0a, 0x11, 0x47, 0x65, + 0x74, 0x46, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x22, 0x43, 0x0a, 0x04, 0x53, 0x68, 0x69, 0x70, 0x12, 0x18, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0x80, 0x97, 0x22, 0x01, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, + 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x24, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x53, + 0x68, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x66, + 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x69, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, + 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, + 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, + 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x67, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, + 0x69, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x73, + 0x68, 0x69, 0x70, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6c, 0x61, 0x72, + 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x53, 0x68, 0x69, 0x70, + 0x52, 0x05, 0x73, 0x68, 0x69, 0x70, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, + 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x32, + 0x83, 0x03, 0x0a, 0x08, 0x53, 0x74, 0x61, 0x72, 0x57, 0x61, 0x72, 0x73, 0x12, 0x95, 0x01, 0x0a, + 0x0a, 0x47, 0x65, 0x74, 0x46, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x2e, 0x6c, 0x61, + 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, + 0x46, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, + 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, + 0x46, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4b, 0xa2, 0xe1, 0xc0, 0x93, 0x02, 0x28, 0x0a, + 0x07, 0x66, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x0a, 0x0a, 0x02, 0x69, 0x64, 0x12, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x2a, 0x11, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x66, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x2a, 0x7d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x12, 0x15, 0x2f, + 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x66, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x77, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x69, 0x70, + 0x73, 0x12, 0x20, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, + 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x69, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x69, 0x70, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x12, 0x1d, + 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x66, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x73, 0x68, 0x69, 0x70, 0x73, 0x12, 0x66, 0x0a, + 0x07, 0x47, 0x65, 0x74, 0x53, 0x68, 0x69, 0x70, 0x12, 0x1e, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, + 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x68, 0x69, + 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, + 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x53, 0x68, 0x69, 0x70, 0x22, 0x25, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x12, 0x1d, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, + 0x65, 0x3d, 0x66, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x2a, 0x2f, 0x73, 0x68, 0x69, + 0x70, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0x2d, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6d, 0x63, 0x66, 0x61, 0x72, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x6c, + 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x3b, 0x74, 0x65, + 0x73, 0x74, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_testpb_starwars_proto_rawDescOnce sync.Once + file_testpb_starwars_proto_rawDescData = file_testpb_starwars_proto_rawDesc +) + +func file_testpb_starwars_proto_rawDescGZIP() []byte { + file_testpb_starwars_proto_rawDescOnce.Do(func() { + file_testpb_starwars_proto_rawDescData = protoimpl.X.CompressGZIP(file_testpb_starwars_proto_rawDescData) + }) + return file_testpb_starwars_proto_rawDescData +} + +var file_testpb_starwars_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_testpb_starwars_proto_goTypes = []interface{}{ + (*Faction)(nil), // 0: larking.testpb.Faction + (*GetFactionRequest)(nil), // 1: larking.testpb.GetFactionRequest + (*Ship)(nil), // 2: larking.testpb.Ship + (*GetShipRequest)(nil), // 3: larking.testpb.GetShipRequest + (*ListShipsRequest)(nil), // 4: larking.testpb.ListShipsRequest + (*ListShipsResponse)(nil), // 5: larking.testpb.ListShipsResponse +} +var file_testpb_starwars_proto_depIdxs = []int32{ + 2, // 0: larking.testpb.ListShipsResponse.ships:type_name -> larking.testpb.Ship + 1, // 1: larking.testpb.StarWars.GetFaction:input_type -> larking.testpb.GetFactionRequest + 4, // 2: larking.testpb.StarWars.ListShips:input_type -> larking.testpb.ListShipsRequest + 3, // 3: larking.testpb.StarWars.GetShip:input_type -> larking.testpb.GetShipRequest + 0, // 4: larking.testpb.StarWars.GetFaction:output_type -> larking.testpb.Faction + 5, // 5: larking.testpb.StarWars.ListShips:output_type -> larking.testpb.ListShipsResponse + 2, // 6: larking.testpb.StarWars.GetShip:output_type -> larking.testpb.Ship + 4, // [4:7] is the sub-list for method output_type + 1, // [1:4] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_testpb_starwars_proto_init() } +func file_testpb_starwars_proto_init() { + if File_testpb_starwars_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_testpb_starwars_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Faction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testpb_starwars_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetFactionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testpb_starwars_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Ship); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testpb_starwars_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetShipRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testpb_starwars_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListShipsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testpb_starwars_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListShipsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_testpb_starwars_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_testpb_starwars_proto_goTypes, + DependencyIndexes: file_testpb_starwars_proto_depIdxs, + MessageInfos: file_testpb_starwars_proto_msgTypes, + }.Build() + File_testpb_starwars_proto = out.File + file_testpb_starwars_proto_rawDesc = nil + file_testpb_starwars_proto_goTypes = nil + file_testpb_starwars_proto_depIdxs = nil +} diff --git a/testpb/starwars.proto b/testpb/starwars.proto new file mode 100644 index 0000000..1f5d274 --- /dev/null +++ b/testpb/starwars.proto @@ -0,0 +1,116 @@ +// Copyright 2021 Edward McFarlane. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +syntax = "proto3"; + +package larking.testpb; + +import "google/api/annotations.proto"; +import "api/graphql.proto"; +// import "google/protobuf/empty.proto"; + +option go_package = "github.com/emcfarlane/larking/testpb;testpb"; + +message Faction { + // option (larking.api.relay).node = { + // rpc : "larking.testpb.StarWars.GetFaction(id : id)" + // method : "/larking.testpb.Starwars/GetFaction/" + // args : { + // "name" : "{id}" + // } + // id : "factions/{name}" + // match : "factions/*" + //}; + + string name = 1; + //[ (larking.api.relay).node = { + // method : "/larking.testpb.StarWars/GetFaction/" + // matches : "{name=factions/*}" + //} ]; + string display_name = 2; + + // arg "{parent}" + // arg "page_size:{first} + // query_arg { name : "after" field_path: " + + // option (larking.api.relay).connection = { + // name : "ships" + // method : "/larking.testpb.StarWars/ListShips/" + // args { + // "{name}" : "parent", + // "first" : "page_size", + // "after" : "page_token", + // } + //}; +} + +message GetFactionRequest { string name = 1; } + +message Ship { + // option (larking.api.relay).node = { + // rpc : "larking.testpb.StarWars.GetShip(id : id)" + //}; + + string name = 1 [ (larking.api.relay_id) = true ]; + string display_name = 2; +} + +message GetShipRequest { string name = 1; } + +message ListShipsRequest { + string parent = 1; + int32 page_size = 2; + string page_token = 3; +} + +message ListShipsResponse { + repeated Ship ships = 1; + string next_page_token = 2; +} + +// type Query { +// rebels: Faction +// empire: Faction +// node(id: ID!): Node +//} +// +// type Mutation { +// introduceShip(input: IntroduceShipInput!): IntroduceShipPayload +//} +service StarWars { + + rpc GetFaction(GetFactionRequest) returns (Faction) { + option (larking.api.relay) = { + query : "faction" + args {name : "id" field : "name"} + node_id : "{name=factions/*}" + + // TODO: empire/rebel routes? + // TODO: default constant args? + // additional_bindings { + // query : "rebels" + // args {"name" : "id=factions/1"} + //} + // additional_bindings { + // query : "empire" + // args {"name" : "id=factions/2"} + //} + }; + option (google.api.http) = { + get : "/v1/{name=factions/*}" + }; + } + + rpc ListShips(ListShipsRequest) returns (ListShipsResponse) { + option (google.api.http) = { + get : "/v1/{parent=factions/*}/ships" + }; + } + + rpc GetShip(GetShipRequest) returns (Ship) { + option (google.api.http) = { + get : "/v1/{name=factions/*/ships/*}" + }; + } +} diff --git a/testpb/starwars_grpc.pb.go b/testpb/starwars_grpc.pb.go new file mode 100644 index 0000000..037b94e --- /dev/null +++ b/testpb/starwars_grpc.pb.go @@ -0,0 +1,173 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package testpb + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// StarWarsClient is the client API for StarWars 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. +type StarWarsClient interface { + GetFaction(ctx context.Context, in *GetFactionRequest, opts ...grpc.CallOption) (*Faction, error) + ListShips(ctx context.Context, in *ListShipsRequest, opts ...grpc.CallOption) (*ListShipsResponse, error) + GetShip(ctx context.Context, in *GetShipRequest, opts ...grpc.CallOption) (*Ship, error) +} + +type starWarsClient struct { + cc grpc.ClientConnInterface +} + +func NewStarWarsClient(cc grpc.ClientConnInterface) StarWarsClient { + return &starWarsClient{cc} +} + +func (c *starWarsClient) GetFaction(ctx context.Context, in *GetFactionRequest, opts ...grpc.CallOption) (*Faction, error) { + out := new(Faction) + err := c.cc.Invoke(ctx, "/larking.testpb.StarWars/GetFaction", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *starWarsClient) ListShips(ctx context.Context, in *ListShipsRequest, opts ...grpc.CallOption) (*ListShipsResponse, error) { + out := new(ListShipsResponse) + err := c.cc.Invoke(ctx, "/larking.testpb.StarWars/ListShips", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *starWarsClient) GetShip(ctx context.Context, in *GetShipRequest, opts ...grpc.CallOption) (*Ship, error) { + out := new(Ship) + err := c.cc.Invoke(ctx, "/larking.testpb.StarWars/GetShip", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// StarWarsServer is the server API for StarWars service. +// All implementations must embed UnimplementedStarWarsServer +// for forward compatibility +type StarWarsServer interface { + GetFaction(context.Context, *GetFactionRequest) (*Faction, error) + ListShips(context.Context, *ListShipsRequest) (*ListShipsResponse, error) + GetShip(context.Context, *GetShipRequest) (*Ship, error) + mustEmbedUnimplementedStarWarsServer() +} + +// UnimplementedStarWarsServer must be embedded to have forward compatible implementations. +type UnimplementedStarWarsServer struct { +} + +func (UnimplementedStarWarsServer) GetFaction(context.Context, *GetFactionRequest) (*Faction, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetFaction not implemented") +} +func (UnimplementedStarWarsServer) ListShips(context.Context, *ListShipsRequest) (*ListShipsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListShips not implemented") +} +func (UnimplementedStarWarsServer) GetShip(context.Context, *GetShipRequest) (*Ship, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetShip not implemented") +} +func (UnimplementedStarWarsServer) mustEmbedUnimplementedStarWarsServer() {} + +// UnsafeStarWarsServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to StarWarsServer will +// result in compilation errors. +type UnsafeStarWarsServer interface { + mustEmbedUnimplementedStarWarsServer() +} + +func RegisterStarWarsServer(s grpc.ServiceRegistrar, srv StarWarsServer) { + s.RegisterService(&StarWars_ServiceDesc, srv) +} + +func _StarWars_GetFaction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetFactionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StarWarsServer).GetFaction(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/larking.testpb.StarWars/GetFaction", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StarWarsServer).GetFaction(ctx, req.(*GetFactionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _StarWars_ListShips_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListShipsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StarWarsServer).ListShips(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/larking.testpb.StarWars/ListShips", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StarWarsServer).ListShips(ctx, req.(*ListShipsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _StarWars_GetShip_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetShipRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StarWarsServer).GetShip(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/larking.testpb.StarWars/GetShip", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StarWarsServer).GetShip(ctx, req.(*GetShipRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// StarWars_ServiceDesc is the grpc.ServiceDesc for StarWars service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var StarWars_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "larking.testpb.StarWars", + HandlerType: (*StarWarsServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetFaction", + Handler: _StarWars_GetFaction_Handler, + }, + { + MethodName: "ListShips", + Handler: _StarWars_ListShips_Handler, + }, + { + MethodName: "GetShip", + Handler: _StarWars_GetShip_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "testpb/starwars.proto", +} diff --git a/testpb/test.pb.go b/testpb/test.pb.go new file mode 100644 index 0000000..a85204a --- /dev/null +++ b/testpb/test.pb.go @@ -0,0 +1,1357 @@ +// Copyright 2021 Edward McFarlane. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.17.0 +// source: testpb/test.proto + +package testpb + +import ( + _ "google.golang.org/genproto/googleapis/api/annotations" + httpbody "google.golang.org/genproto/googleapis/api/httpbody" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + durationpb "google.golang.org/protobuf/types/known/durationpb" + emptypb "google.golang.org/protobuf/types/known/emptypb" + fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Message struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MessageId string `protobuf:"bytes,1,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"` + Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"` // The resource content + UserId string `protobuf:"bytes,3,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` +} + +func (x *Message) Reset() { + *x = Message{} + if protoimpl.UnsafeEnabled { + mi := &file_testpb_test_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Message) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Message) ProtoMessage() {} + +func (x *Message) ProtoReflect() protoreflect.Message { + mi := &file_testpb_test_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Message.ProtoReflect.Descriptor instead. +func (*Message) Descriptor() ([]byte, []int) { + return file_testpb_test_proto_rawDescGZIP(), []int{0} +} + +func (x *Message) GetMessageId() string { + if x != nil { + return x.MessageId + } + return "" +} + +func (x *Message) GetText() string { + if x != nil { + return x.Text + } + return "" +} + +func (x *Message) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type GetMessageRequestOne struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // Mapped to URL path +} + +func (x *GetMessageRequestOne) Reset() { + *x = GetMessageRequestOne{} + if protoimpl.UnsafeEnabled { + mi := &file_testpb_test_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetMessageRequestOne) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMessageRequestOne) ProtoMessage() {} + +func (x *GetMessageRequestOne) ProtoReflect() protoreflect.Message { + mi := &file_testpb_test_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMessageRequestOne.ProtoReflect.Descriptor instead. +func (*GetMessageRequestOne) Descriptor() ([]byte, []int) { + return file_testpb_test_proto_rawDescGZIP(), []int{1} +} + +func (x *GetMessageRequestOne) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type GetMessageRequestTwo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MessageId string `protobuf:"bytes,1,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"` // Mapped to URL path + Revision int64 `protobuf:"varint,2,opt,name=revision,proto3" json:"revision,omitempty"` // Mapped to URL query parameter `revision` + Sub *GetMessageRequestTwo_SubMessage `protobuf:"bytes,3,opt,name=sub,proto3" json:"sub,omitempty"` // Mapped to URL query parameter `sub.subfield` + UserId string `protobuf:"bytes,4,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // Additional binding +} + +func (x *GetMessageRequestTwo) Reset() { + *x = GetMessageRequestTwo{} + if protoimpl.UnsafeEnabled { + mi := &file_testpb_test_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetMessageRequestTwo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMessageRequestTwo) ProtoMessage() {} + +func (x *GetMessageRequestTwo) ProtoReflect() protoreflect.Message { + mi := &file_testpb_test_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMessageRequestTwo.ProtoReflect.Descriptor instead. +func (*GetMessageRequestTwo) Descriptor() ([]byte, []int) { + return file_testpb_test_proto_rawDescGZIP(), []int{2} +} + +func (x *GetMessageRequestTwo) GetMessageId() string { + if x != nil { + return x.MessageId + } + return "" +} + +func (x *GetMessageRequestTwo) GetRevision() int64 { + if x != nil { + return x.Revision + } + return 0 +} + +func (x *GetMessageRequestTwo) GetSub() *GetMessageRequestTwo_SubMessage { + if x != nil { + return x.Sub + } + return nil +} + +func (x *GetMessageRequestTwo) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type UpdateMessageRequestOne struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MessageId string `protobuf:"bytes,1,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"` // Mapped to the URL + Message *Message `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` // Mapped to the body +} + +func (x *UpdateMessageRequestOne) Reset() { + *x = UpdateMessageRequestOne{} + if protoimpl.UnsafeEnabled { + mi := &file_testpb_test_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateMessageRequestOne) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateMessageRequestOne) ProtoMessage() {} + +func (x *UpdateMessageRequestOne) ProtoReflect() protoreflect.Message { + mi := &file_testpb_test_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateMessageRequestOne.ProtoReflect.Descriptor instead. +func (*UpdateMessageRequestOne) Descriptor() ([]byte, []int) { + return file_testpb_test_proto_rawDescGZIP(), []int{3} +} + +func (x *UpdateMessageRequestOne) GetMessageId() string { + if x != nil { + return x.MessageId + } + return "" +} + +func (x *UpdateMessageRequestOne) GetMessage() *Message { + if x != nil { + return x.Message + } + return nil +} + +type UploadFileRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"` + File *httpbody.HttpBody `protobuf:"bytes,2,opt,name=file,proto3" json:"file,omitempty"` +} + +func (x *UploadFileRequest) Reset() { + *x = UploadFileRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_testpb_test_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UploadFileRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UploadFileRequest) ProtoMessage() {} + +func (x *UploadFileRequest) ProtoReflect() protoreflect.Message { + mi := &file_testpb_test_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UploadFileRequest.ProtoReflect.Descriptor instead. +func (*UploadFileRequest) Descriptor() ([]byte, []int) { + return file_testpb_test_proto_rawDescGZIP(), []int{4} +} + +func (x *UploadFileRequest) GetFilename() string { + if x != nil { + return x.Filename + } + return "" +} + +func (x *UploadFileRequest) GetFile() *httpbody.HttpBody { + if x != nil { + return x.File + } + return nil +} + +type Scalars struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Timestamp *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Duration *durationpb.Duration `protobuf:"bytes,2,opt,name=duration,proto3" json:"duration,omitempty"` + BoolValue *wrapperspb.BoolValue `protobuf:"bytes,3,opt,name=bool_value,json=boolValue,proto3" json:"bool_value,omitempty"` + Int32Value *wrapperspb.Int32Value `protobuf:"bytes,4,opt,name=int32_value,json=int32Value,proto3" json:"int32_value,omitempty"` + Int64Value *wrapperspb.Int64Value `protobuf:"bytes,5,opt,name=int64_value,json=int64Value,proto3" json:"int64_value,omitempty"` + Uint32Value *wrapperspb.UInt32Value `protobuf:"bytes,6,opt,name=uint32_value,json=uint32Value,proto3" json:"uint32_value,omitempty"` + Uint64Value *wrapperspb.UInt64Value `protobuf:"bytes,7,opt,name=uint64_value,json=uint64Value,proto3" json:"uint64_value,omitempty"` + FloatValue *wrapperspb.FloatValue `protobuf:"bytes,8,opt,name=float_value,json=floatValue,proto3" json:"float_value,omitempty"` + DoubleValue *wrapperspb.DoubleValue `protobuf:"bytes,9,opt,name=double_value,json=doubleValue,proto3" json:"double_value,omitempty"` + BytesValue *wrapperspb.BytesValue `protobuf:"bytes,10,opt,name=bytes_value,json=bytesValue,proto3" json:"bytes_value,omitempty"` + StringValue *wrapperspb.StringValue `protobuf:"bytes,11,opt,name=string_value,json=stringValue,proto3" json:"string_value,omitempty"` + FieldMask *fieldmaskpb.FieldMask `protobuf:"bytes,12,opt,name=field_mask,json=fieldMask,proto3" json:"field_mask,omitempty"` +} + +func (x *Scalars) Reset() { + *x = Scalars{} + if protoimpl.UnsafeEnabled { + mi := &file_testpb_test_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Scalars) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Scalars) ProtoMessage() {} + +func (x *Scalars) ProtoReflect() protoreflect.Message { + mi := &file_testpb_test_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Scalars.ProtoReflect.Descriptor instead. +func (*Scalars) Descriptor() ([]byte, []int) { + return file_testpb_test_proto_rawDescGZIP(), []int{5} +} + +func (x *Scalars) GetTimestamp() *timestamppb.Timestamp { + if x != nil { + return x.Timestamp + } + return nil +} + +func (x *Scalars) GetDuration() *durationpb.Duration { + if x != nil { + return x.Duration + } + return nil +} + +func (x *Scalars) GetBoolValue() *wrapperspb.BoolValue { + if x != nil { + return x.BoolValue + } + return nil +} + +func (x *Scalars) GetInt32Value() *wrapperspb.Int32Value { + if x != nil { + return x.Int32Value + } + return nil +} + +func (x *Scalars) GetInt64Value() *wrapperspb.Int64Value { + if x != nil { + return x.Int64Value + } + return nil +} + +func (x *Scalars) GetUint32Value() *wrapperspb.UInt32Value { + if x != nil { + return x.Uint32Value + } + return nil +} + +func (x *Scalars) GetUint64Value() *wrapperspb.UInt64Value { + if x != nil { + return x.Uint64Value + } + return nil +} + +func (x *Scalars) GetFloatValue() *wrapperspb.FloatValue { + if x != nil { + return x.FloatValue + } + return nil +} + +func (x *Scalars) GetDoubleValue() *wrapperspb.DoubleValue { + if x != nil { + return x.DoubleValue + } + return nil +} + +func (x *Scalars) GetBytesValue() *wrapperspb.BytesValue { + if x != nil { + return x.BytesValue + } + return nil +} + +func (x *Scalars) GetStringValue() *wrapperspb.StringValue { + if x != nil { + return x.StringValue + } + return nil +} + +func (x *Scalars) GetFieldMask() *fieldmaskpb.FieldMask { + if x != nil { + return x.FieldMask + } + return nil +} + +type Shelf struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Resource name of the shelf. It must have the format of "shelves/*". + // For example: "shelves/shelf1". + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *Shelf) Reset() { + *x = Shelf{} + if protoimpl.UnsafeEnabled { + mi := &file_testpb_test_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Shelf) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Shelf) ProtoMessage() {} + +func (x *Shelf) ProtoReflect() protoreflect.Message { + mi := &file_testpb_test_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Shelf.ProtoReflect.Descriptor instead. +func (*Shelf) Descriptor() ([]byte, []int) { + return file_testpb_test_proto_rawDescGZIP(), []int{6} +} + +func (x *Shelf) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type GetShelfRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Resource name of a shelf. For example: "shelves/shelf1". + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *GetShelfRequest) Reset() { + *x = GetShelfRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_testpb_test_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetShelfRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetShelfRequest) ProtoMessage() {} + +func (x *GetShelfRequest) ProtoReflect() protoreflect.Message { + mi := &file_testpb_test_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetShelfRequest.ProtoReflect.Descriptor instead. +func (*GetShelfRequest) Descriptor() ([]byte, []int) { + return file_testpb_test_proto_rawDescGZIP(), []int{7} +} + +func (x *GetShelfRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type Book struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Resource name of the book. It must have the format of "shelves/*/books/*". + // For example: "shelves/shelf1/books/book2". + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // ... other properties + Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` +} + +func (x *Book) Reset() { + *x = Book{} + if protoimpl.UnsafeEnabled { + mi := &file_testpb_test_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Book) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Book) ProtoMessage() {} + +func (x *Book) ProtoReflect() protoreflect.Message { + mi := &file_testpb_test_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Book.ProtoReflect.Descriptor instead. +func (*Book) Descriptor() ([]byte, []int) { + return file_testpb_test_proto_rawDescGZIP(), []int{8} +} + +func (x *Book) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Book) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +type GetBookRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Resource name of a book. For example: "shelves/shelf1/books/book2". + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *GetBookRequest) Reset() { + *x = GetBookRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_testpb_test_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetBookRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetBookRequest) ProtoMessage() {} + +func (x *GetBookRequest) ProtoReflect() protoreflect.Message { + mi := &file_testpb_test_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetBookRequest.ProtoReflect.Descriptor instead. +func (*GetBookRequest) Descriptor() ([]byte, []int) { + return file_testpb_test_proto_rawDescGZIP(), []int{9} +} + +func (x *GetBookRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type CreateBookRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Resource name of the parent resource where to create the book. + // For example: "shelves/shelf1". + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // The Book resource to be created. Client must not set the `Book.name` field. + Book *Book `protobuf:"bytes,2,opt,name=book,proto3" json:"book,omitempty"` +} + +func (x *CreateBookRequest) Reset() { + *x = CreateBookRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_testpb_test_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateBookRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateBookRequest) ProtoMessage() {} + +func (x *CreateBookRequest) ProtoReflect() protoreflect.Message { + mi := &file_testpb_test_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateBookRequest.ProtoReflect.Descriptor instead. +func (*CreateBookRequest) Descriptor() ([]byte, []int) { + return file_testpb_test_proto_rawDescGZIP(), []int{10} +} + +func (x *CreateBookRequest) GetParent() string { + if x != nil { + return x.Parent + } + return "" +} + +func (x *CreateBookRequest) GetBook() *Book { + if x != nil { + return x.Book + } + return nil +} + +type UpdateBookRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The book resource which replaces the resource on the server. + Book *Book `protobuf:"bytes,1,opt,name=book,proto3" json:"book,omitempty"` + // The update mask applies to the resource. For the `FieldMask` definition, + // see + // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` +} + +func (x *UpdateBookRequest) Reset() { + *x = UpdateBookRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_testpb_test_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateBookRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateBookRequest) ProtoMessage() {} + +func (x *UpdateBookRequest) ProtoReflect() protoreflect.Message { + mi := &file_testpb_test_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateBookRequest.ProtoReflect.Descriptor instead. +func (*UpdateBookRequest) Descriptor() ([]byte, []int) { + return file_testpb_test_proto_rawDescGZIP(), []int{11} +} + +func (x *UpdateBookRequest) GetBook() *Book { + if x != nil { + return x.Book + } + return nil +} + +func (x *UpdateBookRequest) GetUpdateMask() *fieldmaskpb.FieldMask { + if x != nil { + return x.UpdateMask + } + return nil +} + +type GetMessageRequestTwo_SubMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Subfield string `protobuf:"bytes,1,opt,name=subfield,proto3" json:"subfield,omitempty"` +} + +func (x *GetMessageRequestTwo_SubMessage) Reset() { + *x = GetMessageRequestTwo_SubMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_testpb_test_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetMessageRequestTwo_SubMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMessageRequestTwo_SubMessage) ProtoMessage() {} + +func (x *GetMessageRequestTwo_SubMessage) ProtoReflect() protoreflect.Message { + mi := &file_testpb_test_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMessageRequestTwo_SubMessage.ProtoReflect.Descriptor instead. +func (*GetMessageRequestTwo_SubMessage) Descriptor() ([]byte, []int) { + return file_testpb_test_proto_rawDescGZIP(), []int{2, 0} +} + +func (x *GetMessageRequestTwo_SubMessage) GetSubfield() string { + if x != nil { + return x.Subfield + } + return "" +} + +var File_testpb_test_proto protoreflect.FileDescriptor + +var file_testpb_test_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, + 0x74, 0x70, 0x62, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x68, 0x74, + 0x74, 0x70, 0x62, 0x6f, 0x64, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, + 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, + 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x55, 0x0a, 0x07, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, + 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, + 0x72, 0x49, 0x64, 0x22, 0x2a, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4f, 0x6e, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, + 0xd7, 0x01, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x77, 0x6f, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x03, 0x73, 0x75, 0x62, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2f, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, + 0x62, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x54, 0x77, 0x6f, 0x2e, 0x53, 0x75, 0x62, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x52, 0x03, 0x73, 0x75, 0x62, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, + 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x1a, + 0x28, 0x0a, 0x0a, 0x53, 0x75, 0x62, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, + 0x08, 0x73, 0x75, 0x62, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x73, 0x75, 0x62, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x6b, 0x0a, 0x17, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x4f, 0x6e, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x49, 0x64, 0x12, 0x31, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x07, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x59, 0x0a, 0x11, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, + 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x66, + 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, + 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x66, 0x69, 0x6c, + 0x65, 0x22, 0xec, 0x05, 0x0a, 0x07, 0x53, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x73, 0x12, 0x38, 0x0a, + 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x35, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x39, + 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x09, + 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3c, 0x0a, 0x0b, 0x69, 0x6e, 0x74, + 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x69, 0x6e, 0x74, + 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3c, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x36, 0x34, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, + 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x36, 0x34, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3f, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, + 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x33, + 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3f, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, + 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, + 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3c, 0x0a, 0x0b, 0x66, 0x6c, 0x6f, 0x61, 0x74, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, + 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x66, 0x6c, 0x6f, 0x61, 0x74, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3f, 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x6f, + 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, + 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3c, 0x0a, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x79, + 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x62, 0x79, 0x74, 0x65, 0x73, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3f, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x39, 0x0a, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, + 0x61, 0x73, 0x6b, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, + 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, + 0x22, 0x1b, 0x0a, 0x05, 0x53, 0x68, 0x65, 0x6c, 0x66, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x25, 0x0a, + 0x0f, 0x47, 0x65, 0x74, 0x53, 0x68, 0x65, 0x6c, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x30, 0x0a, 0x04, 0x42, 0x6f, 0x6f, 0x6b, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x22, 0x24, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, + 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x55, 0x0a, 0x11, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x62, 0x6f, 0x6f, + 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, + 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x04, 0x62, + 0x6f, 0x6f, 0x6b, 0x22, 0x7a, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, + 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x04, 0x62, 0x6f, + 0x6f, 0x6b, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, + 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, + 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x32, + 0x8c, 0x0c, 0x0a, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x12, 0x72, 0x0a, + 0x0d, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x6e, 0x65, 0x12, 0x24, + 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, + 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x4f, 0x6e, 0x65, 0x1a, 0x17, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x22, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x73, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x6e, 0x61, 0x6d, 0x65, 0x2f, 0x2a, + 0x7d, 0x12, 0xbe, 0x01, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x54, 0x77, 0x6f, 0x12, 0x24, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x77, 0x6f, 0x1a, 0x17, 0x2e, 0x6c, 0x61, 0x72, 0x6b, + 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x22, 0x6e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x68, 0x12, 0x19, 0x2f, 0x76, 0x31, 0x2f, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2f, 0x7b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x5a, 0x1e, 0x12, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, + 0x72, 0x73, 0x2f, 0x7b, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x73, 0x5a, 0x2b, 0x12, 0x29, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, + 0x72, 0x73, 0x2f, 0x7b, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x73, 0x2f, 0x7b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, + 0x64, 0x7d, 0x12, 0x7d, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x12, 0x27, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4f, 0x6e, 0x65, 0x1a, 0x17, 0x2e, 0x6c, + 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x2a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x32, 0x19, 0x2f, + 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2f, 0x7b, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x3a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x12, 0x70, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x17, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, + 0x17, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, + 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x29, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, + 0x32, 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2f, 0x7b, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x62, 0x6f, 0x64, 0x79, + 0x3a, 0x01, 0x2a, 0x12, 0x5e, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x2e, + 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x23, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x22, 0x18, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x74, 0x65, 0x78, + 0x74, 0x3d, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, + 0x3a, 0x01, 0x2a, 0x12, 0x5f, 0x0a, 0x0d, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x67, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x17, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x16, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x22, 0x12, 0x2f, + 0x76, 0x31, 0x2f, 0x7b, 0x74, 0x65, 0x78, 0x74, 0x3d, 0x2a, 0x7d, 0x3a, 0x63, 0x6c, 0x65, 0x61, + 0x72, 0x3a, 0x01, 0x2a, 0x12, 0x61, 0x0a, 0x0e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, + 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x17, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, + 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x22, + 0x13, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x74, 0x65, 0x78, 0x74, 0x3d, 0x2a, 0x2a, 0x7d, 0x3a, 0x77, + 0x61, 0x74, 0x63, 0x68, 0x3a, 0x01, 0x2a, 0x12, 0x57, 0x0a, 0x08, 0x42, 0x61, 0x74, 0x63, 0x68, + 0x47, 0x65, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x12, 0x13, 0x2f, 0x76, 0x33, + 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x3a, 0x62, 0x61, 0x74, 0x63, 0x68, 0x47, 0x65, 0x74, + 0x12, 0x53, 0x0a, 0x0b, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x4f, 0x6e, 0x65, 0x12, + 0x17, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, + 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x22, 0x13, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x12, 0x0b, 0x2f, 0x7b, 0x74, 0x65, 0x78, 0x74, + 0x7d, 0x2f, 0x6f, 0x6e, 0x65, 0x12, 0x53, 0x0a, 0x0b, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, + 0x65, 0x54, 0x77, 0x6f, 0x12, 0x17, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x16, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x13, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x12, 0x0b, 0x2f, + 0x7b, 0x74, 0x65, 0x78, 0x74, 0x7d, 0x2f, 0x74, 0x77, 0x6f, 0x12, 0x60, 0x0a, 0x08, 0x47, 0x65, + 0x74, 0x53, 0x68, 0x65, 0x6c, 0x66, 0x12, 0x1f, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x68, 0x65, 0x6c, 0x66, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, + 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x53, 0x68, 0x65, 0x6c, 0x66, 0x22, 0x1c, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x12, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, + 0x65, 0x3d, 0x73, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x65, 0x0a, 0x07, + 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x12, 0x1e, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, + 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, + 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x22, 0x24, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x12, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, + 0x3d, 0x73, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x2f, 0x2a, 0x2f, 0x62, 0x6f, 0x6f, 0x6b, 0x73, + 0x2f, 0x2a, 0x7d, 0x12, 0x71, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, + 0x6b, 0x12, 0x21, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, + 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x22, 0x2a, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x24, 0x22, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, + 0x73, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x62, 0x6f, 0x6f, 0x6b, 0x73, + 0x3a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x12, 0x76, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x42, 0x6f, 0x6f, 0x6b, 0x12, 0x21, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, + 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x22, 0x2f, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x32, 0x21, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x62, 0x6f, 0x6f, 0x6b, + 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x73, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x2f, 0x2a, 0x2f, + 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x32, 0xee, + 0x01, 0x0a, 0x05, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x6a, 0x0a, 0x0e, 0x55, 0x70, 0x6c, 0x6f, + 0x61, 0x64, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x21, 0x2e, 0x6c, 0x61, 0x72, + 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x6c, 0x6f, + 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x42, + 0x6f, 0x64, 0x79, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x22, 0x11, 0x2f, 0x66, 0x69, + 0x6c, 0x65, 0x73, 0x2f, 0x7b, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x3a, 0x04, + 0x66, 0x69, 0x6c, 0x65, 0x12, 0x79, 0x0a, 0x13, 0x4c, 0x61, 0x72, 0x67, 0x65, 0x55, 0x70, 0x6c, + 0x6f, 0x61, 0x64, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x21, 0x2e, 0x6c, 0x61, + 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x6c, + 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x48, 0x74, 0x74, 0x70, + 0x42, 0x6f, 0x64, 0x79, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x22, 0x17, 0x2f, 0x66, + 0x69, 0x6c, 0x65, 0x73, 0x2f, 0x6c, 0x61, 0x72, 0x67, 0x65, 0x2f, 0x7b, 0x66, 0x69, 0x6c, 0x65, + 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x3a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x28, 0x01, 0x30, 0x01, 0x32, + 0x5c, 0x0a, 0x09, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x12, 0x4f, 0x0a, 0x05, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x17, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, + 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x53, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x73, 0x1a, 0x16, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, 0x0d, + 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x65, 0x6c, 0x6c, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x42, 0x2d, 0x5a, + 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6d, 0x63, 0x66, + 0x61, 0x72, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x74, + 0x65, 0x73, 0x74, 0x70, 0x62, 0x3b, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_testpb_test_proto_rawDescOnce sync.Once + file_testpb_test_proto_rawDescData = file_testpb_test_proto_rawDesc +) + +func file_testpb_test_proto_rawDescGZIP() []byte { + file_testpb_test_proto_rawDescOnce.Do(func() { + file_testpb_test_proto_rawDescData = protoimpl.X.CompressGZIP(file_testpb_test_proto_rawDescData) + }) + return file_testpb_test_proto_rawDescData +} + +var file_testpb_test_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_testpb_test_proto_goTypes = []interface{}{ + (*Message)(nil), // 0: larking.testpb.Message + (*GetMessageRequestOne)(nil), // 1: larking.testpb.GetMessageRequestOne + (*GetMessageRequestTwo)(nil), // 2: larking.testpb.GetMessageRequestTwo + (*UpdateMessageRequestOne)(nil), // 3: larking.testpb.UpdateMessageRequestOne + (*UploadFileRequest)(nil), // 4: larking.testpb.UploadFileRequest + (*Scalars)(nil), // 5: larking.testpb.Scalars + (*Shelf)(nil), // 6: larking.testpb.Shelf + (*GetShelfRequest)(nil), // 7: larking.testpb.GetShelfRequest + (*Book)(nil), // 8: larking.testpb.Book + (*GetBookRequest)(nil), // 9: larking.testpb.GetBookRequest + (*CreateBookRequest)(nil), // 10: larking.testpb.CreateBookRequest + (*UpdateBookRequest)(nil), // 11: larking.testpb.UpdateBookRequest + (*GetMessageRequestTwo_SubMessage)(nil), // 12: larking.testpb.GetMessageRequestTwo.SubMessage + (*httpbody.HttpBody)(nil), // 13: google.api.HttpBody + (*timestamppb.Timestamp)(nil), // 14: google.protobuf.Timestamp + (*durationpb.Duration)(nil), // 15: google.protobuf.Duration + (*wrapperspb.BoolValue)(nil), // 16: google.protobuf.BoolValue + (*wrapperspb.Int32Value)(nil), // 17: google.protobuf.Int32Value + (*wrapperspb.Int64Value)(nil), // 18: google.protobuf.Int64Value + (*wrapperspb.UInt32Value)(nil), // 19: google.protobuf.UInt32Value + (*wrapperspb.UInt64Value)(nil), // 20: google.protobuf.UInt64Value + (*wrapperspb.FloatValue)(nil), // 21: google.protobuf.FloatValue + (*wrapperspb.DoubleValue)(nil), // 22: google.protobuf.DoubleValue + (*wrapperspb.BytesValue)(nil), // 23: google.protobuf.BytesValue + (*wrapperspb.StringValue)(nil), // 24: google.protobuf.StringValue + (*fieldmaskpb.FieldMask)(nil), // 25: google.protobuf.FieldMask + (*emptypb.Empty)(nil), // 26: google.protobuf.Empty +} +var file_testpb_test_proto_depIdxs = []int32{ + 12, // 0: larking.testpb.GetMessageRequestTwo.sub:type_name -> larking.testpb.GetMessageRequestTwo.SubMessage + 0, // 1: larking.testpb.UpdateMessageRequestOne.message:type_name -> larking.testpb.Message + 13, // 2: larking.testpb.UploadFileRequest.file:type_name -> google.api.HttpBody + 14, // 3: larking.testpb.Scalars.timestamp:type_name -> google.protobuf.Timestamp + 15, // 4: larking.testpb.Scalars.duration:type_name -> google.protobuf.Duration + 16, // 5: larking.testpb.Scalars.bool_value:type_name -> google.protobuf.BoolValue + 17, // 6: larking.testpb.Scalars.int32_value:type_name -> google.protobuf.Int32Value + 18, // 7: larking.testpb.Scalars.int64_value:type_name -> google.protobuf.Int64Value + 19, // 8: larking.testpb.Scalars.uint32_value:type_name -> google.protobuf.UInt32Value + 20, // 9: larking.testpb.Scalars.uint64_value:type_name -> google.protobuf.UInt64Value + 21, // 10: larking.testpb.Scalars.float_value:type_name -> google.protobuf.FloatValue + 22, // 11: larking.testpb.Scalars.double_value:type_name -> google.protobuf.DoubleValue + 23, // 12: larking.testpb.Scalars.bytes_value:type_name -> google.protobuf.BytesValue + 24, // 13: larking.testpb.Scalars.string_value:type_name -> google.protobuf.StringValue + 25, // 14: larking.testpb.Scalars.field_mask:type_name -> google.protobuf.FieldMask + 8, // 15: larking.testpb.CreateBookRequest.book:type_name -> larking.testpb.Book + 8, // 16: larking.testpb.UpdateBookRequest.book:type_name -> larking.testpb.Book + 25, // 17: larking.testpb.UpdateBookRequest.update_mask:type_name -> google.protobuf.FieldMask + 1, // 18: larking.testpb.Messaging.GetMessageOne:input_type -> larking.testpb.GetMessageRequestOne + 2, // 19: larking.testpb.Messaging.GetMessageTwo:input_type -> larking.testpb.GetMessageRequestTwo + 3, // 20: larking.testpb.Messaging.UpdateMessage:input_type -> larking.testpb.UpdateMessageRequestOne + 0, // 21: larking.testpb.Messaging.UpdateMessageBody:input_type -> larking.testpb.Message + 0, // 22: larking.testpb.Messaging.Action:input_type -> larking.testpb.Message + 0, // 23: larking.testpb.Messaging.ActionSegment:input_type -> larking.testpb.Message + 0, // 24: larking.testpb.Messaging.ActionSegments:input_type -> larking.testpb.Message + 26, // 25: larking.testpb.Messaging.BatchGet:input_type -> google.protobuf.Empty + 0, // 26: larking.testpb.Messaging.VariableOne:input_type -> larking.testpb.Message + 0, // 27: larking.testpb.Messaging.VariableTwo:input_type -> larking.testpb.Message + 7, // 28: larking.testpb.Messaging.GetShelf:input_type -> larking.testpb.GetShelfRequest + 9, // 29: larking.testpb.Messaging.GetBook:input_type -> larking.testpb.GetBookRequest + 10, // 30: larking.testpb.Messaging.CreateBook:input_type -> larking.testpb.CreateBookRequest + 11, // 31: larking.testpb.Messaging.UpdateBook:input_type -> larking.testpb.UpdateBookRequest + 4, // 32: larking.testpb.Files.UploadDownload:input_type -> larking.testpb.UploadFileRequest + 4, // 33: larking.testpb.Files.LargeUploadDownload:input_type -> larking.testpb.UploadFileRequest + 5, // 34: larking.testpb.WellKnown.Check:input_type -> larking.testpb.Scalars + 0, // 35: larking.testpb.Messaging.GetMessageOne:output_type -> larking.testpb.Message + 0, // 36: larking.testpb.Messaging.GetMessageTwo:output_type -> larking.testpb.Message + 0, // 37: larking.testpb.Messaging.UpdateMessage:output_type -> larking.testpb.Message + 0, // 38: larking.testpb.Messaging.UpdateMessageBody:output_type -> larking.testpb.Message + 26, // 39: larking.testpb.Messaging.Action:output_type -> google.protobuf.Empty + 26, // 40: larking.testpb.Messaging.ActionSegment:output_type -> google.protobuf.Empty + 26, // 41: larking.testpb.Messaging.ActionSegments:output_type -> google.protobuf.Empty + 26, // 42: larking.testpb.Messaging.BatchGet:output_type -> google.protobuf.Empty + 26, // 43: larking.testpb.Messaging.VariableOne:output_type -> google.protobuf.Empty + 26, // 44: larking.testpb.Messaging.VariableTwo:output_type -> google.protobuf.Empty + 6, // 45: larking.testpb.Messaging.GetShelf:output_type -> larking.testpb.Shelf + 8, // 46: larking.testpb.Messaging.GetBook:output_type -> larking.testpb.Book + 8, // 47: larking.testpb.Messaging.CreateBook:output_type -> larking.testpb.Book + 8, // 48: larking.testpb.Messaging.UpdateBook:output_type -> larking.testpb.Book + 13, // 49: larking.testpb.Files.UploadDownload:output_type -> google.api.HttpBody + 13, // 50: larking.testpb.Files.LargeUploadDownload:output_type -> google.api.HttpBody + 26, // 51: larking.testpb.WellKnown.Check:output_type -> google.protobuf.Empty + 35, // [35:52] is the sub-list for method output_type + 18, // [18:35] is the sub-list for method input_type + 18, // [18:18] is the sub-list for extension type_name + 18, // [18:18] is the sub-list for extension extendee + 0, // [0:18] is the sub-list for field type_name +} + +func init() { file_testpb_test_proto_init() } +func file_testpb_test_proto_init() { + if File_testpb_test_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_testpb_test_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Message); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testpb_test_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetMessageRequestOne); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testpb_test_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetMessageRequestTwo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testpb_test_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateMessageRequestOne); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testpb_test_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UploadFileRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testpb_test_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Scalars); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testpb_test_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Shelf); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testpb_test_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetShelfRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testpb_test_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Book); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testpb_test_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetBookRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testpb_test_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateBookRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testpb_test_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateBookRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testpb_test_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetMessageRequestTwo_SubMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_testpb_test_proto_rawDesc, + NumEnums: 0, + NumMessages: 13, + NumExtensions: 0, + NumServices: 3, + }, + GoTypes: file_testpb_test_proto_goTypes, + DependencyIndexes: file_testpb_test_proto_depIdxs, + MessageInfos: file_testpb_test_proto_msgTypes, + }.Build() + File_testpb_test_proto = out.File + file_testpb_test_proto_rawDesc = nil + file_testpb_test_proto_goTypes = nil + file_testpb_test_proto_depIdxs = nil +} From 8ea7ae699824ca98ffa2918c7c9bc4b9a18da3ed Mon Sep 17 00:00:00 2001 From: Edward McFarlane Date: Wed, 10 May 2023 13:09:20 +0100 Subject: [PATCH 3/4] GraphQL rework --- api/graphql.pb.go | 831 ---------- api/graphql.proto | 23 +- api/graphqlpb/graphql.pb.go | 997 ++++++++++++ api/{ => graphqlpb}/graphql_grpc.pb.go | 108 +- {testpb => api}/starwars.proto | 8 +- api/starwarspb/starwars.pb.go | 552 +++++++ .../starwarspb}/starwars_grpc.pb.go | 32 +- go.mod | 1 + go.sum | 2 + graphql.go | 50 - graphql_test.go | 229 --- larking/graphql.go | 40 + larking/graphql_test.go | 199 +++ larking/mux.go | 8 +- testpb/starwars.pb.go | 553 ------- testpb/test.pb.go | 1357 ----------------- 16 files changed, 1889 insertions(+), 3101 deletions(-) delete mode 100644 api/graphql.pb.go create mode 100644 api/graphqlpb/graphql.pb.go rename api/{ => graphqlpb}/graphql_grpc.pb.go (72%) rename {testpb => api}/starwars.proto (93%) create mode 100644 api/starwarspb/starwars.pb.go rename {testpb => api/starwarspb}/starwars_grpc.pb.go (85%) delete mode 100644 graphql.go delete mode 100644 graphql_test.go create mode 100644 larking/graphql.go create mode 100644 larking/graphql_test.go delete mode 100644 testpb/starwars.pb.go delete mode 100644 testpb/test.pb.go diff --git a/api/graphql.pb.go b/api/graphql.pb.go deleted file mode 100644 index 7e06ab2..0000000 --- a/api/graphql.pb.go +++ /dev/null @@ -1,831 +0,0 @@ -// Copyright 2021 Edward McFarlane. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.17.0 -// source: api/graphql.proto - -package api - -import ( - _ "google.golang.org/genproto/googleapis/api/annotations" - httpbody "google.golang.org/genproto/googleapis/api/httpbody" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - descriptorpb "google.golang.org/protobuf/types/descriptorpb" - anypb "google.golang.org/protobuf/types/known/anypb" - structpb "google.golang.org/protobuf/types/known/structpb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// GraphQL bindings. -type GraphQLRule struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Pattern: - // *GraphQLRule_Query - // *GraphQLRule_Mutation - // *GraphQLRule_Subscription - Pattern isGraphQLRule_Pattern `protobuf_oneof:"pattern"` - // Args is a mapping of fields. - Args []*Arg `protobuf:"bytes,4,rep,name=args,proto3" json:"args,omitempty"` - // Controls the Relay NodeID binding. - NodeId string `protobuf:"bytes,5,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` - // Additional GraphQL bindings for the selector. Nested bindings must - // not contain an `additional_bindings` field themselves (that is, - // the nesting may only be one level deep). - AdditionalBindings []*GraphQLRule `protobuf:"bytes,6,rep,name=additional_bindings,json=additionalBindings,proto3" json:"additional_bindings,omitempty"` -} - -func (x *GraphQLRule) Reset() { - *x = GraphQLRule{} - if protoimpl.UnsafeEnabled { - mi := &file_api_graphql_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GraphQLRule) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GraphQLRule) ProtoMessage() {} - -func (x *GraphQLRule) ProtoReflect() protoreflect.Message { - mi := &file_api_graphql_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GraphQLRule.ProtoReflect.Descriptor instead. -func (*GraphQLRule) Descriptor() ([]byte, []int) { - return file_api_graphql_proto_rawDescGZIP(), []int{0} -} - -func (m *GraphQLRule) GetPattern() isGraphQLRule_Pattern { - if m != nil { - return m.Pattern - } - return nil -} - -func (x *GraphQLRule) GetQuery() string { - if x, ok := x.GetPattern().(*GraphQLRule_Query); ok { - return x.Query - } - return "" -} - -func (x *GraphQLRule) GetMutation() string { - if x, ok := x.GetPattern().(*GraphQLRule_Mutation); ok { - return x.Mutation - } - return "" -} - -func (x *GraphQLRule) GetSubscription() string { - if x, ok := x.GetPattern().(*GraphQLRule_Subscription); ok { - return x.Subscription - } - return "" -} - -func (x *GraphQLRule) GetArgs() []*Arg { - if x != nil { - return x.Args - } - return nil -} - -func (x *GraphQLRule) GetNodeId() string { - if x != nil { - return x.NodeId - } - return "" -} - -func (x *GraphQLRule) GetAdditionalBindings() []*GraphQLRule { - if x != nil { - return x.AdditionalBindings - } - return nil -} - -type isGraphQLRule_Pattern interface { - isGraphQLRule_Pattern() -} - -type GraphQLRule_Query struct { - Query string `protobuf:"bytes,1,opt,name=query,proto3,oneof"` -} - -type GraphQLRule_Mutation struct { - Mutation string `protobuf:"bytes,2,opt,name=mutation,proto3,oneof"` -} - -type GraphQLRule_Subscription struct { - Subscription string `protobuf:"bytes,3,opt,name=subscription,proto3,oneof"` -} - -func (*GraphQLRule_Query) isGraphQLRule_Pattern() {} - -func (*GraphQLRule_Mutation) isGraphQLRule_Pattern() {} - -func (*GraphQLRule_Subscription) isGraphQLRule_Pattern() {} - -type Arg struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Field string `protobuf:"bytes,2,opt,name=field,proto3" json:"field,omitempty"` -} - -func (x *Arg) Reset() { - *x = Arg{} - if protoimpl.UnsafeEnabled { - mi := &file_api_graphql_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Arg) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Arg) ProtoMessage() {} - -func (x *Arg) ProtoReflect() protoreflect.Message { - mi := &file_api_graphql_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Arg.ProtoReflect.Descriptor instead. -func (*Arg) Descriptor() ([]byte, []int) { - return file_api_graphql_proto_rawDescGZIP(), []int{1} -} - -func (x *Arg) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Arg) GetField() string { - if x != nil { - return x.Field - } - return "" -} - -// Connection -// https://relay.dev/graphql/connections.htm# -// A field that returns a Connection Type must include forward pagination -// arguments, backward pagination arguments, or both. These pagination arguments -// allow the client to slice the set of edges before it is returned. -// -// Forward Arguments: -// - first takes a non-negative integer. -// - after takes the cursor type as described in the cursor field section. -// -// Backward Arguments: -// - last takes a non-negative integer. -// - before takes the cursor type as described in the cursor field section. -type MessageConnection struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // TODO - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Method string `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"` - Args []*Arg `protobuf:"bytes,3,rep,name=args,proto3" json:"args,omitempty"` -} - -func (x *MessageConnection) Reset() { - *x = MessageConnection{} - if protoimpl.UnsafeEnabled { - mi := &file_api_graphql_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessageConnection) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessageConnection) ProtoMessage() {} - -func (x *MessageConnection) ProtoReflect() protoreflect.Message { - mi := &file_api_graphql_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessageConnection.ProtoReflect.Descriptor instead. -func (*MessageConnection) Descriptor() ([]byte, []int) { - return file_api_graphql_proto_rawDescGZIP(), []int{2} -} - -func (x *MessageConnection) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *MessageConnection) GetMethod() string { - if x != nil { - return x.Method - } - return "" -} - -func (x *MessageConnection) GetArgs() []*Arg { - if x != nil { - return x.Args - } - return nil -} - -// https://relay.dev/graphql/connections.htm -type PageInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - HasNextPage bool `protobuf:"varint,1,opt,name=has_next_page,json=hasNextPage,proto3" json:"has_next_page,omitempty"` - HasPreviousPage bool `protobuf:"varint,2,opt,name=has_previous_page,json=hasPreviousPage,proto3" json:"has_previous_page,omitempty"` - StartCursor []byte `protobuf:"bytes,3,opt,name=start_cursor,json=startCursor,proto3" json:"start_cursor,omitempty"` - EndCursor []byte `protobuf:"bytes,4,opt,name=end_cursor,json=endCursor,proto3" json:"end_cursor,omitempty"` -} - -func (x *PageInfo) Reset() { - *x = PageInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_api_graphql_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PageInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PageInfo) ProtoMessage() {} - -func (x *PageInfo) ProtoReflect() protoreflect.Message { - mi := &file_api_graphql_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PageInfo.ProtoReflect.Descriptor instead. -func (*PageInfo) Descriptor() ([]byte, []int) { - return file_api_graphql_proto_rawDescGZIP(), []int{3} -} - -func (x *PageInfo) GetHasNextPage() bool { - if x != nil { - return x.HasNextPage - } - return false -} - -func (x *PageInfo) GetHasPreviousPage() bool { - if x != nil { - return x.HasPreviousPage - } - return false -} - -func (x *PageInfo) GetStartCursor() []byte { - if x != nil { - return x.StartCursor - } - return nil -} - -func (x *PageInfo) GetEndCursor() []byte { - if x != nil { - return x.EndCursor - } - return nil -} - -type Connection struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Edges []*anypb.Any `protobuf:"bytes,1,rep,name=edges,proto3" json:"edges,omitempty"` - PageInfo *PageInfo `protobuf:"bytes,2,opt,name=page_info,json=pageInfo,proto3" json:"page_info,omitempty"` -} - -func (x *Connection) Reset() { - *x = Connection{} - if protoimpl.UnsafeEnabled { - mi := &file_api_graphql_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Connection) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Connection) ProtoMessage() {} - -func (x *Connection) ProtoReflect() protoreflect.Message { - mi := &file_api_graphql_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Connection.ProtoReflect.Descriptor instead. -func (*Connection) Descriptor() ([]byte, []int) { - return file_api_graphql_proto_rawDescGZIP(), []int{4} -} - -func (x *Connection) GetEdges() []*anypb.Any { - if x != nil { - return x.Edges - } - return nil -} - -func (x *Connection) GetPageInfo() *PageInfo { - if x != nil { - return x.PageInfo - } - return nil -} - -type GraphQLResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Data *structpb.Struct `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` - Errors []*anypb.Any `protobuf:"bytes,2,rep,name=errors,proto3" json:"errors,omitempty"` -} - -func (x *GraphQLResponse) Reset() { - *x = GraphQLResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_graphql_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GraphQLResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GraphQLResponse) ProtoMessage() {} - -func (x *GraphQLResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_graphql_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GraphQLResponse.ProtoReflect.Descriptor instead. -func (*GraphQLResponse) Descriptor() ([]byte, []int) { - return file_api_graphql_proto_rawDescGZIP(), []int{5} -} - -func (x *GraphQLResponse) GetData() *structpb.Struct { - if x != nil { - return x.Data - } - return nil -} - -func (x *GraphQLResponse) GetErrors() []*anypb.Any { - if x != nil { - return x.Errors - } - return nil -} - -type GetRelayNodeRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` -} - -func (x *GetRelayNodeRequest) Reset() { - *x = GetRelayNodeRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_graphql_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetRelayNodeRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetRelayNodeRequest) ProtoMessage() {} - -func (x *GetRelayNodeRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_graphql_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetRelayNodeRequest.ProtoReflect.Descriptor instead. -func (*GetRelayNodeRequest) Descriptor() ([]byte, []int) { - return file_api_graphql_proto_rawDescGZIP(), []int{6} -} - -func (x *GetRelayNodeRequest) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -var file_api_graphql_proto_extTypes = []protoimpl.ExtensionInfo{ - { - ExtendedType: (*descriptorpb.MethodOptions)(nil), - ExtensionType: (*GraphQLRule)(nil), - Field: 72222228, - Name: "larking.api.relay", - Tag: "bytes,72222228,opt,name=relay", - Filename: "api/graphql.proto", - }, - { - ExtendedType: (*descriptorpb.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 70000, - Name: "larking.api.relay_id", - Tag: "varint,70000,opt,name=relay_id", - Filename: "api/graphql.proto", - }, - { - ExtendedType: (*descriptorpb.MessageOptions)(nil), - ExtensionType: (*MessageConnection)(nil), - Field: 70000, - Name: "larking.api.connection", - Tag: "bytes,70000,opt,name=connection", - Filename: "api/graphql.proto", - }, -} - -// Extension fields to descriptorpb.MethodOptions. -var ( - // Adds a method to the GraphQL query root. - // - // optional larking.api.GraphQLRule relay = 72222228; - E_Relay = &file_api_graphql_proto_extTypes[0] -) - -// Extension fields to descriptorpb.FieldOptions. -var ( - // Adds relay - // - // optional bool relay_id = 70000; - E_RelayId = &file_api_graphql_proto_extTypes[1] -) - -// Extension fields to descriptorpb.MessageOptions. -var ( - // optional larking.api.MessageConnection connection = 70000; - E_Connection = &file_api_graphql_proto_extTypes[2] -) - -var File_api_graphql_proto protoreflect.FileDescriptor - -var file_api_graphql_proto_rawDesc = []byte{ - 0x0a, 0x11, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x68, 0x71, 0x6c, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, - 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, - 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x68, 0x74, 0x74, 0x70, 0x62, - 0x6f, 0x64, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfe, 0x01, 0x0a, 0x0b, 0x47, 0x72, 0x61, 0x70, 0x68, 0x51, 0x4c, - 0x52, 0x75, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x08, - 0x6d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, - 0x52, 0x08, 0x6d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x24, 0x0a, 0x0c, 0x73, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x48, 0x00, 0x52, 0x0c, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x24, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, - 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x72, 0x67, - 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, - 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, - 0x49, 0x0a, 0x13, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x62, 0x69, - 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6c, - 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x72, 0x61, 0x70, 0x68, - 0x51, 0x4c, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x12, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x61, 0x6c, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x22, 0x2f, 0x0a, 0x03, 0x41, 0x72, 0x67, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x14, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x65, 0x0a, 0x11, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x24, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x41, 0x72, 0x67, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x9c, 0x01, - 0x0a, 0x08, 0x50, 0x61, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x22, 0x0a, 0x0d, 0x68, 0x61, - 0x73, 0x5f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x0b, 0x68, 0x61, 0x73, 0x4e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x12, 0x2a, - 0x0a, 0x11, 0x68, 0x61, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x5f, 0x70, - 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x68, 0x61, 0x73, 0x50, 0x72, - 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x50, 0x61, 0x67, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x5f, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x43, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x12, 0x1d, 0x0a, - 0x0a, 0x65, 0x6e, 0x64, 0x5f, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x09, 0x65, 0x6e, 0x64, 0x43, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x22, 0x6c, 0x0a, 0x0a, - 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x64, - 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, - 0x05, 0x65, 0x64, 0x67, 0x65, 0x73, 0x12, 0x32, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x69, - 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6c, 0x61, 0x72, 0x6b, - 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, - 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x6c, 0x0a, 0x0f, 0x47, 0x72, - 0x61, 0x70, 0x68, 0x51, 0x4c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, - 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, - 0x72, 0x75, 0x63, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2c, 0x0a, 0x06, 0x65, 0x72, - 0x72, 0x6f, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, - 0x52, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x22, 0x25, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x52, - 0x65, 0x6c, 0x61, 0x79, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x32, - 0x5a, 0x0a, 0x07, 0x47, 0x72, 0x61, 0x70, 0x68, 0x51, 0x4c, 0x12, 0x4f, 0x0a, 0x05, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x12, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x48, 0x74, 0x74, 0x70, 0x42, 0x6f, 0x64, 0x79, 0x1a, 0x1c, 0x2e, 0x6c, 0x61, 0x72, 0x6b, - 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x72, 0x61, 0x70, 0x68, 0x51, 0x4c, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x10, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0a, 0x22, - 0x08, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x68, 0x71, 0x6c, 0x30, 0x01, 0x32, 0x4f, 0x0a, 0x05, 0x52, - 0x65, 0x6c, 0x61, 0x79, 0x12, 0x46, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, - 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4e, 0x6f, 0x64, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x3a, 0x51, 0x0a, 0x05, - 0x72, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x94, 0x8c, 0xb8, 0x22, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, - 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x72, 0x61, - 0x70, 0x68, 0x51, 0x4c, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x05, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x3a, - 0x3d, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x69, 0x64, 0x12, 0x1d, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, - 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xf0, 0xa2, 0x04, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x49, 0x64, 0x88, 0x01, 0x01, 0x3a, 0x61, - 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xf0, 0xa2, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x65, 0x6d, 0x63, 0x66, 0x61, 0x72, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x6c, 0x61, 0x72, 0x6b, 0x69, - 0x6e, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x3b, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_api_graphql_proto_rawDescOnce sync.Once - file_api_graphql_proto_rawDescData = file_api_graphql_proto_rawDesc -) - -func file_api_graphql_proto_rawDescGZIP() []byte { - file_api_graphql_proto_rawDescOnce.Do(func() { - file_api_graphql_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_graphql_proto_rawDescData) - }) - return file_api_graphql_proto_rawDescData -} - -var file_api_graphql_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_api_graphql_proto_goTypes = []interface{}{ - (*GraphQLRule)(nil), // 0: larking.api.GraphQLRule - (*Arg)(nil), // 1: larking.api.Arg - (*MessageConnection)(nil), // 2: larking.api.MessageConnection - (*PageInfo)(nil), // 3: larking.api.PageInfo - (*Connection)(nil), // 4: larking.api.Connection - (*GraphQLResponse)(nil), // 5: larking.api.GraphQLResponse - (*GetRelayNodeRequest)(nil), // 6: larking.api.GetRelayNodeRequest - (*anypb.Any)(nil), // 7: google.protobuf.Any - (*structpb.Struct)(nil), // 8: google.protobuf.Struct - (*descriptorpb.MethodOptions)(nil), // 9: google.protobuf.MethodOptions - (*descriptorpb.FieldOptions)(nil), // 10: google.protobuf.FieldOptions - (*descriptorpb.MessageOptions)(nil), // 11: google.protobuf.MessageOptions - (*httpbody.HttpBody)(nil), // 12: google.api.HttpBody -} -var file_api_graphql_proto_depIdxs = []int32{ - 1, // 0: larking.api.GraphQLRule.args:type_name -> larking.api.Arg - 0, // 1: larking.api.GraphQLRule.additional_bindings:type_name -> larking.api.GraphQLRule - 1, // 2: larking.api.MessageConnection.args:type_name -> larking.api.Arg - 7, // 3: larking.api.Connection.edges:type_name -> google.protobuf.Any - 3, // 4: larking.api.Connection.page_info:type_name -> larking.api.PageInfo - 8, // 5: larking.api.GraphQLResponse.data:type_name -> google.protobuf.Struct - 7, // 6: larking.api.GraphQLResponse.errors:type_name -> google.protobuf.Any - 9, // 7: larking.api.relay:extendee -> google.protobuf.MethodOptions - 10, // 8: larking.api.relay_id:extendee -> google.protobuf.FieldOptions - 11, // 9: larking.api.connection:extendee -> google.protobuf.MessageOptions - 0, // 10: larking.api.relay:type_name -> larking.api.GraphQLRule - 2, // 11: larking.api.connection:type_name -> larking.api.MessageConnection - 12, // 12: larking.api.GraphQL.Query:input_type -> google.api.HttpBody - 6, // 13: larking.api.Relay.GetRelayNode:input_type -> larking.api.GetRelayNodeRequest - 5, // 14: larking.api.GraphQL.Query:output_type -> larking.api.GraphQLResponse - 7, // 15: larking.api.Relay.GetRelayNode:output_type -> google.protobuf.Any - 14, // [14:16] is the sub-list for method output_type - 12, // [12:14] is the sub-list for method input_type - 10, // [10:12] is the sub-list for extension type_name - 7, // [7:10] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name -} - -func init() { file_api_graphql_proto_init() } -func file_api_graphql_proto_init() { - if File_api_graphql_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_api_graphql_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GraphQLRule); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_graphql_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Arg); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_graphql_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageConnection); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_graphql_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PageInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_graphql_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Connection); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_graphql_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GraphQLResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_graphql_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRelayNodeRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_api_graphql_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*GraphQLRule_Query)(nil), - (*GraphQLRule_Mutation)(nil), - (*GraphQLRule_Subscription)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_api_graphql_proto_rawDesc, - NumEnums: 0, - NumMessages: 7, - NumExtensions: 3, - NumServices: 2, - }, - GoTypes: file_api_graphql_proto_goTypes, - DependencyIndexes: file_api_graphql_proto_depIdxs, - MessageInfos: file_api_graphql_proto_msgTypes, - ExtensionInfos: file_api_graphql_proto_extTypes, - }.Build() - File_api_graphql_proto = out.File - file_api_graphql_proto_rawDesc = nil - file_api_graphql_proto_goTypes = nil - file_api_graphql_proto_depIdxs = nil -} diff --git a/api/graphql.proto b/api/graphql.proto index e19daf7..bd1d8f1 100644 --- a/api/graphql.proto +++ b/api/graphql.proto @@ -7,12 +7,11 @@ syntax = "proto3"; package larking.api; import "google/api/annotations.proto"; -import "google/api/httpbody.proto"; import "google/protobuf/any.proto"; import "google/protobuf/descriptor.proto"; import "google/protobuf/struct.proto"; -option go_package = "github.com/emcfarlane/larking/api;api"; +option go_package = "larking.io/api/graphqlpb;graphqlpb"; // Relay GraphQL implementation // https://relay.dev/docs/guides/graphql-server-specification/ @@ -91,17 +90,31 @@ message Connection { PageInfo page_info = 2; } -message GraphQLResponse { +message Request { + string query = 1; + string operation_name = 2; + google.protobuf.Struct variables = 3; +} + +message Response { google.protobuf.Struct data = 1; - repeated google.protobuf.Any errors = 2; + repeated Error errors = 2; +} + +message Error { + string message = 1; + repeated string path = 2; + google.protobuf.Struct extensions = 3; } service GraphQL { - rpc Query(google.api.HttpBody) returns (stream GraphQLResponse) { + rpc Query(Request) returns (Response) { option (google.api.http) = { post : "/graphql" + additional_bindings {get : "/graphql"} }; } + // TODO: Subscriptions } message GetRelayNodeRequest { string id = 1; } diff --git a/api/graphqlpb/graphql.pb.go b/api/graphqlpb/graphql.pb.go new file mode 100644 index 0000000..c5f31ca --- /dev/null +++ b/api/graphqlpb/graphql.pb.go @@ -0,0 +1,997 @@ +// Copyright 2021 Edward McFarlane. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc v3.21.12 +// source: larking/api/graphql.proto + +package graphqlpb + +import ( + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + descriptorpb "google.golang.org/protobuf/types/descriptorpb" + anypb "google.golang.org/protobuf/types/known/anypb" + structpb "google.golang.org/protobuf/types/known/structpb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// GraphQL bindings. +type GraphQLRule struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Pattern: + // + // *GraphQLRule_Query + // *GraphQLRule_Mutation + // *GraphQLRule_Subscription + Pattern isGraphQLRule_Pattern `protobuf_oneof:"pattern"` + // Args is a mapping of fields. + Args []*Arg `protobuf:"bytes,4,rep,name=args,proto3" json:"args,omitempty"` + // Controls the Relay NodeID binding. + NodeId string `protobuf:"bytes,5,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + // Additional GraphQL bindings for the selector. Nested bindings must + // not contain an `additional_bindings` field themselves (that is, + // the nesting may only be one level deep). + AdditionalBindings []*GraphQLRule `protobuf:"bytes,6,rep,name=additional_bindings,json=additionalBindings,proto3" json:"additional_bindings,omitempty"` +} + +func (x *GraphQLRule) Reset() { + *x = GraphQLRule{} + if protoimpl.UnsafeEnabled { + mi := &file_larking_api_graphql_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GraphQLRule) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GraphQLRule) ProtoMessage() {} + +func (x *GraphQLRule) ProtoReflect() protoreflect.Message { + mi := &file_larking_api_graphql_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GraphQLRule.ProtoReflect.Descriptor instead. +func (*GraphQLRule) Descriptor() ([]byte, []int) { + return file_larking_api_graphql_proto_rawDescGZIP(), []int{0} +} + +func (m *GraphQLRule) GetPattern() isGraphQLRule_Pattern { + if m != nil { + return m.Pattern + } + return nil +} + +func (x *GraphQLRule) GetQuery() string { + if x, ok := x.GetPattern().(*GraphQLRule_Query); ok { + return x.Query + } + return "" +} + +func (x *GraphQLRule) GetMutation() string { + if x, ok := x.GetPattern().(*GraphQLRule_Mutation); ok { + return x.Mutation + } + return "" +} + +func (x *GraphQLRule) GetSubscription() string { + if x, ok := x.GetPattern().(*GraphQLRule_Subscription); ok { + return x.Subscription + } + return "" +} + +func (x *GraphQLRule) GetArgs() []*Arg { + if x != nil { + return x.Args + } + return nil +} + +func (x *GraphQLRule) GetNodeId() string { + if x != nil { + return x.NodeId + } + return "" +} + +func (x *GraphQLRule) GetAdditionalBindings() []*GraphQLRule { + if x != nil { + return x.AdditionalBindings + } + return nil +} + +type isGraphQLRule_Pattern interface { + isGraphQLRule_Pattern() +} + +type GraphQLRule_Query struct { + Query string `protobuf:"bytes,1,opt,name=query,proto3,oneof"` +} + +type GraphQLRule_Mutation struct { + Mutation string `protobuf:"bytes,2,opt,name=mutation,proto3,oneof"` +} + +type GraphQLRule_Subscription struct { + Subscription string `protobuf:"bytes,3,opt,name=subscription,proto3,oneof"` +} + +func (*GraphQLRule_Query) isGraphQLRule_Pattern() {} + +func (*GraphQLRule_Mutation) isGraphQLRule_Pattern() {} + +func (*GraphQLRule_Subscription) isGraphQLRule_Pattern() {} + +type Arg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Field string `protobuf:"bytes,2,opt,name=field,proto3" json:"field,omitempty"` +} + +func (x *Arg) Reset() { + *x = Arg{} + if protoimpl.UnsafeEnabled { + mi := &file_larking_api_graphql_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Arg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Arg) ProtoMessage() {} + +func (x *Arg) ProtoReflect() protoreflect.Message { + mi := &file_larking_api_graphql_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Arg.ProtoReflect.Descriptor instead. +func (*Arg) Descriptor() ([]byte, []int) { + return file_larking_api_graphql_proto_rawDescGZIP(), []int{1} +} + +func (x *Arg) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Arg) GetField() string { + if x != nil { + return x.Field + } + return "" +} + +// Connection +// https://relay.dev/graphql/connections.htm# +// A field that returns a Connection Type must include forward pagination +// arguments, backward pagination arguments, or both. These pagination arguments +// allow the client to slice the set of edges before it is returned. +// +// Forward Arguments: +// - first takes a non-negative integer. +// - after takes the cursor type as described in the cursor field section. +// +// Backward Arguments: +// - last takes a non-negative integer. +// - before takes the cursor type as described in the cursor field section. +type MessageConnection struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // TODO + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Method string `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"` + Args []*Arg `protobuf:"bytes,3,rep,name=args,proto3" json:"args,omitempty"` +} + +func (x *MessageConnection) Reset() { + *x = MessageConnection{} + if protoimpl.UnsafeEnabled { + mi := &file_larking_api_graphql_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MessageConnection) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessageConnection) ProtoMessage() {} + +func (x *MessageConnection) ProtoReflect() protoreflect.Message { + mi := &file_larking_api_graphql_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MessageConnection.ProtoReflect.Descriptor instead. +func (*MessageConnection) Descriptor() ([]byte, []int) { + return file_larking_api_graphql_proto_rawDescGZIP(), []int{2} +} + +func (x *MessageConnection) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *MessageConnection) GetMethod() string { + if x != nil { + return x.Method + } + return "" +} + +func (x *MessageConnection) GetArgs() []*Arg { + if x != nil { + return x.Args + } + return nil +} + +// https://relay.dev/graphql/connections.htm +type PageInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + HasNextPage bool `protobuf:"varint,1,opt,name=has_next_page,json=hasNextPage,proto3" json:"has_next_page,omitempty"` + HasPreviousPage bool `protobuf:"varint,2,opt,name=has_previous_page,json=hasPreviousPage,proto3" json:"has_previous_page,omitempty"` + StartCursor []byte `protobuf:"bytes,3,opt,name=start_cursor,json=startCursor,proto3" json:"start_cursor,omitempty"` + EndCursor []byte `protobuf:"bytes,4,opt,name=end_cursor,json=endCursor,proto3" json:"end_cursor,omitempty"` +} + +func (x *PageInfo) Reset() { + *x = PageInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_larking_api_graphql_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PageInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PageInfo) ProtoMessage() {} + +func (x *PageInfo) ProtoReflect() protoreflect.Message { + mi := &file_larking_api_graphql_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PageInfo.ProtoReflect.Descriptor instead. +func (*PageInfo) Descriptor() ([]byte, []int) { + return file_larking_api_graphql_proto_rawDescGZIP(), []int{3} +} + +func (x *PageInfo) GetHasNextPage() bool { + if x != nil { + return x.HasNextPage + } + return false +} + +func (x *PageInfo) GetHasPreviousPage() bool { + if x != nil { + return x.HasPreviousPage + } + return false +} + +func (x *PageInfo) GetStartCursor() []byte { + if x != nil { + return x.StartCursor + } + return nil +} + +func (x *PageInfo) GetEndCursor() []byte { + if x != nil { + return x.EndCursor + } + return nil +} + +type Connection struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Edges []*anypb.Any `protobuf:"bytes,1,rep,name=edges,proto3" json:"edges,omitempty"` + PageInfo *PageInfo `protobuf:"bytes,2,opt,name=page_info,json=pageInfo,proto3" json:"page_info,omitempty"` +} + +func (x *Connection) Reset() { + *x = Connection{} + if protoimpl.UnsafeEnabled { + mi := &file_larking_api_graphql_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Connection) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Connection) ProtoMessage() {} + +func (x *Connection) ProtoReflect() protoreflect.Message { + mi := &file_larking_api_graphql_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Connection.ProtoReflect.Descriptor instead. +func (*Connection) Descriptor() ([]byte, []int) { + return file_larking_api_graphql_proto_rawDescGZIP(), []int{4} +} + +func (x *Connection) GetEdges() []*anypb.Any { + if x != nil { + return x.Edges + } + return nil +} + +func (x *Connection) GetPageInfo() *PageInfo { + if x != nil { + return x.PageInfo + } + return nil +} + +type Request struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + OperationName string `protobuf:"bytes,2,opt,name=operation_name,json=operationName,proto3" json:"operation_name,omitempty"` + Variables *structpb.Struct `protobuf:"bytes,3,opt,name=variables,proto3" json:"variables,omitempty"` +} + +func (x *Request) Reset() { + *x = Request{} + if protoimpl.UnsafeEnabled { + mi := &file_larking_api_graphql_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Request) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Request) ProtoMessage() {} + +func (x *Request) ProtoReflect() protoreflect.Message { + mi := &file_larking_api_graphql_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Request.ProtoReflect.Descriptor instead. +func (*Request) Descriptor() ([]byte, []int) { + return file_larking_api_graphql_proto_rawDescGZIP(), []int{5} +} + +func (x *Request) GetQuery() string { + if x != nil { + return x.Query + } + return "" +} + +func (x *Request) GetOperationName() string { + if x != nil { + return x.OperationName + } + return "" +} + +func (x *Request) GetVariables() *structpb.Struct { + if x != nil { + return x.Variables + } + return nil +} + +type Response struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data *structpb.Struct `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + Errors []*Error `protobuf:"bytes,2,rep,name=errors,proto3" json:"errors,omitempty"` +} + +func (x *Response) Reset() { + *x = Response{} + if protoimpl.UnsafeEnabled { + mi := &file_larking_api_graphql_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Response) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Response) ProtoMessage() {} + +func (x *Response) ProtoReflect() protoreflect.Message { + mi := &file_larking_api_graphql_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Response.ProtoReflect.Descriptor instead. +func (*Response) Descriptor() ([]byte, []int) { + return file_larking_api_graphql_proto_rawDescGZIP(), []int{6} +} + +func (x *Response) GetData() *structpb.Struct { + if x != nil { + return x.Data + } + return nil +} + +func (x *Response) GetErrors() []*Error { + if x != nil { + return x.Errors + } + return nil +} + +type Error struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` + Path []string `protobuf:"bytes,2,rep,name=path,proto3" json:"path,omitempty"` + Extensions *structpb.Struct `protobuf:"bytes,3,opt,name=extensions,proto3" json:"extensions,omitempty"` +} + +func (x *Error) Reset() { + *x = Error{} + if protoimpl.UnsafeEnabled { + mi := &file_larking_api_graphql_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Error) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Error) ProtoMessage() {} + +func (x *Error) ProtoReflect() protoreflect.Message { + mi := &file_larking_api_graphql_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Error.ProtoReflect.Descriptor instead. +func (*Error) Descriptor() ([]byte, []int) { + return file_larking_api_graphql_proto_rawDescGZIP(), []int{7} +} + +func (x *Error) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *Error) GetPath() []string { + if x != nil { + return x.Path + } + return nil +} + +func (x *Error) GetExtensions() *structpb.Struct { + if x != nil { + return x.Extensions + } + return nil +} + +type GetRelayNodeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *GetRelayNodeRequest) Reset() { + *x = GetRelayNodeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_larking_api_graphql_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRelayNodeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRelayNodeRequest) ProtoMessage() {} + +func (x *GetRelayNodeRequest) ProtoReflect() protoreflect.Message { + mi := &file_larking_api_graphql_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRelayNodeRequest.ProtoReflect.Descriptor instead. +func (*GetRelayNodeRequest) Descriptor() ([]byte, []int) { + return file_larking_api_graphql_proto_rawDescGZIP(), []int{8} +} + +func (x *GetRelayNodeRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +var file_larking_api_graphql_proto_extTypes = []protoimpl.ExtensionInfo{ + { + ExtendedType: (*descriptorpb.MethodOptions)(nil), + ExtensionType: (*GraphQLRule)(nil), + Field: 72222228, + Name: "larking.api.relay", + Tag: "bytes,72222228,opt,name=relay", + Filename: "larking/api/graphql.proto", + }, + { + ExtendedType: (*descriptorpb.FieldOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 70000, + Name: "larking.api.relay_id", + Tag: "varint,70000,opt,name=relay_id", + Filename: "larking/api/graphql.proto", + }, + { + ExtendedType: (*descriptorpb.MessageOptions)(nil), + ExtensionType: (*MessageConnection)(nil), + Field: 70000, + Name: "larking.api.connection", + Tag: "bytes,70000,opt,name=connection", + Filename: "larking/api/graphql.proto", + }, +} + +// Extension fields to descriptorpb.MethodOptions. +var ( + // Adds a method to the GraphQL query root. + // + // optional larking.api.GraphQLRule relay = 72222228; + E_Relay = &file_larking_api_graphql_proto_extTypes[0] +) + +// Extension fields to descriptorpb.FieldOptions. +var ( + // Adds relay + // + // optional bool relay_id = 70000; + E_RelayId = &file_larking_api_graphql_proto_extTypes[1] +) + +// Extension fields to descriptorpb.MessageOptions. +var ( + // optional larking.api.MessageConnection connection = 70000; + E_Connection = &file_larking_api_graphql_proto_extTypes[2] +) + +var File_larking_api_graphql_proto protoreflect.FileDescriptor + +var file_larking_api_graphql_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x72, + 0x61, 0x70, 0x68, 0x71, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6c, 0x61, 0x72, + 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0xfe, 0x01, 0x0a, 0x0b, 0x47, 0x72, 0x61, 0x70, 0x68, 0x51, 0x4c, 0x52, 0x75, 0x6c, + 0x65, 0x12, 0x16, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x48, 0x00, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x08, 0x6d, 0x75, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x6d, + 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x24, 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x0c, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x24, 0x0a, + 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6c, 0x61, + 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x72, 0x67, 0x52, 0x04, 0x61, + 0x72, 0x67, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x49, 0x0a, 0x13, + 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x62, 0x69, 0x6e, 0x64, 0x69, + 0x6e, 0x67, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6c, 0x61, 0x72, 0x6b, + 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x72, 0x61, 0x70, 0x68, 0x51, 0x4c, 0x52, + 0x75, 0x6c, 0x65, 0x52, 0x12, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x42, + 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x22, 0x2f, 0x0a, 0x03, 0x41, 0x72, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x22, 0x65, 0x0a, 0x11, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, + 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x12, 0x24, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x41, 0x72, 0x67, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x9c, 0x01, 0x0a, 0x08, 0x50, + 0x61, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x22, 0x0a, 0x0d, 0x68, 0x61, 0x73, 0x5f, 0x6e, + 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, + 0x68, 0x61, 0x73, 0x4e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x68, + 0x61, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x5f, 0x70, 0x61, 0x67, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x68, 0x61, 0x73, 0x50, 0x72, 0x65, 0x76, 0x69, + 0x6f, 0x75, 0x73, 0x50, 0x61, 0x67, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x5f, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x43, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x6e, + 0x64, 0x5f, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, + 0x65, 0x6e, 0x64, 0x43, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x22, 0x6c, 0x0a, 0x0a, 0x43, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x64, 0x67, 0x65, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x65, 0x64, + 0x67, 0x65, 0x73, 0x12, 0x32, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x70, + 0x61, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x7d, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x6f, 0x70, 0x65, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0d, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x35, 0x0a, 0x09, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x09, 0x76, 0x61, 0x72, + 0x69, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x22, 0x63, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, + 0x2a, 0x0a, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x12, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x45, 0x72, + 0x72, 0x6f, 0x72, 0x52, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x22, 0x6e, 0x0a, 0x05, 0x45, + 0x72, 0x72, 0x6f, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, + 0x74, 0x68, 0x12, 0x37, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, + 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x25, 0x0a, 0x13, 0x47, + 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, + 0x69, 0x64, 0x32, 0x5d, 0x0a, 0x07, 0x47, 0x72, 0x61, 0x70, 0x68, 0x51, 0x4c, 0x12, 0x52, 0x0a, + 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x14, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x6c, + 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x5a, 0x0a, 0x12, 0x08, 0x2f, + 0x67, 0x72, 0x61, 0x70, 0x68, 0x71, 0x6c, 0x22, 0x08, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x68, 0x71, + 0x6c, 0x32, 0x4f, 0x0a, 0x05, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x46, 0x0a, 0x0c, 0x47, 0x65, + 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x2e, 0x6c, 0x61, 0x72, + 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, + 0x79, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, + 0x6e, 0x79, 0x3a, 0x51, 0x0a, 0x05, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x1e, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x94, 0x8c, 0xb8, 0x22, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x47, 0x72, 0x61, 0x70, 0x68, 0x51, 0x4c, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x05, + 0x72, 0x65, 0x6c, 0x61, 0x79, 0x3a, 0x3d, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x69, + 0x64, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x18, 0xf0, 0xa2, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x49, + 0x64, 0x88, 0x01, 0x01, 0x3a, 0x61, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x18, 0xf0, 0xa2, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6c, 0x61, + 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x63, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x24, 0x5a, 0x22, 0x6c, 0x61, 0x72, 0x6b, 0x69, + 0x6e, 0x67, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x68, 0x71, + 0x6c, 0x70, 0x62, 0x3b, 0x67, 0x72, 0x61, 0x70, 0x68, 0x71, 0x6c, 0x70, 0x62, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_larking_api_graphql_proto_rawDescOnce sync.Once + file_larking_api_graphql_proto_rawDescData = file_larking_api_graphql_proto_rawDesc +) + +func file_larking_api_graphql_proto_rawDescGZIP() []byte { + file_larking_api_graphql_proto_rawDescOnce.Do(func() { + file_larking_api_graphql_proto_rawDescData = protoimpl.X.CompressGZIP(file_larking_api_graphql_proto_rawDescData) + }) + return file_larking_api_graphql_proto_rawDescData +} + +var file_larking_api_graphql_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_larking_api_graphql_proto_goTypes = []interface{}{ + (*GraphQLRule)(nil), // 0: larking.api.GraphQLRule + (*Arg)(nil), // 1: larking.api.Arg + (*MessageConnection)(nil), // 2: larking.api.MessageConnection + (*PageInfo)(nil), // 3: larking.api.PageInfo + (*Connection)(nil), // 4: larking.api.Connection + (*Request)(nil), // 5: larking.api.Request + (*Response)(nil), // 6: larking.api.Response + (*Error)(nil), // 7: larking.api.Error + (*GetRelayNodeRequest)(nil), // 8: larking.api.GetRelayNodeRequest + (*anypb.Any)(nil), // 9: google.protobuf.Any + (*structpb.Struct)(nil), // 10: google.protobuf.Struct + (*descriptorpb.MethodOptions)(nil), // 11: google.protobuf.MethodOptions + (*descriptorpb.FieldOptions)(nil), // 12: google.protobuf.FieldOptions + (*descriptorpb.MessageOptions)(nil), // 13: google.protobuf.MessageOptions +} +var file_larking_api_graphql_proto_depIdxs = []int32{ + 1, // 0: larking.api.GraphQLRule.args:type_name -> larking.api.Arg + 0, // 1: larking.api.GraphQLRule.additional_bindings:type_name -> larking.api.GraphQLRule + 1, // 2: larking.api.MessageConnection.args:type_name -> larking.api.Arg + 9, // 3: larking.api.Connection.edges:type_name -> google.protobuf.Any + 3, // 4: larking.api.Connection.page_info:type_name -> larking.api.PageInfo + 10, // 5: larking.api.Request.variables:type_name -> google.protobuf.Struct + 10, // 6: larking.api.Response.data:type_name -> google.protobuf.Struct + 7, // 7: larking.api.Response.errors:type_name -> larking.api.Error + 10, // 8: larking.api.Error.extensions:type_name -> google.protobuf.Struct + 11, // 9: larking.api.relay:extendee -> google.protobuf.MethodOptions + 12, // 10: larking.api.relay_id:extendee -> google.protobuf.FieldOptions + 13, // 11: larking.api.connection:extendee -> google.protobuf.MessageOptions + 0, // 12: larking.api.relay:type_name -> larking.api.GraphQLRule + 2, // 13: larking.api.connection:type_name -> larking.api.MessageConnection + 5, // 14: larking.api.GraphQL.Query:input_type -> larking.api.Request + 8, // 15: larking.api.Relay.GetRelayNode:input_type -> larking.api.GetRelayNodeRequest + 6, // 16: larking.api.GraphQL.Query:output_type -> larking.api.Response + 9, // 17: larking.api.Relay.GetRelayNode:output_type -> google.protobuf.Any + 16, // [16:18] is the sub-list for method output_type + 14, // [14:16] is the sub-list for method input_type + 12, // [12:14] is the sub-list for extension type_name + 9, // [9:12] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name +} + +func init() { file_larking_api_graphql_proto_init() } +func file_larking_api_graphql_proto_init() { + if File_larking_api_graphql_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_larking_api_graphql_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GraphQLRule); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_larking_api_graphql_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Arg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_larking_api_graphql_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MessageConnection); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_larking_api_graphql_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PageInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_larking_api_graphql_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Connection); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_larking_api_graphql_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Request); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_larking_api_graphql_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Response); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_larking_api_graphql_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Error); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_larking_api_graphql_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRelayNodeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_larking_api_graphql_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*GraphQLRule_Query)(nil), + (*GraphQLRule_Mutation)(nil), + (*GraphQLRule_Subscription)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_larking_api_graphql_proto_rawDesc, + NumEnums: 0, + NumMessages: 9, + NumExtensions: 3, + NumServices: 2, + }, + GoTypes: file_larking_api_graphql_proto_goTypes, + DependencyIndexes: file_larking_api_graphql_proto_depIdxs, + MessageInfos: file_larking_api_graphql_proto_msgTypes, + ExtensionInfos: file_larking_api_graphql_proto_extTypes, + }.Build() + File_larking_api_graphql_proto = out.File + file_larking_api_graphql_proto_rawDesc = nil + file_larking_api_graphql_proto_goTypes = nil + file_larking_api_graphql_proto_depIdxs = nil +} diff --git a/api/graphql_grpc.pb.go b/api/graphqlpb/graphql_grpc.pb.go similarity index 72% rename from api/graphql_grpc.pb.go rename to api/graphqlpb/graphql_grpc.pb.go index 8081cb9..2324706 100644 --- a/api/graphql_grpc.pb.go +++ b/api/graphqlpb/graphql_grpc.pb.go @@ -1,10 +1,17 @@ +// Copyright 2021 Edward McFarlane. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v3.21.12 +// source: larking/api/graphql.proto -package api +package graphqlpb import ( context "context" - httpbody "google.golang.org/genproto/googleapis/api/httpbody" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -16,11 +23,15 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 +const ( + GraphQL_Query_FullMethodName = "/larking.api.GraphQL/Query" +) + // GraphQLClient is the client API for GraphQL 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. type GraphQLClient interface { - Query(ctx context.Context, in *httpbody.HttpBody, opts ...grpc.CallOption) (GraphQL_QueryClient, error) + Query(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) } type graphQLClient struct { @@ -31,43 +42,20 @@ func NewGraphQLClient(cc grpc.ClientConnInterface) GraphQLClient { return &graphQLClient{cc} } -func (c *graphQLClient) Query(ctx context.Context, in *httpbody.HttpBody, opts ...grpc.CallOption) (GraphQL_QueryClient, error) { - stream, err := c.cc.NewStream(ctx, &GraphQL_ServiceDesc.Streams[0], "/larking.api.GraphQL/Query", opts...) +func (c *graphQLClient) Query(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { + out := new(Response) + err := c.cc.Invoke(ctx, GraphQL_Query_FullMethodName, in, out, opts...) if err != nil { return nil, err } - x := &graphQLQueryClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type GraphQL_QueryClient interface { - Recv() (*GraphQLResponse, error) - grpc.ClientStream -} - -type graphQLQueryClient struct { - grpc.ClientStream -} - -func (x *graphQLQueryClient) Recv() (*GraphQLResponse, error) { - m := new(GraphQLResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil + return out, nil } // GraphQLServer is the server API for GraphQL service. // All implementations must embed UnimplementedGraphQLServer // for forward compatibility type GraphQLServer interface { - Query(*httpbody.HttpBody, GraphQL_QueryServer) error + Query(context.Context, *Request) (*Response, error) mustEmbedUnimplementedGraphQLServer() } @@ -75,8 +63,8 @@ type GraphQLServer interface { type UnimplementedGraphQLServer struct { } -func (UnimplementedGraphQLServer) Query(*httpbody.HttpBody, GraphQL_QueryServer) error { - return status.Errorf(codes.Unimplemented, "method Query not implemented") +func (UnimplementedGraphQLServer) Query(context.Context, *Request) (*Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Query not implemented") } func (UnimplementedGraphQLServer) mustEmbedUnimplementedGraphQLServer() {} @@ -91,25 +79,22 @@ func RegisterGraphQLServer(s grpc.ServiceRegistrar, srv GraphQLServer) { s.RegisterService(&GraphQL_ServiceDesc, srv) } -func _GraphQL_Query_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(httpbody.HttpBody) - if err := stream.RecvMsg(m); err != nil { - return err +func _GraphQL_Query_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Request) + if err := dec(in); err != nil { + return nil, err } - return srv.(GraphQLServer).Query(m, &graphQLQueryServer{stream}) -} - -type GraphQL_QueryServer interface { - Send(*GraphQLResponse) error - grpc.ServerStream -} - -type graphQLQueryServer struct { - grpc.ServerStream -} - -func (x *graphQLQueryServer) Send(m *GraphQLResponse) error { - return x.ServerStream.SendMsg(m) + if interceptor == nil { + return srv.(GraphQLServer).Query(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: GraphQL_Query_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GraphQLServer).Query(ctx, req.(*Request)) + } + return interceptor(ctx, in, info, handler) } // GraphQL_ServiceDesc is the grpc.ServiceDesc for GraphQL service. @@ -118,17 +103,20 @@ func (x *graphQLQueryServer) Send(m *GraphQLResponse) error { var GraphQL_ServiceDesc = grpc.ServiceDesc{ ServiceName: "larking.api.GraphQL", HandlerType: (*GraphQLServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ + Methods: []grpc.MethodDesc{ { - StreamName: "Query", - Handler: _GraphQL_Query_Handler, - ServerStreams: true, + MethodName: "Query", + Handler: _GraphQL_Query_Handler, }, }, - Metadata: "api/graphql.proto", + Streams: []grpc.StreamDesc{}, + Metadata: "larking/api/graphql.proto", } +const ( + Relay_GetRelayNode_FullMethodName = "/larking.api.Relay/GetRelayNode" +) + // RelayClient is the client API for Relay 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. @@ -147,7 +135,7 @@ func NewRelayClient(cc grpc.ClientConnInterface) RelayClient { func (c *relayClient) GetRelayNode(ctx context.Context, in *GetRelayNodeRequest, opts ...grpc.CallOption) (*anypb.Any, error) { out := new(anypb.Any) - err := c.cc.Invoke(ctx, "/larking.api.Relay/GetRelayNode", in, out, opts...) + err := c.cc.Invoke(ctx, Relay_GetRelayNode_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -193,7 +181,7 @@ func _Relay_GetRelayNode_Handler(srv interface{}, ctx context.Context, dec func( } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/larking.api.Relay/GetRelayNode", + FullMethod: Relay_GetRelayNode_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(RelayServer).GetRelayNode(ctx, req.(*GetRelayNodeRequest)) @@ -214,5 +202,5 @@ var Relay_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "api/graphql.proto", + Metadata: "larking/api/graphql.proto", } diff --git a/testpb/starwars.proto b/api/starwars.proto similarity index 93% rename from testpb/starwars.proto rename to api/starwars.proto index 1f5d274..f837168 100644 --- a/testpb/starwars.proto +++ b/api/starwars.proto @@ -1,16 +1,16 @@ -// Copyright 2021 Edward McFarlane. All rights reserved. +// Copyright 2023 Edward McFarlane. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. syntax = "proto3"; -package larking.testpb; +package larking.api; import "google/api/annotations.proto"; -import "api/graphql.proto"; +import "larking/api/graphql.proto"; // import "google/protobuf/empty.proto"; -option go_package = "github.com/emcfarlane/larking/testpb;testpb"; +option go_package = "larking.io/api/starwarspb;starwarspb"; message Faction { // option (larking.api.relay).node = { diff --git a/api/starwarspb/starwars.pb.go b/api/starwarspb/starwars.pb.go new file mode 100644 index 0000000..9d6df80 --- /dev/null +++ b/api/starwarspb/starwars.pb.go @@ -0,0 +1,552 @@ +// Copyright 2023 Edward McFarlane. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc v3.21.12 +// source: larking/api/starwars.proto + +package starwarspb + +import ( + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + _ "larking.io/api/graphqlpb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Faction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // [ (larking.api.relay).node = { + // method : "/larking.testpb.StarWars/GetFaction/" + // matches : "{name=factions/*}" + // } ]; + DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` +} + +func (x *Faction) Reset() { + *x = Faction{} + if protoimpl.UnsafeEnabled { + mi := &file_larking_api_starwars_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Faction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Faction) ProtoMessage() {} + +func (x *Faction) ProtoReflect() protoreflect.Message { + mi := &file_larking_api_starwars_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Faction.ProtoReflect.Descriptor instead. +func (*Faction) Descriptor() ([]byte, []int) { + return file_larking_api_starwars_proto_rawDescGZIP(), []int{0} +} + +func (x *Faction) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Faction) GetDisplayName() string { + if x != nil { + return x.DisplayName + } + return "" +} + +type GetFactionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *GetFactionRequest) Reset() { + *x = GetFactionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_larking_api_starwars_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetFactionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFactionRequest) ProtoMessage() {} + +func (x *GetFactionRequest) ProtoReflect() protoreflect.Message { + mi := &file_larking_api_starwars_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFactionRequest.ProtoReflect.Descriptor instead. +func (*GetFactionRequest) Descriptor() ([]byte, []int) { + return file_larking_api_starwars_proto_rawDescGZIP(), []int{1} +} + +func (x *GetFactionRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type Ship struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` +} + +func (x *Ship) Reset() { + *x = Ship{} + if protoimpl.UnsafeEnabled { + mi := &file_larking_api_starwars_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Ship) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Ship) ProtoMessage() {} + +func (x *Ship) ProtoReflect() protoreflect.Message { + mi := &file_larking_api_starwars_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Ship.ProtoReflect.Descriptor instead. +func (*Ship) Descriptor() ([]byte, []int) { + return file_larking_api_starwars_proto_rawDescGZIP(), []int{2} +} + +func (x *Ship) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Ship) GetDisplayName() string { + if x != nil { + return x.DisplayName + } + return "" +} + +type GetShipRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *GetShipRequest) Reset() { + *x = GetShipRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_larking_api_starwars_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetShipRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetShipRequest) ProtoMessage() {} + +func (x *GetShipRequest) ProtoReflect() protoreflect.Message { + mi := &file_larking_api_starwars_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetShipRequest.ProtoReflect.Descriptor instead. +func (*GetShipRequest) Descriptor() ([]byte, []int) { + return file_larking_api_starwars_proto_rawDescGZIP(), []int{3} +} + +func (x *GetShipRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type ListShipsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` +} + +func (x *ListShipsRequest) Reset() { + *x = ListShipsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_larking_api_starwars_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListShipsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListShipsRequest) ProtoMessage() {} + +func (x *ListShipsRequest) ProtoReflect() protoreflect.Message { + mi := &file_larking_api_starwars_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListShipsRequest.ProtoReflect.Descriptor instead. +func (*ListShipsRequest) Descriptor() ([]byte, []int) { + return file_larking_api_starwars_proto_rawDescGZIP(), []int{4} +} + +func (x *ListShipsRequest) GetParent() string { + if x != nil { + return x.Parent + } + return "" +} + +func (x *ListShipsRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListShipsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +type ListShipsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ships []*Ship `protobuf:"bytes,1,rep,name=ships,proto3" json:"ships,omitempty"` + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListShipsResponse) Reset() { + *x = ListShipsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_larking_api_starwars_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListShipsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListShipsResponse) ProtoMessage() {} + +func (x *ListShipsResponse) ProtoReflect() protoreflect.Message { + mi := &file_larking_api_starwars_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListShipsResponse.ProtoReflect.Descriptor instead. +func (*ListShipsResponse) Descriptor() ([]byte, []int) { + return file_larking_api_starwars_proto_rawDescGZIP(), []int{5} +} + +func (x *ListShipsResponse) GetShips() []*Ship { + if x != nil { + return x.Ships + } + return nil +} + +func (x *ListShipsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +var File_larking_api_starwars_proto protoreflect.FileDescriptor + +var file_larking_api_starwars_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x74, + 0x61, 0x72, 0x77, 0x61, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6c, 0x61, + 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x68, 0x71, 0x6c, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x40, 0x0a, 0x07, 0x46, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, + 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x27, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x46, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x43, 0x0a, + 0x04, 0x53, 0x68, 0x69, 0x70, 0x12, 0x18, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x04, 0x80, 0x97, 0x22, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x21, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, + 0x6d, 0x65, 0x22, 0x24, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x53, 0x68, 0x69, 0x70, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x66, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, + 0x53, 0x68, 0x69, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, + 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, + 0x72, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, + 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x22, 0x64, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x69, 0x70, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x05, 0x73, 0x68, 0x69, 0x70, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x53, 0x68, 0x69, 0x70, 0x52, 0x05, 0x73, 0x68, 0x69, 0x70, 0x73, 0x12, 0x26, + 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, + 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x32, 0xf1, 0x02, 0x0a, 0x08, 0x53, 0x74, 0x61, 0x72, 0x57, + 0x61, 0x72, 0x73, 0x12, 0x8f, 0x01, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x46, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x1e, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x47, 0x65, 0x74, 0x46, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x46, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4b, 0xa2, 0xe1, 0xc0, 0x93, 0x02, 0x28, + 0x22, 0x0a, 0x0a, 0x02, 0x69, 0x64, 0x12, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x2a, 0x11, 0x7b, 0x6e, + 0x61, 0x6d, 0x65, 0x3d, 0x66, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x2a, 0x7d, 0x0a, + 0x07, 0x66, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x12, 0x15, + 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x66, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x71, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x69, + 0x70, 0x73, 0x12, 0x1d, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x69, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1e, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x69, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x12, 0x1d, 0x2f, 0x76, 0x31, 0x2f, 0x7b, + 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x66, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, + 0x2a, 0x7d, 0x2f, 0x73, 0x68, 0x69, 0x70, 0x73, 0x12, 0x60, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x53, + 0x68, 0x69, 0x70, 0x12, 0x1b, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x68, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x11, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x53, + 0x68, 0x69, 0x70, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x12, 0x1d, 0x2f, 0x76, 0x31, + 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x66, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, + 0x2a, 0x2f, 0x73, 0x68, 0x69, 0x70, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0x26, 0x5a, 0x24, 0x6c, 0x61, + 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x74, 0x61, + 0x72, 0x77, 0x61, 0x72, 0x73, 0x70, 0x62, 0x3b, 0x73, 0x74, 0x61, 0x72, 0x77, 0x61, 0x72, 0x73, + 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_larking_api_starwars_proto_rawDescOnce sync.Once + file_larking_api_starwars_proto_rawDescData = file_larking_api_starwars_proto_rawDesc +) + +func file_larking_api_starwars_proto_rawDescGZIP() []byte { + file_larking_api_starwars_proto_rawDescOnce.Do(func() { + file_larking_api_starwars_proto_rawDescData = protoimpl.X.CompressGZIP(file_larking_api_starwars_proto_rawDescData) + }) + return file_larking_api_starwars_proto_rawDescData +} + +var file_larking_api_starwars_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_larking_api_starwars_proto_goTypes = []interface{}{ + (*Faction)(nil), // 0: larking.api.Faction + (*GetFactionRequest)(nil), // 1: larking.api.GetFactionRequest + (*Ship)(nil), // 2: larking.api.Ship + (*GetShipRequest)(nil), // 3: larking.api.GetShipRequest + (*ListShipsRequest)(nil), // 4: larking.api.ListShipsRequest + (*ListShipsResponse)(nil), // 5: larking.api.ListShipsResponse +} +var file_larking_api_starwars_proto_depIdxs = []int32{ + 2, // 0: larking.api.ListShipsResponse.ships:type_name -> larking.api.Ship + 1, // 1: larking.api.StarWars.GetFaction:input_type -> larking.api.GetFactionRequest + 4, // 2: larking.api.StarWars.ListShips:input_type -> larking.api.ListShipsRequest + 3, // 3: larking.api.StarWars.GetShip:input_type -> larking.api.GetShipRequest + 0, // 4: larking.api.StarWars.GetFaction:output_type -> larking.api.Faction + 5, // 5: larking.api.StarWars.ListShips:output_type -> larking.api.ListShipsResponse + 2, // 6: larking.api.StarWars.GetShip:output_type -> larking.api.Ship + 4, // [4:7] is the sub-list for method output_type + 1, // [1:4] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_larking_api_starwars_proto_init() } +func file_larking_api_starwars_proto_init() { + if File_larking_api_starwars_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_larking_api_starwars_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Faction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_larking_api_starwars_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetFactionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_larking_api_starwars_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Ship); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_larking_api_starwars_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetShipRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_larking_api_starwars_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListShipsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_larking_api_starwars_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListShipsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_larking_api_starwars_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_larking_api_starwars_proto_goTypes, + DependencyIndexes: file_larking_api_starwars_proto_depIdxs, + MessageInfos: file_larking_api_starwars_proto_msgTypes, + }.Build() + File_larking_api_starwars_proto = out.File + file_larking_api_starwars_proto_rawDesc = nil + file_larking_api_starwars_proto_goTypes = nil + file_larking_api_starwars_proto_depIdxs = nil +} diff --git a/testpb/starwars_grpc.pb.go b/api/starwarspb/starwars_grpc.pb.go similarity index 85% rename from testpb/starwars_grpc.pb.go rename to api/starwarspb/starwars_grpc.pb.go index 037b94e..896a31f 100644 --- a/testpb/starwars_grpc.pb.go +++ b/api/starwarspb/starwars_grpc.pb.go @@ -1,6 +1,14 @@ +// Copyright 2023 Edward McFarlane. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v3.21.12 +// source: larking/api/starwars.proto -package testpb +package starwarspb import ( context "context" @@ -14,6 +22,12 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 +const ( + StarWars_GetFaction_FullMethodName = "/larking.api.StarWars/GetFaction" + StarWars_ListShips_FullMethodName = "/larking.api.StarWars/ListShips" + StarWars_GetShip_FullMethodName = "/larking.api.StarWars/GetShip" +) + // StarWarsClient is the client API for StarWars 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. @@ -33,7 +47,7 @@ func NewStarWarsClient(cc grpc.ClientConnInterface) StarWarsClient { func (c *starWarsClient) GetFaction(ctx context.Context, in *GetFactionRequest, opts ...grpc.CallOption) (*Faction, error) { out := new(Faction) - err := c.cc.Invoke(ctx, "/larking.testpb.StarWars/GetFaction", in, out, opts...) + err := c.cc.Invoke(ctx, StarWars_GetFaction_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -42,7 +56,7 @@ func (c *starWarsClient) GetFaction(ctx context.Context, in *GetFactionRequest, func (c *starWarsClient) ListShips(ctx context.Context, in *ListShipsRequest, opts ...grpc.CallOption) (*ListShipsResponse, error) { out := new(ListShipsResponse) - err := c.cc.Invoke(ctx, "/larking.testpb.StarWars/ListShips", in, out, opts...) + err := c.cc.Invoke(ctx, StarWars_ListShips_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -51,7 +65,7 @@ func (c *starWarsClient) ListShips(ctx context.Context, in *ListShipsRequest, op func (c *starWarsClient) GetShip(ctx context.Context, in *GetShipRequest, opts ...grpc.CallOption) (*Ship, error) { out := new(Ship) - err := c.cc.Invoke(ctx, "/larking.testpb.StarWars/GetShip", in, out, opts...) + err := c.cc.Invoke(ctx, StarWars_GetShip_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -104,7 +118,7 @@ func _StarWars_GetFaction_Handler(srv interface{}, ctx context.Context, dec func } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/larking.testpb.StarWars/GetFaction", + FullMethod: StarWars_GetFaction_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(StarWarsServer).GetFaction(ctx, req.(*GetFactionRequest)) @@ -122,7 +136,7 @@ func _StarWars_ListShips_Handler(srv interface{}, ctx context.Context, dec func( } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/larking.testpb.StarWars/ListShips", + FullMethod: StarWars_ListShips_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(StarWarsServer).ListShips(ctx, req.(*ListShipsRequest)) @@ -140,7 +154,7 @@ func _StarWars_GetShip_Handler(srv interface{}, ctx context.Context, dec func(in } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/larking.testpb.StarWars/GetShip", + FullMethod: StarWars_GetShip_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(StarWarsServer).GetShip(ctx, req.(*GetShipRequest)) @@ -152,7 +166,7 @@ func _StarWars_GetShip_Handler(srv interface{}, ctx context.Context, dec func(in // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var StarWars_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "larking.testpb.StarWars", + ServiceName: "larking.api.StarWars", HandlerType: (*StarWarsServer)(nil), Methods: []grpc.MethodDesc{ { @@ -169,5 +183,5 @@ var StarWars_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "testpb/starwars.proto", + Metadata: "larking/api/starwars.proto", } diff --git a/go.mod b/go.mod index b83b498..063b6b3 100644 --- a/go.mod +++ b/go.mod @@ -16,6 +16,7 @@ require ( github.com/gobwas/httphead v0.1.0 // indirect github.com/gobwas/pool v0.2.1 // indirect github.com/golang/protobuf v1.5.3 // indirect + github.com/graphql-go/graphql v0.8.1 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.9.0 // indirect ) diff --git a/go.sum b/go.sum index 1860a03..5f99bde 100644 --- a/go.sum +++ b/go.sum @@ -10,6 +10,8 @@ github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/graphql-go/graphql v0.8.1 h1:p7/Ou/WpmulocJeEx7wjQy611rtXGQaAcXGqanuMMgc= +github.com/graphql-go/graphql v0.8.1/go.mod h1:nKiHzRM0qopJEwCITUuIsxk9PlVlwIiiI8pnJEhordQ= golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= diff --git a/graphql.go b/graphql.go deleted file mode 100644 index d2ba134..0000000 --- a/graphql.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2021 Edward McFarlane. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package larking - -import ( - "encoding/json" - "fmt" - "log" - "net/http" - - "github.com/graphql-go/graphql" -) - -func (m *Mux) serveGraphQL(w http.ResponseWriter, r *http.Request) error { - fmt.Println("serve graphQL") - - // Schema - fields := graphql.Fields{ - "hello": &graphql.Field{ - Type: graphql.String, - Resolve: func(p graphql.ResolveParams) (interface{}, error) { - return "world", nil - }, - }, - } - rootQuery := graphql.ObjectConfig{Name: "RootQuery", Fields: fields} - schemaConfig := graphql.SchemaConfig{Query: graphql.NewObject(rootQuery)} - schema, err := graphql.NewSchema(schemaConfig) - if err != nil { - log.Fatalf("failed to create new schema, error: %v", err) - } - - // Query - query := ` - { - hello - } - ` - params := graphql.Params{Schema: schema, RequestString: query} - res := graphql.Do(params) - if len(res.Errors) > 0 { - log.Printf("failed to execute graphql operation, errors: %v", res.Errors) - return fmt.Errorf("%v", res.Errors) - } - rJSON, err := json.Marshal(r) - fmt.Printf("%s \n", rJSON) // {"data":{"hello":"world"}} - return err -} diff --git a/graphql_test.go b/graphql_test.go deleted file mode 100644 index 5d4436d..0000000 --- a/graphql_test.go +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright 2021 Edward McFarlane. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package larking - -import ( - "context" - "io/ioutil" - "net/http" - "net/http/httptest" - "strings" - "testing" - - "github.com/emcfarlane/larking/testpb" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -type starWarsServer struct { - factions map[string]*testpb.Faction - ships map[string]*testpb.Ship - factionShips map[string][]*testpb.Ship -} - -func newStarWarsServer(t *testing.T) *starWarsServer { - var ( - xwing = &testpb.Ship{ - Name: "factions/1/ships/1", - DisplayName: "X-Wing", - } - ywing = &testpb.Ship{ - Name: "factions/1/ships/2", - DisplayName: "Y-Wing", - } - awing = &testpb.Ship{ - Name: "factions/1/ships/3", - DisplayName: "A-Wing", - } - falcon = &testpb.Ship{ - Name: "factions/1/ships/4", - DisplayName: "Millenium Falcon", - } - homeOne = &testpb.Ship{ - Name: "factions/1/ships/5", - DisplayName: "Home One", - } - tieFighter = &testpb.Ship{ - Name: "factions/2/ships/6", - DisplayName: "TIE Fighter", - } - tieInterceptor = &testpb.Ship{ - Name: "factions/2/ships/7", - DisplayName: "TIE Interceptor", - } - executor = &testpb.Ship{ - Name: "factions/2/ships/8", - DisplayName: "Executor", - } - - rebels = &testpb.Faction{ - Name: "factions/1", - DisplayName: "Alliance to Restore the Republic", - } - empire = &testpb.Faction{ - Name: "factions/2", - DisplayName: "Galactic Empire", - } - ) - - return &starWarsServer{ - factions: map[string]*testpb.Faction{ - "factions/1": rebels, - "factions/2": empire, - }, - ships: map[string]*testpb.Ship{ - "factions/1/ships/1": xwing, - "factions/1/ships/2": ywing, - "factions/1/ships/3": awing, - "factions/1/ships/4": falcon, - "factions/1/ships/5": homeOne, - "factions/2/ships/6": tieFighter, - "factions/2/ships/7": tieInterceptor, - "factions/2/ships/8": executor, - }, - factionShips: map[string][]*testpb.Ship{ - "factions/1": {xwing, ywing, awing, falcon, homeOne}, - "factions/2": {tieFighter, tieInterceptor, executor}, - }, - } -} - -func (s *starWarsServer) GetFaction(ctx context.Context, req *testpb.GetFactionRequest) (*testpb.Faction, error) { - //id := strings.TrimPrefix("factions/", req.Name) - v, ok := s.factions[req.Name] - if !ok { - return nil, status.Errorf(codes.NotFound, "missing faction: %s", req.Name) - } - return v, nil -} - -func (s *starWarsServer) GetShip(ctx context.Context, req *testpb.GetShipRequest) (*testpb.Ship, error) { - //id := strings.TrimPrefix("ships/", req.Name) - v, ok := s.ships[req.Name] - if !ok { - return nil, status.Errorf(codes.NotFound, "missing ship: %s", req.Name) - } - return v, nil -} - -func (s *starWarsServer) ListShips(ctx context.Context, req *testpb.ListShipsRequest) (*testpb.ListShipsResponse, error) { - //pid := strings.TrimPrefix(req.Parent, "factions/") - vs, ok := s.factionShips[req.Parent] - if !ok { - return nil, status.Errorf(codes.NotFound, "missing factions ships: %s", req.Parent) - } - pageSize := int(req.PageSize) - if pageSize <= 0 { - pageSize = 10 - } - pageToken := req.PageToken - - if pageToken != "" { - for i, v := range vs { - if v.Name == pageToken { - vs = vs[i+1:] - break - } - } - } - - if len(vs) > pageSize { - vs = vs[:pageSize] - } - - var nextPageToken string - if len(vs) > 0 { - nextPageToken = vs[len(vs)-1].Name - } - - return &testpb.ListShipsResponse{ - Ships: vs, - NextPageToken: nextPageToken, - }, nil -} - -//func (s *starWarsServer) GetRelayNode(ctx context.Context, req *api.GetRelayNodeRequest) (*anypb.Any, error) { -// ps := strings.Split(req.Id, "/") -// if len(ps) != 2 { -// return nil, status.Errorf(codes.InvalidArgument, "invalid name: %v", req.Id) -// } -// switch pfx := ps[0]; pfx { -// case "factions": -// v, err := s.GetFaction(ctx, &testpb.GetFactionRequest{Name: req.Id}) -// if err != nil { -// return nil, err -// } -// return anypb.New(v) -// case "ships": -// v, err := s.GetShip(ctx, &testpb.GetShipRequest{Name: req.Id}) -// if err != nil { -// return nil, err -// } -// return anypb.New(v) -// default: -// return nil, status.Errorf(codes.NotFound, "missing node: %s", req.Id) -// } -//} - -func TestGraphQLStarWars(t *testing.T) { - ss := newStarWarsServer(t) - - m, err := NewMux() - if err != nil { - t.Fatal(err) - } - if err := m.RegisterServiceByName("larking.testpb.StarWars", ss); err != nil { - t.Fatal(err) - } - - tests := []struct { - name string - query string - want string - wantErr error - }{{ - name: "getRebels", - query: `query RebelsQuery { - rebels { - id - name - } -}`, - want: `{ - "rebels": { - "id": "RmFjdGlvbjox", - "name": "Alliance to Restore the Republic" - } -}`, - }} - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - r := httptest.NewRequest( - http.MethodPost, "/graphql", strings.NewReader(tt.query), - ) - r.Header.Set("Content-Type", "application/json") - w := httptest.NewRecorder() - - m.ServeHTTP(w, r) - t.Log(w) - res := w.Result() - if res.StatusCode != 200 { - t.Fatal(res.Status) - } - - data, err := ioutil.ReadAll(r.Body) - if err != nil { - t.Fatal(err) - } - t.Log(string(data)) - - if rsp := string(data); rsp != tt.want { - t.Fatalf("response mismatch: %s != %s", rsp, tt.want) - } - - }) - } -} diff --git a/larking/graphql.go b/larking/graphql.go new file mode 100644 index 0000000..1f69a03 --- /dev/null +++ b/larking/graphql.go @@ -0,0 +1,40 @@ +package larking + +import ( + "context" + + "github.com/graphql-go/graphql" + "larking.io/api/graphqlpb" +) + +func toGraphqlErrors(errs []gqlerrors.FormattedError) []*graphqlpb.Error { + if len(errs) == 0 { + return nil + } + r := make([]*graphqlpb.Error, len(errs)) + for i, err := range errs { + r[i] = &graphqlpb.GraphQLError{ + Message: err.Message, + Locations: err.Locations, + Path: err.Path, + } + } + return r +} + +func (m *Mux) Query(ctx context.Context, req *graphqlpb.Request) (*graphqlpb.Response, error) { + s := m.loadState() + + params := &graphql.Params{ + Schema: s.graphqlSchema, + RequestString: req.Query, + VariableValues: req.Variables.Fields, + OperationName: req.OperationName, + Context: ctx, + } + result := graphql.Do(params) + return &graphqlpb.Response{ + Data: result.Data, + Errors: toGraphqlErrors(result.Errors), + }, nil +} diff --git a/larking/graphql_test.go b/larking/graphql_test.go new file mode 100644 index 0000000..9c9120b --- /dev/null +++ b/larking/graphql_test.go @@ -0,0 +1,199 @@ +package larking + +import ( + "context" + "errors" + "testing" + + "github.com/google/go-cmp/cmp" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/types/known/structpb" + "larking.io/api/graphqlpb" + "larking.io/api/starwarspb" +) + +type starWarsServer struct { + factions map[string]*starwarspb.Faction + ships map[string]*starwarspb.Ship + factionShips map[string][]*starwarspb.Ship +} + +func newStarWarsServer(t *testing.T) *starWarsServer { + var ( + xwing = &starwarspb.Ship{ + Name: "factions/rebels/ships/1", + DisplayName: "X-Wing", + } + ywing = &starwarspb.Ship{ + Name: "factions/rebels/ships/2", + DisplayName: "Y-Wing", + } + awing = &starwarspb.Ship{ + Name: "factions/rebels/ships/3", + DisplayName: "A-Wing", + } + falcon = &starwarspb.Ship{ + Name: "factions/rebels/ships/4", + DisplayName: "Millenium Falcon", + } + homeOne = &starwarspb.Ship{ + Name: "factions/rebels/ships/5", + DisplayName: "Home One", + } + tieFighter = &starwarspb.Ship{ + Name: "factions/empire/ships/6", + DisplayName: "TIE Fighter", + } + tieInterceptor = &starwarspb.Ship{ + Name: "factions/empire/ships/7", + DisplayName: "TIE Interceptor", + } + executor = &starwarspb.Ship{ + Name: "factions/empire/ships/8", + DisplayName: "Executor", + } + + rebels = &starwarspb.Faction{ + Name: "factions/rebels", + DisplayName: "Alliance to Restore the Republic", + } + empire = &starwarspb.Faction{ + Name: "factions/empire", + DisplayName: "Galactic Empire", + } + ) + + return &starWarsServer{ + factions: map[string]*starwarspb.Faction{ + "factions/rebels": rebels, + "factions/empire": empire, + }, + ships: map[string]*starwarspb.Ship{ + "factions/rebels/ships/1": xwing, + "factions/rebels/ships/2": ywing, + "factions/rebels/ships/3": awing, + "factions/rebels/ships/4": falcon, + "factions/rebels/ships/5": homeOne, + "factions/empire/ships/6": tieFighter, + "factions/empire/ships/7": tieInterceptor, + "factions/empire/ships/8": executor, + }, + factionShips: map[string][]*starwarspb.Ship{ + "factions/1": {xwing, ywing, awing, falcon, homeOne}, + "factions/2": {tieFighter, tieInterceptor, executor}, + }, + } +} + +func (s *starWarsServer) GetFaction(ctx context.Context, req *starwarspb.GetFactionRequest) (*starwarspb.Faction, error) { + //id := strings.TrimPrefix("factions/", req.Name) + v, ok := s.factions[req.Name] + if !ok { + return nil, status.Errorf(codes.NotFound, "missing faction: %s", req.Name) + } + return v, nil +} + +func (s *starWarsServer) GetShip(ctx context.Context, req *starwarspb.GetShipRequest) (*starwarspb.Ship, error) { + //id := strings.TrimPrefix("ships/", req.Name) + v, ok := s.ships[req.Name] + if !ok { + return nil, status.Errorf(codes.NotFound, "missing ship: %s", req.Name) + } + return v, nil +} + +func (s *starWarsServer) ListShips(ctx context.Context, req *starwarspb.ListShipsRequest) (*starwarspb.ListShipsResponse, error) { + //pid := strings.TrimPrefix(req.Parent, "factions/") + vs, ok := s.factionShips[req.Parent] + if !ok { + return nil, status.Errorf(codes.NotFound, "missing factions ships: %s", req.Parent) + } + pageSize := int(req.PageSize) + if pageSize <= 0 { + pageSize = 10 + } + pageToken := req.PageToken + + if pageToken != "" { + for i, v := range vs { + if v.Name == pageToken { + vs = vs[i+1:] + break + } + } + } + + if len(vs) > pageSize { + vs = vs[:pageSize] + } + + var nextPageToken string + if len(vs) > 0 { + nextPageToken = vs[len(vs)-1].Name + } + + return &starwarspb.ListShipsResponse{ + Ships: vs, + NextPageToken: nextPageToken, + }, nil +} + +func TestGraphQL(t *testing.T) { + m, err := NewMux() + if err != nil { + t.Fatal(err) + } + + //starwarspb.RegisterStarWarsServer(m, &starwarsServer{}) + + toStruct := func(str string) *structpb.Struct { + var s structpb.Struct + if err := protojson.Unmarshal([]byte(str), &s); err != nil { + t.Fatal(err) + } + return &s + } + + //t.Skip("TODO") + tests := []struct { + name string + req *graphqlpb.GraphQLRequest + rsp *graphqlpb.GraphQLResponse + err error + }{{ + name: "hero", + req: &graphqlpb.GraphQLRequest{ + Query: `{ + rebels { + id + name + } + }`, + }, + rsp: &graphqlpb.GraphQLResponse{ + Data: toStruct(`{ + "hero": { + "name": "R2-D2" + } + }`), + }, + }} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + ctx := context.Background() + rsp, err := m.Query(ctx, tt.req) + if err != nil { + if errors.Is(err, tt.err) { + t.Skip(err) + } + t.Fatal(err) + } + if diff := cmp.Diff(tt.rsp, rsp); diff != "" { + t.Errorf("diff: %s", diff) + } + }) + } +} diff --git a/larking/mux.go b/larking/mux.go index 485cf2f..9509312 100644 --- a/larking/mux.go +++ b/larking/mux.go @@ -21,6 +21,7 @@ import ( "time" "github.com/gobwas/ws" + "github.com/graphql-go/graphql" "google.golang.org/genproto/googleapis/api/annotations" "google.golang.org/genproto/googleapis/api/httpbody" "google.golang.org/genproto/googleapis/api/serviceconfig" @@ -46,9 +47,10 @@ type connList struct { } type state struct { - path *path - conns map[*grpc.ClientConn]connList - handlers map[string][]*handler + path *path + conns map[*grpc.ClientConn]connList + handlers map[string][]*handler + graphqlSchema *graphql.Schema } func (s *state) clone() *state { diff --git a/testpb/starwars.pb.go b/testpb/starwars.pb.go deleted file mode 100644 index 653fa93..0000000 --- a/testpb/starwars.pb.go +++ /dev/null @@ -1,553 +0,0 @@ -// Copyright 2021 Edward McFarlane. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.17.0 -// source: testpb/starwars.proto - -package testpb - -import ( - _ "github.com/emcfarlane/larking/api" - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type Faction struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - //[ (larking.api.relay).node = { - // method : "/larking.testpb.StarWars/GetFaction/" - // matches : "{name=factions/*}" - //} ]; - DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` -} - -func (x *Faction) Reset() { - *x = Faction{} - if protoimpl.UnsafeEnabled { - mi := &file_testpb_starwars_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Faction) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Faction) ProtoMessage() {} - -func (x *Faction) ProtoReflect() protoreflect.Message { - mi := &file_testpb_starwars_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Faction.ProtoReflect.Descriptor instead. -func (*Faction) Descriptor() ([]byte, []int) { - return file_testpb_starwars_proto_rawDescGZIP(), []int{0} -} - -func (x *Faction) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Faction) GetDisplayName() string { - if x != nil { - return x.DisplayName - } - return "" -} - -type GetFactionRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` -} - -func (x *GetFactionRequest) Reset() { - *x = GetFactionRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_testpb_starwars_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetFactionRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetFactionRequest) ProtoMessage() {} - -func (x *GetFactionRequest) ProtoReflect() protoreflect.Message { - mi := &file_testpb_starwars_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetFactionRequest.ProtoReflect.Descriptor instead. -func (*GetFactionRequest) Descriptor() ([]byte, []int) { - return file_testpb_starwars_proto_rawDescGZIP(), []int{1} -} - -func (x *GetFactionRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type Ship struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` -} - -func (x *Ship) Reset() { - *x = Ship{} - if protoimpl.UnsafeEnabled { - mi := &file_testpb_starwars_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Ship) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Ship) ProtoMessage() {} - -func (x *Ship) ProtoReflect() protoreflect.Message { - mi := &file_testpb_starwars_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Ship.ProtoReflect.Descriptor instead. -func (*Ship) Descriptor() ([]byte, []int) { - return file_testpb_starwars_proto_rawDescGZIP(), []int{2} -} - -func (x *Ship) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Ship) GetDisplayName() string { - if x != nil { - return x.DisplayName - } - return "" -} - -type GetShipRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` -} - -func (x *GetShipRequest) Reset() { - *x = GetShipRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_testpb_starwars_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetShipRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetShipRequest) ProtoMessage() {} - -func (x *GetShipRequest) ProtoReflect() protoreflect.Message { - mi := &file_testpb_starwars_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetShipRequest.ProtoReflect.Descriptor instead. -func (*GetShipRequest) Descriptor() ([]byte, []int) { - return file_testpb_starwars_proto_rawDescGZIP(), []int{3} -} - -func (x *GetShipRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type ListShipsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` - PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` -} - -func (x *ListShipsRequest) Reset() { - *x = ListShipsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_testpb_starwars_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListShipsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListShipsRequest) ProtoMessage() {} - -func (x *ListShipsRequest) ProtoReflect() protoreflect.Message { - mi := &file_testpb_starwars_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListShipsRequest.ProtoReflect.Descriptor instead. -func (*ListShipsRequest) Descriptor() ([]byte, []int) { - return file_testpb_starwars_proto_rawDescGZIP(), []int{4} -} - -func (x *ListShipsRequest) GetParent() string { - if x != nil { - return x.Parent - } - return "" -} - -func (x *ListShipsRequest) GetPageSize() int32 { - if x != nil { - return x.PageSize - } - return 0 -} - -func (x *ListShipsRequest) GetPageToken() string { - if x != nil { - return x.PageToken - } - return "" -} - -type ListShipsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Ships []*Ship `protobuf:"bytes,1,rep,name=ships,proto3" json:"ships,omitempty"` - NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` -} - -func (x *ListShipsResponse) Reset() { - *x = ListShipsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_testpb_starwars_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListShipsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListShipsResponse) ProtoMessage() {} - -func (x *ListShipsResponse) ProtoReflect() protoreflect.Message { - mi := &file_testpb_starwars_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListShipsResponse.ProtoReflect.Descriptor instead. -func (*ListShipsResponse) Descriptor() ([]byte, []int) { - return file_testpb_starwars_proto_rawDescGZIP(), []int{5} -} - -func (x *ListShipsResponse) GetShips() []*Ship { - if x != nil { - return x.Ships - } - return nil -} - -func (x *ListShipsResponse) GetNextPageToken() string { - if x != nil { - return x.NextPageToken - } - return "" -} - -var File_testpb_starwars_proto protoreflect.FileDescriptor - -var file_testpb_starwars_proto_rawDesc = []byte{ - 0x0a, 0x15, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2f, 0x73, 0x74, 0x61, 0x72, 0x77, 0x61, 0x72, - 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x68, - 0x71, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x40, 0x0a, 0x07, 0x46, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x70, 0x6c, - 0x61, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, - 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x27, 0x0a, 0x11, 0x47, 0x65, - 0x74, 0x46, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x22, 0x43, 0x0a, 0x04, 0x53, 0x68, 0x69, 0x70, 0x12, 0x18, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0x80, 0x97, 0x22, 0x01, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, - 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x24, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x53, - 0x68, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x66, - 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x69, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, - 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, - 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, - 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x67, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, - 0x69, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x73, - 0x68, 0x69, 0x70, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6c, 0x61, 0x72, - 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x53, 0x68, 0x69, 0x70, - 0x52, 0x05, 0x73, 0x68, 0x69, 0x70, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, - 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x32, - 0x83, 0x03, 0x0a, 0x08, 0x53, 0x74, 0x61, 0x72, 0x57, 0x61, 0x72, 0x73, 0x12, 0x95, 0x01, 0x0a, - 0x0a, 0x47, 0x65, 0x74, 0x46, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x2e, 0x6c, 0x61, - 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, - 0x46, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, - 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, - 0x46, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4b, 0xa2, 0xe1, 0xc0, 0x93, 0x02, 0x28, 0x0a, - 0x07, 0x66, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x0a, 0x0a, 0x02, 0x69, 0x64, 0x12, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x2a, 0x11, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x66, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x2a, 0x7d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x12, 0x15, 0x2f, - 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x66, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x77, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x69, 0x70, - 0x73, 0x12, 0x20, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, - 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x69, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x69, 0x70, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x12, 0x1d, - 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x66, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x73, 0x68, 0x69, 0x70, 0x73, 0x12, 0x66, 0x0a, - 0x07, 0x47, 0x65, 0x74, 0x53, 0x68, 0x69, 0x70, 0x12, 0x1e, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, - 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x68, 0x69, - 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, - 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x53, 0x68, 0x69, 0x70, 0x22, 0x25, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x12, 0x1d, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, - 0x65, 0x3d, 0x66, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x2a, 0x2f, 0x73, 0x68, 0x69, - 0x70, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0x2d, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6d, 0x63, 0x66, 0x61, 0x72, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x6c, - 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x3b, 0x74, 0x65, - 0x73, 0x74, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_testpb_starwars_proto_rawDescOnce sync.Once - file_testpb_starwars_proto_rawDescData = file_testpb_starwars_proto_rawDesc -) - -func file_testpb_starwars_proto_rawDescGZIP() []byte { - file_testpb_starwars_proto_rawDescOnce.Do(func() { - file_testpb_starwars_proto_rawDescData = protoimpl.X.CompressGZIP(file_testpb_starwars_proto_rawDescData) - }) - return file_testpb_starwars_proto_rawDescData -} - -var file_testpb_starwars_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_testpb_starwars_proto_goTypes = []interface{}{ - (*Faction)(nil), // 0: larking.testpb.Faction - (*GetFactionRequest)(nil), // 1: larking.testpb.GetFactionRequest - (*Ship)(nil), // 2: larking.testpb.Ship - (*GetShipRequest)(nil), // 3: larking.testpb.GetShipRequest - (*ListShipsRequest)(nil), // 4: larking.testpb.ListShipsRequest - (*ListShipsResponse)(nil), // 5: larking.testpb.ListShipsResponse -} -var file_testpb_starwars_proto_depIdxs = []int32{ - 2, // 0: larking.testpb.ListShipsResponse.ships:type_name -> larking.testpb.Ship - 1, // 1: larking.testpb.StarWars.GetFaction:input_type -> larking.testpb.GetFactionRequest - 4, // 2: larking.testpb.StarWars.ListShips:input_type -> larking.testpb.ListShipsRequest - 3, // 3: larking.testpb.StarWars.GetShip:input_type -> larking.testpb.GetShipRequest - 0, // 4: larking.testpb.StarWars.GetFaction:output_type -> larking.testpb.Faction - 5, // 5: larking.testpb.StarWars.ListShips:output_type -> larking.testpb.ListShipsResponse - 2, // 6: larking.testpb.StarWars.GetShip:output_type -> larking.testpb.Ship - 4, // [4:7] is the sub-list for method output_type - 1, // [1:4] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_testpb_starwars_proto_init() } -func file_testpb_starwars_proto_init() { - if File_testpb_starwars_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_testpb_starwars_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Faction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_testpb_starwars_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetFactionRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_testpb_starwars_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Ship); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_testpb_starwars_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetShipRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_testpb_starwars_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListShipsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_testpb_starwars_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListShipsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_testpb_starwars_proto_rawDesc, - NumEnums: 0, - NumMessages: 6, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_testpb_starwars_proto_goTypes, - DependencyIndexes: file_testpb_starwars_proto_depIdxs, - MessageInfos: file_testpb_starwars_proto_msgTypes, - }.Build() - File_testpb_starwars_proto = out.File - file_testpb_starwars_proto_rawDesc = nil - file_testpb_starwars_proto_goTypes = nil - file_testpb_starwars_proto_depIdxs = nil -} diff --git a/testpb/test.pb.go b/testpb/test.pb.go deleted file mode 100644 index a85204a..0000000 --- a/testpb/test.pb.go +++ /dev/null @@ -1,1357 +0,0 @@ -// Copyright 2021 Edward McFarlane. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.17.0 -// source: testpb/test.proto - -package testpb - -import ( - _ "google.golang.org/genproto/googleapis/api/annotations" - httpbody "google.golang.org/genproto/googleapis/api/httpbody" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - durationpb "google.golang.org/protobuf/types/known/durationpb" - emptypb "google.golang.org/protobuf/types/known/emptypb" - fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" - wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type Message struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MessageId string `protobuf:"bytes,1,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"` - Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"` // The resource content - UserId string `protobuf:"bytes,3,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` -} - -func (x *Message) Reset() { - *x = Message{} - if protoimpl.UnsafeEnabled { - mi := &file_testpb_test_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Message) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Message) ProtoMessage() {} - -func (x *Message) ProtoReflect() protoreflect.Message { - mi := &file_testpb_test_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Message.ProtoReflect.Descriptor instead. -func (*Message) Descriptor() ([]byte, []int) { - return file_testpb_test_proto_rawDescGZIP(), []int{0} -} - -func (x *Message) GetMessageId() string { - if x != nil { - return x.MessageId - } - return "" -} - -func (x *Message) GetText() string { - if x != nil { - return x.Text - } - return "" -} - -func (x *Message) GetUserId() string { - if x != nil { - return x.UserId - } - return "" -} - -type GetMessageRequestOne struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // Mapped to URL path -} - -func (x *GetMessageRequestOne) Reset() { - *x = GetMessageRequestOne{} - if protoimpl.UnsafeEnabled { - mi := &file_testpb_test_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetMessageRequestOne) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetMessageRequestOne) ProtoMessage() {} - -func (x *GetMessageRequestOne) ProtoReflect() protoreflect.Message { - mi := &file_testpb_test_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetMessageRequestOne.ProtoReflect.Descriptor instead. -func (*GetMessageRequestOne) Descriptor() ([]byte, []int) { - return file_testpb_test_proto_rawDescGZIP(), []int{1} -} - -func (x *GetMessageRequestOne) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type GetMessageRequestTwo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MessageId string `protobuf:"bytes,1,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"` // Mapped to URL path - Revision int64 `protobuf:"varint,2,opt,name=revision,proto3" json:"revision,omitempty"` // Mapped to URL query parameter `revision` - Sub *GetMessageRequestTwo_SubMessage `protobuf:"bytes,3,opt,name=sub,proto3" json:"sub,omitempty"` // Mapped to URL query parameter `sub.subfield` - UserId string `protobuf:"bytes,4,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // Additional binding -} - -func (x *GetMessageRequestTwo) Reset() { - *x = GetMessageRequestTwo{} - if protoimpl.UnsafeEnabled { - mi := &file_testpb_test_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetMessageRequestTwo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetMessageRequestTwo) ProtoMessage() {} - -func (x *GetMessageRequestTwo) ProtoReflect() protoreflect.Message { - mi := &file_testpb_test_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetMessageRequestTwo.ProtoReflect.Descriptor instead. -func (*GetMessageRequestTwo) Descriptor() ([]byte, []int) { - return file_testpb_test_proto_rawDescGZIP(), []int{2} -} - -func (x *GetMessageRequestTwo) GetMessageId() string { - if x != nil { - return x.MessageId - } - return "" -} - -func (x *GetMessageRequestTwo) GetRevision() int64 { - if x != nil { - return x.Revision - } - return 0 -} - -func (x *GetMessageRequestTwo) GetSub() *GetMessageRequestTwo_SubMessage { - if x != nil { - return x.Sub - } - return nil -} - -func (x *GetMessageRequestTwo) GetUserId() string { - if x != nil { - return x.UserId - } - return "" -} - -type UpdateMessageRequestOne struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MessageId string `protobuf:"bytes,1,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"` // Mapped to the URL - Message *Message `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` // Mapped to the body -} - -func (x *UpdateMessageRequestOne) Reset() { - *x = UpdateMessageRequestOne{} - if protoimpl.UnsafeEnabled { - mi := &file_testpb_test_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateMessageRequestOne) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateMessageRequestOne) ProtoMessage() {} - -func (x *UpdateMessageRequestOne) ProtoReflect() protoreflect.Message { - mi := &file_testpb_test_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateMessageRequestOne.ProtoReflect.Descriptor instead. -func (*UpdateMessageRequestOne) Descriptor() ([]byte, []int) { - return file_testpb_test_proto_rawDescGZIP(), []int{3} -} - -func (x *UpdateMessageRequestOne) GetMessageId() string { - if x != nil { - return x.MessageId - } - return "" -} - -func (x *UpdateMessageRequestOne) GetMessage() *Message { - if x != nil { - return x.Message - } - return nil -} - -type UploadFileRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"` - File *httpbody.HttpBody `protobuf:"bytes,2,opt,name=file,proto3" json:"file,omitempty"` -} - -func (x *UploadFileRequest) Reset() { - *x = UploadFileRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_testpb_test_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UploadFileRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UploadFileRequest) ProtoMessage() {} - -func (x *UploadFileRequest) ProtoReflect() protoreflect.Message { - mi := &file_testpb_test_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UploadFileRequest.ProtoReflect.Descriptor instead. -func (*UploadFileRequest) Descriptor() ([]byte, []int) { - return file_testpb_test_proto_rawDescGZIP(), []int{4} -} - -func (x *UploadFileRequest) GetFilename() string { - if x != nil { - return x.Filename - } - return "" -} - -func (x *UploadFileRequest) GetFile() *httpbody.HttpBody { - if x != nil { - return x.File - } - return nil -} - -type Scalars struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Timestamp *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Duration *durationpb.Duration `protobuf:"bytes,2,opt,name=duration,proto3" json:"duration,omitempty"` - BoolValue *wrapperspb.BoolValue `protobuf:"bytes,3,opt,name=bool_value,json=boolValue,proto3" json:"bool_value,omitempty"` - Int32Value *wrapperspb.Int32Value `protobuf:"bytes,4,opt,name=int32_value,json=int32Value,proto3" json:"int32_value,omitempty"` - Int64Value *wrapperspb.Int64Value `protobuf:"bytes,5,opt,name=int64_value,json=int64Value,proto3" json:"int64_value,omitempty"` - Uint32Value *wrapperspb.UInt32Value `protobuf:"bytes,6,opt,name=uint32_value,json=uint32Value,proto3" json:"uint32_value,omitempty"` - Uint64Value *wrapperspb.UInt64Value `protobuf:"bytes,7,opt,name=uint64_value,json=uint64Value,proto3" json:"uint64_value,omitempty"` - FloatValue *wrapperspb.FloatValue `protobuf:"bytes,8,opt,name=float_value,json=floatValue,proto3" json:"float_value,omitempty"` - DoubleValue *wrapperspb.DoubleValue `protobuf:"bytes,9,opt,name=double_value,json=doubleValue,proto3" json:"double_value,omitempty"` - BytesValue *wrapperspb.BytesValue `protobuf:"bytes,10,opt,name=bytes_value,json=bytesValue,proto3" json:"bytes_value,omitempty"` - StringValue *wrapperspb.StringValue `protobuf:"bytes,11,opt,name=string_value,json=stringValue,proto3" json:"string_value,omitempty"` - FieldMask *fieldmaskpb.FieldMask `protobuf:"bytes,12,opt,name=field_mask,json=fieldMask,proto3" json:"field_mask,omitempty"` -} - -func (x *Scalars) Reset() { - *x = Scalars{} - if protoimpl.UnsafeEnabled { - mi := &file_testpb_test_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Scalars) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Scalars) ProtoMessage() {} - -func (x *Scalars) ProtoReflect() protoreflect.Message { - mi := &file_testpb_test_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Scalars.ProtoReflect.Descriptor instead. -func (*Scalars) Descriptor() ([]byte, []int) { - return file_testpb_test_proto_rawDescGZIP(), []int{5} -} - -func (x *Scalars) GetTimestamp() *timestamppb.Timestamp { - if x != nil { - return x.Timestamp - } - return nil -} - -func (x *Scalars) GetDuration() *durationpb.Duration { - if x != nil { - return x.Duration - } - return nil -} - -func (x *Scalars) GetBoolValue() *wrapperspb.BoolValue { - if x != nil { - return x.BoolValue - } - return nil -} - -func (x *Scalars) GetInt32Value() *wrapperspb.Int32Value { - if x != nil { - return x.Int32Value - } - return nil -} - -func (x *Scalars) GetInt64Value() *wrapperspb.Int64Value { - if x != nil { - return x.Int64Value - } - return nil -} - -func (x *Scalars) GetUint32Value() *wrapperspb.UInt32Value { - if x != nil { - return x.Uint32Value - } - return nil -} - -func (x *Scalars) GetUint64Value() *wrapperspb.UInt64Value { - if x != nil { - return x.Uint64Value - } - return nil -} - -func (x *Scalars) GetFloatValue() *wrapperspb.FloatValue { - if x != nil { - return x.FloatValue - } - return nil -} - -func (x *Scalars) GetDoubleValue() *wrapperspb.DoubleValue { - if x != nil { - return x.DoubleValue - } - return nil -} - -func (x *Scalars) GetBytesValue() *wrapperspb.BytesValue { - if x != nil { - return x.BytesValue - } - return nil -} - -func (x *Scalars) GetStringValue() *wrapperspb.StringValue { - if x != nil { - return x.StringValue - } - return nil -} - -func (x *Scalars) GetFieldMask() *fieldmaskpb.FieldMask { - if x != nil { - return x.FieldMask - } - return nil -} - -type Shelf struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Resource name of the shelf. It must have the format of "shelves/*". - // For example: "shelves/shelf1". - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` -} - -func (x *Shelf) Reset() { - *x = Shelf{} - if protoimpl.UnsafeEnabled { - mi := &file_testpb_test_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Shelf) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Shelf) ProtoMessage() {} - -func (x *Shelf) ProtoReflect() protoreflect.Message { - mi := &file_testpb_test_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Shelf.ProtoReflect.Descriptor instead. -func (*Shelf) Descriptor() ([]byte, []int) { - return file_testpb_test_proto_rawDescGZIP(), []int{6} -} - -func (x *Shelf) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type GetShelfRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Resource name of a shelf. For example: "shelves/shelf1". - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` -} - -func (x *GetShelfRequest) Reset() { - *x = GetShelfRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_testpb_test_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetShelfRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetShelfRequest) ProtoMessage() {} - -func (x *GetShelfRequest) ProtoReflect() protoreflect.Message { - mi := &file_testpb_test_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetShelfRequest.ProtoReflect.Descriptor instead. -func (*GetShelfRequest) Descriptor() ([]byte, []int) { - return file_testpb_test_proto_rawDescGZIP(), []int{7} -} - -func (x *GetShelfRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type Book struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Resource name of the book. It must have the format of "shelves/*/books/*". - // For example: "shelves/shelf1/books/book2". - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // ... other properties - Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` -} - -func (x *Book) Reset() { - *x = Book{} - if protoimpl.UnsafeEnabled { - mi := &file_testpb_test_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Book) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Book) ProtoMessage() {} - -func (x *Book) ProtoReflect() protoreflect.Message { - mi := &file_testpb_test_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Book.ProtoReflect.Descriptor instead. -func (*Book) Descriptor() ([]byte, []int) { - return file_testpb_test_proto_rawDescGZIP(), []int{8} -} - -func (x *Book) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Book) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -type GetBookRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Resource name of a book. For example: "shelves/shelf1/books/book2". - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` -} - -func (x *GetBookRequest) Reset() { - *x = GetBookRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_testpb_test_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetBookRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetBookRequest) ProtoMessage() {} - -func (x *GetBookRequest) ProtoReflect() protoreflect.Message { - mi := &file_testpb_test_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetBookRequest.ProtoReflect.Descriptor instead. -func (*GetBookRequest) Descriptor() ([]byte, []int) { - return file_testpb_test_proto_rawDescGZIP(), []int{9} -} - -func (x *GetBookRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type CreateBookRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Resource name of the parent resource where to create the book. - // For example: "shelves/shelf1". - Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` - // The Book resource to be created. Client must not set the `Book.name` field. - Book *Book `protobuf:"bytes,2,opt,name=book,proto3" json:"book,omitempty"` -} - -func (x *CreateBookRequest) Reset() { - *x = CreateBookRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_testpb_test_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CreateBookRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateBookRequest) ProtoMessage() {} - -func (x *CreateBookRequest) ProtoReflect() protoreflect.Message { - mi := &file_testpb_test_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateBookRequest.ProtoReflect.Descriptor instead. -func (*CreateBookRequest) Descriptor() ([]byte, []int) { - return file_testpb_test_proto_rawDescGZIP(), []int{10} -} - -func (x *CreateBookRequest) GetParent() string { - if x != nil { - return x.Parent - } - return "" -} - -func (x *CreateBookRequest) GetBook() *Book { - if x != nil { - return x.Book - } - return nil -} - -type UpdateBookRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The book resource which replaces the resource on the server. - Book *Book `protobuf:"bytes,1,opt,name=book,proto3" json:"book,omitempty"` - // The update mask applies to the resource. For the `FieldMask` definition, - // see - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` -} - -func (x *UpdateBookRequest) Reset() { - *x = UpdateBookRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_testpb_test_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateBookRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateBookRequest) ProtoMessage() {} - -func (x *UpdateBookRequest) ProtoReflect() protoreflect.Message { - mi := &file_testpb_test_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateBookRequest.ProtoReflect.Descriptor instead. -func (*UpdateBookRequest) Descriptor() ([]byte, []int) { - return file_testpb_test_proto_rawDescGZIP(), []int{11} -} - -func (x *UpdateBookRequest) GetBook() *Book { - if x != nil { - return x.Book - } - return nil -} - -func (x *UpdateBookRequest) GetUpdateMask() *fieldmaskpb.FieldMask { - if x != nil { - return x.UpdateMask - } - return nil -} - -type GetMessageRequestTwo_SubMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Subfield string `protobuf:"bytes,1,opt,name=subfield,proto3" json:"subfield,omitempty"` -} - -func (x *GetMessageRequestTwo_SubMessage) Reset() { - *x = GetMessageRequestTwo_SubMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_testpb_test_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetMessageRequestTwo_SubMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetMessageRequestTwo_SubMessage) ProtoMessage() {} - -func (x *GetMessageRequestTwo_SubMessage) ProtoReflect() protoreflect.Message { - mi := &file_testpb_test_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetMessageRequestTwo_SubMessage.ProtoReflect.Descriptor instead. -func (*GetMessageRequestTwo_SubMessage) Descriptor() ([]byte, []int) { - return file_testpb_test_proto_rawDescGZIP(), []int{2, 0} -} - -func (x *GetMessageRequestTwo_SubMessage) GetSubfield() string { - if x != nil { - return x.Subfield - } - return "" -} - -var File_testpb_test_proto protoreflect.FileDescriptor - -var file_testpb_test_proto_rawDesc = []byte{ - 0x0a, 0x11, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, - 0x74, 0x70, 0x62, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x68, 0x74, - 0x74, 0x70, 0x62, 0x6f, 0x64, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, - 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, - 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, - 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x55, 0x0a, 0x07, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, - 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, - 0x72, 0x49, 0x64, 0x22, 0x2a, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4f, 0x6e, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, - 0xd7, 0x01, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x77, 0x6f, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x03, 0x73, 0x75, 0x62, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x2f, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, - 0x62, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x54, 0x77, 0x6f, 0x2e, 0x53, 0x75, 0x62, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x52, 0x03, 0x73, 0x75, 0x62, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, - 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x1a, - 0x28, 0x0a, 0x0a, 0x53, 0x75, 0x62, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, - 0x08, 0x73, 0x75, 0x62, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x73, 0x75, 0x62, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x6b, 0x0a, 0x17, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x4f, 0x6e, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x49, 0x64, 0x12, 0x31, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x07, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x59, 0x0a, 0x11, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, - 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x66, - 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, - 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x66, 0x69, 0x6c, - 0x65, 0x22, 0xec, 0x05, 0x0a, 0x07, 0x53, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x73, 0x12, 0x38, 0x0a, - 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x35, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x39, - 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x09, - 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3c, 0x0a, 0x0b, 0x69, 0x6e, 0x74, - 0x33, 0x32, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x69, 0x6e, 0x74, - 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3c, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x36, 0x34, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, - 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x36, 0x34, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3f, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, - 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x33, - 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3f, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, - 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0b, 0x75, 0x69, 0x6e, 0x74, - 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3c, 0x0a, 0x0b, 0x66, 0x6c, 0x6f, 0x61, 0x74, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, - 0x6c, 0x6f, 0x61, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x66, 0x6c, 0x6f, 0x61, 0x74, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3f, 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x6f, - 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, - 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3c, 0x0a, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x79, - 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x62, 0x79, 0x74, 0x65, 0x73, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x3f, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x39, 0x0a, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, - 0x61, 0x73, 0x6b, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, - 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, - 0x22, 0x1b, 0x0a, 0x05, 0x53, 0x68, 0x65, 0x6c, 0x66, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x25, 0x0a, - 0x0f, 0x47, 0x65, 0x74, 0x53, 0x68, 0x65, 0x6c, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x30, 0x0a, 0x04, 0x42, 0x6f, 0x6f, 0x6b, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x22, 0x24, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, - 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x55, 0x0a, 0x11, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x62, 0x6f, 0x6f, - 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, - 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x04, 0x62, - 0x6f, 0x6f, 0x6b, 0x22, 0x7a, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, - 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x04, 0x62, 0x6f, - 0x6f, 0x6b, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, - 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, - 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x32, - 0x8c, 0x0c, 0x0a, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x12, 0x72, 0x0a, - 0x0d, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x6e, 0x65, 0x12, 0x24, - 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, - 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x4f, 0x6e, 0x65, 0x1a, 0x17, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x22, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x73, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x6e, 0x61, 0x6d, 0x65, 0x2f, 0x2a, - 0x7d, 0x12, 0xbe, 0x01, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x54, 0x77, 0x6f, 0x12, 0x24, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x77, 0x6f, 0x1a, 0x17, 0x2e, 0x6c, 0x61, 0x72, 0x6b, - 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x22, 0x6e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x68, 0x12, 0x19, 0x2f, 0x76, 0x31, 0x2f, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2f, 0x7b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x5a, 0x1e, 0x12, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, - 0x72, 0x73, 0x2f, 0x7b, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x73, 0x5a, 0x2b, 0x12, 0x29, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, - 0x72, 0x73, 0x2f, 0x7b, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x73, 0x2f, 0x7b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, - 0x64, 0x7d, 0x12, 0x7d, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x12, 0x27, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, - 0x73, 0x74, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4f, 0x6e, 0x65, 0x1a, 0x17, 0x2e, 0x6c, - 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x2a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x32, 0x19, 0x2f, - 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2f, 0x7b, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x3a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x12, 0x70, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x17, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, - 0x17, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, - 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x29, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, - 0x32, 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2f, 0x7b, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x62, 0x6f, 0x64, 0x79, - 0x3a, 0x01, 0x2a, 0x12, 0x5e, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x2e, - 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x23, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x22, 0x18, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x74, 0x65, 0x78, - 0x74, 0x3d, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, - 0x3a, 0x01, 0x2a, 0x12, 0x5f, 0x0a, 0x0d, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x67, - 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x17, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x16, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x22, 0x12, 0x2f, - 0x76, 0x31, 0x2f, 0x7b, 0x74, 0x65, 0x78, 0x74, 0x3d, 0x2a, 0x7d, 0x3a, 0x63, 0x6c, 0x65, 0x61, - 0x72, 0x3a, 0x01, 0x2a, 0x12, 0x61, 0x0a, 0x0e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, - 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x17, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, - 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x22, - 0x13, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x74, 0x65, 0x78, 0x74, 0x3d, 0x2a, 0x2a, 0x7d, 0x3a, 0x77, - 0x61, 0x74, 0x63, 0x68, 0x3a, 0x01, 0x2a, 0x12, 0x57, 0x0a, 0x08, 0x42, 0x61, 0x74, 0x63, 0x68, - 0x47, 0x65, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x12, 0x13, 0x2f, 0x76, 0x33, - 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x3a, 0x62, 0x61, 0x74, 0x63, 0x68, 0x47, 0x65, 0x74, - 0x12, 0x53, 0x0a, 0x0b, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x4f, 0x6e, 0x65, 0x12, - 0x17, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, - 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x22, 0x13, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x12, 0x0b, 0x2f, 0x7b, 0x74, 0x65, 0x78, 0x74, - 0x7d, 0x2f, 0x6f, 0x6e, 0x65, 0x12, 0x53, 0x0a, 0x0b, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, - 0x65, 0x54, 0x77, 0x6f, 0x12, 0x17, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x16, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x13, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x12, 0x0b, 0x2f, - 0x7b, 0x74, 0x65, 0x78, 0x74, 0x7d, 0x2f, 0x74, 0x77, 0x6f, 0x12, 0x60, 0x0a, 0x08, 0x47, 0x65, - 0x74, 0x53, 0x68, 0x65, 0x6c, 0x66, 0x12, 0x1f, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x68, 0x65, 0x6c, 0x66, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, - 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x53, 0x68, 0x65, 0x6c, 0x66, 0x22, 0x1c, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x12, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, - 0x65, 0x3d, 0x73, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x65, 0x0a, 0x07, - 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x12, 0x1e, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, - 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6f, 0x6b, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, - 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x22, 0x24, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x12, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, - 0x3d, 0x73, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x2f, 0x2a, 0x2f, 0x62, 0x6f, 0x6f, 0x6b, 0x73, - 0x2f, 0x2a, 0x7d, 0x12, 0x71, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, - 0x6b, 0x12, 0x21, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, - 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x22, 0x2a, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x24, 0x22, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, - 0x73, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x62, 0x6f, 0x6f, 0x6b, 0x73, - 0x3a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x12, 0x76, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x42, 0x6f, 0x6f, 0x6b, 0x12, 0x21, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, - 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, - 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x22, 0x2f, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x32, 0x21, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x62, 0x6f, 0x6f, 0x6b, - 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x73, 0x68, 0x65, 0x6c, 0x76, 0x65, 0x73, 0x2f, 0x2a, 0x2f, - 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x32, 0xee, - 0x01, 0x0a, 0x05, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x6a, 0x0a, 0x0e, 0x55, 0x70, 0x6c, 0x6f, - 0x61, 0x64, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x21, 0x2e, 0x6c, 0x61, 0x72, - 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x6c, 0x6f, - 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x42, - 0x6f, 0x64, 0x79, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x22, 0x11, 0x2f, 0x66, 0x69, - 0x6c, 0x65, 0x73, 0x2f, 0x7b, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x3a, 0x04, - 0x66, 0x69, 0x6c, 0x65, 0x12, 0x79, 0x0a, 0x13, 0x4c, 0x61, 0x72, 0x67, 0x65, 0x55, 0x70, 0x6c, - 0x6f, 0x61, 0x64, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x21, 0x2e, 0x6c, 0x61, - 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x6c, - 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x48, 0x74, 0x74, 0x70, - 0x42, 0x6f, 0x64, 0x79, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x22, 0x17, 0x2f, 0x66, - 0x69, 0x6c, 0x65, 0x73, 0x2f, 0x6c, 0x61, 0x72, 0x67, 0x65, 0x2f, 0x7b, 0x66, 0x69, 0x6c, 0x65, - 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x3a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x28, 0x01, 0x30, 0x01, 0x32, - 0x5c, 0x0a, 0x09, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x12, 0x4f, 0x0a, 0x05, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x17, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, - 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x53, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x73, 0x1a, 0x16, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, 0x0d, - 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x65, 0x6c, 0x6c, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x42, 0x2d, 0x5a, - 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6d, 0x63, 0x66, - 0x61, 0x72, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x74, - 0x65, 0x73, 0x74, 0x70, 0x62, 0x3b, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_testpb_test_proto_rawDescOnce sync.Once - file_testpb_test_proto_rawDescData = file_testpb_test_proto_rawDesc -) - -func file_testpb_test_proto_rawDescGZIP() []byte { - file_testpb_test_proto_rawDescOnce.Do(func() { - file_testpb_test_proto_rawDescData = protoimpl.X.CompressGZIP(file_testpb_test_proto_rawDescData) - }) - return file_testpb_test_proto_rawDescData -} - -var file_testpb_test_proto_msgTypes = make([]protoimpl.MessageInfo, 13) -var file_testpb_test_proto_goTypes = []interface{}{ - (*Message)(nil), // 0: larking.testpb.Message - (*GetMessageRequestOne)(nil), // 1: larking.testpb.GetMessageRequestOne - (*GetMessageRequestTwo)(nil), // 2: larking.testpb.GetMessageRequestTwo - (*UpdateMessageRequestOne)(nil), // 3: larking.testpb.UpdateMessageRequestOne - (*UploadFileRequest)(nil), // 4: larking.testpb.UploadFileRequest - (*Scalars)(nil), // 5: larking.testpb.Scalars - (*Shelf)(nil), // 6: larking.testpb.Shelf - (*GetShelfRequest)(nil), // 7: larking.testpb.GetShelfRequest - (*Book)(nil), // 8: larking.testpb.Book - (*GetBookRequest)(nil), // 9: larking.testpb.GetBookRequest - (*CreateBookRequest)(nil), // 10: larking.testpb.CreateBookRequest - (*UpdateBookRequest)(nil), // 11: larking.testpb.UpdateBookRequest - (*GetMessageRequestTwo_SubMessage)(nil), // 12: larking.testpb.GetMessageRequestTwo.SubMessage - (*httpbody.HttpBody)(nil), // 13: google.api.HttpBody - (*timestamppb.Timestamp)(nil), // 14: google.protobuf.Timestamp - (*durationpb.Duration)(nil), // 15: google.protobuf.Duration - (*wrapperspb.BoolValue)(nil), // 16: google.protobuf.BoolValue - (*wrapperspb.Int32Value)(nil), // 17: google.protobuf.Int32Value - (*wrapperspb.Int64Value)(nil), // 18: google.protobuf.Int64Value - (*wrapperspb.UInt32Value)(nil), // 19: google.protobuf.UInt32Value - (*wrapperspb.UInt64Value)(nil), // 20: google.protobuf.UInt64Value - (*wrapperspb.FloatValue)(nil), // 21: google.protobuf.FloatValue - (*wrapperspb.DoubleValue)(nil), // 22: google.protobuf.DoubleValue - (*wrapperspb.BytesValue)(nil), // 23: google.protobuf.BytesValue - (*wrapperspb.StringValue)(nil), // 24: google.protobuf.StringValue - (*fieldmaskpb.FieldMask)(nil), // 25: google.protobuf.FieldMask - (*emptypb.Empty)(nil), // 26: google.protobuf.Empty -} -var file_testpb_test_proto_depIdxs = []int32{ - 12, // 0: larking.testpb.GetMessageRequestTwo.sub:type_name -> larking.testpb.GetMessageRequestTwo.SubMessage - 0, // 1: larking.testpb.UpdateMessageRequestOne.message:type_name -> larking.testpb.Message - 13, // 2: larking.testpb.UploadFileRequest.file:type_name -> google.api.HttpBody - 14, // 3: larking.testpb.Scalars.timestamp:type_name -> google.protobuf.Timestamp - 15, // 4: larking.testpb.Scalars.duration:type_name -> google.protobuf.Duration - 16, // 5: larking.testpb.Scalars.bool_value:type_name -> google.protobuf.BoolValue - 17, // 6: larking.testpb.Scalars.int32_value:type_name -> google.protobuf.Int32Value - 18, // 7: larking.testpb.Scalars.int64_value:type_name -> google.protobuf.Int64Value - 19, // 8: larking.testpb.Scalars.uint32_value:type_name -> google.protobuf.UInt32Value - 20, // 9: larking.testpb.Scalars.uint64_value:type_name -> google.protobuf.UInt64Value - 21, // 10: larking.testpb.Scalars.float_value:type_name -> google.protobuf.FloatValue - 22, // 11: larking.testpb.Scalars.double_value:type_name -> google.protobuf.DoubleValue - 23, // 12: larking.testpb.Scalars.bytes_value:type_name -> google.protobuf.BytesValue - 24, // 13: larking.testpb.Scalars.string_value:type_name -> google.protobuf.StringValue - 25, // 14: larking.testpb.Scalars.field_mask:type_name -> google.protobuf.FieldMask - 8, // 15: larking.testpb.CreateBookRequest.book:type_name -> larking.testpb.Book - 8, // 16: larking.testpb.UpdateBookRequest.book:type_name -> larking.testpb.Book - 25, // 17: larking.testpb.UpdateBookRequest.update_mask:type_name -> google.protobuf.FieldMask - 1, // 18: larking.testpb.Messaging.GetMessageOne:input_type -> larking.testpb.GetMessageRequestOne - 2, // 19: larking.testpb.Messaging.GetMessageTwo:input_type -> larking.testpb.GetMessageRequestTwo - 3, // 20: larking.testpb.Messaging.UpdateMessage:input_type -> larking.testpb.UpdateMessageRequestOne - 0, // 21: larking.testpb.Messaging.UpdateMessageBody:input_type -> larking.testpb.Message - 0, // 22: larking.testpb.Messaging.Action:input_type -> larking.testpb.Message - 0, // 23: larking.testpb.Messaging.ActionSegment:input_type -> larking.testpb.Message - 0, // 24: larking.testpb.Messaging.ActionSegments:input_type -> larking.testpb.Message - 26, // 25: larking.testpb.Messaging.BatchGet:input_type -> google.protobuf.Empty - 0, // 26: larking.testpb.Messaging.VariableOne:input_type -> larking.testpb.Message - 0, // 27: larking.testpb.Messaging.VariableTwo:input_type -> larking.testpb.Message - 7, // 28: larking.testpb.Messaging.GetShelf:input_type -> larking.testpb.GetShelfRequest - 9, // 29: larking.testpb.Messaging.GetBook:input_type -> larking.testpb.GetBookRequest - 10, // 30: larking.testpb.Messaging.CreateBook:input_type -> larking.testpb.CreateBookRequest - 11, // 31: larking.testpb.Messaging.UpdateBook:input_type -> larking.testpb.UpdateBookRequest - 4, // 32: larking.testpb.Files.UploadDownload:input_type -> larking.testpb.UploadFileRequest - 4, // 33: larking.testpb.Files.LargeUploadDownload:input_type -> larking.testpb.UploadFileRequest - 5, // 34: larking.testpb.WellKnown.Check:input_type -> larking.testpb.Scalars - 0, // 35: larking.testpb.Messaging.GetMessageOne:output_type -> larking.testpb.Message - 0, // 36: larking.testpb.Messaging.GetMessageTwo:output_type -> larking.testpb.Message - 0, // 37: larking.testpb.Messaging.UpdateMessage:output_type -> larking.testpb.Message - 0, // 38: larking.testpb.Messaging.UpdateMessageBody:output_type -> larking.testpb.Message - 26, // 39: larking.testpb.Messaging.Action:output_type -> google.protobuf.Empty - 26, // 40: larking.testpb.Messaging.ActionSegment:output_type -> google.protobuf.Empty - 26, // 41: larking.testpb.Messaging.ActionSegments:output_type -> google.protobuf.Empty - 26, // 42: larking.testpb.Messaging.BatchGet:output_type -> google.protobuf.Empty - 26, // 43: larking.testpb.Messaging.VariableOne:output_type -> google.protobuf.Empty - 26, // 44: larking.testpb.Messaging.VariableTwo:output_type -> google.protobuf.Empty - 6, // 45: larking.testpb.Messaging.GetShelf:output_type -> larking.testpb.Shelf - 8, // 46: larking.testpb.Messaging.GetBook:output_type -> larking.testpb.Book - 8, // 47: larking.testpb.Messaging.CreateBook:output_type -> larking.testpb.Book - 8, // 48: larking.testpb.Messaging.UpdateBook:output_type -> larking.testpb.Book - 13, // 49: larking.testpb.Files.UploadDownload:output_type -> google.api.HttpBody - 13, // 50: larking.testpb.Files.LargeUploadDownload:output_type -> google.api.HttpBody - 26, // 51: larking.testpb.WellKnown.Check:output_type -> google.protobuf.Empty - 35, // [35:52] is the sub-list for method output_type - 18, // [18:35] is the sub-list for method input_type - 18, // [18:18] is the sub-list for extension type_name - 18, // [18:18] is the sub-list for extension extendee - 0, // [0:18] is the sub-list for field type_name -} - -func init() { file_testpb_test_proto_init() } -func file_testpb_test_proto_init() { - if File_testpb_test_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_testpb_test_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Message); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_testpb_test_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetMessageRequestOne); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_testpb_test_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetMessageRequestTwo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_testpb_test_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateMessageRequestOne); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_testpb_test_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UploadFileRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_testpb_test_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Scalars); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_testpb_test_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Shelf); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_testpb_test_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetShelfRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_testpb_test_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Book); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_testpb_test_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetBookRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_testpb_test_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateBookRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_testpb_test_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateBookRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_testpb_test_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetMessageRequestTwo_SubMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_testpb_test_proto_rawDesc, - NumEnums: 0, - NumMessages: 13, - NumExtensions: 0, - NumServices: 3, - }, - GoTypes: file_testpb_test_proto_goTypes, - DependencyIndexes: file_testpb_test_proto_depIdxs, - MessageInfos: file_testpb_test_proto_msgTypes, - }.Build() - File_testpb_test_proto = out.File - file_testpb_test_proto_rawDesc = nil - file_testpb_test_proto_goTypes = nil - file_testpb_test_proto_depIdxs = nil -} From 2a139bc5d58a3d8e018ff39816dcc6569b119a7e Mon Sep 17 00:00:00 2001 From: Edward McFarlane Date: Wed, 10 May 2023 16:35:37 +0100 Subject: [PATCH 4/4] Stub together GraphQL call --- api/graphql.proto | 40 ++- api/graphqlpb/graphql.pb.go | 579 ++++++++++++++++++------------- api/graphqlpb/graphql_grpc.pb.go | 93 ----- api/starwars.proto | 17 +- api/starwarspb/starwars.pb.go | 105 +++--- larking/graphql.go | 249 ++++++++++++- larking/graphql_test.go | 27 +- larking/mux.go | 16 +- 8 files changed, 688 insertions(+), 438 deletions(-) diff --git a/api/graphql.proto b/api/graphql.proto index bd1d8f1..1a17d2d 100644 --- a/api/graphql.proto +++ b/api/graphql.proto @@ -22,7 +22,7 @@ option go_package = "larking.io/api/graphqlpb;graphqlpb"; extend google.protobuf.MethodOptions { // Adds a method to the GraphQL query root. - GraphQLRule relay = 72222228; + Rule graphql = 72222228; } extend google.protobuf.FieldOptions { @@ -30,8 +30,8 @@ extend google.protobuf.FieldOptions { optional bool relay_id = 70000; } -// GraphQL bindings. -message GraphQLRule { +// Rule implements GraphQL bindings. +message Rule { oneof pattern { string query = 1; string mutation = 2; @@ -47,10 +47,17 @@ message GraphQLRule { // Additional GraphQL bindings for the selector. Nested bindings must // not contain an `additional_bindings` field themselves (that is, // the nesting may only be one level deep). - repeated GraphQLRule additional_bindings = 6; + repeated Rule additional_bindings = 6; } -extend google.protobuf.MessageOptions { MessageConnection connection = 70000; } +extend google.protobuf.MessageOptions { Edge edge = 70001; } + +message Edge { + string name = 1; + string method = 2; +} + +extend google.protobuf.MessageOptions { MessageConnection connection = 70002; } message Arg { string name = 1; @@ -101,10 +108,15 @@ message Response { repeated Error errors = 2; } +message SourceLocation { + int32 line = 1; + int32 column = 2; +} + message Error { string message = 1; - repeated string path = 2; - google.protobuf.Struct extensions = 3; + repeated SourceLocation locations = 2; + repeated string path = 3; } service GraphQL { @@ -117,10 +129,10 @@ service GraphQL { // TODO: Subscriptions } -message GetRelayNodeRequest { string id = 1; } - -// Relay service is a client required service for GraphQL options. -service Relay { - // GetRelayNode exposes ID! querying capabilities to the GraphQL service. - rpc GetRelayNode(GetRelayNodeRequest) returns (google.protobuf.Any); -} +// message GetRelayNodeRequest { string id = 1; } +// +//// Relay service is a client required service for GraphQL options. +// service Relay { +// // GetRelayNode exposes ID! querying capabilities to the GraphQL service. +// rpc GetRelayNode(GetRelayNodeRequest) returns (google.protobuf.Any); +// } diff --git a/api/graphqlpb/graphql.pb.go b/api/graphqlpb/graphql.pb.go index c5f31ca..a54a24f 100644 --- a/api/graphqlpb/graphql.pb.go +++ b/api/graphqlpb/graphql.pb.go @@ -28,18 +28,18 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// GraphQL bindings. -type GraphQLRule struct { +// Rule implements GraphQL bindings. +type Rule struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Types that are assignable to Pattern: // - // *GraphQLRule_Query - // *GraphQLRule_Mutation - // *GraphQLRule_Subscription - Pattern isGraphQLRule_Pattern `protobuf_oneof:"pattern"` + // *Rule_Query + // *Rule_Mutation + // *Rule_Subscription + Pattern isRule_Pattern `protobuf_oneof:"pattern"` // Args is a mapping of fields. Args []*Arg `protobuf:"bytes,4,rep,name=args,proto3" json:"args,omitempty"` // Controls the Relay NodeID binding. @@ -47,11 +47,11 @@ type GraphQLRule struct { // Additional GraphQL bindings for the selector. Nested bindings must // not contain an `additional_bindings` field themselves (that is, // the nesting may only be one level deep). - AdditionalBindings []*GraphQLRule `protobuf:"bytes,6,rep,name=additional_bindings,json=additionalBindings,proto3" json:"additional_bindings,omitempty"` + AdditionalBindings []*Rule `protobuf:"bytes,6,rep,name=additional_bindings,json=additionalBindings,proto3" json:"additional_bindings,omitempty"` } -func (x *GraphQLRule) Reset() { - *x = GraphQLRule{} +func (x *Rule) Reset() { + *x = Rule{} if protoimpl.UnsafeEnabled { mi := &file_larking_api_graphql_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -59,13 +59,13 @@ func (x *GraphQLRule) Reset() { } } -func (x *GraphQLRule) String() string { +func (x *Rule) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GraphQLRule) ProtoMessage() {} +func (*Rule) ProtoMessage() {} -func (x *GraphQLRule) ProtoReflect() protoreflect.Message { +func (x *Rule) ProtoReflect() protoreflect.Message { mi := &file_larking_api_graphql_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -77,81 +77,136 @@ func (x *GraphQLRule) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GraphQLRule.ProtoReflect.Descriptor instead. -func (*GraphQLRule) Descriptor() ([]byte, []int) { +// Deprecated: Use Rule.ProtoReflect.Descriptor instead. +func (*Rule) Descriptor() ([]byte, []int) { return file_larking_api_graphql_proto_rawDescGZIP(), []int{0} } -func (m *GraphQLRule) GetPattern() isGraphQLRule_Pattern { +func (m *Rule) GetPattern() isRule_Pattern { if m != nil { return m.Pattern } return nil } -func (x *GraphQLRule) GetQuery() string { - if x, ok := x.GetPattern().(*GraphQLRule_Query); ok { +func (x *Rule) GetQuery() string { + if x, ok := x.GetPattern().(*Rule_Query); ok { return x.Query } return "" } -func (x *GraphQLRule) GetMutation() string { - if x, ok := x.GetPattern().(*GraphQLRule_Mutation); ok { +func (x *Rule) GetMutation() string { + if x, ok := x.GetPattern().(*Rule_Mutation); ok { return x.Mutation } return "" } -func (x *GraphQLRule) GetSubscription() string { - if x, ok := x.GetPattern().(*GraphQLRule_Subscription); ok { +func (x *Rule) GetSubscription() string { + if x, ok := x.GetPattern().(*Rule_Subscription); ok { return x.Subscription } return "" } -func (x *GraphQLRule) GetArgs() []*Arg { +func (x *Rule) GetArgs() []*Arg { if x != nil { return x.Args } return nil } -func (x *GraphQLRule) GetNodeId() string { +func (x *Rule) GetNodeId() string { if x != nil { return x.NodeId } return "" } -func (x *GraphQLRule) GetAdditionalBindings() []*GraphQLRule { +func (x *Rule) GetAdditionalBindings() []*Rule { if x != nil { return x.AdditionalBindings } return nil } -type isGraphQLRule_Pattern interface { - isGraphQLRule_Pattern() +type isRule_Pattern interface { + isRule_Pattern() } -type GraphQLRule_Query struct { +type Rule_Query struct { Query string `protobuf:"bytes,1,opt,name=query,proto3,oneof"` } -type GraphQLRule_Mutation struct { +type Rule_Mutation struct { Mutation string `protobuf:"bytes,2,opt,name=mutation,proto3,oneof"` } -type GraphQLRule_Subscription struct { +type Rule_Subscription struct { Subscription string `protobuf:"bytes,3,opt,name=subscription,proto3,oneof"` } -func (*GraphQLRule_Query) isGraphQLRule_Pattern() {} +func (*Rule_Query) isRule_Pattern() {} -func (*GraphQLRule_Mutation) isGraphQLRule_Pattern() {} +func (*Rule_Mutation) isRule_Pattern() {} -func (*GraphQLRule_Subscription) isGraphQLRule_Pattern() {} +func (*Rule_Subscription) isRule_Pattern() {} + +type Edge struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Method string `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"` +} + +func (x *Edge) Reset() { + *x = Edge{} + if protoimpl.UnsafeEnabled { + mi := &file_larking_api_graphql_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Edge) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Edge) ProtoMessage() {} + +func (x *Edge) ProtoReflect() protoreflect.Message { + mi := &file_larking_api_graphql_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Edge.ProtoReflect.Descriptor instead. +func (*Edge) Descriptor() ([]byte, []int) { + return file_larking_api_graphql_proto_rawDescGZIP(), []int{1} +} + +func (x *Edge) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Edge) GetMethod() string { + if x != nil { + return x.Method + } + return "" +} type Arg struct { state protoimpl.MessageState @@ -165,7 +220,7 @@ type Arg struct { func (x *Arg) Reset() { *x = Arg{} if protoimpl.UnsafeEnabled { - mi := &file_larking_api_graphql_proto_msgTypes[1] + mi := &file_larking_api_graphql_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -178,7 +233,7 @@ func (x *Arg) String() string { func (*Arg) ProtoMessage() {} func (x *Arg) ProtoReflect() protoreflect.Message { - mi := &file_larking_api_graphql_proto_msgTypes[1] + mi := &file_larking_api_graphql_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -191,7 +246,7 @@ func (x *Arg) ProtoReflect() protoreflect.Message { // Deprecated: Use Arg.ProtoReflect.Descriptor instead. func (*Arg) Descriptor() ([]byte, []int) { - return file_larking_api_graphql_proto_rawDescGZIP(), []int{1} + return file_larking_api_graphql_proto_rawDescGZIP(), []int{2} } func (x *Arg) GetName() string { @@ -235,7 +290,7 @@ type MessageConnection struct { func (x *MessageConnection) Reset() { *x = MessageConnection{} if protoimpl.UnsafeEnabled { - mi := &file_larking_api_graphql_proto_msgTypes[2] + mi := &file_larking_api_graphql_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -248,7 +303,7 @@ func (x *MessageConnection) String() string { func (*MessageConnection) ProtoMessage() {} func (x *MessageConnection) ProtoReflect() protoreflect.Message { - mi := &file_larking_api_graphql_proto_msgTypes[2] + mi := &file_larking_api_graphql_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -261,7 +316,7 @@ func (x *MessageConnection) ProtoReflect() protoreflect.Message { // Deprecated: Use MessageConnection.ProtoReflect.Descriptor instead. func (*MessageConnection) Descriptor() ([]byte, []int) { - return file_larking_api_graphql_proto_rawDescGZIP(), []int{2} + return file_larking_api_graphql_proto_rawDescGZIP(), []int{3} } func (x *MessageConnection) GetName() string { @@ -300,7 +355,7 @@ type PageInfo struct { func (x *PageInfo) Reset() { *x = PageInfo{} if protoimpl.UnsafeEnabled { - mi := &file_larking_api_graphql_proto_msgTypes[3] + mi := &file_larking_api_graphql_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -313,7 +368,7 @@ func (x *PageInfo) String() string { func (*PageInfo) ProtoMessage() {} func (x *PageInfo) ProtoReflect() protoreflect.Message { - mi := &file_larking_api_graphql_proto_msgTypes[3] + mi := &file_larking_api_graphql_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -326,7 +381,7 @@ func (x *PageInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use PageInfo.ProtoReflect.Descriptor instead. func (*PageInfo) Descriptor() ([]byte, []int) { - return file_larking_api_graphql_proto_rawDescGZIP(), []int{3} + return file_larking_api_graphql_proto_rawDescGZIP(), []int{4} } func (x *PageInfo) GetHasNextPage() bool { @@ -369,7 +424,7 @@ type Connection struct { func (x *Connection) Reset() { *x = Connection{} if protoimpl.UnsafeEnabled { - mi := &file_larking_api_graphql_proto_msgTypes[4] + mi := &file_larking_api_graphql_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -382,7 +437,7 @@ func (x *Connection) String() string { func (*Connection) ProtoMessage() {} func (x *Connection) ProtoReflect() protoreflect.Message { - mi := &file_larking_api_graphql_proto_msgTypes[4] + mi := &file_larking_api_graphql_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -395,7 +450,7 @@ func (x *Connection) ProtoReflect() protoreflect.Message { // Deprecated: Use Connection.ProtoReflect.Descriptor instead. func (*Connection) Descriptor() ([]byte, []int) { - return file_larking_api_graphql_proto_rawDescGZIP(), []int{4} + return file_larking_api_graphql_proto_rawDescGZIP(), []int{5} } func (x *Connection) GetEdges() []*anypb.Any { @@ -425,7 +480,7 @@ type Request struct { func (x *Request) Reset() { *x = Request{} if protoimpl.UnsafeEnabled { - mi := &file_larking_api_graphql_proto_msgTypes[5] + mi := &file_larking_api_graphql_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -438,7 +493,7 @@ func (x *Request) String() string { func (*Request) ProtoMessage() {} func (x *Request) ProtoReflect() protoreflect.Message { - mi := &file_larking_api_graphql_proto_msgTypes[5] + mi := &file_larking_api_graphql_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -451,7 +506,7 @@ func (x *Request) ProtoReflect() protoreflect.Message { // Deprecated: Use Request.ProtoReflect.Descriptor instead. func (*Request) Descriptor() ([]byte, []int) { - return file_larking_api_graphql_proto_rawDescGZIP(), []int{5} + return file_larking_api_graphql_proto_rawDescGZIP(), []int{6} } func (x *Request) GetQuery() string { @@ -487,7 +542,7 @@ type Response struct { func (x *Response) Reset() { *x = Response{} if protoimpl.UnsafeEnabled { - mi := &file_larking_api_graphql_proto_msgTypes[6] + mi := &file_larking_api_graphql_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -500,7 +555,7 @@ func (x *Response) String() string { func (*Response) ProtoMessage() {} func (x *Response) ProtoReflect() protoreflect.Message { - mi := &file_larking_api_graphql_proto_msgTypes[6] + mi := &file_larking_api_graphql_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -513,7 +568,7 @@ func (x *Response) ProtoReflect() protoreflect.Message { // Deprecated: Use Response.ProtoReflect.Descriptor instead. func (*Response) Descriptor() ([]byte, []int) { - return file_larking_api_graphql_proto_rawDescGZIP(), []int{6} + return file_larking_api_graphql_proto_rawDescGZIP(), []int{7} } func (x *Response) GetData() *structpb.Struct { @@ -530,33 +585,32 @@ func (x *Response) GetErrors() []*Error { return nil } -type Error struct { +type SourceLocation struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` - Path []string `protobuf:"bytes,2,rep,name=path,proto3" json:"path,omitempty"` - Extensions *structpb.Struct `protobuf:"bytes,3,opt,name=extensions,proto3" json:"extensions,omitempty"` + Line int32 `protobuf:"varint,1,opt,name=line,proto3" json:"line,omitempty"` + Column int32 `protobuf:"varint,2,opt,name=column,proto3" json:"column,omitempty"` } -func (x *Error) Reset() { - *x = Error{} +func (x *SourceLocation) Reset() { + *x = SourceLocation{} if protoimpl.UnsafeEnabled { - mi := &file_larking_api_graphql_proto_msgTypes[7] + mi := &file_larking_api_graphql_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *Error) String() string { +func (x *SourceLocation) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Error) ProtoMessage() {} +func (*SourceLocation) ProtoMessage() {} -func (x *Error) ProtoReflect() protoreflect.Message { - mi := &file_larking_api_graphql_proto_msgTypes[7] +func (x *SourceLocation) ProtoReflect() protoreflect.Message { + mi := &file_larking_api_graphql_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -567,57 +621,52 @@ func (x *Error) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Error.ProtoReflect.Descriptor instead. -func (*Error) Descriptor() ([]byte, []int) { - return file_larking_api_graphql_proto_rawDescGZIP(), []int{7} +// Deprecated: Use SourceLocation.ProtoReflect.Descriptor instead. +func (*SourceLocation) Descriptor() ([]byte, []int) { + return file_larking_api_graphql_proto_rawDescGZIP(), []int{8} } -func (x *Error) GetMessage() string { +func (x *SourceLocation) GetLine() int32 { if x != nil { - return x.Message + return x.Line } - return "" + return 0 } -func (x *Error) GetPath() []string { +func (x *SourceLocation) GetColumn() int32 { if x != nil { - return x.Path + return x.Column } - return nil + return 0 } -func (x *Error) GetExtensions() *structpb.Struct { - if x != nil { - return x.Extensions - } - return nil -} - -type GetRelayNodeRequest struct { +type Error struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` + Locations []*SourceLocation `protobuf:"bytes,2,rep,name=locations,proto3" json:"locations,omitempty"` + Path []string `protobuf:"bytes,3,rep,name=path,proto3" json:"path,omitempty"` } -func (x *GetRelayNodeRequest) Reset() { - *x = GetRelayNodeRequest{} +func (x *Error) Reset() { + *x = Error{} if protoimpl.UnsafeEnabled { - mi := &file_larking_api_graphql_proto_msgTypes[8] + mi := &file_larking_api_graphql_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *GetRelayNodeRequest) String() string { +func (x *Error) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetRelayNodeRequest) ProtoMessage() {} +func (*Error) ProtoMessage() {} -func (x *GetRelayNodeRequest) ProtoReflect() protoreflect.Message { - mi := &file_larking_api_graphql_proto_msgTypes[8] +func (x *Error) ProtoReflect() protoreflect.Message { + mi := &file_larking_api_graphql_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -628,25 +677,39 @@ func (x *GetRelayNodeRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetRelayNodeRequest.ProtoReflect.Descriptor instead. -func (*GetRelayNodeRequest) Descriptor() ([]byte, []int) { - return file_larking_api_graphql_proto_rawDescGZIP(), []int{8} +// Deprecated: Use Error.ProtoReflect.Descriptor instead. +func (*Error) Descriptor() ([]byte, []int) { + return file_larking_api_graphql_proto_rawDescGZIP(), []int{9} } -func (x *GetRelayNodeRequest) GetId() string { +func (x *Error) GetMessage() string { if x != nil { - return x.Id + return x.Message } return "" } +func (x *Error) GetLocations() []*SourceLocation { + if x != nil { + return x.Locations + } + return nil +} + +func (x *Error) GetPath() []string { + if x != nil { + return x.Path + } + return nil +} + var file_larking_api_graphql_proto_extTypes = []protoimpl.ExtensionInfo{ { ExtendedType: (*descriptorpb.MethodOptions)(nil), - ExtensionType: (*GraphQLRule)(nil), + ExtensionType: (*Rule)(nil), Field: 72222228, - Name: "larking.api.relay", - Tag: "bytes,72222228,opt,name=relay", + Name: "larking.api.graphql", + Tag: "bytes,72222228,opt,name=graphql", Filename: "larking/api/graphql.proto", }, { @@ -657,12 +720,20 @@ var file_larking_api_graphql_proto_extTypes = []protoimpl.ExtensionInfo{ Tag: "varint,70000,opt,name=relay_id", Filename: "larking/api/graphql.proto", }, + { + ExtendedType: (*descriptorpb.MessageOptions)(nil), + ExtensionType: (*Edge)(nil), + Field: 70001, + Name: "larking.api.edge", + Tag: "bytes,70001,opt,name=edge", + Filename: "larking/api/graphql.proto", + }, { ExtendedType: (*descriptorpb.MessageOptions)(nil), ExtensionType: (*MessageConnection)(nil), - Field: 70000, + Field: 70002, Name: "larking.api.connection", - Tag: "bytes,70000,opt,name=connection", + Tag: "bytes,70002,opt,name=connection", Filename: "larking/api/graphql.proto", }, } @@ -671,8 +742,8 @@ var file_larking_api_graphql_proto_extTypes = []protoimpl.ExtensionInfo{ var ( // Adds a method to the GraphQL query root. // - // optional larking.api.GraphQLRule relay = 72222228; - E_Relay = &file_larking_api_graphql_proto_extTypes[0] + // optional larking.api.Rule graphql = 72222228; + E_Graphql = &file_larking_api_graphql_proto_extTypes[0] ) // Extension fields to descriptorpb.FieldOptions. @@ -685,8 +756,10 @@ var ( // Extension fields to descriptorpb.MessageOptions. var ( - // optional larking.api.MessageConnection connection = 70000; - E_Connection = &file_larking_api_graphql_proto_extTypes[2] + // optional larking.api.Edge edge = 70001; + E_Edge = &file_larking_api_graphql_proto_extTypes[2] + // optional larking.api.MessageConnection connection = 70002; + E_Connection = &file_larking_api_graphql_proto_extTypes[3] ) var File_larking_api_graphql_proto protoreflect.FileDescriptor @@ -702,102 +775,105 @@ var file_larking_api_graphql_proto_rawDesc = []byte{ 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0xfe, 0x01, 0x0a, 0x0b, 0x47, 0x72, 0x61, 0x70, 0x68, 0x51, 0x4c, 0x52, 0x75, 0x6c, - 0x65, 0x12, 0x16, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x48, 0x00, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x08, 0x6d, 0x75, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x6d, - 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x24, 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x0c, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x24, 0x0a, - 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6c, 0x61, - 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x72, 0x67, 0x52, 0x04, 0x61, - 0x72, 0x67, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x49, 0x0a, 0x13, - 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x62, 0x69, 0x6e, 0x64, 0x69, - 0x6e, 0x67, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6c, 0x61, 0x72, 0x6b, - 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x72, 0x61, 0x70, 0x68, 0x51, 0x4c, 0x52, - 0x75, 0x6c, 0x65, 0x52, 0x12, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x42, - 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x22, 0x2f, 0x0a, 0x03, 0x41, 0x72, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, - 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x66, 0x69, - 0x65, 0x6c, 0x64, 0x22, 0x65, 0x0a, 0x11, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, - 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, - 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, - 0x74, 0x68, 0x6f, 0x64, 0x12, 0x24, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x41, 0x72, 0x67, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0x9c, 0x01, 0x0a, 0x08, 0x50, - 0x61, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x22, 0x0a, 0x0d, 0x68, 0x61, 0x73, 0x5f, 0x6e, - 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, - 0x68, 0x61, 0x73, 0x4e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x68, - 0x61, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x5f, 0x70, 0x61, 0x67, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x68, 0x61, 0x73, 0x50, 0x72, 0x65, 0x76, 0x69, - 0x6f, 0x75, 0x73, 0x50, 0x61, 0x67, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x5f, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x43, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x6e, - 0x64, 0x5f, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, - 0x65, 0x6e, 0x64, 0x43, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x22, 0x6c, 0x0a, 0x0a, 0x43, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x64, 0x67, 0x65, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x65, 0x64, - 0x67, 0x65, 0x73, 0x12, 0x32, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x70, - 0x61, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x7d, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x6f, 0x70, 0x65, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0d, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, - 0x35, 0x0a, 0x09, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x09, 0x76, 0x61, 0x72, - 0x69, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x22, 0x63, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, - 0x2a, 0x0a, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x12, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x45, 0x72, - 0x72, 0x6f, 0x72, 0x52, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x22, 0x6e, 0x0a, 0x05, 0x45, - 0x72, 0x72, 0x6f, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, - 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, - 0x74, 0x68, 0x12, 0x37, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, - 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x25, 0x0a, 0x13, 0x47, - 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, - 0x69, 0x64, 0x32, 0x5d, 0x0a, 0x07, 0x47, 0x72, 0x61, 0x70, 0x68, 0x51, 0x4c, 0x12, 0x52, 0x0a, - 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x14, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x6c, - 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x5a, 0x0a, 0x12, 0x08, 0x2f, - 0x67, 0x72, 0x61, 0x70, 0x68, 0x71, 0x6c, 0x22, 0x08, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x68, 0x71, - 0x6c, 0x32, 0x4f, 0x0a, 0x05, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x46, 0x0a, 0x0c, 0x47, 0x65, - 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x2e, 0x6c, 0x61, 0x72, - 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, - 0x79, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x67, + 0x6f, 0x22, 0xf0, 0x01, 0x0a, 0x04, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x05, 0x71, 0x75, + 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x71, 0x75, 0x65, + 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x08, 0x6d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x6d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x24, 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0c, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x24, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x04, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x41, 0x72, 0x67, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x12, 0x17, 0x0a, 0x07, + 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, + 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x42, 0x0a, 0x13, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x61, 0x6c, 0x5f, 0x62, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x06, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x12, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, + 0x6c, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x22, 0x32, 0x0a, 0x04, 0x45, 0x64, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x22, 0x2f, 0x0a, 0x03, 0x41, 0x72, 0x67, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x22, 0x65, 0x0a, 0x11, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x24, 0x0a, 0x04, 0x61, 0x72, + 0x67, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, + 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x72, 0x67, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, + 0x22, 0x9c, 0x01, 0x0a, 0x08, 0x50, 0x61, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x22, 0x0a, + 0x0d, 0x68, 0x61, 0x73, 0x5f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x68, 0x61, 0x73, 0x4e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, + 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x68, 0x61, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, + 0x73, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x68, 0x61, + 0x73, 0x50, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x50, 0x61, 0x67, 0x65, 0x12, 0x21, 0x0a, + 0x0c, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x43, 0x75, 0x72, 0x73, 0x6f, 0x72, + 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x6e, 0x64, 0x5f, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x65, 0x6e, 0x64, 0x43, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x22, + 0x6c, 0x0a, 0x0a, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, + 0x05, 0x65, 0x64, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, - 0x6e, 0x79, 0x3a, 0x51, 0x0a, 0x05, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x1e, 0x2e, 0x67, 0x6f, + 0x6e, 0x79, 0x52, 0x05, 0x65, 0x64, 0x67, 0x65, 0x73, 0x12, 0x32, 0x0a, 0x09, 0x70, 0x61, 0x67, + 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6c, + 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x7d, 0x0a, + 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x25, + 0x0a, 0x0e, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x09, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, + 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, + 0x74, 0x52, 0x09, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x22, 0x63, 0x0a, 0x08, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2a, 0x0a, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x73, 0x22, 0x3c, 0x0a, 0x0e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x22, + 0x70, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x12, 0x39, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x12, 0x0a, + 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, + 0x68, 0x32, 0x5d, 0x0a, 0x07, 0x47, 0x72, 0x61, 0x70, 0x68, 0x51, 0x4c, 0x12, 0x52, 0x0a, 0x05, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x14, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x6c, 0x61, + 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x5a, 0x0a, 0x12, 0x08, 0x2f, 0x67, + 0x72, 0x61, 0x70, 0x68, 0x71, 0x6c, 0x22, 0x08, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x68, 0x71, 0x6c, + 0x3a, 0x4e, 0x0a, 0x07, 0x67, 0x72, 0x61, 0x70, 0x68, 0x71, 0x6c, 0x12, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x94, 0x8c, 0xb8, 0x22, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x47, 0x72, 0x61, 0x70, 0x68, 0x51, 0x4c, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x05, - 0x72, 0x65, 0x6c, 0x61, 0x79, 0x3a, 0x3d, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x69, - 0x64, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x18, 0xf0, 0xa2, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x49, - 0x64, 0x88, 0x01, 0x01, 0x3a, 0x61, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x18, 0xf0, 0xa2, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6c, 0x61, - 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x63, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x24, 0x5a, 0x22, 0x6c, 0x61, 0x72, 0x6b, 0x69, - 0x6e, 0x67, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x68, 0x71, - 0x6c, 0x70, 0x62, 0x3b, 0x67, 0x72, 0x61, 0x70, 0x68, 0x71, 0x6c, 0x70, 0x62, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x07, 0x67, 0x72, 0x61, 0x70, 0x68, 0x71, 0x6c, + 0x3a, 0x3d, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x69, 0x64, 0x12, 0x1d, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, + 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xf0, 0xa2, 0x04, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x49, 0x64, 0x88, 0x01, 0x01, 0x3a, + 0x48, 0x0a, 0x04, 0x65, 0x64, 0x67, 0x65, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xf1, 0xa2, 0x04, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x11, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x45, + 0x64, 0x67, 0x65, 0x52, 0x04, 0x65, 0x64, 0x67, 0x65, 0x3a, 0x61, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xf2, 0xa2, 0x04, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1e, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x24, 0x5a, 0x22, + 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, + 0x72, 0x61, 0x70, 0x68, 0x71, 0x6c, 0x70, 0x62, 0x3b, 0x67, 0x72, 0x61, 0x70, 0x68, 0x71, 0x6c, + 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -812,46 +888,47 @@ func file_larking_api_graphql_proto_rawDescGZIP() []byte { return file_larking_api_graphql_proto_rawDescData } -var file_larking_api_graphql_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_larking_api_graphql_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_larking_api_graphql_proto_goTypes = []interface{}{ - (*GraphQLRule)(nil), // 0: larking.api.GraphQLRule - (*Arg)(nil), // 1: larking.api.Arg - (*MessageConnection)(nil), // 2: larking.api.MessageConnection - (*PageInfo)(nil), // 3: larking.api.PageInfo - (*Connection)(nil), // 4: larking.api.Connection - (*Request)(nil), // 5: larking.api.Request - (*Response)(nil), // 6: larking.api.Response - (*Error)(nil), // 7: larking.api.Error - (*GetRelayNodeRequest)(nil), // 8: larking.api.GetRelayNodeRequest - (*anypb.Any)(nil), // 9: google.protobuf.Any - (*structpb.Struct)(nil), // 10: google.protobuf.Struct - (*descriptorpb.MethodOptions)(nil), // 11: google.protobuf.MethodOptions - (*descriptorpb.FieldOptions)(nil), // 12: google.protobuf.FieldOptions - (*descriptorpb.MessageOptions)(nil), // 13: google.protobuf.MessageOptions + (*Rule)(nil), // 0: larking.api.Rule + (*Edge)(nil), // 1: larking.api.Edge + (*Arg)(nil), // 2: larking.api.Arg + (*MessageConnection)(nil), // 3: larking.api.MessageConnection + (*PageInfo)(nil), // 4: larking.api.PageInfo + (*Connection)(nil), // 5: larking.api.Connection + (*Request)(nil), // 6: larking.api.Request + (*Response)(nil), // 7: larking.api.Response + (*SourceLocation)(nil), // 8: larking.api.SourceLocation + (*Error)(nil), // 9: larking.api.Error + (*anypb.Any)(nil), // 10: google.protobuf.Any + (*structpb.Struct)(nil), // 11: google.protobuf.Struct + (*descriptorpb.MethodOptions)(nil), // 12: google.protobuf.MethodOptions + (*descriptorpb.FieldOptions)(nil), // 13: google.protobuf.FieldOptions + (*descriptorpb.MessageOptions)(nil), // 14: google.protobuf.MessageOptions } var file_larking_api_graphql_proto_depIdxs = []int32{ - 1, // 0: larking.api.GraphQLRule.args:type_name -> larking.api.Arg - 0, // 1: larking.api.GraphQLRule.additional_bindings:type_name -> larking.api.GraphQLRule - 1, // 2: larking.api.MessageConnection.args:type_name -> larking.api.Arg - 9, // 3: larking.api.Connection.edges:type_name -> google.protobuf.Any - 3, // 4: larking.api.Connection.page_info:type_name -> larking.api.PageInfo - 10, // 5: larking.api.Request.variables:type_name -> google.protobuf.Struct - 10, // 6: larking.api.Response.data:type_name -> google.protobuf.Struct - 7, // 7: larking.api.Response.errors:type_name -> larking.api.Error - 10, // 8: larking.api.Error.extensions:type_name -> google.protobuf.Struct - 11, // 9: larking.api.relay:extendee -> google.protobuf.MethodOptions - 12, // 10: larking.api.relay_id:extendee -> google.protobuf.FieldOptions - 13, // 11: larking.api.connection:extendee -> google.protobuf.MessageOptions - 0, // 12: larking.api.relay:type_name -> larking.api.GraphQLRule - 2, // 13: larking.api.connection:type_name -> larking.api.MessageConnection - 5, // 14: larking.api.GraphQL.Query:input_type -> larking.api.Request - 8, // 15: larking.api.Relay.GetRelayNode:input_type -> larking.api.GetRelayNodeRequest - 6, // 16: larking.api.GraphQL.Query:output_type -> larking.api.Response - 9, // 17: larking.api.Relay.GetRelayNode:output_type -> google.protobuf.Any - 16, // [16:18] is the sub-list for method output_type - 14, // [14:16] is the sub-list for method input_type - 12, // [12:14] is the sub-list for extension type_name - 9, // [9:12] is the sub-list for extension extendee + 2, // 0: larking.api.Rule.args:type_name -> larking.api.Arg + 0, // 1: larking.api.Rule.additional_bindings:type_name -> larking.api.Rule + 2, // 2: larking.api.MessageConnection.args:type_name -> larking.api.Arg + 10, // 3: larking.api.Connection.edges:type_name -> google.protobuf.Any + 4, // 4: larking.api.Connection.page_info:type_name -> larking.api.PageInfo + 11, // 5: larking.api.Request.variables:type_name -> google.protobuf.Struct + 11, // 6: larking.api.Response.data:type_name -> google.protobuf.Struct + 9, // 7: larking.api.Response.errors:type_name -> larking.api.Error + 8, // 8: larking.api.Error.locations:type_name -> larking.api.SourceLocation + 12, // 9: larking.api.graphql:extendee -> google.protobuf.MethodOptions + 13, // 10: larking.api.relay_id:extendee -> google.protobuf.FieldOptions + 14, // 11: larking.api.edge:extendee -> google.protobuf.MessageOptions + 14, // 12: larking.api.connection:extendee -> google.protobuf.MessageOptions + 0, // 13: larking.api.graphql:type_name -> larking.api.Rule + 1, // 14: larking.api.edge:type_name -> larking.api.Edge + 3, // 15: larking.api.connection:type_name -> larking.api.MessageConnection + 6, // 16: larking.api.GraphQL.Query:input_type -> larking.api.Request + 7, // 17: larking.api.GraphQL.Query:output_type -> larking.api.Response + 17, // [17:18] is the sub-list for method output_type + 16, // [16:17] is the sub-list for method input_type + 13, // [13:16] is the sub-list for extension type_name + 9, // [9:13] is the sub-list for extension extendee 0, // [0:9] is the sub-list for field type_name } @@ -862,7 +939,7 @@ func file_larking_api_graphql_proto_init() { } if !protoimpl.UnsafeEnabled { file_larking_api_graphql_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GraphQLRule); i { + switch v := v.(*Rule); i { case 0: return &v.state case 1: @@ -874,7 +951,7 @@ func file_larking_api_graphql_proto_init() { } } file_larking_api_graphql_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Arg); i { + switch v := v.(*Edge); i { case 0: return &v.state case 1: @@ -886,7 +963,7 @@ func file_larking_api_graphql_proto_init() { } } file_larking_api_graphql_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageConnection); i { + switch v := v.(*Arg); i { case 0: return &v.state case 1: @@ -898,7 +975,7 @@ func file_larking_api_graphql_proto_init() { } } file_larking_api_graphql_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PageInfo); i { + switch v := v.(*MessageConnection); i { case 0: return &v.state case 1: @@ -910,7 +987,7 @@ func file_larking_api_graphql_proto_init() { } } file_larking_api_graphql_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Connection); i { + switch v := v.(*PageInfo); i { case 0: return &v.state case 1: @@ -922,7 +999,7 @@ func file_larking_api_graphql_proto_init() { } } file_larking_api_graphql_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Request); i { + switch v := v.(*Connection); i { case 0: return &v.state case 1: @@ -934,7 +1011,7 @@ func file_larking_api_graphql_proto_init() { } } file_larking_api_graphql_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Response); i { + switch v := v.(*Request); i { case 0: return &v.state case 1: @@ -946,7 +1023,7 @@ func file_larking_api_graphql_proto_init() { } } file_larking_api_graphql_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Error); i { + switch v := v.(*Response); i { case 0: return &v.state case 1: @@ -958,7 +1035,19 @@ func file_larking_api_graphql_proto_init() { } } file_larking_api_graphql_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRelayNodeRequest); i { + switch v := v.(*SourceLocation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_larking_api_graphql_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Error); i { case 0: return &v.state case 1: @@ -971,9 +1060,9 @@ func file_larking_api_graphql_proto_init() { } } file_larking_api_graphql_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*GraphQLRule_Query)(nil), - (*GraphQLRule_Mutation)(nil), - (*GraphQLRule_Subscription)(nil), + (*Rule_Query)(nil), + (*Rule_Mutation)(nil), + (*Rule_Subscription)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -981,9 +1070,9 @@ func file_larking_api_graphql_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_larking_api_graphql_proto_rawDesc, NumEnums: 0, - NumMessages: 9, - NumExtensions: 3, - NumServices: 2, + NumMessages: 10, + NumExtensions: 4, + NumServices: 1, }, GoTypes: file_larking_api_graphql_proto_goTypes, DependencyIndexes: file_larking_api_graphql_proto_depIdxs, diff --git a/api/graphqlpb/graphql_grpc.pb.go b/api/graphqlpb/graphql_grpc.pb.go index 2324706..bb761ee 100644 --- a/api/graphqlpb/graphql_grpc.pb.go +++ b/api/graphqlpb/graphql_grpc.pb.go @@ -15,7 +15,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - anypb "google.golang.org/protobuf/types/known/anypb" ) // This is a compile-time assertion to ensure that this generated file @@ -112,95 +111,3 @@ var GraphQL_ServiceDesc = grpc.ServiceDesc{ Streams: []grpc.StreamDesc{}, Metadata: "larking/api/graphql.proto", } - -const ( - Relay_GetRelayNode_FullMethodName = "/larking.api.Relay/GetRelayNode" -) - -// RelayClient is the client API for Relay 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. -type RelayClient interface { - // GetRelayNode exposes ID! querying capabilities to the GraphQL service. - GetRelayNode(ctx context.Context, in *GetRelayNodeRequest, opts ...grpc.CallOption) (*anypb.Any, error) -} - -type relayClient struct { - cc grpc.ClientConnInterface -} - -func NewRelayClient(cc grpc.ClientConnInterface) RelayClient { - return &relayClient{cc} -} - -func (c *relayClient) GetRelayNode(ctx context.Context, in *GetRelayNodeRequest, opts ...grpc.CallOption) (*anypb.Any, error) { - out := new(anypb.Any) - err := c.cc.Invoke(ctx, Relay_GetRelayNode_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// RelayServer is the server API for Relay service. -// All implementations must embed UnimplementedRelayServer -// for forward compatibility -type RelayServer interface { - // GetRelayNode exposes ID! querying capabilities to the GraphQL service. - GetRelayNode(context.Context, *GetRelayNodeRequest) (*anypb.Any, error) - mustEmbedUnimplementedRelayServer() -} - -// UnimplementedRelayServer must be embedded to have forward compatible implementations. -type UnimplementedRelayServer struct { -} - -func (UnimplementedRelayServer) GetRelayNode(context.Context, *GetRelayNodeRequest) (*anypb.Any, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetRelayNode not implemented") -} -func (UnimplementedRelayServer) mustEmbedUnimplementedRelayServer() {} - -// UnsafeRelayServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to RelayServer will -// result in compilation errors. -type UnsafeRelayServer interface { - mustEmbedUnimplementedRelayServer() -} - -func RegisterRelayServer(s grpc.ServiceRegistrar, srv RelayServer) { - s.RegisterService(&Relay_ServiceDesc, srv) -} - -func _Relay_GetRelayNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetRelayNodeRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RelayServer).GetRelayNode(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Relay_GetRelayNode_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RelayServer).GetRelayNode(ctx, req.(*GetRelayNodeRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// Relay_ServiceDesc is the grpc.ServiceDesc for Relay service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Relay_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "larking.api.Relay", - HandlerType: (*RelayServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetRelayNode", - Handler: _Relay_GetRelayNode_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "larking/api/graphql.proto", -} diff --git a/api/starwars.proto b/api/starwars.proto index f837168..65d1c0c 100644 --- a/api/starwars.proto +++ b/api/starwars.proto @@ -34,15 +34,10 @@ message Faction { // arg "page_size:{first} // query_arg { name : "after" field_path: " - // option (larking.api.relay).connection = { - // name : "ships" - // method : "/larking.testpb.StarWars/ListShips/" - // args { - // "{name}" : "parent", - // "first" : "page_size", - // "after" : "page_token", - // } - //}; + option (larking.api.edge) = { + name : "ships" + method : "/larking.api.StarWars/ListShips" + }; } message GetFactionRequest { string name = 1; } @@ -52,7 +47,7 @@ message Ship { // rpc : "larking.testpb.StarWars.GetShip(id : id)" //}; - string name = 1 [ (larking.api.relay_id) = true ]; + string name = 1; //[ (larking.api.relay_id) = true ]; string display_name = 2; } @@ -81,7 +76,7 @@ message ListShipsResponse { service StarWars { rpc GetFaction(GetFactionRequest) returns (Faction) { - option (larking.api.relay) = { + option (larking.api.graphql) = { query : "faction" args {name : "id" field : "name"} node_id : "{name=factions/*}" diff --git a/api/starwarspb/starwars.pb.go b/api/starwarspb/starwars.pb.go index 9d6df80..06c2ca0 100644 --- a/api/starwarspb/starwars.pb.go +++ b/api/starwarspb/starwars.pb.go @@ -137,7 +137,7 @@ type Ship struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` //[ (larking.api.relay_id) = true ]; DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` } @@ -361,59 +361,62 @@ var file_larking_api_starwars_proto_rawDesc = []byte{ 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x72, 0x61, 0x70, 0x68, 0x71, 0x6c, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x40, 0x0a, 0x07, 0x46, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, + 0x74, 0x6f, 0x22, 0x6e, 0x0a, 0x07, 0x46, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, - 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x27, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x46, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x43, 0x0a, - 0x04, 0x53, 0x68, 0x69, 0x70, 0x12, 0x18, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x04, 0x80, 0x97, 0x22, 0x01, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x21, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, - 0x6d, 0x65, 0x22, 0x24, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x53, 0x68, 0x69, 0x70, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x66, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, - 0x53, 0x68, 0x69, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, - 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, - 0x72, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, - 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x22, 0x64, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x69, 0x70, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x05, 0x73, 0x68, 0x69, 0x70, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x53, 0x68, 0x69, 0x70, 0x52, 0x05, 0x73, 0x68, 0x69, 0x70, 0x73, 0x12, 0x26, - 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, - 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x32, 0xf1, 0x02, 0x0a, 0x08, 0x53, 0x74, 0x61, 0x72, 0x57, - 0x61, 0x72, 0x73, 0x12, 0x8f, 0x01, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x46, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x1e, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x47, 0x65, 0x74, 0x46, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x46, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4b, 0xa2, 0xe1, 0xc0, 0x93, 0x02, 0x28, - 0x22, 0x0a, 0x0a, 0x02, 0x69, 0x64, 0x12, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x2a, 0x11, 0x7b, 0x6e, - 0x61, 0x6d, 0x65, 0x3d, 0x66, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x2a, 0x7d, 0x0a, - 0x07, 0x66, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x12, 0x15, - 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x66, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x71, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x69, - 0x70, 0x73, 0x12, 0x1d, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x69, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x1e, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x69, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x12, 0x1d, 0x2f, 0x76, 0x31, 0x2f, 0x7b, - 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x66, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, - 0x2a, 0x7d, 0x2f, 0x73, 0x68, 0x69, 0x70, 0x73, 0x12, 0x60, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x53, - 0x68, 0x69, 0x70, 0x12, 0x1b, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x68, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x11, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x53, - 0x68, 0x69, 0x70, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x12, 0x1d, 0x2f, 0x76, 0x31, - 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x66, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, - 0x2a, 0x2f, 0x73, 0x68, 0x69, 0x70, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0x26, 0x5a, 0x24, 0x6c, 0x61, - 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x74, 0x61, - 0x72, 0x77, 0x61, 0x72, 0x73, 0x70, 0x62, 0x3b, 0x73, 0x74, 0x61, 0x72, 0x77, 0x61, 0x72, 0x73, - 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x4e, 0x61, 0x6d, 0x65, 0x3a, 0x2c, 0x8a, 0x97, 0x22, 0x28, 0x0a, 0x05, 0x73, 0x68, 0x69, 0x70, + 0x73, 0x12, 0x1f, 0x2f, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x53, 0x74, 0x61, 0x72, 0x57, 0x61, 0x72, 0x73, 0x2f, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x69, + 0x70, 0x73, 0x22, 0x27, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x46, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x3d, 0x0a, 0x04, 0x53, + 0x68, 0x69, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x70, 0x6c, + 0x61, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, + 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x24, 0x0a, 0x0e, 0x47, 0x65, + 0x74, 0x53, 0x68, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x22, 0x66, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x69, 0x70, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, + 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, + 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, + 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x64, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, + 0x53, 0x68, 0x69, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, + 0x05, 0x73, 0x68, 0x69, 0x70, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6c, + 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x68, 0x69, 0x70, 0x52, + 0x05, 0x73, 0x68, 0x69, 0x70, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, + 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x32, 0xf1, + 0x02, 0x0a, 0x08, 0x53, 0x74, 0x61, 0x72, 0x57, 0x61, 0x72, 0x73, 0x12, 0x8f, 0x01, 0x0a, 0x0a, + 0x47, 0x65, 0x74, 0x46, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x2e, 0x6c, 0x61, 0x72, + 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x6c, 0x61, 0x72, + 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x46, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x22, 0x4b, 0xa2, 0xe1, 0xc0, 0x93, 0x02, 0x28, 0x22, 0x0a, 0x0a, 0x02, 0x69, 0x64, 0x12, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x2a, 0x11, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x66, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x2a, 0x7d, 0x0a, 0x07, 0x66, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x12, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, + 0x65, 0x3d, 0x66, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x71, 0x0a, + 0x09, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x69, 0x70, 0x73, 0x12, 0x1d, 0x2e, 0x6c, 0x61, 0x72, + 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x69, + 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6c, 0x61, 0x72, 0x6b, + 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x68, 0x69, 0x70, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x1f, 0x12, 0x1d, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x66, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x73, 0x68, 0x69, 0x70, 0x73, + 0x12, 0x60, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x53, 0x68, 0x69, 0x70, 0x12, 0x1b, 0x2e, 0x6c, 0x61, + 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x68, 0x69, + 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x6c, 0x61, 0x72, 0x6b, 0x69, + 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x68, 0x69, 0x70, 0x22, 0x25, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x1f, 0x12, 0x1d, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x66, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x2a, 0x2f, 0x73, 0x68, 0x69, 0x70, 0x73, 0x2f, + 0x2a, 0x7d, 0x42, 0x26, 0x5a, 0x24, 0x6c, 0x61, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x69, 0x6f, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x74, 0x61, 0x72, 0x77, 0x61, 0x72, 0x73, 0x70, 0x62, 0x3b, + 0x73, 0x74, 0x61, 0x72, 0x77, 0x61, 0x72, 0x73, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/larking/graphql.go b/larking/graphql.go index 1f69a03..175fae4 100644 --- a/larking/graphql.go +++ b/larking/graphql.go @@ -2,39 +2,270 @@ package larking import ( "context" + "encoding/json" + "fmt" "github.com/graphql-go/graphql" + "github.com/graphql-go/graphql/gqlerrors" + "github.com/graphql-go/graphql/language/location" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/types/known/structpb" "larking.io/api/graphqlpb" ) -func toGraphqlErrors(errs []gqlerrors.FormattedError) []*graphqlpb.Error { +// getExtensionGraphQL returns the graphql extension of the proto message. +func getExtensionGraphQL(m proto.Message) *graphqlpb.Rule { + return proto.GetExtension(m, graphqlpb.E_Graphql).(*graphqlpb.Rule) +} + +type stateKeyT struct{} + +var stateKey stateKeyT + +func ctxWithState(ctx context.Context, s *state) context.Context { + return context.WithValue(ctx, stateKey, s) +} +func stateFromCtx(ctx context.Context) *state { + return ctx.Value(stateKey).(*state) +} + +type streamCall struct { + ctx context.Context + name string + params params + send proto.Message +} + +func (s *streamCall) SetHeader(md metadata.MD) error { return nil } +func (s *streamCall) SendHeader(md metadata.MD) error { return nil } +func (s *streamCall) SetTrailer(md metadata.MD) {} + +func (s *streamCall) Context() context.Context { + sts := &serverTransportStream{s, s.name} + return grpc.NewContextWithServerTransportStream(s.ctx, sts) +} + +func (s *streamCall) SendMsg(v any) error { + s.send = v.(proto.Message) + return nil +} + +func (s *streamCall) RecvMsg(m interface{}) error { + args := m.(proto.Message) + + if err := s.params.set(args); err != nil { + return err + } + return nil +} + +func parseGraphQLParam(fds []protoreflect.FieldDescriptor, val any) (param, error) { + if len(fds) == 0 { + return param{}, fmt.Errorf("zero field") + } + fd := fds[len(fds)-1] + + switch kind := fd.Kind(); kind { + case protoreflect.StringKind: + return param{fds: fds, val: protoreflect.ValueOfString(val.(string))}, nil + default: + return param{}, fmt.Errorf("unsupported kind %v", kind) + } +} + +func (s *state) addGraphQLRule( + opts muxOptions, + rule *graphqlpb.Rule, + desc protoreflect.MethodDescriptor, + name string, +) error { + fmt.Println("addGraphQLRule", rule) + fmt.Println("desc", desc) + + // TODO + + // Schema + + factionType := graphql.NewObject(graphql.ObjectConfig{ + Name: "Faction", + Description: "Faction type", + Fields: graphql.Fields{ + "name": &graphql.Field{ + Type: graphql.NewNonNull(graphql.String), + Description: "The name of the faction.", + Resolve: func(p graphql.ResolveParams) (any, error) { + if msg, ok := p.Source.(proto.Message); ok { + mr := msg.ProtoReflect() + desc := mr.Descriptor() + fd := desc.Fields().ByJSONName("name") + return mr.Get(fd).Interface(), nil + } + return nil, nil + }, + }, + "displayName": &graphql.Field{ + Type: graphql.String, + Description: "The displayName of the faction.", + Resolve: func(p graphql.ResolveParams) (any, error) { + if msg, ok := p.Source.(proto.Message); ok { + mr := msg.ProtoReflect() + desc := mr.Descriptor() + fd := desc.Fields().ByJSONName("displayName") + return mr.Get(fd).Interface(), nil + } + return nil, nil + }, + }, + }, + }) + + msgDesc := desc.Input() + fieldDescs := msgDesc.Fields() + + queryType := graphql.NewObject(graphql.ObjectConfig{ + Name: "Query", + Fields: graphql.Fields{ + "faction": &graphql.Field{ + Type: factionType, + Args: graphql.FieldConfigArgument{ + "name": &graphql.ArgumentConfig{ + Description: "faction description", + Type: graphql.String, + }, + }, + Resolve: func(p graphql.ResolveParams) (any, error) { + // fetch data from handler + // convert to structpb.pb + ctx := p.Context + s := stateFromCtx(ctx) + fmt.Println("state", s) + fmt.Println("p", p.Args) + + var params params + for k, v := range p.Args { + fd := fieldDescs.ByJSONName(k) + p, err := parseGraphQLParam([]protoreflect.FieldDescriptor{fd}, v) + if err != nil { + return nil, err + } + params = append(params, p) + } + + hd, err := s.pickMethodHandler(name) + if err != nil { + return nil, err + } + + stream := &streamCall{ + ctx: ctx, + name: name, + params: params, + } + if err := hd.handler(&opts, stream); err != nil { + return nil, err + } + fmt.Println("stream.send", stream.send) + return stream.send, nil + }, + }, + }, + }) + + schemaConfig := graphql.SchemaConfig{ + Query: queryType, + } + + var err error + s.gqlSchema, err = graphql.NewSchema(schemaConfig) + if err != nil { + return err + } + + return nil +} + +func toGraphQLPath(path []any) []string { + if len(path) == 0 { + return nil + } + r := make([]string, len(path)) + for i, p := range path { + r[i] = p.(string) + } + return r +} + +func toGraphQLLocations(locs []location.SourceLocation) []*graphqlpb.SourceLocation { + if len(locs) == 0 { + return nil + } + r := make([]*graphqlpb.SourceLocation, len(locs)) + for i, loc := range locs { + r[i] = &graphqlpb.SourceLocation{ + Line: int32(loc.Line), + Column: int32(loc.Column), + } + } + return r +} + +func toGraphQLErrors(errs []gqlerrors.FormattedError) []*graphqlpb.Error { if len(errs) == 0 { return nil } r := make([]*graphqlpb.Error, len(errs)) for i, err := range errs { - r[i] = &graphqlpb.GraphQLError{ + r[i] = &graphqlpb.Error{ Message: err.Message, - Locations: err.Locations, - Path: err.Path, + Locations: toGraphQLLocations(err.Locations), + Path: toGraphQLPath(err.Path), } } return r } +// TODO: figure out how to keep structpb.Values +func toGraphQLData(data any) *structpb.Struct { + fmt.Println("toGraphqlData", data) + for k, v := range data.(map[string]interface{}) { + fmt.Println("k", k) + fmt.Println("v", v) + fmt.Printf("%T\n", v) + + //s.Fields[k] = &structpb.Value{ + // Kind: &structpb.Value_StringValue{ + // StringValue: v.(string), + // }, + //} + } + b, _ := json.Marshal(data) + var s structpb.Struct + protojson.Unmarshal(b, &s) + return &s +} + func (m *Mux) Query(ctx context.Context, req *graphqlpb.Request) (*graphqlpb.Response, error) { s := m.loadState() + if s == nil { + return nil, fmt.Errorf("schema not loaded") + } + ctx = ctxWithState(ctx, s) - params := &graphql.Params{ - Schema: s.graphqlSchema, + params := graphql.Params{ + Schema: s.gqlSchema, RequestString: req.Query, - VariableValues: req.Variables.Fields, + VariableValues: nil, // TODO: req.Variables.Fields, OperationName: req.OperationName, Context: ctx, } result := graphql.Do(params) + fmt.Println(result) return &graphqlpb.Response{ - Data: result.Data, - Errors: toGraphqlErrors(result.Errors), + Data: toGraphQLData(result.Data), + Errors: toGraphQLErrors(result.Errors), }, nil } diff --git a/larking/graphql_test.go b/larking/graphql_test.go index 9c9120b..82e1da2 100644 --- a/larking/graphql_test.go +++ b/larking/graphql_test.go @@ -9,12 +9,15 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/testing/protocmp" "google.golang.org/protobuf/types/known/structpb" "larking.io/api/graphqlpb" "larking.io/api/starwarspb" ) type starWarsServer struct { + starwarspb.UnimplementedStarWarsServer + factions map[string]*starwarspb.Faction ships map[string]*starwarspb.Ship factionShips map[string][]*starwarspb.Ship @@ -146,8 +149,8 @@ func TestGraphQL(t *testing.T) { if err != nil { t.Fatal(err) } - - //starwarspb.RegisterStarWarsServer(m, &starwarsServer{}) + svr := newStarWarsServer(t) + starwarspb.RegisterStarWarsServer(m, svr) toStruct := func(str string) *structpb.Struct { var s structpb.Struct @@ -160,27 +163,29 @@ func TestGraphQL(t *testing.T) { //t.Skip("TODO") tests := []struct { name string - req *graphqlpb.GraphQLRequest - rsp *graphqlpb.GraphQLResponse + req *graphqlpb.Request + rsp *graphqlpb.Response err error }{{ name: "hero", - req: &graphqlpb.GraphQLRequest{ + req: &graphqlpb.Request{ Query: `{ - rebels { - id + faction(name: "factions/rebels") { name + displayName } }`, }, - rsp: &graphqlpb.GraphQLResponse{ + rsp: &graphqlpb.Response{ Data: toStruct(`{ - "hero": { - "name": "R2-D2" + "faction": { + "name": "factions/rebels", + "displayName": "Alliance to Restore the Republic" } }`), }, }} + cmpOpts := cmp.Options{protocmp.Transform()} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ctx := context.Background() @@ -191,7 +196,7 @@ func TestGraphQL(t *testing.T) { } t.Fatal(err) } - if diff := cmp.Diff(tt.rsp, rsp); diff != "" { + if diff := cmp.Diff(tt.rsp, rsp, cmpOpts...); diff != "" { t.Errorf("diff: %s", diff) } }) diff --git a/larking/mux.go b/larking/mux.go index 9509312..6c94585 100644 --- a/larking/mux.go +++ b/larking/mux.go @@ -47,10 +47,10 @@ type connList struct { } type state struct { - path *path - conns map[*grpc.ClientConn]connList - handlers map[string][]*handler - graphqlSchema *graphql.Schema + path *path + conns map[*grpc.ClientConn]connList + handlers map[string][]*handler + gqlSchema graphql.Schema } func (s *state) clone() *state { @@ -450,6 +450,14 @@ func (s *state) appendHandler( return fmt.Errorf("[%s] invalid rule %s: %w", desc.FullName(), rule.String(), err) } } + + // Add graphql rules. + if rule := getExtensionGraphQL(desc.Options()); rule != nil { + if err := s.addGraphQLRule(opts, rule, desc, h.method); err != nil { + return fmt.Errorf("[%s] invalid graphQL rule %s: %w", desc.FullName(), rule.String(), err) + } + } + s.handlers[h.method] = append(s.handlers[h.method], h) return nil }