github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/keybase1/home.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/home.avdl 3 4 package keybase1 5 6 import ( 7 "errors" 8 "fmt" 9 "github.com/keybase/go-framed-msgpack-rpc/rpc" 10 context "golang.org/x/net/context" 11 "time" 12 ) 13 14 type HomeScreenItemID string 15 16 func (o HomeScreenItemID) DeepCopy() HomeScreenItemID { 17 return o 18 } 19 20 type HomeScreenItemType int 21 22 const ( 23 HomeScreenItemType_TODO HomeScreenItemType = 1 24 HomeScreenItemType_PEOPLE HomeScreenItemType = 2 25 HomeScreenItemType_ANNOUNCEMENT HomeScreenItemType = 3 26 ) 27 28 func (o HomeScreenItemType) DeepCopy() HomeScreenItemType { return o } 29 30 var HomeScreenItemTypeMap = map[string]HomeScreenItemType{ 31 "TODO": 1, 32 "PEOPLE": 2, 33 "ANNOUNCEMENT": 3, 34 } 35 36 var HomeScreenItemTypeRevMap = map[HomeScreenItemType]string{ 37 1: "TODO", 38 2: "PEOPLE", 39 3: "ANNOUNCEMENT", 40 } 41 42 func (e HomeScreenItemType) String() string { 43 if v, ok := HomeScreenItemTypeRevMap[e]; ok { 44 return v 45 } 46 return fmt.Sprintf("%v", int(e)) 47 } 48 49 type HomeScreenItemData struct { 50 T__ HomeScreenItemType `codec:"t" json:"t"` 51 Todo__ *HomeScreenTodo `codec:"todo,omitempty" json:"todo,omitempty"` 52 People__ *HomeScreenPeopleNotification `codec:"people,omitempty" json:"people,omitempty"` 53 Announcement__ *HomeScreenAnnouncement `codec:"announcement,omitempty" json:"announcement,omitempty"` 54 } 55 56 func (o *HomeScreenItemData) T() (ret HomeScreenItemType, err error) { 57 switch o.T__ { 58 case HomeScreenItemType_TODO: 59 if o.Todo__ == nil { 60 err = errors.New("unexpected nil value for Todo__") 61 return ret, err 62 } 63 case HomeScreenItemType_PEOPLE: 64 if o.People__ == nil { 65 err = errors.New("unexpected nil value for People__") 66 return ret, err 67 } 68 case HomeScreenItemType_ANNOUNCEMENT: 69 if o.Announcement__ == nil { 70 err = errors.New("unexpected nil value for Announcement__") 71 return ret, err 72 } 73 } 74 return o.T__, nil 75 } 76 77 func (o HomeScreenItemData) Todo() (res HomeScreenTodo) { 78 if o.T__ != HomeScreenItemType_TODO { 79 panic("wrong case accessed") 80 } 81 if o.Todo__ == nil { 82 return 83 } 84 return *o.Todo__ 85 } 86 87 func (o HomeScreenItemData) People() (res HomeScreenPeopleNotification) { 88 if o.T__ != HomeScreenItemType_PEOPLE { 89 panic("wrong case accessed") 90 } 91 if o.People__ == nil { 92 return 93 } 94 return *o.People__ 95 } 96 97 func (o HomeScreenItemData) Announcement() (res HomeScreenAnnouncement) { 98 if o.T__ != HomeScreenItemType_ANNOUNCEMENT { 99 panic("wrong case accessed") 100 } 101 if o.Announcement__ == nil { 102 return 103 } 104 return *o.Announcement__ 105 } 106 107 func NewHomeScreenItemDataWithTodo(v HomeScreenTodo) HomeScreenItemData { 108 return HomeScreenItemData{ 109 T__: HomeScreenItemType_TODO, 110 Todo__: &v, 111 } 112 } 113 114 func NewHomeScreenItemDataWithPeople(v HomeScreenPeopleNotification) HomeScreenItemData { 115 return HomeScreenItemData{ 116 T__: HomeScreenItemType_PEOPLE, 117 People__: &v, 118 } 119 } 120 121 func NewHomeScreenItemDataWithAnnouncement(v HomeScreenAnnouncement) HomeScreenItemData { 122 return HomeScreenItemData{ 123 T__: HomeScreenItemType_ANNOUNCEMENT, 124 Announcement__: &v, 125 } 126 } 127 128 func NewHomeScreenItemDataDefault(t HomeScreenItemType) HomeScreenItemData { 129 return HomeScreenItemData{ 130 T__: t, 131 } 132 } 133 134 func (o HomeScreenItemData) DeepCopy() HomeScreenItemData { 135 return HomeScreenItemData{ 136 T__: o.T__.DeepCopy(), 137 Todo__: (func(x *HomeScreenTodo) *HomeScreenTodo { 138 if x == nil { 139 return nil 140 } 141 tmp := (*x).DeepCopy() 142 return &tmp 143 })(o.Todo__), 144 People__: (func(x *HomeScreenPeopleNotification) *HomeScreenPeopleNotification { 145 if x == nil { 146 return nil 147 } 148 tmp := (*x).DeepCopy() 149 return &tmp 150 })(o.People__), 151 Announcement__: (func(x *HomeScreenAnnouncement) *HomeScreenAnnouncement { 152 if x == nil { 153 return nil 154 } 155 tmp := (*x).DeepCopy() 156 return &tmp 157 })(o.Announcement__), 158 } 159 } 160 161 type HomeScreenItemDataExt struct { 162 T__ HomeScreenItemType `codec:"t" json:"t"` 163 Todo__ *HomeScreenTodoExt `codec:"todo,omitempty" json:"todo,omitempty"` 164 } 165 166 func (o *HomeScreenItemDataExt) T() (ret HomeScreenItemType, err error) { 167 switch o.T__ { 168 case HomeScreenItemType_TODO: 169 if o.Todo__ == nil { 170 err = errors.New("unexpected nil value for Todo__") 171 return ret, err 172 } 173 } 174 return o.T__, nil 175 } 176 177 func (o HomeScreenItemDataExt) Todo() (res HomeScreenTodoExt) { 178 if o.T__ != HomeScreenItemType_TODO { 179 panic("wrong case accessed") 180 } 181 if o.Todo__ == nil { 182 return 183 } 184 return *o.Todo__ 185 } 186 187 func NewHomeScreenItemDataExtWithTodo(v HomeScreenTodoExt) HomeScreenItemDataExt { 188 return HomeScreenItemDataExt{ 189 T__: HomeScreenItemType_TODO, 190 Todo__: &v, 191 } 192 } 193 194 func NewHomeScreenItemDataExtDefault(t HomeScreenItemType) HomeScreenItemDataExt { 195 return HomeScreenItemDataExt{ 196 T__: t, 197 } 198 } 199 200 func (o HomeScreenItemDataExt) DeepCopy() HomeScreenItemDataExt { 201 return HomeScreenItemDataExt{ 202 T__: o.T__.DeepCopy(), 203 Todo__: (func(x *HomeScreenTodoExt) *HomeScreenTodoExt { 204 if x == nil { 205 return nil 206 } 207 tmp := (*x).DeepCopy() 208 return &tmp 209 })(o.Todo__), 210 } 211 } 212 213 type AppLinkType int 214 215 const ( 216 AppLinkType_NONE AppLinkType = 0 217 AppLinkType_PEOPLE AppLinkType = 1 218 AppLinkType_CHAT AppLinkType = 2 219 AppLinkType_FILES AppLinkType = 3 220 AppLinkType_WALLET AppLinkType = 4 221 AppLinkType_GIT AppLinkType = 5 222 AppLinkType_DEVICES AppLinkType = 6 223 AppLinkType_SETTINGS AppLinkType = 7 224 AppLinkType_TEAMS AppLinkType = 8 225 ) 226 227 func (o AppLinkType) DeepCopy() AppLinkType { return o } 228 229 var AppLinkTypeMap = map[string]AppLinkType{ 230 "NONE": 0, 231 "PEOPLE": 1, 232 "CHAT": 2, 233 "FILES": 3, 234 "WALLET": 4, 235 "GIT": 5, 236 "DEVICES": 6, 237 "SETTINGS": 7, 238 "TEAMS": 8, 239 } 240 241 var AppLinkTypeRevMap = map[AppLinkType]string{ 242 0: "NONE", 243 1: "PEOPLE", 244 2: "CHAT", 245 3: "FILES", 246 4: "WALLET", 247 5: "GIT", 248 6: "DEVICES", 249 7: "SETTINGS", 250 8: "TEAMS", 251 } 252 253 func (e AppLinkType) String() string { 254 if v, ok := AppLinkTypeRevMap[e]; ok { 255 return v 256 } 257 return fmt.Sprintf("%v", int(e)) 258 } 259 260 type HomeScreenAnnouncementID int 261 262 func (o HomeScreenAnnouncementID) DeepCopy() HomeScreenAnnouncementID { 263 return o 264 } 265 266 type HomeScreenAnnouncementVersion int 267 268 func (o HomeScreenAnnouncementVersion) DeepCopy() HomeScreenAnnouncementVersion { 269 return o 270 } 271 272 type HomeScreenAnnouncement struct { 273 Id HomeScreenAnnouncementID `codec:"id" json:"id"` 274 Version HomeScreenAnnouncementVersion `codec:"version" json:"version"` 275 AppLink AppLinkType `codec:"appLink" json:"appLink"` 276 ConfirmLabel string `codec:"confirmLabel" json:"confirmLabel"` 277 Dismissable bool `codec:"dismissable" json:"dismissable"` 278 IconUrl string `codec:"iconUrl" json:"iconUrl"` 279 Text string `codec:"text" json:"text"` 280 Url string `codec:"url" json:"url"` 281 } 282 283 func (o HomeScreenAnnouncement) DeepCopy() HomeScreenAnnouncement { 284 return HomeScreenAnnouncement{ 285 Id: o.Id.DeepCopy(), 286 Version: o.Version.DeepCopy(), 287 AppLink: o.AppLink.DeepCopy(), 288 ConfirmLabel: o.ConfirmLabel, 289 Dismissable: o.Dismissable, 290 IconUrl: o.IconUrl, 291 Text: o.Text, 292 Url: o.Url, 293 } 294 } 295 296 type HomeScreenTodoType int 297 298 const ( 299 HomeScreenTodoType_NONE HomeScreenTodoType = 0 300 HomeScreenTodoType_BIO HomeScreenTodoType = 1 301 HomeScreenTodoType_PROOF HomeScreenTodoType = 2 302 HomeScreenTodoType_DEVICE HomeScreenTodoType = 3 303 HomeScreenTodoType_FOLLOW HomeScreenTodoType = 4 304 HomeScreenTodoType_PAPERKEY HomeScreenTodoType = 6 305 HomeScreenTodoType_TEAM HomeScreenTodoType = 7 306 HomeScreenTodoType_FOLDER HomeScreenTodoType = 8 307 HomeScreenTodoType_GIT_REPO HomeScreenTodoType = 9 308 HomeScreenTodoType_TEAM_SHOWCASE HomeScreenTodoType = 10 309 HomeScreenTodoType_AVATAR_TEAM HomeScreenTodoType = 12 310 HomeScreenTodoType_ADD_PHONE_NUMBER HomeScreenTodoType = 18 311 HomeScreenTodoType_VERIFY_ALL_PHONE_NUMBER HomeScreenTodoType = 19 312 HomeScreenTodoType_VERIFY_ALL_EMAIL HomeScreenTodoType = 20 313 HomeScreenTodoType_LEGACY_EMAIL_VISIBILITY HomeScreenTodoType = 21 314 HomeScreenTodoType_ADD_EMAIL HomeScreenTodoType = 22 315 HomeScreenTodoType_AVATAR_USER HomeScreenTodoType = 23 316 HomeScreenTodoType_CHAT HomeScreenTodoType = 24 317 HomeScreenTodoType_ANNONCEMENT_PLACEHOLDER HomeScreenTodoType = 10000 318 ) 319 320 func (o HomeScreenTodoType) DeepCopy() HomeScreenTodoType { return o } 321 322 var HomeScreenTodoTypeMap = map[string]HomeScreenTodoType{ 323 "NONE": 0, 324 "BIO": 1, 325 "PROOF": 2, 326 "DEVICE": 3, 327 "FOLLOW": 4, 328 "PAPERKEY": 6, 329 "TEAM": 7, 330 "FOLDER": 8, 331 "GIT_REPO": 9, 332 "TEAM_SHOWCASE": 10, 333 "AVATAR_TEAM": 12, 334 "ADD_PHONE_NUMBER": 18, 335 "VERIFY_ALL_PHONE_NUMBER": 19, 336 "VERIFY_ALL_EMAIL": 20, 337 "LEGACY_EMAIL_VISIBILITY": 21, 338 "ADD_EMAIL": 22, 339 "AVATAR_USER": 23, 340 "CHAT": 24, 341 "ANNONCEMENT_PLACEHOLDER": 10000, 342 } 343 344 var HomeScreenTodoTypeRevMap = map[HomeScreenTodoType]string{ 345 0: "NONE", 346 1: "BIO", 347 2: "PROOF", 348 3: "DEVICE", 349 4: "FOLLOW", 350 6: "PAPERKEY", 351 7: "TEAM", 352 8: "FOLDER", 353 9: "GIT_REPO", 354 10: "TEAM_SHOWCASE", 355 12: "AVATAR_TEAM", 356 18: "ADD_PHONE_NUMBER", 357 19: "VERIFY_ALL_PHONE_NUMBER", 358 20: "VERIFY_ALL_EMAIL", 359 21: "LEGACY_EMAIL_VISIBILITY", 360 22: "ADD_EMAIL", 361 23: "AVATAR_USER", 362 24: "CHAT", 363 10000: "ANNONCEMENT_PLACEHOLDER", 364 } 365 366 func (e HomeScreenTodoType) String() string { 367 if v, ok := HomeScreenTodoTypeRevMap[e]; ok { 368 return v 369 } 370 return fmt.Sprintf("%v", int(e)) 371 } 372 373 // Most of TODO items do not carry additional data, but some do. e.g. TODO 374 // item to tell user to verify their email address will carry that email 375 // address. 376 // 377 // All new TODO data bundle types should be records rather than single fields 378 // to support adding new data to existing TODOs. If a legacy TODO (such as 379 // VERIFY_ALL_EMAIL) uses a single field, the "TodoExt" field should be used to 380 // introduce more data to the payload. 381 type HomeScreenTodo struct { 382 T__ HomeScreenTodoType `codec:"t" json:"t"` 383 VerifyAllPhoneNumber__ *PhoneNumber `codec:"verifyAllPhoneNumber,omitempty" json:"verifyAllPhoneNumber,omitempty"` 384 VerifyAllEmail__ *EmailAddress `codec:"verifyAllEmail,omitempty" json:"verifyAllEmail,omitempty"` 385 LegacyEmailVisibility__ *EmailAddress `codec:"legacyEmailVisibility,omitempty" json:"legacyEmailVisibility,omitempty"` 386 } 387 388 func (o *HomeScreenTodo) T() (ret HomeScreenTodoType, err error) { 389 switch o.T__ { 390 case HomeScreenTodoType_VERIFY_ALL_PHONE_NUMBER: 391 if o.VerifyAllPhoneNumber__ == nil { 392 err = errors.New("unexpected nil value for VerifyAllPhoneNumber__") 393 return ret, err 394 } 395 case HomeScreenTodoType_VERIFY_ALL_EMAIL: 396 if o.VerifyAllEmail__ == nil { 397 err = errors.New("unexpected nil value for VerifyAllEmail__") 398 return ret, err 399 } 400 case HomeScreenTodoType_LEGACY_EMAIL_VISIBILITY: 401 if o.LegacyEmailVisibility__ == nil { 402 err = errors.New("unexpected nil value for LegacyEmailVisibility__") 403 return ret, err 404 } 405 } 406 return o.T__, nil 407 } 408 409 func (o HomeScreenTodo) VerifyAllPhoneNumber() (res PhoneNumber) { 410 if o.T__ != HomeScreenTodoType_VERIFY_ALL_PHONE_NUMBER { 411 panic("wrong case accessed") 412 } 413 if o.VerifyAllPhoneNumber__ == nil { 414 return 415 } 416 return *o.VerifyAllPhoneNumber__ 417 } 418 419 func (o HomeScreenTodo) VerifyAllEmail() (res EmailAddress) { 420 if o.T__ != HomeScreenTodoType_VERIFY_ALL_EMAIL { 421 panic("wrong case accessed") 422 } 423 if o.VerifyAllEmail__ == nil { 424 return 425 } 426 return *o.VerifyAllEmail__ 427 } 428 429 func (o HomeScreenTodo) LegacyEmailVisibility() (res EmailAddress) { 430 if o.T__ != HomeScreenTodoType_LEGACY_EMAIL_VISIBILITY { 431 panic("wrong case accessed") 432 } 433 if o.LegacyEmailVisibility__ == nil { 434 return 435 } 436 return *o.LegacyEmailVisibility__ 437 } 438 439 func NewHomeScreenTodoWithVerifyAllPhoneNumber(v PhoneNumber) HomeScreenTodo { 440 return HomeScreenTodo{ 441 T__: HomeScreenTodoType_VERIFY_ALL_PHONE_NUMBER, 442 VerifyAllPhoneNumber__: &v, 443 } 444 } 445 446 func NewHomeScreenTodoWithVerifyAllEmail(v EmailAddress) HomeScreenTodo { 447 return HomeScreenTodo{ 448 T__: HomeScreenTodoType_VERIFY_ALL_EMAIL, 449 VerifyAllEmail__: &v, 450 } 451 } 452 453 func NewHomeScreenTodoWithLegacyEmailVisibility(v EmailAddress) HomeScreenTodo { 454 return HomeScreenTodo{ 455 T__: HomeScreenTodoType_LEGACY_EMAIL_VISIBILITY, 456 LegacyEmailVisibility__: &v, 457 } 458 } 459 460 func NewHomeScreenTodoDefault(t HomeScreenTodoType) HomeScreenTodo { 461 return HomeScreenTodo{ 462 T__: t, 463 } 464 } 465 466 func (o HomeScreenTodo) DeepCopy() HomeScreenTodo { 467 return HomeScreenTodo{ 468 T__: o.T__.DeepCopy(), 469 VerifyAllPhoneNumber__: (func(x *PhoneNumber) *PhoneNumber { 470 if x == nil { 471 return nil 472 } 473 tmp := (*x).DeepCopy() 474 return &tmp 475 })(o.VerifyAllPhoneNumber__), 476 VerifyAllEmail__: (func(x *EmailAddress) *EmailAddress { 477 if x == nil { 478 return nil 479 } 480 tmp := (*x).DeepCopy() 481 return &tmp 482 })(o.VerifyAllEmail__), 483 LegacyEmailVisibility__: (func(x *EmailAddress) *EmailAddress { 484 if x == nil { 485 return nil 486 } 487 tmp := (*x).DeepCopy() 488 return &tmp 489 })(o.LegacyEmailVisibility__), 490 } 491 } 492 493 type HomeScreenTodoExt struct { 494 T__ HomeScreenTodoType `codec:"t" json:"t"` 495 VerifyAllEmail__ *VerifyAllEmailTodoExt `codec:"verifyAllEmail,omitempty" json:"verifyAllEmail,omitempty"` 496 } 497 498 func (o *HomeScreenTodoExt) T() (ret HomeScreenTodoType, err error) { 499 switch o.T__ { 500 case HomeScreenTodoType_VERIFY_ALL_EMAIL: 501 if o.VerifyAllEmail__ == nil { 502 err = errors.New("unexpected nil value for VerifyAllEmail__") 503 return ret, err 504 } 505 } 506 return o.T__, nil 507 } 508 509 func (o HomeScreenTodoExt) VerifyAllEmail() (res VerifyAllEmailTodoExt) { 510 if o.T__ != HomeScreenTodoType_VERIFY_ALL_EMAIL { 511 panic("wrong case accessed") 512 } 513 if o.VerifyAllEmail__ == nil { 514 return 515 } 516 return *o.VerifyAllEmail__ 517 } 518 519 func NewHomeScreenTodoExtWithVerifyAllEmail(v VerifyAllEmailTodoExt) HomeScreenTodoExt { 520 return HomeScreenTodoExt{ 521 T__: HomeScreenTodoType_VERIFY_ALL_EMAIL, 522 VerifyAllEmail__: &v, 523 } 524 } 525 526 func NewHomeScreenTodoExtDefault(t HomeScreenTodoType) HomeScreenTodoExt { 527 return HomeScreenTodoExt{ 528 T__: t, 529 } 530 } 531 532 func (o HomeScreenTodoExt) DeepCopy() HomeScreenTodoExt { 533 return HomeScreenTodoExt{ 534 T__: o.T__.DeepCopy(), 535 VerifyAllEmail__: (func(x *VerifyAllEmailTodoExt) *VerifyAllEmailTodoExt { 536 if x == nil { 537 return nil 538 } 539 tmp := (*x).DeepCopy() 540 return &tmp 541 })(o.VerifyAllEmail__), 542 } 543 } 544 545 type VerifyAllEmailTodoExt struct { 546 LastVerifyEmailDate UnixTime `codec:"lastVerifyEmailDate" json:"lastVerifyEmailDate"` 547 } 548 549 func (o VerifyAllEmailTodoExt) DeepCopy() VerifyAllEmailTodoExt { 550 return VerifyAllEmailTodoExt{ 551 LastVerifyEmailDate: o.LastVerifyEmailDate.DeepCopy(), 552 } 553 } 554 555 type HomeScreenPeopleNotificationType int 556 557 const ( 558 HomeScreenPeopleNotificationType_FOLLOWED HomeScreenPeopleNotificationType = 1 559 HomeScreenPeopleNotificationType_FOLLOWED_MULTI HomeScreenPeopleNotificationType = 2 560 HomeScreenPeopleNotificationType_CONTACT HomeScreenPeopleNotificationType = 3 561 HomeScreenPeopleNotificationType_CONTACT_MULTI HomeScreenPeopleNotificationType = 4 562 ) 563 564 func (o HomeScreenPeopleNotificationType) DeepCopy() HomeScreenPeopleNotificationType { return o } 565 566 var HomeScreenPeopleNotificationTypeMap = map[string]HomeScreenPeopleNotificationType{ 567 "FOLLOWED": 1, 568 "FOLLOWED_MULTI": 2, 569 "CONTACT": 3, 570 "CONTACT_MULTI": 4, 571 } 572 573 var HomeScreenPeopleNotificationTypeRevMap = map[HomeScreenPeopleNotificationType]string{ 574 1: "FOLLOWED", 575 2: "FOLLOWED_MULTI", 576 3: "CONTACT", 577 4: "CONTACT_MULTI", 578 } 579 580 func (e HomeScreenPeopleNotificationType) String() string { 581 if v, ok := HomeScreenPeopleNotificationTypeRevMap[e]; ok { 582 return v 583 } 584 return fmt.Sprintf("%v", int(e)) 585 } 586 587 type HomeScreenPeopleNotificationFollowed struct { 588 FollowTime Time `codec:"followTime" json:"followTime"` 589 FollowedBack bool `codec:"followedBack" json:"followedBack"` 590 User UserSummary `codec:"user" json:"user"` 591 } 592 593 func (o HomeScreenPeopleNotificationFollowed) DeepCopy() HomeScreenPeopleNotificationFollowed { 594 return HomeScreenPeopleNotificationFollowed{ 595 FollowTime: o.FollowTime.DeepCopy(), 596 FollowedBack: o.FollowedBack, 597 User: o.User.DeepCopy(), 598 } 599 } 600 601 type HomeScreenPeopleNotificationFollowedMulti struct { 602 Followers []HomeScreenPeopleNotificationFollowed `codec:"followers" json:"followers"` 603 NumOthers int `codec:"numOthers" json:"numOthers"` 604 } 605 606 func (o HomeScreenPeopleNotificationFollowedMulti) DeepCopy() HomeScreenPeopleNotificationFollowedMulti { 607 return HomeScreenPeopleNotificationFollowedMulti{ 608 Followers: (func(x []HomeScreenPeopleNotificationFollowed) []HomeScreenPeopleNotificationFollowed { 609 if x == nil { 610 return nil 611 } 612 ret := make([]HomeScreenPeopleNotificationFollowed, len(x)) 613 for i, v := range x { 614 vCopy := v.DeepCopy() 615 ret[i] = vCopy 616 } 617 return ret 618 })(o.Followers), 619 NumOthers: o.NumOthers, 620 } 621 } 622 623 type HomeScreenPeopleNotificationContact struct { 624 ResolveTime Time `codec:"resolveTime" json:"resolveTime"` 625 Username string `codec:"username" json:"username"` 626 Description string `codec:"description" json:"description"` 627 ResolvedContactBlob string `codec:"resolvedContactBlob" json:"resolvedContactBlob"` 628 } 629 630 func (o HomeScreenPeopleNotificationContact) DeepCopy() HomeScreenPeopleNotificationContact { 631 return HomeScreenPeopleNotificationContact{ 632 ResolveTime: o.ResolveTime.DeepCopy(), 633 Username: o.Username, 634 Description: o.Description, 635 ResolvedContactBlob: o.ResolvedContactBlob, 636 } 637 } 638 639 type HomeScreenPeopleNotificationContactMulti struct { 640 Contacts []HomeScreenPeopleNotificationContact `codec:"contacts" json:"contacts"` 641 NumOthers int `codec:"numOthers" json:"numOthers"` 642 } 643 644 func (o HomeScreenPeopleNotificationContactMulti) DeepCopy() HomeScreenPeopleNotificationContactMulti { 645 return HomeScreenPeopleNotificationContactMulti{ 646 Contacts: (func(x []HomeScreenPeopleNotificationContact) []HomeScreenPeopleNotificationContact { 647 if x == nil { 648 return nil 649 } 650 ret := make([]HomeScreenPeopleNotificationContact, len(x)) 651 for i, v := range x { 652 vCopy := v.DeepCopy() 653 ret[i] = vCopy 654 } 655 return ret 656 })(o.Contacts), 657 NumOthers: o.NumOthers, 658 } 659 } 660 661 type HomeScreenPeopleNotification struct { 662 T__ HomeScreenPeopleNotificationType `codec:"t" json:"t"` 663 Followed__ *HomeScreenPeopleNotificationFollowed `codec:"followed,omitempty" json:"followed,omitempty"` 664 FollowedMulti__ *HomeScreenPeopleNotificationFollowedMulti `codec:"followedMulti,omitempty" json:"followedMulti,omitempty"` 665 Contact__ *HomeScreenPeopleNotificationContact `codec:"contact,omitempty" json:"contact,omitempty"` 666 ContactMulti__ *HomeScreenPeopleNotificationContactMulti `codec:"contactMulti,omitempty" json:"contactMulti,omitempty"` 667 } 668 669 func (o *HomeScreenPeopleNotification) T() (ret HomeScreenPeopleNotificationType, err error) { 670 switch o.T__ { 671 case HomeScreenPeopleNotificationType_FOLLOWED: 672 if o.Followed__ == nil { 673 err = errors.New("unexpected nil value for Followed__") 674 return ret, err 675 } 676 case HomeScreenPeopleNotificationType_FOLLOWED_MULTI: 677 if o.FollowedMulti__ == nil { 678 err = errors.New("unexpected nil value for FollowedMulti__") 679 return ret, err 680 } 681 case HomeScreenPeopleNotificationType_CONTACT: 682 if o.Contact__ == nil { 683 err = errors.New("unexpected nil value for Contact__") 684 return ret, err 685 } 686 case HomeScreenPeopleNotificationType_CONTACT_MULTI: 687 if o.ContactMulti__ == nil { 688 err = errors.New("unexpected nil value for ContactMulti__") 689 return ret, err 690 } 691 } 692 return o.T__, nil 693 } 694 695 func (o HomeScreenPeopleNotification) Followed() (res HomeScreenPeopleNotificationFollowed) { 696 if o.T__ != HomeScreenPeopleNotificationType_FOLLOWED { 697 panic("wrong case accessed") 698 } 699 if o.Followed__ == nil { 700 return 701 } 702 return *o.Followed__ 703 } 704 705 func (o HomeScreenPeopleNotification) FollowedMulti() (res HomeScreenPeopleNotificationFollowedMulti) { 706 if o.T__ != HomeScreenPeopleNotificationType_FOLLOWED_MULTI { 707 panic("wrong case accessed") 708 } 709 if o.FollowedMulti__ == nil { 710 return 711 } 712 return *o.FollowedMulti__ 713 } 714 715 func (o HomeScreenPeopleNotification) Contact() (res HomeScreenPeopleNotificationContact) { 716 if o.T__ != HomeScreenPeopleNotificationType_CONTACT { 717 panic("wrong case accessed") 718 } 719 if o.Contact__ == nil { 720 return 721 } 722 return *o.Contact__ 723 } 724 725 func (o HomeScreenPeopleNotification) ContactMulti() (res HomeScreenPeopleNotificationContactMulti) { 726 if o.T__ != HomeScreenPeopleNotificationType_CONTACT_MULTI { 727 panic("wrong case accessed") 728 } 729 if o.ContactMulti__ == nil { 730 return 731 } 732 return *o.ContactMulti__ 733 } 734 735 func NewHomeScreenPeopleNotificationWithFollowed(v HomeScreenPeopleNotificationFollowed) HomeScreenPeopleNotification { 736 return HomeScreenPeopleNotification{ 737 T__: HomeScreenPeopleNotificationType_FOLLOWED, 738 Followed__: &v, 739 } 740 } 741 742 func NewHomeScreenPeopleNotificationWithFollowedMulti(v HomeScreenPeopleNotificationFollowedMulti) HomeScreenPeopleNotification { 743 return HomeScreenPeopleNotification{ 744 T__: HomeScreenPeopleNotificationType_FOLLOWED_MULTI, 745 FollowedMulti__: &v, 746 } 747 } 748 749 func NewHomeScreenPeopleNotificationWithContact(v HomeScreenPeopleNotificationContact) HomeScreenPeopleNotification { 750 return HomeScreenPeopleNotification{ 751 T__: HomeScreenPeopleNotificationType_CONTACT, 752 Contact__: &v, 753 } 754 } 755 756 func NewHomeScreenPeopleNotificationWithContactMulti(v HomeScreenPeopleNotificationContactMulti) HomeScreenPeopleNotification { 757 return HomeScreenPeopleNotification{ 758 T__: HomeScreenPeopleNotificationType_CONTACT_MULTI, 759 ContactMulti__: &v, 760 } 761 } 762 763 func (o HomeScreenPeopleNotification) DeepCopy() HomeScreenPeopleNotification { 764 return HomeScreenPeopleNotification{ 765 T__: o.T__.DeepCopy(), 766 Followed__: (func(x *HomeScreenPeopleNotificationFollowed) *HomeScreenPeopleNotificationFollowed { 767 if x == nil { 768 return nil 769 } 770 tmp := (*x).DeepCopy() 771 return &tmp 772 })(o.Followed__), 773 FollowedMulti__: (func(x *HomeScreenPeopleNotificationFollowedMulti) *HomeScreenPeopleNotificationFollowedMulti { 774 if x == nil { 775 return nil 776 } 777 tmp := (*x).DeepCopy() 778 return &tmp 779 })(o.FollowedMulti__), 780 Contact__: (func(x *HomeScreenPeopleNotificationContact) *HomeScreenPeopleNotificationContact { 781 if x == nil { 782 return nil 783 } 784 tmp := (*x).DeepCopy() 785 return &tmp 786 })(o.Contact__), 787 ContactMulti__: (func(x *HomeScreenPeopleNotificationContactMulti) *HomeScreenPeopleNotificationContactMulti { 788 if x == nil { 789 return nil 790 } 791 tmp := (*x).DeepCopy() 792 return &tmp 793 })(o.ContactMulti__), 794 } 795 } 796 797 type HomeScreenItem struct { 798 Badged bool `codec:"badged" json:"badged"` 799 Data HomeScreenItemData `codec:"data" json:"data"` 800 DataExt HomeScreenItemDataExt `codec:"dataExt" json:"dataExt"` 801 } 802 803 func (o HomeScreenItem) DeepCopy() HomeScreenItem { 804 return HomeScreenItem{ 805 Badged: o.Badged, 806 Data: o.Data.DeepCopy(), 807 DataExt: o.DataExt.DeepCopy(), 808 } 809 } 810 811 type Pics struct { 812 Square40 string `codec:"square40" json:"square_40"` 813 Square200 string `codec:"square200" json:"square_200"` 814 Square360 string `codec:"square360" json:"square_360"` 815 } 816 817 func (o Pics) DeepCopy() Pics { 818 return Pics{ 819 Square40: o.Square40, 820 Square200: o.Square200, 821 Square360: o.Square360, 822 } 823 } 824 825 type HomeUserSummary struct { 826 Uid UID `codec:"uid" json:"uid"` 827 Username string `codec:"username" json:"username"` 828 Bio string `codec:"bio" json:"bio"` 829 FullName string `codec:"fullName" json:"full_name"` 830 Pics *Pics `codec:"pics,omitempty" json:"pics,omitempty"` 831 } 832 833 func (o HomeUserSummary) DeepCopy() HomeUserSummary { 834 return HomeUserSummary{ 835 Uid: o.Uid.DeepCopy(), 836 Username: o.Username, 837 Bio: o.Bio, 838 FullName: o.FullName, 839 Pics: (func(x *Pics) *Pics { 840 if x == nil { 841 return nil 842 } 843 tmp := (*x).DeepCopy() 844 return &tmp 845 })(o.Pics), 846 } 847 } 848 849 type HomeScreen struct { 850 LastViewed Time `codec:"lastViewed" json:"lastViewed"` 851 Version int `codec:"version" json:"version"` 852 Visits int `codec:"visits" json:"visits"` 853 Items []HomeScreenItem `codec:"items" json:"items"` 854 FollowSuggestions []HomeUserSummary `codec:"followSuggestions" json:"followSuggestions"` 855 AnnouncementsVersion int `codec:"announcementsVersion" json:"announcementsVersion"` 856 } 857 858 func (o HomeScreen) DeepCopy() HomeScreen { 859 return HomeScreen{ 860 LastViewed: o.LastViewed.DeepCopy(), 861 Version: o.Version, 862 Visits: o.Visits, 863 Items: (func(x []HomeScreenItem) []HomeScreenItem { 864 if x == nil { 865 return nil 866 } 867 ret := make([]HomeScreenItem, len(x)) 868 for i, v := range x { 869 vCopy := v.DeepCopy() 870 ret[i] = vCopy 871 } 872 return ret 873 })(o.Items), 874 FollowSuggestions: (func(x []HomeUserSummary) []HomeUserSummary { 875 if x == nil { 876 return nil 877 } 878 ret := make([]HomeUserSummary, len(x)) 879 for i, v := range x { 880 vCopy := v.DeepCopy() 881 ret[i] = vCopy 882 } 883 return ret 884 })(o.FollowSuggestions), 885 AnnouncementsVersion: o.AnnouncementsVersion, 886 } 887 } 888 889 type HomeGetScreenArg struct { 890 MarkViewed bool `codec:"markViewed" json:"markViewed"` 891 NumFollowSuggestionsWanted int `codec:"numFollowSuggestionsWanted" json:"numFollowSuggestionsWanted"` 892 } 893 894 type HomeSkipTodoTypeArg struct { 895 T HomeScreenTodoType `codec:"t" json:"t"` 896 } 897 898 type HomeDismissAnnouncementArg struct { 899 I HomeScreenAnnouncementID `codec:"i" json:"i"` 900 } 901 902 type HomeActionTakenArg struct { 903 } 904 905 type HomeMarkViewedArg struct { 906 } 907 908 type HomeInterface interface { 909 // HomeGetScreen returns the home screen for the current user. 910 // If `markViewed` is specified, the server will mark this version of the 911 // home screen "viewed", potentially updating some badges. 912 // `numFollowSuggestionsWanted` controls the number of people to return. 913 // If not specified, it will default to `0`, so no people. If `-1` is specified, 914 // the default number will be returned (10). Otherwise, the caller should 915 // specify. 916 HomeGetScreen(context.Context, HomeGetScreenArg) (HomeScreen, error) 917 HomeSkipTodoType(context.Context, HomeScreenTodoType) error 918 HomeDismissAnnouncement(context.Context, HomeScreenAnnouncementID) error 919 HomeActionTaken(context.Context) error 920 HomeMarkViewed(context.Context) error 921 } 922 923 func HomeProtocol(i HomeInterface) rpc.Protocol { 924 return rpc.Protocol{ 925 Name: "keybase.1.home", 926 Methods: map[string]rpc.ServeHandlerDescription{ 927 "homeGetScreen": { 928 MakeArg: func() interface{} { 929 var ret [1]HomeGetScreenArg 930 return &ret 931 }, 932 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 933 typedArgs, ok := args.(*[1]HomeGetScreenArg) 934 if !ok { 935 err = rpc.NewTypeError((*[1]HomeGetScreenArg)(nil), args) 936 return 937 } 938 ret, err = i.HomeGetScreen(ctx, typedArgs[0]) 939 return 940 }, 941 }, 942 "homeSkipTodoType": { 943 MakeArg: func() interface{} { 944 var ret [1]HomeSkipTodoTypeArg 945 return &ret 946 }, 947 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 948 typedArgs, ok := args.(*[1]HomeSkipTodoTypeArg) 949 if !ok { 950 err = rpc.NewTypeError((*[1]HomeSkipTodoTypeArg)(nil), args) 951 return 952 } 953 err = i.HomeSkipTodoType(ctx, typedArgs[0].T) 954 return 955 }, 956 }, 957 "homeDismissAnnouncement": { 958 MakeArg: func() interface{} { 959 var ret [1]HomeDismissAnnouncementArg 960 return &ret 961 }, 962 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 963 typedArgs, ok := args.(*[1]HomeDismissAnnouncementArg) 964 if !ok { 965 err = rpc.NewTypeError((*[1]HomeDismissAnnouncementArg)(nil), args) 966 return 967 } 968 err = i.HomeDismissAnnouncement(ctx, typedArgs[0].I) 969 return 970 }, 971 }, 972 "homeActionTaken": { 973 MakeArg: func() interface{} { 974 var ret [1]HomeActionTakenArg 975 return &ret 976 }, 977 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 978 err = i.HomeActionTaken(ctx) 979 return 980 }, 981 }, 982 "homeMarkViewed": { 983 MakeArg: func() interface{} { 984 var ret [1]HomeMarkViewedArg 985 return &ret 986 }, 987 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 988 err = i.HomeMarkViewed(ctx) 989 return 990 }, 991 }, 992 }, 993 } 994 } 995 996 type HomeClient struct { 997 Cli rpc.GenericClient 998 } 999 1000 // HomeGetScreen returns the home screen for the current user. 1001 // If `markViewed` is specified, the server will mark this version of the 1002 // home screen "viewed", potentially updating some badges. 1003 // `numFollowSuggestionsWanted` controls the number of people to return. 1004 // If not specified, it will default to `0`, so no people. If `-1` is specified, 1005 // the default number will be returned (10). Otherwise, the caller should 1006 // specify. 1007 func (c HomeClient) HomeGetScreen(ctx context.Context, __arg HomeGetScreenArg) (res HomeScreen, err error) { 1008 err = c.Cli.Call(ctx, "keybase.1.home.homeGetScreen", []interface{}{__arg}, &res, 0*time.Millisecond) 1009 return 1010 } 1011 1012 func (c HomeClient) HomeSkipTodoType(ctx context.Context, t HomeScreenTodoType) (err error) { 1013 __arg := HomeSkipTodoTypeArg{T: t} 1014 err = c.Cli.Call(ctx, "keybase.1.home.homeSkipTodoType", []interface{}{__arg}, nil, 0*time.Millisecond) 1015 return 1016 } 1017 1018 func (c HomeClient) HomeDismissAnnouncement(ctx context.Context, i HomeScreenAnnouncementID) (err error) { 1019 __arg := HomeDismissAnnouncementArg{I: i} 1020 err = c.Cli.Call(ctx, "keybase.1.home.homeDismissAnnouncement", []interface{}{__arg}, nil, 0*time.Millisecond) 1021 return 1022 } 1023 1024 func (c HomeClient) HomeActionTaken(ctx context.Context) (err error) { 1025 err = c.Cli.Call(ctx, "keybase.1.home.homeActionTaken", []interface{}{HomeActionTakenArg{}}, nil, 0*time.Millisecond) 1026 return 1027 } 1028 1029 func (c HomeClient) HomeMarkViewed(ctx context.Context) (err error) { 1030 err = c.Cli.Call(ctx, "keybase.1.home.homeMarkViewed", []interface{}{HomeMarkViewedArg{}}, nil, 0*time.Millisecond) 1031 return 1032 }