Skip to content

Commit

Permalink
Re-added missing variants code
Browse files Browse the repository at this point in the history
  • Loading branch information
wilkohein committed Mar 13, 2017
1 parent e9adca9 commit 9f000c2
Show file tree
Hide file tree
Showing 7 changed files with 17,061 additions and 15,147 deletions.
235 changes: 231 additions & 4 deletions README.md
@@ -1,6 +1,6 @@
# YaasApiProductV2

> TypeScript abstraction library for RAML-based REST API [YaasApiProductV2](https://api.eu.yaas.io/hybris/product/v2).
> TypeScript abstraction library for RAML-based REST API [YaasApiProductV2](https://api.yaas.io/hybris/product/v2).
Auto-generated using [raml-typescript-generator](https://github.com/brainboutique/raml-typescript-generator).

Expand Down Expand Up @@ -45,7 +45,7 @@ You can set options when you initialize a client or at any time with the `option
client = new YaasApiProductV2({ ... })

client('GET', '/', {
baseUri: 'https://api.eu.yaas.io/hybris/product/anotherVersion',
baseUri: 'https://api.yaas.io/hybris/product/anotherVersion',
headers: {
'Content-Type': 'application/json'
}
Expand All @@ -61,15 +61,15 @@ client = new YaasApiProductV2({
```

#### Base URI
By default, endpoint as defined in RAML file `https://api.eu.yaas.io/hybris/product/v2` is used.
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:

```javascript
new YaasApiProductV2({
baseUri: 'https://api.eu.yaas.io/hybris/product/anotherVersion',
baseUri: 'https://api.yaas.io/hybris/product/anotherVersion',
});
```

Expand Down Expand Up @@ -266,6 +266,233 @@ Accepted scope:
client.tenant({ tenant }).products.productId({ productId }).media.mediaId({ mediaId }).commit.post([body, [options]]).then(...)
```

#### `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

```js
client.tenant({ tenant }).products.productId({ productId }).variants.get([query, [options]]).then(...)
```

#### `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

```js
client.tenant({ tenant }).products.productId({ productId }).variants.post([body, [options]]).then(...)
```

#### `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

```js
client.tenant({ tenant }).products.productId({ productId }).variants.delete([body, [options]]).then(...)
```

#### `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

```js
client.tenant({ tenant }).products.productId({ productId }).variants.variantId({ variantId }).get([query, [options]]).then(...)
```

#### `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

```js
client.tenant({ tenant }).products.productId({ productId }).variants.variantId({ variantId }).put([body, [options]]).then(...)
```

#### `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

```js
client.tenant({ tenant }).products.productId({ productId }).variants.variantId({ variantId }).delete([body, [options]]).then(...)
```

#### `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

```js
client.tenant({ tenant }).products.productId({ productId }).variants.variantId({ variantId }).media.post([body, [options]]).then(...)
```

#### `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

```js
client.tenant({ tenant }).products.productId({ productId }).variants.variantId({ variantId }).media.get([query, [options]]).then(...)
```

#### `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

```js
client.tenant({ tenant }).products.productId({ productId }).variants.variantId({ variantId }).media.mediaId({ mediaId }).get([query, [options]]).then(...)
```

#### `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

```js
client.tenant({ tenant }).products.productId({ productId }).variants.variantId({ variantId }).media.mediaId({ mediaId }).put([body, [options]]).then(...)
```

#### `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

```js
client.tenant({ tenant }).products.productId({ productId }).variants.variantId({ variantId }).media.mediaId({ mediaId }).delete([body, [options]]).then(...)
```

#### `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

```js
client.tenant({ tenant }).products.productId({ productId }).variants.variantId({ variantId }).media.mediaId({ mediaId }).commit.post([body, [options]]).then(...)
```

#### `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

```js
client.tenant({ tenant }).variants.get([query, [options]]).then(...)
```

#### `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

```js
client.tenant({ tenant }).search.post([body, [options]]).then(...)
```

## License

Apache 2.0
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "yaas-api-product-v2",
"version": "0.1.0",
"version": "0.1.1",
"description": "TypeScript API client-lib for YAAS 'product' based on (fixed) version on Hybris SAP published API RAML, see https://devportal.yaas.io/services/product/v2/ [Auto-generated using raml-typescript-generator]",
"main": "./dist/index.js",
"types": "./dist/index",
Expand Down

0 comments on commit 9f000c2

Please sign in to comment.