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

    1.0.6 • Public • Published

    JavaScript library for Modyo's headless API (node & browser)

    JavaScript SDK for the Modyo headless API. It helps you to easily access your content stored in Modyo with your JavaScript applications. This project was bootstrapped with TSDX.

    Supported browsers and Node.js versions:

    • Chrome
    • Firefox
    • Edge
    • IE11+
    • Safari
    • node.js (8.x)

    Installation

    With npm:

    npm install @modyo/sdk

    For yarn users:

    yarn add @modyo/sdk

    Usage

    import { Client } from '@modyo/sdk';
    
    const msdk = new Client('ModyoAccountURL');
    # To access public content
    const ctype = msdk.getContentType('spaceUID', 'typeUID');
    # To acces private content (user must be logged in on account)
    const ctype = msdk.getContentType('spaceUID', 'typeUID', false);
    # To preview content type's JSON Schema
    ctype.getSchema().then(sch => console.log('Content Type JSON Schema:', sch));
    # To preview content searchable attributes (requires loaded schema)
    ctype.getSchema().then(() => console.log('Content Type Attrs:', ctype.getAttrs()));
    # To view all entries
    const entries = ctype.getEntries();
    # To create Filters (supported: Before, After, LessThan, GreaterThan, In, NotIn, Has)
    const filters = ctype.Filter().Before('meta.created_at','2020-05-01').In('meta.tag',['tag1','tag2'])
    # Then search with such filters
    ctype.getEntries(filters).then(data => console.log(data))
    # JSONPath and Sorting are also supported as filters
    const filters = ctype.Filter().SortBy('meta.created_at', 'desc').JSONPath('$..uuid')
    

    Local Development

    Below is a list of commands you will probably find useful.

    npm start or yarn start

    Runs the project in development/watch mode. Your project will be rebuilt upon changes. TSDX has a special logger for you convenience. Error messages are pretty printed and formatted for compatibility VS Code's Problems tab.

    Your library will be rebuilt if you make edits.

    npm run build or yarn build

    Bundles the package to the dist folder. The package is optimized and bundled with Rollup into multiple formats (CommonJS, UMD, and ES Module).

    npm test or yarn test

    Runs the test watcher (Jest) in an interactive mode. By default, runs tests related to files changed since the last commit.

    Install

    npm i @modyo/sdk

    DownloadsWeekly Downloads

    109

    Version

    1.0.6

    License

    ISC

    Unpacked Size

    107 kB

    Total Files

    17

    Last publish

    Collaborators

    • johannrp27
    • portega
    • giorgiosaud
    • rriveras
    • jsilvamodyo