github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/keybase1/log_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/log_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 LogArg struct {
    13  	SessionID int      `codec:"sessionID" json:"sessionID"`
    14  	Level     LogLevel `codec:"level" json:"level"`
    15  	Text      Text     `codec:"text" json:"text"`
    16  }
    17  
    18  type LogUiInterface interface {
    19  	Log(context.Context, LogArg) error
    20  }
    21  
    22  func LogUiProtocol(i LogUiInterface) rpc.Protocol {
    23  	return rpc.Protocol{
    24  		Name: "keybase.1.logUi",
    25  		Methods: map[string]rpc.ServeHandlerDescription{
    26  			"log": {
    27  				MakeArg: func() interface{} {
    28  					var ret [1]LogArg
    29  					return &ret
    30  				},
    31  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    32  					typedArgs, ok := args.(*[1]LogArg)
    33  					if !ok {
    34  						err = rpc.NewTypeError((*[1]LogArg)(nil), args)
    35  						return
    36  					}
    37  					err = i.Log(ctx, typedArgs[0])
    38  					return
    39  				},
    40  			},
    41  		},
    42  	}
    43  }
    44  
    45  type LogUiClient struct {
    46  	Cli rpc.GenericClient
    47  }
    48  
    49  func (c LogUiClient) Log(ctx context.Context, __arg LogArg) (err error) {
    50  	err = c.Cli.Call(ctx, "keybase.1.logUi.log", []interface{}{__arg}, nil, 0*time.Millisecond)
    51  	return
    52  }