From f652d0777649d7846ec521ea0f087dbc262cadfb Mon Sep 17 00:00:00 2001 From: Markus Reinhold Date: Fri, 12 Dec 2025 18:43:38 +0100 Subject: [PATCH] Add WriteMessage --- go/chat/v1/gamingplatform.go | 2 + go/chat/v1/messaging.pb.go | 128 ++++++++++++++- php/GamingPlatform/Api/Chat/V1/ChatV1.php | 20 +++ .../Api/Chat/V1/ChatV1Factory.php | 22 +++ .../Api/Chat/V1/WriteMessage.php | 150 ++++++++++++++++++ .../Api/Chat/V1/WriteMessageResponse.php | 31 ++++ .../Api/GPBMetadata/Chat/V1/Messaging.php | 10 +- .../api/chat/v1/messaging.proto | 12 ++ 8 files changed, 366 insertions(+), 9 deletions(-) create mode 100644 php/GamingPlatform/Api/Chat/V1/WriteMessage.php create mode 100644 php/GamingPlatform/Api/Chat/V1/WriteMessageResponse.php diff --git a/go/chat/v1/gamingplatform.go b/go/chat/v1/gamingplatform.go index afb83a4..c3709bc 100644 --- a/go/chat/v1/gamingplatform.go +++ b/go/chat/v1/gamingplatform.go @@ -5,3 +5,5 @@ package chatv1 const InitiateChatType = "Chat.InitiateChat.v1" const InitiateChatResponseType = "Chat.InitiateChatResponse.v1" const MessageWrittenType = "Chat.MessageWritten.v1" +const WriteMessageType = "Chat.WriteMessage.v1" +const WriteMessageResponseType = "Chat.WriteMessageResponse.v1" diff --git a/go/chat/v1/messaging.pb.go b/go/chat/v1/messaging.pb.go index 9d102a2..fea6e0d 100644 --- a/go/chat/v1/messaging.pb.go +++ b/go/chat/v1/messaging.pb.go @@ -133,6 +133,112 @@ func (x *InitiateChatResponse) GetCorrelationId() string { return "" } +type WriteMessage struct { + state protoimpl.MessageState `protogen:"open.v1"` + // This applies per author within a chat. + // Don't set if no idempotency is needed. + IdempotencyKey string `protobuf:"bytes,1,opt,name=idempotency_key,json=idempotencyKey,proto3" json:"idempotency_key,omitempty"` + ChatId string `protobuf:"bytes,2,opt,name=chat_id,json=chatId,proto3" json:"chat_id,omitempty"` + AuthorId string `protobuf:"bytes,3,opt,name=author_id,json=authorId,proto3" json:"author_id,omitempty"` + Message string `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WriteMessage) Reset() { + *x = WriteMessage{} + mi := &file_gamingplatform_api_chat_v1_messaging_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WriteMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WriteMessage) ProtoMessage() {} + +func (x *WriteMessage) ProtoReflect() protoreflect.Message { + mi := &file_gamingplatform_api_chat_v1_messaging_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 WriteMessage.ProtoReflect.Descriptor instead. +func (*WriteMessage) Descriptor() ([]byte, []int) { + return file_gamingplatform_api_chat_v1_messaging_proto_rawDescGZIP(), []int{2} +} + +func (x *WriteMessage) GetIdempotencyKey() string { + if x != nil { + return x.IdempotencyKey + } + return "" +} + +func (x *WriteMessage) GetChatId() string { + if x != nil { + return x.ChatId + } + return "" +} + +func (x *WriteMessage) GetAuthorId() string { + if x != nil { + return x.AuthorId + } + return "" +} + +func (x *WriteMessage) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type WriteMessageResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WriteMessageResponse) Reset() { + *x = WriteMessageResponse{} + mi := &file_gamingplatform_api_chat_v1_messaging_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WriteMessageResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WriteMessageResponse) ProtoMessage() {} + +func (x *WriteMessageResponse) ProtoReflect() protoreflect.Message { + mi := &file_gamingplatform_api_chat_v1_messaging_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 WriteMessageResponse.ProtoReflect.Descriptor instead. +func (*WriteMessageResponse) Descriptor() ([]byte, []int) { + return file_gamingplatform_api_chat_v1_messaging_proto_rawDescGZIP(), []int{3} +} + type MessageWritten struct { state protoimpl.MessageState `protogen:"open.v1"` ChatId string `protobuf:"bytes,1,opt,name=chat_id,json=chatId,proto3" json:"chat_id,omitempty"` @@ -147,7 +253,7 @@ type MessageWritten struct { func (x *MessageWritten) Reset() { *x = MessageWritten{} - mi := &file_gamingplatform_api_chat_v1_messaging_proto_msgTypes[2] + mi := &file_gamingplatform_api_chat_v1_messaging_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -159,7 +265,7 @@ func (x *MessageWritten) String() string { func (*MessageWritten) ProtoMessage() {} func (x *MessageWritten) ProtoReflect() protoreflect.Message { - mi := &file_gamingplatform_api_chat_v1_messaging_proto_msgTypes[2] + mi := &file_gamingplatform_api_chat_v1_messaging_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -172,7 +278,7 @@ func (x *MessageWritten) ProtoReflect() protoreflect.Message { // Deprecated: Use MessageWritten.ProtoReflect.Descriptor instead. func (*MessageWritten) Descriptor() ([]byte, []int) { - return file_gamingplatform_api_chat_v1_messaging_proto_rawDescGZIP(), []int{2} + return file_gamingplatform_api_chat_v1_messaging_proto_rawDescGZIP(), []int{4} } func (x *MessageWritten) GetChatId() string { @@ -221,7 +327,13 @@ const file_gamingplatform_api_chat_v1_messaging_proto_rawDesc = "" + "\aauthors\x18\x03 \x03(\tR\aauthors\"V\n" + "\x14InitiateChatResponse\x12\x17\n" + "\achat_id\x18\x01 \x01(\tR\x06chatId\x12%\n" + - "\x0ecorrelation_id\x18\x02 \x01(\tR\rcorrelationId\"\x9e\x01\n" + + "\x0ecorrelation_id\x18\x02 \x01(\tR\rcorrelationId\"\x87\x01\n" + + "\fWriteMessage\x12'\n" + + "\x0fidempotency_key\x18\x01 \x01(\tR\x0eidempotencyKey\x12\x17\n" + + "\achat_id\x18\x02 \x01(\tR\x06chatId\x12\x1b\n" + + "\tauthor_id\x18\x03 \x01(\tR\bauthorId\x12\x18\n" + + "\amessage\x18\x04 \x01(\tR\amessage\"\x16\n" + + "\x14WriteMessageResponse\"\x9e\x01\n" + "\x0eMessageWritten\x12\x17\n" + "\achat_id\x18\x01 \x01(\tR\x06chatId\x12\x1d\n" + "\n" + @@ -243,11 +355,13 @@ func file_gamingplatform_api_chat_v1_messaging_proto_rawDescGZIP() []byte { return file_gamingplatform_api_chat_v1_messaging_proto_rawDescData } -var file_gamingplatform_api_chat_v1_messaging_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_gamingplatform_api_chat_v1_messaging_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_gamingplatform_api_chat_v1_messaging_proto_goTypes = []any{ (*InitiateChat)(nil), // 0: gamingplatform.api.chat.v1.InitiateChat (*InitiateChatResponse)(nil), // 1: gamingplatform.api.chat.v1.InitiateChatResponse - (*MessageWritten)(nil), // 2: gamingplatform.api.chat.v1.MessageWritten + (*WriteMessage)(nil), // 2: gamingplatform.api.chat.v1.WriteMessage + (*WriteMessageResponse)(nil), // 3: gamingplatform.api.chat.v1.WriteMessageResponse + (*MessageWritten)(nil), // 4: gamingplatform.api.chat.v1.MessageWritten } var file_gamingplatform_api_chat_v1_messaging_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type @@ -268,7 +382,7 @@ func file_gamingplatform_api_chat_v1_messaging_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_gamingplatform_api_chat_v1_messaging_proto_rawDesc), len(file_gamingplatform_api_chat_v1_messaging_proto_rawDesc)), NumEnums: 0, - NumMessages: 3, + NumMessages: 5, NumExtensions: 0, NumServices: 0, }, diff --git a/php/GamingPlatform/Api/Chat/V1/ChatV1.php b/php/GamingPlatform/Api/Chat/V1/ChatV1.php index fc6d18e..d982818 100644 --- a/php/GamingPlatform/Api/Chat/V1/ChatV1.php +++ b/php/GamingPlatform/Api/Chat/V1/ChatV1.php @@ -38,4 +38,24 @@ public static function createMessageWritten( if ($data !== null) $message->mergeFromString($data); return $message; } + public const string WriteMessageType = 'Chat.WriteMessage.v1'; + public static function createWriteMessage( + ?string $data = null + ): WriteMessage { + static $template; + $template ??= new WriteMessage(); + $message = clone $template; + if ($data !== null) $message->mergeFromString($data); + return $message; + } + public const string WriteMessageResponseType = 'Chat.WriteMessageResponse.v1'; + public static function createWriteMessageResponse( + ?string $data = null + ): WriteMessageResponse { + static $template; + $template ??= new WriteMessageResponse(); + $message = clone $template; + if ($data !== null) $message->mergeFromString($data); + return $message; + } } diff --git a/php/GamingPlatform/Api/Chat/V1/ChatV1Factory.php b/php/GamingPlatform/Api/Chat/V1/ChatV1Factory.php index 5419e3b..347d6e1 100644 --- a/php/GamingPlatform/Api/Chat/V1/ChatV1Factory.php +++ b/php/GamingPlatform/Api/Chat/V1/ChatV1Factory.php @@ -42,4 +42,26 @@ public static function createMessageWritten( return $message; } + /** @deprecated */ + public static function createWriteMessage( + string $data + ): \GamingPlatform\Api\Chat\V1\WriteMessage { + static $template; + $template ??= new \GamingPlatform\Api\Chat\V1\WriteMessage(); + $message = clone $template; + $message->mergeFromString($data); + return $message; + } + + /** @deprecated */ + public static function createWriteMessageResponse( + string $data + ): \GamingPlatform\Api\Chat\V1\WriteMessageResponse { + static $template; + $template ??= new \GamingPlatform\Api\Chat\V1\WriteMessageResponse(); + $message = clone $template; + $message->mergeFromString($data); + return $message; + } + } diff --git a/php/GamingPlatform/Api/Chat/V1/WriteMessage.php b/php/GamingPlatform/Api/Chat/V1/WriteMessage.php new file mode 100644 index 0000000..a10670e --- /dev/null +++ b/php/GamingPlatform/Api/Chat/V1/WriteMessage.php @@ -0,0 +1,150 @@ +gamingplatform.api.chat.v1.WriteMessage + */ +class WriteMessage extends \Google\Protobuf\Internal\Message +{ + /** + * This applies per author within a chat. + * Don't set if no idempotency is needed. + * + * Generated from protobuf field string idempotency_key = 1; + */ + protected $idempotency_key = ''; + /** + * Generated from protobuf field string chat_id = 2; + */ + protected $chat_id = ''; + /** + * Generated from protobuf field string author_id = 3; + */ + protected $author_id = ''; + /** + * Generated from protobuf field string message = 4; + */ + protected $message = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $idempotency_key + * This applies per author within a chat. + * Don't set if no idempotency is needed. + * @type string $chat_id + * @type string $author_id + * @type string $message + * } + */ + public function __construct($data = NULL) { + \GamingPlatform\Api\GPBMetadata\Chat\V1\Messaging::initOnce(); + parent::__construct($data); + } + + /** + * This applies per author within a chat. + * Don't set if no idempotency is needed. + * + * Generated from protobuf field string idempotency_key = 1; + * @return string + */ + public function getIdempotencyKey() + { + return $this->idempotency_key; + } + + /** + * This applies per author within a chat. + * Don't set if no idempotency is needed. + * + * Generated from protobuf field string idempotency_key = 1; + * @param string $var + * @return $this + */ + public function setIdempotencyKey($var) + { + GPBUtil::checkString($var, True); + $this->idempotency_key = $var; + + return $this; + } + + /** + * Generated from protobuf field string chat_id = 2; + * @return string + */ + public function getChatId() + { + return $this->chat_id; + } + + /** + * Generated from protobuf field string chat_id = 2; + * @param string $var + * @return $this + */ + public function setChatId($var) + { + GPBUtil::checkString($var, True); + $this->chat_id = $var; + + return $this; + } + + /** + * Generated from protobuf field string author_id = 3; + * @return string + */ + public function getAuthorId() + { + return $this->author_id; + } + + /** + * Generated from protobuf field string author_id = 3; + * @param string $var + * @return $this + */ + public function setAuthorId($var) + { + GPBUtil::checkString($var, True); + $this->author_id = $var; + + return $this; + } + + /** + * Generated from protobuf field string message = 4; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Generated from protobuf field string message = 4; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + +} + diff --git a/php/GamingPlatform/Api/Chat/V1/WriteMessageResponse.php b/php/GamingPlatform/Api/Chat/V1/WriteMessageResponse.php new file mode 100644 index 0000000..e63bdd1 --- /dev/null +++ b/php/GamingPlatform/Api/Chat/V1/WriteMessageResponse.php @@ -0,0 +1,31 @@ +gamingplatform.api.chat.v1.WriteMessageResponse + */ +class WriteMessageResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GamingPlatform\Api\GPBMetadata\Chat\V1\Messaging::initOnce(); + parent::__construct($data); + } + +} + diff --git a/php/GamingPlatform/Api/GPBMetadata/Chat/V1/Messaging.php b/php/GamingPlatform/Api/GPBMetadata/Chat/V1/Messaging.php index 65ea638..5356470 100644 --- a/php/GamingPlatform/Api/GPBMetadata/Chat/V1/Messaging.php +++ b/php/GamingPlatform/Api/GPBMetadata/Chat/V1/Messaging.php @@ -16,7 +16,7 @@ public static function initOnce() { } $pool->internalAddGeneratedFile( ' -Ì +Â *gamingplatform/api/chat/v1/messaging.protogamingplatform.api.chat.v1"P InitiateChat idempotency_key (  @@ -24,7 +24,13 @@ public static function initOnce() { authors ( "? InitiateChatResponse chat_id (  -correlation_id ( "m +correlation_id ( "\\ + WriteMessage +idempotency_key (  +chat_id (  + author_id (  +message ( " +WriteMessageResponse"m MessageWritten chat_id (  diff --git a/schema/gamingplatform/api/chat/v1/messaging.proto b/schema/gamingplatform/api/chat/v1/messaging.proto index cfd36c4..0413603 100644 --- a/schema/gamingplatform/api/chat/v1/messaging.proto +++ b/schema/gamingplatform/api/chat/v1/messaging.proto @@ -17,6 +17,18 @@ message InitiateChatResponse { string correlation_id = 2; } +message WriteMessage { + // This applies per author within a chat. + // Don't set if no idempotency is needed. + string idempotency_key = 1; + string chat_id = 2; + string author_id = 3; + string message = 4; +} + +message WriteMessageResponse { +} + message MessageWritten { string chat_id = 1; string message_id = 2;