@tintup/tint-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.0.59 • Public • Published

Tint SDK

A SDK for TINT Clients. A bunch of methods that allow to building own themes.

Installation

npm install @tintup/tint-sdk

Or

yarn install @tintup/tint-sdk

Quick start

  1. Create the Tint instance: const tint = new Tint(tintSlug) You can get the tint slug by going to Tint website and creating a new Tint.
  2. After you crate the new instance you should run up method on the instance to get the basic data: tint.up().

Examples:

Pagination
const tint = new Tint('mySlug');
const { postsResponse } = await tint.up();
const links = postsResponse.links;

if (links.next) {
  const { posts: nextPosts, inks: getPageNewLinks, postsRelationships: nextPostRelationships } = await tint.getPage(
    links.next
  );
}
Long polling events
  const tint = new Tint('mySlug');
  const { pollingObserver, postsResponse } = await tint.up();

  let postsToDisplay = postsResponse.posts;

  if (pollingObserver) {
    pollingObserver.subscribe(async (posts) => {
      postsToDisplay = posts;
    });

Dependents (1)

Package Sidebar

Install

npm i @tintup/tint-sdk

Weekly Downloads

5

Version

1.0.59

License

MIT

Unpacked Size

212 kB

Total Files

28

Last publish

Collaborators

  • mikson
  • przemekprzemek
  • arturwedzicha
  • gabifija