Skip to content

Commit

Permalink
Merge pull request #911 from xPaw/only-public
Browse files Browse the repository at this point in the history
Remove only_public from pics requests
  • Loading branch information
yaakov-h authored Jul 30, 2021
2 parents 60d99f4 + 184b02c commit 97b9608
Showing 1 changed file with 7 additions and 31 deletions.
38 changes: 7 additions & 31 deletions SteamKit2/SteamKit2/Steam/Handlers/SteamApps/SteamApps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public sealed partial class SteamApps : ClientMsgHandler
/// <summary>
/// Represents a PICS request used for <see cref="SteamApps.PICSGetProductInfo"/>
/// </summary>
public sealed class PICSRequest
public struct PICSRequest
#pragma warning restore 0419
{
/// <summary>
Expand All @@ -37,38 +37,16 @@ public sealed class PICSRequest
/// </summary>
/// <value>The access token</value>
public ulong AccessToken { get; set; }
/// <summary>
/// Requests only public app info
/// </summary>
/// <value>The flag specifying if only public data is requested</value>
public bool Public { get; set; }

/// <summary>
/// Instantiate an empty PICS product info request
/// </summary>
public PICSRequest() : this( 0, 0, true )
{
}

/// <summary>
/// Instantiate a PICS product info request for a given app or package id
/// </summary>
/// <param name="id">App or package ID</param>
public PICSRequest( uint id ) : this( id, 0, true )
{
}

/// <summary>
/// Instantiate a PICS product info request for a given app or package id and an access token
/// </summary>
/// <param name="id">App or package ID</param>
/// <param name="access_token">PICS access token</param>
/// <param name="only_public">Get only public info</param>
public PICSRequest( uint id, ulong access_token, bool only_public )
public PICSRequest( uint id = 0, ulong access_token = 0 )
{
ID = id;
AccessToken = access_token;
Public = only_public;
}
}

Expand Down Expand Up @@ -205,18 +183,17 @@ public AsyncJob<PICSChangesCallback> PICSGetChangesSince( uint lastChangeNumber
/// </summary>
/// <param name="app">App id requested.</param>
/// <param name="package">Package id requested.</param>
/// <param name="onlyPublic">Whether to send only public information.</param>
/// <param name="metaDataOnly">Whether to send only meta data.</param>
/// <returns>The Job ID of the request. This can be used to find the appropriate <see cref="PICSProductInfoCallback"/>.</returns>
public AsyncJobMultiple<PICSProductInfoCallback> PICSGetProductInfo(uint? app, uint? package, bool onlyPublic = true, bool metaDataOnly = false)
public AsyncJobMultiple<PICSProductInfoCallback> PICSGetProductInfo(uint? app, uint? package, bool metaDataOnly = false)
{
List<uint> apps = new List<uint>();
List<uint> packages = new List<uint>();

if ( app.HasValue ) apps.Add( app.Value );
if ( package.HasValue ) packages.Add( package.Value );

return PICSGetProductInfo( apps, packages, onlyPublic, metaDataOnly );
return PICSGetProductInfo( apps, packages, metaDataOnly );
}

/// <summary>
Expand All @@ -226,12 +203,11 @@ public AsyncJobMultiple<PICSProductInfoCallback> PICSGetProductInfo(uint? app, u
/// </summary>
/// <param name="apps">List of app ids requested.</param>
/// <param name="packages">List of package ids requested.</param>
/// <param name="onlyPublic">Whether to send only public information.</param>
/// <param name="metaDataOnly">Whether to send only meta data.</param>
/// <returns>The Job ID of the request. This can be used to find the appropriate <see cref="PICSProductInfoCallback"/>.</returns>
public AsyncJobMultiple<PICSProductInfoCallback> PICSGetProductInfo( IEnumerable<uint> apps, IEnumerable<uint> packages, bool onlyPublic = true, bool metaDataOnly = false )
public AsyncJobMultiple<PICSProductInfoCallback> PICSGetProductInfo( IEnumerable<uint> apps, IEnumerable<uint> packages, bool metaDataOnly = false )
{
return PICSGetProductInfo( apps.Select( app => new PICSRequest( app, 0, onlyPublic ) ), packages.Select( package => new PICSRequest( package ) ), metaDataOnly );
return PICSGetProductInfo( apps.Select( app => new PICSRequest( app ) ), packages.Select( package => new PICSRequest( package ) ), metaDataOnly );
}

/// <summary>
Expand Down Expand Up @@ -263,7 +239,7 @@ public AsyncJobMultiple<PICSProductInfoCallback> PICSGetProductInfo( IEnumerable
var appinfo = new CMsgClientPICSProductInfoRequest.AppInfo();
appinfo.access_token = app_request.AccessToken;
appinfo.appid = app_request.ID;
appinfo.only_public_obsolete = app_request.Public;
appinfo.only_public_obsolete = false;

request.Body.apps.Add( appinfo );
}
Expand Down

0 comments on commit 97b9608

Please sign in to comment.