babelshift / SteamWebAPI2

🎮 C# / .NET library that makes it easy to use the Steam Web API. It conveniently wraps around all of the JSON data and ugly API details with clean methods, structures and classes.
MIT License
262 stars 43 forks source link

Problems with async returns - sample code #43

Closed Mithgroth closed 7 years ago

Mithgroth commented 7 years ago

Helloes, thanks for this library and incredible work you have done. I just started using it, and hammered your sample code to my controller.

// this will map to the ISteamUser endpoint
var steamInterface = new SteamUser("<devKeyHere>");

// this will map to ISteamUser/GetPlayerSummaries method in the Steam Web API
// see PlayerSummaryResultContainer.cs for response documentation
var playerSummaryResponse = await steamInterface.GetPlayerSummaryAsync(<steamIdHere>);
var playerSummaryData = playerSummaryResponse.Data;
var playerSummaryLastModified = playerSummaryResponse.LastModified;

// this will map to ISteamUser/GetFriendsListAsync method in the Steam Web API
// see FriendListResultContainer.cs for response documentation
var friendsListResponse = await steamInterface.GetFriendsListAsync(<steamIdHere>);
var friendsList = friendsListResponse.Data;

I checked my own Steam profile, player summary runs and works great and it's structured with models, awesome so far!

However I get nothing after invoking GetFriendsListAsync, no exceptions too. Tried it with EconItems.GetPlayerItemsAsync() too, I'm just not receiving anything out of these methods. But I did get my player summary.

What would you suggest me to do?

babelshift commented 7 years ago

Hi Emek,

Can you please tell me which Steam ID you are testing with so I can try?

Thanks.

On Apr 18, 2017 1:25 PM, "Emek Taydaş" notifications@github.com wrote:

Helloes, thanks for this library and incredible work you have done. I just started using it, and hammered your sample code to my controller.

// this will map to the ISteamUser endpoint var steamInterface = new SteamUser("");

// this will map to ISteamUser/GetPlayerSummaries method in the Steam Web API // see PlayerSummaryResultContainer.cs for response documentation var playerSummaryResponse = await steamInterface.GetPlayerSummaryAsync(); var playerSummaryData = playerSummaryResponse.Data; var playerSummaryLastModified = playerSummaryResponse.LastModified;

// this will map to ISteamUser/GetFriendsListAsync method in the Steam Web API // see FriendListResultContainer.cs for response documentation var friendsListResponse = await steamInterface.GetFriendsListAsync(); var friendsList = friendsListResponse.Data;

I checked my own Steam profile, player summary runs and works great and it's structured with models, awesome so far!

However I get nothing after invoking GetFriendsListAsync, no exceptions too. Tried it with EconItems.GetPlayerItemsAsync() too, I'm just not receiving anything out of these methods. But I did get my player summary.

What would you suggest me to do?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/babelshift/SteamWebAPI2/issues/43, or mute the thread https://github.com/notifications/unsubscribe-auth/ACmOX1DdbCyB6J9jVe1UPfNZ6kuUB_EBks5rxPIPgaJpZM4NApjg .

Mithgroth commented 7 years ago

Hey :) 76561197999973508 is the SteamId I'm trying. Even if there is a problem (friends list private or another privacy setting) I'm getting no errors at all.

Eagerly waiting for your response, thanks!

babelshift commented 7 years ago

Here's what I just tested:

var econItemsService = new EconItems("key", EconItemsAppId.TeamFortress2);
var playerItems = await econItemsService.GetPlayerItemsAsync(76561197999973508);
var steamUser = new SteamUser("key");
var friendsList = await steamUser.GetFriendsListAsync(76561197999973508);

playerItems.Data contains 116 items. friendsList.Data contains 98 friends.

It seems to be working on my end. Can you double check your code or post a full sample?

Mithgroth commented 7 years ago

I was querying about CS:GO and this might be the cause:

http://api.steampowered.com/IEconItems_730/GetPlayerItems/v0001/?key={key}&steamid=76561197999973508&format=json

returns:

screenshot_3

aleksamagicka commented 7 years ago

That method is long gone. Valve removed it because of its instability. You can still use the GC to get the inventory. See here.

babelshift commented 7 years ago

@Mithgroth what about the friends list? Can you confirm that's working for you? I was able to retrieve friends for the Steam ID you provided.

Mithgroth commented 7 years ago

@babelshift Yeah, I got fList working, no problems. Any plans to change EconItems for CS:GO since the method is changed?

babelshift commented 7 years ago

@Mithgroth Unfortunately, if Valve has deprecated the method, there's not much I can do. I'm not aware if they have moved the CS:GO EconItems to a different web endpoint.

The reddit link above indicates that the only way to get that information is via protobuf; something that I can't support in this library. You could try using SteamKit for that.