Skip to content

Commit

Permalink
Fixed test command
Browse files Browse the repository at this point in the history
  • Loading branch information
Pickysaurus committed Aug 6, 2024
1 parent 922b256 commit edc26c7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/api/queries/v2-latestmods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export async function latestMods(headers: Record<string,string>, startDate: Date
// Force setting header version
if (headers['api-version'] !== '2024-09-01') {
headers['api-version'] = '2024-09-01'
logMessage('OUTDATED QUERY [Mods] - API Version header must be set to 2024-09-01 for this request')
logMessage('OUTDATED QUERY [Latest Mods] - API Version header must be set to 2024-09-01 for this request')
}

if (typeof startDate === 'string') {
Expand Down
8 changes: 7 additions & 1 deletion src/api/queries/v2-updatedMods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ export async function updatedMods(
gameIds?: number | number[],
sort: IModsSort = { updatedAt: { direction: 'ASC' }}
): Promise<IUpdatedModResults> {

// Force setting header version
if (headers['api-version'] !== '2024-09-01') {
headers['api-version'] = '2024-09-01'
logMessage('OUTDATED QUERY [Updated Mods] - API Version header must be set to 2024-09-01 for this request')
}

const sinceDate: number = Math.floor(new Date(newSince).getTime() / 1000)
// The API has a page size limit of 50 (default 20) so we need to break our request into pages.
Expand All @@ -88,7 +94,7 @@ export async function updatedMods(
const vars = {
filter,
sort,
first: 10
count: 10
}

try {
Expand Down
4 changes: 2 additions & 2 deletions src/interactions/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ async function action(client: ClientExt, baseInteraction: CommandInteraction): P
MyCollections: (await botuser.NexusMods.API.v2.MyCollections()).length > 0,
Collections: (await botuser.NexusMods.API.v2.Collections({}, 'endorsements_count')).nodesCount > 0,
Collection: (await botuser.NexusMods.API.v2.Collection('pkcov7', 'skyrimspecialedition', true))?.slug === 'pkcov7',
CollectionsByUser: (await botuser.NexusMods.API.v2.CollectionsByUser(51448566)).nodesCount > 0,
CollectionsByUser: (await botuser.NexusMods.API.v2.CollectionsByUser(31179975)).nodesCount > 0,
FindUserName: (await botuser.NexusMods.API.v2.FindUser('Janquel'))?.memberId === 51448566,
CollectionDownloadTotals: (await botuser.NexusMods.API.v2.CollectionDownloadTotals(31179975))?.totalDownloads > 0,
FindUserID: (await botuser.NexusMods.API.v2.FindUser(51448566))?.name === 'Janquel',
LatestMods: (await botuser.NexusMods.API.v2.LatestMods(new Date(Date.now() - 10000))).totalCount > 0
LatestMods: (await botuser.NexusMods.API.v2.LatestMods(new Date(1))).totalCount > 0
}

logMessage('API tests complete', { v1test, v2test });
Expand Down

0 comments on commit edc26c7

Please sign in to comment.