tm-products-service v1.3.1
Documentation
ServiceProducts
Extends TMMicroServiceAPI
Parameters
props...anyurlstring service urltoken(string | null) user access token if available (optional, defaultnull)
messages
Object with class service messages
constructor
constructor of instance
Parameters
Examples
const service = new Service(url, token);Returns object service SDK object
post
Disable template
Parameters
templateIdnumber
Examples
(async () => {
const service = new Service('http://service-products.dev/api/v1/products/:id/disable', token);
const request = await service.disableTemplate(53001);
})();Returns Promise<any>
post
Freeze template
Parameters
templateIdnumber
Examples
(async () => {
const service = new Service('http://service-products.dev/api/v1/products/:id/freeze', token);
const request = await service.freezeTemplate(53001);
})();Returns Promise<any>
post
Undo disable process
Parameters
templateIdnumber
Examples
(async () => {
const service = new Service('http://service-products.dev/api/v1/products/:id/undisable', token);
const request = await service.undoDisableProcess(53001);
})();Returns Promise<any>
post
Undo freeze process
Parameters
templateIdnumber
Examples
(async () => {
const service = new Service('http://service-products.dev/api/v1/products/:id/unfreeze', token);
const request = await service.undoFreezeProcess(53001);
})();Returns Promise<any>
post
Update user rating and total reviews count
Parameters
propsobject
Examples
(async () => {
const service = new Service('http://service-products.dev/api/v1/product-listeners/update-review-counters', token);
const request = await service.updateUserRatingAndTotalReviewsCount({
templateId: 53001,
reviewsAverageScore: 123,
reviewsTotal: 123,
});
})();Returns Promise<any>
get
Get template by id (public method)
Parameters
Examples
(async () => {
const service = new Service('http://service-products.dev/api/v1/products/:locale/:id');
const request = await service.getTemplateByIdPublic('en', 53001);
})();Returns Promise<any>
get
Get template by id
Parameters
templateIdnumber
Examples
(async () => {
const service = new Service('http://service-products.dev/api/v1/products/:id', token);
const request = await service.getTemplateById(53001);
})();Returns Promise<any>
get
Get templates (public method)
Parameters
localestring 2 char locale (en, ru de, etc.)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. (?propertiesauthor_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/:locale');
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<any>
get
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. (?propertiesauthor_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/products/topics');
const request = await service.getTemplatesTopics({
isAdult: 1,
ids: '53001',
searchWord: 'qwe',
properties: {
id: 2570,
propertyName: 'Name of the template',
},
type: 'wordpress',
});
})();Returns Promise<any>
get
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. (?propertiesauthor_user_id=1506970)
Examples
(async () => {
const service = new Service('http://service-products.dev/api/v1/products/types');
const request = await service.getTemplatesTypes({
isAdult: 1,
ids: '53001',
searchWord: 'qwe',
properties: {
id: 2570,
propertyName: 'Name of the template',
},
});
})();Returns Promise<any>
get
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. (?propertiesauthor_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.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<any>
get
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. (?propertiesauthor_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/products/sales');
const request = await service.getTotalTemplatesSales({
isAdult: 1,
ids: '53001',
searchWord: 'qwe',
properties: {
id: 2570,
propertyName: 'Name of the template',
},
type: 'wordpress',
});
})();Returns Promise<any>
get
Get user own products
Parameters
localestring 2 char locale (en, ru de, etc.)propsobjectprops.propertiesobject array of properties where key is a property name and value is a value to search. e.g. (?propertiesauthor_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/:locale/my', token);
const request = await service.getUserOwnProducts({
properties: {
id: 2570,
propertyName: 'Name of the template',
},
type: 'wordpress',
sort: 'price',
perPage: 20,
page: 1,
});
})();Returns Promise<any>