xbl

package module
v0.0.0-...-a7df6cc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2018 License: Unlicense Imports: 12 Imported by: 1

README

xbl

GoDoc

Documentation

Overview

Package xbl provides access to the Smartglass Xbox Live API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Achievement

type Achievement struct {
	ID                int       `json:"id"`
	TitleID           int       `json:"titleId"`
	Name              string    `json:"name"`
	Sequence          int       `json:"sequence"`
	Flags             int       `json:"flags"`
	UnlockedOnline    bool      `json:"unlockedOnline"`
	Unlocked          bool      `json:"unlocked"`
	IsSecret          bool      `json:"isSecret"`
	Platform          int       `json:"platform"`
	Gamescore         int       `json:"gamerscore"`
	Description       string    `json:"description"`
	LockedDescription string    `json:"lockedDescription"`
	Type              int       `json:"type"`
	TimeUnlocked      time.Time `json:"timeUnlocked"`
	Rarity            Rarity    `json:"rarity"`
}

Achievement represents an individual user's achievement in a game.

type ActivityStatus

type ActivityStatus struct {
	XUID    string           `json:"xuid"`
	State   string           `json:"state"`
	Devices []DeviceActivity `json:"devices,omitempty"`
}

ActivityStatus describes the current status of a Xbox LIVE gamertag.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client encapsulates the entire Xbox Live API and a set of credentials to access the API.

A Client is safe for concurrent access.

func Login

func Login(username, password string) (*Client, error)

Login logs into the Microsoft Live API, returning a client with a fresh access token.

func (*Client) Achievements

func (c *Client) Achievements(xid string) ([]Achievement, error)

Achievements retrieves all achievements for the provided XID.

func (*Client) ActivityStatuses

func (c *Client) ActivityStatuses(xids ...string) ([]ActivityStatus, error)

ActivityStatuses retrieves the activity statuses for the provided XIDs.

func (*Client) Expiry

func (c *Client) Expiry() time.Time

Expiry returns the time at which this client's credentials will no longer be valid and the client should be replaced with a new one obtained from Login.

func (*Client) Gamertag

func (c *Client) Gamertag() string

Gamertag returns the gamertag of the user who is authenticated with the API.

func (*Client) Profile

func (c *Client) Profile(gamertag string) (*Profile, error)

Profile retrieves the profile for the provided gamertag.

func (*Client) Profiles

func (c *Client) Profiles(userIDs ...string) ([]*Profile, error)

Profiles retrieves the profiles for the users with the provided IDs.

func (*Client) Titles

func (c *Client) Titles(xid string, opts ...Option) ([]Title, error)

Titles retrieves all Xbox titles played by the provided XID.

func (*Client) UserID

func (c *Client) UserID() string

UserID returns the XID user ID of the user who is authenticated with the API. All requests to the API are performed as this user.

type DeviceActivity

type DeviceActivity struct {
	Type   string          `json:"type"`
	Titles []TitleActivity `json:"titles,omitempty"`
}

type Option

type Option func(*reqOptions)

Option defines an option for a client method.

func UpdatedSince

func UpdatedSince(t time.Time) Option

UpdatedSince will filter results to only results updated since the provided time.

type Profile

type Profile struct {
	ID             string `json:"id"`
	Gamertag       string `json:"gamertag,omitempty"`
	Gamerscore     int    `json:"gamerscore,omitempty"`
	GamerPicture   string `json:"picture_url,omitempty"`
	AccountTier    string `json:"account_tier,omitempty"`
	Reputation     string `json:"reputation,omitempty"`
	PreferredColor string `json:"-"`
	Tenure         int    `json:"-"`
	Bio            string `json:"bio,omitempty"`
	Location       string `json:"location,omitempty"`
}

Profile describe's a gamer's Xbox Live account.

type Rarity

type Rarity struct {
	CurrentCategory   string `json:"currentCategory"`
	CurrentPercentage int    `json:"currentPercentage"`
}

Rarity describes the rarity of a particular achievement.

type Title

type Title struct {
	ID                  int64     `json:"titleId"`
	Type                int       `json:"titleType"`
	Platforms           []int     `json:"platforms"`
	Name                string    `json:"name"`
	LastPlayed          time.Time `json:"lastPlayed"`
	CurrentAchievements int64     `json:"currentAchievements"`
	CurrentGamerscore   int64     `json:"currentGamerscore"`
	Sequence            int64     `json:"sequence"`
	TotalAchievements   int64     `json:"totalAchievements"`
	TotalGamerscore     int64     `json:"totalGamerscore"`
	RareUnlocks         []struct {
		RarityCategory   string `json:"rarityCategory"`
		NumUnlocks       int    `json:"numUnlocks"`
		IsRarestCategory bool   `json:"isRarestCategory"`
	} `json:"rareUnlocks"`
}

Title represents an individual Xbox title.

type TitleActivity

type TitleActivity struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	Placement    string `json:"placement"`
	State        string `json:"state"`
	LastModified string `json:"lastModified"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL