Commit: Bulk unfinished work

This commit is contained in:
2026-01-22 17:39:04 +01:00
parent 6c46b4efcc
commit 3a9acc42a2
68 changed files with 5047 additions and 1064 deletions

645
gen/todo/v1/todo.pb.go Normal file
View File

@@ -0,0 +1,645 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.10
// protoc (unknown)
// source: todo/v1/todo.proto
package todov1
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
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 Status int32
const (
Status_Todo Status = 0
Status_NeedsMoreInfo Status = 1
Status_Doing Status = 2
Status_Done Status = 3
)
// Enum value maps for Status.
var (
Status_name = map[int32]string{
0: "Todo",
1: "NeedsMoreInfo",
2: "Doing",
3: "Done",
}
Status_value = map[string]int32{
"Todo": 0,
"NeedsMoreInfo": 1,
"Doing": 2,
"Done": 3,
}
)
func (x Status) Enum() *Status {
p := new(Status)
*p = x
return p
}
func (x Status) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (Status) Descriptor() protoreflect.EnumDescriptor {
return file_todo_v1_todo_proto_enumTypes[0].Descriptor()
}
func (Status) Type() protoreflect.EnumType {
return &file_todo_v1_todo_proto_enumTypes[0]
}
func (x Status) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use Status.Descriptor instead.
func (Status) EnumDescriptor() ([]byte, []int) {
return file_todo_v1_todo_proto_rawDescGZIP(), []int{0}
}
type Field int32
const (
Field_FieldId Field = 0
Field_FieldTitle Field = 1
Field_FieldDescription Field = 2
Field_FieldStatus Field = 3
)
// Enum value maps for Field.
var (
Field_name = map[int32]string{
0: "FieldId",
1: "FieldTitle",
2: "FieldDescription",
3: "FieldStatus",
}
Field_value = map[string]int32{
"FieldId": 0,
"FieldTitle": 1,
"FieldDescription": 2,
"FieldStatus": 3,
}
)
func (x Field) Enum() *Field {
p := new(Field)
*p = x
return p
}
func (x Field) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (Field) Descriptor() protoreflect.EnumDescriptor {
return file_todo_v1_todo_proto_enumTypes[1].Descriptor()
}
func (Field) Type() protoreflect.EnumType {
return &file_todo_v1_todo_proto_enumTypes[1]
}
func (x Field) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use Field.Descriptor instead.
func (Field) EnumDescriptor() ([]byte, []int) {
return file_todo_v1_todo_proto_rawDescGZIP(), []int{1}
}
type Operation int32
const (
Operation_Equals Operation = 0
Operation_NotEquals Operation = 1
Operation_GreaterThan Operation = 2
Operation_LessThan Operation = 3
Operation_Like Operation = 4
)
// Enum value maps for Operation.
var (
Operation_name = map[int32]string{
0: "Equals",
1: "NotEquals",
2: "GreaterThan",
3: "LessThan",
4: "Like",
}
Operation_value = map[string]int32{
"Equals": 0,
"NotEquals": 1,
"GreaterThan": 2,
"LessThan": 3,
"Like": 4,
}
)
func (x Operation) Enum() *Operation {
p := new(Operation)
*p = x
return p
}
func (x Operation) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (Operation) Descriptor() protoreflect.EnumDescriptor {
return file_todo_v1_todo_proto_enumTypes[2].Descriptor()
}
func (Operation) Type() protoreflect.EnumType {
return &file_todo_v1_todo_proto_enumTypes[2]
}
func (x Operation) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use Operation.Descriptor instead.
func (Operation) EnumDescriptor() ([]byte, []int) {
return file_todo_v1_todo_proto_rawDescGZIP(), []int{2}
}
type GetTodosRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetTodosRequest) Reset() {
*x = GetTodosRequest{}
mi := &file_todo_v1_todo_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetTodosRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetTodosRequest) ProtoMessage() {}
func (x *GetTodosRequest) ProtoReflect() protoreflect.Message {
mi := &file_todo_v1_todo_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetTodosRequest.ProtoReflect.Descriptor instead.
func (*GetTodosRequest) Descriptor() ([]byte, []int) {
return file_todo_v1_todo_proto_rawDescGZIP(), []int{0}
}
func (x *GetTodosRequest) GetId() int32 {
if x != nil {
return x.Id
}
return 0
}
type GetTodosResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
Status Status `protobuf:"varint,4,opt,name=status,proto3,enum=todo.v1.Status" json:"status,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetTodosResponse) Reset() {
*x = GetTodosResponse{}
mi := &file_todo_v1_todo_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetTodosResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetTodosResponse) ProtoMessage() {}
func (x *GetTodosResponse) ProtoReflect() protoreflect.Message {
mi := &file_todo_v1_todo_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetTodosResponse.ProtoReflect.Descriptor instead.
func (*GetTodosResponse) Descriptor() ([]byte, []int) {
return file_todo_v1_todo_proto_rawDescGZIP(), []int{1}
}
func (x *GetTodosResponse) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *GetTodosResponse) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *GetTodosResponse) GetDescription() string {
if x != nil {
return x.Description
}
return ""
}
func (x *GetTodosResponse) GetStatus() Status {
if x != nil {
return x.Status
}
return Status_Todo
}
type ListTodosRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
PerPage int32 `protobuf:"varint,2,opt,name=per_page,json=perPage,proto3" json:"per_page,omitempty"`
OrberBy string `protobuf:"bytes,3,opt,name=orber_by,json=orberBy,proto3" json:"orber_by,omitempty"`
Asc bool `protobuf:"varint,4,opt,name=asc,proto3" json:"asc,omitempty"`
Filters []*Filter `protobuf:"bytes,5,rep,name=filters,proto3" json:"filters,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ListTodosRequest) Reset() {
*x = ListTodosRequest{}
mi := &file_todo_v1_todo_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListTodosRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListTodosRequest) ProtoMessage() {}
func (x *ListTodosRequest) ProtoReflect() protoreflect.Message {
mi := &file_todo_v1_todo_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListTodosRequest.ProtoReflect.Descriptor instead.
func (*ListTodosRequest) Descriptor() ([]byte, []int) {
return file_todo_v1_todo_proto_rawDescGZIP(), []int{2}
}
func (x *ListTodosRequest) GetPage() int32 {
if x != nil {
return x.Page
}
return 0
}
func (x *ListTodosRequest) GetPerPage() int32 {
if x != nil {
return x.PerPage
}
return 0
}
func (x *ListTodosRequest) GetOrberBy() string {
if x != nil {
return x.OrberBy
}
return ""
}
func (x *ListTodosRequest) GetAsc() bool {
if x != nil {
return x.Asc
}
return false
}
func (x *ListTodosRequest) GetFilters() []*Filter {
if x != nil {
return x.Filters
}
return nil
}
type Filter struct {
state protoimpl.MessageState `protogen:"open.v1"`
Field Field `protobuf:"varint,1,opt,name=field,proto3,enum=todo.v1.Field" json:"field,omitempty"`
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
Operation Operation `protobuf:"varint,3,opt,name=operation,proto3,enum=todo.v1.Operation" json:"operation,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Filter) Reset() {
*x = Filter{}
mi := &file_todo_v1_todo_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Filter) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Filter) ProtoMessage() {}
func (x *Filter) ProtoReflect() protoreflect.Message {
mi := &file_todo_v1_todo_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Filter.ProtoReflect.Descriptor instead.
func (*Filter) Descriptor() ([]byte, []int) {
return file_todo_v1_todo_proto_rawDescGZIP(), []int{3}
}
func (x *Filter) GetField() Field {
if x != nil {
return x.Field
}
return Field_FieldId
}
func (x *Filter) GetValue() string {
if x != nil {
return x.Value
}
return ""
}
func (x *Filter) GetOperation() Operation {
if x != nil {
return x.Operation
}
return Operation_Equals
}
type Metadata struct {
state protoimpl.MessageState `protogen:"open.v1"`
TotalCount int32 `protobuf:"varint,1,opt,name=totalCount,proto3" json:"totalCount,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Metadata) Reset() {
*x = Metadata{}
mi := &file_todo_v1_todo_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Metadata) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Metadata) ProtoMessage() {}
func (x *Metadata) ProtoReflect() protoreflect.Message {
mi := &file_todo_v1_todo_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Metadata.ProtoReflect.Descriptor instead.
func (*Metadata) Descriptor() ([]byte, []int) {
return file_todo_v1_todo_proto_rawDescGZIP(), []int{4}
}
func (x *Metadata) GetTotalCount() int32 {
if x != nil {
return x.TotalCount
}
return 0
}
type ListTodosResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Data []*GetTodosResponse `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
Meta *Metadata `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ListTodosResponse) Reset() {
*x = ListTodosResponse{}
mi := &file_todo_v1_todo_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListTodosResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListTodosResponse) ProtoMessage() {}
func (x *ListTodosResponse) ProtoReflect() protoreflect.Message {
mi := &file_todo_v1_todo_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListTodosResponse.ProtoReflect.Descriptor instead.
func (*ListTodosResponse) Descriptor() ([]byte, []int) {
return file_todo_v1_todo_proto_rawDescGZIP(), []int{5}
}
func (x *ListTodosResponse) GetData() []*GetTodosResponse {
if x != nil {
return x.Data
}
return nil
}
func (x *ListTodosResponse) GetMeta() *Metadata {
if x != nil {
return x.Meta
}
return nil
}
var File_todo_v1_todo_proto protoreflect.FileDescriptor
const file_todo_v1_todo_proto_rawDesc = "" +
"\n" +
"\x12todo/v1/todo.proto\x12\atodo.v1\"!\n" +
"\x0fGetTodosRequest\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x05R\x02id\"\x83\x01\n" +
"\x10GetTodosResponse\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x14\n" +
"\x05title\x18\x02 \x01(\tR\x05title\x12 \n" +
"\vdescription\x18\x03 \x01(\tR\vdescription\x12'\n" +
"\x06status\x18\x04 \x01(\x0e2\x0f.todo.v1.StatusR\x06status\"\x99\x01\n" +
"\x10ListTodosRequest\x12\x12\n" +
"\x04page\x18\x01 \x01(\x05R\x04page\x12\x19\n" +
"\bper_page\x18\x02 \x01(\x05R\aperPage\x12\x19\n" +
"\borber_by\x18\x03 \x01(\tR\aorberBy\x12\x10\n" +
"\x03asc\x18\x04 \x01(\bR\x03asc\x12)\n" +
"\afilters\x18\x05 \x03(\v2\x0f.todo.v1.FilterR\afilters\"v\n" +
"\x06Filter\x12$\n" +
"\x05field\x18\x01 \x01(\x0e2\x0e.todo.v1.FieldR\x05field\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value\x120\n" +
"\toperation\x18\x03 \x01(\x0e2\x12.todo.v1.OperationR\toperation\"*\n" +
"\bMetadata\x12\x1e\n" +
"\n" +
"totalCount\x18\x01 \x01(\x05R\n" +
"totalCount\"i\n" +
"\x11ListTodosResponse\x12-\n" +
"\x04data\x18\x01 \x03(\v2\x19.todo.v1.GetTodosResponseR\x04data\x12%\n" +
"\x04meta\x18\x02 \x01(\v2\x11.todo.v1.MetadataR\x04meta*:\n" +
"\x06Status\x12\b\n" +
"\x04Todo\x10\x00\x12\x11\n" +
"\rNeedsMoreInfo\x10\x01\x12\t\n" +
"\x05Doing\x10\x02\x12\b\n" +
"\x04Done\x10\x03*K\n" +
"\x05Field\x12\v\n" +
"\aFieldId\x10\x00\x12\x0e\n" +
"\n" +
"FieldTitle\x10\x01\x12\x14\n" +
"\x10FieldDescription\x10\x02\x12\x0f\n" +
"\vFieldStatus\x10\x03*O\n" +
"\tOperation\x12\n" +
"\n" +
"\x06Equals\x10\x00\x12\r\n" +
"\tNotEquals\x10\x01\x12\x0f\n" +
"\vGreaterThan\x10\x02\x12\f\n" +
"\bLessThan\x10\x03\x12\b\n" +
"\x04Like\x10\x042\x91\x01\n" +
"\vTodoService\x12>\n" +
"\aGetTodo\x12\x18.todo.v1.GetTodosRequest\x1a\x19.todo.v1.GetTodosResponse\x12B\n" +
"\tListTodos\x12\x19.todo.v1.ListTodosRequest\x1a\x1a.todo.v1.ListTodosResponseB\x84\x01\n" +
"\vcom.todo.v1B\tTodoProtoP\x01Z-git.kocoder.xyz/kocoded/vt/gen/todo/v1;todov1\xa2\x02\x03TXX\xaa\x02\aTodo.V1\xca\x02\aTodo\\V1\xe2\x02\x13Todo\\V1\\GPBMetadata\xea\x02\bTodo::V1b\x06proto3"
var (
file_todo_v1_todo_proto_rawDescOnce sync.Once
file_todo_v1_todo_proto_rawDescData []byte
)
func file_todo_v1_todo_proto_rawDescGZIP() []byte {
file_todo_v1_todo_proto_rawDescOnce.Do(func() {
file_todo_v1_todo_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_todo_v1_todo_proto_rawDesc), len(file_todo_v1_todo_proto_rawDesc)))
})
return file_todo_v1_todo_proto_rawDescData
}
var file_todo_v1_todo_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
var file_todo_v1_todo_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_todo_v1_todo_proto_goTypes = []any{
(Status)(0), // 0: todo.v1.Status
(Field)(0), // 1: todo.v1.Field
(Operation)(0), // 2: todo.v1.Operation
(*GetTodosRequest)(nil), // 3: todo.v1.GetTodosRequest
(*GetTodosResponse)(nil), // 4: todo.v1.GetTodosResponse
(*ListTodosRequest)(nil), // 5: todo.v1.ListTodosRequest
(*Filter)(nil), // 6: todo.v1.Filter
(*Metadata)(nil), // 7: todo.v1.Metadata
(*ListTodosResponse)(nil), // 8: todo.v1.ListTodosResponse
}
var file_todo_v1_todo_proto_depIdxs = []int32{
0, // 0: todo.v1.GetTodosResponse.status:type_name -> todo.v1.Status
6, // 1: todo.v1.ListTodosRequest.filters:type_name -> todo.v1.Filter
1, // 2: todo.v1.Filter.field:type_name -> todo.v1.Field
2, // 3: todo.v1.Filter.operation:type_name -> todo.v1.Operation
4, // 4: todo.v1.ListTodosResponse.data:type_name -> todo.v1.GetTodosResponse
7, // 5: todo.v1.ListTodosResponse.meta:type_name -> todo.v1.Metadata
3, // 6: todo.v1.TodoService.GetTodo:input_type -> todo.v1.GetTodosRequest
5, // 7: todo.v1.TodoService.ListTodos:input_type -> todo.v1.ListTodosRequest
4, // 8: todo.v1.TodoService.GetTodo:output_type -> todo.v1.GetTodosResponse
8, // 9: todo.v1.TodoService.ListTodos:output_type -> todo.v1.ListTodosResponse
8, // [8:10] is the sub-list for method output_type
6, // [6:8] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
6, // [6:6] is the sub-list for extension extendee
0, // [0:6] is the sub-list for field type_name
}
func init() { file_todo_v1_todo_proto_init() }
func file_todo_v1_todo_proto_init() {
if File_todo_v1_todo_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_todo_v1_todo_proto_rawDesc), len(file_todo_v1_todo_proto_rawDesc)),
NumEnums: 3,
NumMessages: 6,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_todo_v1_todo_proto_goTypes,
DependencyIndexes: file_todo_v1_todo_proto_depIdxs,
EnumInfos: file_todo_v1_todo_proto_enumTypes,
MessageInfos: file_todo_v1_todo_proto_msgTypes,
}.Build()
File_todo_v1_todo_proto = out.File
file_todo_v1_todo_proto_goTypes = nil
file_todo_v1_todo_proto_depIdxs = nil
}

View File

@@ -0,0 +1,144 @@
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
//
// Source: todo/v1/todo.proto
package todov1connect
import (
connect "connectrpc.com/connect"
context "context"
errors "errors"
v1 "git.kocoder.xyz/kocoded/vt/gen/todo/v1"
http "net/http"
strings "strings"
)
// This is a compile-time assertion to ensure that this generated file and the connect package are
// compatible. If you get a compiler error that this constant is not defined, this code was
// generated with a version of connect newer than the one compiled into your binary. You can fix the
// problem by either regenerating this code with an older version of connect or updating the connect
// version compiled into your binary.
const _ = connect.IsAtLeastVersion1_13_0
const (
// TodoServiceName is the fully-qualified name of the TodoService service.
TodoServiceName = "todo.v1.TodoService"
)
// These constants are the fully-qualified names of the RPCs defined in this package. They're
// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
//
// Note that these are different from the fully-qualified method names used by
// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
// period.
const (
// TodoServiceGetTodoProcedure is the fully-qualified name of the TodoService's GetTodo RPC.
TodoServiceGetTodoProcedure = "/todo.v1.TodoService/GetTodo"
// TodoServiceListTodosProcedure is the fully-qualified name of the TodoService's ListTodos RPC.
TodoServiceListTodosProcedure = "/todo.v1.TodoService/ListTodos"
)
// TodoServiceClient is a client for the todo.v1.TodoService service.
type TodoServiceClient interface {
GetTodo(context.Context, *v1.GetTodosRequest) (*v1.GetTodosResponse, error)
ListTodos(context.Context, *v1.ListTodosRequest) (*v1.ListTodosResponse, error)
}
// NewTodoServiceClient constructs a client for the todo.v1.TodoService service. By default, it uses
// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
// connect.WithGRPCWeb() options.
//
// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
// http://api.acme.com or https://acme.com/grpc).
func NewTodoServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) TodoServiceClient {
baseURL = strings.TrimRight(baseURL, "/")
todoServiceMethods := v1.File_todo_v1_todo_proto.Services().ByName("TodoService").Methods()
return &todoServiceClient{
getTodo: connect.NewClient[v1.GetTodosRequest, v1.GetTodosResponse](
httpClient,
baseURL+TodoServiceGetTodoProcedure,
connect.WithSchema(todoServiceMethods.ByName("GetTodo")),
connect.WithClientOptions(opts...),
),
listTodos: connect.NewClient[v1.ListTodosRequest, v1.ListTodosResponse](
httpClient,
baseURL+TodoServiceListTodosProcedure,
connect.WithSchema(todoServiceMethods.ByName("ListTodos")),
connect.WithClientOptions(opts...),
),
}
}
// todoServiceClient implements TodoServiceClient.
type todoServiceClient struct {
getTodo *connect.Client[v1.GetTodosRequest, v1.GetTodosResponse]
listTodos *connect.Client[v1.ListTodosRequest, v1.ListTodosResponse]
}
// GetTodo calls todo.v1.TodoService.GetTodo.
func (c *todoServiceClient) GetTodo(ctx context.Context, req *v1.GetTodosRequest) (*v1.GetTodosResponse, error) {
response, err := c.getTodo.CallUnary(ctx, connect.NewRequest(req))
if response != nil {
return response.Msg, err
}
return nil, err
}
// ListTodos calls todo.v1.TodoService.ListTodos.
func (c *todoServiceClient) ListTodos(ctx context.Context, req *v1.ListTodosRequest) (*v1.ListTodosResponse, error) {
response, err := c.listTodos.CallUnary(ctx, connect.NewRequest(req))
if response != nil {
return response.Msg, err
}
return nil, err
}
// TodoServiceHandler is an implementation of the todo.v1.TodoService service.
type TodoServiceHandler interface {
GetTodo(context.Context, *v1.GetTodosRequest) (*v1.GetTodosResponse, error)
ListTodos(context.Context, *v1.ListTodosRequest) (*v1.ListTodosResponse, error)
}
// NewTodoServiceHandler builds an HTTP handler from the service implementation. It returns the path
// on which to mount the handler and the handler itself.
//
// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
// and JSON codecs. They also support gzip compression.
func NewTodoServiceHandler(svc TodoServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
todoServiceMethods := v1.File_todo_v1_todo_proto.Services().ByName("TodoService").Methods()
todoServiceGetTodoHandler := connect.NewUnaryHandlerSimple(
TodoServiceGetTodoProcedure,
svc.GetTodo,
connect.WithSchema(todoServiceMethods.ByName("GetTodo")),
connect.WithHandlerOptions(opts...),
)
todoServiceListTodosHandler := connect.NewUnaryHandlerSimple(
TodoServiceListTodosProcedure,
svc.ListTodos,
connect.WithSchema(todoServiceMethods.ByName("ListTodos")),
connect.WithHandlerOptions(opts...),
)
return "/todo.v1.TodoService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case TodoServiceGetTodoProcedure:
todoServiceGetTodoHandler.ServeHTTP(w, r)
case TodoServiceListTodosProcedure:
todoServiceListTodosHandler.ServeHTTP(w, r)
default:
http.NotFound(w, r)
}
})
}
// UnimplementedTodoServiceHandler returns CodeUnimplemented from all methods.
type UnimplementedTodoServiceHandler struct{}
func (UnimplementedTodoServiceHandler) GetTodo(context.Context, *v1.GetTodosRequest) (*v1.GetTodosResponse, error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("todo.v1.TodoService.GetTodo is not implemented"))
}
func (UnimplementedTodoServiceHandler) ListTodos(context.Context, *v1.ListTodosRequest) (*v1.ListTodosResponse, error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("todo.v1.TodoService.ListTodos is not implemented"))
}