Skip to content

Commit

Permalink
Wrap docs at 80ch
Browse files Browse the repository at this point in the history
  • Loading branch information
sliekens committed Nov 1, 2024
1 parent d81842e commit d67bc14
Show file tree
Hide file tree
Showing 8 changed files with 380 additions and 74 deletions.
16 changes: 13 additions & 3 deletions docs/guide/getting-started/authentication.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
# Authentication

The library provides methods to retrieve information about a player account, such as the characters, bank, inventory, wallet, unlocked skins, etc. You need a valid access token to use these methods.
The library provides methods to retrieve information about a player account, such
as the characters, bank, inventory, wallet, unlocked skins, etc. You need a valid
access token to use these methods.

``` csharp
var characters = await gw2.Accounts.GetCharacters(
accessToken: "API key or subtoken"
);
```

To obtain an API key, you need a Guild Wars 2 account and log in to <https://account.arena.net/applications>, create a New Key, and store it somewhere safely in your application secrets (not in source control.)
To obtain an API key, you need a Guild Wars 2 account and log in to
<https://account.arena.net/applications>, create a New Key, and store it
somewhere safely in your application secrets (not in source control.)

You can use the `TokenProvider` class to validate an access token that you received from someone else. You can also use it to create a subtoken with a shorter time-to-live or with fewer privileges. This is useful if you wish to give someone else limited access to your account. For example: if you build a modular application that can be extended with 3rd-party plugins, you may ask the user for a full-access master token and then create a subtoken for each plugin, giving it only the permissions it needs and the time it needs.
You can use the `TokenProvider` class to validate an access token that you received
from someone else. You can also use it to create a subtoken with a shorter time-to-live
or with fewer privileges. This is useful if you wish to give someone else limited
access to your account. For example: if you build a modular application that can
be extended with 3rd-party plugins, you may ask the user for a full-access master
token and then create a subtoken for each plugin, giving it only the permissions
it needs and the time it needs.
2 changes: 1 addition & 1 deletion docs/guide/getting-started/formatted-text.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ For example:
```text
Double-click to apply to an unused infusion slot. Adds a festive glow.
<c=@Warning>Warning!</c>
<c=@Flavor>Captain's Council recommends avoiding direct contact with this substance.</c>"
<c=@Flavor>Captain's Council recommends avoiding direct contact with this substance.</c>
```

Which is rendered as:
Expand Down
362 changes: 314 additions & 48 deletions docs/guide/getting-started/game-link.md

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions docs/guide/getting-started/translations.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Translations

Some API methods return localized data, and you can pass a `Language` object to control the language of the text returned by the API. English is used if you don't specify any language, or if the specified language is not supported.
Some API methods return localized data, and you can pass a `Language` object to
control the language of the text returned by the API. English is used if you don't
specify any language, or if the specified language is not supported.

Currently the supported languages are:

Expand All @@ -10,7 +12,11 @@ Currently the supported languages are:
- French
- Chinese

In .NET, you typically set `CultureInfo.CurrentUICulture` to the user's preferred language. However, GW2SDK does not use this setting. Instead, you should pass a `Language` object to the API methods that support it. You can use the `Language.CurrentUICulture` static property to get the current UI culture as a `Language` object.
In .NET, you typically set `CultureInfo.CurrentUICulture` to the user's preferred
language. However, GW2SDK does not use this setting. Instead, you should pass a
`Language` object to the API methods that support it. You can use the
`Language.CurrentUICulture` static property to get the current UI culture as a
`Language` object.

[!code-csharp[](~/samples/Translations/Program.cs)]

Expand Down
31 changes: 19 additions & 12 deletions docs/guide/overview/installation.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,48 @@
# Installation

The recommended way to install the Guild Wars 2 SDK is to use the [NuGet package][nuget]. You can install the package from the command line using the .NET CLI.
The recommended way to install the Guild Wars 2 SDK is to use the [NuGet package][nuget].
You can install the package from the command line using the .NET CLI.

``` sh
dotnet add package GW2SDK
```

## Development packages

You can install development packages from GitHub from [here][packages]. These packages are updated on every commit to the main branch and versioned by number of git commits since the last release. (Format: 1.0.0-preview.0.123)
You can install development packages from GitHub from [here][packages]. These packages
are updated on every commit to the main branch and versioned by number of git commits
since the last release. (Format: 1.0.0-preview.0.123)

First create a personal access token [here][tokens] with the _read:packages_ scope. Then run the following command.
First create a personal access token [here][tokens] with the _read:packages_ scope.
Then run the following command.

``` sh
dotnet nuget add source https://nuget.pkg.github.com/sliekens/index.json --name sliekens --username <USERNAME> --password <TOKEN>
dotnet nuget add source https://nuget.pkg.github.com/sliekens/index.json \
--name sliekens \
--username <USERNAME> --password <TOKEN>
```

Replace:

- USERNAME with the name of your user account on GitHub.
- TOKEN with your personal access token.
Replace `USERNAME` with the name of your user account on GitHub.
Replace `TOKEN` with your personal access token.

By default, your token is stored in encrypted format in your user directory.

- Windows: `%appdata%\NuGet\NuGet.Config`
- Mac/Linux: `~/.config/NuGet/NuGet.Config` or `~/.nuget/NuGet/NuGet.Config` (varies by OS distribution)
- Mac/Linux: `~/.config/NuGet/NuGet.Config` or `~/.nuget/NuGet/NuGet.Config`
(varies by OS distribution)

Encryption is not supported on every platform. If you get an error, try the command again with `--store-password-in-clear-text`.
Encryption is not supported on every platform. If you get an error, try the
command again with `--store-password-in-clear-text`.

## Uninstalling development packages

To stop using development packages, you can remove the NuGet source from your machine. This will remove the source and your token.
To stop using development packages, you can remove the NuGet source from your
machine. This will remove the source and your token.

``` sh
dotnet nuget remove source sliekens
```

[tokens]:https://github.com/settings/tokens
[packages]:https://github.com/sliekens/gw2sdk/packages
[nuget]:https://www.nuget.org/packages/GW2SDK/
[nuget]:https://www.nuget.org/packages/GW2SDK/
19 changes: 13 additions & 6 deletions docs/guide/overview/introduction.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# Introduction

GW2SDK is a .NET code library for interacting with the Guild Wars 2 API and game client.
GW2SDK is a .NET code library for interacting with the Guild Wars 2 API and game
client.

The Guild Wars 2 API is accessible over HTTPS. It provides information about the game, your account, PvP seasons, WvW matches and the in-game economy.
The Guild Wars 2 API is accessible over HTTPS. It provides information about the
game, your account, PvP seasons, WvW matches and the in-game economy.

The game client on Windows provides realtime information about the player's movement in the world and the location and size of UI elements.
The game client on Windows provides realtime information about the player's movement
in the world and the location and size of UI elements.

## Features

The SDK provides an interface to the Guild Wars 2 API and game client. It is designed to be easy to use and to provide a high level of performance.
The SDK provides an interface to the Guild Wars 2 API and game client. It is designed
to be easy to use and to provide a high level of performance.

It provides the following features and benefits:

Expand All @@ -24,7 +28,8 @@ It provides the following features and benefits:
The package has the following entrypoint classes:

- `GuildWars2.Gw2Client` provides access to the API,
- `GuildWars2.GameLink` provides realtime information from the game client (Windows only)
- `GuildWars2.GameLink` provides realtime information from the game client
(Windows only)

## Platform support

Expand All @@ -39,4 +44,6 @@ GW2SDK is compiled for .NET Standard 2.0 so it supports a wide range of platform
- Universal Windows Platform 10.0.16299+
- Unity 2018.1+

Retrieving information from the game client is only supported on Windows due to the use of named memory-mapped files. It might work in Wine, but it has not been tested.
Retrieving information from the game client is only supported on Windows due to
the use of named memory-mapped files. It might work in Wine, but it has not been
tested.
4 changes: 4 additions & 0 deletions docs/template/public/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
div.content {
max-width: 80ch;
word-wrap: break-word;
}
10 changes: 8 additions & 2 deletions samples/Mumble/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
host.Logging.AddSimpleConsole(
options =>
{
options.SingleLine = true;
options.SingleLine = false;
options.TimestampFormat = "HH:mm:ss.fff ";
options.UseUtcTimestamp = true;
}
Expand Down Expand Up @@ -118,7 +118,13 @@ void OnNext(GameTick gameTick)
{
var transport = gameTick.Context.IsMounted ? gameTick.Context.Mount.ToString() : "foot";
logger.LogInformation(
"[{UiTick}] {Name}, {Title} ({Specialization}) is on {Transport} in {Map} ({Type}), Position: {{ Latitude = {X}, Longitude = {Z}, Elevation = {Y} }}",
"""
[{UiTick}] {Name}, {Title} ({Specialization}) is on {Transport}
Map : {Map} ({Type})
Latitude : {X}
Longitude : {Z}
Elevation : {Y}
""",
gameTick.UiTick,
identity.Name,
title,
Expand Down

0 comments on commit d67bc14

Please sign in to comment.