TabNewsClientCore 1.0.8

dotnet add package TabNewsClientCore --version 1.0.8
                    
NuGet\Install-Package TabNewsClientCore -Version 1.0.8
                    
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="TabNewsClientCore" Version="1.0.8" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TabNewsClientCore" Version="1.0.8" />
                    
Directory.Packages.props
<PackageReference Include="TabNewsClientCore" />
                    
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 TabNewsClientCore --version 1.0.8
                    
#r "nuget: TabNewsClientCore, 1.0.8"
                    
#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 TabNewsClientCore@1.0.8
                    
#: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=TabNewsClientCore&version=1.0.8
                    
Install as a Cake Addin
#tool nuget:?package=TabNewsClientCore&version=1.0.8
                    
Install as a Cake Tool

TabNewsClientCore - SDK C# para TabNews (.NET 8.0)

NuGet

SDK não-oficial em C# para interagir com a API do TabNews - Uma plataforma de notícias e conteúdo baseada em comunidade.

📦 Instalação

Via NuGet Package Manager

Install-Package TabNewsClientCore

Via .NET CLI

dotnet add package TabNewsClientCore

🚀 Uso Rápido

Obter Informações do Usuário

using TabNewsClientCore;

// Obter dados do usuário
var user = TabNewsApi.GetUser("nome_usuario");
Console.WriteLine($"Usuário: {user.Username}");
Console.WriteLine($"TabCoins: {user.TabCoins}");

Obter Conteúdo Específico

// Buscar um artigo específico
var content = TabNewsApi.GetContent("nome_usuario", "slug-do-artigo");
Console.WriteLine($"Título: {content.Title}");
Console.WriteLine($"Corpo: {content.Body}");

Listar Conteúdos com Paginação

// Obter conteúdos com paginação
var response = TabNewsApi.GetContents("nome_usuario", perPage: 10, page: 1);
Console.WriteLine($"Total de posts: {response.TotalPosts}");
foreach (var post in response.Contents)
{
    Console.WriteLine($"- {post.Title}");
}

Obter Últimos 10 Posts de um Usuário

// Busca automaticamente todos os posts até encontrar 10
var posts = TabNewsApi.Get10LastedPosts("nome_usuario");
Console.WriteLine($"Posts obtidos: {posts.Count}");

📚 Referência de Classes

TabNewsApi (Classe Principal)

Classe estática que contém todos os métodos para interagir com a API.

Métodos
  • GetUser(ownerUsername) - Obtém informações de um usuário
  • GetContent(ownerUsername, slug) - Obtém um conteúdo específico
  • GetContents(ownerUsername, perPage, page, strategy) - Lista conteúdos com paginação
  • Get10LastedPosts(ownerUsername, perPage, page) - Obtém os últimos 10 posts

Entities

TabNewsUser

Representa as informações de um usuário.

public class TabNewsUser
{
    public string? Id { get; set; }
    public string? Username { get; set; }
    public string? Email { get; set; }
    public string? Description { get; set; }
    public bool Notifications { get; set; }
    public List<string>? Features { get; set; }
    public int TabCoins { get; set; }
    public int TabCash { get; set; }
    public DateTime CreatedAt { get; set; }
    public DateTime UpdatedAt { get; set; }
}
TabNewsContent

Representa um artigo ou comentário.

public class TabNewsContent
{
    public string? Id { get; set; }
    public string? OwnerId { get; set; }
    public string? ParentId { get; set; }
    public string? Slug { get; set; }
    public string? Title { get; set; }
    public string? Body { get; set; }
    public string? Status { get; set; }
    public string? SourceUrl { get; set; }
    public DateTime CreatedAt { get; set; }
    public DateTime UpdatedAt { get; set; }
    public DateTime PublishedAt { get; set; }
    public DateTime? DeletedAt { get; set; }
    public string? OwnerUsername { get; set; }
    public int TabCoins { get; set; }
    public int TabCoinsCredit { get; set; }
    public int TabCoinsDebit { get; set; }
    public int ChildrenDeepCount { get; set; }
}
TabNewsContentResponse

Resposta paginada para requisições de conteúdo.

public class TabNewsContentResponse
{
    public int TotalPosts { get; set; }
    public int Page { get; set; }
    public int PageSize { get; set; }
    public List<TabNewsContent> Contents { get; set; }
}
TabNewsException

Exceção específica lançada por operações da API.

public class TabNewsException : Exception
{
    // Construtores padrão
}

🔄 Migração do TabNewsCSharpSDK

Este projeto é a versão .NET 8.0 moderna do TabNewsCSharpSDK (Framework 4.7.2).

Principais Mudanças

  • ✅ .NET 8.0 (com suporte a versões anteriores via multi-targeting)
  • ✅ Nullable reference types habilitados
  • ✅ Propriedades em PascalCase (conforme conventions C#)
  • ✅ Use of latest RestSharp (v113.0.0)
  • ✅ XML documentation comments
  • ✅ Melhor tratamento de null values

Compatibilidade de API

A API pública é praticamente idêntica ao SDK antigo, com as seguintes mudanças:

Antigo Novo
id (propriedades) Id
owner_id OwnerId
parent_id ParentId
etc. PascalCase para todas as propriedades

🛠️ Dependências

  • RestSharp (>= 113.0.0)
  • Newtonsoft.Json (>= 13.0.4)
  • .NET 8.0 ou superior

📝 Exemplo Completo

using TabNewsClientCore;
using TabNewsClientCore.Entities;

// 1. Obter informações do usuário
var user = TabNewsApi.GetUser("nome_usuario");
Console.WriteLine($"Usuário: {user.Username}");
Console.WriteLine($"TabCoins: {user.TabCoins}");

// 2. Listar artigos do usuário
var posts = TabNewsApi.Get10LastedPosts(user.Username);
Console.WriteLine($"Últimos {posts.Count} posts:");
foreach (var post in posts)
{
    Console.WriteLine($"- {post.Title} ({post.TabCoins} tabcoins)");
}

// 3. Obter um artigo específico
var article = TabNewsApi.GetContent(user.Username, posts[0].Slug);
Console.WriteLine($"Artigo: {article.Body}");

⚠️ Tratamento de Erros

try
{
    var user = TabNewsApi.GetUser("nome_usuario");
}
catch (TabNewsException ex)
{
    Console.WriteLine($"Erro ao obter usuário: {ex.Message}");
}

📄 Licença

MIT

👤 Autor

Programador Raiz

🤝 Contribuições

Contribuições são bem-vindas! Sinta-se livre para abrir issues ou pull requests.


Nota: Este é um SDK não-oficial. Para questões sobre a API, visite tabnews.com.br

Product 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 was computed.  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.

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
1.0.8 113 12/27/2025
1.0.7 108 12/27/2025
1.0.6 106 12/27/2025
1.0.5 112 12/27/2025
1.0.4 109 12/27/2025
1.0.3 112 12/27/2025
1.0.2 192 12/25/2025

Correção crítica: Adicionado mapeamento correto JSON para deserialização das entidades (snake_case para PascalCase)