github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/keybase1/debugging.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/debugging.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 FirstStepResult struct {
    13  	ValPlusTwo int `codec:"valPlusTwo" json:"valPlusTwo"`
    14  }
    15  
    16  func (o FirstStepResult) DeepCopy() FirstStepResult {
    17  	return FirstStepResult{
    18  		ValPlusTwo: o.ValPlusTwo,
    19  	}
    20  }
    21  
    22  type FirstStepArg struct {
    23  	SessionID int `codec:"sessionID" json:"sessionID"`
    24  	Val       int `codec:"val" json:"val"`
    25  }
    26  
    27  type SecondStepArg struct {
    28  	SessionID int `codec:"sessionID" json:"sessionID"`
    29  	Val       int `codec:"val" json:"val"`
    30  }
    31  
    32  type IncrementArg struct {
    33  	SessionID int `codec:"sessionID" json:"sessionID"`
    34  	Val       int `codec:"val" json:"val"`
    35  }
    36  
    37  type ScriptArg struct {
    38  	Script string   `codec:"script" json:"script"`
    39  	Args   []string `codec:"args" json:"args"`
    40  }
    41  
    42  type DebuggingInterface interface {
    43  	FirstStep(context.Context, FirstStepArg) (FirstStepResult, error)
    44  	SecondStep(context.Context, SecondStepArg) (int, error)
    45  	Increment(context.Context, IncrementArg) (int, error)
    46  	Script(context.Context, ScriptArg) (string, error)
    47  }
    48  
    49  func DebuggingProtocol(i DebuggingInterface) rpc.Protocol {
    50  	return rpc.Protocol{
    51  		Name: "keybase.1.debugging",
    52  		Methods: map[string]rpc.ServeHandlerDescription{
    53  			"firstStep": {
    54  				MakeArg: func() interface{} {
    55  					var ret [1]FirstStepArg
    56  					return &ret
    57  				},
    58  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    59  					typedArgs, ok := args.(*[1]FirstStepArg)
    60  					if !ok {
    61  						err = rpc.NewTypeError((*[1]FirstStepArg)(nil), args)
    62  						return
    63  					}
    64  					ret, err = i.FirstStep(ctx, typedArgs[0])
    65  					return
    66  				},
    67  			},
    68  			"secondStep": {
    69  				MakeArg: func() interface{} {
    70  					var ret [1]SecondStepArg
    71  					return &ret
    72  				},
    73  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    74  					typedArgs, ok := args.(*[1]SecondStepArg)
    75  					if !ok {
    76  						err = rpc.NewTypeError((*[1]SecondStepArg)(nil), args)
    77  						return
    78  					}
    79  					ret, err = i.SecondStep(ctx, typedArgs[0])
    80  					return
    81  				},
    82  			},
    83  			"increment": {
    84  				MakeArg: func() interface{} {
    85  					var ret [1]IncrementArg
    86  					return &ret
    87  				},
    88  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    89  					typedArgs, ok := args.(*[1]IncrementArg)
    90  					if !ok {
    91  						err = rpc.NewTypeError((*[1]IncrementArg)(nil), args)
    92  						return
    93  					}
    94  					ret, err = i.Increment(ctx, typedArgs[0])
    95  					return
    96  				},
    97  			},
    98  			"script": {
    99  				MakeArg: func() interface{} {
   100  					var ret [1]ScriptArg
   101  					return &ret
   102  				},
   103  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   104  					typedArgs, ok := args.(*[1]ScriptArg)
   105  					if !ok {
   106  						err = rpc.NewTypeError((*[1]ScriptArg)(nil), args)
   107  						return
   108  					}
   109  					ret, err = i.Script(ctx, typedArgs[0])
   110  					return
   111  				},
   112  			},
   113  		},
   114  	}
   115  }
   116  
   117  type DebuggingClient struct {
   118  	Cli rpc.GenericClient
   119  }
   120  
   121  func (c DebuggingClient) FirstStep(ctx context.Context, __arg FirstStepArg) (res FirstStepResult, err error) {
   122  	err = c.Cli.Call(ctx, "keybase.1.debugging.firstStep", []interface{}{__arg}, &res, 0*time.Millisecond)
   123  	return
   124  }
   125  
   126  func (c DebuggingClient) SecondStep(ctx context.Context, __arg SecondStepArg) (res int, err error) {
   127  	err = c.Cli.Call(ctx, "keybase.1.debugging.secondStep", []interface{}{__arg}, &res, 0*time.Millisecond)
   128  	return
   129  }
   130  
   131  func (c DebuggingClient) Increment(ctx context.Context, __arg IncrementArg) (res int, err error) {
   132  	err = c.Cli.Call(ctx, "keybase.1.debugging.increment", []interface{}{__arg}, &res, 0*time.Millisecond)
   133  	return
   134  }
   135  
   136  func (c DebuggingClient) Script(ctx context.Context, __arg ScriptArg) (res string, err error) {
   137  	err = c.Cli.Call(ctx, "keybase.1.debugging.script", []interface{}{__arg}, &res, 0*time.Millisecond)
   138  	return
   139  }