What Does the Kentico Cloud TypeScript SDK Offer?
The Kentico Cloud TypeScript SDK offers tooling that enables the clean and easy consumption of the Delivery API by providing three core features:
- Strongly-typed base models for the core Delivery objects
- An extensible Delivery client API that makes querying easy
- Customizable resolvers for resolving URL slugs and modular content
In addition to these SDK features, there’s also a code generator available to help you easily and automatically generate strongly typed models for your Kentico Cloud project. This can help you save some serious time building out the models for your content types. Both the SDK and the code generator are available as npm packages.
Strongly-typed Base Models
The base models provided in the SDK enable you to get moving quickly. They cover the basics, like the base content item, the system properties, and field types (text field, Multiple choice field, Date/Time field, etc.). These make it easy to build out your content type models easily. As previously mentioned, you can use the Kentico Cloud model generator utility to generate your models automatically. For example, a simple blog content item might look something like:
Extensible Client API
The TypeScript SDK also provides a robust implementation of the Delivery API. It provides a configurable Delivery client that supports:
- Getting data using the observable or promise patterns
- Using query parameters such as content type, depth, limit, order, etc.
- Filtering content items by element value with filters such as equals, greater than, range, etc.
- Sorting results
- Getting localized items (for projects with multiple languages)
Using that same blog post model, the code to retrieve all blog posts would look like this:
How Do I Use It?
Richard also built a second, more complex example. This example demonstrates the use of the Kentico Cloud TypeScript SDK in a simple Angular app. If you’re familiar with Angular, this might be a good place to start.
If React is more your style, stay tuned! I'm putting together a sample site built on React with the TypeScript SDK. It's designed to show a complete example using the default content you get when you first sign up for Kentico Cloud.
The Kentico Cloud TypeScript SDK will continue to evolve based on Kentico Cloud updates and community direction, feedback, and pull requests. The Kentico Cloud team is also looking to add SDKs for other programming languages. If you have any ideas or an SDK you developed that you want to make available to everyone, let us know in the forums! In the meantime, why not grab the latest version of the SDK and the generator utility from npm and get started on your own project!