Skip to content

Types

client.types covers /types and /types/{id}. A type names a kind of work (journal-article, book-chapter, posted-content). Later blocks reuse the client from the first block.

import asyncio

from bibliofabric.crossref import CrossrefClient


client = CrossrefClient()


async def main() -> None:
    async with client:
        type_ = await client.types.get("journal-article")
        print(type_.id, "-", type_.label)


asyncio.run(main())
journal-article - Journal Article

The route takes no query, filter, sort, select, or paging parameters; any of those raises ConfigurationError client-side. Crossref ignores rows and offset on /types and always returns the complete list in a single response, so search(), iterate(), and count() issue one unpaged fetch:

page = await client.types.search()
print("type list:", len(page.results), "count:", await client.types.count())
type list: 30 count: 30

All works of a type

types.works(type_id) returns a works client bound to /types/{id}/works; see Works:

scoped = await client.types.works("journal-article").search(page_size=1)
print("total:", scoped.total)
total: 125596915