github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/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  	Notifysimplefs       bool `codec:"notifysimplefs" json:"notifysimplefs"`
    20  	Tracking             bool `codec:"tracking" json:"tracking"`
    21  	Favorites            bool `codec:"favorites" json:"favorites"`
    22  	Paperkeys            bool `codec:"paperkeys" json:"paperkeys"`
    23  	Keyfamily            bool `codec:"keyfamily" json:"keyfamily"`
    24  	Service              bool `codec:"service" json:"service"`
    25  	App                  bool `codec:"app" json:"app"`
    26  	Chat                 bool `codec:"chat" json:"chat"`
    27  	PGP                  bool `codec:"pgp" json:"pgp"`
    28  	Kbfsrequest          bool `codec:"kbfsrequest" json:"kbfsrequest"`
    29  	Badges               bool `codec:"badges" json:"badges"`
    30  	Reachability         bool `codec:"reachability" json:"reachability"`
    31  	Team                 bool `codec:"team" json:"team"`
    32  	Ephemeral            bool `codec:"ephemeral" json:"ephemeral"`
    33  	Teambot              bool `codec:"teambot" json:"teambot"`
    34  	Chatkbfsedits        bool `codec:"chatkbfsedits" json:"chatkbfsedits"`
    35  	Chatdev              bool `codec:"chatdev" json:"chatdev"`
    36  	Chatemoji            bool `codec:"chatemoji" json:"chatemoji"`
    37  	Chatemojicross       bool `codec:"chatemojicross" json:"chatemojicross"`
    38  	Deviceclone          bool `codec:"deviceclone" json:"deviceclone"`
    39  	Chatattachments      bool `codec:"chatattachments" json:"chatattachments"`
    40  	Wallet               bool `codec:"wallet" json:"wallet"`
    41  	Audit                bool `codec:"audit" json:"audit"`
    42  	Runtimestats         bool `codec:"runtimestats" json:"runtimestats"`
    43  	FeaturedBots         bool `codec:"featuredBots" json:"featuredBots"`
    44  	Saltpack             bool `codec:"saltpack" json:"saltpack"`
    45  	AllowChatNotifySkips bool `codec:"allowChatNotifySkips" json:"allowChatNotifySkips"`
    46  	Chatarchive          bool `codec:"chatarchive" json:"chatarchive"`
    47  }
    48  
    49  func (o NotificationChannels) DeepCopy() NotificationChannels {
    50  	return NotificationChannels{
    51  		Session:              o.Session,
    52  		Users:                o.Users,
    53  		Kbfs:                 o.Kbfs,
    54  		Kbfsdesktop:          o.Kbfsdesktop,
    55  		Kbfslegacy:           o.Kbfslegacy,
    56  		Kbfssubscription:     o.Kbfssubscription,
    57  		Notifysimplefs:       o.Notifysimplefs,
    58  		Tracking:             o.Tracking,
    59  		Favorites:            o.Favorites,
    60  		Paperkeys:            o.Paperkeys,
    61  		Keyfamily:            o.Keyfamily,
    62  		Service:              o.Service,
    63  		App:                  o.App,
    64  		Chat:                 o.Chat,
    65  		PGP:                  o.PGP,
    66  		Kbfsrequest:          o.Kbfsrequest,
    67  		Badges:               o.Badges,
    68  		Reachability:         o.Reachability,
    69  		Team:                 o.Team,
    70  		Ephemeral:            o.Ephemeral,
    71  		Teambot:              o.Teambot,
    72  		Chatkbfsedits:        o.Chatkbfsedits,
    73  		Chatdev:              o.Chatdev,
    74  		Chatemoji:            o.Chatemoji,
    75  		Chatemojicross:       o.Chatemojicross,
    76  		Deviceclone:          o.Deviceclone,
    77  		Chatattachments:      o.Chatattachments,
    78  		Wallet:               o.Wallet,
    79  		Audit:                o.Audit,
    80  		Runtimestats:         o.Runtimestats,
    81  		FeaturedBots:         o.FeaturedBots,
    82  		Saltpack:             o.Saltpack,
    83  		AllowChatNotifySkips: o.AllowChatNotifySkips,
    84  		Chatarchive:          o.Chatarchive,
    85  	}
    86  }
    87  
    88  type SetNotificationsArg struct {
    89  	Channels NotificationChannels `codec:"channels" json:"channels"`
    90  }
    91  
    92  type NotifyCtlInterface interface {
    93  	SetNotifications(context.Context, NotificationChannels) error
    94  }
    95  
    96  func NotifyCtlProtocol(i NotifyCtlInterface) rpc.Protocol {
    97  	return rpc.Protocol{
    98  		Name: "keybase.1.notifyCtl",
    99  		Methods: map[string]rpc.ServeHandlerDescription{
   100  			"setNotifications": {
   101  				MakeArg: func() interface{} {
   102  					var ret [1]SetNotificationsArg
   103  					return &ret
   104  				},
   105  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   106  					typedArgs, ok := args.(*[1]SetNotificationsArg)
   107  					if !ok {
   108  						err = rpc.NewTypeError((*[1]SetNotificationsArg)(nil), args)
   109  						return
   110  					}
   111  					err = i.SetNotifications(ctx, typedArgs[0].Channels)
   112  					return
   113  				},
   114  			},
   115  		},
   116  	}
   117  }
   118  
   119  type NotifyCtlClient struct {
   120  	Cli rpc.GenericClient
   121  }
   122  
   123  func (c NotifyCtlClient) SetNotifications(ctx context.Context, channels NotificationChannels) (err error) {
   124  	__arg := SetNotificationsArg{Channels: channels}
   125  	err = c.Cli.Call(ctx, "keybase.1.notifyCtl.setNotifications", []interface{}{__arg}, nil, 0*time.Millisecond)
   126  	return
   127  }