Skip to main content

Browsing Mods

After initializing the plugin and authenticating a user, you can query the available mods using ListAllModsAsync.

ListAllModsAsync supports filtering by name, tag, author, mature content, and more using ModioFilterParams. You can sort results as specified by ModioSortFieldType, and request paginated or indexed results. By default, ModioFilterParams asks for the first 100 results (the maximum number returnable in a query) sorted by ModioModID.

void UModioManagerSubsystem::ListAllMods()
{
if (UModioSubsystem* Subsystem = GEngine->GetEngineSubsystem<UModioSubsystem>())
{
FModioFilterParams Filter;
// Build the filter by chaining together multiple calls
Filter.PagedResults(1, 5).IndexedResults(3, 5).WithTags("Multiplayer").SortBy(EModioSortFieldType::ID, EModioSortDirection::Descending);

Subsystem->ListAllModsAsync(Filter, FOnListAllModsDelegateFast::CreateUObject(this, &UModioManagerSubsystem::OnListAllModsComplete));
}
}

void UModioManagerSubsystem::OnListAllModsComplete(FModioErrorCode ErrorCode, TOptional<FModioModInfoList> OptionalModList)
{
// Ensure ListAllModsAsync was successful
if (!ErrorCode)
{
// ModList is guaranteed to be valid if there is no error
TArray<FModioModInfo> ModInfoArray = OptionalModList.GetValue().GetRawList();

// Do something with ModInfoArray

// You can use OptionalModList().GetValue().Paged related methods to make further paginated requests if required
}
}