Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/node/src/modules/halo-infinite/ugc-discovery.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@ export class UgcDiscoveryModule extends ModuleBase {
count?: number;
/** Starting offset */
start?: number;
/** Minimum average rating between 0 and 5 */
averageRatingMin?: number;
/** Minimum date created */
fromDateCreatedUtc?: Date;
/** Maximum date created */
toDateCreatedUtc?: Date;
/** Minimum date modified */
fromDateModifiedUtc?: Date;
/** Maximum date modified */
toDateModifiedUtc?: Date;
/** Minimum date published */
fromDatePublishedUtc?: Date;
/** Maximum date published */
toDatePublishedUtc?: Date;
}): Promise<HaloApiResult<UgcSearchResult>> {
const queryParts: string[] = [];

Expand Down Expand Up @@ -93,6 +107,27 @@ export class UgcDiscoveryModule extends ModuleBase {
if (params.start !== undefined) {
queryParts.push(`start=${params.start}`);
}
if (params.averageRatingMin !== undefined) {
queryParts.push(`averageRatingMin=${params.averageRatingMin}`);
}
if (params.fromDateCreatedUtc) {
queryParts.push(`fromDateCreatedUtc=${encodeURIComponent(params.fromDateCreatedUtc.toISOString())}`);
}
if (params.toDateCreatedUtc) {
queryParts.push(`toDateCreatedUtc=${encodeURIComponent(params.toDateCreatedUtc.toISOString())}`);
}
if (params.fromDateModifiedUtc) {
queryParts.push(`fromDateModifiedUtc=${encodeURIComponent(params.fromDateModifiedUtc.toISOString())}`);
}
if (params.toDateModifiedUtc) {
queryParts.push(`toDateModifiedUtc=${encodeURIComponent(params.toDateModifiedUtc.toISOString())}`);
}
if (params.fromDatePublishedUtc) {
queryParts.push(`fromDatePublishedUtc=${encodeURIComponent(params.fromDatePublishedUtc.toISOString())}`);
}
if (params.toDatePublishedUtc) {
queryParts.push(`toDatePublishedUtc=${encodeURIComponent(params.toDatePublishedUtc.toISOString())}`);
}

const queryString = queryParts.length > 0 ? `?${queryParts.join('&')}` : '';
return this.get<UgcSearchResult>(`/hi/search${queryString}`);
Expand Down