Documentation ¶
Index ¶
- type Clan
- type ClanMembership
- type ClanMembershipPlayer
- type ClanMemberships
- type ClanNameAndPublicID
- type ClanPayload
- type ClanPlayerInfo
- type ClanSummary
- type ClansRelationships
- type ClansSummary
- type Khan
- func (k *Khan) CreateClan(ctx context.Context, clan *ClanPayload) (string, error)
- func (k *Khan) CreatePlayer(ctx context.Context, publicID, name string, metadata interface{}) (string, error)
- func (k *Khan) RetrieveClan(ctx context.Context, clanID string) (*Clan, error)
- func (k *Khan) RetrieveClanSummary(ctx context.Context, clanID string) (*ClanSummary, error)
- func (k *Khan) RetrieveClansSummary(ctx context.Context, clanIDs []string) ([]*ClanSummary, error)
- func (k *Khan) RetrievePlayer(ctx context.Context, publicID string) (*Player, error)
- func (k *Khan) UpdateClan(ctx context.Context, clan *ClanPayload) error
- func (k *Khan) UpdatePlayer(ctx context.Context, publicID, name string, metadata interface{}) error
- type KhanInterface
- type Player
- type PlayerMembership
- type RequestError
- type ShortPlayerInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clan ¶
type Clan struct { PublicID string `json:"publicID"` Name string `json:"name"` Metadata interface{} `json:"metadata"` AllowApplication bool `json:"allowApplication"` AutoJoin bool `json:"autoJoin"` MembershipCount int `json:"membershipCount"` Owner *ShortPlayerInfo `json:"owner"` Roster []*ClanMembership `json:"roster"` Memberships *ClanMemberships `json:"memberships"` }
Clan is the structure returned by the retrieve clan route
type ClanMembership ¶
type ClanMembership struct { Level int `json:"level"` Message string `json:"message"` Player *ClanMembershipPlayer `json:"player"` }
ClanMembership represents the membership structure inside a clan response
type ClanMembershipPlayer ¶
type ClanMembershipPlayer struct { Approver *ShortPlayerInfo `json:"approver"` Metadata interface{} `json:"metadata"` Name string `json:"name"` PublicID string `json:"publicID"` }
ClanMembershipPlayer represents the player structure inside the clan membership
type ClanMemberships ¶
type ClanMemberships struct { PendingApplications []*ClanMembership `json:"pendingApplications"` PendingInvites []*ClanMembership `json:"pendingInvites"` Denied []*ClanMembership `json:"denied"` Banned []*ClanMembership `json:"banned"` }
ClanMemberships is the memberships structure inside a clan response
type ClanNameAndPublicID ¶
ClanNameAndPublicID has name and publicID
type ClanPayload ¶
type ClanPayload struct { PublicID string `json:"publicID,omitempty"` Name string `json:"name"` OwnerPublicID string `json:"ownerPublicID"` Metadata interface{} `json:"metadata"` AllowApplication bool `json:"allowApplication"` AutoJoin bool `json:"autoJoin"` }
ClanPayload maps the payload for the Create Clan route and Update Clan route
type ClanPlayerInfo ¶
type ClanPlayerInfo struct { Metadata interface{} `json:"metadata"` Name string `json:"name"` PublicID string `json:"publicID"` MembershipCount int `json:"membershipCount"` }
ClanPlayerInfo defines the clan info returned on the membership
type ClanSummary ¶
type ClanSummary struct { PublicID string `json:"publicID"` Name string `json:"name"` Metadata interface{} `json:"metadata"` AllowApplication bool `json:"allowApplication"` AutoJoin bool `json:"autoJoin"` MembershipCount int `json:"membershipCount"` }
ClanSummary defines the clan summary
type ClansRelationships ¶
type ClansRelationships struct { Owned []*ClanNameAndPublicID `json:"owned"` Approved []*ClanNameAndPublicID `json:"approved"` Banned []*ClanNameAndPublicID `json:"banned"` Denied []*ClanNameAndPublicID `json:"denied"` PendingApplications []*ClanNameAndPublicID `json:"pendingApplications"` PendingInvites []*ClanNameAndPublicID `json:"pendingInvites"` }
ClansRelationships defines the struct returned inside player
type ClansSummary ¶
type ClansSummary struct {
Clans []*ClanSummary `json:"clans"`
}
ClansSummary defines the clans summary
type Khan ¶
Khan is a struct that represents a khan API application
func (*Khan) CreateClan ¶
CreateClan calls the create clan route from khan
func (*Khan) CreatePlayer ¶
func (k *Khan) CreatePlayer(ctx context.Context, publicID, name string, metadata interface{}) (string, error)
CreatePlayer calls Khan to create a new player
func (*Khan) RetrieveClan ¶
RetrieveClan calls the route to retrieve clan from khan
func (*Khan) RetrieveClanSummary ¶
RetrieveClanSummary calls the route to retrieve clan summary from khan
func (*Khan) RetrieveClansSummary ¶
RetrieveClansSummary calls the route to retrieve clans summary from khan
func (*Khan) RetrievePlayer ¶
RetrievePlayer calls the retrieve player route from khan
func (*Khan) UpdateClan ¶
func (k *Khan) UpdateClan(ctx context.Context, clan *ClanPayload) error
UpdateClan calls the update clan route from khan
type KhanInterface ¶
type KhanInterface interface { CreatePlayer(context.Context, string, string, interface{}) (string, error) UpdatePlayer(context.Context, string, string, interface{}) error RetrievePlayer(context.Context, string) (*Player, error) CreateClan(context.Context, *ClanPayload) (string, error) UpdateClan(context.Context, *ClanPayload) error RetrieveClan(context.Context, string) (*Clan, error) RetrieveClanSummary(context.Context, string) (*ClanSummary, error) RetrieveClansSummary(context.Context, []string) ([]*ClanSummary, error) }
KhanInterface defines the interface for the khan client
func NewKhan ¶
func NewKhan(config *viper.Viper) KhanInterface
NewKhan returns a new khan API application
type Player ¶
type Player struct { PublicID string `json:"publicID"` Name string `json:"name"` Metadata interface{} `json:"metadata"` Clans *ClansRelationships `json:"clans,omitempty"` Memberships []*PlayerMembership `json:"memberships,omitempty"` }
Player defines the struct returned by the khan API for retrieve player
type PlayerMembership ¶
type PlayerMembership struct { Approved bool `json:"approved"` Banned bool `json:"banned"` Denied bool `json:"denied"` Clan *ClanPlayerInfo `json:"clan"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` DeletedAt int64 `json:"deletedAt"` ApprovedAt int64 `json:"approvedAt"` DeniedAt int64 `json:"deniedAt"` Level string `json:"level"` Message string `json:"message"` Requestor *ShortPlayerInfo `json:"requestor"` Approver *ShortPlayerInfo `json:"approver"` Denier *ShortPlayerInfo `json:"denier"` }
PlayerMembership defines the membership returned by retrieve player
type RequestError ¶
type RequestError struct {
// contains filtered or unexported fields
}
RequestError contains code and body of a request that failed
func (*RequestError) Error ¶
func (r *RequestError) Error() string
func (*RequestError) Status ¶
func (r *RequestError) Status() int
Status returns the status code of the error
type ShortPlayerInfo ¶
type ShortPlayerInfo struct { PublicID string `json:"publicID"` Name string `json:"name"` Metadata interface{} `json:"metadata"` }
ShortPlayerInfo defines the data returned for these elements on each membership