github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/keybase1/notify_ctl.go (about)

     1  // Auto-generated to Go types and interfaces using avdl-compiler v1.4.10 (https://github.com/keybase/node-avdl-compiler)
     2  //   Input file: avdl/keybase1/notify_ctl.avdl
     3  
     4  package keybase1
     5  
     6  import (
     7  	"github.com/keybase/go-framed-msgpack-rpc/rpc"
     8  	context "golang.org/x/net/context"
     9  	"time"
    10  )
    11  
    12  type NotificationChannels struct {
    13  	Session              bool `codec:"session" json:"session"`
    14  	Users                bool `codec:"users" json:"users"`
    15  	Kbfs                 bool `codec:"kbfs" json:"kbfs"`
    16  	Kbfsdesktop          bool `codec:"kbfsdesktop" json:"kbfsdesktop"`
    17  	Kbfslegacy           bool `codec:"kbfslegacy" json:"kbfslegacy"`
    18  	Kbfssubscription     bool `codec:"kbfssubscription" json:"kbfssubscription"`
    19  	Tracking             bool `codec:"tracking" json:"tracking"`
    20  	Favorites            bool `codec:"favorites" json:"favorites"`
    21  	Paperkeys            bool `codec:"paperkeys" json:"paperkeys"`
    22  	Keyfamily            bool `codec:"keyfamily" json:"keyfamily"`
    23  	Service              bool `codec:"service" json:"service"`
    24  	App                  bool `codec:"app" json:"app"`
    25  	Chat                 bool `codec:"chat" json:"chat"`
    26  	PGP                  bool `codec:"pgp" json:"pgp"`
    27  	Kbfsrequest          bool `codec:"kbfsrequest" json:"kbfsrequest"`
    28  	Badges               bool `codec:"badges" json:"badges"`
    29  	Reachability         bool `codec:"reachability" json:"reachability"`
    30  	Team                 bool `codec:"team" json:"team"`
    31  	Ephemeral            bool `codec:"ephemeral" json:"ephemeral"`
    32  	Teambot              bool `codec:"teambot" json:"teambot"`
    33  	Chatkbfsedits        bool `codec:"chatkbfsedits" json:"chatkbfsedits"`
    34  	Chatdev              bool `codec:"chatdev" json:"chatdev"`
    35  	Chatemoji            bool `codec:"chatemoji" json:"chatemoji"`
    36  	Chatemojicross       bool `codec:"chatemojicross" json:"chatemojicross"`
    37  	Deviceclone          bool `codec:"deviceclone" json:"deviceclone"`
    38  	Chatattachments      bool `codec:"chatattachments" json:"chatattachments"`
    39  	Wallet               bool `codec:"wallet" json:"wallet"`
    40  	Audit                bool `codec:"audit" json:"audit"`
    41  	Runtimestats         bool `codec:"runtimestats" json:"runtimestats"`
    42  	FeaturedBots         bool `codec:"featuredBots" json:"featuredBots"`
    43  	Saltpack             bool `codec:"saltpack" json:"saltpack"`
    44  	AllowChatNotifySkips bool `codec:"allowChatNotifySkips" json:"allowChatNotifySkips"`
    45  	Chatarchive          bool `codec:"chatarchive" json:"chatarchive"`
    46  }
    47  
    48  func (o NotificationChannels) DeepCopy() NotificationChannels {
    49  	return NotificationChannels{
    50  		Session:              o.Session,
    51  		Users:                o.Users,
    52  		Kbfs:                 o.Kbfs,
    53  		Kbfsdesktop:          o.Kbfsdesktop,
    54  		Kbfslegacy:           o.Kbfslegacy,
    55  		Kbfssubscription:     o.Kbfssubscription,
    56  		Tracking:             o.Tracking,
    57  		Favorites:            o.Favorites,
    58  		Paperkeys:            o.Paperkeys,
    59  		Keyfamily:            o.Keyfamily,
    60  		Service:              o.Service,
    61  		App:                  o.App,
    62  		Chat:                 o.Chat,
    63  		PGP:                  o.PGP,
    64  		Kbfsrequest:          o.Kbfsrequest,
    65  		Badges:               o.Badges,
    66  		Reachability:         o.Reachability,
    67  		Team:                 o.Team,
    68  		Ephemeral:            o.Ephemeral,
    69  		Teambot:              o.Teambot,
    70  		Chatkbfsedits:        o.Chatkbfsedits,
    71  		Chatdev:              o.Chatdev,
    72  		Chatemoji:            o.Chatemoji,
    73  		Chatemojicross:       o.Chatemojicross,
    74  		Deviceclone:          o.Deviceclone,
    75  		Chatattachments:      o.Chatattachments,
    76  		Wallet:               o.Wallet,
    77  		Audit:                o.Audit,
    78  		Runtimestats:         o.Runtimestats,
    79  		FeaturedBots:         o.FeaturedBots,
    80  		Saltpack:             o.Saltpack,
    81  		AllowChatNotifySkips: o.AllowChatNotifySkips,
    82  		Chatarchive:          o.Chatarchive,
    83  	}
    84  }
    85  
    86  type SetNotificationsArg struct {
    87  	Channels NotificationChannels `codec:"channels" json:"channels"`
    88  }
    89  
    90  type NotifyCtlInterface interface {
    91  	SetNotifications(context.Context, NotificationChannels) error
    92  }
    93  
    94  func NotifyCtlProtocol(i NotifyCtlInterface) rpc.Protocol {
    95  	return rpc.Protocol{
    96  		Name: "keybase.1.notifyCtl",
    97  		Methods: map[string]rpc.ServeHandlerDescription{
    98  			"setNotifications": {
    99  				MakeArg: func() interface{} {
   100  					var ret [1]SetNotificationsArg
   101  					return &ret
   102  				},
   103  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   104  					typedArgs, ok := args.(*[1]SetNotificationsArg)
   105  					if !ok {
   106  						err = rpc.NewTypeError((*[1]SetNotificationsArg)(nil), args)
   107  						return
   108  					}
   109  					err = i.SetNotifications(ctx, typedArgs[0].Channels)
   110  					return
   111  				},
   112  			},
   113  		},
   114  	}
   115  }
   116  
   117  type NotifyCtlClient struct {
   118  	Cli rpc.GenericClient
   119  }
   120  
   121  func (c NotifyCtlClient) SetNotifications(ctx context.Context, channels NotificationChannels) (err error) {
   122  	__arg := SetNotificationsArg{Channels: channels}
   123  	err = c.Cli.Call(ctx, "keybase.1.notifyCtl.setNotifications", []interface{}{__arg}, nil, 0*time.Millisecond)
   124  	return
   125  }