TabuaMare.SDK 2.0.0

dotnet add package TabuaMare.SDK --version 2.0.0
                    
NuGet\Install-Package TabuaMare.SDK -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TabuaMare.SDK" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TabuaMare.SDK" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="TabuaMare.SDK" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TabuaMare.SDK --version 2.0.0
                    
#r "nuget: TabuaMare.SDK, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TabuaMare.SDK@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TabuaMare.SDK&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=TabuaMare.SDK&version=2.0.0
                    
Install as a Cake Tool

Tábua de Maré — cliente C#

Cliente .NET para consultar a API REST de Tábua de Maré do Brasil (v2). A biblioteca encapsula as requisições HTTP, desserializa as respostas JSON e oferece métodos tipados para estados, portos, tábuas mensais e consultas por geolocalização.

Requisitos

  • .NET 9.0 ou superior
  • Uma API key da Tábua de Maré para endpoints autenticados e limites ampliados

Instalação

dotnet add package TabuaMare.SDK

Ou adicione diretamente ao .csproj:

<PackageReference Include="TabuaMare.SDK" Version="2.0.0" />

Autenticação

A chave é informada na configuração do cliente. Passe somente o valor da chave; não inclua o prefixo Bearer.

using TabuaMare;

var client = new TabuaMareClient(new TabuaMareClientOptions
{
    ApiKey = Environment.GetEnvironmentVariable("TABUAMARE_API_KEY")
});

O cliente envia a chave nos headers Authorization: Bearer <api_key> e X-Api-Key: <api_key>. A explicação completa está na documentação sobre API key.

Exemplos

Listar estados e portos

using TabuaMare;

var client = new TabuaMareClient();
var states = await client.GetStatesAsync();
var harbors = await client.GetHarborsByStateAsync("pb");

Console.WriteLine(string.Join(", ", states));
foreach (var harbor in harbors)
    Console.WriteLine($"{harbor.Id}: {harbor.Name}");

Consultar a tábua de um porto

var tables = await client.GetTideTableAsync(
    harborId: "pb01",
    month: 1,
    days: new[] { 1, 2, 3 });

foreach (var month in tables[0].Months)
foreach (var day in month.Days)
    Console.WriteLine($"Dia {day.Day}: {day.Hours.Count} eventos");

Encontrar o porto mais próximo

var nearest = await client.GetNearestHarborAsync(-7.11509, -34.86414);
Console.WriteLine($"{nearest.Name} ({nearest.Id})");

As respostas seguem os tipos retornados pela API v2. Os IDs de porto são strings, como pb01 e pe02.

Desenvolvimento

dotnet test tests/TabuaMare.Tests/TabuaMare.Tests.csproj
dotnet pack src/TabuaMare/TabuaMare.csproj --configuration Release

Licença

MIT.

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 93 9/3/2026