diff --git a/Dockerfile b/Dockerfile index e80bec1..00d66db 100644 --- a/Dockerfile +++ b/Dockerfile @@ -142,7 +142,7 @@ COPY src/plugin_loader.go /tmp/signal-cli-rest-api-src/ # build signal-cli-rest-api RUN ls -la /tmp/signal-cli-rest-api-src -RUN cd /tmp/signal-cli-rest-api-src && ${GOPATH}/bin/swag init +RUN cd /tmp/signal-cli-rest-api-src && ${GOPATH}/bin/swag init --requiredByDefault RUN cd /tmp/signal-cli-rest-api-src && go build -o signal-cli-rest-api main.go RUN cd /tmp/signal-cli-rest-api-src && go test ./client -v && go test ./utils -v diff --git a/src/api/api.go b/src/api/api.go index daf7639..4123aaf 100644 --- a/src/api/api.go +++ b/src/api/api.go @@ -34,32 +34,32 @@ const ( type UpdateContactRequest struct { Recipient string `json:"recipient"` - Name *string `json:"name"` - ExpirationInSeconds *int `json:"expiration_in_seconds"` + Name *string `json:"name,omitempty"` + ExpirationInSeconds *int `json:"expiration_in_seconds,omitempty"` } type CreateGroupRequest struct { Name string `json:"name"` Members []string `json:"members"` - Description string `json:"description"` - Permissions ds.GroupPermissions `json:"permissions"` - GroupLinkState string `json:"group_link" enums:"disabled,enabled,enabled-with-approval"` - ExpirationTime *int `json:"expiration_time"` + Description string `json:"description,omitempty"` + Permissions ds.GroupPermissions `json:"permissions,omitempty"` + GroupLinkState string `json:"group_link,omitempty" enums:"disabled,enabled,enabled-with-approval"` + ExpirationTime *int `json:"expiration_time,omitempty"` } type UpdateGroupRequest struct { - Base64Avatar *string `json:"base64_avatar"` - Description *string `json:"description"` - Name *string `json:"name"` - ExpirationTime *int `json:"expiration_time"` - GroupLinkState *string `json:"group_link" enums:"disabled,enabled,enabled-with-approval"` - Permissions *ds.GroupPermissions `json:"permissions"` + Base64Avatar *string `json:"base64_avatar,omitempty"` + Description *string `json:"description,omitempty"` + Name *string `json:"name,omitempty"` + ExpirationTime *int `json:"expiration_time,omitempty"` + GroupLinkState *string `json:"group_link,omitempty" enums:"disabled,enabled,enabled-with-approval"` + Permissions *ds.GroupPermissions `json:"permissions,omitempty"` } type PinMessageInGroupRequest struct { TargetAuthor string `json:"target_author"` Timestamp int64 `json:"timestamp"` - Duration *int `json:"duration"` + Duration *int `json:"duration,omitempty"` } type UnpinMessageInGroupRequest struct { @@ -84,17 +84,17 @@ type Configuration struct { } type RegisterNumberRequest struct { - UseVoice bool `json:"use_voice"` - Captcha string `json:"captcha"` + UseVoice bool `json:"use_voice,omitempty"` + Captcha string `json:"captcha,omitempty"` } type UnregisterNumberRequest struct { - DeleteAccount bool `json:"delete_account" example:"false"` - DeleteLocalData bool `json:"delete_local_data" example:"false"` + DeleteAccount bool `json:"delete_account,omitempty" example:"false"` + DeleteLocalData bool `json:"delete_local_data,omitempty" example:"false"` } type VerifyNumberSettings struct { - Pin string `json:"pin"` + Pin string `json:"pin,omitempty"` } type Reaction struct { @@ -114,27 +114,27 @@ type SendMessageV1 struct { Number string `json:"number"` Recipients []string `json:"recipients"` Message string `json:"message"` - Base64Attachment string `json:"base64_attachment" example:"'' OR 'data:;base64,' OR 'data:;filename=;base64,'"` - IsGroup bool `json:"is_group"` + Base64Attachment string `json:"base64_attachment,omitempty" example:"'' OR 'data:;base64,' OR 'data:;filename=;base64,'"` + IsGroup bool `json:"is_group,omitempty"` } type SendMessageV2 struct { Number string `json:"number"` Recipients []string `json:"recipients"` - Recipient string `json:"recipient" swaggerignore:"true"` //some REST API consumers (like the Synology NAS) do not support an array as recipients, so we provide this string parameter here as backup. In order to not confuse anyone, the parameter won't be exposed in the Swagger UI (most users are fine with the recipients parameter). + Recipient string `json:"recipient,omitempty" swaggerignore:"true"` //some REST API consumers (like the Synology NAS) do not support an array as recipients, so we provide this string parameter here as backup. In order to not confuse anyone, the parameter won't be exposed in the Swagger UI (most users are fine with the recipients parameter). Message string `json:"message"` - Base64Attachments []string `json:"base64_attachments" example:",data:;base64,data:;filename=;base64"` - Sticker string `json:"sticker"` - Mentions []ds.MessageMention `json:"mentions"` - QuoteTimestamp *int64 `json:"quote_timestamp"` - QuoteAuthor *string `json:"quote_author"` - QuoteMessage *string `json:"quote_message"` - QuoteMentions []ds.MessageMention `json:"quote_mentions"` - TextMode *string `json:"text_mode" enums:"normal,styled"` - EditTimestamp *int64 `json:"edit_timestamp"` - NotifySelf *bool `json:"notify_self"` - LinkPreview *ds.LinkPreviewType `json:"link_preview"` - ViewOnce *bool `json:"view_once"` + Base64Attachments []string `json:"base64_attachments,omitempty" example:",data:;base64,data:;filename=;base64"` + Sticker string `json:"sticker,omitempty"` + Mentions []ds.MessageMention `json:"mentions,omitempty"` + QuoteTimestamp *int64 `json:"quote_timestamp,omitempty"` + QuoteAuthor *string `json:"quote_author,omitempty"` + QuoteMessage *string `json:"quote_message,omitempty"` + QuoteMentions []ds.MessageMention `json:"quote_mentions,omitempty"` + TextMode *string `json:"text_mode,omitempty" enums:"normal,styled"` + EditTimestamp *int64 `json:"edit_timestamp,omitempty"` + NotifySelf *bool `json:"notify_self,omitempty"` + LinkPreview *ds.LinkPreviewType `json:"link_preview,omitempty"` + ViewOnce *bool `json:"view_once,omitempty"` } type TypingIndicatorRequest struct { @@ -157,13 +157,13 @@ type CreateGroupResponse struct { type UpdateProfileRequest struct { Name string `json:"name"` - Base64Avatar string `json:"base64_avatar"` - About *string `json:"about"` + Base64Avatar string `json:"base64_avatar,omitempty"` + About *string `json:"about,omitempty"` } type TrustIdentityRequest struct { - VerifiedSafetyNumber *string `json:"verified_safety_number"` - TrustAllKnownKeys *bool `json:"trust_all_known_keys" example:"false"` + VerifiedSafetyNumber *string `json:"verified_safety_number,omitempty"` + TrustAllKnownKeys *bool `json:"trust_all_known_keys,omitempty" example:"false"` } type SendMessageResponse struct { @@ -203,8 +203,8 @@ type RateLimitChallengeRequest struct { } type UpdateAccountSettingsRequest struct { - DiscoverableByNumber *bool `json:"discoverable_by_number"` - ShareNumber *bool `json:"share_number"` + DiscoverableByNumber *bool `json:"discoverable_by_number,omitempty"` + ShareNumber *bool `json:"share_number,omitempty"` } type SetUsernameRequest struct { @@ -226,7 +226,7 @@ type RemoteDeleteRequest struct { } type DeleteLocalAccountDataRequest struct { - IgnoreRegistered bool `json:"ignore_registered" example:"false"` + IgnoreRegistered bool `json:"ignore_registered,omitempty" example:"false"` } type DeviceLinkUriResponse struct { @@ -237,7 +237,7 @@ type CreatePollRequest struct { Recipient string `json:"recipient" example:" OR OR "` Question string `json:"question" example:"What's your favourite fruit?"` Answers []string `json:"answers" example:"apple,banana,orange"` - AllowMultipleSelections *bool `json:"allow_multiple_selections" example:"true"` + AllowMultipleSelections *bool `json:"allow_multiple_selections,omitempty" example:"true"` } type CreatePollResponse struct { diff --git a/src/docs/README.md b/src/docs/README.md index 0117eff..dc4b95f 100644 --- a/src/docs/README.md +++ b/src/docs/README.md @@ -9,7 +9,7 @@ docker run --rm -v $(pwd):/code ghcr.io/swaggo/swag:latest init Or, if you have `swag` installed: ```bash -swag init +swag init --requiredByDefault ``` Then run the app in `/src` diff --git a/src/docs/docs.go b/src/docs/docs.go index e46b0dd..be1620b 100644 --- a/src/docs/docs.go +++ b/src/docs/docs.go @@ -1482,6 +1482,112 @@ const docTemplate = `{ } } }, + "/v1/groups/{number}/{groupid}/pin-message": { + "post": { + "description": "Pin a message in a Signal Group.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Groups" + ], + "summary": "Pin a message in a Signal Group.", + "parameters": [ + { + "description": "Pin", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/api.PinMessageInGroupRequest" + } + }, + { + "type": "string", + "description": "Registered Phone Number", + "name": "number", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Group Id", + "name": "groupid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/api.Error" + } + } + } + }, + "delete": { + "description": "Unpin a message in a Signal Group.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Groups" + ], + "summary": "Unpin a message in a Signal Group.", + "parameters": [ + { + "description": "Unpin", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/api.UnpinMessageInGroupRequest" + } + }, + { + "type": "string", + "description": "Registered Phone Number", + "name": "number", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Group Id", + "name": "groupid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/api.Error" + } + } + } + } + }, "/v1/groups/{number}/{groupid}/quit": { "post": { "description": "Quit the specified Signal Group.", @@ -2600,6 +2706,9 @@ const docTemplate = `{ "definitions": { "api.AddDeviceRequest": { "type": "object", + "required": [ + "uri" + ], "properties": { "uri": { "type": "string" @@ -2608,6 +2717,10 @@ const docTemplate = `{ }, "api.AddStickerPackRequest": { "type": "object", + "required": [ + "pack_id", + "pack_key" + ], "properties": { "pack_id": { "type": "string", @@ -2621,6 +2734,9 @@ const docTemplate = `{ }, "api.ChangeGroupAdminsRequest": { "type": "object", + "required": [ + "admins" + ], "properties": { "admins": { "type": "array", @@ -2632,6 +2748,9 @@ const docTemplate = `{ }, "api.ChangeGroupMembersRequest": { "type": "object", + "required": [ + "members" + ], "properties": { "members": { "type": "array", @@ -2643,6 +2762,10 @@ const docTemplate = `{ }, "api.ClosePollRequest": { "type": "object", + "required": [ + "poll_timestamp", + "recipient" + ], "properties": { "poll_timestamp": { "type": "string", @@ -2656,6 +2779,9 @@ const docTemplate = `{ }, "api.Configuration": { "type": "object", + "required": [ + "logging" + ], "properties": { "logging": { "$ref": "#/definitions/api.LoggingConfiguration" @@ -2664,6 +2790,10 @@ const docTemplate = `{ }, "api.CreateGroupRequest": { "type": "object", + "required": [ + "members", + "name" + ], "properties": { "description": { "type": "string" @@ -2695,6 +2825,9 @@ const docTemplate = `{ }, "api.CreateGroupResponse": { "type": "object", + "required": [ + "id" + ], "properties": { "id": { "type": "string" @@ -2703,6 +2836,11 @@ const docTemplate = `{ }, "api.CreatePollRequest": { "type": "object", + "required": [ + "answers", + "question", + "recipient" + ], "properties": { "allow_multiple_selections": { "type": "boolean", @@ -2731,6 +2869,9 @@ const docTemplate = `{ }, "api.CreatePollResponse": { "type": "object", + "required": [ + "timestamp" + ], "properties": { "timestamp": { "type": "string", @@ -2749,6 +2890,9 @@ const docTemplate = `{ }, "api.DeviceLinkUriResponse": { "type": "object", + "required": [ + "device_link_uri" + ], "properties": { "device_link_uri": { "type": "string" @@ -2757,6 +2901,9 @@ const docTemplate = `{ }, "api.Error": { "type": "object", + "required": [ + "error" + ], "properties": { "error": { "type": "string" @@ -2765,14 +2912,39 @@ const docTemplate = `{ }, "api.LoggingConfiguration": { "type": "object", + "required": [ + "Level" + ], "properties": { "Level": { "type": "string" } } }, + "api.PinMessageInGroupRequest": { + "type": "object", + "required": [ + "target_author", + "timestamp" + ], + "properties": { + "duration": { + "type": "integer" + }, + "target_author": { + "type": "string" + }, + "timestamp": { + "type": "integer" + } + } + }, "api.RateLimitChallengeRequest": { "type": "object", + "required": [ + "captcha", + "challenge_token" + ], "properties": { "captcha": { "type": "string", @@ -2786,6 +2958,12 @@ const docTemplate = `{ }, "api.Reaction": { "type": "object", + "required": [ + "reaction", + "recipient", + "target_author", + "timestamp" + ], "properties": { "reaction": { "type": "string" @@ -2803,6 +2981,11 @@ const docTemplate = `{ }, "api.Receipt": { "type": "object", + "required": [ + "receipt_type", + "recipient", + "timestamp" + ], "properties": { "receipt_type": { "type": "string", @@ -2832,6 +3015,10 @@ const docTemplate = `{ }, "api.RemoteDeleteRequest": { "type": "object", + "required": [ + "recipient", + "timestamp" + ], "properties": { "recipient": { "type": "string" @@ -2843,6 +3030,9 @@ const docTemplate = `{ }, "api.RemoteDeleteResponse": { "type": "object", + "required": [ + "timestamp" + ], "properties": { "timestamp": { "type": "string" @@ -2851,6 +3041,10 @@ const docTemplate = `{ }, "api.SearchResponse": { "type": "object", + "required": [ + "number", + "registered" + ], "properties": { "number": { "type": "string" @@ -2862,6 +3056,10 @@ const docTemplate = `{ }, "api.SendMessageError": { "type": "object", + "required": [ + "account", + "error" + ], "properties": { "account": { "type": "string" @@ -2879,6 +3077,9 @@ const docTemplate = `{ }, "api.SendMessageResponse": { "type": "object", + "required": [ + "timestamp" + ], "properties": { "timestamp": { "type": "string" @@ -2887,6 +3088,11 @@ const docTemplate = `{ }, "api.SendMessageV1": { "type": "object", + "required": [ + "message", + "number", + "recipients" + ], "properties": { "base64_attachment": { "type": "string", @@ -2911,6 +3117,11 @@ const docTemplate = `{ }, "api.SendMessageV2": { "type": "object", + "required": [ + "message", + "number", + "recipients" + ], "properties": { "base64_attachments": { "type": "array", @@ -2982,6 +3193,9 @@ const docTemplate = `{ }, "api.SetPinRequest": { "type": "object", + "required": [ + "pin" + ], "properties": { "pin": { "type": "string" @@ -2990,6 +3204,9 @@ const docTemplate = `{ }, "api.SetUsernameRequest": { "type": "object", + "required": [ + "username" + ], "properties": { "username": { "type": "string", @@ -3011,6 +3228,9 @@ const docTemplate = `{ }, "api.TrustModeRequest": { "type": "object", + "required": [ + "trust_mode" + ], "properties": { "trust_mode": { "type": "string" @@ -3019,6 +3239,9 @@ const docTemplate = `{ }, "api.TrustModeResponse": { "type": "object", + "required": [ + "trust_mode" + ], "properties": { "trust_mode": { "type": "string" @@ -3027,12 +3250,30 @@ const docTemplate = `{ }, "api.TypingIndicatorRequest": { "type": "object", + "required": [ + "recipient" + ], "properties": { "recipient": { "type": "string" } } }, + "api.UnpinMessageInGroupRequest": { + "type": "object", + "required": [ + "target_author", + "timestamp" + ], + "properties": { + "target_author": { + "type": "string" + }, + "timestamp": { + "type": "integer" + } + } + }, "api.UnregisterNumberRequest": { "type": "object", "properties": { @@ -3059,6 +3300,9 @@ const docTemplate = `{ }, "api.UpdateContactRequest": { "type": "object", + "required": [ + "recipient" + ], "properties": { "expiration_in_seconds": { "type": "integer" @@ -3101,6 +3345,9 @@ const docTemplate = `{ }, "api.UpdateProfileRequest": { "type": "object", + "required": [ + "name" + ], "properties": { "about": { "type": "string" @@ -3123,6 +3370,12 @@ const docTemplate = `{ }, "api.VoteRequest": { "type": "object", + "required": [ + "poll_author", + "poll_timestamp", + "recipient", + "selected_answers" + ], "properties": { "poll_author": { "type": "string", @@ -3149,6 +3402,13 @@ const docTemplate = `{ }, "client.About": { "type": "object", + "required": [ + "build", + "capabilities", + "mode", + "version", + "versions" + ], "properties": { "build": { "type": "integer" @@ -3178,6 +3438,13 @@ const docTemplate = `{ }, "client.ContactProfile": { "type": "object", + "required": [ + "about", + "given_name", + "has_avatar", + "last_updated_timestamp", + "lastname" + ], "properties": { "about": { "type": "string" @@ -3198,6 +3465,19 @@ const docTemplate = `{ }, "client.GroupEntry": { "type": "object", + "required": [ + "admins", + "blocked", + "description", + "id", + "internal_id", + "invite_link", + "members", + "name", + "pending_invites", + "pending_requests", + "permissions" + ], "properties": { "admins": { "type": "array", @@ -3248,6 +3528,14 @@ const docTemplate = `{ }, "client.IdentityEntry": { "type": "object", + "required": [ + "added", + "fingerprint", + "number", + "safety_number", + "status", + "uuid" + ], "properties": { "added": { "type": "string" @@ -3271,6 +3559,20 @@ const docTemplate = `{ }, "client.ListContactsResponse": { "type": "object", + "required": [ + "blocked", + "color", + "given_name", + "message_expiration", + "name", + "nickname", + "note", + "number", + "profile", + "profile_name", + "username", + "uuid" + ], "properties": { "blocked": { "type": "boolean" @@ -3312,6 +3614,12 @@ const docTemplate = `{ }, "client.ListDevicesResponse": { "type": "object", + "required": [ + "creation_timestamp", + "id", + "last_seen_timestamp", + "name" + ], "properties": { "creation_timestamp": { "type": "integer" @@ -3329,6 +3637,13 @@ const docTemplate = `{ }, "client.ListInstalledStickerPacksResponse": { "type": "object", + "required": [ + "author", + "installed", + "pack_id", + "title", + "url" + ], "properties": { "author": { "type": "string" @@ -3349,6 +3664,11 @@ const docTemplate = `{ }, "client.Nickname": { "type": "object", + "required": [ + "family_name", + "given_name", + "name" + ], "properties": { "family_name": { "type": "string" @@ -3363,6 +3683,10 @@ const docTemplate = `{ }, "client.SetUsernameResponse": { "type": "object", + "required": [ + "username", + "username_link" + ], "properties": { "username": { "type": "string" @@ -3374,6 +3698,11 @@ const docTemplate = `{ }, "data.GroupPermissions": { "type": "object", + "required": [ + "add_members", + "edit_group", + "send_messages" + ], "properties": { "add_members": { "type": "string", @@ -3400,6 +3729,12 @@ const docTemplate = `{ }, "data.LinkPreviewType": { "type": "object", + "required": [ + "base64_thumbnail", + "description", + "title", + "url" + ], "properties": { "base64_thumbnail": { "type": "string" @@ -3417,6 +3752,11 @@ const docTemplate = `{ }, "data.MessageMention": { "type": "object", + "required": [ + "author", + "length", + "start" + ], "properties": { "author": { "type": "string" diff --git a/src/docs/swagger.json b/src/docs/swagger.json index 8ab740d..bff665f 100644 --- a/src/docs/swagger.json +++ b/src/docs/swagger.json @@ -1479,6 +1479,112 @@ } } }, + "/v1/groups/{number}/{groupid}/pin-message": { + "post": { + "description": "Pin a message in a Signal Group.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Groups" + ], + "summary": "Pin a message in a Signal Group.", + "parameters": [ + { + "description": "Pin", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/api.PinMessageInGroupRequest" + } + }, + { + "type": "string", + "description": "Registered Phone Number", + "name": "number", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Group Id", + "name": "groupid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/api.Error" + } + } + } + }, + "delete": { + "description": "Unpin a message in a Signal Group.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Groups" + ], + "summary": "Unpin a message in a Signal Group.", + "parameters": [ + { + "description": "Unpin", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/api.UnpinMessageInGroupRequest" + } + }, + { + "type": "string", + "description": "Registered Phone Number", + "name": "number", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Group Id", + "name": "groupid", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/api.Error" + } + } + } + } + }, "/v1/groups/{number}/{groupid}/quit": { "post": { "description": "Quit the specified Signal Group.", @@ -2597,6 +2703,9 @@ "definitions": { "api.AddDeviceRequest": { "type": "object", + "required": [ + "uri" + ], "properties": { "uri": { "type": "string" @@ -2605,6 +2714,10 @@ }, "api.AddStickerPackRequest": { "type": "object", + "required": [ + "pack_id", + "pack_key" + ], "properties": { "pack_id": { "type": "string", @@ -2618,6 +2731,9 @@ }, "api.ChangeGroupAdminsRequest": { "type": "object", + "required": [ + "admins" + ], "properties": { "admins": { "type": "array", @@ -2629,6 +2745,9 @@ }, "api.ChangeGroupMembersRequest": { "type": "object", + "required": [ + "members" + ], "properties": { "members": { "type": "array", @@ -2640,6 +2759,10 @@ }, "api.ClosePollRequest": { "type": "object", + "required": [ + "poll_timestamp", + "recipient" + ], "properties": { "poll_timestamp": { "type": "string", @@ -2653,6 +2776,9 @@ }, "api.Configuration": { "type": "object", + "required": [ + "logging" + ], "properties": { "logging": { "$ref": "#/definitions/api.LoggingConfiguration" @@ -2661,6 +2787,10 @@ }, "api.CreateGroupRequest": { "type": "object", + "required": [ + "members", + "name" + ], "properties": { "description": { "type": "string" @@ -2692,6 +2822,9 @@ }, "api.CreateGroupResponse": { "type": "object", + "required": [ + "id" + ], "properties": { "id": { "type": "string" @@ -2700,6 +2833,11 @@ }, "api.CreatePollRequest": { "type": "object", + "required": [ + "answers", + "question", + "recipient" + ], "properties": { "allow_multiple_selections": { "type": "boolean", @@ -2728,6 +2866,9 @@ }, "api.CreatePollResponse": { "type": "object", + "required": [ + "timestamp" + ], "properties": { "timestamp": { "type": "string", @@ -2746,6 +2887,9 @@ }, "api.DeviceLinkUriResponse": { "type": "object", + "required": [ + "device_link_uri" + ], "properties": { "device_link_uri": { "type": "string" @@ -2754,6 +2898,9 @@ }, "api.Error": { "type": "object", + "required": [ + "error" + ], "properties": { "error": { "type": "string" @@ -2762,14 +2909,39 @@ }, "api.LoggingConfiguration": { "type": "object", + "required": [ + "Level" + ], "properties": { "Level": { "type": "string" } } }, + "api.PinMessageInGroupRequest": { + "type": "object", + "required": [ + "target_author", + "timestamp" + ], + "properties": { + "duration": { + "type": "integer" + }, + "target_author": { + "type": "string" + }, + "timestamp": { + "type": "integer" + } + } + }, "api.RateLimitChallengeRequest": { "type": "object", + "required": [ + "captcha", + "challenge_token" + ], "properties": { "captcha": { "type": "string", @@ -2783,6 +2955,12 @@ }, "api.Reaction": { "type": "object", + "required": [ + "reaction", + "recipient", + "target_author", + "timestamp" + ], "properties": { "reaction": { "type": "string" @@ -2800,6 +2978,11 @@ }, "api.Receipt": { "type": "object", + "required": [ + "receipt_type", + "recipient", + "timestamp" + ], "properties": { "receipt_type": { "type": "string", @@ -2829,6 +3012,10 @@ }, "api.RemoteDeleteRequest": { "type": "object", + "required": [ + "recipient", + "timestamp" + ], "properties": { "recipient": { "type": "string" @@ -2840,6 +3027,9 @@ }, "api.RemoteDeleteResponse": { "type": "object", + "required": [ + "timestamp" + ], "properties": { "timestamp": { "type": "string" @@ -2848,6 +3038,10 @@ }, "api.SearchResponse": { "type": "object", + "required": [ + "number", + "registered" + ], "properties": { "number": { "type": "string" @@ -2859,6 +3053,10 @@ }, "api.SendMessageError": { "type": "object", + "required": [ + "account", + "error" + ], "properties": { "account": { "type": "string" @@ -2876,6 +3074,9 @@ }, "api.SendMessageResponse": { "type": "object", + "required": [ + "timestamp" + ], "properties": { "timestamp": { "type": "string" @@ -2884,6 +3085,11 @@ }, "api.SendMessageV1": { "type": "object", + "required": [ + "message", + "number", + "recipients" + ], "properties": { "base64_attachment": { "type": "string", @@ -2908,6 +3114,11 @@ }, "api.SendMessageV2": { "type": "object", + "required": [ + "message", + "number", + "recipients" + ], "properties": { "base64_attachments": { "type": "array", @@ -2979,6 +3190,9 @@ }, "api.SetPinRequest": { "type": "object", + "required": [ + "pin" + ], "properties": { "pin": { "type": "string" @@ -2987,6 +3201,9 @@ }, "api.SetUsernameRequest": { "type": "object", + "required": [ + "username" + ], "properties": { "username": { "type": "string", @@ -3008,6 +3225,9 @@ }, "api.TrustModeRequest": { "type": "object", + "required": [ + "trust_mode" + ], "properties": { "trust_mode": { "type": "string" @@ -3016,6 +3236,9 @@ }, "api.TrustModeResponse": { "type": "object", + "required": [ + "trust_mode" + ], "properties": { "trust_mode": { "type": "string" @@ -3024,12 +3247,30 @@ }, "api.TypingIndicatorRequest": { "type": "object", + "required": [ + "recipient" + ], "properties": { "recipient": { "type": "string" } } }, + "api.UnpinMessageInGroupRequest": { + "type": "object", + "required": [ + "target_author", + "timestamp" + ], + "properties": { + "target_author": { + "type": "string" + }, + "timestamp": { + "type": "integer" + } + } + }, "api.UnregisterNumberRequest": { "type": "object", "properties": { @@ -3056,6 +3297,9 @@ }, "api.UpdateContactRequest": { "type": "object", + "required": [ + "recipient" + ], "properties": { "expiration_in_seconds": { "type": "integer" @@ -3098,6 +3342,9 @@ }, "api.UpdateProfileRequest": { "type": "object", + "required": [ + "name" + ], "properties": { "about": { "type": "string" @@ -3120,6 +3367,12 @@ }, "api.VoteRequest": { "type": "object", + "required": [ + "poll_author", + "poll_timestamp", + "recipient", + "selected_answers" + ], "properties": { "poll_author": { "type": "string", @@ -3146,6 +3399,13 @@ }, "client.About": { "type": "object", + "required": [ + "build", + "capabilities", + "mode", + "version", + "versions" + ], "properties": { "build": { "type": "integer" @@ -3175,6 +3435,13 @@ }, "client.ContactProfile": { "type": "object", + "required": [ + "about", + "given_name", + "has_avatar", + "last_updated_timestamp", + "lastname" + ], "properties": { "about": { "type": "string" @@ -3195,6 +3462,19 @@ }, "client.GroupEntry": { "type": "object", + "required": [ + "admins", + "blocked", + "description", + "id", + "internal_id", + "invite_link", + "members", + "name", + "pending_invites", + "pending_requests", + "permissions" + ], "properties": { "admins": { "type": "array", @@ -3245,6 +3525,14 @@ }, "client.IdentityEntry": { "type": "object", + "required": [ + "added", + "fingerprint", + "number", + "safety_number", + "status", + "uuid" + ], "properties": { "added": { "type": "string" @@ -3268,6 +3556,20 @@ }, "client.ListContactsResponse": { "type": "object", + "required": [ + "blocked", + "color", + "given_name", + "message_expiration", + "name", + "nickname", + "note", + "number", + "profile", + "profile_name", + "username", + "uuid" + ], "properties": { "blocked": { "type": "boolean" @@ -3309,6 +3611,12 @@ }, "client.ListDevicesResponse": { "type": "object", + "required": [ + "creation_timestamp", + "id", + "last_seen_timestamp", + "name" + ], "properties": { "creation_timestamp": { "type": "integer" @@ -3326,6 +3634,13 @@ }, "client.ListInstalledStickerPacksResponse": { "type": "object", + "required": [ + "author", + "installed", + "pack_id", + "title", + "url" + ], "properties": { "author": { "type": "string" @@ -3346,6 +3661,11 @@ }, "client.Nickname": { "type": "object", + "required": [ + "family_name", + "given_name", + "name" + ], "properties": { "family_name": { "type": "string" @@ -3360,6 +3680,10 @@ }, "client.SetUsernameResponse": { "type": "object", + "required": [ + "username", + "username_link" + ], "properties": { "username": { "type": "string" @@ -3371,6 +3695,11 @@ }, "data.GroupPermissions": { "type": "object", + "required": [ + "add_members", + "edit_group", + "send_messages" + ], "properties": { "add_members": { "type": "string", @@ -3397,6 +3726,12 @@ }, "data.LinkPreviewType": { "type": "object", + "required": [ + "base64_thumbnail", + "description", + "title", + "url" + ], "properties": { "base64_thumbnail": { "type": "string" @@ -3414,6 +3749,11 @@ }, "data.MessageMention": { "type": "object", + "required": [ + "author", + "length", + "start" + ], "properties": { "author": { "type": "string" diff --git a/src/docs/swagger.yaml b/src/docs/swagger.yaml index b189493..804385a 100644 --- a/src/docs/swagger.yaml +++ b/src/docs/swagger.yaml @@ -4,6 +4,8 @@ definitions: properties: uri: type: string + required: + - uri type: object api.AddStickerPackRequest: properties: @@ -13,6 +15,9 @@ definitions: pack_key: example: 19546e18eba0ff69dea78eb591465289d39e16f35e58389ae779d4f9455aff3a type: string + required: + - pack_id + - pack_key type: object api.ChangeGroupAdminsRequest: properties: @@ -20,6 +25,8 @@ definitions: items: type: string type: array + required: + - admins type: object api.ChangeGroupMembersRequest: properties: @@ -27,6 +34,8 @@ definitions: items: type: string type: array + required: + - members type: object api.ClosePollRequest: properties: @@ -36,11 +45,16 @@ definitions: recipient: example: OR OR type: string + required: + - poll_timestamp + - recipient type: object api.Configuration: properties: logging: $ref: '#/definitions/api.LoggingConfiguration' + required: + - logging type: object api.CreateGroupRequest: properties: @@ -62,11 +76,16 @@ definitions: type: string permissions: $ref: '#/definitions/data.GroupPermissions' + required: + - members + - name type: object api.CreateGroupResponse: properties: id: type: string + required: + - id type: object api.CreatePollRequest: properties: @@ -87,12 +106,18 @@ definitions: recipient: example: OR OR type: string + required: + - answers + - question + - recipient type: object api.CreatePollResponse: properties: timestamp: example: "1769271479" type: string + required: + - timestamp type: object api.DeleteLocalAccountDataRequest: properties: @@ -104,16 +129,34 @@ definitions: properties: device_link_uri: type: string + required: + - device_link_uri type: object api.Error: properties: error: type: string + required: + - error type: object api.LoggingConfiguration: properties: Level: type: string + required: + - Level + type: object + api.PinMessageInGroupRequest: + properties: + duration: + type: integer + target_author: + type: string + timestamp: + type: integer + required: + - target_author + - timestamp type: object api.RateLimitChallengeRequest: properties: @@ -123,6 +166,9 @@ definitions: challenge_token: example: type: string + required: + - captcha + - challenge_token type: object api.Reaction: properties: @@ -134,6 +180,11 @@ definitions: type: string timestamp: type: integer + required: + - reaction + - recipient + - target_author + - timestamp type: object api.Receipt: properties: @@ -146,6 +197,10 @@ definitions: type: string timestamp: type: integer + required: + - receipt_type + - recipient + - timestamp type: object api.RegisterNumberRequest: properties: @@ -160,11 +215,16 @@ definitions: type: string timestamp: type: integer + required: + - recipient + - timestamp type: object api.RemoteDeleteResponse: properties: timestamp: type: string + required: + - timestamp type: object api.SearchResponse: properties: @@ -172,6 +232,9 @@ definitions: type: string registered: type: boolean + required: + - number + - registered type: object api.SendMessageError: properties: @@ -183,11 +246,16 @@ definitions: type: array error: type: string + required: + - account + - error type: object api.SendMessageResponse: properties: timestamp: type: string + required: + - timestamp type: object api.SendMessageV1: properties: @@ -206,6 +274,10 @@ definitions: items: type: string type: array + required: + - message + - number + - recipients type: object api.SendMessageV2: properties: @@ -254,17 +326,25 @@ definitions: type: string view_once: type: boolean + required: + - message + - number + - recipients type: object api.SetPinRequest: properties: pin: type: string + required: + - pin type: object api.SetUsernameRequest: properties: username: example: test type: string + required: + - username type: object api.TrustIdentityRequest: properties: @@ -278,16 +358,32 @@ definitions: properties: trust_mode: type: string + required: + - trust_mode type: object api.TrustModeResponse: properties: trust_mode: type: string + required: + - trust_mode type: object api.TypingIndicatorRequest: properties: recipient: type: string + required: + - recipient + type: object + api.UnpinMessageInGroupRequest: + properties: + target_author: + type: string + timestamp: + type: integer + required: + - target_author + - timestamp type: object api.UnregisterNumberRequest: properties: @@ -313,6 +409,8 @@ definitions: type: string recipient: type: string + required: + - recipient type: object api.UpdateGroupRequest: properties: @@ -341,6 +439,8 @@ definitions: type: string name: type: string + required: + - name type: object api.VerifyNumberSettings: properties: @@ -364,6 +464,11 @@ definitions: items: type: integer type: array + required: + - poll_author + - poll_timestamp + - recipient + - selected_answers type: object client.About: properties: @@ -383,6 +488,12 @@ definitions: items: type: string type: array + required: + - build + - capabilities + - mode + - version + - versions type: object client.ContactProfile: properties: @@ -396,6 +507,12 @@ definitions: type: integer lastname: type: string + required: + - about + - given_name + - has_avatar + - last_updated_timestamp + - lastname type: object client.GroupEntry: properties: @@ -429,6 +546,18 @@ definitions: type: array permissions: $ref: '#/definitions/data.GroupPermissions' + required: + - admins + - blocked + - description + - id + - internal_id + - invite_link + - members + - name + - pending_invites + - pending_requests + - permissions type: object client.IdentityEntry: properties: @@ -444,6 +573,13 @@ definitions: type: string uuid: type: string + required: + - added + - fingerprint + - number + - safety_number + - status + - uuid type: object client.ListContactsResponse: properties: @@ -471,6 +607,19 @@ definitions: type: string uuid: type: string + required: + - blocked + - color + - given_name + - message_expiration + - name + - nickname + - note + - number + - profile + - profile_name + - username + - uuid type: object client.ListDevicesResponse: properties: @@ -482,6 +631,11 @@ definitions: type: integer name: type: string + required: + - creation_timestamp + - id + - last_seen_timestamp + - name type: object client.ListInstalledStickerPacksResponse: properties: @@ -495,6 +649,12 @@ definitions: type: string url: type: string + required: + - author + - installed + - pack_id + - title + - url type: object client.Nickname: properties: @@ -504,6 +664,10 @@ definitions: type: string name: type: string + required: + - family_name + - given_name + - name type: object client.SetUsernameResponse: properties: @@ -511,6 +675,9 @@ definitions: type: string username_link: type: string + required: + - username + - username_link type: object data.GroupPermissions: properties: @@ -529,6 +696,10 @@ definitions: - only-admins - every-member type: string + required: + - add_members + - edit_group + - send_messages type: object data.LinkPreviewType: properties: @@ -540,6 +711,11 @@ definitions: type: string url: type: string + required: + - base64_thumbnail + - description + - title + - url type: object data.MessageMention: properties: @@ -549,6 +725,10 @@ definitions: type: integer start: type: integer + required: + - author + - length + - start type: object host: localhost:8080 info: @@ -1543,6 +1723,77 @@ paths: summary: Add one or more members to an existing Signal Group. tags: - Groups + /v1/groups/{number}/{groupid}/pin-message: + delete: + consumes: + - application/json + description: Unpin a message in a Signal Group. + parameters: + - description: Unpin + in: body + name: data + required: true + schema: + $ref: '#/definitions/api.UnpinMessageInGroupRequest' + - description: Registered Phone Number + in: path + name: number + required: true + type: string + - description: Group Id + in: path + name: groupid + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + type: string + "400": + description: Bad Request + schema: + $ref: '#/definitions/api.Error' + summary: Unpin a message in a Signal Group. + tags: + - Groups + post: + consumes: + - application/json + description: Pin a message in a Signal Group. + parameters: + - description: Pin + in: body + name: data + required: true + schema: + $ref: '#/definitions/api.PinMessageInGroupRequest' + - description: Registered Phone Number + in: path + name: number + required: true + type: string + - description: Group Id + in: path + name: groupid + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + type: string + "400": + description: Bad Request + schema: + $ref: '#/definitions/api.Error' + summary: Pin a message in a Signal Group. + tags: + - Groups /v1/groups/{number}/{groupid}/quit: post: consumes: