github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/keybase1/selfprovision.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/selfprovision.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 SelfProvisionArg struct {
    13  	SessionID  int    `codec:"sessionID" json:"sessionID"`
    14  	DeviceName string `codec:"deviceName" json:"deviceName"`
    15  }
    16  
    17  type SelfprovisionInterface interface {
    18  	// Performs self provision. If the current device is clone, this function
    19  	// will provision it as a new device.
    20  	SelfProvision(context.Context, SelfProvisionArg) error
    21  }
    22  
    23  func SelfprovisionProtocol(i SelfprovisionInterface) rpc.Protocol {
    24  	return rpc.Protocol{
    25  		Name: "keybase.1.selfprovision",
    26  		Methods: map[string]rpc.ServeHandlerDescription{
    27  			"selfProvision": {
    28  				MakeArg: func() interface{} {
    29  					var ret [1]SelfProvisionArg
    30  					return &ret
    31  				},
    32  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    33  					typedArgs, ok := args.(*[1]SelfProvisionArg)
    34  					if !ok {
    35  						err = rpc.NewTypeError((*[1]SelfProvisionArg)(nil), args)
    36  						return
    37  					}
    38  					err = i.SelfProvision(ctx, typedArgs[0])
    39  					return
    40  				},
    41  			},
    42  		},
    43  	}
    44  }
    45  
    46  type SelfprovisionClient struct {
    47  	Cli rpc.GenericClient
    48  }
    49  
    50  // Performs self provision. If the current device is clone, this function
    51  // will provision it as a new device.
    52  func (c SelfprovisionClient) SelfProvision(ctx context.Context, __arg SelfProvisionArg) (err error) {
    53  	err = c.Cli.Call(ctx, "keybase.1.selfprovision.selfProvision", []interface{}{__arg}, nil, 0*time.Millisecond)
    54  	return
    55  }