npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@plasma-platform/service-products

v3.1.0

Published

Products Service API

Downloads

98

Readme

version nextVersion downloads license dependency


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

Short documentation

Table of Contents

ServiceProducts

Parameters

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

messages

Object with class service messages

Type: object

getPossibleSuggestions

Get possible suggestions

Parameters

  • text text search suggests texts

Examples

(async () => {
  const service = new Service('http://service-products.dev/api/v1/', token);
  const request = await service.getPossibleSuggests('53001');
})();

Returns Promise<object> array with fined products

disableTemplate

Disable template

Parameters

Examples

(async () => {
  const service = new Service('http://service-products.dev/api/v1/', token);
  const request = await service.disableTemplate(53001);
})();

Returns Promise<object> object of disable product

freezeTemplate

Freeze template

Parameters

Examples

(async () => {
  const service = new Service('http://service-products.dev/api/v1/', token);
  const request = await service.freezeTemplate(53001);
})();

Returns Promise<object> object 0f freeze product

removedTemplate

Removed template

Parameters

Examples

(async () => {
  const service = new Service('http://service-products.dev/api/v1/', token);
  const request = await service.removedTemplate(53001);
})();

Returns Promise<object> object 0f freeze product

getTemplateByIdPublic

Get template by id (public method)

Parameters

  • props object
    • props.expand number expand information
    • props.ids string list of templates id divided by comma (e.g. "55555,55556,55557")
    • props.locale string 2 char locale (en, ru de, etc.)

Examples

(async () => {
  const service = new Service('http://service-products.dev/api/v1/');
  const request = await service.getTemplateByIdPublic({locale: 'en', ids: 53000});
)();

Returns Promise<object> object of product

getTemplateById

Get template by id

Parameters

  • props object
    • props.expand number expand information
    • props.ids string list of templates id divided by comma (e.g. "55555,55556,55557")

Examples

(async () => {
  const service = new Service('http://service-products.dev/api/v1/', token);
  const request = await service.getTemplateById(53001);
})();

Returns Promise<object> object of product

getTemplatesTopics

Get templates topics

Parameters

  • props object
    • props.isAdult number return only adult or not templates
    • props.ids string array of templates id divided by comma (e.g. "55555,55556,55557")
    • props.searchWord string
    • props.properties object array of properties where key is a property name and value is a value to search. e.g. (?properties[author_user_id]=1506970)
    • props.type string find all templates with given type name (e.g. "?type=wordpress", "?type=wordpress themes")

Examples

(async () => {
  const service = new Service('http://service-products.dev/api/v1/');
  const request = await service.getTemplatesTopics({
isAdult: 1,
ids: '53001',
searchWord: 'qwe',
properties: {
id: 2570,
propertyName: 'Name of the template',
},
type: 'wordpress',
});
})();

Returns Promise<object> object of topics products list

getTemplatesTypes

Get templates types

Parameters

  • props object
    • props.isAdult number return only adult or not templates
    • props.ids string array of templates id divided by comma (e.g. "55555,55556,55557")
    • props.searchWord string
    • props.properties object array of properties where key is a property name and value is a value to search. e.g. (?properties[author_user_id]=1506970)

Examples

(async () => {
  const service = new Service('http://service-products.dev/api/v1/');
  const request = await service.getTemplatesTypes({
isAdult: 1,
ids: '53001',
searchWord: 'qwe',
properties: {
id: 2570,
propertyName: 'Name of the template',
},
});
})();

Returns Promise<object> object of types products list

getTemplates

Get templates

Parameters

  • props object
    • props.isAdult number return only adult or not templates
    • props.ids string array of templates id divided by comma (e.g. "55555,55556,55557")
    • props.searchWord string
    • props.properties object array of properties where key is a property name and value is a value to search. e.g. (?properties[author_user_id]=1506970)
    • props.type string find all templates with given type name (e.g. "?type=wordpress", "?type=wordpress themes")
    • props.sort string available value [cheap, pricey, new, from doc API]
    • props.perPage number max templates per one page (20 by default, 200 is max size)
    • props.page number page number to view
    • props.filterTopic string topic id
    • props.filterUser string vendor id
    • props.filterPlatform string platform name [wordpress, joomla, ...]

Examples

(async () => {
  const service = new Service('http://service-products.dev/api/v1/', token);
  const request = await service.getTemplates({
isAdult: 1,
ids: '53001',
searchWord: 'qwe',
properties: {
id: 2570,
propertyName: 'Name of the template',
},
type: 'wordpress',
sort: 'price',
perPage: 20,
page: 1,
});
})();

Returns Promise<object> object of products list

getTemplatesPublic

Get templates public

Parameters

  • props object
    • props.isAdult number return only adult or not templates
    • props.ids string array of templates id divided by comma (e.g. "55555,55556,55557")
    • props.searchWord string
    • props.properties object array of properties where key is a property name and value is a value to search. e.g. (?properties[author_user_id]=1506970)
    • props.type string find all templates with given type name (e.g. "?type=wordpress", "?type=wordpress themes")
    • props.sort string available value [cheap, pricey, new, from doc API]
    • props.perPage number max templates per one page (20 by default, 200 is max size)
    • props.page number page number to view
    • props.filterTopic string topic id
    • props.filterUser string vendor id
    • props.filterPlatform string platform name [wordpress, joomla, ...]

Examples

(async () => {
  const service = new Service('http://service-products.dev/api/v1/', token);
  const request = await service.getTemplatesPublic({
isAdult: 1,
ids: '53001',
searchWord: 'qwe',
properties: {
id: 2570,
propertyName: 'Name of the template',
},
type: 'wordpress',
sort: 'price',
perPage: 20,
page: 1,
});
})();

Returns Promise<object> object of products list

getTotalTemplatesSales

Get total templates sales

Parameters

  • props object
    • props.isAdult number return only adult or not templates
    • props.ids string array of templates id divided by comma (e.g. "55555,55556,55557")
    • props.searchWord string
    • props.properties object array of properties where key is a property name and value is a value to search. e.g. (?properties[author_user_id]=1506970)
    • props.type string find all templates with given type name (e.g. "?type=wordpress", "?type=wordpress themes")

Examples

(async () => {
  const service = new Service('http://service-products.dev/api/v1/');
  const request = await service.getTotalTemplatesSales({
isAdult: 1,
ids: '53001',
searchWord: 'qwe',
properties: {
id: 2570,
propertyName: 'Name of the template',
},
type: 'wordpress',
});
})();

Returns Promise<object> object of templates total sales value

getUserOwnProducts

Get user own products

Parameters

  • props object
    • props.locale string 2 char locale (en, ru de, etc.)
    • props.properties object array of properties where key is a property name and value is a value to search. e.g. (?properties[author_user_id]=1506970)
    • props.type string find all templates with given type name (e.g. "?type=wordpress", "?type=wordpress themes")
    • props.sort string defines on which fields to sort (e.g. ?sort=price,-templateId) ("-" symbol is DESC sort)
    • props.perPage number max templates per one page (20 by default, 200 is max size)
    • props.page number page number to view

Examples

(async () => {
  const service = new Service('http://service-products.dev/api/v1/products/', token);
  const request = await service.getUserOwnProducts({
properties: {
id: 2570,
propertyName: 'Name of the template',
},
type: 'wordpress',
sort: 'price',
perPage: 20,
page: 1,
});
})();

Returns Promise<object> object of product parameters

getUserOwnProductsHead

Get user own products heads

Parameters

  • props object
    • props.locale string 2 char locale (en, ru de, etc.)
    • props.properties object array of properties where key is a property name and value is a value to search. e.g. (?properties[author_user_id]=1506970)
    • props.type string find all templates with given type name (e.g. "?type=wordpress", "?type=wordpress themes")
    • props.sort string defines on which fields to sort (e.g. ?sort=price,-templateId) ("-" symbol is DESC sort)
    • props.perPage number max templates per one page (20 by default, 200 is max size)
    • props.page number page number to view

Examples

(async () => {
  const service = new Service('http://service-products.dev/api/v1/products/', token);
  const request = await service.getUserOwnProductsHead({
properties: {
id: 2570,
propertyName: 'Name of the template',
},
type: 'wordpress',
sort: 'price',
perPage: 20,
page: 1,
});
})();

Returns Promise<object> object of product parameters

undoDisableProcess

Undo disable process

Parameters

Examples

(async () => {
  const service = new Service('http://service-products.dev/api/v1/products/', token);
  const request = await service.undoDisableProcess(53001);
})();

Returns Promise<object> object of product

undoFreezeProcess

Undo freeze process

Parameters

Examples

(async () => {
  const service = new Service('http://service-products.dev/api/v1/products/', token);
  const request = await service.undoFreezeProcess(53001);
})();

Returns Promise<object> object of product

undoRemovedProcess

Undo removed process

Parameters

Examples

(async () => {
  const service = new Service('http://service-products.dev/api/v1/products/', token);
  const request = await service.undoRemovedProcess(53001);
})();

Returns Promise<object> object of product

updateUserRatingAndTotalReviewsCount

Update user rating and total reviews count

Parameters

  • props object
    • props.templateId number Reviewed template id
    • props.reviewsAverageScore number Review score
    • props.reviewsTotal number Total amount of reviews for this template

Examples

(async () => {
  const service = new Service('http://service-products.dev/api/v1/', token);
  const request = await service.updateUserRatingAndTotalReviewsCount({
templateId: 53001,
reviewsAverageScore: 123,
reviewsTotal: 123,
});
})();

Returns Promise<object> object of updated product parameters

getProductsBySpecificParams

Search products by specific params (only v2)

Parameters

Examples

(async () => {
  const service = new Service('//api.templatemonsterdev.com/products/v2/');
  const request = await service.getProductsBySpecificParams({ locale: 'en' });
})();

Returns Promise<object> object product parameters