From 1694e7aad710ddcdc114d5bb693972341193c7d7 Mon Sep 17 00:00:00 2001 From: Alilestera <75608652+alilestera@users.noreply.github.com> Date: Fri, 18 Aug 2023 14:34:45 +0800 Subject: [PATCH] feat: modify sms api proto (#982) --- docs/api/v1/sms.html | 40 +++++++- spec/proto/extension/v1/sms/sms.pb.go | 141 +++++++++++++++++++------- spec/proto/extension/v1/sms/sms.proto | 23 ++++- 3 files changed, 158 insertions(+), 46 deletions(-) diff --git a/docs/api/v1/sms.html b/docs/api/v1/sms.html index 005141c587..3febbee758 100644 --- a/docs/api/v1/sms.html +++ b/docs/api/v1/sms.html @@ -192,7 +192,11 @@

Table of Contents

  • - MSendSmsWithTemplateResponse.MetadataEntry + MSendStatus +
  • + +
  • + MSendStatus.MetadataEntry
  • @@ -340,7 +344,7 @@

    Se

    SendSmsWithTemplateResponse

    -

    SendSmsResponse is the reponse of the `SendSms` method.

    +

    SendSmsResponse is the response of the `SendSms` method.

    @@ -356,6 +360,30 @@

    SendSmsWithTemp

    + + + + + + + + +

    The unique requestId.

    resultsSendStatusrepeated

    The status set of SMS

    + + + + + +

    SendStatus

    +

    Status contains more information about the response

    + + + + + + + + @@ -372,9 +400,11 @@

    SendSmsWithTemp

    - + - + @@ -384,7 +414,7 @@

    SendSmsWithTemp -

    SendSmsWithTemplateResponse.MetadataEntry

    +

    SendStatus.MetadataEntry

    diff --git a/spec/proto/extension/v1/sms/sms.pb.go b/spec/proto/extension/v1/sms/sms.pb.go index 43a333dafa..2167ed0c08 100644 --- a/spec/proto/extension/v1/sms/sms.pb.go +++ b/spec/proto/extension/v1/sms/sms.pb.go @@ -175,7 +175,7 @@ func (x *Template) GetTemplateParams() map[string]string { return nil } -// SendSmsResponse is the reponse of the `SendSms` method. +// SendSmsResponse is the response of the `SendSms` method. type SendSmsWithTemplateResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -183,12 +183,8 @@ type SendSmsWithTemplateResponse struct { // The unique requestId. RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` - // "OK" represents success. - Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"` - // The error message. - Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` - // The metadata returned from SMS service. - Metadata map[string]string `protobuf:"bytes,4,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // The status set of SMS + Results []*SendStatus `protobuf:"bytes,2,rep,name=results,proto3" json:"results,omitempty"` } func (x *SendSmsWithTemplateResponse) Reset() { @@ -230,21 +226,76 @@ func (x *SendSmsWithTemplateResponse) GetRequestId() string { return "" } -func (x *SendSmsWithTemplateResponse) GetCode() string { +func (x *SendSmsWithTemplateResponse) GetResults() []*SendStatus { + if x != nil { + return x.Results + } + return nil +} + +// Status contains more information about the response +type SendStatus struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // "OK" represents success. + Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` + // The error message. + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + // The send status metadata returned from SMS service. + // Includes `PhoneNumber`. + // `PhoneNumber`, is the phone number SMS send to. Supported by tencentcloud. + Metadata map[string]string `protobuf:"bytes,3,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *SendStatus) Reset() { + *x = SendStatus{} + if protoimpl.UnsafeEnabled { + mi := &file_sms_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendStatus) ProtoMessage() {} + +func (x *SendStatus) ProtoReflect() protoreflect.Message { + mi := &file_sms_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 SendStatus.ProtoReflect.Descriptor instead. +func (*SendStatus) Descriptor() ([]byte, []int) { + return file_sms_proto_rawDescGZIP(), []int{3} +} + +func (x *SendStatus) GetCode() string { if x != nil { return x.Code } return "" } -func (x *SendSmsWithTemplateResponse) GetMessage() string { +func (x *SendStatus) GetMessage() string { if x != nil { return x.Message } return "" } -func (x *SendSmsWithTemplateResponse) GetMetadata() map[string]string { +func (x *SendStatus) GetMetadata() map[string]string { if x != nil { return x.Metadata } @@ -294,18 +345,22 @@ var file_sms_proto_rawDesc = []byte{ 0x72, 0x61, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x8b, 0x02, 0x0a, 0x1b, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x6d, - 0x73, 0x57, 0x69, 0x74, 0x68, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x12, 0x62, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x73, 0x70, 0x65, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x7f, 0x0a, 0x1b, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x6d, 0x73, + 0x57, 0x69, 0x74, 0x68, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x49, 0x64, 0x12, 0x41, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x73, 0x70, 0x65, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x73, - 0x6d, 0x73, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x6d, 0x73, 0x57, 0x69, 0x74, 0x68, 0x54, 0x65, - 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4d, + 0x6d, 0x73, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x07, 0x72, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x22, 0xca, 0x01, 0x0a, 0x0a, 0x53, 0x65, 0x6e, 0x64, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x12, 0x51, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x73, 0x70, 0x65, 0x63, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, + 0x73, 0x6d, 0x73, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, @@ -339,27 +394,29 @@ func file_sms_proto_rawDescGZIP() []byte { return file_sms_proto_rawDescData } -var file_sms_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_sms_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_sms_proto_goTypes = []interface{}{ (*SendSmsWithTemplateRequest)(nil), // 0: spec.proto.extension.v1.sms.SendSmsWithTemplateRequest (*Template)(nil), // 1: spec.proto.extension.v1.sms.Template (*SendSmsWithTemplateResponse)(nil), // 2: spec.proto.extension.v1.sms.SendSmsWithTemplateResponse - nil, // 3: spec.proto.extension.v1.sms.SendSmsWithTemplateRequest.MetadataEntry - nil, // 4: spec.proto.extension.v1.sms.Template.TemplateParamsEntry - nil, // 5: spec.proto.extension.v1.sms.SendSmsWithTemplateResponse.MetadataEntry + (*SendStatus)(nil), // 3: spec.proto.extension.v1.sms.SendStatus + nil, // 4: spec.proto.extension.v1.sms.SendSmsWithTemplateRequest.MetadataEntry + nil, // 5: spec.proto.extension.v1.sms.Template.TemplateParamsEntry + nil, // 6: spec.proto.extension.v1.sms.SendStatus.MetadataEntry } var file_sms_proto_depIdxs = []int32{ 1, // 0: spec.proto.extension.v1.sms.SendSmsWithTemplateRequest.template:type_name -> spec.proto.extension.v1.sms.Template - 3, // 1: spec.proto.extension.v1.sms.SendSmsWithTemplateRequest.metadata:type_name -> spec.proto.extension.v1.sms.SendSmsWithTemplateRequest.MetadataEntry - 4, // 2: spec.proto.extension.v1.sms.Template.template_params:type_name -> spec.proto.extension.v1.sms.Template.TemplateParamsEntry - 5, // 3: spec.proto.extension.v1.sms.SendSmsWithTemplateResponse.metadata:type_name -> spec.proto.extension.v1.sms.SendSmsWithTemplateResponse.MetadataEntry - 0, // 4: spec.proto.extension.v1.sms.SmsService.SendSmsWithTemplate:input_type -> spec.proto.extension.v1.sms.SendSmsWithTemplateRequest - 2, // 5: spec.proto.extension.v1.sms.SmsService.SendSmsWithTemplate:output_type -> spec.proto.extension.v1.sms.SendSmsWithTemplateResponse - 5, // [5:6] is the sub-list for method output_type - 4, // [4:5] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name + 4, // 1: spec.proto.extension.v1.sms.SendSmsWithTemplateRequest.metadata:type_name -> spec.proto.extension.v1.sms.SendSmsWithTemplateRequest.MetadataEntry + 5, // 2: spec.proto.extension.v1.sms.Template.template_params:type_name -> spec.proto.extension.v1.sms.Template.TemplateParamsEntry + 3, // 3: spec.proto.extension.v1.sms.SendSmsWithTemplateResponse.results:type_name -> spec.proto.extension.v1.sms.SendStatus + 6, // 4: spec.proto.extension.v1.sms.SendStatus.metadata:type_name -> spec.proto.extension.v1.sms.SendStatus.MetadataEntry + 0, // 5: spec.proto.extension.v1.sms.SmsService.SendSmsWithTemplate:input_type -> spec.proto.extension.v1.sms.SendSmsWithTemplateRequest + 2, // 6: spec.proto.extension.v1.sms.SmsService.SendSmsWithTemplate:output_type -> spec.proto.extension.v1.sms.SendSmsWithTemplateResponse + 6, // [6:7] is the sub-list for method output_type + 5, // [5:6] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_sms_proto_init() } @@ -404,6 +461,18 @@ func file_sms_proto_init() { return nil } } + file_sms_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendStatus); 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{ @@ -411,7 +480,7 @@ func file_sms_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_sms_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 7, NumExtensions: 0, NumServices: 1, }, diff --git a/spec/proto/extension/v1/sms/sms.proto b/spec/proto/extension/v1/sms/sms.proto index cb8ea5cac6..1c4b17a7a8 100644 --- a/spec/proto/extension/v1/sms/sms.proto +++ b/spec/proto/extension/v1/sms/sms.proto @@ -35,6 +35,7 @@ message SendSmsWithTemplateRequest { // The metadata which will be sent to SMS components. map metadata = 6; + } // Sms template @@ -48,17 +49,29 @@ message Template{ } -// SendSmsResponse is the reponse of the `SendSms` method. +// SendSmsResponse is the response of the `SendSms` method. message SendSmsWithTemplateResponse { + // The unique requestId. string request_id = 1; + // The status set of SMS + repeated SendStatus results = 2; + +} + +// Status contains more information about the response +message SendStatus { + // "OK" represents success. - string code = 2; + string code = 1; // The error message. - string message = 3; + string message = 2; + + // The send status metadata returned from SMS service. + // Includes `PhoneNumber`. + // `PhoneNumber`, is the phone number SMS send to. Supported by tencentcloud. + map metadata = 3; - // The metadata returned from SMS service. - map metadata = 4; } \ No newline at end of file
    FieldTypeLabelDescription
    code string
    metadataSendSmsWithTemplateResponse.MetadataEntrySendStatus.MetadataEntry repeated

    The metadata returned from SMS service.

    The send status metadata returned from SMS service. +Includes `PhoneNumber`. +`PhoneNumber`, is the phone number SMS send to. Supported by tencentcloud.