This API aims to be the most comprehensive API for Steam in Go. It aims to provide all the endpoints found in https://steamapi.xpaw.me/
All API-Endpoints specified in https://developer.valvesoftware.com/wiki/Steam_Web_API are ready to use in this library.
All endpoints are callable on a variable of the Client struct:
httpClient := http.Client{}
client := steamclient.New("your-api-key", httpClient)Here, you need to specify a (customizable) HTTP client, which is used to send the requests, and an API key. You can obtain an API key by following Valve's documentation: https://steamcommunity.com/dev
Some requests don't explicitly require a key. If you only want to call such endpoints, you can create a client without a key:
client := steamclient.NewClientWithoutKey(httpClient)Calling an Endpoint To call an endpoint, you first need to create a parameter variable for the corresponding method. Optional parameters are marked as such and are pointer types, which means you don't have to specify them when creating the parameter variable.
We will use the GetUserStatsForGame endpoint as an example:
// define the output format
f := config.Json
client := steamclient.New("your-api-key", httpClient)
// define the params struct
params := steamclient.UserStatsForGameParams{
SteamId: 76561197972495328,
AppId: 440,
Format: config.OutputFormat(f),
// we could also specify the language here, but chose not to because it's an optional parameter
}
// get the returned body from the request
o, err := client.GetUserStatsForGame(params)
if err != nil {
log.Fatal("Error:", err)
}
// pretty-print the returned value
fmt.Println(format.PrettyPrint(o, f))Every endpoint returns a specific structure in the specified format (JSON and XML; VDF is currently not implemented). This library returns the responses in a directly usable object format, instead of a string. For this endpoint, the returned struct looks like this:
// a variable of this struct will be returned
type UserStatsResponse struct {
PlayerStats UserStats `json:"playerstats" xml:"playerstats"`
}
type UserStats struct {
SteamID string `json:"steamID" xml:"steamID"`
GameName string `json:"gameName" xml:"gameName"`
Achievements []UserStatsAchievement `json:"achievements" xml:"achievements>achievement"`
}
type UserStatsAchievement struct {
Name string `json:"name" xml:"name"`
Achieved int `json:"achieved" xml:"achieved"` // 1 - true, 0 - false
}Below are the status of the implementations of all the interfaces Steam provides.
- IAccountCartService
- IAccountLinkingService
- IAccountPrivateAppsService
- IAuctionService
- IAuthenticationService
- IAuthenticationSupportService
- IBroadcastClientService
- IBroadcastService
- IChatRoomService
- ICheatReportingService
- ICheckoutService
- IClanFAQSService
- IClanService
- IClientCommService
- IClientMetricsService
- ICloudService
- ICommunityLinkFilterService
- ICommunityService
- IContentFilteringService
- IContentServerConfigService
- IContentServerDirectoryService
- ICredentialsService
- IDailyDealService
- IDataPublisherService
- IDeviceAuthService
- IEconMarketService
- IEconService
- IEmbeddedClientService
- IFamilyGroupsService
- IFriendMessagesService
- IFriendsListService
- IGameCoordinator
- IGameInventory
- IGameNotificationsService
- IGameRecordingClipService
- IGameServersService
- IHelpRequestLogsService
- IInventoryService
- ILobbyMatchmakingService
- ILoyaltyRewardsService
- IMarketingMessagesService
- IMobileAppService
- IMobileAuthService
- IMobileDeviceService
- IMobileNotificationService
- INewsService
- IOnlinePlayService
- IParentalService
- IPartnerMembershipInviteService
- IPartnerStoreBrowseService
- IPhoneService
- IPhysicalGoodsService
- IPlayerService
- IProductInfoService
- IPromotionEventInvitesService
- IPromotionPlanningService
- IPromotionStatsService
- IPublishedFileService
- IPublishingService
- IQuestService
- IRemoteClientService
- ISaleFeatureService
- ISaleItemRewardsService
- IShoppingCartService
- ISiteLicenseService
- ISteamApps
- ISteamAwardsService
- ISteamBitPay
- ISteamBoaCompra
- ISteamBroadcast
- ISteamCDN
- ISteamChartsService
- ISteamCloudGaming
- ISteamCommunity
- ISteamDirectory
- ISteamEconomy
- ISteamEnvoy
- ISteamGameServerStats
- ISteamLeaderboards
- ISteamLearnService
- ISteamMicroTxn
- ISteamMicroTxnSandbox
- ISteamNews
- ISteamNodwin
- ISteamNotificationService
- ISteamPayPalPaymentsHub
- ISteamPublishedItemSearch
- ISteamPublishedItemVoting
- ISteamRemoteStorage
- ISteamSpecialSurvey
- ISteamTVService
- ISteamUser
- ISteamUserAuth
- ISteamUserOAuth
- ISteamUserStats
- GetGlobalStatsForGame method
- ISteamWebAPIUtil
- ISteamWorkshop
- IStoreAppSimilarityService
- IStoreBrowseService
- IStoreMarketingService
- IStoreQueryService
- IStoreSalesService
- IStoreService
- IStoreTopSellersService
- ITestExternalPrivilegeService
- ITrustService
- ITwoFactorService
- IUserAccountService
- IUserGameNotesService
- IUserReviewsService
- IVACManagementService
- IVideoService
- IWorkshopService
- ICSGOServers_730
- ICSGOStreamSystem_730
- ICSGOTournaments_730
- IEconItems_730
- IGCVersion_730
- IDOTA2AutomatedTourney_570
- IDOTA2CustomGames_570
- IDOTA2Events_570
- IDOTA2Fantasy_570
- IDOTA2Guild_570
- IDOTA2League_570
- IDOTA2MatchStats_570
- IDOTA2Match_570
- IDOTA2Operations_570
- IDOTA2Plus_570
- IDOTA2StreamSystem_570
- IDOTA2Teams_570
- IDOTA2Ticket_570
- IDOTAChat_570
- IEconDOTA2_570
- IEconItems_570
- IGCVersion_570
- IEconItems_440
- IGCVersion_440
- ITFItems_440
- ITFPromos_440
- ITFSystem_440
- IEconItems_620
- IPortal2Leaderboards_620
- ITFPromos_620
- IClientStats_1046930
- IEconItems_1046930
- IGCVersion_1046930
- IEconItems_583950
- IGCVersion_583950
- IEconItems_1269260
- IGCVersion_1269260