output formatting
parent
5c04f59ff5
commit
bd963f87af
@ -0,0 +1,21 @@
|
||||
package steam
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type ClientError struct {
|
||||
msg string
|
||||
parent error
|
||||
}
|
||||
|
||||
func (c ClientError) Error() string {
|
||||
if c.parent == nil {
|
||||
return fmt.Sprintf("steam client error: %s", c.msg)
|
||||
}
|
||||
return fmt.Sprintf("steam client error: %s: %v", c.msg, c.parent)
|
||||
}
|
||||
|
||||
func errorf(parent error, msg string, args ...interface{}) error {
|
||||
return ClientError{msg: fmt.Sprintf(msg, args...), parent: parent}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package steam
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type PlayerSummary struct {
|
||||
SteamId uint64 `json:"steamid,string"`
|
||||
Visibility int `json:"communityvisibilitystate"`
|
||||
ProfileState int `json:"profilestate"`
|
||||
PersonaName string `json:"personaname"`
|
||||
LastLogOff int64 `json:"lastlogoff"`
|
||||
ProfileUrl string `json:"profileurl"`
|
||||
Avatar string `json:"avatar"`
|
||||
AvatarMedium string `json:"avatarmedium"`
|
||||
AvatarFull string `json:"avatarfull"`
|
||||
PersonaState int `json:"personastate"`
|
||||
LocCountryCode string `json:"loccountrycode"`
|
||||
LocStateCode string `json:"locstatecode"`
|
||||
LocCityID int `json:"loccityid"`
|
||||
}
|
||||
|
||||
func (p PlayerSummary) Oneline() string {
|
||||
return fmt.Sprintf("%d\t%s\t%s", p.SteamId, p.PersonaName, p.ProfileUrl)
|
||||
}
|
||||
|
||||
type PlayerFriend struct {
|
||||
SteamId uint64 `json:"steamid,string"`
|
||||
Relationship string `json:"relationship"`
|
||||
FriendSince int `json:"friend_since"`
|
||||
}
|
||||
|
||||
func (p PlayerFriend) Oneline() string {
|
||||
return fmt.Sprintf("%d\t%s\t%d", p.SteamId, p.Relationship, p.FriendSince)
|
||||
}
|
Loading…
Reference in New Issue