@plasma-platform/service-uploads

Uploads Service API

Usage no npm install needed!

<script type="module">
  import plasmaPlatformServiceUploads from 'https://cdn.skypack.dev/@plasma-platform/service-uploads';
</script>

README

version nextVersion downloads license dependency


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

Short documentation

Table of Contents

ServiceUploads

Uploads API

getHeaders

Get response headers

Parameters

  • response {Object} response data

Returns Object

getDocuments

Get list of documents

Parameters

  • params object
    • params.type number? Template type for search.
    • params.locale string? Document locale for search.
    • params.url string? Document url for search.

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
    • params.sort string? sort by any param (e.g. sort DESC by id: "?sort=-id"), Possible values: id, name
    • params.fields string? Filter by any param (e.g. return only id filed: "?fields=id"), Possible values: id, name

Examples

(async () => {
  const service = new Service(url);
  const request = await service.getFeatures();
})();

Returns Promise<any>

getLicenses

Get list of template licenses

Parameters

  • params object
    • params.sort string? sort by any param (e.g. sort DESC by id: "?sort=-id"), Possible values: id, name, price, description
    • params.fields string? Filter by any param (e.g. return only id filed: "?fields=id"), Possible values: id, name, price, description

Examples

(async () => {
  const service = new Service(url);
  const request = await service.getLicenses();
})();

Returns Promise<any>

getTools

Get list of template tools

Parameters

  • params object
    • params.sort string? sort by any param (e.g. sort DESC by id: "?sort=-id"), Possible values: id, name
    • params.fields string? Filter by any param (e.g. return only id filed: "?fields=id"), Possible values: id, name

Examples

(async () => {
  const service = new Service(url);
  const request = await service.getTools();
})();

Returns Promise<any>

getTopics

Get list of template topics

Parameters

  • params object
    • params.sort string? sort by any param (e.g. sort DESC by id: "?sort=-id"), Possible values: id, name, icon, lft, rgt, depth
    • params.fields string? Filter by any param (e.g. return only id filed: "?fields=id"), Possible values: id, name, icon, lft, rgt, depth

Examples

(async () => {
  const service = new Service(url);
  const request = await service.getTopics();
})();

Returns Promise<any>

getTypes

Get list of template types

Parameters

  • params object
    • params.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_url
    • params.fields string? Filter by any param (e.g. return only id filed: "?fields=id"), Possible values: id, title, price, need_demo_url, steps
    • params.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
    • params.type string? type name (e.g. wordpress-themes).
    • params.expand string? Show additional info (e.g. ?expand=fields,steps).
    • params.fields string? Filter by any param (e.g. return only id filed: "?fields=id"), Possible values: id, title, price, need_demo_url, steps

Examples

(async () => {
  const service = new Service(url);
  const request = await service.getType(params);
})();

Returns Promise<any>

getAuthorTemplates

Get Author templates

Parameters

  • params object
    • params.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 id
    • params.templateId string? filter by template id
    • params.hasTemplateId number? 1 to receive uploads only with template_id, 0 to receive uploads without template_id
    • params.name string? filter field
    • params.sort string? sort by parameter (e.g. DESC sort by id: "?sort=-id"); available values [cheap, pricey, new, from doc API] // TODO: clarify sort options
    • params.perPage number? Templates per page
    • params.page string? Templates page
    • params.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 uploads
    • params.expand string? products expand for uploads
    • params.text string? products search text
    • params.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 1

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
    • params.accessToken string Access token. Use either the Authorization header or the access_token query param to pass an access token.
    • params.id number Template ID (required)

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
    • params.accessToken string? Access token. Use either the Authorization header or the access_token query param to pass an access token.
    • params.file string File name for saving into S3 (required).

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
    • params.id number template ID (required).
    • params.accessToken string? Access token. Use either the Authorization header or the access_token query param to pass an access token.
    • params.file string File name for saving into S3 (required).

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 object
    • 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.templateId number? real template ID (if template is already released and update is needed)
    • params.price number? Template price
    • params.authorComment string? author review comment
    • params.isExclusive boolean? if template sold exclusively on TM
    • params.isOnSale boolean? if template can be sold on sale
    • params.isOnLoyalty boolean? If template will take part in loyalty program
    • params.isOnAffiliate boolean? If template will take part in affiliate program
    • params.changelog string? template changelog
    • params.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 object
    • params.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 comment
    • params.isExclusive boolean? if template sold exclusively on TM
    • params.isOnSale boolean? if template can be sold on sale
    • params.isOnLoyalty boolean? If template will take part in loyalty program
    • params.isOnAffiliate boolean? If template will take part in affiliate program
    • params.changelog string? template changelog
    • params.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

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 object
    • params.ids string? Array of id divided by comma (e.g. "1,2"). Max count items 50
    • params.typeIds string? Array of type id divided by comma (e.g. "6,8"). Max count items 50
    • params.status number? Status
    • params.perPage number? Max items per one page (50 is max size). default = 20
    • params.page number? Page number to view. default = 1
    • params.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
    • params.typeUrl string Type Url (required)
    • params.link string Link S3 to file csv (required)

Examples

(async () => {
  const service = new Service(url, token);
  const request = await service.uploadCsvFile(params);

Returns Promise<userInfo>

getAuthorShareStatistics

Get author share statistics

Parameters

  • params object
    • params.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

getAuthorShareStatistics

Get list product boost

Examples

(async () => {
  const service = new Service(url, token);
  const request = await service.getListProductBoosts();
})();

Returns Promise<object> object of product

registrationShareProductInSocial

Registration share product in social network

Parameters

  • params object
    • params.accessToken string Access token. Use either the Authorization header or the access_token query param to pass an access token.
    • params.templateId string Product id for registration share
    • params.name string Name of social network

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
    • params.accessToken string Access token. Use either the Authorization header or the access_token query param to pass an access token.
    • params.templateId string Product id for remove from uploads

Examples

(async () => {
  const service = new Service(url, token);
  const request = await service.removeTemplateFromUploads({templateId: 55555});
})();

Returns Promise<object> object of product