@plasma-platform/tm-service-products
v2.1.7
Published
Products Service API
Readme
Documentation
Table of Contents
ServiceProducts
Parameters
messages
Object with class service messages
disableTemplate
Disable template
Parameters
templateIdnumber template ID
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
templateIdnumber template ID
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
getTemplateByIdPublic
Get template by id (public method)
Parameters
propsobject
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
propsobject
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
propsobjectprops.isAdultnumber return only adult or not templatesprops.idsstring array of templates id divided by comma (e.g. "55555,55556,55557")props.searchWordstringprops.propertiesobject array of properties where key is a property name and value is a value to search. e.g. (?properties[author_user_id]=1506970)props.typestring 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
propsobjectprops.isAdultnumber return only adult or not templatesprops.idsstring array of templates id divided by comma (e.g. "55555,55556,55557")props.searchWordstringprops.propertiesobject 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
propsobjectprops.isAdultnumber return only adult or not templatesprops.idsstring array of templates id divided by comma (e.g. "55555,55556,55557")props.searchWordstringprops.propertiesobject array of properties where key is a property name and value is a value to search. e.g. (?properties[author_user_id]=1506970)props.typestring find all templates with given type name (e.g. "?type=wordpress", "?type=wordpress themes")props.sortstring available value [cheap, pricey, new, from doc API]props.perPagenumber max templates per one page (20 by default, 200 is max size)props.pagenumber page number to viewprops.filterTopicstring topic idprops.filterUserstring vendor idprops.filterPlatformstring 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
propsobjectprops.isAdultnumber return only adult or not templatesprops.idsstring array of templates id divided by comma (e.g. "55555,55556,55557")props.searchWordstringprops.propertiesobject array of properties where key is a property name and value is a value to search. e.g. (?properties[author_user_id]=1506970)props.typestring find all templates with given type name (e.g. "?type=wordpress", "?type=wordpress themes")props.sortstring available value [cheap, pricey, new, from doc API]props.perPagenumber max templates per one page (20 by default, 200 is max size)props.pagenumber page number to viewprops.filterTopicstring topic idprops.filterUserstring vendor idprops.filterPlatformstring 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
propsobjectprops.isAdultnumber return only adult or not templatesprops.idsstring array of templates id divided by comma (e.g. "55555,55556,55557")props.searchWordstringprops.propertiesobject array of properties where key is a property name and value is a value to search. e.g. (?properties[author_user_id]=1506970)props.typestring 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
propsobjectprops.localestring 2 char locale (en, ru de, etc.)props.propertiesobject array of properties where key is a property name and value is a value to search. e.g. (?properties[author_user_id]=1506970)props.typestring find all templates with given type name (e.g. "?type=wordpress", "?type=wordpress themes")props.sortstring defines on which fields to sort (e.g. ?sort=price,-templateId) ("-" symbol is DESC sort)props.perPagenumber max templates per one page (20 by default, 200 is max size)props.pagenumber 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
undoDisableProcess
Undo disable process
Parameters
templateIdnumber template ID
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
templateIdnumber template ID
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
updateUserRatingAndTotalReviewsCount
Update user rating and total reviews count
Parameters
propsobject
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' });
})();