Implement start new chat API

This commit is contained in:
Tulir Asokan 2023-07-17 01:52:13 +03:00
parent 6602e6c937
commit db53aaf3e7
6 changed files with 923 additions and 777 deletions

File diff suppressed because it is too large Load diff

View file

@ -42,6 +42,8 @@ message ContactNumber {
message GetOrCreateConversationPayload { message GetOrCreateConversationPayload {
repeated ContactNumber numbers = 2; repeated ContactNumber numbers = 2;
optional string RCSGroupName = 3;
optional bool createRCSGroup = 4;
} }
message ResendMessagePayload { message ResendMessagePayload {

View file

@ -51,9 +51,13 @@ message ListTopContactsResponse {
} }
message GetOrCreateConversationResponse { message GetOrCreateConversationResponse {
enum Status {
UNKNOWN = 0;
SUCCESS = 1;
CREATE_RCS = 3;
}
conversations.Conversation conversation = 2; conversations.Conversation conversation = 2;
// uncertain, never seen any other value than 1 Status status = 3;
bool success = 3;
} }
message DeleteMessageResponse { message DeleteMessageResponse {

View file

@ -20,6 +20,55 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
) )
type GetOrCreateConversationResponse_Status int32
const (
GetOrCreateConversationResponse_UNKNOWN GetOrCreateConversationResponse_Status = 0
GetOrCreateConversationResponse_SUCCESS GetOrCreateConversationResponse_Status = 1
GetOrCreateConversationResponse_CREATE_RCS GetOrCreateConversationResponse_Status = 3
)
// Enum value maps for GetOrCreateConversationResponse_Status.
var (
GetOrCreateConversationResponse_Status_name = map[int32]string{
0: "UNKNOWN",
1: "SUCCESS",
3: "CREATE_RCS",
}
GetOrCreateConversationResponse_Status_value = map[string]int32{
"UNKNOWN": 0,
"SUCCESS": 1,
"CREATE_RCS": 3,
}
)
func (x GetOrCreateConversationResponse_Status) Enum() *GetOrCreateConversationResponse_Status {
p := new(GetOrCreateConversationResponse_Status)
*p = x
return p
}
func (x GetOrCreateConversationResponse_Status) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (GetOrCreateConversationResponse_Status) Descriptor() protoreflect.EnumDescriptor {
return file_responses_proto_enumTypes[0].Descriptor()
}
func (GetOrCreateConversationResponse_Status) Type() protoreflect.EnumType {
return &file_responses_proto_enumTypes[0]
}
func (x GetOrCreateConversationResponse_Status) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use GetOrCreateConversationResponse_Status.Descriptor instead.
func (GetOrCreateConversationResponse_Status) EnumDescriptor() ([]byte, []int) {
return file_responses_proto_rawDescGZIP(), []int{9, 0}
}
type ParticipantThumbnail struct { type ParticipantThumbnail struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -495,9 +544,8 @@ type GetOrCreateConversationResponse struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Conversation *Conversation `protobuf:"bytes,2,opt,name=conversation,proto3" json:"conversation,omitempty"` Conversation *Conversation `protobuf:"bytes,2,opt,name=conversation,proto3" json:"conversation,omitempty"`
// uncertain, never seen any other value than 1 Status GetOrCreateConversationResponse_Status `protobuf:"varint,3,opt,name=status,proto3,enum=responses.GetOrCreateConversationResponse_Status" json:"status,omitempty"`
Success bool `protobuf:"varint,3,opt,name=success,proto3" json:"success,omitempty"`
} }
func (x *GetOrCreateConversationResponse) Reset() { func (x *GetOrCreateConversationResponse) Reset() {
@ -539,11 +587,11 @@ func (x *GetOrCreateConversationResponse) GetConversation() *Conversation {
return nil return nil
} }
func (x *GetOrCreateConversationResponse) GetSuccess() bool { func (x *GetOrCreateConversationResponse) GetStatus() GetOrCreateConversationResponse_Status {
if x != nil { if x != nil {
return x.Success return x.Status
} }
return false return GetOrCreateConversationResponse_UNKNOWN
} }
type DeleteMessageResponse struct { type DeleteMessageResponse struct {
@ -1258,86 +1306,92 @@ var file_responses_proto_rawDesc = []byte{
0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x16, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x32, 0x16, 0x2e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63,
0x74, 0x73, 0x22, 0x7c, 0x0a, 0x1f, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x74, 0x73, 0x22, 0xe1, 0x01, 0x0a, 0x1f, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x43, 0x72, 0x65, 0x61,
0x65, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x6f, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63,
0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x6f, 0x6e,
0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x76, 0x65,
0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x49, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75,
0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x22, 0x31, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x73, 0x65, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43,
0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x63, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74,
0x65, 0x73, 0x73, 0x22, 0x36, 0x0a, 0x1a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x75, 0x73, 0x22, 0x32, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07,
0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43,
0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x43, 0x45, 0x53, 0x53, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45,
0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x5f, 0x52, 0x43, 0x53, 0x10, 0x03, 0x22, 0x31, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,
0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x63, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08,
0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x02, 0x20, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x36, 0x0a, 0x1a, 0x55, 0x70, 0x64,
0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52,
0x6e, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65,
0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73,
0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x12, 0x18, 0x0a, 0x73, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73,
0x07, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x32, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x32, 0x22, 0x1d, 0x0a, 0x1b, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f,
0x79, 0x44, 0x69, 0x74, 0x74, 0x6f, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x52, 0x65, 0x6e, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x76, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x32, 0x0a, 0x16, 0x49, 0x73, 0x42, 0x75, 0x67, 0x6c, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70,
0x65, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a,
0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x31, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f,
0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x40, 0x0a, 0x12, 0x47, 0x65, 0x6f, 0x6c, 0x31, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x32, 0x18, 0x06,
0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x32, 0x22, 0x1d, 0x0a,
0x12, 0x2a, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x1b, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x44, 0x69, 0x74, 0x74, 0x6f, 0x41, 0x63, 0x74, 0x69,
0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x6c, 0x65, 0x72, 0x76, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x32, 0x0a, 0x16,
0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x29, 0x0a, 0x13, 0x49, 0x73, 0x42, 0x75, 0x67, 0x6c, 0x65, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x65,
0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73,
0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73,
0x03, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x91, 0x01, 0x0a, 0x19, 0x52, 0x65, 0x66, 0x72, 0x22, 0x40, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65,
0x65, 0x73, 0x68, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x06,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x0b, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x55, 0x73,
0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x04, 0x64, 0x61,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x74, 0x61, 0x22, 0x29, 0x0a, 0x13, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0b, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70,
0x6e, 0x61, 0x74, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x69, 0x72, 0x4b, 0x65, 0x79, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x91, 0x01,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x69, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x0a, 0x19, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x52, 0x65,
0x1a, 0x0a, 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x46, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x0b, 0x63,
0x03, 0x52, 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x46, 0x6f, 0x72, 0x22, 0x6c, 0x0a, 0x18, 0x57, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
0x65, 0x62, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x52, 0x32, 0x1c, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x6f,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x0b, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0b,
0x69, 0x6e, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x70,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x69, 0x72, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61,
0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0b, 0x63, 0x6f, 0x6f, 0x72, 0x69, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x46, 0x6f,
0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x46, 0x6f,
0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x9e, 0x02, 0x0a, 0x1a, 0x52, 0x65, 0x72, 0x22, 0x6c, 0x0a, 0x18, 0x57, 0x65, 0x62, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69,
0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x0b, 0x63, 0x6f, 0x6f, 0x72, 0x0b, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01,
0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x2e, 0x43,
0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x6e, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0b, 0x63, 0x6f, 0x6f, 0x52, 0x0b, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x73, 0x12, 0x10, 0x0a,
0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x07, 0x62, 0x72, 0x6f, 0x77, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22,
0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x9e, 0x02, 0x0a, 0x1a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x68, 0x6f, 0x6e,
0x61, 0x67, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x07, 0x62, 0x72, 0x6f, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e,
0x77, 0x73, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x4b, 0x0a, 0x0b, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20,
0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x70, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x2e,
0x67, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x46, 0x6f, 0x72, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x46, 0x6f, 0x72, 0x65, 0x52, 0x0b, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x73, 0x12, 0x2a,
0x12, 0x38, 0x0a, 0x0b, 0x61, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x44, 0x61, 0x74, 0x61, 0x18, 0x0a, 0x07, 0x62, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x10, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63,
0x73, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0b, 0x61, 0x65, 0x52, 0x07, 0x62, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x61,
0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x49, 0x44, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x61, 0x69, 0x72, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x76, 0x61,
0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x49, 0x44, 0x22, 0x2b, 0x0a, 0x11, 0x43, 0x6f, 0x6c, 0x69, 0x64, 0x46, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x76, 0x61,
0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x6c, 0x69, 0x64, 0x46, 0x6f, 0x72, 0x12, 0x38, 0x0a, 0x0b, 0x61, 0x75, 0x74, 0x68, 0x4b, 0x65,
0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x31, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x79, 0x44, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x72, 0x65,
0x06, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x31, 0x22, 0x55, 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x44,
0x65, 0x79, 0x44, 0x61, 0x74, 0x61, 0x12, 0x2a, 0x0a, 0x10, 0x74, 0x61, 0x63, 0x68, 0x79, 0x6f, 0x61, 0x74, 0x61, 0x52, 0x0b, 0x61, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x44, 0x61, 0x74, 0x61,
0x6e, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x49, 0x44, 0x18, 0x06,
0x52, 0x10, 0x74, 0x61, 0x63, 0x68, 0x79, 0x6f, 0x6e, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x49, 0x44,
0x65, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x46, 0x6f, 0x72, 0x18, 0x02, 0x22, 0x2b, 0x0a, 0x11, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x4d, 0x65,
0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x46, 0x6f, 0x72, 0x42, 0x0e, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x31, 0x18,
0x5a, 0x0c, 0x2e, 0x2e, 0x2f, 0x2e, 0x2e, 0x2f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x62, 0x06, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x31, 0x22, 0x55, 0x0a,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x44, 0x61, 0x74, 0x61, 0x12, 0x2a, 0x0a, 0x10,
0x74, 0x61, 0x63, 0x68, 0x79, 0x6f, 0x6e, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x74, 0x61, 0x63, 0x68, 0x79, 0x6f, 0x6e, 0x41,
0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x76, 0x61, 0x6c, 0x69,
0x64, 0x46, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x76, 0x61, 0x6c, 0x69,
0x64, 0x46, 0x6f, 0x72, 0x42, 0x0e, 0x5a, 0x0c, 0x2e, 0x2e, 0x2f, 0x2e, 0x2e, 0x2f, 0x62, 0x69,
0x6e, 0x61, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -1352,59 +1406,62 @@ func file_responses_proto_rawDescGZIP() []byte {
return file_responses_proto_rawDescData return file_responses_proto_rawDescData
} }
var file_responses_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_responses_proto_msgTypes = make([]protoimpl.MessageInfo, 22) var file_responses_proto_msgTypes = make([]protoimpl.MessageInfo, 22)
var file_responses_proto_goTypes = []interface{}{ var file_responses_proto_goTypes = []interface{}{
(*ParticipantThumbnail)(nil), // 0: responses.ParticipantThumbnail (GetOrCreateConversationResponse_Status)(0), // 0: responses.GetOrCreateConversationResponse.Status
(*Thumbnail)(nil), // 1: responses.Thumbnail (*ParticipantThumbnail)(nil), // 1: responses.ParticipantThumbnail
(*ThumbnailData)(nil), // 2: responses.ThumbnailData (*Thumbnail)(nil), // 2: responses.Thumbnail
(*RegisterRefreshResponse)(nil), // 3: responses.RegisterRefreshResponse (*ThumbnailData)(nil), // 3: responses.ThumbnailData
(*RevokeRelayPairingResponse)(nil), // 4: responses.RevokeRelayPairingResponse (*RegisterRefreshResponse)(nil), // 4: responses.RegisterRefreshResponse
(*RefreshAuthData)(nil), // 5: responses.RefreshAuthData (*RevokeRelayPairingResponse)(nil), // 5: responses.RevokeRelayPairingResponse
(*FetchMessagesResponse)(nil), // 6: responses.FetchMessagesResponse (*RefreshAuthData)(nil), // 6: responses.RefreshAuthData
(*ListContactsResponse)(nil), // 7: responses.ListContactsResponse (*FetchMessagesResponse)(nil), // 7: responses.FetchMessagesResponse
(*ListTopContactsResponse)(nil), // 8: responses.ListTopContactsResponse (*ListContactsResponse)(nil), // 8: responses.ListContactsResponse
(*GetOrCreateConversationResponse)(nil), // 9: responses.GetOrCreateConversationResponse (*ListTopContactsResponse)(nil), // 9: responses.ListTopContactsResponse
(*DeleteMessageResponse)(nil), // 10: responses.DeleteMessageResponse (*GetOrCreateConversationResponse)(nil), // 10: responses.GetOrCreateConversationResponse
(*UpdateConversationResponse)(nil), // 11: responses.UpdateConversationResponse (*DeleteMessageResponse)(nil), // 11: responses.DeleteMessageResponse
(*GetConversationTypeResponse)(nil), // 12: responses.GetConversationTypeResponse (*UpdateConversationResponse)(nil), // 12: responses.UpdateConversationResponse
(*NotifyDittoActivityResponse)(nil), // 13: responses.NotifyDittoActivityResponse (*GetConversationTypeResponse)(nil), // 13: responses.GetConversationTypeResponse
(*IsBugleDefaultResponse)(nil), // 14: responses.IsBugleDefaultResponse (*NotifyDittoActivityResponse)(nil), // 14: responses.NotifyDittoActivityResponse
(*GetUpdatesResponse)(nil), // 15: responses.GetUpdatesResponse (*IsBugleDefaultResponse)(nil), // 15: responses.IsBugleDefaultResponse
(*SendMessageResponse)(nil), // 16: responses.SendMessageResponse (*GetUpdatesResponse)(nil), // 16: responses.GetUpdatesResponse
(*RefreshPhoneRelayResponse)(nil), // 17: responses.RefreshPhoneRelayResponse (*SendMessageResponse)(nil), // 17: responses.SendMessageResponse
(*WebEncryptionKeyResponse)(nil), // 18: responses.WebEncryptionKeyResponse (*RefreshPhoneRelayResponse)(nil), // 18: responses.RefreshPhoneRelayResponse
(*RegisterPhoneRelayResponse)(nil), // 19: responses.RegisterPhoneRelayResponse (*WebEncryptionKeyResponse)(nil), // 19: responses.WebEncryptionKeyResponse
(*CoordinateMessage)(nil), // 20: responses.CoordinateMessage (*RegisterPhoneRelayResponse)(nil), // 20: responses.RegisterPhoneRelayResponse
(*AuthKeyData)(nil), // 21: responses.AuthKeyData (*CoordinateMessage)(nil), // 21: responses.CoordinateMessage
(*Pixels)(nil), // 22: conversations.Pixels (*AuthKeyData)(nil), // 22: responses.AuthKeyData
(*Message)(nil), // 23: conversations.Message (*Pixels)(nil), // 23: conversations.Pixels
(*Cursor)(nil), // 24: conversations.Cursor (*Message)(nil), // 24: conversations.Message
(*Contact)(nil), // 25: conversations.Contact (*Cursor)(nil), // 25: conversations.Cursor
(*Conversation)(nil), // 26: conversations.Conversation (*Contact)(nil), // 26: conversations.Contact
(*UserAlertEvent)(nil), // 27: events.UserAlertEvent (*Conversation)(nil), // 27: conversations.Conversation
(*Device)(nil), // 28: messages.Device (*UserAlertEvent)(nil), // 28: events.UserAlertEvent
(*Device)(nil), // 29: messages.Device
} }
var file_responses_proto_depIdxs = []int32{ var file_responses_proto_depIdxs = []int32{
1, // 0: responses.ParticipantThumbnail.thumbnail:type_name -> responses.Thumbnail 2, // 0: responses.ParticipantThumbnail.thumbnail:type_name -> responses.Thumbnail
2, // 1: responses.Thumbnail.data:type_name -> responses.ThumbnailData 3, // 1: responses.Thumbnail.data:type_name -> responses.ThumbnailData
22, // 2: responses.ThumbnailData.pixels:type_name -> conversations.Pixels 23, // 2: responses.ThumbnailData.pixels:type_name -> conversations.Pixels
5, // 3: responses.RegisterRefreshResponse.tokenData:type_name -> responses.RefreshAuthData 6, // 3: responses.RegisterRefreshResponse.tokenData:type_name -> responses.RefreshAuthData
23, // 4: responses.FetchMessagesResponse.messages:type_name -> conversations.Message 24, // 4: responses.FetchMessagesResponse.messages:type_name -> conversations.Message
24, // 5: responses.FetchMessagesResponse.cursor:type_name -> conversations.Cursor 25, // 5: responses.FetchMessagesResponse.cursor:type_name -> conversations.Cursor
25, // 6: responses.ListContactsResponse.contacts:type_name -> conversations.Contact 26, // 6: responses.ListContactsResponse.contacts:type_name -> conversations.Contact
25, // 7: responses.ListTopContactsResponse.contacts:type_name -> conversations.Contact 26, // 7: responses.ListTopContactsResponse.contacts:type_name -> conversations.Contact
26, // 8: responses.GetOrCreateConversationResponse.conversation:type_name -> conversations.Conversation 27, // 8: responses.GetOrCreateConversationResponse.conversation:type_name -> conversations.Conversation
27, // 9: responses.GetUpdatesResponse.data:type_name -> events.UserAlertEvent 0, // 9: responses.GetOrCreateConversationResponse.status:type_name -> responses.GetOrCreateConversationResponse.Status
20, // 10: responses.RefreshPhoneRelayResponse.coordinates:type_name -> responses.CoordinateMessage 28, // 10: responses.GetUpdatesResponse.data:type_name -> events.UserAlertEvent
20, // 11: responses.WebEncryptionKeyResponse.coordinates:type_name -> responses.CoordinateMessage 21, // 11: responses.RefreshPhoneRelayResponse.coordinates:type_name -> responses.CoordinateMessage
20, // 12: responses.RegisterPhoneRelayResponse.coordinates:type_name -> responses.CoordinateMessage 21, // 12: responses.WebEncryptionKeyResponse.coordinates:type_name -> responses.CoordinateMessage
28, // 13: responses.RegisterPhoneRelayResponse.browser:type_name -> messages.Device 21, // 13: responses.RegisterPhoneRelayResponse.coordinates:type_name -> responses.CoordinateMessage
21, // 14: responses.RegisterPhoneRelayResponse.authKeyData:type_name -> responses.AuthKeyData 29, // 14: responses.RegisterPhoneRelayResponse.browser:type_name -> messages.Device
15, // [15:15] is the sub-list for method output_type 22, // 15: responses.RegisterPhoneRelayResponse.authKeyData:type_name -> responses.AuthKeyData
15, // [15:15] is the sub-list for method input_type 16, // [16:16] is the sub-list for method output_type
15, // [15:15] is the sub-list for extension type_name 16, // [16:16] is the sub-list for method input_type
15, // [15:15] is the sub-list for extension extendee 16, // [16:16] is the sub-list for extension type_name
0, // [0:15] is the sub-list for field type_name 16, // [16:16] is the sub-list for extension extendee
0, // [0:16] is the sub-list for field type_name
} }
func init() { file_responses_proto_init() } func init() { file_responses_proto_init() }
@ -1686,13 +1743,14 @@ func file_responses_proto_init() {
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_responses_proto_rawDesc, RawDescriptor: file_responses_proto_rawDesc,
NumEnums: 0, NumEnums: 1,
NumMessages: 22, NumMessages: 22,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },
GoTypes: file_responses_proto_goTypes, GoTypes: file_responses_proto_goTypes,
DependencyIndexes: file_responses_proto_depIdxs, DependencyIndexes: file_responses_proto_depIdxs,
EnumInfos: file_responses_proto_enumTypes,
MessageInfos: file_responses_proto_msgTypes, MessageInfos: file_responses_proto_msgTypes,
}.Build() }.Build()
File_responses_proto = out.File File_responses_proto = out.File

View file

@ -68,21 +68,10 @@ func (c *Client) ListTopContacts() (*binary.ListTopContactsResponse, error) {
return res, nil return res, nil
} }
func (c *Client) GetOrCreateConversation(numbers []string) (*binary.GetOrCreateConversationResponse, error) { func (c *Client) GetOrCreateConversation(req *binary.GetOrCreateConversationPayload) (*binary.GetOrCreateConversationResponse, error) {
contacts := make([]*binary.ContactNumber, len(numbers))
for i, number := range numbers {
contacts[i] = &binary.ContactNumber{
MysteriousInt: 7,
Number: number,
Number2: number,
}
}
payload := &binary.GetOrCreateConversationPayload{
Numbers: contacts,
}
actionType := binary.ActionType_GET_OR_CREATE_CONVERSATION actionType := binary.ActionType_GET_OR_CREATE_CONVERSATION
response, err := c.sessionHandler.sendMessage(actionType, payload) response, err := c.sessionHandler.sendMessage(actionType, req)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View file

@ -25,11 +25,14 @@ import (
"time" "time"
"github.com/rs/zerolog" "github.com/rs/zerolog"
"google.golang.org/protobuf/proto"
log "maunium.net/go/maulogger/v2" log "maunium.net/go/maulogger/v2"
"maunium.net/go/mautrix/bridge/status" "maunium.net/go/mautrix/bridge/status"
"maunium.net/go/mautrix/id" "maunium.net/go/mautrix/id"
"go.mau.fi/mautrix-gmessages/libgm/binary"
) )
type ProvisioningAPI struct { type ProvisioningAPI struct {
@ -169,14 +172,80 @@ func (prov *ProvisioningAPI) ListContacts(w http.ResponseWriter, r *http.Request
} }
} }
type StartChatRequest struct {
Numbers []string `json:"numbers"`
}
type StartChatResponse struct {
RoomID id.RoomID `json:"room_id"`
}
func (prov *ProvisioningAPI) StartChat(w http.ResponseWriter, r *http.Request) { func (prov *ProvisioningAPI) StartChat(w http.ResponseWriter, r *http.Request) {
if user := r.Context().Value("user").(*User); user.Client == nil { user := r.Context().Value("user").(*User)
if user.Client == nil {
jsonResponse(w, http.StatusBadRequest, Error{ jsonResponse(w, http.StatusBadRequest, Error{
Error: "User is not connected to Google Messages", Error: "User is not connected to Google Messages",
ErrCode: "no session", ErrCode: "no session",
}) })
} }
var req StartChatRequest
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
jsonResponse(w, http.StatusBadRequest, Error{
Error: "Failed to parse request JSON",
ErrCode: "bad json",
})
}
var reqData binary.GetOrCreateConversationPayload
reqData.Numbers = make([]*binary.ContactNumber, 0, len(req.Numbers))
for _, number := range req.Numbers {
reqData.Numbers = append(reqData.Numbers, &binary.ContactNumber{
// This should maybe sometimes be 7
MysteriousInt: 2,
Number: number,
Number2: number,
})
}
resp, err := user.Client.GetOrCreateConversation(&reqData)
if err != nil {
prov.zlog.Err(err).Msg("Failed to start chat")
jsonResponse(w, http.StatusInternalServerError, Error{
Error: "Failed to start chat",
ErrCode: "unknown error",
})
return
} else if resp.GetStatus() == binary.GetOrCreateConversationResponse_CREATE_RCS {
prov.zlog.Debug().Msg("Creating RCS group")
// TODO this will always create a new group and won't deduplicate
reqData.CreateRCSGroup = proto.Bool(true)
resp, err = user.Client.GetOrCreateConversation(&reqData)
if err != nil {
prov.zlog.Err(err).Msg("Failed to start RCS chat")
jsonResponse(w, http.StatusInternalServerError, Error{
Error: "Failed to start chat",
ErrCode: "unknown error",
})
return
}
}
if resp.GetConversation() == nil {
prov.zlog.Warn().Str("status", resp.GetStatus().String()).Msg("No conversation in chat create response")
jsonResponse(w, http.StatusInternalServerError, Error{
Error: "Failed to start chat",
ErrCode: "unknown error",
})
return
}
portal := user.GetPortalByID(resp.Conversation.ConversationID)
err = portal.CreateMatrixRoom(user, resp.Conversation)
if err != nil {
prov.zlog.Err(err).Msg("Failed to create matrix room")
jsonResponse(w, http.StatusInternalServerError, Error{
Error: "Failed to create matrix room",
ErrCode: "unknown error",
})
return
}
jsonResponse(w, http.StatusOK, StartChatResponse{portal.MXID})
} }
func (prov *ProvisioningAPI) Ping(w http.ResponseWriter, r *http.Request) { func (prov *ProvisioningAPI) Ping(w http.ResponseWriter, r *http.Request) {