mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-07-19 00:43:35 -05:00
Update documentation
This commit is contained in:
parent
29b8923c5b
commit
b26f71f930
40
docs/cli.md
40
docs/cli.md
|
|
@ -414,6 +414,46 @@ nxapi nooklink reactions
|
|||
nxapi nooklink post-reaction happyflower
|
||||
```
|
||||
|
||||
SplatNet 3
|
||||
---
|
||||
|
||||
All SplatNet 3 commands may automatically request a web service token. This will involve the imink/flapg API (or a custom server). This can be disabled by setting `--no-auto-update-session`, however this will cause commands to fail if there isn't a valid SplatNet 3 token.
|
||||
|
||||
### User
|
||||
|
||||
```sh
|
||||
# Show the authenticated SplatNet 3 user
|
||||
nxapi splatnet3 user
|
||||
```
|
||||
|
||||
### Download battle/Salmon Run results
|
||||
|
||||
```sh
|
||||
# Download battle and Salmon Run results to the splatnet3 directory in nxapi's data path
|
||||
# Data that already exists will not be redownloaded
|
||||
nxapi splatnet3 dump-results
|
||||
# Download battle and Salmon Run results to data/splatnet3
|
||||
nxapi splatnet3 dump-results data/splatnet3
|
||||
|
||||
# Only download battle results
|
||||
nxapi splatnet3 dump-results --no-coop
|
||||
# Only download Salmon Run results
|
||||
nxapi splatnet3 dump-results --no-battles
|
||||
```
|
||||
|
||||
### Friends
|
||||
|
||||
```sh
|
||||
# Show Nintendo Switch friends who have played Splatoon 3 in a table
|
||||
# This shows more information about in-game activities than `nxapi nso friends`
|
||||
# Friends that are online and selected in a game will appear as online, even if they are not playing Splatoon 3
|
||||
nxapi splatnet3 friends
|
||||
|
||||
# JSON
|
||||
nxapi splatnet3 friends --json
|
||||
nxapi splatnet3 friends --json-pretty-print
|
||||
```
|
||||
|
||||
Nintendo Switch Parental Controls
|
||||
---
|
||||
|
||||
|
|
|
|||
61
docs/lib/splatnet3.md
Normal file
61
docs/lib/splatnet3.md
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
`nxapi/splatnet3`
|
||||
---
|
||||
|
||||
### `SplatNet3Api`
|
||||
|
||||
> This is exported as `default`.
|
||||
|
||||
SplatNet 3 API client. An instance of this class should not be created directly; instead one of the `createWith*` static methods should be used.
|
||||
|
||||
Most of this API is intentionally undocumented. Read the source code at [src/api/splatnet3.ts](../../src/api/splatnet3.ts), [src/common/auth/splatnet3.ts](../../src/common/auth/splatnet3.ts) and [src/cli/splatnet3](../../src/cli/splatnet3) for examples of using this API. If you need any help using this API ask in [#splatnet3](https://discordapp.com/channels/998657768594608138/998664939537440820) on Discord.
|
||||
|
||||
You should review HTTP captures of SplatNet 3 in the Nintendo Switch Online app and attempt to match the behaviour of Nintendo's official app.
|
||||
|
||||
#### `SplatNet3Api.createWithCoral`
|
||||
|
||||
Authenticate to SplatNet 3 using a `CoralApi` instance.
|
||||
|
||||
> This function should not be called often. If your project will create a new SplatNet3Api object again for the same user before the SplatNet 3 authentication token expires (usually after 2 hours), you must store the `data` object this returns and use `SplatNet3Api.createWithSavedToken`.
|
||||
|
||||
```ts
|
||||
import CoralApi, { CoralAuthData } from 'nxapi/coral';
|
||||
import SplatNet3Api, { SplatNet3AuthData } from 'nxapi/splatnet3';
|
||||
|
||||
const coral: CoralApi;
|
||||
const coral_auth_data: CoralAuthData;
|
||||
|
||||
const {splatnet, data} = await SplatNet3Api.createWithCoral(coral, coral_auth_data.user);
|
||||
// splatnet instanceof SplatNet3Api
|
||||
// data is a plain object of type SplatNet3AuthData
|
||||
// data should be saved and reused
|
||||
```
|
||||
|
||||
#### `SplatNet3Api.createWithSavedToken`
|
||||
|
||||
Create a SplatNet3Api instance using cached data from `SplatNet3Api.createWithCoral` or `SplatNet3Api.loginWithCoral`.
|
||||
|
||||
```ts
|
||||
import SplatNet3Api, { SplatNet3AuthData } from 'nxapi/splatnet3';
|
||||
|
||||
const auth_data: SplatNet3AuthData;
|
||||
|
||||
const splatnet = SplatNet3Api.createWithSavedToken(auth_data);
|
||||
// splatnet instanceof SplatNet3Api
|
||||
```
|
||||
|
||||
#### `SplatNet3Api.createWithCliTokenData`
|
||||
|
||||
Create a SplatNet3Api instance using the output of the `nxapi splatnet3 token --json` command.
|
||||
|
||||
```ts
|
||||
import SplatNet3Api, { SplatNet3CliTokenData } from 'nxapi/splatnet3';
|
||||
|
||||
const data: SplatNet3CliTokenData;
|
||||
|
||||
const splatnet = SplatNet3Api.createWithCliTokenData(data);
|
||||
// splatnet instanceof SplatNet3Api
|
||||
```
|
||||
|
||||
### API types
|
||||
|
||||
`nxapi/splatnet3` exports all API types from [src/api/splatnet3-types.ts](../../src/api/splatnet3-types.ts).
|
||||
|
|
@ -923,7 +923,10 @@ export interface HomeResult {
|
|||
};
|
||||
};
|
||||
banners: HomeBanner[];
|
||||
/** Only includes online friends that have played Splatoon 3, even if they are currently playing a different game */
|
||||
/**
|
||||
* Only includes up to 3 online friends that have played Splatoon 3, even if they are currently
|
||||
* playing a different game. `totalCount` also only counts online friends.
|
||||
*/
|
||||
friends: NodeList<HomeFriend, true>;
|
||||
footerMessages: HomeFooterMessage[];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -451,9 +451,9 @@ const ZNCA_API_USE_TEXT = `To access the Nintendo Switch Online app API, nxapi m
|
|||
By default, this uses the imink API, but another service can be used by setting an environment variable. The default API may change without notice if you do not force use of a specific service.
|
||||
|
||||
The data sent includes:
|
||||
- A random UUID and the current timestamp
|
||||
- (When authenticating to the Nintendo Switch Online app) An ID token, containing your Nintendo Account ID and country, which is valid for 15 minutes
|
||||
- (When authenticating to game-specific services) An ID token, containing your Coral (Nintendo Switch Online app) user ID, Nintendo Switch Online membership status, and Nintendo Account child restriction status, which is valid for 2 hours`;
|
||||
|
||||
- When authenticating to the Nintendo Switch Online app: a Nintendo Account ID token, containing your Nintendo Account ID and country, which is valid for 15 minutes
|
||||
- When authenticating to game-specific services: a Coral (Nintendo Switch Online app) ID token, containing your Coral user ID, Nintendo Switch Online membership status, and Nintendo Account child restriction status, which is valid for 2 hours`;
|
||||
|
||||
async function askZncaApiUseAllowed(window?: BrowserWindow): Promise<boolean> {
|
||||
const options: MessageBoxOptions = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user