model

package
v0.0.0-...-a1b8ec1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package model which provides structs to be used with the CSGO API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Achievement

type Achievement struct {
	APIName     string
	Title       string
	Description string
	Achieved    int
}

Achievement stores the complete information about achievements of a player. this includes metadata to identify what and how, as well if it was achieved by the player. This struct is filled in combination of a Stats request, and the parsing of an XML request from the user's public profile.

type AchievementsDetails

type AchievementsDetails struct {
	Achievements struct {
		Achievement []struct {
			Closed      string `xml:"closed,attr"`
			Name        string `xml:"name"`
			APIName     string `xml:"apiname"`
			Description string `xml:"description"`
		} `xml:"achievement"`
	} `xml:"achievements"`
}

AchievementsDetails stores a struct of a XML response to complement the response from the API, since the other response only contains raw data, this adds more detail.

type GameInfo

type GameInfo struct {
	Response struct {
		Games []struct {
			Playtime2Weeks         int `json:"playtime_2weeks"`
			PlaytimeForever        int `json:"playtime_forever"`
			PlaytimeWindowsForever int `json:"playtime_windows_forever"`
			PlaytimeMacForever     int `json:"playtime_mac_forever"`
			PlaytimeLinuxForever   int `json:"playtime_linux_forever"`
		} `json:"games"`
	} `json:"response"`
}

GameInfo stores information about the game itself from a player perspective, this includes the playtime in different categories including per OS.

type Inventory

type Inventory struct {
	Assets []struct {
		ClassID    string `json:"classid"`
		InstanceID string `json:"instanceid"`
		Amount     string `json:"amount"`
	} `json:"assets"`
	Descriptions []struct {
		ClassID                   string `json:"classid"`
		InstanceID                string `json:"instanceid"`
		Tradable                  int    `json:"tradable"`
		Name                      string `json:"name"`
		Type                      string `json:"type"`
		MarketName                string `json:"market_name"`
		Commodity                 int    `json:"commodity"`
		MarketTradableRestriction int    `json:"market_tradable_restriction"`
		Marketable                int    `json:"marketable"`
	} `json:"descriptions"`
	TotalInventoryCount int `json:"total_inventory_count"`
}

Inventory stores a struct of JSON response for an unofficial API of CS:GO.

type ItemsList

type ItemsList struct {
	Success   bool   `json:"success"`
	Currency  string `json:"currency"`
	Timestamp int    `json:"timestamp"`
	ItemsList map[string]struct {
		Name  string `json:"name"`
		Price struct {
			SevenDays struct {
				Average float64 `json:"average"`
			} `json:"7_days"`
		} `json:"price"`
		FirstSaleDate string `json:"first_sale_date"`
	} `json:"items_list"`
}

ItemsList returns a struct from CSGOBackpack for all the prices available.

type News

type News struct {
	Appnews struct {
		Appid     int `json:"appid"`
		Newsitems []struct {
			Gid           string `json:"gid"`
			Title         string `json:"title"`
			URL           string `json:"url"`
			IsExternalURL bool   `json:"is_external_url"`
			Author        string `json:"author"`
			Contents      string `json:"contents"`
			Feedlabel     string `json:"feedlabel"`
			Date          int    `json:"date"`
			Feedname      string `json:"feedname"`
			FeedType      int    `json:"feed_type"`
			Appid         int    `json:"appid"`
		} `json:"newsitems"`
		Count int `json:"count"`
	} `json:"appnews"`
}

News stores a struct of JSON response for news from CS:GO.

type PlayerInventory

type PlayerInventory struct {
	ClassID      string
	MarketName   string
	Amount       int64
	Currency     string
	AveragePrice float64 // decimal
	Tradable     bool
	Marketable   bool
}

PlayerInventory stores a struct of all the player's inventory from CS:GO.

type PlayerStats

type PlayerStats struct {
	PlayerStats struct {
		SteamID string `json:"playerstats.steamID"`

		Stats []struct {
			Name  string `json:"name"`
			Value int    `json:"value"`
		} `json:"stats"`

		Achievements []struct {
			Name     string `json:"name"`
			Achieved int    `json:"achieved"`
		} `json:"achievements"`
	} `json:"playerstats"`
}

PlayerStats stores a struct of JSON response for player statistics it contains the SteamID which is the ID of the player, Stats which are all the data gather from all the game, as well as achievements which are the ones achieved by the player.

type PlayerSummaries

type PlayerSummaries struct {
	Response struct {
		Players []struct {
			PersonaName string `json:"personaname"`
		} `json:"players"`
	} `json:"response"`
}

PlayerSummaries stores information about the player's Steam profile, it is used to convert a SteamID to a SteamName. Inverso of ResolveVanityUrl

type ResolveVanityUrl

type ResolveVanityUrl struct {
	Response struct {
		Steamid string `json:"steamid"`
	} `json:"response"`
}

ResolveVanityUrl stores information about the player's Steam ID, it is used to convert a username to a SteamID that can be used for future requests.

Jump to

Keyboard shortcuts

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