From b9b641502b553880b7927ba8cf807b58b2d53510 Mon Sep 17 00:00:00 2001 From: Jeff Cuevas-Koch <4649003+cuevaskoch@users.noreply.github.com> Date: Mon, 26 Apr 2021 10:36:45 -0700 Subject: [PATCH] fix(assets): Allow querying for a specific asset type (#99) Signed-off-by: Jeff Cuevas-Koch Co-authored-by: Jeff Cuevas-Koch --- src/resources/AssetsContext.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/resources/AssetsContext.js b/src/resources/AssetsContext.js index 13ed489..90254d2 100644 --- a/src/resources/AssetsContext.js +++ b/src/resources/AssetsContext.js @@ -19,6 +19,23 @@ class AssetsContext extends PagedContext { this.code = customerCode; } + /** + * Sets the desired asset type for this context. + * This is required. + * @example + * const assets = new AssetsContext(...); + * assets + * .withAssetType('logo') + * .getPage() + * .then(page => ...) + * @param {string} assetType Type of asset to return. Supported types are 'Logo' and 'GenericImageMedia' + * @returns {AssetsContext} Returns itself + */ + withAssetType(assetType) { + this.params.asset_type = assetType; + return this; + } + /** * Gets the first page of results for this context * @returns {Promise} If successful, a page of Asset objects