github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/protocol/keybase1/notify_badges.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/notify_badges.avdl
     3  
     4  package keybase1
     5  
     6  import (
     7  	gregor1 "github.com/keybase/client/go/protocol/gregor1"
     8  	"github.com/keybase/go-framed-msgpack-rpc/rpc"
     9  	context "golang.org/x/net/context"
    10  	"time"
    11  )
    12  
    13  type ChatConversationID []byte
    14  
    15  func (o ChatConversationID) DeepCopy() ChatConversationID {
    16  	return (func(x []byte) []byte {
    17  		if x == nil {
    18  			return nil
    19  		}
    20  		return append([]byte{}, x...)
    21  	})(o)
    22  }
    23  
    24  type TeamMemberOutReset struct {
    25  	TeamID   TeamID        `codec:"teamID" json:"teamID"`
    26  	Teamname string        `codec:"teamname" json:"teamname"`
    27  	Username string        `codec:"username" json:"username"`
    28  	Uid      UID           `codec:"uid" json:"uid"`
    29  	Id       gregor1.MsgID `codec:"id" json:"id"`
    30  }
    31  
    32  func (o TeamMemberOutReset) DeepCopy() TeamMemberOutReset {
    33  	return TeamMemberOutReset{
    34  		TeamID:   o.TeamID.DeepCopy(),
    35  		Teamname: o.Teamname,
    36  		Username: o.Username,
    37  		Uid:      o.Uid.DeepCopy(),
    38  		Id:       o.Id.DeepCopy(),
    39  	}
    40  }
    41  
    42  type DeletedTeamInfo struct {
    43  	TeamName  string        `codec:"teamName" json:"teamName"`
    44  	DeletedBy string        `codec:"deletedBy" json:"deletedBy"`
    45  	Id        gregor1.MsgID `codec:"id" json:"id"`
    46  }
    47  
    48  func (o DeletedTeamInfo) DeepCopy() DeletedTeamInfo {
    49  	return DeletedTeamInfo{
    50  		TeamName:  o.TeamName,
    51  		DeletedBy: o.DeletedBy,
    52  		Id:        o.Id.DeepCopy(),
    53  	}
    54  }
    55  
    56  type WalletAccountInfo struct {
    57  	AccountID string `codec:"accountID" json:"accountID"`
    58  	NumUnread int    `codec:"numUnread" json:"numUnread"`
    59  }
    60  
    61  func (o WalletAccountInfo) DeepCopy() WalletAccountInfo {
    62  	return WalletAccountInfo{
    63  		AccountID: o.AccountID,
    64  		NumUnread: o.NumUnread,
    65  	}
    66  }
    67  
    68  type ResetState struct {
    69  	EndTime Time `codec:"endTime" json:"end_time"`
    70  	Active  bool `codec:"active" json:"active"`
    71  }
    72  
    73  func (o ResetState) DeepCopy() ResetState {
    74  	return ResetState{
    75  		EndTime: o.EndTime.DeepCopy(),
    76  		Active:  o.Active,
    77  	}
    78  }
    79  
    80  type WotUpdate struct {
    81  	Voucher string        `codec:"voucher" json:"voucher"`
    82  	Vouchee string        `codec:"vouchee" json:"vouchee"`
    83  	Status  WotStatusType `codec:"status" json:"status"`
    84  }
    85  
    86  func (o WotUpdate) DeepCopy() WotUpdate {
    87  	return WotUpdate{
    88  		Voucher: o.Voucher,
    89  		Vouchee: o.Vouchee,
    90  		Status:  o.Status.DeepCopy(),
    91  	}
    92  }
    93  
    94  type BadgeState struct {
    95  	NewTlfs                   int                     `codec:"newTlfs" json:"newTlfs"`
    96  	RekeysNeeded              int                     `codec:"rekeysNeeded" json:"rekeysNeeded"`
    97  	NewFollowers              int                     `codec:"newFollowers" json:"newFollowers"`
    98  	InboxVers                 int                     `codec:"inboxVers" json:"inboxVers"`
    99  	HomeTodoItems             int                     `codec:"homeTodoItems" json:"homeTodoItems"`
   100  	UnverifiedEmails          int                     `codec:"unverifiedEmails" json:"unverifiedEmails"`
   101  	UnverifiedPhones          int                     `codec:"unverifiedPhones" json:"unverifiedPhones"`
   102  	SmallTeamBadgeCount       int                     `codec:"smallTeamBadgeCount" json:"smallTeamBadgeCount"`
   103  	BigTeamBadgeCount         int                     `codec:"bigTeamBadgeCount" json:"bigTeamBadgeCount"`
   104  	NewTeamAccessRequestCount int                     `codec:"newTeamAccessRequestCount" json:"newTeamAccessRequestCount"`
   105  	NewDevices                []DeviceID              `codec:"newDevices" json:"newDevices"`
   106  	RevokedDevices            []DeviceID              `codec:"revokedDevices" json:"revokedDevices"`
   107  	Conversations             []BadgeConversationInfo `codec:"conversations" json:"conversations"`
   108  	NewGitRepoGlobalUniqueIDs []string                `codec:"newGitRepoGlobalUniqueIDs" json:"newGitRepoGlobalUniqueIDs"`
   109  	NewTeams                  []TeamID                `codec:"newTeams" json:"newTeams"`
   110  	DeletedTeams              []DeletedTeamInfo       `codec:"deletedTeams" json:"deletedTeams"`
   111  	TeamsWithResetUsers       []TeamMemberOutReset    `codec:"teamsWithResetUsers" json:"teamsWithResetUsers"`
   112  	UnreadWalletAccounts      []WalletAccountInfo     `codec:"unreadWalletAccounts" json:"unreadWalletAccounts"`
   113  	WotUpdates                map[string]WotUpdate    `codec:"wotUpdates" json:"wotUpdates"`
   114  	ResetState                ResetState              `codec:"resetState" json:"resetState"`
   115  }
   116  
   117  func (o BadgeState) DeepCopy() BadgeState {
   118  	return BadgeState{
   119  		NewTlfs:                   o.NewTlfs,
   120  		RekeysNeeded:              o.RekeysNeeded,
   121  		NewFollowers:              o.NewFollowers,
   122  		InboxVers:                 o.InboxVers,
   123  		HomeTodoItems:             o.HomeTodoItems,
   124  		UnverifiedEmails:          o.UnverifiedEmails,
   125  		UnverifiedPhones:          o.UnverifiedPhones,
   126  		SmallTeamBadgeCount:       o.SmallTeamBadgeCount,
   127  		BigTeamBadgeCount:         o.BigTeamBadgeCount,
   128  		NewTeamAccessRequestCount: o.NewTeamAccessRequestCount,
   129  		NewDevices: (func(x []DeviceID) []DeviceID {
   130  			if x == nil {
   131  				return nil
   132  			}
   133  			ret := make([]DeviceID, len(x))
   134  			for i, v := range x {
   135  				vCopy := v.DeepCopy()
   136  				ret[i] = vCopy
   137  			}
   138  			return ret
   139  		})(o.NewDevices),
   140  		RevokedDevices: (func(x []DeviceID) []DeviceID {
   141  			if x == nil {
   142  				return nil
   143  			}
   144  			ret := make([]DeviceID, len(x))
   145  			for i, v := range x {
   146  				vCopy := v.DeepCopy()
   147  				ret[i] = vCopy
   148  			}
   149  			return ret
   150  		})(o.RevokedDevices),
   151  		Conversations: (func(x []BadgeConversationInfo) []BadgeConversationInfo {
   152  			if x == nil {
   153  				return nil
   154  			}
   155  			ret := make([]BadgeConversationInfo, len(x))
   156  			for i, v := range x {
   157  				vCopy := v.DeepCopy()
   158  				ret[i] = vCopy
   159  			}
   160  			return ret
   161  		})(o.Conversations),
   162  		NewGitRepoGlobalUniqueIDs: (func(x []string) []string {
   163  			if x == nil {
   164  				return nil
   165  			}
   166  			ret := make([]string, len(x))
   167  			for i, v := range x {
   168  				vCopy := v
   169  				ret[i] = vCopy
   170  			}
   171  			return ret
   172  		})(o.NewGitRepoGlobalUniqueIDs),
   173  		NewTeams: (func(x []TeamID) []TeamID {
   174  			if x == nil {
   175  				return nil
   176  			}
   177  			ret := make([]TeamID, len(x))
   178  			for i, v := range x {
   179  				vCopy := v.DeepCopy()
   180  				ret[i] = vCopy
   181  			}
   182  			return ret
   183  		})(o.NewTeams),
   184  		DeletedTeams: (func(x []DeletedTeamInfo) []DeletedTeamInfo {
   185  			if x == nil {
   186  				return nil
   187  			}
   188  			ret := make([]DeletedTeamInfo, len(x))
   189  			for i, v := range x {
   190  				vCopy := v.DeepCopy()
   191  				ret[i] = vCopy
   192  			}
   193  			return ret
   194  		})(o.DeletedTeams),
   195  		TeamsWithResetUsers: (func(x []TeamMemberOutReset) []TeamMemberOutReset {
   196  			if x == nil {
   197  				return nil
   198  			}
   199  			ret := make([]TeamMemberOutReset, len(x))
   200  			for i, v := range x {
   201  				vCopy := v.DeepCopy()
   202  				ret[i] = vCopy
   203  			}
   204  			return ret
   205  		})(o.TeamsWithResetUsers),
   206  		UnreadWalletAccounts: (func(x []WalletAccountInfo) []WalletAccountInfo {
   207  			if x == nil {
   208  				return nil
   209  			}
   210  			ret := make([]WalletAccountInfo, len(x))
   211  			for i, v := range x {
   212  				vCopy := v.DeepCopy()
   213  				ret[i] = vCopy
   214  			}
   215  			return ret
   216  		})(o.UnreadWalletAccounts),
   217  		WotUpdates: (func(x map[string]WotUpdate) map[string]WotUpdate {
   218  			if x == nil {
   219  				return nil
   220  			}
   221  			ret := make(map[string]WotUpdate, len(x))
   222  			for k, v := range x {
   223  				kCopy := k
   224  				vCopy := v.DeepCopy()
   225  				ret[kCopy] = vCopy
   226  			}
   227  			return ret
   228  		})(o.WotUpdates),
   229  		ResetState: o.ResetState.DeepCopy(),
   230  	}
   231  }
   232  
   233  type BadgeConversationInfo struct {
   234  	ConvID         ChatConversationID `codec:"convID" json:"convID"`
   235  	BadgeCount     int                `codec:"badgeCount" json:"badgeCount"`
   236  	UnreadMessages int                `codec:"unreadMessages" json:"unreadMessages"`
   237  }
   238  
   239  func (o BadgeConversationInfo) DeepCopy() BadgeConversationInfo {
   240  	return BadgeConversationInfo{
   241  		ConvID:         o.ConvID.DeepCopy(),
   242  		BadgeCount:     o.BadgeCount,
   243  		UnreadMessages: o.UnreadMessages,
   244  	}
   245  }
   246  
   247  type BadgeStateArg struct {
   248  	BadgeState BadgeState `codec:"badgeState" json:"badgeState"`
   249  }
   250  
   251  type NotifyBadgesInterface interface {
   252  	BadgeState(context.Context, BadgeState) error
   253  }
   254  
   255  func NotifyBadgesProtocol(i NotifyBadgesInterface) rpc.Protocol {
   256  	return rpc.Protocol{
   257  		Name: "keybase.1.NotifyBadges",
   258  		Methods: map[string]rpc.ServeHandlerDescription{
   259  			"badgeState": {
   260  				MakeArg: func() interface{} {
   261  					var ret [1]BadgeStateArg
   262  					return &ret
   263  				},
   264  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   265  					typedArgs, ok := args.(*[1]BadgeStateArg)
   266  					if !ok {
   267  						err = rpc.NewTypeError((*[1]BadgeStateArg)(nil), args)
   268  						return
   269  					}
   270  					err = i.BadgeState(ctx, typedArgs[0].BadgeState)
   271  					return
   272  				},
   273  			},
   274  		},
   275  	}
   276  }
   277  
   278  type NotifyBadgesClient struct {
   279  	Cli rpc.GenericClient
   280  }
   281  
   282  func (c NotifyBadgesClient) BadgeState(ctx context.Context, badgeState BadgeState) (err error) {
   283  	__arg := BadgeStateArg{BadgeState: badgeState}
   284  	err = c.Cli.Notify(ctx, "keybase.1.NotifyBadges.badgeState", []interface{}{__arg}, 0*time.Millisecond)
   285  	return
   286  }