CNinnovation.Codebreaker.GamesClient
3.8.0
Prefix Reserved
dotnet add package CNinnovation.Codebreaker.GamesClient --version 3.8.0
NuGet\Install-Package CNinnovation.Codebreaker.GamesClient -Version 3.8.0
<PackageReference Include="CNinnovation.Codebreaker.GamesClient" Version="3.8.0" />
<PackageVersion Include="CNinnovation.Codebreaker.GamesClient" Version="3.8.0" />
<PackageReference Include="CNinnovation.Codebreaker.GamesClient" />
paket add CNinnovation.Codebreaker.GamesClient --version 3.8.0
#r "nuget: CNinnovation.Codebreaker.GamesClient, 3.8.0"
#:package CNinnovation.Codebreaker.GamesClient@3.8.0
#addin nuget:?package=CNinnovation.Codebreaker.GamesClient&version=3.8.0
#tool nuget:?package=CNinnovation.Codebreaker.GamesClient&version=3.8.0
CNinnovation.Codebreaker.GamesClient
This library contains the GamesClient class to communicate with the Codebreaker service, and model types that are used for the communication.
See https://github.com/codebreakerapp for more information on the complete solution.
See Codebreakerlight for a simple version of the Codebreaker solution with a Wiki to create your own Codebreaker service.
The GamesClient class and IGamesClient interface
The IGamesClient class is the main contract to be used for communication to play the game. It contains the following methods:
| Method | Description |
|---|---|
StartGameAsync |
Start a new game |
SetMoveAsync |
Set guesses for a game move |
GetGameAsync |
Get a game by id with all details and moves |
GetGamesAsync |
Get a list of games with all details and moves (use the GamesQuery class to define the filter) |
The GamesClient class implements the IGamesClient interface. In the constructor, inject the HttpClient class. You can use Microsoft.Extensions.Http to configure the HttpClient class.
Model types
The following model types are used to return information about the game.
| Model type | Description |
|---|---|
GameType |
Enum value to list different game types |
GamesQuery |
Use this class to query for game info lists using GetGamesAsync |
GameInfo |
Contains the game id, the game status, the game moves and the game result |
MoveInfo |
Contains the move number, the guess and the result of the guess. Contained within a GameInfo |
How to use
The following code snippet shows how to use the GamesClient class to play the game.
Configure the DI container with the GamesClient class (use the NuGet package Microsoft.Extensions.Http to configure the HttpClient class):
services.AddHttpClient<IGamesClient, GamesClient>(client =>
{
client.BaseAddress = new Uri("https://localhost:5001");
});
Start a game:
(Guid id, int numberCodes, int maxMoves, IDictionary<string, string[]> fieldValues) = await gamesClient.StartGameAsync("Game6x4", "player1");
Set a move:
(string[] result, bool ended, bool isVictory) = await gameClient.SetMoveAsync(id, "Game6x4", [ "Red", "Green", "Blue", "Yellow" ]);
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
-
net9.0
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on CNinnovation.Codebreaker.GamesClient:
| Package | Downloads |
|---|---|
|
CNInnovation.Codebreaker.ViewModels
This library contains shared view-model types for the Codebreaker app. See https://github.com/codebreakerapp for more information on the complete solution. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.8.0 | 486 | 11/16/2024 |
| 3.7.0 | 451 | 5/27/2024 |
| 3.6.0-beta.24 | 170 | 3/28/2024 |
| 3.6.0-beta.23 | 193 | 2/12/2024 |
| 3.6.0-beta.21 | 187 | 1/12/2024 |