Create UserHandle type

This commit is contained in:
Alessio 2021-06-16 13:14:56 -07:00
parent 90e5fdb8b1
commit 74ef2e4193

View File

@ -6,11 +6,12 @@ import (
) )
type UserID string type UserID string
type UserHandle string
type User struct { type User struct {
ID UserID ID UserID
DisplayName string DisplayName string
Handle string Handle UserHandle
Bio string Bio string
FollowingCount int FollowingCount int
FollowersCount int FollowersCount int
@ -32,7 +33,7 @@ func (u User) String() string {
func ParseSingleUser(apiUser APIUser) (ret User, err error) { func ParseSingleUser(apiUser APIUser) (ret User, err error) {
ret.ID = UserID(apiUser.IDStr) ret.ID = UserID(apiUser.IDStr)
ret.DisplayName = apiUser.Name ret.DisplayName = apiUser.Name
ret.Handle = apiUser.ScreenName ret.Handle = UserHandle(apiUser.ScreenName)
ret.Bio = apiUser.Description ret.Bio = apiUser.Description
ret.FollowingCount = apiUser.FriendsCount ret.FollowingCount = apiUser.FriendsCount
ret.FollowersCount = apiUser.FollowersCount ret.FollowersCount = apiUser.FollowersCount