diff --git a/cmd/signaldctl/cmd/get/group.go b/cmd/signaldctl/cmd/get/group.go new file mode 100644 index 0000000..fc27c40 --- /dev/null +++ b/cmd/signaldctl/cmd/get/group.go @@ -0,0 +1,110 @@ +// Copyright © 2021 Finn Herzfeld +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +package get + +import ( + "encoding/json" + "log" + "os" + + "github.com/jedib0t/go-pretty/v6/table" + "github.com/spf13/cobra" + "gopkg.in/yaml.v2" + + "gitlab.com/signald/signald-go/cmd/signaldctl/common" + "gitlab.com/signald/signald-go/signald/client-protocol/v1" +) + +var ( + account string + groupID string + getGroupCmd = &cobra.Command{ + Use: "group", + Aliases: []string{"groups"}, + Short: "return a list of Signal groups", + Run: func(_ *cobra.Command, _ []string) { + go common.Signald.Listen(nil) + var resp v1.GroupList + if len(groupID) == 0 || len(groupID) == 24 { + var err error + req := v1.ListGroupsRequest{Account: account} + resp, err = req.Submit(common.Signald) + if err != nil { + log.Fatal(err, "error communicating with signald") + } + + if len(groupID) == 24 { + for _, group := range resp.LegacyGroups { + if group.GroupId == groupID { + resp = v1.GroupList{LegacyGroups: []*v1.JsonGroupInfo{group}} + break + } + } + log.Fatal("group not found") + } + } else if len(groupID) == 44 { + req := v1.GetGroupRequest{Account: account, GroupID: groupID} + group, err := req.Submit(common.Signald) + if err != nil { + log.Fatal(err, "error communicating with signald") + } + resp = v1.GroupList{Groups: []*v1.JsonGroupV2Info{&group}} + } else { + log.Fatal("malformed group ID (expected length of 24 or 44)") + } + + switch common.OutputFormat { + case "json": + err := json.NewEncoder(os.Stdout).Encode(resp) + if err != nil { + log.Fatal(err, "error encoding response to stdout") + } + break + case "yaml": + err := yaml.NewEncoder(os.Stdout).Encode(resp) + if err != nil { + log.Fatal(err, "error encoding response to stdout") + } + break + case "table": + t := table.NewWriter() + t.SetOutputMirror(os.Stdout) + t.AppendHeader(table.Row{"ID", "Title", "Members"}) + + for _, group := range resp.Groups { + t.AppendRow(table.Row{group.ID, group.Title, len(group.Members)}) + } + + for _, group := range resp.LegacyGroups { + t.AppendRow(table.Row{group.GroupId, group.Name, len(group.Members)}) + } + + t.Render() + break + default: + log.Fatal("Unsupported output format") + } + }, + } +) + +func init() { + GetCmd.AddCommand(getGroupCmd) + getGroupCmd.Flags().StringVarP(&account, "account", "a", "", "the signald account to use") + getGroupCmd.Flags().StringVarP(&groupID, "group-id", "g", "", "if set, fetches the latest state of a group from the server (local state is used for legacy groups). If unset, return all groups") + common.Must(getGroupCmd.MarkFlagRequired("account")) + +} diff --git a/cmd/signaldctl/cmd/get/root.go b/cmd/signaldctl/cmd/get/root.go new file mode 100644 index 0000000..a599851 --- /dev/null +++ b/cmd/signaldctl/cmd/get/root.go @@ -0,0 +1,22 @@ +// Copyright © 2021 Finn Herzfeld +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +package get + +import ( + "github.com/spf13/cobra" +) + +var GetCmd = &cobra.Command{Use: "get"} diff --git a/cmd/signaldctl/cmd/link.go b/cmd/signaldctl/cmd/link.go index 9d0038a..55b1010 100644 --- a/cmd/signaldctl/cmd/link.go +++ b/cmd/signaldctl/cmd/link.go @@ -24,6 +24,7 @@ import ( "github.com/mdp/qrterminal" "github.com/spf13/cobra" + "gitlab.com/signald/signald-go/cmd/signaldctl/common" "gitlab.com/signald/signald-go/signald/client-protocol/v0" ) @@ -36,7 +37,7 @@ var linkCmd = &cobra.Command{ Long: `Get a URI or QR code to link to an existing Signal account`, Run: func(cmd *cobra.Command, args []string) { requestID := fmt.Sprint("signaldctl-", rand.Intn(1000)) - err := s.RawRequest(v0.LegacyRequest{ + err := common.Signald.RawRequest(v0.LegacyRequest{ Type: "link", ID: requestID, }) @@ -45,7 +46,7 @@ var linkCmd = &cobra.Command{ } c := make(chan v0.LegacyResponse) - go s.Listen(c) + go common.Signald.Listen(c) for { message := <-c if message.ID == requestID { diff --git a/cmd/signaldctl/cmd/list-accounts.go b/cmd/signaldctl/cmd/list-accounts.go index d210a3f..136bc1b 100644 --- a/cmd/signaldctl/cmd/list-accounts.go +++ b/cmd/signaldctl/cmd/list-accounts.go @@ -22,6 +22,7 @@ import ( "github.com/spf13/cobra" + "gitlab.com/signald/signald-go/cmd/signaldctl/common" "gitlab.com/signald/signald-go/signald/client-protocol/v0" ) @@ -32,7 +33,7 @@ var listAccountsCmd = &cobra.Command{ Long: `Prints a list of all users to stdout.`, Run: func(cmd *cobra.Command, args []string) { requestID := fmt.Sprint("signaldctl-", rand.Intn(1000)) - err := s.RawRequest(v0.LegacyRequest{ + err := common.Signald.RawRequest(v0.LegacyRequest{ Type: "list_accounts", ID: requestID, }) @@ -41,7 +42,7 @@ var listAccountsCmd = &cobra.Command{ } c := make(chan v0.LegacyResponse) - go s.Listen(c) + go common.Signald.Listen(c) for { message := <-c if message.ID == requestID { diff --git a/cmd/signaldctl/cmd/list-groups.go b/cmd/signaldctl/cmd/list-groups.go deleted file mode 100644 index 35a99a5..0000000 --- a/cmd/signaldctl/cmd/list-groups.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright © 2020 Finn Herzfeld -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -package cmd - -import ( - "encoding/json" - "log" - "os" - - "github.com/spf13/cobra" - - "gitlab.com/signald/signald-go/signald/client-protocol/v1" -) - -// listGroupsCmd represents the listGroups command -var listGroupsCmd = &cobra.Command{ - Use: "list-groups", - Short: "list of all the groups that the user is in.", - Long: `Prints a list of all groups the user is in to stdout.`, - Run: func(cmd *cobra.Command, args []string) { - go s.Listen(nil) - req := v1.ListGroupsRequest{Account: username} - resp, err := req.Submit(s) - if err != nil { - log.Fatal(err, "error communicating with signald") - } - err = json.NewEncoder(os.Stdout).Encode(resp) - if err != nil { - log.Fatal(err, "error encoding response to stdout") - } - }, -} - -func init() { - RootCmd.AddCommand(listGroupsCmd) - - listGroupsCmd.Flags().StringVarP(&username, "username", "u", "", "The username of the account to use)") - must(listGroupsCmd.MarkFlagRequired("username")) -} diff --git a/cmd/signaldctl/cmd/register.go b/cmd/signaldctl/cmd/register.go index 26a41bd..bba9fc8 100644 --- a/cmd/signaldctl/cmd/register.go +++ b/cmd/signaldctl/cmd/register.go @@ -22,6 +22,7 @@ import ( "github.com/spf13/cobra" + "gitlab.com/signald/signald-go/cmd/signaldctl/common" "gitlab.com/signald/signald-go/signald/client-protocol/v0" ) @@ -32,7 +33,7 @@ var registerCmd = &cobra.Command{ Long: `Register a new signal account, generating new keys if the number was previously registered.`, Run: func(cmd *cobra.Command, args []string) { requestID := fmt.Sprint("signaldctl-", rand.Intn(1000)) - err := s.RawRequest(v0.LegacyRequest{ + err := common.Signald.RawRequest(v0.LegacyRequest{ Type: "register", Username: username, ID: requestID, @@ -40,10 +41,10 @@ var registerCmd = &cobra.Command{ if err != nil { log.Fatal("error sending request: ", err) } - go s.Listen(nil) + go common.Signald.Listen(nil) - defer s.CloseResponseListener(requestID) - r := <-s.GetResponseListener(requestID) + defer common.Signald.CloseResponseListener(requestID) + r := <-common.Signald.GetResponseListener(requestID) account, err := r.Data.MarshalJSON() if err != nil { log.Fatal("error rendering response:", err) @@ -56,5 +57,5 @@ func init() { RootCmd.AddCommand(registerCmd) registerCmd.Flags().StringVarP(&username, "username", "u", "", "The phone number of the new account to register)") - must(registerCmd.MarkFlagRequired("username")) + common.Must(registerCmd.MarkFlagRequired("username")) } diff --git a/cmd/signaldctl/cmd/root.go b/cmd/signaldctl/cmd/root.go index 11fe156..1519586 100644 --- a/cmd/signaldctl/cmd/root.go +++ b/cmd/signaldctl/cmd/root.go @@ -1,4 +1,4 @@ -// Copyright © 2018 Finn Herzfeld +// Copyright © 2021 Finn Herzfeld // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -23,12 +23,13 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" + "gitlab.com/signald/signald-go/cmd/signaldctl/cmd/get" + "gitlab.com/signald/signald-go/cmd/signaldctl/common" "gitlab.com/signald/signald-go/signald" ) var cfgFile string var socketPath string -var s *signald.Signald // RootCmd represents the base command when called without any subcommands var RootCmd = &cobra.Command{ @@ -36,8 +37,8 @@ var RootCmd = &cobra.Command{ Short: "Interact with a running siangld instance", Long: `signaldctl is a command line tool to interact with signald.`, PersistentPreRun: func(cmd *cobra.Command, args []string) { - s = &signald.Signald{SocketPath: socketPath} - err := s.Connect() + common.Signald = &signald.Signald{SocketPath: socketPath} + err := common.Signald.Connect() if err != nil { log.Fatal(err) } @@ -57,6 +58,8 @@ func init() { cobra.OnInitialize(initConfig) RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.signaldctl.yaml)") RootCmd.PersistentFlags().StringVarP(&socketPath, "socket", "s", "/var/run/signald/signald.sock", "the path to the signald socket file") + RootCmd.PersistentFlags().StringVarP(&common.OutputFormat, "output-format", "o", "table", "the output format. Options are table (default), json or yaml") + RootCmd.AddCommand(get.GetCmd) } // initConfig reads in config file and ENV variables if set. @@ -74,9 +77,3 @@ func initConfig() { fmt.Println("Using config file:", viper.ConfigFileUsed()) } } - -func must(err error) { - if err != nil { - log.Fatal(err) - } -} diff --git a/cmd/signaldctl/cmd/send.go b/cmd/signaldctl/cmd/send.go index 33d964a..23e4bcc 100644 --- a/cmd/signaldctl/cmd/send.go +++ b/cmd/signaldctl/cmd/send.go @@ -22,6 +22,7 @@ import ( "github.com/spf13/cobra" + "gitlab.com/signald/signald-go/cmd/signaldctl/common" "gitlab.com/signald/signald-go/signald/client-protocol/v0" "gitlab.com/signald/signald-go/signald/client-protocol/v1" ) @@ -57,8 +58,8 @@ var sendCmd = &cobra.Command{ if attachment != "" { request.Attachments = []*v0.JsonAttachment{{Filename: attachment}} } - go s.Listen(nil) - response, err := request.Submit(s) + go common.Signald.Listen(nil) + response, err := request.Submit(common.Signald) if err != nil { log.Fatal("error submitting request to signald: ", err) } @@ -73,7 +74,7 @@ func init() { RootCmd.AddCommand(sendCmd) sendCmd.Flags().StringVarP(&username, "username", "u", "", "The username to send from (required)") - must(sendCmd.MarkFlagRequired("username")) + common.Must(sendCmd.MarkFlagRequired("username")) sendCmd.Flags().StringVarP(&toUser, "to", "t", "", "The user to send the message to (cannot be combined with --group)") diff --git a/cmd/signaldctl/cmd/subscribe.go b/cmd/signaldctl/cmd/subscribe.go index b0c27ec..c534aac 100644 --- a/cmd/signaldctl/cmd/subscribe.go +++ b/cmd/signaldctl/cmd/subscribe.go @@ -24,6 +24,7 @@ import ( "github.com/spf13/cobra" + "gitlab.com/signald/signald-go/cmd/signaldctl/common" "gitlab.com/signald/signald-go/signald/client-protocol/v0" ) @@ -34,7 +35,7 @@ var subscribeCmd = &cobra.Command{ Long: `receive incoming messages from Signal`, Run: func(cmd *cobra.Command, args []string) { requestID := fmt.Sprint("signaldctl-", rand.Intn(1000)) - err := s.RawRequest(v0.LegacyRequest{ + err := common.Signald.RawRequest(v0.LegacyRequest{ Type: "subscribe", Username: username, ID: requestID, @@ -44,11 +45,11 @@ var subscribeCmd = &cobra.Command{ } c := make(chan v0.LegacyResponse) - go s.Listen(c) + go common.Signald.Listen(c) go func() { - defer s.CloseResponseListener(requestID) - r := <-s.GetResponseListener(requestID) + defer common.Signald.CloseResponseListener(requestID) + r := <-common.Signald.GetResponseListener(requestID) if r.GetError() != nil { log.Fatal("error subscribing: ", r.GetError()) } @@ -67,5 +68,5 @@ func init() { RootCmd.AddCommand(subscribeCmd) subscribeCmd.Flags().StringVarP(&username, "username", "u", "", "The phone number to subscribe to") - must(subscribeCmd.MarkFlagRequired("username")) + common.Must(subscribeCmd.MarkFlagRequired("username")) } diff --git a/cmd/signaldctl/cmd/verify.go b/cmd/signaldctl/cmd/verify.go index 154f2d4..ce4f1f0 100644 --- a/cmd/signaldctl/cmd/verify.go +++ b/cmd/signaldctl/cmd/verify.go @@ -22,6 +22,7 @@ import ( "github.com/spf13/cobra" + "gitlab.com/signald/signald-go/cmd/signaldctl/common" "gitlab.com/signald/signald-go/signald/client-protocol/v0" ) @@ -36,7 +37,7 @@ var verify = &cobra.Command{ Long: `Verify the phone number on a new account by submitting a verification code, completing the account registration process.`, Run: func(cmd *cobra.Command, args []string) { requestID := fmt.Sprint("signaldctl-", rand.Intn(1000)) - err := s.RawRequest(v0.LegacyRequest{ + err := common.Signald.RawRequest(v0.LegacyRequest{ Type: "verify", Username: username, Code: code, @@ -45,10 +46,10 @@ var verify = &cobra.Command{ if err != nil { log.Fatal("error sending request: ", err) } - go s.Listen(nil) + go common.Signald.Listen(nil) - defer s.CloseResponseListener(requestID) - r := <-s.GetResponseListener(requestID) + defer common.Signald.CloseResponseListener(requestID) + r := <-common.Signald.GetResponseListener(requestID) account, err := r.Data.MarshalJSON() if err != nil { log.Fatal("error rendering response:", err) @@ -61,8 +62,8 @@ func init() { RootCmd.AddCommand(verify) verify.Flags().StringVarP(&username, "username", "u", "", "The phone number the verification code was sent to") - must(verify.MarkFlagRequired("username")) + common.Must(verify.MarkFlagRequired("username")) verify.Flags().StringVarP(&code, "code", "c", "", "The verification code") - must(verify.MarkFlagRequired("code")) + common.Must(verify.MarkFlagRequired("code")) } diff --git a/cmd/signaldctl/cmd/version.go b/cmd/signaldctl/cmd/version.go index 542f2a3..3793a94 100644 --- a/cmd/signaldctl/cmd/version.go +++ b/cmd/signaldctl/cmd/version.go @@ -22,6 +22,7 @@ import ( "github.com/spf13/cobra" + "gitlab.com/signald/signald-go/cmd/signaldctl/common" "gitlab.com/signald/signald-go/signald/client-protocol/v1" ) @@ -31,9 +32,9 @@ var versionCmd = &cobra.Command{ Short: "print the signald version", Long: `print the signald version`, Run: func(cmd *cobra.Command, args []string) { - go s.Listen(nil) + go common.Signald.Listen(nil) r := v1.VersionRequest{} - response, err := r.Submit(s) + response, err := r.Submit(common.Signald) if err != nil { log.Fatal(err) } diff --git a/cmd/signaldctl/common/signald.go b/cmd/signaldctl/common/signald.go new file mode 100644 index 0000000..3287838 --- /dev/null +++ b/cmd/signaldctl/common/signald.go @@ -0,0 +1,19 @@ +package common + +import ( + "log" + + "gitlab.com/signald/signald-go/signald" +) + +var ( + Signald *signald.Signald + + OutputFormat string +) + +func Must(err error) { + if err != nil { + log.Fatal(err) + } +} diff --git a/go.mod b/go.mod index 6c0bc1f..31ab494 100644 --- a/go.mod +++ b/go.mod @@ -4,11 +4,19 @@ go 1.14 require ( github.com/fsnotify/fsnotify v1.4.9 // indirect + github.com/jedib0t/go-pretty/v6 v6.1.0 + github.com/kr/text v0.2.0 // indirect + github.com/mattn/go-runewidth v0.0.10 // indirect github.com/mdp/qrterminal v1.0.1 + github.com/mitchellh/mapstructure v1.3.3 // indirect + github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect + github.com/pelletier/go-toml v1.7.0 // indirect github.com/spf13/cobra v1.0.0 github.com/spf13/viper v1.7.0 - github.com/stretchr/testify v1.4.0 // indirect + github.com/stretchr/testify v1.6.1 // indirect golang.org/x/sys v0.0.0-20200519105757-fe76b779f299 // indirect - gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect - gopkg.in/yaml.v2 v2.3.0 // indirect + golang.org/x/text v0.3.3 // indirect + gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect + gopkg.in/yaml.v2 v2.3.0 + gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c // indirect ) diff --git a/go.sum b/go.sum index 21bc510..40a79ce 100644 --- a/go.sum +++ b/go.sum @@ -35,6 +35,7 @@ github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -45,11 +46,13 @@ github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fzipp/gocyclo v0.3.1/go.mod h1:DJHO6AUmbdqj2ET4Z9iArSuwWgYDRryYt2wASxc7x3E= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= @@ -101,6 +104,8 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jedib0t/go-pretty/v6 v6.1.0 h1:NVS2PT3ZvzMb47DzS50cmsK6xkf8SSyLfroSSIG20JI= +github.com/jedib0t/go-pretty/v6 v6.1.0/go.mod h1:+nE9fyyHGil+PuISTCrp7avEdo6bqoMwqZnuiK2r2a0= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= @@ -116,11 +121,16 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-runewidth v0.0.10 h1:CoZ3S2P7pvtP45xOtBw+/mDL2z0RKI576gSkzRRpdGg= +github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mdp/qrterminal v1.0.1 h1:07+fzVDlPuBlXS8tB0ktTAyf+Lp1j2+2zK3fBOL5b7c= github.com/mdp/qrterminal v1.0.1/go.mod h1:Z33WhxQe9B6CdW37HaVqcRKzP+kByF3q/qLxOGe12xQ= @@ -134,15 +144,22 @@ github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0Qu github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8= +github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pelletier/go-toml v1.7.0 h1:7utD74fnzVc/cpcyy8sjrlFr5vYpypUixARcHIMIGuI= +github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= @@ -155,6 +172,8 @@ github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY= +github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -186,8 +205,8 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= @@ -246,6 +265,7 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180816055513-1c9583448a9c/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -267,6 +287,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -313,8 +335,8 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= @@ -324,8 +346,12 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c h1:grhR+C34yXImVGp7EzNk+DTIk+323eIUWOmEevy6bDo= +gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/signald/client-protocol/v0/structs.go b/signald/client-protocol/v0/structs.go index aab9077..23cc58a 100644 --- a/signald/client-protocol/v0/structs.go +++ b/signald/client-protocol/v0/structs.go @@ -3,162 +3,162 @@ package v0 // DO NOT EDIT: this file is automatically generated by ./tools/generator in this repo type Request struct { - ID string `json:"id"` - Version string `json:"version"` - Type string `json:"type"` + ID string `json:"id" yaml:"id"` + Version string `json:"version" yaml:"version"` + Type string `json:"type" yaml:"type"` } type AnswerMessage struct { - ID int64 `json:"id,omitempty"` - Opaque string `json:"opaque,omitempty"` - Sdp string `json:"sdp,omitempty"` + ID int64 `json:"id,omitempty" yaml:"id,omitempty"` + Opaque string `json:"opaque,omitempty" yaml:"opaque,omitempty"` + Sdp string `json:"sdp,omitempty" yaml:"sdp,omitempty"` } type BusyMessage struct { - ID int64 `json:"id,omitempty"` + ID int64 `json:"id,omitempty" yaml:"id,omitempty"` } type ConfigurationMessage struct { - LinkPreviews *Optional `json:"linkPreviews,omitempty"` - ReadReceipts *Optional `json:"readReceipts,omitempty"` - TypingIndicators *Optional `json:"typingIndicators,omitempty"` - UnidentifiedDeliveryIndicators *Optional `json:"unidentifiedDeliveryIndicators,omitempty"` + LinkPreviews *Optional `json:"linkPreviews,omitempty" yaml:"linkPreviews,omitempty"` + ReadReceipts *Optional `json:"readReceipts,omitempty" yaml:"readReceipts,omitempty"` + TypingIndicators *Optional `json:"typingIndicators,omitempty" yaml:"typingIndicators,omitempty"` + UnidentifiedDeliveryIndicators *Optional `json:"unidentifiedDeliveryIndicators,omitempty" yaml:"unidentifiedDeliveryIndicators,omitempty"` } type DeviceInfo struct { - Created int64 `json:"created,omitempty"` - ID int64 `json:"id,omitempty"` - LastSeen int64 `json:"lastSeen,omitempty"` - Name string `json:"name,omitempty"` + Created int64 `json:"created,omitempty" yaml:"created,omitempty"` + ID int64 `json:"id,omitempty" yaml:"id,omitempty"` + LastSeen int64 `json:"lastSeen,omitempty" yaml:"lastSeen,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` } type HangupMessage struct { - DeviceId int32 `json:"deviceId,omitempty"` - ID int64 `json:"id,omitempty"` - Legacy bool `json:"legacy,omitempty"` - Type *Type `json:"type,omitempty"` + DeviceId int32 `json:"deviceId,omitempty" yaml:"deviceId,omitempty"` + ID int64 `json:"id,omitempty" yaml:"id,omitempty"` + Legacy bool `json:"legacy,omitempty" yaml:"legacy,omitempty"` + Type *Type `json:"type,omitempty" yaml:"type,omitempty"` } type IceUpdateMessage struct { - ID int64 `json:"id,omitempty"` - Opaque string `json:"opaque,omitempty"` - Sdp string `json:"sdp,omitempty"` + ID int64 `json:"id,omitempty" yaml:"id,omitempty"` + Opaque string `json:"opaque,omitempty" yaml:"opaque,omitempty"` + Sdp string `json:"sdp,omitempty" yaml:"sdp,omitempty"` } type JsonAccount struct { - DeviceId int32 `json:"deviceId,omitempty"` - Filename string `json:"filename,omitempty"` - Has_keys bool `json:"has_keys,omitempty"` - Registered bool `json:"registered,omitempty"` - Subscribed bool `json:"subscribed,omitempty"` - Username string `json:"username,omitempty"` - UUID string `json:"uuid,omitempty"` + DeviceId int32 `json:"deviceId,omitempty" yaml:"deviceId,omitempty"` + Filename string `json:"filename,omitempty" yaml:"filename,omitempty"` + Has_keys bool `json:"has_keys,omitempty" yaml:"has_keys,omitempty"` + Registered bool `json:"registered,omitempty" yaml:"registered,omitempty"` + Subscribed bool `json:"subscribed,omitempty" yaml:"subscribed,omitempty"` + Username string `json:"username,omitempty" yaml:"username,omitempty"` + UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` } type JsonAccountList struct { - Accounts []*JsonAccount `json:"accounts,omitempty"` + Accounts []*JsonAccount `json:"accounts,omitempty" yaml:"accounts,omitempty"` } type JsonAttachment struct { - Blurhash string `json:"blurhash,omitempty"` - Caption string `json:"caption,omitempty"` - ContentType string `json:"contentType,omitempty"` - CustomFilename string `json:"customFilename,omitempty"` - Digest string `json:"digest,omitempty"` - Filename string `json:"filename,omitempty"` - Height int32 `json:"height,omitempty"` - ID string `json:"id,omitempty"` - Key string `json:"key,omitempty"` - Size int32 `json:"size,omitempty"` - StoredFilename string `json:"storedFilename,omitempty"` - VoiceNote bool `json:"voiceNote,omitempty"` - Width int32 `json:"width,omitempty"` + Blurhash string `json:"blurhash,omitempty" yaml:"blurhash,omitempty"` + Caption string `json:"caption,omitempty" yaml:"caption,omitempty"` + ContentType string `json:"contentType,omitempty" yaml:"contentType,omitempty"` + CustomFilename string `json:"customFilename,omitempty" yaml:"customFilename,omitempty"` + Digest string `json:"digest,omitempty" yaml:"digest,omitempty"` + Filename string `json:"filename,omitempty" yaml:"filename,omitempty"` + Height int32 `json:"height,omitempty" yaml:"height,omitempty"` + ID string `json:"id,omitempty" yaml:"id,omitempty"` + Key string `json:"key,omitempty" yaml:"key,omitempty"` + Size int32 `json:"size,omitempty" yaml:"size,omitempty"` + StoredFilename string `json:"storedFilename,omitempty" yaml:"storedFilename,omitempty"` + VoiceNote bool `json:"voiceNote,omitempty" yaml:"voiceNote,omitempty"` + Width int32 `json:"width,omitempty" yaml:"width,omitempty"` } type JsonCallMessage struct { - AnswerMessage *AnswerMessage `json:"answerMessage,omitempty"` - BusyMessage *BusyMessage `json:"busyMessage,omitempty"` - DestinationDeviceId int32 `json:"destinationDeviceId,omitempty"` - HangupMessage *HangupMessage `json:"hangupMessage,omitempty"` - IceUpdateMessages []*IceUpdateMessage `json:"iceUpdateMessages,omitempty"` - IsMultiRing bool `json:"isMultiRing,omitempty"` - OfferMessage *OfferMessage `json:"offerMessage,omitempty"` + AnswerMessage *AnswerMessage `json:"answerMessage,omitempty" yaml:"answerMessage,omitempty"` + BusyMessage *BusyMessage `json:"busyMessage,omitempty" yaml:"busyMessage,omitempty"` + DestinationDeviceId int32 `json:"destinationDeviceId,omitempty" yaml:"destinationDeviceId,omitempty"` + HangupMessage *HangupMessage `json:"hangupMessage,omitempty" yaml:"hangupMessage,omitempty"` + IceUpdateMessages []*IceUpdateMessage `json:"iceUpdateMessages,omitempty" yaml:"iceUpdateMessages,omitempty"` + IsMultiRing bool `json:"isMultiRing,omitempty" yaml:"isMultiRing,omitempty"` + OfferMessage *OfferMessage `json:"offerMessage,omitempty" yaml:"offerMessage,omitempty"` } type JsonPreview struct { - Attachment *JsonAttachment `json:"attachment,omitempty"` - Title string `json:"title,omitempty"` - Url string `json:"url,omitempty"` + Attachment *JsonAttachment `json:"attachment,omitempty" yaml:"attachment,omitempty"` + Title string `json:"title,omitempty" yaml:"title,omitempty"` + Url string `json:"url,omitempty" yaml:"url,omitempty"` } type JsonQuotedAttachment struct { - ContentType string `json:"contentType,omitempty"` - FileName string `json:"fileName,omitempty"` - Thumbnail *JsonAttachment `json:"thumbnail,omitempty"` + ContentType string `json:"contentType,omitempty" yaml:"contentType,omitempty"` + FileName string `json:"fileName,omitempty" yaml:"fileName,omitempty"` + Thumbnail *JsonAttachment `json:"thumbnail,omitempty" yaml:"thumbnail,omitempty"` } type JsonReceiptMessage struct { - Timestamps []int64 `json:"timestamps,omitempty"` - Type string `json:"type,omitempty"` - When int64 `json:"when,omitempty"` + Timestamps []int64 `json:"timestamps,omitempty" yaml:"timestamps,omitempty"` + Type string `json:"type,omitempty" yaml:"type,omitempty"` + When int64 `json:"when,omitempty" yaml:"when,omitempty"` } type JsonSticker struct { - Attachment *JsonAttachment `json:"attachment,omitempty"` - PackID string `json:"packID,omitempty"` - PackKey string `json:"packKey,omitempty"` - StickerID int32 `json:"stickerID,omitempty"` + Attachment *JsonAttachment `json:"attachment,omitempty" yaml:"attachment,omitempty"` + PackID string `json:"packID,omitempty" yaml:"packID,omitempty"` + PackKey string `json:"packKey,omitempty" yaml:"packKey,omitempty"` + StickerID int32 `json:"stickerID,omitempty" yaml:"stickerID,omitempty"` } type JsonStickerPackOperationMessage struct { - PackID string `json:"packID,omitempty"` - PackKey string `json:"packKey,omitempty"` - Type string `json:"type,omitempty"` + PackID string `json:"packID,omitempty" yaml:"packID,omitempty"` + PackKey string `json:"packKey,omitempty" yaml:"packKey,omitempty"` + Type string `json:"type,omitempty" yaml:"type,omitempty"` } type JsonTypingMessage struct { - Action string `json:"action,omitempty"` - GroupId string `json:"groupId,omitempty"` - Timestamp int64 `json:"timestamp,omitempty"` + Action string `json:"action,omitempty" yaml:"action,omitempty"` + GroupId string `json:"groupId,omitempty" yaml:"groupId,omitempty"` + Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` } type Name struct { - Display *Optional `json:"display,omitempty"` - Family *Optional `json:"family,omitempty"` - Given *Optional `json:"given,omitempty"` - Middle *Optional `json:"middle,omitempty"` - Prefix *Optional `json:"prefix,omitempty"` - Suffix *Optional `json:"suffix,omitempty"` + Display *Optional `json:"display,omitempty" yaml:"display,omitempty"` + Family *Optional `json:"family,omitempty" yaml:"family,omitempty"` + Given *Optional `json:"given,omitempty" yaml:"given,omitempty"` + Middle *Optional `json:"middle,omitempty" yaml:"middle,omitempty"` + Prefix *Optional `json:"prefix,omitempty" yaml:"prefix,omitempty"` + Suffix *Optional `json:"suffix,omitempty" yaml:"suffix,omitempty"` } type OfferMessage struct { - ID int64 `json:"id,omitempty"` - Opaque string `json:"opaque,omitempty"` - Sdp string `json:"sdp,omitempty"` - Type *Type `json:"type,omitempty"` + ID int64 `json:"id,omitempty" yaml:"id,omitempty"` + Opaque string `json:"opaque,omitempty" yaml:"opaque,omitempty"` + Sdp string `json:"sdp,omitempty" yaml:"sdp,omitempty"` + Type *Type `json:"type,omitempty" yaml:"type,omitempty"` } type Optional struct { - Present bool `json:"present,omitempty"` + Present bool `json:"present,omitempty" yaml:"present,omitempty"` } type RemoteDelete struct { - TargetSentTimestamp int64 `json:"targetSentTimestamp,omitempty"` + TargetSentTimestamp int64 `json:"targetSentTimestamp,omitempty" yaml:"targetSentTimestamp,omitempty"` } type SharedContact struct { - Address *Optional `json:"address,omitempty"` - Avatar *Optional `json:"avatar,omitempty"` - Email *Optional `json:"email,omitempty"` - Name *Name `json:"name,omitempty"` - Organization *Optional `json:"organization,omitempty"` - Phone *Optional `json:"phone,omitempty"` + Address *Optional `json:"address,omitempty" yaml:"address,omitempty"` + Avatar *Optional `json:"avatar,omitempty" yaml:"avatar,omitempty"` + Email *Optional `json:"email,omitempty" yaml:"email,omitempty"` + Name *Name `json:"name,omitempty" yaml:"name,omitempty"` + Organization *Optional `json:"organization,omitempty" yaml:"organization,omitempty"` + Phone *Optional `json:"phone,omitempty" yaml:"phone,omitempty"` } type Success struct { - Duration int64 `json:"duration,omitempty"` - NeedsSync bool `json:"needsSync,omitempty"` - Unidentified bool `json:"unidentified,omitempty"` + Duration int64 `json:"duration,omitempty" yaml:"duration,omitempty"` + NeedsSync bool `json:"needsSync,omitempty" yaml:"needsSync,omitempty"` + Unidentified bool `json:"unidentified,omitempty" yaml:"unidentified,omitempty"` } type Type struct { diff --git a/signald/client-protocol/v1/structs.go b/signald/client-protocol/v1/structs.go index 1601545..83adc87 100644 --- a/signald/client-protocol/v1/structs.go +++ b/signald/client-protocol/v1/structs.go @@ -7,272 +7,272 @@ import ( ) type Request struct { - ID string `json:"id"` - Version string `json:"version"` - Type string `json:"type"` + ID string `json:"id" yaml:"id"` + Version string `json:"version" yaml:"version"` + Type string `json:"type" yaml:"type"` } // AcceptInvitationRequest: Accept a v2 group invitation. Note that you must have a profile name set to join groups. type AcceptInvitationRequest struct { Request - Account string `json:"account,omitempty"` // The account to interact with - GroupID string `json:"groupID,omitempty"` + Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to interact with + GroupID string `json:"groupID,omitempty" yaml:"groupID,omitempty"` } // ApproveMembershipRequest: approve a request to join a group type ApproveMembershipRequest struct { Request - Account string `json:"account,omitempty"` // The account to interact with - GroupID string `json:"groupID,omitempty"` - Members []*JsonAddress `json:"members,omitempty"` // list of requesting members to approve + Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to interact with + GroupID string `json:"groupID,omitempty" yaml:"groupID,omitempty"` + Members []*JsonAddress `json:"members,omitempty" yaml:"members,omitempty"` // list of requesting members to approve } type Capabilities struct { - Gv1Migration bool `json:"gv1-migration,omitempty"` - Gv2 bool `json:"gv2,omitempty"` - Storage bool `json:"storage,omitempty"` + Gv1Migration bool `json:"gv1-migration,omitempty" yaml:"gv1-migration,omitempty"` + Gv2 bool `json:"gv2,omitempty" yaml:"gv2,omitempty"` + Storage bool `json:"storage,omitempty" yaml:"storage,omitempty"` } // GetGroupRequest: Query the server for the latest state of a known group type GetGroupRequest struct { Request - Account string `json:"account,omitempty"` // The account to interact with - GroupID string `json:"groupID,omitempty"` - Revision int32 `json:"revision,omitempty"` // the latest known revision, default value (-1) forces fetch from server + Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to interact with + GroupID string `json:"groupID,omitempty" yaml:"groupID,omitempty"` + Revision int32 `json:"revision,omitempty" yaml:"revision,omitempty"` // the latest known revision, default value (-1) forces fetch from server } // GetLinkedDevicesRequest: list all linked devices on a Signal account type GetLinkedDevicesRequest struct { Request - Account string `json:"account,omitempty"` // The account to interact with + Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to interact with } // GetProfileRequest: Get all information available about a user type GetProfileRequest struct { Request - Account string `json:"account,omitempty"` // the signald account to use - Address *JsonAddress `json:"address,omitempty"` // the address to look up - Async bool `json:"async,omitempty"` // return results from local store immediately, refreshing from server if needed. If false (default), block until all pending profiles have been retrieved. + Account string `json:"account,omitempty" yaml:"account,omitempty"` // the signald account to use + Address *JsonAddress `json:"address,omitempty" yaml:"address,omitempty"` // the address to look up + Async bool `json:"async,omitempty" yaml:"async,omitempty"` // return results from local store immediately, refreshing from server if needed. If false (default), block until all pending profiles have been retrieved. } // GroupInfo: A generic type that is used when the group version is not known type GroupInfo struct { - V1 *JsonGroupInfo `json:"v1,omitempty"` - V2 *JsonGroupV2Info `json:"v2,omitempty"` + V1 *JsonGroupInfo `json:"v1,omitempty" yaml:"v1,omitempty"` + V2 *JsonGroupV2Info `json:"v2,omitempty" yaml:"v2,omitempty"` } type GroupList struct { - Groups []*JsonGroupV2Info `json:"groups,omitempty"` - LegacyGroups []*JsonGroupInfo `json:"legacyGroups,omitempty"` + Groups []*JsonGroupV2Info `json:"groups,omitempty" yaml:"groups,omitempty"` + LegacyGroups []*JsonGroupInfo `json:"legacyGroups,omitempty" yaml:"legacyGroups,omitempty"` } // JoinGroupRequest: Join a group using the a signal.group URL. Note that you must have a profile name set to join groups. type JoinGroupRequest struct { Request - Account string `json:"account,omitempty"` // The account to interact with - Uri string `json:"uri,omitempty"` // The signal.group URL + Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to interact with + Uri string `json:"uri,omitempty" yaml:"uri,omitempty"` // The signal.group URL } type JsonAddress struct { - Number string `json:"number,omitempty"` // An e164 phone number, starting with +. Currently the only available user-facing Signal identifier. - Relay string `json:"relay,omitempty"` - UUID string `json:"uuid,omitempty"` // A UUID, the unique identifier for a particular Signal account. + Number string `json:"number,omitempty" yaml:"number,omitempty"` // An e164 phone number, starting with +. Currently the only available user-facing Signal identifier. + Relay string `json:"relay,omitempty" yaml:"relay,omitempty"` + UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` // A UUID, the unique identifier for a particular Signal account. } type JsonBlockedListMessage struct { - Addresses []*JsonAddress `json:"addresses,omitempty"` - GroupIds []string `json:"groupIds,omitempty"` + Addresses []*JsonAddress `json:"addresses,omitempty" yaml:"addresses,omitempty"` + GroupIds []string `json:"groupIds,omitempty" yaml:"groupIds,omitempty"` } type JsonDataMessage struct { - Attachments []*v0.JsonAttachment `json:"attachments,omitempty"` // files attached to the incoming message - Body string `json:"body,omitempty"` // the text body of the incoming message. - Contacts []*v0.SharedContact `json:"contacts,omitempty"` // if the incoming message has a shared contact, the contact's information will be here - EndSession bool `json:"endSession,omitempty"` - ExpiresInSeconds int32 `json:"expiresInSeconds,omitempty"` // the expiry timer on the incoming message. Clients should delete records of the message within this number of seconds - Group *JsonGroupInfo `json:"group,omitempty"` // if the incoming message was sent to a v1 group, information about that group will be here - GroupV2 *JsonGroupV2Info `json:"groupV2,omitempty"` // is the incoming message was sent to a v2 group, basic identifying information about that group will be here. For full information, use list_groups - Mentions []*JsonMention `json:"mentions,omitempty"` // list of mentions in the message - Previews []*v0.JsonPreview `json:"previews,omitempty"` // if the incoming message has a link preview, information about that preview will be here - ProfileKeyUpdate bool `json:"profileKeyUpdate,omitempty"` - Quote *JsonQuote `json:"quote,omitempty"` // if the incoming message is a quote or reply to another message, this will contain information about that message - Reaction *JsonReaction `json:"reaction,omitempty"` // if the message adds or removes a reaction to another message, this will indicate what change is being made - RemoteDelete *v0.RemoteDelete `json:"remoteDelete,omitempty"` // if the inbound message is deleting a previously sent message, indicates which message should be deleted - Sticker *v0.JsonSticker `json:"sticker,omitempty"` // if the incoming message is a sticker, information about the sicker will be here - Timestamp int64 `json:"timestamp,omitempty"` // 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. - ViewOnce bool `json:"viewOnce,omitempty"` // indicates the message is a view once message. View once messages typically include no body and a single image attachment. Official Signal clients will prevent the user from saving the image, and once the user has viewed the image once they will destroy the image. + Attachments []*v0.JsonAttachment `json:"attachments,omitempty" yaml:"attachments,omitempty"` // files attached to the incoming message + Body string `json:"body,omitempty" yaml:"body,omitempty"` // the text body of the incoming message. + Contacts []*v0.SharedContact `json:"contacts,omitempty" yaml:"contacts,omitempty"` // if the incoming message has a shared contact, the contact's information will be here + EndSession bool `json:"endSession,omitempty" yaml:"endSession,omitempty"` + ExpiresInSeconds int32 `json:"expiresInSeconds,omitempty" yaml:"expiresInSeconds,omitempty"` // the expiry timer on the incoming message. Clients should delete records of the message within this number of seconds + Group *JsonGroupInfo `json:"group,omitempty" yaml:"group,omitempty"` // if the incoming message was sent to a v1 group, information about that group will be here + GroupV2 *JsonGroupV2Info `json:"groupV2,omitempty" yaml:"groupV2,omitempty"` // is the incoming message was sent to a v2 group, basic identifying information about that group will be here. For full information, use list_groups + Mentions []*JsonMention `json:"mentions,omitempty" yaml:"mentions,omitempty"` // list of mentions in the message + Previews []*v0.JsonPreview `json:"previews,omitempty" yaml:"previews,omitempty"` // if the incoming message has a link preview, information about that preview will be here + ProfileKeyUpdate bool `json:"profileKeyUpdate,omitempty" yaml:"profileKeyUpdate,omitempty"` + Quote *JsonQuote `json:"quote,omitempty" yaml:"quote,omitempty"` // if the incoming message is a quote or reply to another message, this will contain information about that message + Reaction *JsonReaction `json:"reaction,omitempty" yaml:"reaction,omitempty"` // if the message adds or removes a reaction to another message, this will indicate what change is being made + RemoteDelete *v0.RemoteDelete `json:"remoteDelete,omitempty" yaml:"remoteDelete,omitempty"` // if the inbound message is deleting a previously sent message, indicates which message should be deleted + Sticker *v0.JsonSticker `json:"sticker,omitempty" yaml:"sticker,omitempty"` // if the incoming message is a sticker, information about the sicker will be here + Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` // 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. + ViewOnce bool `json:"viewOnce,omitempty" yaml:"viewOnce,omitempty"` // indicates the message is a view once message. View once messages typically include no body and a single image attachment. Official Signal clients will prevent the user from saving the image, and once the user has viewed the image once they will destroy the image. } type JsonGroupInfo struct { - AvatarId int64 `json:"avatarId,omitempty"` - GroupId string `json:"groupId,omitempty"` - Members []*JsonAddress `json:"members,omitempty"` - Name string `json:"name,omitempty"` - Type string `json:"type,omitempty"` + AvatarId int64 `json:"avatarId,omitempty" yaml:"avatarId,omitempty"` + GroupId string `json:"groupId,omitempty" yaml:"groupId,omitempty"` + Members []*JsonAddress `json:"members,omitempty" yaml:"members,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Type string `json:"type,omitempty" yaml:"type,omitempty"` } type JsonGroupJoinInfo struct { - AddFromInviteLink int32 `json:"addFromInviteLink,omitempty"` - GroupID string `json:"groupID,omitempty"` - MemberCount int32 `json:"memberCount,omitempty"` - PendingAdminApproval bool `json:"pendingAdminApproval,omitempty"` - Revision int32 `json:"revision,omitempty"` - Title string `json:"title,omitempty"` + AddFromInviteLink int32 `json:"addFromInviteLink,omitempty" yaml:"addFromInviteLink,omitempty"` + GroupID string `json:"groupID,omitempty" yaml:"groupID,omitempty"` + MemberCount int32 `json:"memberCount,omitempty" yaml:"memberCount,omitempty"` + PendingAdminApproval bool `json:"pendingAdminApproval,omitempty" yaml:"pendingAdminApproval,omitempty"` + Revision int32 `json:"revision,omitempty" yaml:"revision,omitempty"` + Title string `json:"title,omitempty" yaml:"title,omitempty"` } type JsonGroupV2Info struct { - ID string `json:"id,omitempty"` - InviteLink string `json:"inviteLink,omitempty"` - Members []*JsonAddress `json:"members,omitempty"` - PendingMembers []*JsonAddress `json:"pendingMembers,omitempty"` - RequestingMembers []*JsonAddress `json:"requestingMembers,omitempty"` - Revision int32 `json:"revision,omitempty"` - Timer int32 `json:"timer,omitempty"` - Title string `json:"title,omitempty"` + ID string `json:"id,omitempty" yaml:"id,omitempty"` + InviteLink string `json:"inviteLink,omitempty" yaml:"inviteLink,omitempty"` + Members []*JsonAddress `json:"members,omitempty" yaml:"members,omitempty"` + PendingMembers []*JsonAddress `json:"pendingMembers,omitempty" yaml:"pendingMembers,omitempty"` + RequestingMembers []*JsonAddress `json:"requestingMembers,omitempty" yaml:"requestingMembers,omitempty"` + Revision int32 `json:"revision,omitempty" yaml:"revision,omitempty"` + Timer int32 `json:"timer,omitempty" yaml:"timer,omitempty"` + Title string `json:"title,omitempty" yaml:"title,omitempty"` } type JsonMention struct { - Length int32 `json:"length,omitempty"` // The length of the mention represented in the message. Seems to always be 1 but included here in case that changes. - Start int32 `json:"start,omitempty"` // The number of characters in that the mention starts at. Note that due to a quirk of how signald encodes JSON, if this value is 0 (for example if the first character in the message is the mention) the field won't show up. - UUID string `json:"uuid,omitempty"` // The UUID of the account being mentioned + Length int32 `json:"length,omitempty" yaml:"length,omitempty"` // The length of the mention represented in the message. Seems to always be 1 but included here in case that changes. + Start int32 `json:"start,omitempty" yaml:"start,omitempty"` // The number of characters in that the mention starts at. Note that due to a quirk of how signald encodes JSON, if this value is 0 (for example if the first character in the message is the mention) the field won't show up. + UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` // The UUID of the account being mentioned } type JsonMessageEnvelope struct { - CallMessage *v0.JsonCallMessage `json:"callMessage,omitempty"` - DataMessage *JsonDataMessage `json:"dataMessage,omitempty"` - HasContent bool `json:"hasContent,omitempty"` - HasLegacyMessage bool `json:"hasLegacyMessage,omitempty"` - IsUnidentifiedSender bool `json:"isUnidentifiedSender,omitempty"` - Receipt *v0.JsonReceiptMessage `json:"receipt,omitempty"` - Relay string `json:"relay,omitempty"` - ServerDeliveredTimestamp int64 `json:"serverDeliveredTimestamp,omitempty"` - ServerTimestamp int64 `json:"serverTimestamp,omitempty"` - Source *JsonAddress `json:"source,omitempty"` - SourceDevice int32 `json:"sourceDevice,omitempty"` - SyncMessage *JsonSyncMessage `json:"syncMessage,omitempty"` - Timestamp int64 `json:"timestamp,omitempty"` - TimestampISO string `json:"timestampISO,omitempty"` - Type string `json:"type,omitempty"` - Typing *v0.JsonTypingMessage `json:"typing,omitempty"` - Username string `json:"username,omitempty"` - UUID string `json:"uuid,omitempty"` + CallMessage *v0.JsonCallMessage `json:"callMessage,omitempty" yaml:"callMessage,omitempty"` + DataMessage *JsonDataMessage `json:"dataMessage,omitempty" yaml:"dataMessage,omitempty"` + HasContent bool `json:"hasContent,omitempty" yaml:"hasContent,omitempty"` + HasLegacyMessage bool `json:"hasLegacyMessage,omitempty" yaml:"hasLegacyMessage,omitempty"` + IsUnidentifiedSender bool `json:"isUnidentifiedSender,omitempty" yaml:"isUnidentifiedSender,omitempty"` + Receipt *v0.JsonReceiptMessage `json:"receipt,omitempty" yaml:"receipt,omitempty"` + Relay string `json:"relay,omitempty" yaml:"relay,omitempty"` + ServerDeliveredTimestamp int64 `json:"serverDeliveredTimestamp,omitempty" yaml:"serverDeliveredTimestamp,omitempty"` + ServerTimestamp int64 `json:"serverTimestamp,omitempty" yaml:"serverTimestamp,omitempty"` + Source *JsonAddress `json:"source,omitempty" yaml:"source,omitempty"` + SourceDevice int32 `json:"sourceDevice,omitempty" yaml:"sourceDevice,omitempty"` + SyncMessage *JsonSyncMessage `json:"syncMessage,omitempty" yaml:"syncMessage,omitempty"` + Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` + TimestampISO string `json:"timestampISO,omitempty" yaml:"timestampISO,omitempty"` + Type string `json:"type,omitempty" yaml:"type,omitempty"` + Typing *v0.JsonTypingMessage `json:"typing,omitempty" yaml:"typing,omitempty"` + Username string `json:"username,omitempty" yaml:"username,omitempty"` + UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"` } type JsonMessageRequestResponseMessage struct { - GroupId string `json:"groupId,omitempty"` - Person *JsonAddress `json:"person,omitempty"` - Type string `json:"type,omitempty"` + GroupId string `json:"groupId,omitempty" yaml:"groupId,omitempty"` + Person *JsonAddress `json:"person,omitempty" yaml:"person,omitempty"` + Type string `json:"type,omitempty" yaml:"type,omitempty"` } // JsonQuote: A quote is a reply to a previous message. ID is the sent time of the message being replied to type JsonQuote struct { - Attachments []*v0.JsonQuotedAttachment `json:"attachments,omitempty"` // list of files attached to the quoted message - Author *JsonAddress `json:"author,omitempty"` // the author of the message being quoted - ID int64 `json:"id,omitempty"` // the client timestamp of the message being quoted - Mentions []*JsonMention `json:"mentions,omitempty"` // list of mentions in the quoted message - Text string `json:"text,omitempty"` // the body of the message being quoted + Attachments []*v0.JsonQuotedAttachment `json:"attachments,omitempty" yaml:"attachments,omitempty"` // list of files attached to the quoted message + Author *JsonAddress `json:"author,omitempty" yaml:"author,omitempty"` // the author of the message being quoted + ID int64 `json:"id,omitempty" yaml:"id,omitempty"` // the client timestamp of the message being quoted + Mentions []*JsonMention `json:"mentions,omitempty" yaml:"mentions,omitempty"` // list of mentions in the quoted message + Text string `json:"text,omitempty" yaml:"text,omitempty"` // the body of the message being quoted } type JsonReaction struct { - Emoji string `json:"emoji,omitempty"` // the emoji to react with - Remove bool `json:"remove,omitempty"` // set to true to remove the reaction. requires emoji be set to previously reacted emoji - TargetAuthor *JsonAddress `json:"targetAuthor,omitempty"` // the author of the message being reacted to - TargetSentTimestamp int64 `json:"targetSentTimestamp,omitempty"` // the client timestamp of the message being reacted to + Emoji string `json:"emoji,omitempty" yaml:"emoji,omitempty"` // the emoji to react with + Remove bool `json:"remove,omitempty" yaml:"remove,omitempty"` // set to true to remove the reaction. requires emoji be set to previously reacted emoji + TargetAuthor *JsonAddress `json:"targetAuthor,omitempty" yaml:"targetAuthor,omitempty"` // the author of the message being reacted to + TargetSentTimestamp int64 `json:"targetSentTimestamp,omitempty" yaml:"targetSentTimestamp,omitempty"` // the client timestamp of the message being reacted to } type JsonReadMessage struct { - Sender *JsonAddress `json:"sender,omitempty"` - Timestamp int64 `json:"timestamp,omitempty"` + Sender *JsonAddress `json:"sender,omitempty" yaml:"sender,omitempty"` + Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` } type JsonSendMessageResult struct { - Address *JsonAddress `json:"address,omitempty"` - IdentityFailure string `json:"identityFailure,omitempty"` - NetworkFailure bool `json:"networkFailure,omitempty"` - Success *v0.Success `json:"success,omitempty"` - UnregisteredFailure bool `json:"unregisteredFailure,omitempty"` + Address *JsonAddress `json:"address,omitempty" yaml:"address,omitempty"` + IdentityFailure string `json:"identityFailure,omitempty" yaml:"identityFailure,omitempty"` + NetworkFailure bool `json:"networkFailure,omitempty" yaml:"networkFailure,omitempty"` + Success *v0.Success `json:"success,omitempty" yaml:"success,omitempty"` + UnregisteredFailure bool `json:"unregisteredFailure,omitempty" yaml:"unregisteredFailure,omitempty"` } type JsonSentTranscriptMessage struct { - Destination *JsonAddress `json:"destination,omitempty"` - ExpirationStartTimestamp int64 `json:"expirationStartTimestamp,omitempty"` - IsRecipientUpdate bool `json:"isRecipientUpdate,omitempty"` - Message *JsonDataMessage `json:"message,omitempty"` - Timestamp int64 `json:"timestamp,omitempty"` - UnidentifiedStatus map[string]string `json:"unidentifiedStatus,omitempty"` + Destination *JsonAddress `json:"destination,omitempty" yaml:"destination,omitempty"` + ExpirationStartTimestamp int64 `json:"expirationStartTimestamp,omitempty" yaml:"expirationStartTimestamp,omitempty"` + IsRecipientUpdate bool `json:"isRecipientUpdate,omitempty" yaml:"isRecipientUpdate,omitempty"` + Message *JsonDataMessage `json:"message,omitempty" yaml:"message,omitempty"` + Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` + UnidentifiedStatus map[string]string `json:"unidentifiedStatus,omitempty" yaml:"unidentifiedStatus,omitempty"` } type JsonSyncMessage struct { - BlockedList *JsonBlockedListMessage `json:"blockedList,omitempty"` - Configuration *v0.ConfigurationMessage `json:"configuration,omitempty"` - Contacts *v0.JsonAttachment `json:"contacts,omitempty"` - ContactsComplete bool `json:"contactsComplete,omitempty"` - FetchType string `json:"fetchType,omitempty"` - Groups *v0.JsonAttachment `json:"groups,omitempty"` - MessageRequestResponse *JsonMessageRequestResponseMessage `json:"messageRequestResponse,omitempty"` - ReadMessages []*JsonReadMessage `json:"readMessages,omitempty"` - Request string `json:"request,omitempty"` - Sent *JsonSentTranscriptMessage `json:"sent,omitempty"` - StickerPackOperations []*v0.JsonStickerPackOperationMessage `json:"stickerPackOperations,omitempty"` - Verified *JsonVerifiedMessage `json:"verified,omitempty"` - ViewOnceOpen *JsonViewOnceOpenMessage `json:"viewOnceOpen,omitempty"` + BlockedList *JsonBlockedListMessage `json:"blockedList,omitempty" yaml:"blockedList,omitempty"` + Configuration *v0.ConfigurationMessage `json:"configuration,omitempty" yaml:"configuration,omitempty"` + Contacts *v0.JsonAttachment `json:"contacts,omitempty" yaml:"contacts,omitempty"` + ContactsComplete bool `json:"contactsComplete,omitempty" yaml:"contactsComplete,omitempty"` + FetchType string `json:"fetchType,omitempty" yaml:"fetchType,omitempty"` + Groups *v0.JsonAttachment `json:"groups,omitempty" yaml:"groups,omitempty"` + MessageRequestResponse *JsonMessageRequestResponseMessage `json:"messageRequestResponse,omitempty" yaml:"messageRequestResponse,omitempty"` + ReadMessages []*JsonReadMessage `json:"readMessages,omitempty" yaml:"readMessages,omitempty"` + Request string `json:"request,omitempty" yaml:"request,omitempty"` + Sent *JsonSentTranscriptMessage `json:"sent,omitempty" yaml:"sent,omitempty"` + StickerPackOperations []*v0.JsonStickerPackOperationMessage `json:"stickerPackOperations,omitempty" yaml:"stickerPackOperations,omitempty"` + Verified *JsonVerifiedMessage `json:"verified,omitempty" yaml:"verified,omitempty"` + ViewOnceOpen *JsonViewOnceOpenMessage `json:"viewOnceOpen,omitempty" yaml:"viewOnceOpen,omitempty"` } type JsonVerifiedMessage struct { - Destination *JsonAddress `json:"destination,omitempty"` - IdentityKey string `json:"identityKey,omitempty"` - Timestamp int64 `json:"timestamp,omitempty"` - Verified string `json:"verified,omitempty"` + Destination *JsonAddress `json:"destination,omitempty" yaml:"destination,omitempty"` + IdentityKey string `json:"identityKey,omitempty" yaml:"identityKey,omitempty"` + Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` + Verified string `json:"verified,omitempty" yaml:"verified,omitempty"` } type JsonVersionMessage struct { - Branch string `json:"branch,omitempty"` - Commit string `json:"commit,omitempty"` - Name string `json:"name,omitempty"` - Version string `json:"version,omitempty"` + Branch string `json:"branch,omitempty" yaml:"branch,omitempty"` + Commit string `json:"commit,omitempty" yaml:"commit,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Version string `json:"version,omitempty" yaml:"version,omitempty"` } type JsonViewOnceOpenMessage struct { - Sender *JsonAddress `json:"sender,omitempty"` - Timestamp int64 `json:"timestamp,omitempty"` + Sender *JsonAddress `json:"sender,omitempty" yaml:"sender,omitempty"` + Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` } type LinkedDevices struct { - Devices []*v0.DeviceInfo `json:"devices,omitempty"` + Devices []*v0.DeviceInfo `json:"devices,omitempty" yaml:"devices,omitempty"` } type ListContactsRequest struct { Request - Account string `json:"account,omitempty"` - Async bool `json:"async,omitempty"` // return results from local store immediately, refreshing from server if needed. If false (default), block until all pending profiles have been retrieved. + Account string `json:"account,omitempty" yaml:"account,omitempty"` + Async bool `json:"async,omitempty" yaml:"async,omitempty"` // return results from local store immediately, refreshing from server if needed. If false (default), block until all pending profiles have been retrieved. } type ListGroupsRequest struct { Request - Account string `json:"account,omitempty"` + Account string `json:"account,omitempty" yaml:"account,omitempty"` } type MarkReadRequest struct { Request - Account string `json:"account,omitempty"` // The account to interact with - Timestamps []int64 `json:"timestamps,omitempty"` // List of messages to mark as read - To *JsonAddress `json:"to,omitempty"` // The address that sent the message being marked as read + Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to interact with + Timestamps []int64 `json:"timestamps,omitempty" yaml:"timestamps,omitempty"` // List of messages to mark as read + To *JsonAddress `json:"to,omitempty" yaml:"to,omitempty"` // The address that sent the message being marked as read } // Profile: Information about a Signal user type Profile struct { - Address *JsonAddress `json:"address,omitempty"` - Avatar string `json:"avatar,omitempty"` - Capabilities *Capabilities `json:"capabilities,omitempty"` - Color string `json:"color,omitempty"` - ExpirationTime int32 `json:"expiration_time,omitempty"` - InboxPosition int32 `json:"inbox_position,omitempty"` - Name string `json:"name,omitempty"` // The user's name from local contact names if available, or if not in contact list their Signal profile name - ProfileName string `json:"profile_name,omitempty"` // The user's Signal profile name + Address *JsonAddress `json:"address,omitempty" yaml:"address,omitempty"` + Avatar string `json:"avatar,omitempty" yaml:"avatar,omitempty"` + Capabilities *Capabilities `json:"capabilities,omitempty" yaml:"capabilities,omitempty"` + Color string `json:"color,omitempty" yaml:"color,omitempty"` + ExpirationTime int32 `json:"expiration_time,omitempty" yaml:"expiration_time,omitempty"` + InboxPosition int32 `json:"inbox_position,omitempty" yaml:"inbox_position,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` // The user's name from local contact names if available, or if not in contact list their Signal profile name + ProfileName string `json:"profile_name,omitempty" yaml:"profile_name,omitempty"` // The user's Signal profile name } type ProfileList struct { - Profiles []*Profile `json:"profiles,omitempty"` + Profiles []*Profile `json:"profiles,omitempty" yaml:"profiles,omitempty"` } type ProtocolRequest struct { @@ -282,60 +282,60 @@ type ProtocolRequest struct { // ReactRequest: react to a previous message type ReactRequest struct { Request - Reaction *JsonReaction `json:"reaction,omitempty"` - RecipientAddress *JsonAddress `json:"recipientAddress,omitempty"` - RecipientGroupID string `json:"recipientGroupId,omitempty"` - Timestamp int64 `json:"timestamp,omitempty"` - Username string `json:"username,omitempty"` + Reaction *JsonReaction `json:"reaction,omitempty" yaml:"reaction,omitempty"` + RecipientAddress *JsonAddress `json:"recipientAddress,omitempty" yaml:"recipientAddress,omitempty"` + RecipientGroupID string `json:"recipientGroupId,omitempty" yaml:"recipientGroupId,omitempty"` + Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` + Username string `json:"username,omitempty" yaml:"username,omitempty"` } // RemoveLinkedDeviceRequest: Remove a linked device from the Signal account. Only allowed when the local device id is 1 type RemoveLinkedDeviceRequest struct { Request - Account string `json:"account,omitempty"` // The account to interact with - DeviceId int64 `json:"deviceId,omitempty"` // the ID of the device to unlink + Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to interact with + DeviceId int64 `json:"deviceId,omitempty" yaml:"deviceId,omitempty"` // the ID of the device to unlink } // ResolveAddressRequest: Resolve a partial JsonAddress with only a number or UUID to one with both. Anywhere that signald accepts a JsonAddress will except a partial, this is a convenience function for client authors, mostly because signald doesn't resolve all the partials it returns type ResolveAddressRequest struct { Request - Account string `json:"account,omitempty"` // The signal account to use - Partial *JsonAddress `json:"partial,omitempty"` // The partial address, missing fields + Account string `json:"account,omitempty" yaml:"account,omitempty"` // The signal account to use + Partial *JsonAddress `json:"partial,omitempty" yaml:"partial,omitempty"` // The partial address, missing fields } type SendRequest struct { Request - Attachments []*v0.JsonAttachment `json:"attachments,omitempty"` - Mentions []*JsonMention `json:"mentions,omitempty"` - MessageBody string `json:"messageBody,omitempty"` - Quote *JsonQuote `json:"quote,omitempty"` - RecipientAddress *JsonAddress `json:"recipientAddress,omitempty"` - RecipientGroupID string `json:"recipientGroupId,omitempty"` - Timestamp int64 `json:"timestamp,omitempty"` - Username string `json:"username,omitempty"` + Attachments []*v0.JsonAttachment `json:"attachments,omitempty" yaml:"attachments,omitempty"` + Mentions []*JsonMention `json:"mentions,omitempty" yaml:"mentions,omitempty"` + MessageBody string `json:"messageBody,omitempty" yaml:"messageBody,omitempty"` + Quote *JsonQuote `json:"quote,omitempty" yaml:"quote,omitempty"` + RecipientAddress *JsonAddress `json:"recipientAddress,omitempty" yaml:"recipientAddress,omitempty"` + RecipientGroupID string `json:"recipientGroupId,omitempty" yaml:"recipientGroupId,omitempty"` + Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` + Username string `json:"username,omitempty" yaml:"username,omitempty"` } type SendResponse struct { - Results []*JsonSendMessageResult `json:"results,omitempty"` - Timestamp int64 `json:"timestamp,omitempty"` + Results []*JsonSendMessageResult `json:"results,omitempty" yaml:"results,omitempty"` + Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` } type SetProfile struct { Request - Account string `json:"account,omitempty"` // The phone number of the account to use - AvatarFile string `json:"avatarFile,omitempty"` // Path to new profile avatar file, if the avatar should be updated - Name string `json:"name,omitempty"` // New profile name. Set to empty string for no profile name + Account string `json:"account,omitempty" yaml:"account,omitempty"` // The phone number of the account to use + AvatarFile string `json:"avatarFile,omitempty" yaml:"avatarFile,omitempty"` // Path to new profile avatar file, if the avatar should be updated + Name string `json:"name,omitempty" yaml:"name,omitempty"` // New profile name. Set to empty string for no profile name } // UpdateGroupRequest: modify a group type UpdateGroupRequest struct { Request - Account string `json:"account,omitempty"` // The identifier of the account to interact with - AddMembers []*JsonAddress `json:"addMembers,omitempty"` - Avatar string `json:"avatar,omitempty"` - GroupID string `json:"groupID,omitempty"` - RemoveMembers []*JsonAddress `json:"removeMembers,omitempty"` - Title string `json:"title,omitempty"` + Account string `json:"account,omitempty" yaml:"account,omitempty"` // The identifier of the account to interact with + AddMembers []*JsonAddress `json:"addMembers,omitempty" yaml:"addMembers,omitempty"` + Avatar string `json:"avatar,omitempty" yaml:"avatar,omitempty"` + GroupID string `json:"groupID,omitempty" yaml:"groupID,omitempty"` + RemoveMembers []*JsonAddress `json:"removeMembers,omitempty" yaml:"removeMembers,omitempty"` + Title string `json:"title,omitempty" yaml:"title,omitempty"` } type VersionRequest struct { diff --git a/signald/client-protocol/v1alpha1/structs.go b/signald/client-protocol/v1alpha1/structs.go index 497e89d..fbc1288 100644 --- a/signald/client-protocol/v1alpha1/structs.go +++ b/signald/client-protocol/v1alpha1/structs.go @@ -8,69 +8,69 @@ import ( ) type Request struct { - ID string `json:"id"` - Version string `json:"version"` - Type string `json:"type"` + ID string `json:"id" yaml:"id"` + Version string `json:"version" yaml:"version"` + Type string `json:"type" yaml:"type"` } // AcceptInvitationRequest: Accept a v2 group invitation. Note that you must have a profile name set to join groups. type AcceptInvitationRequest struct { Request - Account string `json:"account,omitempty"` // The account to interact with - GroupID string `json:"groupID,omitempty"` + Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to interact with + GroupID string `json:"groupID,omitempty" yaml:"groupID,omitempty"` } // ApproveMembershipRequest: approve a request to join a group type ApproveMembershipRequest struct { Request - Account string `json:"account,omitempty"` // The account to interact with - GroupID string `json:"groupID,omitempty"` - Members []*v1.JsonAddress `json:"members,omitempty"` // list of requesting members to approve + Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to interact with + GroupID string `json:"groupID,omitempty" yaml:"groupID,omitempty"` + Members []*v1.JsonAddress `json:"members,omitempty" yaml:"members,omitempty"` // list of requesting members to approve } // GetGroupRequest: Query the server for the latest state of a known group type GetGroupRequest struct { Request - Account string `json:"account,omitempty"` // The account to interact with - GroupID string `json:"groupID,omitempty"` - Revision int32 `json:"revision,omitempty"` // the latest known revision, default value (-1) forces fetch from server + Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to interact with + GroupID string `json:"groupID,omitempty" yaml:"groupID,omitempty"` + Revision int32 `json:"revision,omitempty" yaml:"revision,omitempty"` // the latest known revision, default value (-1) forces fetch from server } // GetLinkedDevicesRequest: list all linked devices on a Signal account type GetLinkedDevicesRequest struct { Request - Account string `json:"account,omitempty"` // The account to interact with + Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to interact with } // JoinGroupRequest: Join a group using the a signal.group URL. Note that you must have a profile name set to join groups. type JoinGroupRequest struct { Request - Account string `json:"account,omitempty"` // The account to interact with - Uri string `json:"uri,omitempty"` // The signal.group URL + Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to interact with + Uri string `json:"uri,omitempty" yaml:"uri,omitempty"` // The signal.group URL } type JsonGroupJoinInfo struct { - AddFromInviteLink int32 `json:"addFromInviteLink,omitempty"` - GroupID string `json:"groupID,omitempty"` - MemberCount int32 `json:"memberCount,omitempty"` - PendingAdminApproval bool `json:"pendingAdminApproval,omitempty"` - Revision int32 `json:"revision,omitempty"` - Title string `json:"title,omitempty"` + AddFromInviteLink int32 `json:"addFromInviteLink,omitempty" yaml:"addFromInviteLink,omitempty"` + GroupID string `json:"groupID,omitempty" yaml:"groupID,omitempty"` + MemberCount int32 `json:"memberCount,omitempty" yaml:"memberCount,omitempty"` + PendingAdminApproval bool `json:"pendingAdminApproval,omitempty" yaml:"pendingAdminApproval,omitempty"` + Revision int32 `json:"revision,omitempty" yaml:"revision,omitempty"` + Title string `json:"title,omitempty" yaml:"title,omitempty"` } type JsonGroupV2Info struct { - ID string `json:"id,omitempty"` - InviteLink string `json:"inviteLink,omitempty"` - Members []*v1.JsonAddress `json:"members,omitempty"` - PendingMembers []*v1.JsonAddress `json:"pendingMembers,omitempty"` - RequestingMembers []*v1.JsonAddress `json:"requestingMembers,omitempty"` - Revision int32 `json:"revision,omitempty"` - Timer int32 `json:"timer,omitempty"` - Title string `json:"title,omitempty"` + ID string `json:"id,omitempty" yaml:"id,omitempty"` + InviteLink string `json:"inviteLink,omitempty" yaml:"inviteLink,omitempty"` + Members []*v1.JsonAddress `json:"members,omitempty" yaml:"members,omitempty"` + PendingMembers []*v1.JsonAddress `json:"pendingMembers,omitempty" yaml:"pendingMembers,omitempty"` + RequestingMembers []*v1.JsonAddress `json:"requestingMembers,omitempty" yaml:"requestingMembers,omitempty"` + Revision int32 `json:"revision,omitempty" yaml:"revision,omitempty"` + Timer int32 `json:"timer,omitempty" yaml:"timer,omitempty"` + Title string `json:"title,omitempty" yaml:"title,omitempty"` } type LinkedDevices struct { - Devices []*v0.DeviceInfo `json:"devices,omitempty"` + Devices []*v0.DeviceInfo `json:"devices,omitempty" yaml:"devices,omitempty"` } type ProtocolRequest struct { @@ -80,16 +80,16 @@ type ProtocolRequest struct { // RemoveLinkedDeviceRequest: Remove a linked device from the Signal account. Only allowed when the local device id is 1 type RemoveLinkedDeviceRequest struct { Request - Account string `json:"account,omitempty"` // The account to interact with - DeviceId int64 `json:"deviceId,omitempty"` // the ID of the device to unlink + Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to interact with + DeviceId int64 `json:"deviceId,omitempty" yaml:"deviceId,omitempty"` // the ID of the device to unlink } // UpdateGroupRequest: modify a group. only v2 groups for now type UpdateGroupRequest struct { Request - Account string `json:"account,omitempty"` // The account to interact with - AddMembers []*v1.JsonAddress `json:"addMembers,omitempty"` - GroupID string `json:"groupID,omitempty"` - RemoveMembers []*v1.JsonAddress `json:"removeMembers,omitempty"` - Title string `json:"title,omitempty"` + Account string `json:"account,omitempty" yaml:"account,omitempty"` // The account to interact with + AddMembers []*v1.JsonAddress `json:"addMembers,omitempty" yaml:"addMembers,omitempty"` + GroupID string `json:"groupID,omitempty" yaml:"groupID,omitempty"` + RemoveMembers []*v1.JsonAddress `json:"removeMembers,omitempty" yaml:"removeMembers,omitempty"` + Title string `json:"title,omitempty" yaml:"title,omitempty"` } diff --git a/signald/client-protocol/v1alpha2/structs.go b/signald/client-protocol/v1alpha2/structs.go index 69ae9bd..d594209 100644 --- a/signald/client-protocol/v1alpha2/structs.go +++ b/signald/client-protocol/v1alpha2/structs.go @@ -7,24 +7,24 @@ import ( ) type Request struct { - ID string `json:"id"` - Version string `json:"version"` - Type string `json:"type"` + ID string `json:"id" yaml:"id"` + Version string `json:"version" yaml:"version"` + Type string `json:"type" yaml:"type"` } // GroupInfo: A generic type that is used when the group version is not known type GroupInfo struct { - V1 *v1.JsonGroupInfo `json:"v1,omitempty"` - V2 *v1.JsonGroupV2Info `json:"v2,omitempty"` + V1 *v1.JsonGroupInfo `json:"v1,omitempty" yaml:"v1,omitempty"` + V2 *v1.JsonGroupV2Info `json:"v2,omitempty" yaml:"v2,omitempty"` } // UpdateGroupRequest: modify a group type UpdateGroupRequest struct { Request - Account string `json:"account,omitempty"` // The identifier of the account to interact with - AddMembers []*v1.JsonAddress `json:"addMembers,omitempty"` - Avatar string `json:"avatar,omitempty"` - GroupID string `json:"groupID,omitempty"` - RemoveMembers []*v1.JsonAddress `json:"removeMembers,omitempty"` - Title string `json:"title,omitempty"` + Account string `json:"account,omitempty" yaml:"account,omitempty"` // The identifier of the account to interact with + AddMembers []*v1.JsonAddress `json:"addMembers,omitempty" yaml:"addMembers,omitempty"` + Avatar string `json:"avatar,omitempty" yaml:"avatar,omitempty"` + GroupID string `json:"groupID,omitempty" yaml:"groupID,omitempty"` + RemoveMembers []*v1.JsonAddress `json:"removeMembers,omitempty" yaml:"removeMembers,omitempty"` + Title string `json:"title,omitempty" yaml:"title,omitempty"` } diff --git a/tools/generator/structs.go.tmpl b/tools/generator/structs.go.tmpl index 884bbc5..e8091a2 100644 --- a/tools/generator/structs.go.tmpl +++ b/tools/generator/structs.go.tmpl @@ -9,13 +9,13 @@ import ( {{end}} type Request struct { - ID string `json:"id"` - Version string `json:"version"` - Type string `json:"type"` + ID string `json:"id" yaml:"id"` + Version string `json:"version" yaml:"version"` + Type string `json:"type" yaml:"type"` } {{ range $structName, $type := .Types }}{{if ne $type.Doc ""}}// {{$structName}}: {{$type.Doc}}{{end}} type {{ $structName }} struct { {{if $type.Request}} Request{{end}} -{{ range $fieldName, $field := $type.Fields }}{{ $field.FieldName }} {{if $field.List}}[]{{end}}{{ $field.Type }} `json:"{{$fieldName}},omitempty"`{{if ne $field.Doc ""}} // {{$field.Doc}}{{end}} +{{ range $fieldName, $field := $type.Fields }}{{ $field.FieldName }} {{if $field.List}}[]{{end}}{{ $field.Type }} `json:"{{$fieldName}},omitempty" yaml:"{{$fieldName}},omitempty"`{{if ne $field.Doc ""}} // {{$field.Doc}}{{end}} {{ end }}} {{ end }}