github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/keybase1/metadata_update.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/metadata_update.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 RekeyRequest struct {
    13  	FolderID string `codec:"folderID" json:"folderID"`
    14  	Revision int64  `codec:"revision" json:"revision"`
    15  }
    16  
    17  func (o RekeyRequest) DeepCopy() RekeyRequest {
    18  	return RekeyRequest{
    19  		FolderID: o.FolderID,
    20  		Revision: o.Revision,
    21  	}
    22  }
    23  
    24  type MetadataUpdateArg struct {
    25  	FolderID string `codec:"folderID" json:"folderID"`
    26  	Revision int64  `codec:"revision" json:"revision"`
    27  }
    28  
    29  type FolderNeedsRekeyArg struct {
    30  	FolderID string `codec:"folderID" json:"folderID"`
    31  	Revision int64  `codec:"revision" json:"revision"`
    32  }
    33  
    34  type FoldersNeedRekeyArg struct {
    35  	Requests []RekeyRequest `codec:"requests" json:"requests"`
    36  }
    37  
    38  type MetadataUpdateInterface interface {
    39  	MetadataUpdate(context.Context, MetadataUpdateArg) error
    40  	FolderNeedsRekey(context.Context, FolderNeedsRekeyArg) error
    41  	FoldersNeedRekey(context.Context, []RekeyRequest) error
    42  }
    43  
    44  func MetadataUpdateProtocol(i MetadataUpdateInterface) rpc.Protocol {
    45  	return rpc.Protocol{
    46  		Name: "keybase.1.metadataUpdate",
    47  		Methods: map[string]rpc.ServeHandlerDescription{
    48  			"metadataUpdate": {
    49  				MakeArg: func() interface{} {
    50  					var ret [1]MetadataUpdateArg
    51  					return &ret
    52  				},
    53  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    54  					typedArgs, ok := args.(*[1]MetadataUpdateArg)
    55  					if !ok {
    56  						err = rpc.NewTypeError((*[1]MetadataUpdateArg)(nil), args)
    57  						return
    58  					}
    59  					err = i.MetadataUpdate(ctx, typedArgs[0])
    60  					return
    61  				},
    62  			},
    63  			"folderNeedsRekey": {
    64  				MakeArg: func() interface{} {
    65  					var ret [1]FolderNeedsRekeyArg
    66  					return &ret
    67  				},
    68  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    69  					typedArgs, ok := args.(*[1]FolderNeedsRekeyArg)
    70  					if !ok {
    71  						err = rpc.NewTypeError((*[1]FolderNeedsRekeyArg)(nil), args)
    72  						return
    73  					}
    74  					err = i.FolderNeedsRekey(ctx, typedArgs[0])
    75  					return
    76  				},
    77  			},
    78  			"foldersNeedRekey": {
    79  				MakeArg: func() interface{} {
    80  					var ret [1]FoldersNeedRekeyArg
    81  					return &ret
    82  				},
    83  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    84  					typedArgs, ok := args.(*[1]FoldersNeedRekeyArg)
    85  					if !ok {
    86  						err = rpc.NewTypeError((*[1]FoldersNeedRekeyArg)(nil), args)
    87  						return
    88  					}
    89  					err = i.FoldersNeedRekey(ctx, typedArgs[0].Requests)
    90  					return
    91  				},
    92  			},
    93  		},
    94  	}
    95  }
    96  
    97  type MetadataUpdateClient struct {
    98  	Cli rpc.GenericClient
    99  }
   100  
   101  func (c MetadataUpdateClient) MetadataUpdate(ctx context.Context, __arg MetadataUpdateArg) (err error) {
   102  	err = c.Cli.CallCompressed(ctx, "keybase.1.metadataUpdate.metadataUpdate", []interface{}{__arg}, nil, rpc.CompressionGzip, 0*time.Millisecond)
   103  	return
   104  }
   105  
   106  func (c MetadataUpdateClient) FolderNeedsRekey(ctx context.Context, __arg FolderNeedsRekeyArg) (err error) {
   107  	err = c.Cli.CallCompressed(ctx, "keybase.1.metadataUpdate.folderNeedsRekey", []interface{}{__arg}, nil, rpc.CompressionGzip, 0*time.Millisecond)
   108  	return
   109  }
   110  
   111  func (c MetadataUpdateClient) FoldersNeedRekey(ctx context.Context, requests []RekeyRequest) (err error) {
   112  	__arg := FoldersNeedRekeyArg{Requests: requests}
   113  	err = c.Cli.CallCompressed(ctx, "keybase.1.metadataUpdate.foldersNeedRekey", []interface{}{__arg}, nil, rpc.CompressionGzip, 0*time.Millisecond)
   114  	return
   115  }