From 80a6cc017aac55553d64f32ac9b349458f8569e9 Mon Sep 17 00:00:00 2001 From: Finn Date: Thu, 18 Feb 2021 17:52:50 -0800 Subject: [PATCH] Update protocol --- protocol.json | 40 ++++++++++++++++---------- signald/client-protocol/v1/requests.go | 2 +- signald/client-protocol/v1/structs.go | 5 ++++ 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/protocol.json b/protocol.json index 055f8d9..3281fa0 100644 --- a/protocol.json +++ b/protocol.json @@ -2,9 +2,9 @@ "doc_version": "v1", "version": { "name": "signald", - "version": "0.12.0+git2021-02-18r64bd433c.35", + "version": "0.12.0+git2021-02-18r577f6d0f.36", "branch": "main", - "commit": "64bd433c25d9f66523171d53aa7a26ec921a6473" + "commit": "577f6d0f076466fe6006fea2e99c53519531830b" }, "info": "This document describes objects that may be used when communicating with signald.", "types": { @@ -34,7 +34,7 @@ }, "timestamp": { "type": "long", - "example": "1613632213480" + "example": "1613676833495" }, "timestampISO": { "type": "String" @@ -44,7 +44,7 @@ }, "serverDeliveredTimestamp": { "type": "long", - "example": "161363221348080" + "example": "161367683349580" }, "hasLegacyMessage": { "type": "boolean" @@ -124,7 +124,7 @@ }, "timestamp": { "type": "long", - "example": "1613632213480" + "example": "1613676833495" } } }, @@ -165,7 +165,7 @@ }, "version": { "type": "String", - "example": "\"0.12.0+git2021-02-18r64bd433c.35\"" + "example": "\"0.12.0+git2021-02-18r577f6d0f.36\"" }, "branch": { "type": "String", @@ -173,7 +173,7 @@ }, "commit": { "type": "String", - "example": "\"64bd433c25d9f66523171d53aa7a26ec921a6473\"" + "example": "\"577f6d0f076466fe6006fea2e99c53519531830b\"" } } }, @@ -517,7 +517,7 @@ "list": true, "type": "Long", "doc": "List of messages to mark as read", - "example": "1613632213480", + "example": "1613676833495", "required": true } } @@ -673,6 +673,16 @@ "fields": {}, "doc": "Generate a linking URI. Typically this is QR encoded and scanned by the primary device. Submit the returned session_id with a finish_link request." }, + "LinkingURI": { + "fields": { + "uri": { + "type": "String" + }, + "session_id": { + "type": "String" + } + } + }, "FinishLinkRequest": { "fields": { "device_name": { @@ -706,7 +716,7 @@ "timestamp": { "type": "long", "doc": "the timestamp that the message was sent at, according to the sender's device. This is used to uniquely identify this message for things like reactions and quotes.", - "example": "1613632213480" + "example": "1613676833495" }, "attachments": { "list": true, @@ -843,7 +853,7 @@ "id": { "type": "long", "doc": "the client timestamp of the message being quoted", - "example": "1613632213480" + "example": "1613676833495" }, "author": { "type": "JsonAddress", @@ -931,7 +941,7 @@ "targetSentTimestamp": { "type": "long", "doc": "the client timestamp of the message being reacted to", - "example": "1613632213480" + "example": "1613676833495" } } }, @@ -1011,7 +1021,7 @@ }, "timestamp": { "type": "long", - "example": "1613632213480" + "example": "1613676833495" }, "expirationStartTimestamp": { "type": "long" @@ -1049,7 +1059,7 @@ }, "timestamp": { "type": "long", - "example": "1613632213480" + "example": "1613676833495" } } }, @@ -1061,7 +1071,7 @@ }, "timestamp": { "type": "long", - "example": "1613632213480" + "example": "1613676833495" } } }, @@ -1838,7 +1848,7 @@ }, "generate_linking_uri": { "request": "GenerateLinkingURIRequest", - "response": "String", + "response": "LinkingURI", "doc": "Generate a linking URI. Typically this is QR encoded and scanned by the primary device. Submit the returned session_id with a finish_link request." }, "finish_link": { diff --git a/signald/client-protocol/v1/requests.go b/signald/client-protocol/v1/requests.go index 62f39b8..56970d7 100644 --- a/signald/client-protocol/v1/requests.go +++ b/signald/client-protocol/v1/requests.go @@ -141,7 +141,7 @@ func (r *FinishLinkRequest) Submit(conn *signald.Signald) (response Account, err } // Submit: Generate a linking URI. Typically this is QR encoded and scanned by the primary device. Submit the returned session_id with a finish_link request. -func (r *GenerateLinkingURIRequest) Submit(conn *signald.Signald) (response string, err error) { +func (r *GenerateLinkingURIRequest) Submit(conn *signald.Signald) (response LinkingURI, err error) { r.Version = "v1" r.Type = "generate_linking_uri" if r.ID == "" { diff --git a/signald/client-protocol/v1/structs.go b/signald/client-protocol/v1/structs.go index afc6aad..8a613d2 100644 --- a/signald/client-protocol/v1/structs.go +++ b/signald/client-protocol/v1/structs.go @@ -292,6 +292,11 @@ type LinkedDevices struct { Devices []*v0.DeviceInfo `json:"devices,omitempty" yaml:"devices,omitempty"` } +type LinkingURI struct { + SessionId string `json:"session_id,omitempty" yaml:"session_id,omitempty"` + Uri string `json:"uri,omitempty" yaml:"uri,omitempty"` +} + type ListContactsRequest struct { Request Account string `json:"account,omitempty" yaml:"account,omitempty"`