github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/protocol/chat1/commands.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/chat1/commands.avdl
     3  
     4  package chat1
     5  
     6  import (
     7  	"errors"
     8  	"fmt"
     9  	"github.com/keybase/go-framed-msgpack-rpc/rpc"
    10  )
    11  
    12  type ConversationCommand struct {
    13  	Description string  `codec:"description" json:"description"`
    14  	Name        string  `codec:"name" json:"name"`
    15  	Usage       string  `codec:"usage" json:"usage"`
    16  	HasHelpText bool    `codec:"hasHelpText" json:"hasHelpText"`
    17  	Username    *string `codec:"username,omitempty" json:"username,omitempty"`
    18  }
    19  
    20  func (o ConversationCommand) DeepCopy() ConversationCommand {
    21  	return ConversationCommand{
    22  		Description: o.Description,
    23  		Name:        o.Name,
    24  		Usage:       o.Usage,
    25  		HasHelpText: o.HasHelpText,
    26  		Username: (func(x *string) *string {
    27  			if x == nil {
    28  				return nil
    29  			}
    30  			tmp := (*x)
    31  			return &tmp
    32  		})(o.Username),
    33  	}
    34  }
    35  
    36  type ConversationCommandGroupsTyp int
    37  
    38  const (
    39  	ConversationCommandGroupsTyp_BUILTIN ConversationCommandGroupsTyp = 0
    40  	ConversationCommandGroupsTyp_CUSTOM  ConversationCommandGroupsTyp = 1
    41  	ConversationCommandGroupsTyp_NONE    ConversationCommandGroupsTyp = 2
    42  )
    43  
    44  func (o ConversationCommandGroupsTyp) DeepCopy() ConversationCommandGroupsTyp { return o }
    45  
    46  var ConversationCommandGroupsTypMap = map[string]ConversationCommandGroupsTyp{
    47  	"BUILTIN": 0,
    48  	"CUSTOM":  1,
    49  	"NONE":    2,
    50  }
    51  
    52  var ConversationCommandGroupsTypRevMap = map[ConversationCommandGroupsTyp]string{
    53  	0: "BUILTIN",
    54  	1: "CUSTOM",
    55  	2: "NONE",
    56  }
    57  
    58  func (e ConversationCommandGroupsTyp) String() string {
    59  	if v, ok := ConversationCommandGroupsTypRevMap[e]; ok {
    60  		return v
    61  	}
    62  	return fmt.Sprintf("%v", int(e))
    63  }
    64  
    65  type ConversationBuiltinCommandTyp int
    66  
    67  const (
    68  	ConversationBuiltinCommandTyp_NONE           ConversationBuiltinCommandTyp = 0
    69  	ConversationBuiltinCommandTyp_ADHOC          ConversationBuiltinCommandTyp = 1
    70  	ConversationBuiltinCommandTyp_SMALLTEAM      ConversationBuiltinCommandTyp = 2
    71  	ConversationBuiltinCommandTyp_BIGTEAM        ConversationBuiltinCommandTyp = 3
    72  	ConversationBuiltinCommandTyp_BIGTEAMGENERAL ConversationBuiltinCommandTyp = 4
    73  )
    74  
    75  func (o ConversationBuiltinCommandTyp) DeepCopy() ConversationBuiltinCommandTyp { return o }
    76  
    77  var ConversationBuiltinCommandTypMap = map[string]ConversationBuiltinCommandTyp{
    78  	"NONE":           0,
    79  	"ADHOC":          1,
    80  	"SMALLTEAM":      2,
    81  	"BIGTEAM":        3,
    82  	"BIGTEAMGENERAL": 4,
    83  }
    84  
    85  var ConversationBuiltinCommandTypRevMap = map[ConversationBuiltinCommandTyp]string{
    86  	0: "NONE",
    87  	1: "ADHOC",
    88  	2: "SMALLTEAM",
    89  	3: "BIGTEAM",
    90  	4: "BIGTEAMGENERAL",
    91  }
    92  
    93  func (e ConversationBuiltinCommandTyp) String() string {
    94  	if v, ok := ConversationBuiltinCommandTypRevMap[e]; ok {
    95  		return v
    96  	}
    97  	return fmt.Sprintf("%v", int(e))
    98  }
    99  
   100  type ConversationCommandGroupsCustom struct {
   101  	Commands []ConversationCommand `codec:"commands" json:"commands"`
   102  }
   103  
   104  func (o ConversationCommandGroupsCustom) DeepCopy() ConversationCommandGroupsCustom {
   105  	return ConversationCommandGroupsCustom{
   106  		Commands: (func(x []ConversationCommand) []ConversationCommand {
   107  			if x == nil {
   108  				return nil
   109  			}
   110  			ret := make([]ConversationCommand, len(x))
   111  			for i, v := range x {
   112  				vCopy := v.DeepCopy()
   113  				ret[i] = vCopy
   114  			}
   115  			return ret
   116  		})(o.Commands),
   117  	}
   118  }
   119  
   120  type ConversationCommandGroups struct {
   121  	Typ__     ConversationCommandGroupsTyp     `codec:"typ" json:"typ"`
   122  	Builtin__ *ConversationBuiltinCommandTyp   `codec:"builtin,omitempty" json:"builtin,omitempty"`
   123  	Custom__  *ConversationCommandGroupsCustom `codec:"custom,omitempty" json:"custom,omitempty"`
   124  }
   125  
   126  func (o *ConversationCommandGroups) Typ() (ret ConversationCommandGroupsTyp, err error) {
   127  	switch o.Typ__ {
   128  	case ConversationCommandGroupsTyp_BUILTIN:
   129  		if o.Builtin__ == nil {
   130  			err = errors.New("unexpected nil value for Builtin__")
   131  			return ret, err
   132  		}
   133  	case ConversationCommandGroupsTyp_CUSTOM:
   134  		if o.Custom__ == nil {
   135  			err = errors.New("unexpected nil value for Custom__")
   136  			return ret, err
   137  		}
   138  	}
   139  	return o.Typ__, nil
   140  }
   141  
   142  func (o ConversationCommandGroups) Builtin() (res ConversationBuiltinCommandTyp) {
   143  	if o.Typ__ != ConversationCommandGroupsTyp_BUILTIN {
   144  		panic("wrong case accessed")
   145  	}
   146  	if o.Builtin__ == nil {
   147  		return
   148  	}
   149  	return *o.Builtin__
   150  }
   151  
   152  func (o ConversationCommandGroups) Custom() (res ConversationCommandGroupsCustom) {
   153  	if o.Typ__ != ConversationCommandGroupsTyp_CUSTOM {
   154  		panic("wrong case accessed")
   155  	}
   156  	if o.Custom__ == nil {
   157  		return
   158  	}
   159  	return *o.Custom__
   160  }
   161  
   162  func NewConversationCommandGroupsWithBuiltin(v ConversationBuiltinCommandTyp) ConversationCommandGroups {
   163  	return ConversationCommandGroups{
   164  		Typ__:     ConversationCommandGroupsTyp_BUILTIN,
   165  		Builtin__: &v,
   166  	}
   167  }
   168  
   169  func NewConversationCommandGroupsWithCustom(v ConversationCommandGroupsCustom) ConversationCommandGroups {
   170  	return ConversationCommandGroups{
   171  		Typ__:    ConversationCommandGroupsTyp_CUSTOM,
   172  		Custom__: &v,
   173  	}
   174  }
   175  
   176  func NewConversationCommandGroupsWithNone() ConversationCommandGroups {
   177  	return ConversationCommandGroups{
   178  		Typ__: ConversationCommandGroupsTyp_NONE,
   179  	}
   180  }
   181  
   182  func (o ConversationCommandGroups) DeepCopy() ConversationCommandGroups {
   183  	return ConversationCommandGroups{
   184  		Typ__: o.Typ__.DeepCopy(),
   185  		Builtin__: (func(x *ConversationBuiltinCommandTyp) *ConversationBuiltinCommandTyp {
   186  			if x == nil {
   187  				return nil
   188  			}
   189  			tmp := (*x).DeepCopy()
   190  			return &tmp
   191  		})(o.Builtin__),
   192  		Custom__: (func(x *ConversationCommandGroupsCustom) *ConversationCommandGroupsCustom {
   193  			if x == nil {
   194  				return nil
   195  			}
   196  			tmp := (*x).DeepCopy()
   197  			return &tmp
   198  		})(o.Custom__),
   199  	}
   200  }
   201  
   202  type CommandsInterface interface {
   203  }
   204  
   205  func CommandsProtocol(i CommandsInterface) rpc.Protocol {
   206  	return rpc.Protocol{
   207  		Name:    "chat.1.commands",
   208  		Methods: map[string]rpc.ServeHandlerDescription{},
   209  	}
   210  }
   211  
   212  type CommandsClient struct {
   213  	Cli rpc.GenericClient
   214  }