github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/keybase1/notify_teambot.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_teambot.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 NewTeambotKeyArg struct {
    13  	Id          TeamID               `codec:"id" json:"id"`
    14  	Generation  TeambotKeyGeneration `codec:"generation" json:"generation"`
    15  	Application TeamApplication      `codec:"application" json:"application"`
    16  }
    17  
    18  type TeambotKeyNeededArg struct {
    19  	Id          TeamID               `codec:"id" json:"id"`
    20  	Uid         UID                  `codec:"uid" json:"uid"`
    21  	Generation  TeambotKeyGeneration `codec:"generation" json:"generation"`
    22  	Application TeamApplication      `codec:"application" json:"application"`
    23  }
    24  
    25  type NotifyTeambotInterface interface {
    26  	NewTeambotKey(context.Context, NewTeambotKeyArg) error
    27  	TeambotKeyNeeded(context.Context, TeambotKeyNeededArg) error
    28  }
    29  
    30  func NotifyTeambotProtocol(i NotifyTeambotInterface) rpc.Protocol {
    31  	return rpc.Protocol{
    32  		Name: "keybase.1.NotifyTeambot",
    33  		Methods: map[string]rpc.ServeHandlerDescription{
    34  			"newTeambotKey": {
    35  				MakeArg: func() interface{} {
    36  					var ret [1]NewTeambotKeyArg
    37  					return &ret
    38  				},
    39  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    40  					typedArgs, ok := args.(*[1]NewTeambotKeyArg)
    41  					if !ok {
    42  						err = rpc.NewTypeError((*[1]NewTeambotKeyArg)(nil), args)
    43  						return
    44  					}
    45  					err = i.NewTeambotKey(ctx, typedArgs[0])
    46  					return
    47  				},
    48  			},
    49  			"teambotKeyNeeded": {
    50  				MakeArg: func() interface{} {
    51  					var ret [1]TeambotKeyNeededArg
    52  					return &ret
    53  				},
    54  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    55  					typedArgs, ok := args.(*[1]TeambotKeyNeededArg)
    56  					if !ok {
    57  						err = rpc.NewTypeError((*[1]TeambotKeyNeededArg)(nil), args)
    58  						return
    59  					}
    60  					err = i.TeambotKeyNeeded(ctx, typedArgs[0])
    61  					return
    62  				},
    63  			},
    64  		},
    65  	}
    66  }
    67  
    68  type NotifyTeambotClient struct {
    69  	Cli rpc.GenericClient
    70  }
    71  
    72  func (c NotifyTeambotClient) NewTeambotKey(ctx context.Context, __arg NewTeambotKeyArg) (err error) {
    73  	err = c.Cli.Notify(ctx, "keybase.1.NotifyTeambot.newTeambotKey", []interface{}{__arg}, 0*time.Millisecond)
    74  	return
    75  }
    76  
    77  func (c NotifyTeambotClient) TeambotKeyNeeded(ctx context.Context, __arg TeambotKeyNeededArg) (err error) {
    78  	err = c.Cli.Call(ctx, "keybase.1.NotifyTeambot.teambotKeyNeeded", []interface{}{__arg}, nil, 0*time.Millisecond)
    79  	return
    80  }