anecdotica-api-client
1.0.0
dotnet add package anecdotica-api-client --version 1.0.0
NuGet\Install-Package anecdotica-api-client -Version 1.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="anecdotica-api-client" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="anecdotica-api-client" Version="1.0.0" />
<PackageReference Include="anecdotica-api-client" />
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 anecdotica-api-client --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: anecdotica-api-client, 1.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 anecdotica-api-client@1.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=anecdotica-api-client&version=1.0.0
#tool nuget:?package=anecdotica-api-client&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
📖 Описание
AnecdoticaAPI — это .NET-клиент для работы с API анекдотов, который берет данные с api http://anecdotica.ru/offer/api.html#3.1. Он упрощает взаимодействие с сервисом, предоставляя удобные методы для получения случайных анекдотов, поиска по категории, фильтруя по цензурности, белого, черного листа.
🚀 Установка
dotnet add package AnecdoticaAPI
🌠 Использование
Инициализация клиента
using AnecdoticaAPI;
using AnecdoticaAPI.Models;
using AnecdoticaAPI.Requests;
var client = new AnecdoticaApiClient(config =>
{
config.Pid = "pid который вам выдали на сайте API";
config.Token = "Если предпочтете использовать токен в запросах";
config.SecureKey = "Секретный ключ так же выдается на сайте API, дугой метод аутентификации более безопасный";
config.SendType = SendType.ByHash; // ByHash - аутентификация происходит с помощью хеша более безопасно
// ByToken - аутентификация на основе токена
config.ApiLevel = ApiLevel.Lvl1;
// ApiLevel.Lvl1
// ApiLevel.Lvl2
// ApiLevel.Lvl3
// ApiLevel.Lvl4 - Lvl приобретается на сайте API относительно Lvl api будет доступно больше функций
});
Вызов метода
var response = await client.GetItemsAsync(new GetItemsRequest
{
CategoryType = CategoryType.All, // Категория анекдотов
GenreType = GenreType.All, // Жанр анекдота
Series = AnecdoteSeries.All, // Серия анекдота, т.е из какой стихии Армянское радио,Винни-Пух и все-все-все. и т.д
Country = Country.All, // Страна
LangType = (LangType)0, // Язык анекдотов
ResponseFormat = (ResponseFormat)0, // В каком формате будет ответ json, xml, txt, html
CharsetType = (CharsetType)0, // Кодировка
MarkupType = MarkupType.Off, // Флаг html-разметки
NoteType = NoteType.Off, // Флаг примечания
WhiteListType = WhiteListType.Off, // Будут ли анекдоты из white-list
CensorType = CensorType.Off, // Цензурность
Ipp = 0, // Кол-во анекдотов на страницу
Page = 0 // Номер страницы
});
Результат ответа
var response = await client.GetRandItemAsync(new GetRandItemRequest
{
ResponseFormat = ResponseFormat.Xml,
});
Console.WriteLine(response.ResponseFormat); // ResponseFormat.Xml
Console.WriteLine(response.JsonResponse); // null
Console.WriteLine(response.StringResponse); // Xml строка
К каждому методу и запросу написана xml документация
📝 Контакты
Если у тебя есть вопросы, пиши:
📧 Email: cdbacjdorz@yandex.ru
🐙 Telegram: https://t.me/daammirka
📌 Официальная документация
По ссылке вы можете ознакомиться с ценами и документацией API
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Newtonsoft.Json (>= 13.0.3)
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.0 | 167 | 3/15/2025 |