@jungvonmatt/contentful-client
v6.0.0
Published
Shared Contentful Management API client helpers
Downloads
213
Readme
@jungvonmatt/contentful-client
Shared Contentful API toolkit (Management + Delivery + Helpers) for the JvM Contentful toolchain.
This is a low-level support package used by @jungvonmatt/contentful-ssg,
@jungvonmatt/contentful-config, @jungvonmatt/contentful-fakes, and
@jungvonmatt/contentful-typings. It is published so those packages can
resolve their shared runtime dependency outside the pnpm workspace.
Note: This is an internal-only package published to npm for use by internal tools.
Install
npm install @jungvonmatt/contentful-clientModules
Management API
import {
getManagementClient,
getSpaces,
getEnvironment,
} from "@jungvonmatt/contentful-client";getManagementClient(options)— create or reuse a Management API plain clientgetSpaces(options)— fetch all accessible spacesgetSpace(options)— fetch a single space byspaceIdgetEnvironments(options)— fetch all environments for a spacegetEnvironment(options)— fetch and validate one environment byenvironmentIdgetApiKey(options)— fetch the first delivery API key for a spacegetPreviewApiKey(options)— fetch the first preview API key for a spacegetOrganizations(options)— fetch accessible organizationsgetWebhooks(options)— fetch webhooks for a spaceaddWebhook(options, id, data)— get or create a webhook with a deterministic IDdeleteWebhook(options, id)— delete a webhook by IDresetManagementClient()— clear the cached client instance (for tests)
Delivery API
import {
getClient,
getContent,
getLocales,
getContentTypes,
} from "@jungvonmatt/contentful-client";getClient(options)— create or reuse a Delivery/Preview API clientgetContent(options)— fetch all entries and assets for a space/environmentgetLocales(options)— fetch available localesgetContentTypes(options)— fetch all content typesgetEntriesLinkedToEntry(options, entryId)— reverse-link lookup for entriesgetEntriesLinkedToAsset(options, assetId)— reverse-link lookup for assetsresetClient()— clear the cached client instance (for tests)MAX_ALLOWED_LIMIT— page-size constant used internally
Helpers
import {
isEntry,
isAsset,
isLink,
getContentTypeId,
convertToMap,
} from "@jungvonmatt/contentful-client";- Type guards:
isEntry,isAsset,isLink,isAssetLink,isEntryLink,isContentfulObject - ID extractors:
getContentTypeId,getContentId,getEnvironmentId - Converters:
convertToMap,getFieldSettings - Field-type constants:
FIELD_TYPE_SYMBOL,FIELD_TYPE_TEXT,FIELD_TYPE_RICHTEXT, etc.
Related packages
| Package | Role |
| -------------------------------- | ---------------------------------------------------------------- |
| @jungvonmatt/contentful-config | Generates .contentfulrc.json (credentials + space/environment) |
| @jungvonmatt/contentful-client | Uses config for API access (Management + Delivery) |
| @jungvonmatt/contentful-ssg | Orchestrates SSG builds with content from contentful-client |
