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
263 stars 43 forks source link

Support for the Additional Arguments in ISteamNews/GetNewsForApp #108

Closed CannoliSquid closed 3 years ago

CannoliSquid commented 3 years ago

According to the website in the README (https://steamwebapi.azurewebsites.net/), version 1 and 2 of ISteamNews/GetNewsForApp support additional arguments (version 1 supports tags as an argument while version 2 supports tags and feeds as arguments).

http://api.steampowered.com/ISteamNews/GetNewsForApp/v0002/?appid=570&count=60&maxlength=300&format=json&feedname=%22steam_community_announcements%22

http://api.steampowered.com/ISteamNews/GetNewsForApp/v0002/?appid=570&count=100&maxlength=600&format=json&tags=patchnotes&feedname=%22steam_community_announcements%22

The API call below shows me trying to play around and only access News posts with the "mod_reviewed" status in the "tags" JSON arrays, but it doesn't look like it worked.

http://api.steampowered.com/ISteamNews/GetNewsForApp/v0002/?appid=570&count=60&maxlength=300&format=json&tags[0]=%22mod_reviewed%22

Would it be possible it add these enhancements? I could always try my hand at adding them to SteamWebAPI2 myself, but I wasn't sure if there had been any other interest for this enhancement.

CannoliSquid commented 3 years ago

Update: I forked the project and started looking into adding the parameters. The SteamNewsTests test still works perfectly with the addition of "feeds" as a parameter, but the "tags" parameter breaks it. I made sure that it's the "v2" version of the API call, so I'm not sure why it's not accepting it unless the site is incorrect about "tags" being accepted in "ISteamNews/GetNewsForApp/v2".

I'm going to try a bit more to make it work, but worst case scenario, at least I'll have added a small piece to support an additional parameter.

CannoliSquid commented 3 years ago

After checking a few responses, it turns out that the "tags" parameter is a string array, not just a string (as stated on https://steamwebapi.azurewebsites.net/). Turning this variable into a string array fixed the issue. I'll be running a few more tests before submitting a pull request.

CannoliSquid commented 3 years ago

109 Should fix this when/if pull request is merged