@plasma-platform/tm-service-collections

3.0.3 • Public • Published

Service Collections

Documentation

Table of Contents

CollectionsService

  • See: //api.templatemonster.com/collection/v2/

collections Micro Service API that you may adopt for your needs

Parameters

  • url string service url
  • token (string | null) user access tocken if available (optional, default null)

messages

Object with class service messages

getColectionItemsById

Get list of collection items of collection specified by collection_id

Examples

Read collection items list

(async () => {
  const collections = new CollectionsService('//api.templatemonster.com/collection/v2/');
  const items = await collections.getColectionItemsById('mfsgxst31slvddqz0miv');
})();

Returns CollectionItemsList array of items

getCollectionsOfUser

Get list of collections of user

Parameters

  • name string collection name
  • page number page
  • perPage number collections per page, 0 for all

Examples

Get Favorites Collection

(async () => {
  const collections = new CollectionsService('//api.templatemonster.com/collection/v2/');
  const items = await collections.getCollectionsOfUser();
})();

Returns CollectionList collections

postCollection

Add new collection

Parameters

Examples

Create collection

(async () => {
  const collections = new CollectionsService('//api.templatemonster.com/collection/v2/');
  const item = await collections.postCollection('Favorites');
})();

Returns Collection collection object

postItem

Add new collection item

Parameters

Examples

Favorite item

(async () => {
  const collections = new CollectionsService('//api.templatemonster.com/collection/v2/');
  const item = await collections.postItem('mfsgxst31slvddqz0miv', 'template-67020');
})();

Returns CollectionItem record in the collection

deleteItem

Delete Collection Item

Parameters

  • id number id of the record in the collection

Examples

Remove from collection

(async () => {
  const collections = new CollectionsService('//api.templatemonster.com/collection/v2/');
  await collections.deleteItem(2342);
})();

Array

Collection items list object

Type: CollectionItemsList

Properties

  • null-null Array<CollectionItem> array of items

Post

Collection item object

Type: CollectionItem

Properties

  • id number collection item id
  • collection_id string collection id
  • item_name string item name
  • description string description
  • created_at number creation timestamp
  • updated_at number update timestamp

/@plasma-platform/tm-service-collections/

    Package Sidebar

    Install

    npm i @plasma-platform/tm-service-collections

    Weekly Downloads

    0

    Version

    3.0.3

    License

    CC-BY-4.0

    Unpacked Size

    1.59 MB

    Total Files

    34

    Last publish

    Collaborators

    • alienmonster
    • ch-tm
    • viram