github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/protocol/keybase1/stream_ui.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/stream_ui.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 CloseArg struct {
    13  	SessionID int    `codec:"sessionID" json:"sessionID"`
    14  	S         Stream `codec:"s" json:"s"`
    15  }
    16  
    17  type ReadArg struct {
    18  	SessionID int    `codec:"sessionID" json:"sessionID"`
    19  	S         Stream `codec:"s" json:"s"`
    20  	Sz        int    `codec:"sz" json:"sz"`
    21  }
    22  
    23  type ResetArg struct {
    24  	SessionID int    `codec:"sessionID" json:"sessionID"`
    25  	S         Stream `codec:"s" json:"s"`
    26  }
    27  
    28  type WriteArg struct {
    29  	SessionID int    `codec:"sessionID" json:"sessionID"`
    30  	S         Stream `codec:"s" json:"s"`
    31  	Buf       []byte `codec:"buf" json:"buf"`
    32  }
    33  
    34  type StreamUiInterface interface {
    35  	Close(context.Context, CloseArg) error
    36  	Read(context.Context, ReadArg) ([]byte, error)
    37  	Reset(context.Context, ResetArg) error
    38  	Write(context.Context, WriteArg) (int, error)
    39  }
    40  
    41  func StreamUiProtocol(i StreamUiInterface) rpc.Protocol {
    42  	return rpc.Protocol{
    43  		Name: "keybase.1.streamUi",
    44  		Methods: map[string]rpc.ServeHandlerDescription{
    45  			"close": {
    46  				MakeArg: func() interface{} {
    47  					var ret [1]CloseArg
    48  					return &ret
    49  				},
    50  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    51  					typedArgs, ok := args.(*[1]CloseArg)
    52  					if !ok {
    53  						err = rpc.NewTypeError((*[1]CloseArg)(nil), args)
    54  						return
    55  					}
    56  					err = i.Close(ctx, typedArgs[0])
    57  					return
    58  				},
    59  			},
    60  			"read": {
    61  				MakeArg: func() interface{} {
    62  					var ret [1]ReadArg
    63  					return &ret
    64  				},
    65  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    66  					typedArgs, ok := args.(*[1]ReadArg)
    67  					if !ok {
    68  						err = rpc.NewTypeError((*[1]ReadArg)(nil), args)
    69  						return
    70  					}
    71  					ret, err = i.Read(ctx, typedArgs[0])
    72  					return
    73  				},
    74  			},
    75  			"reset": {
    76  				MakeArg: func() interface{} {
    77  					var ret [1]ResetArg
    78  					return &ret
    79  				},
    80  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    81  					typedArgs, ok := args.(*[1]ResetArg)
    82  					if !ok {
    83  						err = rpc.NewTypeError((*[1]ResetArg)(nil), args)
    84  						return
    85  					}
    86  					err = i.Reset(ctx, typedArgs[0])
    87  					return
    88  				},
    89  			},
    90  			"write": {
    91  				MakeArg: func() interface{} {
    92  					var ret [1]WriteArg
    93  					return &ret
    94  				},
    95  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    96  					typedArgs, ok := args.(*[1]WriteArg)
    97  					if !ok {
    98  						err = rpc.NewTypeError((*[1]WriteArg)(nil), args)
    99  						return
   100  					}
   101  					ret, err = i.Write(ctx, typedArgs[0])
   102  					return
   103  				},
   104  			},
   105  		},
   106  	}
   107  }
   108  
   109  type StreamUiClient struct {
   110  	Cli rpc.GenericClient
   111  }
   112  
   113  func (c StreamUiClient) Close(ctx context.Context, __arg CloseArg) (err error) {
   114  	err = c.Cli.Call(ctx, "keybase.1.streamUi.close", []interface{}{__arg}, nil, 0*time.Millisecond)
   115  	return
   116  }
   117  
   118  func (c StreamUiClient) Read(ctx context.Context, __arg ReadArg) (res []byte, err error) {
   119  	err = c.Cli.Call(ctx, "keybase.1.streamUi.read", []interface{}{__arg}, &res, 0*time.Millisecond)
   120  	return
   121  }
   122  
   123  func (c StreamUiClient) Reset(ctx context.Context, __arg ResetArg) (err error) {
   124  	err = c.Cli.Call(ctx, "keybase.1.streamUi.reset", []interface{}{__arg}, nil, 0*time.Millisecond)
   125  	return
   126  }
   127  
   128  func (c StreamUiClient) Write(ctx context.Context, __arg WriteArg) (res int, err error) {
   129  	err = c.Cli.Call(ctx, "keybase.1.streamUi.write", []interface{}{__arg}, &res, 0*time.Millisecond)
   130  	return
   131  }