YaasApiProductV2
TypeScript abstraction library for RAML-based REST API YaasApiProductV2.
Auto-generated using raml-typescript-generator.
Installation
npm install yaas-api-product-v2 --save
Usage
TypeScript
;...constructor..
To support multiple versions of the API, it is recommended to alias the import so it can easily be mapped to a later API version - and, due to the nature of Typescript, you should be alerted on API signature changes already at compile time:
;
JS (Legacy)
API skeleton as it would be produced by MuleSoft's raml-javascript-generator JS generator is shipped for reference and to ease migrations:
var YaasApiProductV2 = var client =
Options
You can set options when you initialize a client or at any time with the options
property. You may also override options per request by passing an object as the last argument of request methods. For example:
client = ...
For dynamic header injection - for example required for non-standard REST services asking for custom authentication token - a provider may be defined:
client = { returnthismyToken ? Authorization: "Bearer " + thismyToken : {} };
Base URI
By default, endpoint as defined in RAML file https://api.yaas.io/hybris/product/v2
is used.
Note If supported by API provider, it is recommended to use one API version definition (i.e. RAML file and corresponding API TypeScript library) and switch endpoint based on the desired environment, for example test
, qa
or prod
You can override the base URI by setting the baseUri
property, or initializing a client with a base URI. For example:
baseUri: 'https://api.yaas.io/hybris/product/anotherVersion';
Methods
All methods return an Observable wrapping a Popsicle obtained response:
tenant({ tenant }).products.get([query, [options]])
- tenant (type:
string
)
Get all products.
Accepted scopes:
hybris.product_read_unpublished
- required to retrieve non-public products. If not provided only published products are returned
clientproducts
tenant({ tenant }).products.post([body, [options]])
- tenant (type:
string
)
Create new product.
Accepted scopes:
hybris.product_create
- mandatoryhybris.product_publish
- required if product is created as published (by providing published flag true )
clientproducts
tenant({ tenant }).products.delete([body, [options]])
- tenant (type:
string
)
Delete all Product entities.
Accepted scopes:
hybris.product_delete_all
- mandatory
clientproducts
tenant({ tenant }).products.productId({ productId }).get([query, [options]])
- tenant (type:
string
) - productId (type:
string
)
Retrieves a single product.
YRN: urn:yaas:hybris:product:product:{tenant};{productId}
Accepted scopes:
hybris.product_read_unpublished
- required to retrieve non-public product
clientproducts
tenant({ tenant }).products.productId({ productId }).put([body, [options]])
- tenant (type:
string
) - productId (type:
string
)
Update a single product.
Accepted scopes:
hybris.product_update
- required to update product datahybris.product_publish
- required to publish the product (by settingpublished
flag totrue
)hybris.product_unpublish
- required to unpublish the product (by settingpublished
flag tofalse
)
clientproducts
tenant({ tenant }).products.productId({ productId }).delete([body, [options]])
- tenant (type:
string
) - productId (type:
string
)
Delete a single Product entity.
Accepted scopes:
hybris.product_delete
- mandatory
clientproducts
tenant({ tenant }).products.productId({ productId }).media.post([body, [options]])
- tenant (type:
string
) - productId (type:
string
)
Initialize process of creating new media file for product
Accepted scopes:
hybris.product_update
- mandatory
clientproductsmedia
tenant({ tenant }).products.productId({ productId }).media.get([query, [options]])
- tenant (type:
string
) - productId (type:
string
)
Return metadata of media files. The list is ordered according to the "position" attribute set in the file metadata.
Accepted scopes:
hybris.product_read_unpublished
- required to retrieve media metadata of non-public product
clientproductsmedia
tenant({ tenant }).products.productId({ productId }).media.mediaId({ mediaId }).get([query, [options]])
- tenant (type:
string
) - productId (type:
string
) - mediaId (type:
string
)
Return media file metadata by ID.
YRN: urn:yaas:hybris:product:product-media:{tenant};{productId};{mediaId}
Accepted scope:
hybris.product_read_unpublished
- to retrieve media metadata of non-public product
clientproductsmedia
tenant({ tenant }).products.productId({ productId }).media.mediaId({ mediaId }).put([body, [options]])
- tenant (type:
string
) - productId (type:
string
) - mediaId (type:
string
)
Update media file metadata. Note that only part of the metadata field can be updated.
Accepted scopes:
hybris.product_update
- mandatory
clientproductsmedia
tenant({ tenant }).products.productId({ productId }).media.mediaId({ mediaId }).delete([body, [options]])
- tenant (type:
string
) - productId (type:
string
) - mediaId (type:
string
)
Delete media identified by media ID.
Accepted scopes:
hybris.product_update
- mandatory
clientproductsmedia
tenant({ tenant }).products.productId({ productId }).media.mediaId({ mediaId }).commit.post([body, [options]])
- tenant (type:
string
) - productId (type:
string
) - mediaId (type:
string
)
Confirms that the media file specified by the media id is updated and ready to be used with product.
Accepted scope:
hybris.product_update
- required to attach media to product
clientproductsmediacommit
tenant({ tenant }).products.productId({ productId }).variants.get([query, [options]])
- tenant (type:
string
) - productId (type:
string
)
Get all variants for product.
Accepted scopes:
hybris.product_read_unpublished
- required to retrieve variants of non-public product. If not provided only variants of published product are returned
clientproductsvariants
tenant({ tenant }).products.productId({ productId }).variants.post([body, [options]])
- tenant (type:
string
) - productId (type:
string
)
Create new product variant.
Accepted scopes:
hybris.product_create
- mandatory
clientproductsvariants
tenant({ tenant }).products.productId({ productId }).variants.delete([body, [options]])
- tenant (type:
string
) - productId (type:
string
)
Delete all variants entities for specified product id.
Accepted scopes:
hybris.product_delete
- mandatory
clientproductsvariants
tenant({ tenant }).products.productId({ productId }).variants.variantId({ variantId }).get([query, [options]])
- tenant (type:
string
) - productId (type:
string
) - variantId (type:
string
)
Retrieve a single product variant.
YRN: urn:yaas:hybris:product:product-variant:{tenant};{productId};{variantId}
Accepted scopes:
hybris.product_read_unpublished
- required to retrieve non-public product variants
clientproductsvariants
tenant({ tenant }).products.productId({ productId }).variants.variantId({ variantId }).put([body, [options]])
- tenant (type:
string
) - productId (type:
string
) - variantId (type:
string
)
Replace a single product variant.
Accepted scopes:
hybris.product_update
- required to update product variant data
clientproductsvariants
tenant({ tenant }).products.productId({ productId }).variants.variantId({ variantId }).delete([body, [options]])
- tenant (type:
string
) - productId (type:
string
) - variantId (type:
string
)
Delete a single Product variant entity.
Accepted scopes:
hybris.product_delete
- mandatory
clientproductsvariants
tenant({ tenant }).products.productId({ productId }).variants.variantId({ variantId }).media.post([body, [options]])
- tenant (type:
string
) - productId (type:
string
) - variantId (type:
string
)
Initialize process of creating new media file for variant
Accepted scopes:
hybris.product_update
- mandatory
clientproductsvariantsmedia
tenant({ tenant }).products.productId({ productId }).variants.variantId({ variantId }).media.get([query, [options]])
- tenant (type:
string
) - productId (type:
string
) - variantId (type:
string
)
Return metadata of media files. The list is ordered according to the "position" attribute set in the file metadata.
Accepted scopes:
hybris.product_read_unpublished
- required to retrieve media metadata of a variant that belongs to a non-public product
clientproductsvariantsmedia
tenant({ tenant }).products.productId({ productId }).variants.variantId({ variantId }).media.mediaId({ mediaId }).get([query, [options]])
- tenant (type:
string
) - productId (type:
string
) - variantId (type:
string
) - mediaId (type:
string
)
Return media file metadata by ID.
YRN: urn:yaas:hybris:product:product-variant-media:{tenant};{productId};{variantId};{mediaId}
Accepted scope:
hybris.product_read_unpublished
- to retrieve media metadata of a variant that belongs to a non-public product
clientproductsvariantsmedia
tenant({ tenant }).products.productId({ productId }).variants.variantId({ variantId }).media.mediaId({ mediaId }).put([body, [options]])
- tenant (type:
string
) - productId (type:
string
) - variantId (type:
string
) - mediaId (type:
string
)
Update product variant media file metadata. Note that only part of the metadata field can be updated.
Accepted scopes:
hybris.product_update
- mandatory
clientproductsvariantsmedia
tenant({ tenant }).products.productId({ productId }).variants.variantId({ variantId }).media.mediaId({ mediaId }).delete([body, [options]])
- tenant (type:
string
) - productId (type:
string
) - variantId (type:
string
) - mediaId (type:
string
)
Delete media identified by media ID.
Accepted scopes:
hybris.product_update
- mandatory
clientproductsvariantsmedia
tenant({ tenant }).products.productId({ productId }).variants.variantId({ variantId }).media.mediaId({ mediaId }).commit.post([body, [options]])
- tenant (type:
string
) - productId (type:
string
) - variantId (type:
string
) - mediaId (type:
string
)
Confirms that the media file specified by the media id is updated and ready to be used with product variant.
Accepted scope:
hybris.product_update
- required to attach media to product variant
clientproductsvariantsmediacommit
tenant({ tenant }).variants.get([query, [options]])
- tenant (type:
string
)
Get variants by code or id. If user provides ids and codes only the variants that fulfill both restrictions will be returned.
Accepted scopes:
hybris.product_read_unpublished
- required to retrieve variants of non-public product. If not provided only variants of published product are returned
clientvariants
tenant({ tenant }).search.post([body, [options]])
- tenant (type:
string
)
Search products and variants by yrn. If you would like to embed product data into requested variant then use params.variant.expand parameter with value product. Using fields parameter user can limit the properties returned with response entities. If you would like to limit the properties of product embedded in variant, use params.variant.fields parameters prefixed with product., please see the example for more details.
Accepted scopes:
hybris.product_read_unpublished
- required to retrieve non-public products and variants. If not provided only published products or variants are returned
clientsearch
License
Apache 2.0