Giter Club home page Giter Club logo

cms-sdk's Introduction

CMS360 SDK Documentation (JS)

Report a bug/issue ๐Ÿชฒ

Prerequisite: Your API Key (16 digits alphanumeric). Head over to our website to create yours for free!

Installation

  • Unpkg

    <script src="https://unpkg.com/@pyvot360/cms" type="module" ></script>
    
  • NPM

    npm i @pyvot360/cms
    
  • YARN

    yarn add @pyvot360/cms
    

Import

```
const {ClientSDK} = require("@pyvot360/cms");
// import {ClientSDK} from "@pyvot360/cms";

const sdk = new ClientSDK('YOUR-API-KEY');
```

Methods

  • sdk.getAll() (async) Fetches all articles
  • sdk.getById(articleId: string) (async) Fetches one article by id
  • sdk.getByUrl(articleUrl: string) (async) Fetches one article by url string
  • sdk.getTopics() (async) Fetches all topics
  • sdk.search(filters: ArticleFilters) * (async) Fetches articles related to search filters
  • sdk.viewed(articleId: string) (async) Updates the view count of an article
Note: All methods are async (return a promise). You may choose to handle that using await or .then()

Types & Interfaces

export declare interface Article {
    id?: string;
    title: string;
    author: Partial<Author>;
    banner: string;
    content: string;
    tags: string[];
    stats?: ArticleStats;
    dateWritten?: number;
    dateEditted?: number;
    isPublished: boolean;
    _secondaryKey?: string;
    url?: string;
}

export declare interface ArticleStats {
    views: number;
}

export declare interface Author {
    name?: string;
    bio?: string;
    email?: string;
    avatar?: string;
}

export declare interface ArticleFilters {
    title?: string;
    tag?: string;
    author?: string;
}

export declare class ClientSDK {
    constructor(key: string);
    getAll():  Promise<Article[]>;
    getById(articleId: string): Promise<Article | undefined>;
    getByUrl(articleUrl: string): Promise<Article | undefined>;
    getTopics(): Promise<string[]>;
    search(filters: ArticleFilters): Promise<Article[]>;
    viewed(articleId: string);
}

cms-sdk's People

Contributors

jerryoluranti avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.