Documentation ¶
Index ¶
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 AuthenticatedClient ¶ added in v1.0.1
type AuthenticatedClient interface { Client User(ctx context.Context, id uint) (*User, error) Close() error Wait() }
AuthenticatedClient extends the Client interface with methods to fetch information that requires authentication
func NewAuthenticatedClient ¶ added in v1.0.1
func NewAuthenticatedClient(httpClient *http.Client, initSessionID string) AuthenticatedClient
NewAuthenticatedClient creates a new instance of an authenticated client.
type Client ¶ added in v1.0.1
type Client interface { // Organizations returns all Dual Universe organizations Organizations(ctx context.Context, start, length, sort, order int) (*OrganizationsResp, error) // OrganizationMembers returns all members of a given organization OrganizationMembers(ctx context.Context, id string, start, length int) (*OrganizationMembersResp, error) // OrganizationExtraDescription returns the descriptions // provided on the organizations page OrganizationExtraDescription(ctx context.Context, id string) (*OrganizationDescription, error) }
Client provides methods to fetch information from the Dual Universe Community page without authentication
type Organization ¶ added in v1.0.1
type Organization struct { ID int `json:"id"` OwnerID int `json:"ownerId"` Active bool `json:"active"` Posts []interface{} `json:"posts"` Description string `json:"description"` Keywords string `json:"keywords"` Language string `json:"language"` Logo *OrganizationLogo `json:"logo"` Manifest string `json:"manifest"` Name string `json:"name"` IsRecruiting bool `json:"recruiting"` Tag string `json:"tag"` CreatedAt string `json:"createdAt"` MemberCount int `json:"memberCount"` // contains filtered or unexported fields }
func (*Organization) ExtractCreated ¶ added in v1.0.1
func (o *Organization) ExtractCreated() (time.Time, error)
ExtractCreated extracts the created timestamp
func (*Organization) ExtractID ¶ added in v1.0.1
func (o *Organization) ExtractID() (string, error)
ExtractID extracts the identifier of the organization the html tag
func (*Organization) ExtractKeywords ¶ added in v1.0.1
func (o *Organization) ExtractKeywords() []string
ExtractKeywords extracts the keywords of the organization
func (*Organization) ExtractLogoURL ¶ added in v1.0.1
func (o *Organization) ExtractLogoURL() (string, error)
ExtractLogoURL extracts the logo url from the html tag
func (*Organization) ExtractName ¶ added in v1.0.1
func (o *Organization) ExtractName() (string, error)
ExtractName extracts the name from the html tag
type OrganizationDescription ¶ added in v1.0.1
type OrganizationDescription struct { ShortDescription string `json:"short_description"` LongDescription string `json:"long_description"` }
OrganizationDescription represents information shown on the organization's overview page
type OrganizationDescriptionResp ¶ added in v1.0.1
type OrganizationDescriptionResp struct{}
type OrganizationLogo ¶ added in v1.0.1
type OrganizationMember ¶ added in v1.0.1
type OrganizationMember struct { MemberID int `json:"memberId"` UserID int `json:"userId"` PlayerID int `json:"playerId"` DisplayName string `json:"displayName"` Role string `json:"role"` JoinedAt string `json:"joinedAt"` Avatar string `json:"avatar"` }
func (*OrganizationMember) ExtractAvatarURL ¶ added in v1.0.1
func (m *OrganizationMember) ExtractAvatarURL() (string, error)
ExtractAvatarURL extracts the avatar URL from the logo html tag
func (*OrganizationMember) ExtractDisplayName ¶ added in v1.0.1
func (m *OrganizationMember) ExtractDisplayName() (string, error)
ExtractDisplayName extracts the display name of a org member
func (*OrganizationMember) ExtractJoinedAt ¶ added in v1.0.1
func (m *OrganizationMember) ExtractJoinedAt() (time.Time, error)
ExtractJoinedAt extracts the joined at date
func (*OrganizationMember) ExtractRank ¶ added in v1.0.1
func (m *OrganizationMember) ExtractRank() (string, error)
ExtractRank extracts the rank from the rank html tag
type OrganizationMembersResp ¶ added in v1.0.1
type OrganizationMembersResp struct { Draw int `json:"draw"` RecordsTotal int `json:"recordsTotal"` RecordsFiltered int `json:"recordsFiltered"` Data []*OrganizationMember `json:"data"` }
type OrganizationParser ¶ added in v1.0.1
OrganizationParser is used to parse the organization's overview page for information provided there
func (*OrganizationParser) Parse ¶ added in v1.0.1
func (o *OrganizationParser) Parse() (*OrganizationDescription, error)
Parse parses all overview information provided on the Dual Universe page
type OrganizationsResp ¶ added in v1.0.1
type OrganizationsResp struct { Draw int `json:"draw"` RecordsTotal int `json:"recordsTotal"` RecordsFiltered int `json:"recordsFiltered"` Data []*Organization `json:"data"` }
type User ¶ added in v1.0.1
type User struct { ID uint `json:"id"` Name string `json:"name"` Status *string `json:"status"` AboutMe string `json:"about_me"` Location *string `json:"location"` JoinedAt time.Time `json:"joined_at"` AvatarURL string `json:"avatar_url"` TwitterName *string `json:"twitter_url"` FacebookName *string `json:"facebook_url"` }
User represents a dual universe user profile