ComicVineApi
1.0.0
واجهة برمجة تطبيقات .NET جميلة تغلف واجهة برمجة تطبيقات Comic Vine REST الرائعة.
ستحتاج إلى مفتاح API من https://comicvine.com/api.
هناك ثلاث طرق رئيسية للعثور على/جلب المعلومات:
بالنسبة لكل مورد، يمكنك بسهولة طلب عنصر محدد في سطر واحد من التعليمات البرمجية:
// create the client
var client = new ComicVineClient ( " <API-KEY> " , " <CUSTOM-USER-AGENT> " ) ;
// request the Batgirl (Cassandra Cain) character
var cassie = await client . Character . GetAsync ( 65230 ) ;
// print something out
Console . WriteLine ( $" { cassie . Name } was born on { cassie . Birth } . " ) ;
عامل التصفية الأساسي مع القيم:
// create the client
var client = new ComicVineClient ( " <API-KEY> " , " <CUSTOM-USER-AGENT> " ) ;
// request the female Cain family characters
var females = client . Character . Filter ( )
. WithValue ( x => x . Name , " Cain " )
. WithValue ( x => x . Gender , Gender . Female ) ;
// fetch the first result (all fields)
var first = await females . FirstOrDefaultAsync ( ) ;
// print something out
Console . WriteLine ( $" { first . Name } was born on { first . Birth } . " ) ;
التصفية مع الحقول المخفضة للحمولات الأصغر:
// create the client
var client = new ComicVineClient ( " <API-KEY> " , " <CUSTOM-USER-AGENT> " ) ;
// request the female Cain family characters
var females = client . Character . Filter ( )
. WithValue ( x => x . Name , " Cain " )
. WithValue ( x => x . Gender , Gender . Female ) ;
// just fetch minimal data (id, name, birth)
var smallPayload = females
. IncludeField ( x => x . Id )
. IncludeField ( x => x . Name )
. IncludeField ( x => x . Birth ) ;
// fetch all the results on the page
var page = await smallPayload . ToListAsync ( ) ;
// fetch all the items on all the pages
foreach ( var character in page )
{
// print something out
Console . WriteLine ( $" { character . Name } was born on { character . Birth } . " ) ;
}
قم بالتكرار على جميع النتائج الموجودة على الخادم (عبر استدعاءات API المتعددة):
// create the client
var client = new ComicVineClient ( " <API-KEY> " , " <CUSTOM-USER-AGENT> " ) ;
// request the female Cain family characters
var females = client . Character . Filter ( )
. WithValue ( x => x . Name , " Cain " )
. WithValue ( x => x . Gender , Gender . Female ) ;
// fetch all the items on all the pages
await foreach ( var character in filter . ToAsyncEnumerable ( ) )
{
// print something out
Console . WriteLine ( $" { character . Name } was born on { character . Birth } . " ) ;
}
المهام: إضافة المستندات
المهام: إضافة المستندات