mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-10-20 16:48:43 -05:00
Update types
This commit is contained in:
@@ -165,7 +165,7 @@ export default class MoonApi {
|
||||
const nintendoAccountToken = await getNintendoAccountToken(token, ZNMA_CLIENT_ID);
|
||||
|
||||
// Nintendo Account user data
|
||||
const user = await getNintendoAccountUser(nintendoAccountToken);
|
||||
const user = await getNintendoAccountUser<never>(nintendoAccountToken);
|
||||
|
||||
return {
|
||||
nintendoAccountToken,
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { fetch, FormData, Response } from 'undici';
|
||||
import { WebServiceToken } from './coral-types.js';
|
||||
import { NintendoAccountUser } from './na.js';
|
||||
import { defineResponse, ErrorResponse, HasResponse } from './util.js';
|
||||
import { CoralApiInterface } from './coral.js';
|
||||
import { CoralApiInterface, NintendoAccountUserCoral } from './coral.js';
|
||||
import { WebServiceError, Users, AuthToken, UserProfile, Newspapers, Newspaper, Emoticons, Reaction, IslandProfile } from './nooklink-types.js';
|
||||
import createDebug from '../util/debug.js';
|
||||
import { timeoutSignal } from '../util/misc.js';
|
||||
@@ -107,13 +106,13 @@ export default class NooklinkApi {
|
||||
return NooklinkUserApi._createWithNooklinkApi(this, user_id);
|
||||
}
|
||||
|
||||
async renewTokenWithCoral(coral: CoralApiInterface, user: NintendoAccountUser) {
|
||||
async renewTokenWithCoral(coral: CoralApiInterface, user: NintendoAccountUserCoral) {
|
||||
const data = await NooklinkApi.loginWithCoral(coral, user);
|
||||
this.setTokenWithSavedToken(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
async renewTokenWithWebServiceToken(webserviceToken: WebServiceToken, user: NintendoAccountUser) {
|
||||
async renewTokenWithWebServiceToken(webserviceToken: WebServiceToken, user: NintendoAccountUserCoral) {
|
||||
const data = await NooklinkApi.loginWithWebServiceToken(webserviceToken, user);
|
||||
this.setTokenWithSavedToken(data);
|
||||
return data;
|
||||
@@ -124,7 +123,7 @@ export default class NooklinkApi {
|
||||
this._token_expired = false;
|
||||
}
|
||||
|
||||
static async createWithCoral(coral: CoralApiInterface, user: NintendoAccountUser) {
|
||||
static async createWithCoral(coral: CoralApiInterface, user: NintendoAccountUserCoral) {
|
||||
const data = await this.loginWithCoral(coral, user);
|
||||
return {nooklink: this.createWithSavedToken(data), data};
|
||||
}
|
||||
@@ -133,7 +132,7 @@ export default class NooklinkApi {
|
||||
return new this(data.gtoken, data.useragent);
|
||||
}
|
||||
|
||||
static async loginWithCoral(coral: CoralApiInterface, user: NintendoAccountUser) {
|
||||
static async loginWithCoral(coral: CoralApiInterface, user: NintendoAccountUserCoral) {
|
||||
const { default: { coral_gws_nooklink: config } } = await import('../common/remote-config.js');
|
||||
if (!config) throw new Error('Remote configuration prevents NookLink authentication');
|
||||
|
||||
@@ -143,7 +142,7 @@ export default class NooklinkApi {
|
||||
}
|
||||
|
||||
static async loginWithWebServiceToken(
|
||||
webserviceToken: WebServiceToken, user: NintendoAccountUser
|
||||
webserviceToken: WebServiceToken, user: NintendoAccountUserCoral
|
||||
): Promise<NooklinkAuthData> {
|
||||
const { default: { coral_gws_nooklink: config } } = await import('../common/remote-config.js');
|
||||
if (!config) throw new Error('Remote configuration prevents NookLink authentication');
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { randomUUID } from 'node:crypto';
|
||||
import { Cookie, fetch, FormData, getSetCookies } from 'undici';
|
||||
import { WebServiceToken } from './coral-types.js';
|
||||
import { NintendoAccountUser } from './na.js';
|
||||
import { defineResponse, ErrorResponse } from './util.js';
|
||||
import { CoralApiInterface } from './coral.js';
|
||||
import { CoralApiInterface, NintendoAccountUserCoral } from './coral.js';
|
||||
import { ActiveFestivals, CoopResult, CoopResults, CoopSchedules, HeroRecords, LeagueMatchRankings, NicknameAndIcons, PastFestivals, Records, Result, Results, Schedules, ShareResponse, ShopMerchandises, Stages, Timeline, WebServiceError, XPowerRankingRecords, XPowerRankingSummary } from './splatnet2-types.js';
|
||||
import createDebug from '../util/debug.js';
|
||||
import { timeoutSignal } from '../util/misc.js';
|
||||
@@ -240,7 +239,7 @@ ${colour}
|
||||
});
|
||||
}
|
||||
|
||||
static async createWithCoral(coral: CoralApiInterface, user: NintendoAccountUser) {
|
||||
static async createWithCoral(coral: CoralApiInterface, user: NintendoAccountUserCoral) {
|
||||
const data = await this.loginWithCoral(coral, user);
|
||||
return {splatnet: this.createWithSavedToken(data), data};
|
||||
}
|
||||
@@ -269,14 +268,14 @@ ${colour}
|
||||
);
|
||||
}
|
||||
|
||||
static async loginWithCoral(coral: CoralApiInterface, user: NintendoAccountUser) {
|
||||
static async loginWithCoral(coral: CoralApiInterface, user: NintendoAccountUserCoral) {
|
||||
const webserviceToken = await coral.getWebServiceToken(SPLATNET2_WEBSERVICE_ID);
|
||||
|
||||
return this.loginWithWebServiceToken(webserviceToken, user);
|
||||
}
|
||||
|
||||
static async loginWithWebServiceToken(
|
||||
webserviceToken: WebServiceToken, user: NintendoAccountUser
|
||||
webserviceToken: WebServiceToken, user: NintendoAccountUserCoral
|
||||
): Promise<SplatNet2AuthData> {
|
||||
const url = new URL(SPLATNET2_WEBSERVICE_URL);
|
||||
url.search = new URLSearchParams({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { fetch, Response } from 'undici';
|
||||
import { BankaraBattleHistoriesRefetchResult, BankaraBattleHistoriesRefetchVariables, GraphQLError, GraphQLErrorResponse, GraphQLRequest, GraphQLResponse, GraphQLSuccessResponse, KnownRequestId, LatestBattleHistoriesRefetchResult, LatestBattleHistoriesRefetchVariables, MyOutfitInput, PagerUpdateBattleHistoriesByVsModeResult, PagerUpdateBattleHistoriesByVsModeVariables, PrivateBattleHistoriesRefetchResult, PrivateBattleHistoriesRefetchVariables, RegularBattleHistoriesRefetchResult, RegularBattleHistoriesRefetchVariables, RequestId, ResultTypes, VariablesTypes, XBattleHistoriesRefetchResult, XBattleHistoriesRefetchVariables } from 'splatnet3-types/splatnet3';
|
||||
import { WebServiceToken } from './coral-types.js';
|
||||
import { CoralApiInterface } from './coral.js';
|
||||
import { CoralApiInterface, NintendoAccountUserCoral } from './coral.js';
|
||||
import { NintendoAccountUser } from './na.js';
|
||||
import { BulletToken } from './splatnet3-types.js';
|
||||
import { defineResponse, ErrorResponse, HasResponse, ResponseSymbol } from './util.js';
|
||||
@@ -938,13 +938,13 @@ export default class SplatNet3Api {
|
||||
//
|
||||
//
|
||||
|
||||
async renewTokenWithCoral(coral: CoralApiInterface, user: NintendoAccountUser) {
|
||||
async renewTokenWithCoral(coral: CoralApiInterface, user: NintendoAccountUserCoral) {
|
||||
const data = await SplatNet3Api.loginWithCoral(coral, user);
|
||||
this.setTokenWithSavedToken(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
async renewTokenWithWebServiceToken(webserviceToken: WebServiceToken, user: NintendoAccountUser) {
|
||||
async renewTokenWithWebServiceToken(webserviceToken: WebServiceToken, user: NintendoAccountUserCoral) {
|
||||
const data = await SplatNet3Api.loginWithWebServiceToken(webserviceToken, user);
|
||||
this.setTokenWithSavedToken(data);
|
||||
return data;
|
||||
@@ -958,7 +958,7 @@ export default class SplatNet3Api {
|
||||
this._token_expired = false;
|
||||
}
|
||||
|
||||
static async createWithCoral(coral: CoralApiInterface, user: NintendoAccountUser) {
|
||||
static async createWithCoral(coral: CoralApiInterface, user: NintendoAccountUserCoral) {
|
||||
const data = await this.loginWithCoral(coral, user);
|
||||
return {splatnet: this.createWithSavedToken(data), data};
|
||||
}
|
||||
@@ -987,7 +987,7 @@ export default class SplatNet3Api {
|
||||
);
|
||||
}
|
||||
|
||||
static async loginWithCoral(coral: CoralApiInterface, user: NintendoAccountUser) {
|
||||
static async loginWithCoral(coral: CoralApiInterface, user: NintendoAccountUserCoral) {
|
||||
const { default: { coral_gws_splatnet3: config } } = await import('../common/remote-config.js');
|
||||
if (!config) throw new Error('Remote configuration prevents SplatNet 3 authentication');
|
||||
|
||||
@@ -997,7 +997,7 @@ export default class SplatNet3Api {
|
||||
}
|
||||
|
||||
static async loginWithWebServiceToken(
|
||||
webserviceToken: WebServiceToken, user: NintendoAccountUser
|
||||
webserviceToken: WebServiceToken, user: NintendoAccountUserCoral
|
||||
): Promise<SplatNet3AuthData> {
|
||||
const { default: { coral_gws_splatnet3: config } } = await import('../common/remote-config.js');
|
||||
if (!config) throw new Error('Remote configuration prevents SplatNet 3 authentication');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { fetch, Response } from 'undici';
|
||||
import { ActiveEvent, Announcements, CurrentUser, Event, Friend, Presence, PresencePermissions, User, WebService, WebServiceToken, CoralStatus, CoralSuccessResponse, FriendCodeUser, FriendCodeUrl, WebService_4, Media, Announcements_4, Friend_4 } from './coral-types.js';
|
||||
import { ActiveEvent, CurrentUser, Event, Friend, Presence, PresencePermissions, User, WebServiceToken, CoralStatus, CoralSuccessResponse, FriendCodeUser, FriendCodeUrl, WebService_4, Media, Announcements_4, Friend_4 } from './coral-types.js';
|
||||
import { defineResponse, ErrorResponse, ResponseSymbol } from './util.js';
|
||||
import { AbstractCoralApi, CoralApiInterface, CoralAuthData, CorrelationIdSymbol, PartialCoralAuthData, RequestFlagAddPlatformSymbol, RequestFlagAddProductVersionSymbol, RequestFlagNoParameterSymbol, RequestFlagRequestIdSymbol, RequestFlags, ResponseDataSymbol, Result } from './coral.js';
|
||||
import { NintendoAccountToken, NintendoAccountUser } from './na.js';
|
||||
|
||||
Reference in New Issue
Block a user