@plasma-platform/service-uploads
v2.3.10
Published
Uploads Service API
Downloads
68
Readme
Full documentation
install:npm i @plasma-platform/service-uploads -S
Short documentation
Table of Contents
- ServiceUploads
- getHeaders
- getDocuments
- getDocument
- getFeatures
- getLicenses
- getTools
- getTopics
- getTypes
- getType
- getAuthorTemplates
- getAuthorTemplateInfo
- getAuthorTemplateUploadLink
- getAuthorScreenshotUploadLink
- createNewTemplate
- updateTemplateInfo
- validateUploadFields
- getBulkUploadErrorsById
- getSampleCsvFile
- searchBulkUploads
- uploadCsvFile
- getAuthorShareStatistics
- registrationShareProductInSocial
- removeTemplateFromUploads
- getListProductBoosts
- getListProductDiscounts
- getCriticalUpdateStatistics
- deletePlannedAuthorDiscount
- getDownloadLink
ServiceUploads
Uploads API
getHeaders
Get response headers
Parameters
response
{Object} response data
Returns Object
getDocuments
Get list of documents
Parameters
params
object
Examples
(async () => {
const service = new Service(url);
const request = await service.getDocuments();
})();
Returns Promise<any>
getDocument
Get document by id
Parameters
Examples
(async () => {
const service = new Service(url);
const request = await service.getDocument(id);
})();
Returns Promise<any>
getFeatures
Get list of template features
Parameters
params
object
Examples
(async () => {
const service = new Service(url);
const request = await service.getFeatures();
})();
Returns Promise<any>
getLicenses
Get list of template licenses
Parameters
params
object
Examples
(async () => {
const service = new Service(url);
const request = await service.getLicenses();
})();
Returns Promise<any>
getTools
Get list of template tools
Parameters
params
object
Examples
(async () => {
const service = new Service(url);
const request = await service.getTools();
})();
Returns Promise<any>
getTopics
Get list of template topics
Parameters
params
object
Examples
(async () => {
const service = new Service(url);
const request = await service.getTopics();
})();
Returns Promise<any>
getTypes
Get list of template types
Parameters
params
objectparams.expand
string? Show additional info (e.g. ?expand=fields,steps).params.sort
string? sort by any param (e.g. sort DESC by id: "?sort=-id"), Possible values: id, title, price, need_demo_urlparams.fields
string? Filter by any param (e.g. return only id filed: "?fields=id"), Possible values: id, title, price, need_demo_url, stepsparams.status
string? Filter types by status. Possible values: active, inactive
Examples
(async () => {
const service = new Service(url);
const request = await service.getTypes();
})();
Returns Promise<any>
getType
Types - Get template type
Parameters
params
object
Examples
(async () => {
const service = new Service(url);
const request = await service.getType(params);
})();
Returns Promise<any>
getAuthorTemplates
Get Author templates
Parameters
params
objectparams.state
string? filter by status id (e.g. Pending - 1; In progress - 2; Approved - 3; Soft Reject - 4; Hard Reject - 5; Deploy - 6; Deploy failed - 7;)params.states
string? filter by more then one state divided by comma (e.g. "states=1,2,3")params.stepId
string? filter by step idparams.templateId
string? filter by template idparams.hasTemplateId
number? 1 to receive uploads only with template_id, 0 to receive uploads without template_idparams.name
string? filter fieldparams.sort
string? sort by parameter (e.g. DESC sort by id: "?sort=-id"); available values [cheap, pricey, new, from doc API] // TODO: clarify sort optionsparams.perPage
number? Templates per pageparams.page
string? Templates pageparams.accessToken
string? Access token. Use either the Authorization header or the access_token query param to pass an access token.params.productStates
string? products states for filter in uploadsparams.expand
string? products expand for uploadsparams.text
string? products search textparams.shareState
string? products share state: if not shared - "0", if shared 1 to 4 - "1", if shared 5 - "2"params.isProductBoost
string? products boosted state: 0 or 1params.criticalUpdateFrom
string? Timestamp critical update fromparams.criticalUpdateTo
string? Timestamp critical update to
Examples
(async () => {
const service = new Service(url, token);
const request = await service.getAuthorTemplates({
state: 3,
stepId: 1,
templateId: 10,
hasTemplateId: true,
sort: 'price',
perPage: 20,
page: 5,
accessToken: 'He46Mlwsr6uowkPsrZCG1GYHJ8laUEcfrW1Xt6UG'
productStates: '10',
expand: 'downloadLink',
text: 'Monstroid',
shareState: 0,
isProductBoost: 1,
});
})();
Returns Promise<object> object of products list
getAuthorTemplateInfo
Get author template info
Parameters
params
object
Examples
(async () => {
const service = new Service(url, token);
const request = await service.getAuthorTemplateInfo({ id: 1 });
})();
Returns Promise<object> object of product
getAuthorTemplateUploadLink
Get author template upload link (Amazon S3)
Parameters
params
object
Examples
(async () => {
const service = new Service(url, token);
const request = await service.getAuthorTemplateUploadLink({ file: 'loremipsumdolorsitamet' });
})();
Returns Promise<object> object of product
getAuthorScreenshotUploadLink
Get author screenshot upload link (Amazon S3)
Parameters
params
object
Examples
(async () => {
const service = new Service(url, token);
const request = await service.getAuthorScreenshotUploadLink({ file: 'loremipsumdolorsitamet', id: 1});
})();
Returns Promise<object> object of product
createNewTemplate
Templates - Create new template
Parameters
params
objectparams.name
string Template name. (required)params.type
string Template type ID. (required)params.file
string File name which has been saved into S3 (required)params.templateId
number? real template ID (if template is already released and update is needed)params.price
number? Template priceparams.authorComment
string? author review commentparams.isExclusive
boolean? if template sold exclusively on TMparams.isOnSale
boolean? if template can be sold on saleparams.isOnLoyalty
boolean? If template will take part in loyalty programparams.isOnAffiliate
boolean? If template will take part in affiliate programparams.changelog
string? template changelogparams.licenses
Array<number>? Product Licenses IDs.params.support
Array<Object>? Support types.params.media
Array<Object>? Additional media content.params.properties
object? Template properties.
string
string [].type] - Support type(1 - Tickets, 2 - Email, 3 - Phone, 4 - Chat).string
string [].measure] - Support measure (day, minute, hour).number
number [].value] - Measure value.string
string [].phone] - Support phone if needed.string
string [].url] - Media url.string
string [].type] - Media type (image | video).string
string [].slot] - Media view slot (slider | presentational | main).
Examples
(async () => {
const service = new Service(url, token);
const request = await service.createNewTemplate({
name: "Some brand new WP Template",
type: 'wordpress-templates',
file: "wp-v1-brand-new.zip",
templateId: null,
price: null,
authorComment: "Some comments from template author",
isExclusive: false,
isOnSale: true,
isOnLoyalty: true,
isOnAffiliate: false,
changelog: null,
licenses: [],
support: [],
media: [],
properties: {},
});
})();
Returns Promise<userInfo>
updateTemplateInfo
Templates - Update template info
Parameters
params
objectparams.id
number Template ID (required)params.name
string Template name. (required)params.type
string Template type ID. (required)params.file
string File name which has been saved into S3 (required)params.price
number Template price (required)params.authorComment
string? author review commentparams.isExclusive
boolean? if template sold exclusively on TMparams.isOnSale
boolean? if template can be sold on saleparams.isOnLoyalty
boolean? If template will take part in loyalty programparams.isOnAffiliate
boolean? If template will take part in affiliate programparams.changelog
string? template changelogparams.licenses
Array<number>? Product Licenses IDs.params.support
Array<Object>? Support types.params.media
Array<Object>? Additional media content.params.properties
object? Template properties.
string
string [].type] - Support type(1 - Tickets, 2 - Email, 3 - Phone, 4 - Chat).string
string [].measure] - Support measure (day, minute, hour).number
number [].value] - Measure value.string
string [].phone] - Support phone if needed.string
string [].url] - Media url.string
string [].type] - Media type (image | video).string
string [].slot] - Media view slot (slider | presentational | main).
Examples
(async () => {
const service = new Service(url, token);
const request = await service.updateTemplateInfo({
id: 3498,
name: "Some brand new WP Template",
type: 'wordpress-templates',
file: "wp-v1-brand-new.zip",
price: null,
authorComment: "Some comments from template author",
isExclusive: false,
isOnSale: true,
isOnLoyalty: true,
isOnAffiliate: false,
changelog: null,
licenses: [],
support: [],
media: [],
properties: {},
});
})();
Returns Promise<userInfo>
validateUploadFields
Templates - Validate
Parameters
params
object
Examples
(async () => {
const service = new Service(url, token);
const request = await service.validateUploadFields(params);
})();
Returns Promise<userInfo>
getBulkUploadErrorsById
BulkUpload - Get errors by upload item
Parameters
id
string Bulk upload id (required)
Examples
(async () => {
const service = new Service(url, token);
const request = await service.getBulkUploadErrorsById(id);
})();
Returns Promise<any>
getSampleCsvFile
BulkUpload - Get sample CSV files
Parameters
typeUrl
string Type Url (required)
Examples
(async () => {
const service = new Service(url);
const request = await service.getSampleCsvFile(typeUrl);
})();
Returns Promise<any>
searchBulkUploads
BulkUpload - Search bulk uploads
Parameters
params
objectparams.ids
string? Array of id divided by comma (e.g. "1,2"). Max count items 50params.typeIds
string? Array of type id divided by comma (e.g. "6,8"). Max count items 50params.status
number? Statusparams.perPage
number? Max items per one page (50 is max size). default = 20params.page
number? Page number to view. default = 1params.sort
string? Sort. Defines on which fields to sort (e.g. ?sort=-id) ("-" symbol is DESC sort). default = id
Examples
(async () => {
const service = new Service(url, token);
const request = await service.searchBulkUploads(params);
})();
Returns Promise<any>
uploadCsvFile
BulkUpload - Upload csv file
Parameters
params
object
Examples
(async () => {
const service = new Service(url, token);
const request = await service.uploadCsvFile(params);
Returns Promise<userInfo>
getAuthorShareStatistics
Get author share statistics
Parameters
params
objectparams.accessToken
string Access token. Use either the Authorization header or the access_token query param to pass an access token.
Examples
(async () => {
const service = new Service(url, token);
const request = await service.getAuthorShareStatistics({});
})();
Returns Promise<object> object of product
registrationShareProductInSocial
Registration share product in social network
Parameters
params
object
Examples
(async () => {
const service = new Service(url, token);
const request = await service.registrationShareProductInSocial({});
})();
Returns Promise<object> object of product
removeTemplateFromUploads
Registration share product in social network
Parameters
params
object
Examples
(async () => {
const service = new Service(url, token);
const request = await service.removeTemplateFromUploads({templateId: 55555});
})();
Returns Promise<object> object of product
getListProductBoosts
Get list product boost
Examples
(async () => {
const service = new Service(url, token);
const request = await service.getListProductBoosts();
})();
Returns Promise<object> object of boosts
getListProductDiscounts
Get list product discounts
Examples
(async () => {
const service = new Service(url, token);
const request = await service.getListProductDiscounts();
})();
Returns Promise<object> object of discounts
getCriticalUpdateStatistics
Get critical update statistics
Examples
(async () => {
const service = new Service(url, token);
const request = await service.getCriticalUpdateStatistics();
})();
Returns Promise<object> object of discounts
deletePlannedAuthorDiscount
Delete planned author discount
Examples
(async () => {
const service = new Service(url, token);
const request = await service.deletePlannedAuthorDiscount();
})();
Returns Promise<object> object of discounts
getDownloadLink
Get download link
Parameters
params
objectparams.accessToken
string Access token. Use either the Authorization header or the access_token query param to pass an access token.params.id
number Upload Id (required)params.user_id
number User idparams.product_id
number Find last upload by product idparams.user_login
string User loginparams.user_ip
string User ipparams.user_agent
string User Agentparams.user_referer
string User refererparams.access_token
string Access token. Use either the Authorization header or the access_token query param to pass an access token.
Examples
(async () => {
const service = new Service(url, token);
const request = await service.getDownloadLink({ id: 1 });
})();