Le SDK de StudioCMS est un outil puissant qui vous permet d’interagir avec StudioCMS par programmation. Il fournit un ensemble de fonctions et d’utilitaires pour gérer et diffuser votre contenu via Astro DB. Il constitue également la base du tableau de bord StudioCMS et est basé sur Effect^.
Le SDK de StudioCMS est disponible sous forme de module virtuel dans votre projet Astro. Vous pouvez l’importer et l’utiliser avec la syntaxe suivante :
VanillaJS Version of the SDKCore. Most internal functions will still contain Effects, you can use runSDK from the 'studiocms:sdk' to run these as normal async functions
@example
import { SDKCoreJs, runSDK } from'studiocms:sdk';
constpages = awaitrunSDK(SDKCoreJs.GET.pages());
SDKCoreJs,
construnSDK: <A, E>(effect: Effect.Effect<A, E, never>) =>Promise<A>
Utility function for running components of the SDKCoreJs
Provides a way to write effectful code using generator functions, simplifying
control flow and error handling.
When to Use
Effect.gen allows you to write code that looks and behaves like synchronous
code, but it can handle asynchronous tasks, errors, and complex control flow
(like loops and conditions). It helps make asynchronous code more readable
and easier to manage.
The generator functions work similarly to async/await but with more
explicit control over the execution of effects. You can yield* values from
effects and return the final result at the end.
VanillaJS Version of the SDKCore. Most internal functions will still contain Effects, you can use runSDK from the 'studiocms:sdk' to run these as normal async functions
VanillaJS Version of the SDKCore. Most internal functions will still contain Effects, you can use runSDK from the 'studiocms:sdk' to run these as normal async functions
VanillaJS Version of the SDKCore. Most internal functions will still contain Effects, you can use runSDK from the 'studiocms:sdk' to run these as normal async functions