github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/protocol/keybase1/fs.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/fs.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 File struct {
    13  	Path string `codec:"path" json:"path"`
    14  }
    15  
    16  func (o File) DeepCopy() File {
    17  	return File{
    18  		Path: o.Path,
    19  	}
    20  }
    21  
    22  type ListResult struct {
    23  	Files []File `codec:"files" json:"files"`
    24  }
    25  
    26  func (o ListResult) DeepCopy() ListResult {
    27  	return ListResult{
    28  		Files: (func(x []File) []File {
    29  			if x == nil {
    30  				return nil
    31  			}
    32  			ret := make([]File, len(x))
    33  			for i, v := range x {
    34  				vCopy := v.DeepCopy()
    35  				ret[i] = vCopy
    36  			}
    37  			return ret
    38  		})(o.Files),
    39  	}
    40  }
    41  
    42  type ListArg struct {
    43  	SessionID int    `codec:"sessionID" json:"sessionID"`
    44  	Path      string `codec:"path" json:"path"`
    45  }
    46  
    47  type FsInterface interface {
    48  	// List files in a path. Implemented by KBFS service.
    49  	List(context.Context, ListArg) (ListResult, error)
    50  }
    51  
    52  func FsProtocol(i FsInterface) rpc.Protocol {
    53  	return rpc.Protocol{
    54  		Name: "keybase.1.fs",
    55  		Methods: map[string]rpc.ServeHandlerDescription{
    56  			"List": {
    57  				MakeArg: func() interface{} {
    58  					var ret [1]ListArg
    59  					return &ret
    60  				},
    61  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    62  					typedArgs, ok := args.(*[1]ListArg)
    63  					if !ok {
    64  						err = rpc.NewTypeError((*[1]ListArg)(nil), args)
    65  						return
    66  					}
    67  					ret, err = i.List(ctx, typedArgs[0])
    68  					return
    69  				},
    70  			},
    71  		},
    72  	}
    73  }
    74  
    75  type FsClient struct {
    76  	Cli rpc.GenericClient
    77  }
    78  
    79  // List files in a path. Implemented by KBFS service.
    80  func (c FsClient) List(ctx context.Context, __arg ListArg) (res ListResult, err error) {
    81  	err = c.Cli.Call(ctx, "keybase.1.fs.List", []interface{}{__arg}, &res, 0*time.Millisecond)
    82  	return
    83  }