UGC Query

Introduction

Designed to simplify the act of querying User Generated Content aka Workshop items from Steam this object can be used to create and manage queries.
The intended use is that a query will be created through one of the static Create methods to properly intialize the base query and you can then use simple calls on the object to modiy the query, execute the query and step through query pages.
This is used by the UGC Query Manager which can its self simplify UGC query even further.

Definition

1
public class UgcQuery
Copied!

Static Methods

These are inteded to be how you create a new UgcQuery object. Each creates a corisponding type of query.

General Query

General use query common for example when browsing all available items
1
public static UgcQuery Create(EUGCQuery queryType,
2
EUGCMatchingUGCType matchingType,
3
AppId_t creatorApp,
4
AppId_t consumerApp)
Copied!
  • queryType The type of query to run, see EUGCQuery for more details.
  • matchingType Used to specify the type of UGC queried for. See EUGCMAtchingUGCType for more details.
  • creatorApp Filter by the app that created the item
  • consumerApp Filter by the app the item is created for

File Query

Returns specific files back defined by ID. Use this to get the details on a set of published file IDs such as when returning the list of subscribed items
1
public static UgcQuery Create(IEnumerable<PublishedFileId_t> fileIds);
Copied!
  • fileIds The collection of IDs to search for

User Query

Returns items relive to the given user account e.g. the favorited files or followed files
1
public static UgcQuery Create(AccountID_t account,
2
EUserUGCList listType,
3
EUGCMatchingUGCType matchingType,
4
EUserUGCListSortOrder sortOrder,
5
AppId_t creatorApp,
6
AppId_t consumerApp)
Copied!
  • account This is the user account to search for
  • listType The type of list to return ... see EUserUGCList for more details
  • matchingType Used to specify the type of UGC queried for. See EUGCMAtchingUGCType for more details.
  • sortOrder How should the results be sorted. See EUserUGCListSortOrder for more details.
  • creatorApp Filter by the app that created the item
  • consumerApp Filter by the app the item is created for

Fields and Attributes

handle

1
public UGCQueryHandle_t handle
Copied!
The active query handle if any. This can be used to modify the query acter creating it. In most cases you wont need to use this directly.

matchedRecordCount

1
public uint matchedRecordCount
Copied!
The number of matched records. This will be 0 untill the query is executed and should not be updated manually.

pageCount

1
public uint pageCount
Copied!
The number of pages found for this query. This will be 0 until the query is exeucted and should not be updated manually.

Page

1
public uint Page => get;
Copied!
This indicates the current page the query is reading. Use the SetPage method to update this value and update the query for the desired page.

ResultList

1
public List<UGCCommunityItem> ResultsList
Copied!
This will be populated with the results when the query is exeucted ... assuming there are results to populate.
See UGCCommunityItem for more info on how to use the items returned.

Methods

SetLanguage

1
public bool SetLanguage(string language);
Copied!
Sets the query item language

SetMatchAnyTag

1
public bool SetMatchAnyTag(bool anyTag)
Copied!
Sets the query match any tag

SetRankedByTrendDays

1
public bool SetRankedByTrendDays(uint days);
Copied!
Sets the query to rank by trend over the indicated days

SetReturnAdditionalPreviews

1
public bool SetReturnAdditionalPreviews(bool enable);
Copied!
Should the query return additional previews or just the main

SetReturnChildren

1
public bool SetReturnChildren(bool enable);
Copied!
Should the query return child items or just the main

SetReturnKeyValueTags

1
public bool SetReturnKeyValueTags(bool enable);
Copied!
Should the query return key value tags

SEtReturnLongDescription

1
public bool SetReturnLongDescription(bool enable);
Copied!
Should the query return the long description of the item

SetReturnMetadata

1
public bool SetReturnMetadata(bool enable);
Copied!
Should the query return metadata

SetReturnOnlyIDs

1
public bool SetReturnOnlyIDs(bool enable);
Copied!
Should the query only return item IDs

SetReturnPlaytimeStats

1
public bool SetReturnPlaytimeStats(uint days);
Copied!
Over what set of days should paly time stats be returned

SetReturnTotalOnly

1
public bool SetReturnTotalOnly(bool enable);
Copied!
Should the query only return the matching count and not item data at all

SetSearchText

1
public bool SetSearchText(string text);
Copied!
Sets the search text to be used by the query

SetNextPage

1
public bool SetNextPage();
Copied!
Advances the active page forward by 1 if avialable

SetPreviousPage

1
public bool SetPreviousPage();
Copied!
Steps back to the previous page if available

SetPage

1
public bool SetPage(uint page);
Copied!
Sets the query to the indicated page

Execute

1
public bool Execute(UnityAction<UgcQuery> callback);
Copied!
Executes the given query and registeres a callback to catch its results

ReleaseHandle

1
public void ReleaseHandle();
Copied!
Releases the query handle, this should be called when done with a query. This is automatically called when the object is disposed.

Dispose

1
public void Dispose();
Copied!
Deconstructs the query and frees its handles