Update protocol to call-signaling branch
This commit is contained in:
parent
9928e5ffc2
commit
4e7a2fe7c7
4 changed files with 161 additions and 5527 deletions
5525
protocol.json
5525
protocol.json
File diff suppressed because one or more lines are too long
|
@ -284,6 +284,13 @@ func mkerr(response client_protocol.BasicResponse) error {
|
|||
return err
|
||||
}
|
||||
return result
|
||||
case "UnsupportedGroupError":
|
||||
result := UnsupportedGroupError{}
|
||||
err := json.Unmarshal(response.Error, &result)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return result
|
||||
case "UntrustedIdentityError":
|
||||
result := UntrustedIdentityError{}
|
||||
err := json.Unmarshal(response.Error, &result)
|
||||
|
@ -645,6 +652,15 @@ func (e UnregisteredUserError) Error() string {
|
|||
return e.Message
|
||||
}
|
||||
|
||||
// UnsupportedGroupError: returned in response to use v1 groups, which are no longer supported
|
||||
type UnsupportedGroupError struct {
|
||||
Message string `json:"message,omitempty" yaml:"message,omitempty"`
|
||||
}
|
||||
|
||||
func (e UnsupportedGroupError) Error() string {
|
||||
return e.Message
|
||||
}
|
||||
|
||||
type UntrustedIdentityError struct {
|
||||
Identifier string `json:"identifier,omitempty" yaml:"identifier,omitempty"`
|
||||
IdentityKey **IdentityKey `json:"identity_key,omitempty" yaml:"identity_key,omitempty"`
|
||||
|
|
|
@ -98,6 +98,30 @@ func (r *AddServerRequest) Submit(conn *signald.Signald) (response string, err e
|
|||
|
||||
}
|
||||
|
||||
func (r *AnswerCallRequest) Submit(conn *signald.Signald) (err error) {
|
||||
r.Version = "v1"
|
||||
r.Type = "answer_call"
|
||||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
return
|
||||
}
|
||||
|
||||
return err
|
||||
|
||||
}
|
||||
|
||||
// Submit: approve a request to join a group
|
||||
func (r *ApproveMembershipRequest) Submit(conn *signald.Signald) (response JsonGroupV2Info, err error) {
|
||||
r.Version = "v1"
|
||||
|
@ -593,6 +617,30 @@ func (r *GroupLinkInfoRequest) Submit(conn *signald.Signald) (response JsonGroup
|
|||
|
||||
}
|
||||
|
||||
func (r *HangupCallRequest) Submit(conn *signald.Signald) (err error) {
|
||||
r.Version = "v1"
|
||||
r.Type = "hangup_call"
|
||||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
return
|
||||
}
|
||||
|
||||
return err
|
||||
|
||||
}
|
||||
|
||||
// Submit: Determine whether an account identifier is registered on the Signal service.
|
||||
func (r *IsIdentifierRegisteredRequest) Submit(conn *signald.Signald) (response BooleanMessage, err error) {
|
||||
r.Version = "v1"
|
||||
|
@ -1079,6 +1127,54 @@ func (r *SendRequest) Submit(conn *signald.Signald) (response SendResponse, err
|
|||
|
||||
}
|
||||
|
||||
func (r *SendCallOfferRequest) Submit(conn *signald.Signald) (err error) {
|
||||
r.Version = "v1"
|
||||
r.Type = "send_call_offer"
|
||||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
return
|
||||
}
|
||||
|
||||
return err
|
||||
|
||||
}
|
||||
|
||||
func (r *SendIceUpdatesRequest) Submit(conn *signald.Signald) (err error) {
|
||||
r.Version = "v1"
|
||||
r.Type = "send_ice_updates"
|
||||
if r.ID == "" {
|
||||
r.ID = signald.GenerateID()
|
||||
}
|
||||
responseChannel := conn.GetResponseListener(r.ID)
|
||||
defer conn.CloseResponseListener(r.ID)
|
||||
err = conn.RawRequest(r)
|
||||
if err != nil {
|
||||
log.Println("signald-go: error submitting request to signald")
|
||||
return
|
||||
}
|
||||
|
||||
rawResponse := <-responseChannel
|
||||
if rawResponse.Error != nil {
|
||||
err = mkerr(rawResponse)
|
||||
return
|
||||
}
|
||||
|
||||
return err
|
||||
|
||||
}
|
||||
|
||||
// Submit: send a mobilecoin payment
|
||||
func (r *SendPaymentRequest) Submit(conn *signald.Signald) (response SendResponse, err error) {
|
||||
r.Version = "v1"
|
||||
|
|
|
@ -49,6 +49,16 @@ type AllIdentityKeyList struct {
|
|||
IdentityKeys []*IdentityKeyList `json:"identity_keys,omitempty" yaml:"identity_keys,omitempty"`
|
||||
}
|
||||
|
||||
type AnswerCallRequest struct {
|
||||
Request
|
||||
Account string `json:"account,omitempty" yaml:"account,omitempty"` // the local account to use
|
||||
CallId int64 `json:"call_id,omitempty" yaml:"call_id,omitempty"` // the id of the call
|
||||
DestinationDeviceId int32 `json:"destination_device_id,omitempty" yaml:"destination_device_id,omitempty"`
|
||||
Multiring bool `json:"multiring,omitempty" yaml:"multiring,omitempty"`
|
||||
Recipient *JsonAddress `json:"recipient,omitempty" yaml:"recipient,omitempty"` // the address of the caller
|
||||
Sdp string `json:"sdp,omitempty" yaml:"sdp,omitempty"`
|
||||
}
|
||||
|
||||
type AnswerMessage struct {
|
||||
ID int64 `json:"id,omitempty" yaml:"id,omitempty"`
|
||||
Opaque string `json:"opaque,omitempty" yaml:"opaque,omitempty"`
|
||||
|
@ -263,7 +273,7 @@ type GroupLinkInfoRequest struct {
|
|||
|
||||
type GroupList struct {
|
||||
Groups []*JsonGroupV2Info `json:"groups,omitempty" yaml:"groups,omitempty"`
|
||||
LegacyGroups []*JsonGroupInfo `json:"legacyGroups,omitempty" yaml:"legacyGroups,omitempty"`
|
||||
LegacyGroups []*JsonGroupInfo `json:"legacyGroups,omitempty" yaml:"legacyGroups,omitempty"` // list of legacy (v1) groups, no longer supported (will always be empty)
|
||||
}
|
||||
|
||||
type GroupMember struct {
|
||||
|
@ -284,6 +294,17 @@ type GroupRequestingMember struct {
|
|||
UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
|
||||
}
|
||||
|
||||
type HangupCallRequest struct {
|
||||
Request
|
||||
Account string `json:"account,omitempty" yaml:"account,omitempty"` // the local account to use
|
||||
CallId int64 `json:"call_id,omitempty" yaml:"call_id,omitempty"` // the id of the call
|
||||
DestinationDeviceId int32 `json:"destination_device_id,omitempty" yaml:"destination_device_id,omitempty"`
|
||||
DeviceId int32 `json:"device_id,omitempty" yaml:"device_id,omitempty"`
|
||||
Multiring bool `json:"multiring,omitempty" yaml:"multiring,omitempty"`
|
||||
Recipient *JsonAddress `json:"recipient,omitempty" yaml:"recipient,omitempty"` // the address of the caller
|
||||
Type string `json:"type,omitempty" yaml:"type,omitempty"` // hangup type, options are: normal, accepted, declined, busy, need_permission
|
||||
}
|
||||
|
||||
type HangupMessage struct {
|
||||
DeviceId int32 `json:"device_id,omitempty" yaml:"device_id,omitempty"`
|
||||
ID int64 `json:"id,omitempty" yaml:"id,omitempty"`
|
||||
|
@ -293,7 +314,9 @@ type HangupMessage struct {
|
|||
|
||||
type IceUpdateMessage struct {
|
||||
ID int64 `json:"id,omitempty" yaml:"id,omitempty"`
|
||||
Opaque string `json:"opaque,omitempty" yaml:"opaque,omitempty"`
|
||||
Line int32 `json:"line,omitempty" yaml:"line,omitempty"`
|
||||
Mid string `json:"mid,omitempty" yaml:"mid,omitempty"`
|
||||
Opaque string `json:"opaque,omitempty" yaml:"opaque,omitempty"` // the base64 encoded protobuf value.
|
||||
Sdp string `json:"sdp,omitempty" yaml:"sdp,omitempty"`
|
||||
}
|
||||
|
||||
|
@ -492,6 +515,7 @@ type JsonSentTranscriptMessage struct {
|
|||
ExpirationStartTimestamp int64 `json:"expirationStartTimestamp,omitempty" yaml:"expirationStartTimestamp,omitempty"`
|
||||
IsRecipientUpdate bool `json:"isRecipientUpdate,omitempty" yaml:"isRecipientUpdate,omitempty"`
|
||||
Message *JsonDataMessage `json:"message,omitempty" yaml:"message,omitempty"`
|
||||
Story *StoryMessage `json:"story,omitempty" yaml:"story,omitempty"`
|
||||
Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"`
|
||||
UnidentifiedStatus map[string]string `json:"unidentifiedStatus,omitempty" yaml:"unidentifiedStatus,omitempty"`
|
||||
}
|
||||
|
@ -600,6 +624,7 @@ type Profile struct {
|
|||
Avatar string `json:"avatar,omitempty" yaml:"avatar,omitempty"` // path to avatar on local disk
|
||||
Capabilities *Capabilities `json:"capabilities,omitempty" yaml:"capabilities,omitempty"`
|
||||
Color string `json:"color,omitempty" yaml:"color,omitempty"` // color of the chat with this user
|
||||
ContactName string `json:"contact_name,omitempty" yaml:"contact_name,omitempty"` // The user's name from local contact names
|
||||
Emoji string `json:"emoji,omitempty" yaml:"emoji,omitempty"`
|
||||
ExpirationTime int32 `json:"expiration_time,omitempty" yaml:"expiration_time,omitempty"`
|
||||
InboxPosition int32 `json:"inbox_position,omitempty" yaml:"inbox_position,omitempty"`
|
||||
|
@ -716,6 +741,26 @@ type ResolveAddressRequest struct {
|
|||
Partial *JsonAddress `json:"partial,omitempty" yaml:"partial,omitempty"` // The partial address, missing fields
|
||||
}
|
||||
|
||||
type SendCallOfferRequest struct {
|
||||
Request
|
||||
Account string `json:"account,omitempty" yaml:"account,omitempty"` // the local account to use
|
||||
CallId int64 `json:"call_id,omitempty" yaml:"call_id,omitempty"` // the id of the call
|
||||
CallType string `json:"call_type,omitempty" yaml:"call_type,omitempty"` // must be one of 'audio_call' or 'video_call'
|
||||
DestinationDeviceId int32 `json:"destination_device_id,omitempty" yaml:"destination_device_id,omitempty"`
|
||||
Multring bool `json:"multring,omitempty" yaml:"multring,omitempty"`
|
||||
Recipient *JsonAddress `json:"recipient,omitempty" yaml:"recipient,omitempty"` // the address of the caller
|
||||
Sdp string `json:"sdp,omitempty" yaml:"sdp,omitempty"`
|
||||
}
|
||||
|
||||
type SendIceUpdatesRequest struct {
|
||||
Request
|
||||
Account string `json:"account,omitempty" yaml:"account,omitempty"` // the local account to use
|
||||
DestinationDeviceId int32 `json:"destination_device_id,omitempty" yaml:"destination_device_id,omitempty"`
|
||||
Multiring bool `json:"multiring,omitempty" yaml:"multiring,omitempty"`
|
||||
Recipient *JsonAddress `json:"recipient,omitempty" yaml:"recipient,omitempty"` // the address of the caller
|
||||
Updates []*IceUpdateMessage `json:"updates,omitempty" yaml:"updates,omitempty"`
|
||||
}
|
||||
|
||||
// SendPaymentRequest: send a mobilecoin payment
|
||||
type SendPaymentRequest struct {
|
||||
Request
|
||||
|
|
Loading…
Reference in a new issue