github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/keybase1/airdrop.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/airdrop.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 AirdropDetails struct {
    13  	Uid  UID       `codec:"uid" json:"uid"`
    14  	Kid  BinaryKID `codec:"kid" json:"kid"`
    15  	Vid  VID       `codec:"vid" json:"vid"`
    16  	Vers string    `codec:"vers" json:"vers"`
    17  	Time Time      `codec:"time" json:"time"`
    18  }
    19  
    20  func (o AirdropDetails) DeepCopy() AirdropDetails {
    21  	return AirdropDetails{
    22  		Uid:  o.Uid.DeepCopy(),
    23  		Kid:  o.Kid.DeepCopy(),
    24  		Vid:  o.Vid.DeepCopy(),
    25  		Vers: o.Vers,
    26  		Time: o.Time.DeepCopy(),
    27  	}
    28  }
    29  
    30  type Reg1Arg struct {
    31  	Uid UID       `codec:"uid" json:"uid"`
    32  	Kid BinaryKID `codec:"kid" json:"kid"`
    33  }
    34  
    35  type Reg2Arg struct {
    36  	Ctext []byte `codec:"ctext" json:"ctext"`
    37  }
    38  
    39  type AirdropInterface interface {
    40  	Reg1(context.Context, Reg1Arg) (BinaryKID, error)
    41  	Reg2(context.Context, []byte) error
    42  }
    43  
    44  func AirdropProtocol(i AirdropInterface) rpc.Protocol {
    45  	return rpc.Protocol{
    46  		Name: "keybase.1.airdrop",
    47  		Methods: map[string]rpc.ServeHandlerDescription{
    48  			"reg1": {
    49  				MakeArg: func() interface{} {
    50  					var ret [1]Reg1Arg
    51  					return &ret
    52  				},
    53  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    54  					typedArgs, ok := args.(*[1]Reg1Arg)
    55  					if !ok {
    56  						err = rpc.NewTypeError((*[1]Reg1Arg)(nil), args)
    57  						return
    58  					}
    59  					ret, err = i.Reg1(ctx, typedArgs[0])
    60  					return
    61  				},
    62  			},
    63  			"reg2": {
    64  				MakeArg: func() interface{} {
    65  					var ret [1]Reg2Arg
    66  					return &ret
    67  				},
    68  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    69  					typedArgs, ok := args.(*[1]Reg2Arg)
    70  					if !ok {
    71  						err = rpc.NewTypeError((*[1]Reg2Arg)(nil), args)
    72  						return
    73  					}
    74  					err = i.Reg2(ctx, typedArgs[0].Ctext)
    75  					return
    76  				},
    77  			},
    78  		},
    79  	}
    80  }
    81  
    82  type AirdropClient struct {
    83  	Cli rpc.GenericClient
    84  }
    85  
    86  func (c AirdropClient) Reg1(ctx context.Context, __arg Reg1Arg) (res BinaryKID, err error) {
    87  	err = c.Cli.Call(ctx, "keybase.1.airdrop.reg1", []interface{}{__arg}, &res, 0*time.Millisecond)
    88  	return
    89  }
    90  
    91  func (c AirdropClient) Reg2(ctx context.Context, ctext []byte) (err error) {
    92  	__arg := Reg2Arg{Ctext: ctext}
    93  	err = c.Cli.Call(ctx, "keybase.1.airdrop.reg2", []interface{}{__arg}, nil, 0*time.Millisecond)
    94  	return
    95  }