github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/protocol/chat1/emoji.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/emoji.avdl
     3  
     4  package chat1
     5  
     6  import (
     7  	"errors"
     8  	"fmt"
     9  	gregor1 "github.com/keybase/client/go/protocol/gregor1"
    10  	"github.com/keybase/go-framed-msgpack-rpc/rpc"
    11  )
    12  
    13  type EmojiLoadSourceTyp int
    14  
    15  const (
    16  	EmojiLoadSourceTyp_HTTPSRV EmojiLoadSourceTyp = 0
    17  	EmojiLoadSourceTyp_STR     EmojiLoadSourceTyp = 1
    18  )
    19  
    20  func (o EmojiLoadSourceTyp) DeepCopy() EmojiLoadSourceTyp { return o }
    21  
    22  var EmojiLoadSourceTypMap = map[string]EmojiLoadSourceTyp{
    23  	"HTTPSRV": 0,
    24  	"STR":     1,
    25  }
    26  
    27  var EmojiLoadSourceTypRevMap = map[EmojiLoadSourceTyp]string{
    28  	0: "HTTPSRV",
    29  	1: "STR",
    30  }
    31  
    32  func (e EmojiLoadSourceTyp) String() string {
    33  	if v, ok := EmojiLoadSourceTypRevMap[e]; ok {
    34  		return v
    35  	}
    36  	return fmt.Sprintf("%v", int(e))
    37  }
    38  
    39  type EmojiLoadSource struct {
    40  	Typ__     EmojiLoadSourceTyp `codec:"typ" json:"typ"`
    41  	Httpsrv__ *string            `codec:"httpsrv,omitempty" json:"httpsrv,omitempty"`
    42  	Str__     *string            `codec:"str,omitempty" json:"str,omitempty"`
    43  }
    44  
    45  func (o *EmojiLoadSource) Typ() (ret EmojiLoadSourceTyp, err error) {
    46  	switch o.Typ__ {
    47  	case EmojiLoadSourceTyp_HTTPSRV:
    48  		if o.Httpsrv__ == nil {
    49  			err = errors.New("unexpected nil value for Httpsrv__")
    50  			return ret, err
    51  		}
    52  	case EmojiLoadSourceTyp_STR:
    53  		if o.Str__ == nil {
    54  			err = errors.New("unexpected nil value for Str__")
    55  			return ret, err
    56  		}
    57  	}
    58  	return o.Typ__, nil
    59  }
    60  
    61  func (o EmojiLoadSource) Httpsrv() (res string) {
    62  	if o.Typ__ != EmojiLoadSourceTyp_HTTPSRV {
    63  		panic("wrong case accessed")
    64  	}
    65  	if o.Httpsrv__ == nil {
    66  		return
    67  	}
    68  	return *o.Httpsrv__
    69  }
    70  
    71  func (o EmojiLoadSource) Str() (res string) {
    72  	if o.Typ__ != EmojiLoadSourceTyp_STR {
    73  		panic("wrong case accessed")
    74  	}
    75  	if o.Str__ == nil {
    76  		return
    77  	}
    78  	return *o.Str__
    79  }
    80  
    81  func NewEmojiLoadSourceWithHttpsrv(v string) EmojiLoadSource {
    82  	return EmojiLoadSource{
    83  		Typ__:     EmojiLoadSourceTyp_HTTPSRV,
    84  		Httpsrv__: &v,
    85  	}
    86  }
    87  
    88  func NewEmojiLoadSourceWithStr(v string) EmojiLoadSource {
    89  	return EmojiLoadSource{
    90  		Typ__: EmojiLoadSourceTyp_STR,
    91  		Str__: &v,
    92  	}
    93  }
    94  
    95  func (o EmojiLoadSource) DeepCopy() EmojiLoadSource {
    96  	return EmojiLoadSource{
    97  		Typ__: o.Typ__.DeepCopy(),
    98  		Httpsrv__: (func(x *string) *string {
    99  			if x == nil {
   100  				return nil
   101  			}
   102  			tmp := (*x)
   103  			return &tmp
   104  		})(o.Httpsrv__),
   105  		Str__: (func(x *string) *string {
   106  			if x == nil {
   107  				return nil
   108  			}
   109  			tmp := (*x)
   110  			return &tmp
   111  		})(o.Str__),
   112  	}
   113  }
   114  
   115  type EmojiRemoteSourceTyp int
   116  
   117  const (
   118  	EmojiRemoteSourceTyp_MESSAGE    EmojiRemoteSourceTyp = 0
   119  	EmojiRemoteSourceTyp_STOCKALIAS EmojiRemoteSourceTyp = 1
   120  )
   121  
   122  func (o EmojiRemoteSourceTyp) DeepCopy() EmojiRemoteSourceTyp { return o }
   123  
   124  var EmojiRemoteSourceTypMap = map[string]EmojiRemoteSourceTyp{
   125  	"MESSAGE":    0,
   126  	"STOCKALIAS": 1,
   127  }
   128  
   129  var EmojiRemoteSourceTypRevMap = map[EmojiRemoteSourceTyp]string{
   130  	0: "MESSAGE",
   131  	1: "STOCKALIAS",
   132  }
   133  
   134  func (e EmojiRemoteSourceTyp) String() string {
   135  	if v, ok := EmojiRemoteSourceTypRevMap[e]; ok {
   136  		return v
   137  	}
   138  	return fmt.Sprintf("%v", int(e))
   139  }
   140  
   141  type EmojiMessage struct {
   142  	ConvID  ConversationID `codec:"convID" json:"convID"`
   143  	MsgID   MessageID      `codec:"msgID" json:"msgID"`
   144  	IsAlias bool           `codec:"isAlias" json:"isAlias"`
   145  }
   146  
   147  func (o EmojiMessage) DeepCopy() EmojiMessage {
   148  	return EmojiMessage{
   149  		ConvID:  o.ConvID.DeepCopy(),
   150  		MsgID:   o.MsgID.DeepCopy(),
   151  		IsAlias: o.IsAlias,
   152  	}
   153  }
   154  
   155  type EmojiStockAlias struct {
   156  	Text     string       `codec:"text" json:"text"`
   157  	Username string       `codec:"username" json:"username"`
   158  	Time     gregor1.Time `codec:"time" json:"time"`
   159  }
   160  
   161  func (o EmojiStockAlias) DeepCopy() EmojiStockAlias {
   162  	return EmojiStockAlias{
   163  		Text:     o.Text,
   164  		Username: o.Username,
   165  		Time:     o.Time.DeepCopy(),
   166  	}
   167  }
   168  
   169  type EmojiRemoteSource struct {
   170  	Typ__        EmojiRemoteSourceTyp `codec:"typ" json:"typ"`
   171  	Message__    *EmojiMessage        `codec:"message,omitempty" json:"message,omitempty"`
   172  	Stockalias__ *EmojiStockAlias     `codec:"stockalias,omitempty" json:"stockalias,omitempty"`
   173  }
   174  
   175  func (o *EmojiRemoteSource) Typ() (ret EmojiRemoteSourceTyp, err error) {
   176  	switch o.Typ__ {
   177  	case EmojiRemoteSourceTyp_MESSAGE:
   178  		if o.Message__ == nil {
   179  			err = errors.New("unexpected nil value for Message__")
   180  			return ret, err
   181  		}
   182  	case EmojiRemoteSourceTyp_STOCKALIAS:
   183  		if o.Stockalias__ == nil {
   184  			err = errors.New("unexpected nil value for Stockalias__")
   185  			return ret, err
   186  		}
   187  	}
   188  	return o.Typ__, nil
   189  }
   190  
   191  func (o EmojiRemoteSource) Message() (res EmojiMessage) {
   192  	if o.Typ__ != EmojiRemoteSourceTyp_MESSAGE {
   193  		panic("wrong case accessed")
   194  	}
   195  	if o.Message__ == nil {
   196  		return
   197  	}
   198  	return *o.Message__
   199  }
   200  
   201  func (o EmojiRemoteSource) Stockalias() (res EmojiStockAlias) {
   202  	if o.Typ__ != EmojiRemoteSourceTyp_STOCKALIAS {
   203  		panic("wrong case accessed")
   204  	}
   205  	if o.Stockalias__ == nil {
   206  		return
   207  	}
   208  	return *o.Stockalias__
   209  }
   210  
   211  func NewEmojiRemoteSourceWithMessage(v EmojiMessage) EmojiRemoteSource {
   212  	return EmojiRemoteSource{
   213  		Typ__:     EmojiRemoteSourceTyp_MESSAGE,
   214  		Message__: &v,
   215  	}
   216  }
   217  
   218  func NewEmojiRemoteSourceWithStockalias(v EmojiStockAlias) EmojiRemoteSource {
   219  	return EmojiRemoteSource{
   220  		Typ__:        EmojiRemoteSourceTyp_STOCKALIAS,
   221  		Stockalias__: &v,
   222  	}
   223  }
   224  
   225  func (o EmojiRemoteSource) DeepCopy() EmojiRemoteSource {
   226  	return EmojiRemoteSource{
   227  		Typ__: o.Typ__.DeepCopy(),
   228  		Message__: (func(x *EmojiMessage) *EmojiMessage {
   229  			if x == nil {
   230  				return nil
   231  			}
   232  			tmp := (*x).DeepCopy()
   233  			return &tmp
   234  		})(o.Message__),
   235  		Stockalias__: (func(x *EmojiStockAlias) *EmojiStockAlias {
   236  			if x == nil {
   237  				return nil
   238  			}
   239  			tmp := (*x).DeepCopy()
   240  			return &tmp
   241  		})(o.Stockalias__),
   242  	}
   243  }
   244  
   245  type HarvestedEmoji struct {
   246  	Alias       string            `codec:"alias" json:"alias"`
   247  	IsBig       bool              `codec:"isBig" json:"isBig"`
   248  	IsCrossTeam bool              `codec:"isCrossTeam" json:"isCrossTeam"`
   249  	Source      EmojiRemoteSource `codec:"source" json:"source"`
   250  }
   251  
   252  func (o HarvestedEmoji) DeepCopy() HarvestedEmoji {
   253  	return HarvestedEmoji{
   254  		Alias:       o.Alias,
   255  		IsBig:       o.IsBig,
   256  		IsCrossTeam: o.IsCrossTeam,
   257  		Source:      o.Source.DeepCopy(),
   258  	}
   259  }
   260  
   261  type EmojiCreationInfo struct {
   262  	Username string       `codec:"username" json:"username"`
   263  	Time     gregor1.Time `codec:"time" json:"time"`
   264  }
   265  
   266  func (o EmojiCreationInfo) DeepCopy() EmojiCreationInfo {
   267  	return EmojiCreationInfo{
   268  		Username: o.Username,
   269  		Time:     o.Time.DeepCopy(),
   270  	}
   271  }
   272  
   273  type Emoji struct {
   274  	Alias        string             `codec:"alias" json:"alias"`
   275  	IsBig        bool               `codec:"isBig" json:"isBig"`
   276  	IsReacji     bool               `codec:"isReacji" json:"isReacji"`
   277  	IsCrossTeam  bool               `codec:"isCrossTeam" json:"isCrossTeam"`
   278  	IsAlias      bool               `codec:"isAlias" json:"isAlias"`
   279  	Source       EmojiLoadSource    `codec:"source" json:"source"`
   280  	NoAnimSource EmojiLoadSource    `codec:"noAnimSource" json:"noAnimSource"`
   281  	RemoteSource EmojiRemoteSource  `codec:"remoteSource" json:"remoteSource"`
   282  	CreationInfo *EmojiCreationInfo `codec:"creationInfo,omitempty" json:"creationInfo,omitempty"`
   283  	Teamname     *string            `codec:"teamname,omitempty" json:"teamname,omitempty"`
   284  }
   285  
   286  func (o Emoji) DeepCopy() Emoji {
   287  	return Emoji{
   288  		Alias:        o.Alias,
   289  		IsBig:        o.IsBig,
   290  		IsReacji:     o.IsReacji,
   291  		IsCrossTeam:  o.IsCrossTeam,
   292  		IsAlias:      o.IsAlias,
   293  		Source:       o.Source.DeepCopy(),
   294  		NoAnimSource: o.NoAnimSource.DeepCopy(),
   295  		RemoteSource: o.RemoteSource.DeepCopy(),
   296  		CreationInfo: (func(x *EmojiCreationInfo) *EmojiCreationInfo {
   297  			if x == nil {
   298  				return nil
   299  			}
   300  			tmp := (*x).DeepCopy()
   301  			return &tmp
   302  		})(o.CreationInfo),
   303  		Teamname: (func(x *string) *string {
   304  			if x == nil {
   305  				return nil
   306  			}
   307  			tmp := (*x)
   308  			return &tmp
   309  		})(o.Teamname),
   310  	}
   311  }
   312  
   313  type EmojiGroup struct {
   314  	Name   string  `codec:"name" json:"name"`
   315  	Emojis []Emoji `codec:"emojis" json:"emojis"`
   316  }
   317  
   318  func (o EmojiGroup) DeepCopy() EmojiGroup {
   319  	return EmojiGroup{
   320  		Name: o.Name,
   321  		Emojis: (func(x []Emoji) []Emoji {
   322  			if x == nil {
   323  				return nil
   324  			}
   325  			ret := make([]Emoji, len(x))
   326  			for i, v := range x {
   327  				vCopy := v.DeepCopy()
   328  				ret[i] = vCopy
   329  			}
   330  			return ret
   331  		})(o.Emojis),
   332  	}
   333  }
   334  
   335  type UserEmojis struct {
   336  	Emojis []EmojiGroup `codec:"emojis" json:"emojis"`
   337  }
   338  
   339  func (o UserEmojis) DeepCopy() UserEmojis {
   340  	return UserEmojis{
   341  		Emojis: (func(x []EmojiGroup) []EmojiGroup {
   342  			if x == nil {
   343  				return nil
   344  			}
   345  			ret := make([]EmojiGroup, len(x))
   346  			for i, v := range x {
   347  				vCopy := v.DeepCopy()
   348  				ret[i] = vCopy
   349  			}
   350  			return ret
   351  		})(o.Emojis),
   352  	}
   353  }
   354  
   355  type EmojiStorage struct {
   356  	Mapping map[string]EmojiRemoteSource `codec:"mapping" json:"mapping"`
   357  }
   358  
   359  func (o EmojiStorage) DeepCopy() EmojiStorage {
   360  	return EmojiStorage{
   361  		Mapping: (func(x map[string]EmojiRemoteSource) map[string]EmojiRemoteSource {
   362  			if x == nil {
   363  				return nil
   364  			}
   365  			ret := make(map[string]EmojiRemoteSource, len(x))
   366  			for k, v := range x {
   367  				kCopy := k
   368  				vCopy := v.DeepCopy()
   369  				ret[kCopy] = vCopy
   370  			}
   371  			return ret
   372  		})(o.Mapping),
   373  	}
   374  }
   375  
   376  type EmojiInterface interface {
   377  }
   378  
   379  func EmojiProtocol(i EmojiInterface) rpc.Protocol {
   380  	return rpc.Protocol{
   381  		Name:    "chat.1.emoji",
   382  		Methods: map[string]rpc.ServeHandlerDescription{},
   383  	}
   384  }
   385  
   386  type EmojiClient struct {
   387  	Cli rpc.GenericClient
   388  }