Added proper implementation of the various 'setreturn...' methods which previously did nothing

This commit is contained in:
Alex Mein 2019-10-18 10:07:18 +01:00
parent 4997a74d15
commit f549a69bc0

View File

@ -127,6 +127,13 @@ public Query WithFileId( params PublishedFileId[] files )
handle = SteamUGC.Internal.CreateQueryAllUGCRequest1( queryType, matchingType, creatorApp.Value, consumerApp.Value, (uint)page );
}
ApplyReturns(handle);
if (maxCacheAge.HasValue)
{
SteamUGC.Internal.SetAllowCachedResponse(handle, (uint)maxCacheAge.Value);
}
ApplyConstraints( handle );
var result = await SteamUGC.Internal.SendQueryUGCRequest( handle );
@ -145,25 +152,8 @@ public Query WithFileId( params PublishedFileId[] files )
};
}
#region SharedConstraints
#region SharedConstraints
public QueryType WithType( UgcType type ) { matchingType = type; return this; }
bool? WantsReturnOnlyIDs;
public QueryType WithOnlyIDs( bool b ) { WantsReturnOnlyIDs = b; return this; }
bool? WantsReturnKeyValueTags;
public QueryType WithKeyValueTag( bool b ) { WantsReturnKeyValueTags = b; return this; }
bool? WantsReturnLongDescription;
public QueryType WithLongDescription( bool b ) { WantsReturnLongDescription = b; return this; }
bool? WantsReturnMetadata;
public QueryType WithMetadata( bool b ) { WantsReturnMetadata = b; return this; }
bool? WantsReturnChildren;
public QueryType WithChildren( bool b ) { WantsReturnChildren = b; return this; }
bool? WantsReturnAdditionalPreviews;
public QueryType WithAdditionalPreviews( bool b ) { WantsReturnAdditionalPreviews = b; return this; }
bool? WantsReturnTotalOnly;
public QueryType WithTotalOnly( bool b ) { WantsReturnTotalOnly = b; return this; }
bool? WantsReturnPlaytimeStats;
public QueryType WithPlaytimeStats( bool b ) { WantsReturnPlaytimeStats = b; return this; }
int? maxCacheAge;
public QueryType AllowCachedResponse( int maxSecondsAge ) { maxCacheAge = maxSecondsAge; return this; }
string language;
@ -244,7 +234,70 @@ void ApplyConstraints( UGCQueryHandle_t handle )
}
}
#endregion
#endregion
}
#region ReturnValues
bool? WantsReturnOnlyIDs;
public QueryType WithOnlyIDs(bool b) { WantsReturnOnlyIDs = b; return this; }
bool? WantsReturnKeyValueTags;
public QueryType WithKeyValueTag(bool b) { WantsReturnKeyValueTags = b; return this; }
bool? WantsReturnLongDescription;
public QueryType WithLongDescription(bool b) { WantsReturnLongDescription = b; return this; }
bool? WantsReturnMetadata;
public QueryType WithMetadata(bool b) { WantsReturnMetadata = b; return this; }
bool? WantsReturnChildren;
public QueryType WithChildren(bool b) { WantsReturnChildren = b; return this; }
bool? WantsReturnAdditionalPreviews;
public QueryType WithAdditionalPreviews(bool b) { WantsReturnAdditionalPreviews = b; return this; }
bool? WantsReturnTotalOnly;
public QueryType WithTotalOnly(bool b) { WantsReturnTotalOnly = b; return this; }
uint? WantsReturnPlaytimeStats;
public QueryType WithPlaytimeStats(uint unDays) { WantsReturnPlaytimeStats = unDays; return this; }
private void ApplyReturns(UGCQueryHandle_t handle)
{
if (WantsReturnOnlyIDs.HasValue)
{
SteamUGC.Internal.SetReturnOnlyIDs(handle, WantsReturnOnlyIDs.Value);
}
if (WantsReturnKeyValueTags.HasValue)
{
SteamUGC.Internal.SetReturnKeyValueTags(handle, WantsReturnKeyValueTags.Value);
}
if (WantsReturnLongDescription.HasValue)
{
SteamUGC.Internal.SetReturnLongDescription(handle, WantsReturnLongDescription.Value);
}
if (WantsReturnMetadata.HasValue)
{
SteamUGC.Internal.SetReturnMetadata(handle, WantsReturnMetadata.Value);
}
if (WantsReturnChildren.HasValue)
{
SteamUGC.Internal.SetReturnChildren(handle, WantsReturnChildren.Value);
}
if (WantsReturnAdditionalPreviews.HasValue)
{
SteamUGC.Internal.SetReturnAdditionalPreviews(handle, WantsReturnAdditionalPreviews.Value);
}
if (WantsReturnTotalOnly.HasValue)
{
SteamUGC.Internal.SetReturnTotalOnly(handle, WantsReturnTotalOnly.Value);
}
if (WantsReturnPlaytimeStats.HasValue)
{
SteamUGC.Internal.SetReturnPlaytimeStats(handle, WantsReturnPlaytimeStats.Value);
}
}
#endregion
}
}