TabNewsClientCore 1.0.8
dotnet add package TabNewsClientCore --version 1.0.8
NuGet\Install-Package TabNewsClientCore -Version 1.0.8
<PackageReference Include="TabNewsClientCore" Version="1.0.8" />
<PackageVersion Include="TabNewsClientCore" Version="1.0.8" />
<PackageReference Include="TabNewsClientCore" />
paket add TabNewsClientCore --version 1.0.8
#r "nuget: TabNewsClientCore, 1.0.8"
#:package TabNewsClientCore@1.0.8
#addin nuget:?package=TabNewsClientCore&version=1.0.8
#tool nuget:?package=TabNewsClientCore&version=1.0.8
TabNewsClientCore - SDK C# para TabNews (.NET 8.0)
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árioGetContent(ownerUsername, slug)- Obtém um conteúdo específicoGetContents(ownerUsername, perPage, page, strategy)- Lista conteúdos com paginaçãoGet10LastedPosts(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.0ou 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
🔗 Links
🤝 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 | 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 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. |
-
net8.0
- Newtonsoft.Json (>= 13.0.4)
- RestSharp (>= 113.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Correção crítica: Adicionado mapeamento correto JSON para deserialização das entidades (snake_case para PascalCase)