🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@plasma-platform/service-collections

Package Overview
Dependencies
Maintainers
5
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@plasma-platform/service-collections

Collections Service api

latest
npmnpm
Version
3.5.0
Version published
Maintainers
5
Created
Source

version nextVersion downloads license dependency

Full documentation
install:
npm i @plasma-platform/service-collections -S

Short 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

Type: Object

getCollectionById

Get collection information specified by collection_id

Parameters

Examples

Read collection info

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

Returns Collection collection object

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 object 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 object 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 object 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);
})();

getCollections

Get list of collections

Parameters

  • params object object of params.
    • params.page number Page number.
    • params.ids array Array Collection unique ID.
    • params.names array Array Collection Name.
    • params.name string Array Collection unique ID.
    • params.expand string Get additional fields. Collection items are visible only if "expand=items" param is in request

Examples

(async () => {
  const service = new CollectionsService(serviceUrl);
  const collections = await service.getCollections(params);
})();

Returns object collection list & pagination

getMyCollections

Get my list of collections

Parameters

  • params object object of params.
    • params.page number Page number.
    • params.ids array Array Collection unique ID.
    • params.names array Array Collection Name.
    • params.name string Array Collection unique ID.
    • params.expand string Get additional fields. Collection items are visible only if "expand=items" param is in request

Examples

(async () => {
  const service = new CollectionsService(serviceUrl);
  const collections = await service.getCollections(params);
})();

Returns object collection list & pagination

mergeCollections

Collection - Merge Collections

Parameters

  • targetCollectionId string Target collection unique ID.
  • sourceCollectionId string Source collection unique ID.

Examples

(async () => {
  const service = new CollectionsService(serviceUrl);
  const collections = await service.mergeCollections(targetCollectionId, sourceCollectionId);
})();

Returns object collection data

Keywords

TM Micro Service

FAQs

Package last updated on 07 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts