Commit: Bulk unfinished work
This commit is contained in:
433
gen/project/v1/project.pb.go
Normal file
433
gen/project/v1/project.pb.go
Normal file
@@ -0,0 +1,433 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.10
|
||||
// protoc (unknown)
|
||||
// source: project/v1/project.proto
|
||||
|
||||
package projectv1
|
||||
|
||||
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 GetProjectRequest 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 *GetProjectRequest) Reset() {
|
||||
*x = GetProjectRequest{}
|
||||
mi := &file_project_v1_project_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetProjectRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetProjectRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetProjectRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_project_v1_project_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 GetProjectRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetProjectRequest) Descriptor() ([]byte, []int) {
|
||||
return file_project_v1_project_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *GetProjectRequest) GetId() int32 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type GetProjectResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
|
||||
IsMaterialized *bool `protobuf:"varint,5,opt,name=is_materialized,json=isMaterialized,proto3,oneof" json:"is_materialized,omitempty"`
|
||||
IsPersonalized *bool `protobuf:"varint,6,opt,name=is_personalized,json=isPersonalized,proto3,oneof" json:"is_personalized,omitempty"`
|
||||
IsConfirmed *bool `protobuf:"varint,7,opt,name=is_confirmed,json=isConfirmed,proto3,oneof" json:"is_confirmed,omitempty"`
|
||||
IsPaid *bool `protobuf:"varint,8,opt,name=is_paid,json=isPaid,proto3,oneof" json:"is_paid,omitempty"`
|
||||
IsDone *bool `protobuf:"varint,9,opt,name=is_done,json=isDone,proto3,oneof" json:"is_done,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetProjectResponse) Reset() {
|
||||
*x = GetProjectResponse{}
|
||||
mi := &file_project_v1_project_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetProjectResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetProjectResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetProjectResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_project_v1_project_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 GetProjectResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetProjectResponse) Descriptor() ([]byte, []int) {
|
||||
return file_project_v1_project_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *GetProjectResponse) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *GetProjectResponse) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GetProjectResponse) GetDescription() string {
|
||||
if x != nil {
|
||||
return x.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GetProjectResponse) GetIsMaterialized() bool {
|
||||
if x != nil && x.IsMaterialized != nil {
|
||||
return *x.IsMaterialized
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *GetProjectResponse) GetIsPersonalized() bool {
|
||||
if x != nil && x.IsPersonalized != nil {
|
||||
return *x.IsPersonalized
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *GetProjectResponse) GetIsConfirmed() bool {
|
||||
if x != nil && x.IsConfirmed != nil {
|
||||
return *x.IsConfirmed
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *GetProjectResponse) GetIsPaid() bool {
|
||||
if x != nil && x.IsPaid != nil {
|
||||
return *x.IsPaid
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *GetProjectResponse) GetIsDone() bool {
|
||||
if x != nil && x.IsDone != nil {
|
||||
return *x.IsDone
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type ListProjectsRequest 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"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ListProjectsRequest) Reset() {
|
||||
*x = ListProjectsRequest{}
|
||||
mi := &file_project_v1_project_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ListProjectsRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ListProjectsRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ListProjectsRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_project_v1_project_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 ListProjectsRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ListProjectsRequest) Descriptor() ([]byte, []int) {
|
||||
return file_project_v1_project_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *ListProjectsRequest) GetPage() int32 {
|
||||
if x != nil {
|
||||
return x.Page
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ListProjectsRequest) GetPerPage() int32 {
|
||||
if x != nil {
|
||||
return x.PerPage
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ListProjectsRequest) GetOrberBy() string {
|
||||
if x != nil {
|
||||
return x.OrberBy
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ListProjectsRequest) GetAsc() bool {
|
||||
if x != nil {
|
||||
return x.Asc
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
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_project_v1_project_proto_msgTypes[3]
|
||||
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_project_v1_project_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 Metadata.ProtoReflect.Descriptor instead.
|
||||
func (*Metadata) Descriptor() ([]byte, []int) {
|
||||
return file_project_v1_project_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *Metadata) GetTotalCount() int32 {
|
||||
if x != nil {
|
||||
return x.TotalCount
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type ListProjectsResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Data []*GetProjectResponse `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 *ListProjectsResponse) Reset() {
|
||||
*x = ListProjectsResponse{}
|
||||
mi := &file_project_v1_project_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ListProjectsResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ListProjectsResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ListProjectsResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_project_v1_project_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 ListProjectsResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ListProjectsResponse) Descriptor() ([]byte, []int) {
|
||||
return file_project_v1_project_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *ListProjectsResponse) GetData() []*GetProjectResponse {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ListProjectsResponse) GetMeta() *Metadata {
|
||||
if x != nil {
|
||||
return x.Meta
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_project_v1_project_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_project_v1_project_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x18project/v1/project.proto\x12\n" +
|
||||
"project.v1\"#\n" +
|
||||
"\x11GetProjectRequest\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\x05R\x02id\"\xeb\x02\n" +
|
||||
"\x12GetProjectResponse\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" +
|
||||
"\x04name\x18\x02 \x01(\tR\x04name\x12 \n" +
|
||||
"\vdescription\x18\x03 \x01(\tR\vdescription\x12,\n" +
|
||||
"\x0fis_materialized\x18\x05 \x01(\bH\x00R\x0eisMaterialized\x88\x01\x01\x12,\n" +
|
||||
"\x0fis_personalized\x18\x06 \x01(\bH\x01R\x0eisPersonalized\x88\x01\x01\x12&\n" +
|
||||
"\fis_confirmed\x18\a \x01(\bH\x02R\visConfirmed\x88\x01\x01\x12\x1c\n" +
|
||||
"\ais_paid\x18\b \x01(\bH\x03R\x06isPaid\x88\x01\x01\x12\x1c\n" +
|
||||
"\ais_done\x18\t \x01(\bH\x04R\x06isDone\x88\x01\x01B\x12\n" +
|
||||
"\x10_is_materializedB\x12\n" +
|
||||
"\x10_is_personalizedB\x0f\n" +
|
||||
"\r_is_confirmedB\n" +
|
||||
"\n" +
|
||||
"\b_is_paidB\n" +
|
||||
"\n" +
|
||||
"\b_is_done\"q\n" +
|
||||
"\x13ListProjectsRequest\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\"*\n" +
|
||||
"\bMetadata\x12\x1e\n" +
|
||||
"\n" +
|
||||
"totalCount\x18\x01 \x01(\x05R\n" +
|
||||
"totalCount\"t\n" +
|
||||
"\x14ListProjectsResponse\x122\n" +
|
||||
"\x04data\x18\x01 \x03(\v2\x1e.project.v1.GetProjectResponseR\x04data\x12(\n" +
|
||||
"\x04meta\x18\x02 \x01(\v2\x14.project.v1.MetadataR\x04meta2\xb0\x01\n" +
|
||||
"\x0eProjectService\x12K\n" +
|
||||
"\n" +
|
||||
"GetProject\x12\x1d.project.v1.GetProjectRequest\x1a\x1e.project.v1.GetProjectResponse\x12Q\n" +
|
||||
"\fListProjects\x12\x1f.project.v1.ListProjectsRequest\x1a .project.v1.ListProjectsResponseB\x9c\x01\n" +
|
||||
"\x0ecom.project.v1B\fProjectProtoP\x01Z3git.kocoder.xyz/kocoded/vt/gen/project/v1;projectv1\xa2\x02\x03PXX\xaa\x02\n" +
|
||||
"Project.V1\xca\x02\n" +
|
||||
"Project\\V1\xe2\x02\x16Project\\V1\\GPBMetadata\xea\x02\vProject::V1b\x06proto3"
|
||||
|
||||
var (
|
||||
file_project_v1_project_proto_rawDescOnce sync.Once
|
||||
file_project_v1_project_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_project_v1_project_proto_rawDescGZIP() []byte {
|
||||
file_project_v1_project_proto_rawDescOnce.Do(func() {
|
||||
file_project_v1_project_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_project_v1_project_proto_rawDesc), len(file_project_v1_project_proto_rawDesc)))
|
||||
})
|
||||
return file_project_v1_project_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_project_v1_project_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
||||
var file_project_v1_project_proto_goTypes = []any{
|
||||
(*GetProjectRequest)(nil), // 0: project.v1.GetProjectRequest
|
||||
(*GetProjectResponse)(nil), // 1: project.v1.GetProjectResponse
|
||||
(*ListProjectsRequest)(nil), // 2: project.v1.ListProjectsRequest
|
||||
(*Metadata)(nil), // 3: project.v1.Metadata
|
||||
(*ListProjectsResponse)(nil), // 4: project.v1.ListProjectsResponse
|
||||
}
|
||||
var file_project_v1_project_proto_depIdxs = []int32{
|
||||
1, // 0: project.v1.ListProjectsResponse.data:type_name -> project.v1.GetProjectResponse
|
||||
3, // 1: project.v1.ListProjectsResponse.meta:type_name -> project.v1.Metadata
|
||||
0, // 2: project.v1.ProjectService.GetProject:input_type -> project.v1.GetProjectRequest
|
||||
2, // 3: project.v1.ProjectService.ListProjects:input_type -> project.v1.ListProjectsRequest
|
||||
1, // 4: project.v1.ProjectService.GetProject:output_type -> project.v1.GetProjectResponse
|
||||
4, // 5: project.v1.ProjectService.ListProjects:output_type -> project.v1.ListProjectsResponse
|
||||
4, // [4:6] is the sub-list for method output_type
|
||||
2, // [2:4] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_project_v1_project_proto_init() }
|
||||
func file_project_v1_project_proto_init() {
|
||||
if File_project_v1_project_proto != nil {
|
||||
return
|
||||
}
|
||||
file_project_v1_project_proto_msgTypes[1].OneofWrappers = []any{}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_project_v1_project_proto_rawDesc), len(file_project_v1_project_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 5,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_project_v1_project_proto_goTypes,
|
||||
DependencyIndexes: file_project_v1_project_proto_depIdxs,
|
||||
MessageInfos: file_project_v1_project_proto_msgTypes,
|
||||
}.Build()
|
||||
File_project_v1_project_proto = out.File
|
||||
file_project_v1_project_proto_goTypes = nil
|
||||
file_project_v1_project_proto_depIdxs = nil
|
||||
}
|
||||
146
gen/project/v1/projectv1connect/project.connect.go
Normal file
146
gen/project/v1/projectv1connect/project.connect.go
Normal file
@@ -0,0 +1,146 @@
|
||||
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
|
||||
//
|
||||
// Source: project/v1/project.proto
|
||||
|
||||
package projectv1connect
|
||||
|
||||
import (
|
||||
connect "connectrpc.com/connect"
|
||||
context "context"
|
||||
errors "errors"
|
||||
v1 "git.kocoder.xyz/kocoded/vt/gen/project/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 (
|
||||
// ProjectServiceName is the fully-qualified name of the ProjectService service.
|
||||
ProjectServiceName = "project.v1.ProjectService"
|
||||
)
|
||||
|
||||
// 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 (
|
||||
// ProjectServiceGetProjectProcedure is the fully-qualified name of the ProjectService's GetProject
|
||||
// RPC.
|
||||
ProjectServiceGetProjectProcedure = "/project.v1.ProjectService/GetProject"
|
||||
// ProjectServiceListProjectsProcedure is the fully-qualified name of the ProjectService's
|
||||
// ListProjects RPC.
|
||||
ProjectServiceListProjectsProcedure = "/project.v1.ProjectService/ListProjects"
|
||||
)
|
||||
|
||||
// ProjectServiceClient is a client for the project.v1.ProjectService service.
|
||||
type ProjectServiceClient interface {
|
||||
GetProject(context.Context, *v1.GetProjectRequest) (*v1.GetProjectResponse, error)
|
||||
ListProjects(context.Context, *v1.ListProjectsRequest) (*v1.ListProjectsResponse, error)
|
||||
}
|
||||
|
||||
// NewProjectServiceClient constructs a client for the project.v1.ProjectService 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 NewProjectServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) ProjectServiceClient {
|
||||
baseURL = strings.TrimRight(baseURL, "/")
|
||||
projectServiceMethods := v1.File_project_v1_project_proto.Services().ByName("ProjectService").Methods()
|
||||
return &projectServiceClient{
|
||||
getProject: connect.NewClient[v1.GetProjectRequest, v1.GetProjectResponse](
|
||||
httpClient,
|
||||
baseURL+ProjectServiceGetProjectProcedure,
|
||||
connect.WithSchema(projectServiceMethods.ByName("GetProject")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
listProjects: connect.NewClient[v1.ListProjectsRequest, v1.ListProjectsResponse](
|
||||
httpClient,
|
||||
baseURL+ProjectServiceListProjectsProcedure,
|
||||
connect.WithSchema(projectServiceMethods.ByName("ListProjects")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
// projectServiceClient implements ProjectServiceClient.
|
||||
type projectServiceClient struct {
|
||||
getProject *connect.Client[v1.GetProjectRequest, v1.GetProjectResponse]
|
||||
listProjects *connect.Client[v1.ListProjectsRequest, v1.ListProjectsResponse]
|
||||
}
|
||||
|
||||
// GetProject calls project.v1.ProjectService.GetProject.
|
||||
func (c *projectServiceClient) GetProject(ctx context.Context, req *v1.GetProjectRequest) (*v1.GetProjectResponse, error) {
|
||||
response, err := c.getProject.CallUnary(ctx, connect.NewRequest(req))
|
||||
if response != nil {
|
||||
return response.Msg, err
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// ListProjects calls project.v1.ProjectService.ListProjects.
|
||||
func (c *projectServiceClient) ListProjects(ctx context.Context, req *v1.ListProjectsRequest) (*v1.ListProjectsResponse, error) {
|
||||
response, err := c.listProjects.CallUnary(ctx, connect.NewRequest(req))
|
||||
if response != nil {
|
||||
return response.Msg, err
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// ProjectServiceHandler is an implementation of the project.v1.ProjectService service.
|
||||
type ProjectServiceHandler interface {
|
||||
GetProject(context.Context, *v1.GetProjectRequest) (*v1.GetProjectResponse, error)
|
||||
ListProjects(context.Context, *v1.ListProjectsRequest) (*v1.ListProjectsResponse, error)
|
||||
}
|
||||
|
||||
// NewProjectServiceHandler 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 NewProjectServiceHandler(svc ProjectServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
|
||||
projectServiceMethods := v1.File_project_v1_project_proto.Services().ByName("ProjectService").Methods()
|
||||
projectServiceGetProjectHandler := connect.NewUnaryHandlerSimple(
|
||||
ProjectServiceGetProjectProcedure,
|
||||
svc.GetProject,
|
||||
connect.WithSchema(projectServiceMethods.ByName("GetProject")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
projectServiceListProjectsHandler := connect.NewUnaryHandlerSimple(
|
||||
ProjectServiceListProjectsProcedure,
|
||||
svc.ListProjects,
|
||||
connect.WithSchema(projectServiceMethods.ByName("ListProjects")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
return "/project.v1.ProjectService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.URL.Path {
|
||||
case ProjectServiceGetProjectProcedure:
|
||||
projectServiceGetProjectHandler.ServeHTTP(w, r)
|
||||
case ProjectServiceListProjectsProcedure:
|
||||
projectServiceListProjectsHandler.ServeHTTP(w, r)
|
||||
default:
|
||||
http.NotFound(w, r)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// UnimplementedProjectServiceHandler returns CodeUnimplemented from all methods.
|
||||
type UnimplementedProjectServiceHandler struct{}
|
||||
|
||||
func (UnimplementedProjectServiceHandler) GetProject(context.Context, *v1.GetProjectRequest) (*v1.GetProjectResponse, error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("project.v1.ProjectService.GetProject is not implemented"))
|
||||
}
|
||||
|
||||
func (UnimplementedProjectServiceHandler) ListProjects(context.Context, *v1.ListProjectsRequest) (*v1.ListProjectsResponse, error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("project.v1.ProjectService.ListProjects is not implemented"))
|
||||
}
|
||||
Reference in New Issue
Block a user