feat: implement ListFiles and DownloadFile RPCs with documentation updates in GRPC.md

This commit is contained in:
2026-07-17 18:14:51 +09:00
parent 27d5b59106
commit 8f183d597e
6 changed files with 569 additions and 65 deletions
+224 -17
View File
@@ -429,6 +429,190 @@ func (x *RandomPass) GetPassword() string {
return ""
}
type EmptyRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *EmptyRequest) Reset() {
*x = EmptyRequest{}
mi := &file_protoapi_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *EmptyRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EmptyRequest) ProtoMessage() {}
func (x *EmptyRequest) ProtoReflect() protoreflect.Message {
mi := &file_protoapi_proto_msgTypes[8]
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 EmptyRequest.ProtoReflect.Descriptor instead.
func (*EmptyRequest) Descriptor() ([]byte, []int) {
return file_protoapi_proto_rawDescGZIP(), []int{8}
}
type FileMetadata struct {
state protoimpl.MessageState `protogen:"open.v1"`
FileName string `protobuf:"bytes,1,opt,name=FileName,proto3" json:"FileName,omitempty"`
FileSize int64 `protobuf:"varint,2,opt,name=FileSize,proto3" json:"FileSize,omitempty"`
UploadedAt int64 `protobuf:"varint,3,opt,name=UploadedAt,proto3" json:"UploadedAt,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *FileMetadata) Reset() {
*x = FileMetadata{}
mi := &file_protoapi_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *FileMetadata) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FileMetadata) ProtoMessage() {}
func (x *FileMetadata) ProtoReflect() protoreflect.Message {
mi := &file_protoapi_proto_msgTypes[9]
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 FileMetadata.ProtoReflect.Descriptor instead.
func (*FileMetadata) Descriptor() ([]byte, []int) {
return file_protoapi_proto_rawDescGZIP(), []int{9}
}
func (x *FileMetadata) GetFileName() string {
if x != nil {
return x.FileName
}
return ""
}
func (x *FileMetadata) GetFileSize() int64 {
if x != nil {
return x.FileSize
}
return 0
}
func (x *FileMetadata) GetUploadedAt() int64 {
if x != nil {
return x.UploadedAt
}
return 0
}
type FileList struct {
state protoimpl.MessageState `protogen:"open.v1"`
Files []*FileMetadata `protobuf:"bytes,1,rep,name=Files,proto3" json:"Files,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *FileList) Reset() {
*x = FileList{}
mi := &file_protoapi_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *FileList) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FileList) ProtoMessage() {}
func (x *FileList) ProtoReflect() protoreflect.Message {
mi := &file_protoapi_proto_msgTypes[10]
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 FileList.ProtoReflect.Descriptor instead.
func (*FileList) Descriptor() ([]byte, []int) {
return file_protoapi_proto_rawDescGZIP(), []int{10}
}
func (x *FileList) GetFiles() []*FileMetadata {
if x != nil {
return x.Files
}
return nil
}
type DownloadRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
FileName string `protobuf:"bytes,1,opt,name=FileName,proto3" json:"FileName,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *DownloadRequest) Reset() {
*x = DownloadRequest{}
mi := &file_protoapi_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *DownloadRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DownloadRequest) ProtoMessage() {}
func (x *DownloadRequest) ProtoReflect() protoreflect.Message {
mi := &file_protoapi_proto_msgTypes[11]
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 DownloadRequest.ProtoReflect.Descriptor instead.
func (*DownloadRequest) Descriptor() ([]byte, []int) {
return file_protoapi_proto_rawDescGZIP(), []int{11}
}
func (x *DownloadRequest) GetFileName() string {
if x != nil {
return x.FileName
}
return ""
}
var File_protoapi_proto protoreflect.FileDescriptor
const file_protoapi_proto_rawDesc = "" +
@@ -457,7 +641,18 @@ const file_protoapi_proto_rawDesc = "" +
"\x06Length\x18\b \x01(\x03R\x06Length\"(\n" +
"\n" +
"RandomPass\x12\x1a\n" +
"\bPassword\x18\x01 \x01(\tR\bPassword2\xc0\x01\n" +
"\bPassword\x18\x01 \x01(\tR\bPassword\"\x0e\n" +
"\fEmptyRequest\"f\n" +
"\fFileMetadata\x12\x1a\n" +
"\bFileName\x18\x01 \x01(\tR\bFileName\x12\x1a\n" +
"\bFileSize\x18\x02 \x01(\x03R\bFileSize\x12\x1e\n" +
"\n" +
"UploadedAt\x18\x03 \x01(\x03R\n" +
"UploadedAt\"/\n" +
"\bFileList\x12#\n" +
"\x05Files\x18\x01 \x03(\v2\r.FileMetadataR\x05Files\"-\n" +
"\x0fDownloadRequest\x12\x1a\n" +
"\bFileName\x18\x01 \x01(\tR\bFileName2\x97\x02\n" +
"\n" +
"IoTService\x12&\n" +
"\aGetDate\x12\x10.RequestDateTime\x1a\t.DateTime\x123\n" +
@@ -465,7 +660,10 @@ const file_protoapi_proto_rawDesc = "" +
"\rGetRandomPass\x12\f.RequestPass\x1a\v.RandomPass\x12)\n" +
"\n" +
"UploadFile\x12\n" +
".FileChunk\x1a\r.UploadStatus(\x01B\x16Z\x14./protoapi/;protoapib\x06proto3"
".FileChunk\x1a\r.UploadStatus(\x01\x12%\n" +
"\tListFiles\x12\r.EmptyRequest\x1a\t.FileList\x12.\n" +
"\fDownloadFile\x12\x10.DownloadRequest\x1a\n" +
".FileChunk0\x01B\x16Z\x14./protoapi/;protoapib\x06proto3"
var (
file_protoapi_proto_rawDescOnce sync.Once
@@ -479,7 +677,7 @@ func file_protoapi_proto_rawDescGZIP() []byte {
return file_protoapi_proto_rawDescData
}
var file_protoapi_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_protoapi_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
var file_protoapi_proto_goTypes = []any{
(*FileChunk)(nil), // 0: FileChunk
(*UploadStatus)(nil), // 1: UploadStatus
@@ -489,21 +687,30 @@ var file_protoapi_proto_goTypes = []any{
(*RequestDateTime)(nil), // 5: RequestDateTime
(*RequestPass)(nil), // 6: RequestPass
(*RandomPass)(nil), // 7: RandomPass
(*EmptyRequest)(nil), // 8: EmptyRequest
(*FileMetadata)(nil), // 9: FileMetadata
(*FileList)(nil), // 10: FileList
(*DownloadRequest)(nil), // 11: DownloadRequest
}
var file_protoapi_proto_depIdxs = []int32{
5, // 0: IoTService.GetDate:input_type -> RequestDateTime
2, // 1: IoTService.UpdateSensingData:input_type -> SensingData
6, // 2: IoTService.GetRandomPass:input_type -> RequestPass
0, // 3: IoTService.UploadFile:input_type -> FileChunk
4, // 4: IoTService.GetDate:output_type -> DateTime
3, // 5: IoTService.UpdateSensingData:output_type -> SensingResponse
7, // 6: IoTService.GetRandomPass:output_type -> RandomPass
1, // 7: IoTService.UploadFile:output_type -> UploadStatus
4, // [4:8] is the sub-list for method output_type
0, // [0:4] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
9, // 0: FileList.Files:type_name -> FileMetadata
5, // 1: IoTService.GetDate:input_type -> RequestDateTime
2, // 2: IoTService.UpdateSensingData:input_type -> SensingData
6, // 3: IoTService.GetRandomPass:input_type -> RequestPass
0, // 4: IoTService.UploadFile:input_type -> FileChunk
8, // 5: IoTService.ListFiles:input_type -> EmptyRequest
11, // 6: IoTService.DownloadFile:input_type -> DownloadRequest
4, // 7: IoTService.GetDate:output_type -> DateTime
3, // 8: IoTService.UpdateSensingData:output_type -> SensingResponse
7, // 9: IoTService.GetRandomPass:output_type -> RandomPass
1, // 10: IoTService.UploadFile:output_type -> UploadStatus
10, // 11: IoTService.ListFiles:output_type -> FileList
0, // 12: IoTService.DownloadFile:output_type -> FileChunk
7, // [7:13] is the sub-list for method output_type
1, // [1:7] 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_protoapi_proto_init() }
@@ -517,7 +724,7 @@ func file_protoapi_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_protoapi_proto_rawDesc), len(file_protoapi_proto_rawDesc)),
NumEnums: 0,
NumMessages: 8,
NumMessages: 12,
NumExtensions: 0,
NumServices: 1,
},