Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- type ExtendedDescription
- type ExtendedDescriptionParser
- type Member
- type MemberEntityID
- type MembersResponse
- type Organization
- func (o *Organization) ExtractCreated() (time.Time, error)
- func (o *Organization) ExtractID() (string, error)
- func (o *Organization) ExtractLogoURL() (string, error)
- func (o *Organization) ExtractName() (string, error)
- func (o *Organization) GetExtendedDescription(ctx context.Context) (*ExtendedDescription, error)
- func (o *Organization) GetMembers(ctx context.Context) (*MembersResponse, error)
- type OrganizationsResponse
Constants ¶
const ( // SortByName sorts the organizations by their name SortByName = iota // SortByCreatedAt sorts the organizations by their creation date SortByCreatedAt = iota // SortByPlayerCount sorts the organizations by their player count SortByPlayerCount = iota )
const ( // OrderDescending orders the organizations descending by their sort filter OrderDescending = 0 // OrderAscending orders the organizations ascending by their sort filter OrderAscending = 1 )
Variables ¶
var ErrInternalServerError = errors.New("internal server error")
ErrInternalServerError is thrown if the Dual Universe servers return an internal server error
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { GetOrganizations(ctx context.Context, start, length, sort, order int) (*OrganizationsResponse, error) GetOrganizationMembers(ctx context.Context, id string) (*MembersResponse, error) GetOrganizationExtendedDescription(ctx context.Context, id string) (*ExtendedDescription, error) }
Client provides methods to interact with the Dual Universe API
type ExtendedDescription ¶
type ExtendedDescription struct { ShortDescription string `json:"short_description"` LongDescription string `json:"long_description"` }
ExtendedDescription represents information shown on the organization's overview page
type ExtendedDescriptionParser ¶
ExtendedDescriptionParser is used to parse the organization's overview page for information provided there
func (*ExtendedDescriptionParser) Parse ¶
func (o *ExtendedDescriptionParser) Parse() (*ExtendedDescription, error)
Parse parses all overview information provided on the Dual Universe page
type Member ¶
type Member struct { EntityID *MemberEntityID `json:"entityId"` DisplayName string `json:"displayName"` Rank string `json:"rank"` Online bool `json:"online"` JoinedAtUnix int64 `json:"joinedAt"` Avatar string `json:"avatar"` JoinedAtTimestamp string `json:"joinedAt_yymmjj"` }
Member represents an organization member
func (*Member) ExtractAvatarURL ¶
ExtractAvatarURL extracts the avatar URL from the logo html tag
func (*Member) ExtractJoinedAt ¶
ExtractJoinedAt extracts the joined at date
func (*Member) ExtractRank ¶
ExtractRank extracts the rank from the rank html tag
type MemberEntityID ¶
type MemberEntityID struct { PlayerID int `json:"playerId"` OrganizationID int `json:"organizationId"` }
MemberEntityID represents an organization-id-player-id-pair
type MembersResponse ¶
type MembersResponse struct {
Data []*Member `json:"data"`
}
MembersResponse represents the members response of an organisation
type Organization ¶
type Organization struct { Logo string `json:"logo"` Name string `json:"name"` Description string `json:"description"` MemberCount int `json:"member_count"` LegateCount int `json:"legate_count"` Created string `json:"created"` Button string `json:"button"` Client Client `json:"-"` }
Organization represents a Dual Universe organization
func (*Organization) ExtractCreated ¶
func (o *Organization) ExtractCreated() (time.Time, error)
ExtractCreated extracts the created timestamp
func (*Organization) ExtractID ¶
func (o *Organization) ExtractID() (string, error)
ExtractID extracts the identifier of the organization the html tag
func (*Organization) ExtractLogoURL ¶
func (o *Organization) ExtractLogoURL() (string, error)
ExtractLogoURL extracts the logo url from the html tag
func (*Organization) ExtractName ¶
func (o *Organization) ExtractName() (string, error)
ExtractName extracts the name from the html tag
func (*Organization) GetExtendedDescription ¶
func (o *Organization) GetExtendedDescription(ctx context.Context) (*ExtendedDescription, error)
GetExtendedDescription is an alias of Client.GetOrganizationExtendedDescription for this organization
func (*Organization) GetMembers ¶
func (o *Organization) GetMembers(ctx context.Context) (*MembersResponse, error)
GetMembers is an alias of Client.GetOrganizationMembers for this organization
type OrganizationsResponse ¶
type OrganizationsResponse struct { Draw int `json:"draw"` RecordsTotal int `json:"recordsTotal"` RecordsFiltered int `json:"recordsFiltered"` Data []*Organization `json:"data"` }
OrganizationsResponse is the organizations response