github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/keybase1/quota.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/quota.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 VerifySessionRes struct {
    13  	Uid       UID    `codec:"uid" json:"uid"`
    14  	Sid       string `codec:"sid" json:"sid"`
    15  	Generated int    `codec:"generated" json:"generated"`
    16  	Lifetime  int    `codec:"lifetime" json:"lifetime"`
    17  }
    18  
    19  func (o VerifySessionRes) DeepCopy() VerifySessionRes {
    20  	return VerifySessionRes{
    21  		Uid:       o.Uid.DeepCopy(),
    22  		Sid:       o.Sid,
    23  		Generated: o.Generated,
    24  		Lifetime:  o.Lifetime,
    25  	}
    26  }
    27  
    28  type VerifySessionArg struct {
    29  	Session string `codec:"session" json:"session"`
    30  }
    31  
    32  type QuotaInterface interface {
    33  	VerifySession(context.Context, string) (VerifySessionRes, error)
    34  }
    35  
    36  func QuotaProtocol(i QuotaInterface) rpc.Protocol {
    37  	return rpc.Protocol{
    38  		Name: "keybase.1.quota",
    39  		Methods: map[string]rpc.ServeHandlerDescription{
    40  			"verifySession": {
    41  				MakeArg: func() interface{} {
    42  					var ret [1]VerifySessionArg
    43  					return &ret
    44  				},
    45  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    46  					typedArgs, ok := args.(*[1]VerifySessionArg)
    47  					if !ok {
    48  						err = rpc.NewTypeError((*[1]VerifySessionArg)(nil), args)
    49  						return
    50  					}
    51  					ret, err = i.VerifySession(ctx, typedArgs[0].Session)
    52  					return
    53  				},
    54  			},
    55  		},
    56  	}
    57  }
    58  
    59  type QuotaClient struct {
    60  	Cli rpc.GenericClient
    61  }
    62  
    63  func (c QuotaClient) VerifySession(ctx context.Context, session string) (res VerifySessionRes, err error) {
    64  	__arg := VerifySessionArg{Session: session}
    65  	err = c.Cli.Call(ctx, "keybase.1.quota.verifySession", []interface{}{__arg}, &res, 0*time.Millisecond)
    66  	return
    67  }