From 7dd9367280a0e3acebc7d5b527ce8e64fd552903 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Thu, 31 Jan 2019 11:41:07 -0800 Subject: [PATCH 1/3] Add new OCAPI properties/types --- src/models/ProductRef.js | 68 +++++++++++++++++++++++++++ src/models/ProductSearchHit.js | 19 ++++++++ src/models/VariationAttributeValue.js | 17 +++++++ 3 files changed, 104 insertions(+) create mode 100644 src/models/ProductRef.js diff --git a/src/models/ProductRef.js b/src/models/ProductRef.js new file mode 100644 index 0000000..bb3fe49 --- /dev/null +++ b/src/models/ProductRef.js @@ -0,0 +1,68 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* Copyright (c) 2017 Mobify Research & Development Inc. All rights reserved. */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* eslint-disable dot-notation */ +/** + * Shop API + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 17.8 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + */ +import ApiClient from '../ApiClient' + +/** +* The ProductRef model module. +* @module models/ProductRef +* @version 17.8 +*/ +export default class ProductRef { + /** + * Constructs a new ProductRef. + * Document representing a product reference. + * @alias module:models/ProductRef + * @class + * @param id {String} The ID of the product reference. + */ + constructor(id) { + /** + * The ID of the product reference. + * @member {String} id + */ + this.id = id + + /** + * The link to the product reference. + * @member {String} link + */ + this.link = undefined + } + + /** + * Constructs a ProductRef from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:models/ProductRef} obj Optional instance to populate. + * @return {module:models/ProductRef} The populated ProductRef instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ProductRef() + + if (data.hasOwnProperty('id')) { + obj['id'] = ApiClient.convertToType(data['id'], 'String') + } + if (data.hasOwnProperty('link')) { + obj['link'] = ApiClient.convertToType(data['link'], 'String') + } + } + + return obj + } +} diff --git a/src/models/ProductSearchHit.js b/src/models/ProductSearchHit.js index 039cded..5b30c0a 100644 --- a/src/models/ProductSearchHit.js +++ b/src/models/ProductSearchHit.js @@ -18,6 +18,7 @@ import ApiClient from '../ApiClient' import Image from './Image' import ProductType from './ProductType' +import ProductRef from './ProductRef' import VariationAttribute from './VariationAttribute' /** @@ -93,6 +94,18 @@ export default class ProductSearchHit { */ this.product_type = undefined + /** + * The first represented product. + * @member {module:models/ProductRef} represented_product + */ + this.represented_product = undefined + + /** + * All the represented products. + * @member {Array.} represented_products + */ + this.represented_products = undefined + /** * The array of represented variation attributes (for the master product only). This array can be empty. * @member {Array.} variation_attributes @@ -141,6 +154,12 @@ export default class ProductSearchHit { if (data.hasOwnProperty('product_type')) { obj['product_type'] = ProductType.constructFromObject(data['product_type']) } + if (data.hasOwnProperty('represented_product')) { + obj['represented_product'] = ProductType.constructFromObject(data['represented_product']) + } + if (data.hasOwnProperty('represented_products')) { + obj['represented_products'] = ApiClient.convertToType(data['represented_products'], [ProductRef]) + } if (data.hasOwnProperty('variation_attributes')) { obj['variation_attributes'] = ApiClient.convertToType(data['variation_attributes'], [VariationAttribute]) } diff --git a/src/models/VariationAttributeValue.js b/src/models/VariationAttributeValue.js index d2f85da..591dce9 100644 --- a/src/models/VariationAttributeValue.js +++ b/src/models/VariationAttributeValue.js @@ -16,6 +16,7 @@ * */ import ApiClient from '../ApiClient' +import Image from './Image' /** * The VariationAttributeValue model module. @@ -35,6 +36,16 @@ export default class VariationAttributeValue { */ this.description = undefined + /** + * @member {module:models/Image} image + */ + this.image = undefined + + /** + * @member {module:models/Image} image_swatch + */ + this.image_swatch = undefined + /** * @member {String} name */ @@ -65,6 +76,12 @@ export default class VariationAttributeValue { if (data.hasOwnProperty('description')) { obj['description'] = ApiClient.convertToType(data['description'], 'String') } + if (data.hasOwnProperty('image')) { + obj['image'] = Image.constructFromObject(data['image']) + } + if (data.hasOwnProperty('image_swatch')) { + obj['image_swatch'] = Image.constructFromObject(data['image_swatch']) + } if (data.hasOwnProperty('name')) { obj['name'] = ApiClient.convertToType(data['name'], 'String') } From ecadb0928823aae11ff9bf145e7c4c05467b0715 Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Thu, 31 Jan 2019 13:28:19 -0800 Subject: [PATCH 2/3] Update change log --- CHANGELOG.md | 3 +++ package-lock.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 713d68a..95dec9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## To be released +- Add relevant properties to `VariationAttributeValue` modal and some others. [#15](https://github.com/mobify/commercecloud-ocapi-client/pull/15) + ## v0.1.6 (October 16, 2018) - Fix `overrideHttpPut` logic invocation diff --git a/package-lock.json b/package-lock.json index 5413242..11542fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "commercecloud-ocapi-client", - "version": "0.1.4", + "version": "0.1.6", "lockfileVersion": 1, "requires": true, "dependencies": { From f70efe9998ae337addfba95edfdbc32264b81c1d Mon Sep 17 00:00:00 2001 From: Ben Chypak Date: Tue, 5 Feb 2019 13:35:57 -0800 Subject: [PATCH 3/3] Fix typo `modal` -> 'model' --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95dec9f..51629d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ ## To be released -- Add relevant properties to `VariationAttributeValue` modal and some others. [#15](https://github.com/mobify/commercecloud-ocapi-client/pull/15) +- Add relevant properties to `VariationAttributeValue` model and some others. [#15](https://github.com/mobify/commercecloud-ocapi-client/pull/15) ## v0.1.6 (October 16, 2018) - Fix `overrideHttpPut` logic invocation