diff options
| author | Xe Iaso <me@xeiaso.net> | 2025-01-11 16:53:04 -0500 |
|---|---|---|
| committer | Xe Iaso <me@xeiaso.net> | 2025-01-11 16:53:04 -0500 |
| commit | f313a12d72101ba74032c84d6785ad51c6bb7601 (patch) | |
| tree | 0cc37effbc217c07b6d1ac5c352f3b0611d6c92c /buf/patchouli | |
| parent | 883434d8f85936f46565fcd40f84eaf65027d79f (diff) | |
| download | x-f313a12d72101ba74032c84d6785ad51c6bb7601.tar.xz x-f313a12d72101ba74032c84d6785ad51c6bb7601.zip | |
fix builds oops
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'buf/patchouli')
| -rw-r--r-- | buf/patchouli/patchouli.pb.go | 357 | ||||
| -rw-r--r-- | buf/patchouli/patchouli.proto | 32 | ||||
| -rw-r--r-- | buf/patchouli/patchouliconnect/patchouli.connect.go | 141 |
3 files changed, 530 insertions, 0 deletions
diff --git a/buf/patchouli/patchouli.pb.go b/buf/patchouli/patchouli.pb.go new file mode 100644 index 0000000..dbb9401 --- /dev/null +++ b/buf/patchouli/patchouli.pb.go @@ -0,0 +1,357 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.1 +// protoc (unknown) +// source: patchouli/patchouli.proto + +package patchouli + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + 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 TwitchInfoReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` +} + +func (x *TwitchInfoReq) Reset() { + *x = TwitchInfoReq{} + mi := &file_patchouli_patchouli_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TwitchInfoReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TwitchInfoReq) ProtoMessage() {} + +func (x *TwitchInfoReq) ProtoReflect() protoreflect.Message { + mi := &file_patchouli_patchouli_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 TwitchInfoReq.ProtoReflect.Descriptor instead. +func (*TwitchInfoReq) Descriptor() ([]byte, []int) { + return file_patchouli_patchouli_proto_rawDescGZIP(), []int{0} +} + +func (x *TwitchInfoReq) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +type TwitchInfoResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` + ThumbnailUrl string `protobuf:"bytes,3,opt,name=thumbnail_url,json=thumbnailUrl,proto3" json:"thumbnail_url,omitempty"` + Duration string `protobuf:"bytes,4,opt,name=duration,proto3" json:"duration,omitempty"` + UploadDate *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=upload_date,json=uploadDate,proto3" json:"upload_date,omitempty"` + Url string `protobuf:"bytes,6,opt,name=url,proto3" json:"url,omitempty"` +} + +func (x *TwitchInfoResp) Reset() { + *x = TwitchInfoResp{} + mi := &file_patchouli_patchouli_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TwitchInfoResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TwitchInfoResp) ProtoMessage() {} + +func (x *TwitchInfoResp) ProtoReflect() protoreflect.Message { + mi := &file_patchouli_patchouli_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 TwitchInfoResp.ProtoReflect.Descriptor instead. +func (*TwitchInfoResp) Descriptor() ([]byte, []int) { + return file_patchouli_patchouli_proto_rawDescGZIP(), []int{1} +} + +func (x *TwitchInfoResp) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *TwitchInfoResp) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *TwitchInfoResp) GetThumbnailUrl() string { + if x != nil { + return x.ThumbnailUrl + } + return "" +} + +func (x *TwitchInfoResp) GetDuration() string { + if x != nil { + return x.Duration + } + return "" +} + +func (x *TwitchInfoResp) GetUploadDate() *timestamppb.Timestamp { + if x != nil { + return x.UploadDate + } + return nil +} + +func (x *TwitchInfoResp) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +type TwitchDownloadReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` +} + +func (x *TwitchDownloadReq) Reset() { + *x = TwitchDownloadReq{} + mi := &file_patchouli_patchouli_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TwitchDownloadReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TwitchDownloadReq) ProtoMessage() {} + +func (x *TwitchDownloadReq) ProtoReflect() protoreflect.Message { + mi := &file_patchouli_patchouli_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 TwitchDownloadReq.ProtoReflect.Descriptor instead. +func (*TwitchDownloadReq) Descriptor() ([]byte, []int) { + return file_patchouli_patchouli_proto_rawDescGZIP(), []int{2} +} + +func (x *TwitchDownloadReq) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +type TwitchDownloadResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` + Location string `protobuf:"bytes,2,opt,name=location,proto3" json:"location,omitempty"` +} + +func (x *TwitchDownloadResp) Reset() { + *x = TwitchDownloadResp{} + mi := &file_patchouli_patchouli_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TwitchDownloadResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TwitchDownloadResp) ProtoMessage() {} + +func (x *TwitchDownloadResp) ProtoReflect() protoreflect.Message { + mi := &file_patchouli_patchouli_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 TwitchDownloadResp.ProtoReflect.Descriptor instead. +func (*TwitchDownloadResp) Descriptor() ([]byte, []int) { + return file_patchouli_patchouli_proto_rawDescGZIP(), []int{3} +} + +func (x *TwitchDownloadResp) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *TwitchDownloadResp) GetLocation() string { + if x != nil { + return x.Location + } + return "" +} + +var File_patchouli_patchouli_proto protoreflect.FileDescriptor + +var file_patchouli_patchouli_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x70, 0x61, 0x74, 0x63, 0x68, 0x6f, 0x75, 0x6c, 0x69, 0x2f, 0x70, 0x61, 0x74, 0x63, + 0x68, 0x6f, 0x75, 0x6c, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1a, 0x77, 0x69, 0x74, + 0x68, 0x69, 0x6e, 0x2e, 0x77, 0x65, 0x62, 0x73, 0x69, 0x74, 0x65, 0x2e, 0x78, 0x2e, 0x70, 0x61, + 0x74, 0x63, 0x68, 0x6f, 0x75, 0x6c, 0x69, 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, 0x22, 0x21, 0x0a, 0x0d, 0x54, 0x77, 0x69, 0x74, + 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x22, 0xc6, 0x01, 0x0a, 0x0e, + 0x54, 0x77, 0x69, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, + 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, + 0x69, 0x74, 0x6c, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, + 0x6c, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x68, 0x75, + 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x55, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x75, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x75, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, + 0x64, 0x61, 0x74, 0x65, 0x18, 0x05, 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, 0x0a, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x44, 0x61, + 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x75, 0x72, 0x6c, 0x22, 0x25, 0x0a, 0x11, 0x54, 0x77, 0x69, 0x74, 0x63, 0x68, 0x44, 0x6f, + 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x22, 0x42, 0x0a, 0x12, 0x54, + 0x77, 0x69, 0x74, 0x63, 0x68, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x73, + 0x70, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x75, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, + 0xd9, 0x01, 0x0a, 0x09, 0x53, 0x79, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x5f, 0x0a, + 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x29, 0x2e, 0x77, 0x69, 0x74, 0x68, 0x69, 0x6e, 0x2e, 0x77, + 0x65, 0x62, 0x73, 0x69, 0x74, 0x65, 0x2e, 0x78, 0x2e, 0x70, 0x61, 0x74, 0x63, 0x68, 0x6f, 0x75, + 0x6c, 0x69, 0x2e, 0x54, 0x77, 0x69, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, + 0x1a, 0x2a, 0x2e, 0x77, 0x69, 0x74, 0x68, 0x69, 0x6e, 0x2e, 0x77, 0x65, 0x62, 0x73, 0x69, 0x74, + 0x65, 0x2e, 0x78, 0x2e, 0x70, 0x61, 0x74, 0x63, 0x68, 0x6f, 0x75, 0x6c, 0x69, 0x2e, 0x54, 0x77, + 0x69, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x6b, + 0x0a, 0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x2d, 0x2e, 0x77, 0x69, 0x74, + 0x68, 0x69, 0x6e, 0x2e, 0x77, 0x65, 0x62, 0x73, 0x69, 0x74, 0x65, 0x2e, 0x78, 0x2e, 0x70, 0x61, + 0x74, 0x63, 0x68, 0x6f, 0x75, 0x6c, 0x69, 0x2e, 0x54, 0x77, 0x69, 0x74, 0x63, 0x68, 0x44, 0x6f, + 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x2e, 0x2e, 0x77, 0x69, 0x74, 0x68, + 0x69, 0x6e, 0x2e, 0x77, 0x65, 0x62, 0x73, 0x69, 0x74, 0x65, 0x2e, 0x78, 0x2e, 0x70, 0x61, 0x74, + 0x63, 0x68, 0x6f, 0x75, 0x6c, 0x69, 0x2e, 0x54, 0x77, 0x69, 0x74, 0x63, 0x68, 0x44, 0x6f, 0x77, + 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x42, 0x20, 0x5a, 0x1e, 0x77, + 0x69, 0x74, 0x68, 0x69, 0x6e, 0x2e, 0x77, 0x65, 0x62, 0x73, 0x69, 0x74, 0x65, 0x2f, 0x78, 0x2f, + 0x62, 0x75, 0x66, 0x2f, 0x70, 0x61, 0x74, 0x63, 0x68, 0x6f, 0x75, 0x6c, 0x69, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_patchouli_patchouli_proto_rawDescOnce sync.Once + file_patchouli_patchouli_proto_rawDescData = file_patchouli_patchouli_proto_rawDesc +) + +func file_patchouli_patchouli_proto_rawDescGZIP() []byte { + file_patchouli_patchouli_proto_rawDescOnce.Do(func() { + file_patchouli_patchouli_proto_rawDescData = protoimpl.X.CompressGZIP(file_patchouli_patchouli_proto_rawDescData) + }) + return file_patchouli_patchouli_proto_rawDescData +} + +var file_patchouli_patchouli_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_patchouli_patchouli_proto_goTypes = []any{ + (*TwitchInfoReq)(nil), // 0: within.website.x.patchouli.TwitchInfoReq + (*TwitchInfoResp)(nil), // 1: within.website.x.patchouli.TwitchInfoResp + (*TwitchDownloadReq)(nil), // 2: within.website.x.patchouli.TwitchDownloadReq + (*TwitchDownloadResp)(nil), // 3: within.website.x.patchouli.TwitchDownloadResp + (*timestamppb.Timestamp)(nil), // 4: google.protobuf.Timestamp +} +var file_patchouli_patchouli_proto_depIdxs = []int32{ + 4, // 0: within.website.x.patchouli.TwitchInfoResp.upload_date:type_name -> google.protobuf.Timestamp + 0, // 1: within.website.x.patchouli.Syndicate.Info:input_type -> within.website.x.patchouli.TwitchInfoReq + 2, // 2: within.website.x.patchouli.Syndicate.Download:input_type -> within.website.x.patchouli.TwitchDownloadReq + 1, // 3: within.website.x.patchouli.Syndicate.Info:output_type -> within.website.x.patchouli.TwitchInfoResp + 3, // 4: within.website.x.patchouli.Syndicate.Download:output_type -> within.website.x.patchouli.TwitchDownloadResp + 3, // [3:5] is the sub-list for method output_type + 1, // [1:3] 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_patchouli_patchouli_proto_init() } +func file_patchouli_patchouli_proto_init() { + if File_patchouli_patchouli_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_patchouli_patchouli_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_patchouli_patchouli_proto_goTypes, + DependencyIndexes: file_patchouli_patchouli_proto_depIdxs, + MessageInfos: file_patchouli_patchouli_proto_msgTypes, + }.Build() + File_patchouli_patchouli_proto = out.File + file_patchouli_patchouli_proto_rawDesc = nil + file_patchouli_patchouli_proto_goTypes = nil + file_patchouli_patchouli_proto_depIdxs = nil +} diff --git a/buf/patchouli/patchouli.proto b/buf/patchouli/patchouli.proto new file mode 100644 index 0000000..cfd7bcf --- /dev/null +++ b/buf/patchouli/patchouli.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; +package within.website.x.patchouli; +option go_package = "within.website/x/buf/patchouli"; + +import "google/protobuf/timestamp.proto"; + +service Syndicate { + rpc Info(TwitchInfoReq) returns (TwitchInfoResp) {}; + rpc Download(TwitchDownloadReq) returns (TwitchDownloadResp) {}; +} + +message TwitchInfoReq { + string url = 1; +} + +message TwitchInfoResp { + string id = 1; + string title = 2; + string thumbnail_url = 3; + string duration = 4; + google.protobuf.Timestamp upload_date = 5; + string url = 6; +} + +message TwitchDownloadReq { + string url = 1; +} + +message TwitchDownloadResp { + string url = 1; + string location = 2; +}
\ No newline at end of file diff --git a/buf/patchouli/patchouliconnect/patchouli.connect.go b/buf/patchouli/patchouliconnect/patchouli.connect.go new file mode 100644 index 0000000..55585f7 --- /dev/null +++ b/buf/patchouli/patchouliconnect/patchouli.connect.go @@ -0,0 +1,141 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: patchouli/patchouli.proto + +package patchouliconnect + +import ( + connect "connectrpc.com/connect" + context "context" + errors "errors" + http "net/http" + strings "strings" + patchouli "within.website/x/buf/patchouli" +) + +// 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 ( + // SyndicateName is the fully-qualified name of the Syndicate service. + SyndicateName = "within.website.x.patchouli.Syndicate" +) + +// 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 ( + // SyndicateInfoProcedure is the fully-qualified name of the Syndicate's Info RPC. + SyndicateInfoProcedure = "/within.website.x.patchouli.Syndicate/Info" + // SyndicateDownloadProcedure is the fully-qualified name of the Syndicate's Download RPC. + SyndicateDownloadProcedure = "/within.website.x.patchouli.Syndicate/Download" +) + +// These variables are the protoreflect.Descriptor objects for the RPCs defined in this package. +var ( + syndicateServiceDescriptor = patchouli.File_patchouli_patchouli_proto.Services().ByName("Syndicate") + syndicateInfoMethodDescriptor = syndicateServiceDescriptor.Methods().ByName("Info") + syndicateDownloadMethodDescriptor = syndicateServiceDescriptor.Methods().ByName("Download") +) + +// SyndicateClient is a client for the within.website.x.patchouli.Syndicate service. +type SyndicateClient interface { + Info(context.Context, *connect.Request[patchouli.TwitchInfoReq]) (*connect.Response[patchouli.TwitchInfoResp], error) + Download(context.Context, *connect.Request[patchouli.TwitchDownloadReq]) (*connect.Response[patchouli.TwitchDownloadResp], error) +} + +// NewSyndicateClient constructs a client for the within.website.x.patchouli.Syndicate 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 NewSyndicateClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) SyndicateClient { + baseURL = strings.TrimRight(baseURL, "/") + return &syndicateClient{ + info: connect.NewClient[patchouli.TwitchInfoReq, patchouli.TwitchInfoResp]( + httpClient, + baseURL+SyndicateInfoProcedure, + connect.WithSchema(syndicateInfoMethodDescriptor), + connect.WithClientOptions(opts...), + ), + download: connect.NewClient[patchouli.TwitchDownloadReq, patchouli.TwitchDownloadResp]( + httpClient, + baseURL+SyndicateDownloadProcedure, + connect.WithSchema(syndicateDownloadMethodDescriptor), + connect.WithClientOptions(opts...), + ), + } +} + +// syndicateClient implements SyndicateClient. +type syndicateClient struct { + info *connect.Client[patchouli.TwitchInfoReq, patchouli.TwitchInfoResp] + download *connect.Client[patchouli.TwitchDownloadReq, patchouli.TwitchDownloadResp] +} + +// Info calls within.website.x.patchouli.Syndicate.Info. +func (c *syndicateClient) Info(ctx context.Context, req *connect.Request[patchouli.TwitchInfoReq]) (*connect.Response[patchouli.TwitchInfoResp], error) { + return c.info.CallUnary(ctx, req) +} + +// Download calls within.website.x.patchouli.Syndicate.Download. +func (c *syndicateClient) Download(ctx context.Context, req *connect.Request[patchouli.TwitchDownloadReq]) (*connect.Response[patchouli.TwitchDownloadResp], error) { + return c.download.CallUnary(ctx, req) +} + +// SyndicateHandler is an implementation of the within.website.x.patchouli.Syndicate service. +type SyndicateHandler interface { + Info(context.Context, *connect.Request[patchouli.TwitchInfoReq]) (*connect.Response[patchouli.TwitchInfoResp], error) + Download(context.Context, *connect.Request[patchouli.TwitchDownloadReq]) (*connect.Response[patchouli.TwitchDownloadResp], error) +} + +// NewSyndicateHandler 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 NewSyndicateHandler(svc SyndicateHandler, opts ...connect.HandlerOption) (string, http.Handler) { + syndicateInfoHandler := connect.NewUnaryHandler( + SyndicateInfoProcedure, + svc.Info, + connect.WithSchema(syndicateInfoMethodDescriptor), + connect.WithHandlerOptions(opts...), + ) + syndicateDownloadHandler := connect.NewUnaryHandler( + SyndicateDownloadProcedure, + svc.Download, + connect.WithSchema(syndicateDownloadMethodDescriptor), + connect.WithHandlerOptions(opts...), + ) + return "/within.website.x.patchouli.Syndicate/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case SyndicateInfoProcedure: + syndicateInfoHandler.ServeHTTP(w, r) + case SyndicateDownloadProcedure: + syndicateDownloadHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedSyndicateHandler returns CodeUnimplemented from all methods. +type UnimplementedSyndicateHandler struct{} + +func (UnimplementedSyndicateHandler) Info(context.Context, *connect.Request[patchouli.TwitchInfoReq]) (*connect.Response[patchouli.TwitchInfoResp], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("within.website.x.patchouli.Syndicate.Info is not implemented")) +} + +func (UnimplementedSyndicateHandler) Download(context.Context, *connect.Request[patchouli.TwitchDownloadReq]) (*connect.Response[patchouli.TwitchDownloadResp], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("within.website.x.patchouli.Syndicate.Download is not implemented")) +} |
