github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/protocol/keybase1/notify_tracking.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_tracking.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 TrackingChangedArg struct {
    13  	Uid        UID    `codec:"uid" json:"uid"`
    14  	Username   string `codec:"username" json:"username"`
    15  	IsTracking bool   `codec:"isTracking" json:"isTracking"`
    16  }
    17  
    18  type TrackingInfoArg struct {
    19  	Uid       UID      `codec:"uid" json:"uid"`
    20  	Followers []string `codec:"followers" json:"followers"`
    21  	Followees []string `codec:"followees" json:"followees"`
    22  }
    23  
    24  type NotifyUserBlockedArg struct {
    25  	B UserBlockedSummary `codec:"b" json:"b"`
    26  }
    27  
    28  type NotifyTrackingInterface interface {
    29  	TrackingChanged(context.Context, TrackingChangedArg) error
    30  	TrackingInfo(context.Context, TrackingInfoArg) error
    31  	NotifyUserBlocked(context.Context, UserBlockedSummary) error
    32  }
    33  
    34  func NotifyTrackingProtocol(i NotifyTrackingInterface) rpc.Protocol {
    35  	return rpc.Protocol{
    36  		Name: "keybase.1.NotifyTracking",
    37  		Methods: map[string]rpc.ServeHandlerDescription{
    38  			"trackingChanged": {
    39  				MakeArg: func() interface{} {
    40  					var ret [1]TrackingChangedArg
    41  					return &ret
    42  				},
    43  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    44  					typedArgs, ok := args.(*[1]TrackingChangedArg)
    45  					if !ok {
    46  						err = rpc.NewTypeError((*[1]TrackingChangedArg)(nil), args)
    47  						return
    48  					}
    49  					err = i.TrackingChanged(ctx, typedArgs[0])
    50  					return
    51  				},
    52  			},
    53  			"trackingInfo": {
    54  				MakeArg: func() interface{} {
    55  					var ret [1]TrackingInfoArg
    56  					return &ret
    57  				},
    58  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    59  					typedArgs, ok := args.(*[1]TrackingInfoArg)
    60  					if !ok {
    61  						err = rpc.NewTypeError((*[1]TrackingInfoArg)(nil), args)
    62  						return
    63  					}
    64  					err = i.TrackingInfo(ctx, typedArgs[0])
    65  					return
    66  				},
    67  			},
    68  			"notifyUserBlocked": {
    69  				MakeArg: func() interface{} {
    70  					var ret [1]NotifyUserBlockedArg
    71  					return &ret
    72  				},
    73  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    74  					typedArgs, ok := args.(*[1]NotifyUserBlockedArg)
    75  					if !ok {
    76  						err = rpc.NewTypeError((*[1]NotifyUserBlockedArg)(nil), args)
    77  						return
    78  					}
    79  					err = i.NotifyUserBlocked(ctx, typedArgs[0].B)
    80  					return
    81  				},
    82  			},
    83  		},
    84  	}
    85  }
    86  
    87  type NotifyTrackingClient struct {
    88  	Cli rpc.GenericClient
    89  }
    90  
    91  func (c NotifyTrackingClient) TrackingChanged(ctx context.Context, __arg TrackingChangedArg) (err error) {
    92  	err = c.Cli.Notify(ctx, "keybase.1.NotifyTracking.trackingChanged", []interface{}{__arg}, 0*time.Millisecond)
    93  	return
    94  }
    95  
    96  func (c NotifyTrackingClient) TrackingInfo(ctx context.Context, __arg TrackingInfoArg) (err error) {
    97  	err = c.Cli.Notify(ctx, "keybase.1.NotifyTracking.trackingInfo", []interface{}{__arg}, 0*time.Millisecond)
    98  	return
    99  }
   100  
   101  func (c NotifyTrackingClient) NotifyUserBlocked(ctx context.Context, b UserBlockedSummary) (err error) {
   102  	__arg := NotifyUserBlockedArg{B: b}
   103  	err = c.Cli.Notify(ctx, "keybase.1.NotifyTracking.notifyUserBlocked", []interface{}{__arg}, 0*time.Millisecond)
   104  	return
   105  }