github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/chat1/unfurl.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/unfurl.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 UnfurlType int
    14  
    15  const (
    16  	UnfurlType_GENERIC UnfurlType = 0
    17  	UnfurlType_YOUTUBE UnfurlType = 1
    18  	UnfurlType_GIPHY   UnfurlType = 2
    19  	UnfurlType_MAPS    UnfurlType = 3
    20  )
    21  
    22  func (o UnfurlType) DeepCopy() UnfurlType { return o }
    23  
    24  var UnfurlTypeMap = map[string]UnfurlType{
    25  	"GENERIC": 0,
    26  	"YOUTUBE": 1,
    27  	"GIPHY":   2,
    28  	"MAPS":    3,
    29  }
    30  
    31  var UnfurlTypeRevMap = map[UnfurlType]string{
    32  	0: "GENERIC",
    33  	1: "YOUTUBE",
    34  	2: "GIPHY",
    35  	3: "MAPS",
    36  }
    37  
    38  func (e UnfurlType) String() string {
    39  	if v, ok := UnfurlTypeRevMap[e]; ok {
    40  		return v
    41  	}
    42  	return fmt.Sprintf("%v", int(e))
    43  }
    44  
    45  type UnfurlVideo struct {
    46  	Url      string `codec:"url" json:"url"`
    47  	MimeType string `codec:"mimeType" json:"mimeType"`
    48  	Height   int    `codec:"height" json:"height"`
    49  	Width    int    `codec:"width" json:"width"`
    50  }
    51  
    52  func (o UnfurlVideo) DeepCopy() UnfurlVideo {
    53  	return UnfurlVideo{
    54  		Url:      o.Url,
    55  		MimeType: o.MimeType,
    56  		Height:   o.Height,
    57  		Width:    o.Width,
    58  	}
    59  }
    60  
    61  type UnfurlGenericRaw struct {
    62  	Title       string       `codec:"title" json:"title"`
    63  	Url         string       `codec:"url" json:"url"`
    64  	SiteName    string       `codec:"siteName" json:"siteName"`
    65  	FaviconUrl  *string      `codec:"faviconUrl,omitempty" json:"faviconUrl,omitempty"`
    66  	ImageUrl    *string      `codec:"imageUrl,omitempty" json:"imageUrl,omitempty"`
    67  	Video       *UnfurlVideo `codec:"video,omitempty" json:"video,omitempty"`
    68  	PublishTime *int         `codec:"publishTime,omitempty" json:"publishTime,omitempty"`
    69  	Description *string      `codec:"description,omitempty" json:"description,omitempty"`
    70  }
    71  
    72  func (o UnfurlGenericRaw) DeepCopy() UnfurlGenericRaw {
    73  	return UnfurlGenericRaw{
    74  		Title:    o.Title,
    75  		Url:      o.Url,
    76  		SiteName: o.SiteName,
    77  		FaviconUrl: (func(x *string) *string {
    78  			if x == nil {
    79  				return nil
    80  			}
    81  			tmp := (*x)
    82  			return &tmp
    83  		})(o.FaviconUrl),
    84  		ImageUrl: (func(x *string) *string {
    85  			if x == nil {
    86  				return nil
    87  			}
    88  			tmp := (*x)
    89  			return &tmp
    90  		})(o.ImageUrl),
    91  		Video: (func(x *UnfurlVideo) *UnfurlVideo {
    92  			if x == nil {
    93  				return nil
    94  			}
    95  			tmp := (*x).DeepCopy()
    96  			return &tmp
    97  		})(o.Video),
    98  		PublishTime: (func(x *int) *int {
    99  			if x == nil {
   100  				return nil
   101  			}
   102  			tmp := (*x)
   103  			return &tmp
   104  		})(o.PublishTime),
   105  		Description: (func(x *string) *string {
   106  			if x == nil {
   107  				return nil
   108  			}
   109  			tmp := (*x)
   110  			return &tmp
   111  		})(o.Description),
   112  	}
   113  }
   114  
   115  type UnfurlYoutubeRaw struct {
   116  }
   117  
   118  func (o UnfurlYoutubeRaw) DeepCopy() UnfurlYoutubeRaw {
   119  	return UnfurlYoutubeRaw{}
   120  }
   121  
   122  type UnfurlGiphyRaw struct {
   123  	ImageUrl   *string      `codec:"imageUrl,omitempty" json:"imageUrl,omitempty"`
   124  	Video      *UnfurlVideo `codec:"video,omitempty" json:"video,omitempty"`
   125  	FaviconUrl *string      `codec:"faviconUrl,omitempty" json:"faviconUrl,omitempty"`
   126  }
   127  
   128  func (o UnfurlGiphyRaw) DeepCopy() UnfurlGiphyRaw {
   129  	return UnfurlGiphyRaw{
   130  		ImageUrl: (func(x *string) *string {
   131  			if x == nil {
   132  				return nil
   133  			}
   134  			tmp := (*x)
   135  			return &tmp
   136  		})(o.ImageUrl),
   137  		Video: (func(x *UnfurlVideo) *UnfurlVideo {
   138  			if x == nil {
   139  				return nil
   140  			}
   141  			tmp := (*x).DeepCopy()
   142  			return &tmp
   143  		})(o.Video),
   144  		FaviconUrl: (func(x *string) *string {
   145  			if x == nil {
   146  				return nil
   147  			}
   148  			tmp := (*x)
   149  			return &tmp
   150  		})(o.FaviconUrl),
   151  	}
   152  }
   153  
   154  type UnfurlMapsRaw struct {
   155  	Title               string        `codec:"title" json:"title"`
   156  	Url                 string        `codec:"url" json:"url"`
   157  	SiteName            string        `codec:"siteName" json:"siteName"`
   158  	ImageUrl            string        `codec:"imageUrl" json:"imageUrl"`
   159  	HistoryImageUrl     *string       `codec:"historyImageUrl,omitempty" json:"historyImageUrl,omitempty"`
   160  	Description         string        `codec:"description" json:"description"`
   161  	Coord               Coordinate    `codec:"coord" json:"coord"`
   162  	Time                gregor1.Time  `codec:"time" json:"time"`
   163  	LiveLocationEndTime *gregor1.Time `codec:"liveLocationEndTime,omitempty" json:"liveLocationEndTime,omitempty"`
   164  	LiveLocationDone    bool          `codec:"liveLocationDone" json:"liveLocationDone"`
   165  }
   166  
   167  func (o UnfurlMapsRaw) DeepCopy() UnfurlMapsRaw {
   168  	return UnfurlMapsRaw{
   169  		Title:    o.Title,
   170  		Url:      o.Url,
   171  		SiteName: o.SiteName,
   172  		ImageUrl: o.ImageUrl,
   173  		HistoryImageUrl: (func(x *string) *string {
   174  			if x == nil {
   175  				return nil
   176  			}
   177  			tmp := (*x)
   178  			return &tmp
   179  		})(o.HistoryImageUrl),
   180  		Description: o.Description,
   181  		Coord:       o.Coord.DeepCopy(),
   182  		Time:        o.Time.DeepCopy(),
   183  		LiveLocationEndTime: (func(x *gregor1.Time) *gregor1.Time {
   184  			if x == nil {
   185  				return nil
   186  			}
   187  			tmp := (*x).DeepCopy()
   188  			return &tmp
   189  		})(o.LiveLocationEndTime),
   190  		LiveLocationDone: o.LiveLocationDone,
   191  	}
   192  }
   193  
   194  type UnfurlRaw struct {
   195  	UnfurlType__ UnfurlType        `codec:"unfurlType" json:"unfurlType"`
   196  	Generic__    *UnfurlGenericRaw `codec:"generic,omitempty" json:"generic,omitempty"`
   197  	Youtube__    *UnfurlYoutubeRaw `codec:"youtube,omitempty" json:"youtube,omitempty"`
   198  	Giphy__      *UnfurlGiphyRaw   `codec:"giphy,omitempty" json:"giphy,omitempty"`
   199  	Maps__       *UnfurlMapsRaw    `codec:"maps,omitempty" json:"maps,omitempty"`
   200  }
   201  
   202  func (o *UnfurlRaw) UnfurlType() (ret UnfurlType, err error) {
   203  	switch o.UnfurlType__ {
   204  	case UnfurlType_GENERIC:
   205  		if o.Generic__ == nil {
   206  			err = errors.New("unexpected nil value for Generic__")
   207  			return ret, err
   208  		}
   209  	case UnfurlType_YOUTUBE:
   210  		if o.Youtube__ == nil {
   211  			err = errors.New("unexpected nil value for Youtube__")
   212  			return ret, err
   213  		}
   214  	case UnfurlType_GIPHY:
   215  		if o.Giphy__ == nil {
   216  			err = errors.New("unexpected nil value for Giphy__")
   217  			return ret, err
   218  		}
   219  	case UnfurlType_MAPS:
   220  		if o.Maps__ == nil {
   221  			err = errors.New("unexpected nil value for Maps__")
   222  			return ret, err
   223  		}
   224  	}
   225  	return o.UnfurlType__, nil
   226  }
   227  
   228  func (o UnfurlRaw) Generic() (res UnfurlGenericRaw) {
   229  	if o.UnfurlType__ != UnfurlType_GENERIC {
   230  		panic("wrong case accessed")
   231  	}
   232  	if o.Generic__ == nil {
   233  		return
   234  	}
   235  	return *o.Generic__
   236  }
   237  
   238  func (o UnfurlRaw) Youtube() (res UnfurlYoutubeRaw) {
   239  	if o.UnfurlType__ != UnfurlType_YOUTUBE {
   240  		panic("wrong case accessed")
   241  	}
   242  	if o.Youtube__ == nil {
   243  		return
   244  	}
   245  	return *o.Youtube__
   246  }
   247  
   248  func (o UnfurlRaw) Giphy() (res UnfurlGiphyRaw) {
   249  	if o.UnfurlType__ != UnfurlType_GIPHY {
   250  		panic("wrong case accessed")
   251  	}
   252  	if o.Giphy__ == nil {
   253  		return
   254  	}
   255  	return *o.Giphy__
   256  }
   257  
   258  func (o UnfurlRaw) Maps() (res UnfurlMapsRaw) {
   259  	if o.UnfurlType__ != UnfurlType_MAPS {
   260  		panic("wrong case accessed")
   261  	}
   262  	if o.Maps__ == nil {
   263  		return
   264  	}
   265  	return *o.Maps__
   266  }
   267  
   268  func NewUnfurlRawWithGeneric(v UnfurlGenericRaw) UnfurlRaw {
   269  	return UnfurlRaw{
   270  		UnfurlType__: UnfurlType_GENERIC,
   271  		Generic__:    &v,
   272  	}
   273  }
   274  
   275  func NewUnfurlRawWithYoutube(v UnfurlYoutubeRaw) UnfurlRaw {
   276  	return UnfurlRaw{
   277  		UnfurlType__: UnfurlType_YOUTUBE,
   278  		Youtube__:    &v,
   279  	}
   280  }
   281  
   282  func NewUnfurlRawWithGiphy(v UnfurlGiphyRaw) UnfurlRaw {
   283  	return UnfurlRaw{
   284  		UnfurlType__: UnfurlType_GIPHY,
   285  		Giphy__:      &v,
   286  	}
   287  }
   288  
   289  func NewUnfurlRawWithMaps(v UnfurlMapsRaw) UnfurlRaw {
   290  	return UnfurlRaw{
   291  		UnfurlType__: UnfurlType_MAPS,
   292  		Maps__:       &v,
   293  	}
   294  }
   295  
   296  func (o UnfurlRaw) DeepCopy() UnfurlRaw {
   297  	return UnfurlRaw{
   298  		UnfurlType__: o.UnfurlType__.DeepCopy(),
   299  		Generic__: (func(x *UnfurlGenericRaw) *UnfurlGenericRaw {
   300  			if x == nil {
   301  				return nil
   302  			}
   303  			tmp := (*x).DeepCopy()
   304  			return &tmp
   305  		})(o.Generic__),
   306  		Youtube__: (func(x *UnfurlYoutubeRaw) *UnfurlYoutubeRaw {
   307  			if x == nil {
   308  				return nil
   309  			}
   310  			tmp := (*x).DeepCopy()
   311  			return &tmp
   312  		})(o.Youtube__),
   313  		Giphy__: (func(x *UnfurlGiphyRaw) *UnfurlGiphyRaw {
   314  			if x == nil {
   315  				return nil
   316  			}
   317  			tmp := (*x).DeepCopy()
   318  			return &tmp
   319  		})(o.Giphy__),
   320  		Maps__: (func(x *UnfurlMapsRaw) *UnfurlMapsRaw {
   321  			if x == nil {
   322  				return nil
   323  			}
   324  			tmp := (*x).DeepCopy()
   325  			return &tmp
   326  		})(o.Maps__),
   327  	}
   328  }
   329  
   330  type UnfurlGenericMapInfo struct {
   331  	Coord               Coordinate    `codec:"coord" json:"coord"`
   332  	Time                gregor1.Time  `codec:"time" json:"time"`
   333  	LiveLocationEndTime *gregor1.Time `codec:"liveLocationEndTime,omitempty" json:"liveLocationEndTime,omitempty"`
   334  	IsLiveLocationDone  bool          `codec:"isLiveLocationDone" json:"isLiveLocationDone"`
   335  }
   336  
   337  func (o UnfurlGenericMapInfo) DeepCopy() UnfurlGenericMapInfo {
   338  	return UnfurlGenericMapInfo{
   339  		Coord: o.Coord.DeepCopy(),
   340  		Time:  o.Time.DeepCopy(),
   341  		LiveLocationEndTime: (func(x *gregor1.Time) *gregor1.Time {
   342  			if x == nil {
   343  				return nil
   344  			}
   345  			tmp := (*x).DeepCopy()
   346  			return &tmp
   347  		})(o.LiveLocationEndTime),
   348  		IsLiveLocationDone: o.IsLiveLocationDone,
   349  	}
   350  }
   351  
   352  type UnfurlGeneric struct {
   353  	Title       string                `codec:"title" json:"title"`
   354  	Url         string                `codec:"url" json:"url"`
   355  	SiteName    string                `codec:"siteName" json:"siteName"`
   356  	Favicon     *Asset                `codec:"favicon,omitempty" json:"favicon,omitempty"`
   357  	Image       *Asset                `codec:"image,omitempty" json:"image,omitempty"`
   358  	PublishTime *int                  `codec:"publishTime,omitempty" json:"publishTime,omitempty"`
   359  	Description *string               `codec:"description,omitempty" json:"description,omitempty"`
   360  	MapInfo     *UnfurlGenericMapInfo `codec:"mapInfo,omitempty" json:"mapInfo,omitempty"`
   361  }
   362  
   363  func (o UnfurlGeneric) DeepCopy() UnfurlGeneric {
   364  	return UnfurlGeneric{
   365  		Title:    o.Title,
   366  		Url:      o.Url,
   367  		SiteName: o.SiteName,
   368  		Favicon: (func(x *Asset) *Asset {
   369  			if x == nil {
   370  				return nil
   371  			}
   372  			tmp := (*x).DeepCopy()
   373  			return &tmp
   374  		})(o.Favicon),
   375  		Image: (func(x *Asset) *Asset {
   376  			if x == nil {
   377  				return nil
   378  			}
   379  			tmp := (*x).DeepCopy()
   380  			return &tmp
   381  		})(o.Image),
   382  		PublishTime: (func(x *int) *int {
   383  			if x == nil {
   384  				return nil
   385  			}
   386  			tmp := (*x)
   387  			return &tmp
   388  		})(o.PublishTime),
   389  		Description: (func(x *string) *string {
   390  			if x == nil {
   391  				return nil
   392  			}
   393  			tmp := (*x)
   394  			return &tmp
   395  		})(o.Description),
   396  		MapInfo: (func(x *UnfurlGenericMapInfo) *UnfurlGenericMapInfo {
   397  			if x == nil {
   398  				return nil
   399  			}
   400  			tmp := (*x).DeepCopy()
   401  			return &tmp
   402  		})(o.MapInfo),
   403  	}
   404  }
   405  
   406  type UnfurlYoutube struct {
   407  }
   408  
   409  func (o UnfurlYoutube) DeepCopy() UnfurlYoutube {
   410  	return UnfurlYoutube{}
   411  }
   412  
   413  type UnfurlGiphy struct {
   414  	Favicon *Asset `codec:"favicon,omitempty" json:"favicon,omitempty"`
   415  	Image   *Asset `codec:"image,omitempty" json:"image,omitempty"`
   416  	Video   *Asset `codec:"video,omitempty" json:"video,omitempty"`
   417  }
   418  
   419  func (o UnfurlGiphy) DeepCopy() UnfurlGiphy {
   420  	return UnfurlGiphy{
   421  		Favicon: (func(x *Asset) *Asset {
   422  			if x == nil {
   423  				return nil
   424  			}
   425  			tmp := (*x).DeepCopy()
   426  			return &tmp
   427  		})(o.Favicon),
   428  		Image: (func(x *Asset) *Asset {
   429  			if x == nil {
   430  				return nil
   431  			}
   432  			tmp := (*x).DeepCopy()
   433  			return &tmp
   434  		})(o.Image),
   435  		Video: (func(x *Asset) *Asset {
   436  			if x == nil {
   437  				return nil
   438  			}
   439  			tmp := (*x).DeepCopy()
   440  			return &tmp
   441  		})(o.Video),
   442  	}
   443  }
   444  
   445  type Unfurl struct {
   446  	UnfurlType__ UnfurlType     `codec:"unfurlType" json:"unfurlType"`
   447  	Generic__    *UnfurlGeneric `codec:"generic,omitempty" json:"generic,omitempty"`
   448  	Youtube__    *UnfurlYoutube `codec:"youtube,omitempty" json:"youtube,omitempty"`
   449  	Giphy__      *UnfurlGiphy   `codec:"giphy,omitempty" json:"giphy,omitempty"`
   450  }
   451  
   452  func (o *Unfurl) UnfurlType() (ret UnfurlType, err error) {
   453  	switch o.UnfurlType__ {
   454  	case UnfurlType_GENERIC:
   455  		if o.Generic__ == nil {
   456  			err = errors.New("unexpected nil value for Generic__")
   457  			return ret, err
   458  		}
   459  	case UnfurlType_YOUTUBE:
   460  		if o.Youtube__ == nil {
   461  			err = errors.New("unexpected nil value for Youtube__")
   462  			return ret, err
   463  		}
   464  	case UnfurlType_GIPHY:
   465  		if o.Giphy__ == nil {
   466  			err = errors.New("unexpected nil value for Giphy__")
   467  			return ret, err
   468  		}
   469  	}
   470  	return o.UnfurlType__, nil
   471  }
   472  
   473  func (o Unfurl) Generic() (res UnfurlGeneric) {
   474  	if o.UnfurlType__ != UnfurlType_GENERIC {
   475  		panic("wrong case accessed")
   476  	}
   477  	if o.Generic__ == nil {
   478  		return
   479  	}
   480  	return *o.Generic__
   481  }
   482  
   483  func (o Unfurl) Youtube() (res UnfurlYoutube) {
   484  	if o.UnfurlType__ != UnfurlType_YOUTUBE {
   485  		panic("wrong case accessed")
   486  	}
   487  	if o.Youtube__ == nil {
   488  		return
   489  	}
   490  	return *o.Youtube__
   491  }
   492  
   493  func (o Unfurl) Giphy() (res UnfurlGiphy) {
   494  	if o.UnfurlType__ != UnfurlType_GIPHY {
   495  		panic("wrong case accessed")
   496  	}
   497  	if o.Giphy__ == nil {
   498  		return
   499  	}
   500  	return *o.Giphy__
   501  }
   502  
   503  func NewUnfurlWithGeneric(v UnfurlGeneric) Unfurl {
   504  	return Unfurl{
   505  		UnfurlType__: UnfurlType_GENERIC,
   506  		Generic__:    &v,
   507  	}
   508  }
   509  
   510  func NewUnfurlWithYoutube(v UnfurlYoutube) Unfurl {
   511  	return Unfurl{
   512  		UnfurlType__: UnfurlType_YOUTUBE,
   513  		Youtube__:    &v,
   514  	}
   515  }
   516  
   517  func NewUnfurlWithGiphy(v UnfurlGiphy) Unfurl {
   518  	return Unfurl{
   519  		UnfurlType__: UnfurlType_GIPHY,
   520  		Giphy__:      &v,
   521  	}
   522  }
   523  
   524  func (o Unfurl) DeepCopy() Unfurl {
   525  	return Unfurl{
   526  		UnfurlType__: o.UnfurlType__.DeepCopy(),
   527  		Generic__: (func(x *UnfurlGeneric) *UnfurlGeneric {
   528  			if x == nil {
   529  				return nil
   530  			}
   531  			tmp := (*x).DeepCopy()
   532  			return &tmp
   533  		})(o.Generic__),
   534  		Youtube__: (func(x *UnfurlYoutube) *UnfurlYoutube {
   535  			if x == nil {
   536  				return nil
   537  			}
   538  			tmp := (*x).DeepCopy()
   539  			return &tmp
   540  		})(o.Youtube__),
   541  		Giphy__: (func(x *UnfurlGiphy) *UnfurlGiphy {
   542  			if x == nil {
   543  				return nil
   544  			}
   545  			tmp := (*x).DeepCopy()
   546  			return &tmp
   547  		})(o.Giphy__),
   548  	}
   549  }
   550  
   551  type UnfurlResult struct {
   552  	Unfurl Unfurl `codec:"unfurl" json:"unfurl"`
   553  	Url    string `codec:"url" json:"url"`
   554  }
   555  
   556  func (o UnfurlResult) DeepCopy() UnfurlResult {
   557  	return UnfurlResult{
   558  		Unfurl: o.Unfurl.DeepCopy(),
   559  		Url:    o.Url,
   560  	}
   561  }
   562  
   563  type UnfurlImageDisplay struct {
   564  	Url     string `codec:"url" json:"url"`
   565  	Height  int    `codec:"height" json:"height"`
   566  	Width   int    `codec:"width" json:"width"`
   567  	IsVideo bool   `codec:"isVideo" json:"isVideo"`
   568  }
   569  
   570  func (o UnfurlImageDisplay) DeepCopy() UnfurlImageDisplay {
   571  	return UnfurlImageDisplay{
   572  		Url:     o.Url,
   573  		Height:  o.Height,
   574  		Width:   o.Width,
   575  		IsVideo: o.IsVideo,
   576  	}
   577  }
   578  
   579  type UnfurlGenericDisplay struct {
   580  	Title       string                `codec:"title" json:"title"`
   581  	Url         string                `codec:"url" json:"url"`
   582  	SiteName    string                `codec:"siteName" json:"siteName"`
   583  	Favicon     *UnfurlImageDisplay   `codec:"favicon,omitempty" json:"favicon,omitempty"`
   584  	Media       *UnfurlImageDisplay   `codec:"media,omitempty" json:"media,omitempty"`
   585  	PublishTime *int                  `codec:"publishTime,omitempty" json:"publishTime,omitempty"`
   586  	Description *string               `codec:"description,omitempty" json:"description,omitempty"`
   587  	MapInfo     *UnfurlGenericMapInfo `codec:"mapInfo,omitempty" json:"mapInfo,omitempty"`
   588  }
   589  
   590  func (o UnfurlGenericDisplay) DeepCopy() UnfurlGenericDisplay {
   591  	return UnfurlGenericDisplay{
   592  		Title:    o.Title,
   593  		Url:      o.Url,
   594  		SiteName: o.SiteName,
   595  		Favicon: (func(x *UnfurlImageDisplay) *UnfurlImageDisplay {
   596  			if x == nil {
   597  				return nil
   598  			}
   599  			tmp := (*x).DeepCopy()
   600  			return &tmp
   601  		})(o.Favicon),
   602  		Media: (func(x *UnfurlImageDisplay) *UnfurlImageDisplay {
   603  			if x == nil {
   604  				return nil
   605  			}
   606  			tmp := (*x).DeepCopy()
   607  			return &tmp
   608  		})(o.Media),
   609  		PublishTime: (func(x *int) *int {
   610  			if x == nil {
   611  				return nil
   612  			}
   613  			tmp := (*x)
   614  			return &tmp
   615  		})(o.PublishTime),
   616  		Description: (func(x *string) *string {
   617  			if x == nil {
   618  				return nil
   619  			}
   620  			tmp := (*x)
   621  			return &tmp
   622  		})(o.Description),
   623  		MapInfo: (func(x *UnfurlGenericMapInfo) *UnfurlGenericMapInfo {
   624  			if x == nil {
   625  				return nil
   626  			}
   627  			tmp := (*x).DeepCopy()
   628  			return &tmp
   629  		})(o.MapInfo),
   630  	}
   631  }
   632  
   633  type UnfurlYoutubeDisplay struct {
   634  }
   635  
   636  func (o UnfurlYoutubeDisplay) DeepCopy() UnfurlYoutubeDisplay {
   637  	return UnfurlYoutubeDisplay{}
   638  }
   639  
   640  type UnfurlGiphyDisplay struct {
   641  	Favicon *UnfurlImageDisplay `codec:"favicon,omitempty" json:"favicon,omitempty"`
   642  	Image   *UnfurlImageDisplay `codec:"image,omitempty" json:"image,omitempty"`
   643  	Video   *UnfurlImageDisplay `codec:"video,omitempty" json:"video,omitempty"`
   644  }
   645  
   646  func (o UnfurlGiphyDisplay) DeepCopy() UnfurlGiphyDisplay {
   647  	return UnfurlGiphyDisplay{
   648  		Favicon: (func(x *UnfurlImageDisplay) *UnfurlImageDisplay {
   649  			if x == nil {
   650  				return nil
   651  			}
   652  			tmp := (*x).DeepCopy()
   653  			return &tmp
   654  		})(o.Favicon),
   655  		Image: (func(x *UnfurlImageDisplay) *UnfurlImageDisplay {
   656  			if x == nil {
   657  				return nil
   658  			}
   659  			tmp := (*x).DeepCopy()
   660  			return &tmp
   661  		})(o.Image),
   662  		Video: (func(x *UnfurlImageDisplay) *UnfurlImageDisplay {
   663  			if x == nil {
   664  				return nil
   665  			}
   666  			tmp := (*x).DeepCopy()
   667  			return &tmp
   668  		})(o.Video),
   669  	}
   670  }
   671  
   672  type UnfurlDisplay struct {
   673  	UnfurlType__ UnfurlType            `codec:"unfurlType" json:"unfurlType"`
   674  	Generic__    *UnfurlGenericDisplay `codec:"generic,omitempty" json:"generic,omitempty"`
   675  	Youtube__    *UnfurlYoutubeDisplay `codec:"youtube,omitempty" json:"youtube,omitempty"`
   676  	Giphy__      *UnfurlGiphyDisplay   `codec:"giphy,omitempty" json:"giphy,omitempty"`
   677  }
   678  
   679  func (o *UnfurlDisplay) UnfurlType() (ret UnfurlType, err error) {
   680  	switch o.UnfurlType__ {
   681  	case UnfurlType_GENERIC:
   682  		if o.Generic__ == nil {
   683  			err = errors.New("unexpected nil value for Generic__")
   684  			return ret, err
   685  		}
   686  	case UnfurlType_YOUTUBE:
   687  		if o.Youtube__ == nil {
   688  			err = errors.New("unexpected nil value for Youtube__")
   689  			return ret, err
   690  		}
   691  	case UnfurlType_GIPHY:
   692  		if o.Giphy__ == nil {
   693  			err = errors.New("unexpected nil value for Giphy__")
   694  			return ret, err
   695  		}
   696  	}
   697  	return o.UnfurlType__, nil
   698  }
   699  
   700  func (o UnfurlDisplay) Generic() (res UnfurlGenericDisplay) {
   701  	if o.UnfurlType__ != UnfurlType_GENERIC {
   702  		panic("wrong case accessed")
   703  	}
   704  	if o.Generic__ == nil {
   705  		return
   706  	}
   707  	return *o.Generic__
   708  }
   709  
   710  func (o UnfurlDisplay) Youtube() (res UnfurlYoutubeDisplay) {
   711  	if o.UnfurlType__ != UnfurlType_YOUTUBE {
   712  		panic("wrong case accessed")
   713  	}
   714  	if o.Youtube__ == nil {
   715  		return
   716  	}
   717  	return *o.Youtube__
   718  }
   719  
   720  func (o UnfurlDisplay) Giphy() (res UnfurlGiphyDisplay) {
   721  	if o.UnfurlType__ != UnfurlType_GIPHY {
   722  		panic("wrong case accessed")
   723  	}
   724  	if o.Giphy__ == nil {
   725  		return
   726  	}
   727  	return *o.Giphy__
   728  }
   729  
   730  func NewUnfurlDisplayWithGeneric(v UnfurlGenericDisplay) UnfurlDisplay {
   731  	return UnfurlDisplay{
   732  		UnfurlType__: UnfurlType_GENERIC,
   733  		Generic__:    &v,
   734  	}
   735  }
   736  
   737  func NewUnfurlDisplayWithYoutube(v UnfurlYoutubeDisplay) UnfurlDisplay {
   738  	return UnfurlDisplay{
   739  		UnfurlType__: UnfurlType_YOUTUBE,
   740  		Youtube__:    &v,
   741  	}
   742  }
   743  
   744  func NewUnfurlDisplayWithGiphy(v UnfurlGiphyDisplay) UnfurlDisplay {
   745  	return UnfurlDisplay{
   746  		UnfurlType__: UnfurlType_GIPHY,
   747  		Giphy__:      &v,
   748  	}
   749  }
   750  
   751  func (o UnfurlDisplay) DeepCopy() UnfurlDisplay {
   752  	return UnfurlDisplay{
   753  		UnfurlType__: o.UnfurlType__.DeepCopy(),
   754  		Generic__: (func(x *UnfurlGenericDisplay) *UnfurlGenericDisplay {
   755  			if x == nil {
   756  				return nil
   757  			}
   758  			tmp := (*x).DeepCopy()
   759  			return &tmp
   760  		})(o.Generic__),
   761  		Youtube__: (func(x *UnfurlYoutubeDisplay) *UnfurlYoutubeDisplay {
   762  			if x == nil {
   763  				return nil
   764  			}
   765  			tmp := (*x).DeepCopy()
   766  			return &tmp
   767  		})(o.Youtube__),
   768  		Giphy__: (func(x *UnfurlGiphyDisplay) *UnfurlGiphyDisplay {
   769  			if x == nil {
   770  				return nil
   771  			}
   772  			tmp := (*x).DeepCopy()
   773  			return &tmp
   774  		})(o.Giphy__),
   775  	}
   776  }
   777  
   778  type UnfurlMode int
   779  
   780  const (
   781  	UnfurlMode_ALWAYS      UnfurlMode = 0
   782  	UnfurlMode_NEVER       UnfurlMode = 1
   783  	UnfurlMode_WHITELISTED UnfurlMode = 2
   784  )
   785  
   786  func (o UnfurlMode) DeepCopy() UnfurlMode { return o }
   787  
   788  var UnfurlModeMap = map[string]UnfurlMode{
   789  	"ALWAYS":      0,
   790  	"NEVER":       1,
   791  	"WHITELISTED": 2,
   792  }
   793  
   794  var UnfurlModeRevMap = map[UnfurlMode]string{
   795  	0: "ALWAYS",
   796  	1: "NEVER",
   797  	2: "WHITELISTED",
   798  }
   799  
   800  func (e UnfurlMode) String() string {
   801  	if v, ok := UnfurlModeRevMap[e]; ok {
   802  		return v
   803  	}
   804  	return fmt.Sprintf("%v", int(e))
   805  }
   806  
   807  type UnfurlSettings struct {
   808  	Mode      UnfurlMode      `codec:"mode" json:"mode"`
   809  	Whitelist map[string]bool `codec:"whitelist" json:"whitelist"`
   810  }
   811  
   812  func (o UnfurlSettings) DeepCopy() UnfurlSettings {
   813  	return UnfurlSettings{
   814  		Mode: o.Mode.DeepCopy(),
   815  		Whitelist: (func(x map[string]bool) map[string]bool {
   816  			if x == nil {
   817  				return nil
   818  			}
   819  			ret := make(map[string]bool, len(x))
   820  			for k, v := range x {
   821  				kCopy := k
   822  				vCopy := v
   823  				ret[kCopy] = vCopy
   824  			}
   825  			return ret
   826  		})(o.Whitelist),
   827  	}
   828  }
   829  
   830  type UnfurlSettingsDisplay struct {
   831  	Mode      UnfurlMode `codec:"mode" json:"mode"`
   832  	Whitelist []string   `codec:"whitelist" json:"whitelist"`
   833  }
   834  
   835  func (o UnfurlSettingsDisplay) DeepCopy() UnfurlSettingsDisplay {
   836  	return UnfurlSettingsDisplay{
   837  		Mode: o.Mode.DeepCopy(),
   838  		Whitelist: (func(x []string) []string {
   839  			if x == nil {
   840  				return nil
   841  			}
   842  			ret := make([]string, len(x))
   843  			for i, v := range x {
   844  				vCopy := v
   845  				ret[i] = vCopy
   846  			}
   847  			return ret
   848  		})(o.Whitelist),
   849  	}
   850  }
   851  
   852  type UnfurlInterface interface {
   853  }
   854  
   855  func UnfurlProtocol(i UnfurlInterface) rpc.Protocol {
   856  	return rpc.Protocol{
   857  		Name:    "chat.1.unfurl",
   858  		Methods: map[string]rpc.ServeHandlerDescription{},
   859  	}
   860  }
   861  
   862  type UnfurlClient struct {
   863  	Cli rpc.GenericClient
   864  }