diff --git a/src/client/client.go b/src/client/client.go index 569509e..ac33203 100644 --- a/src/client/client.go +++ b/src/client/client.go @@ -230,10 +230,12 @@ type ListInstalledStickerPacksResponse struct { } type ProfileBadge struct { - Id string `json:"id"` - Category string `json:"category"` - ExpirationTimestamp *int64 `json:"expiration_timestamp"` - Visible bool `json:"visible"` + Id string `json:"id"` + Category string `json:"category"` + // Milliseconds since the epoch. Signal only discloses this for the account's own profile, so it is null for other contacts. + ExpirationTimestamp *int64 `json:"expiration_timestamp" extensions:"x-nullable=true"` + // Signal only discloses this for the account's own profile, so it is false for other contacts, whose badges are always displayed ones. + Visible bool `json:"visible"` } type ContactProfile struct { diff --git a/src/client/contacts_test.go b/src/client/contacts_test.go index 1b64d07..69a5aa6 100644 --- a/src/client/contacts_test.go +++ b/src/client/contacts_test.go @@ -6,8 +6,9 @@ import ( ) // TestSignalCliProfileBadgesToProfileBadges verifies that the badges of signal-cli's -// `listContacts` output are carried through to the REST response, including badges -// without an expiration. +// `listContacts` output are carried through to the REST response, both in the shape +// of the account's own badge and of another contact's, which has no expiration and +// is reported as not visible. func TestSignalCliProfileBadgesToProfileBadges(t *testing.T) { const sampleBadgesJSON = `[ {"id": "BOOST", "category": "donor", "expirationTimestamp": 1767225600000, "visible": true}, diff --git a/src/docs/docs.go b/src/docs/docs.go index 4baf3bc..08fb1e6 100644 --- a/src/docs/docs.go +++ b/src/docs/docs.go @@ -1027,12 +1027,15 @@ const docTemplate = `{ "type": "string" }, "expiration_timestamp": { - "type": "integer" + "description": "Milliseconds since the epoch. Signal only discloses this for the account's own profile, so it is null for other contacts.", + "type": "integer", + "x-nullable": "true" }, "id": { "type": "string" }, "visible": { + "description": "Signal only discloses this for the account's own profile, so it is false for other contacts, whose badges are always displayed ones.", "type": "boolean" } }, diff --git a/src/docs/swagger.json b/src/docs/swagger.json index 1b51e28..e064372 100644 --- a/src/docs/swagger.json +++ b/src/docs/swagger.json @@ -1022,12 +1022,15 @@ "type": "string" }, "expiration_timestamp": { - "type": "integer" + "description": "Milliseconds since the epoch. Signal only discloses this for the account's own profile, so it is null for other contacts.", + "type": "integer", + "x-nullable": "true" }, "id": { "type": "string" }, "visible": { + "description": "Signal only discloses this for the account's own profile, so it is false for other contacts, whose badges are always displayed ones.", "type": "boolean" } },