diff --git a/lib/tumblr.js b/lib/tumblr.js index be38bfb9..50fab584 100644 --- a/lib/tumblr.js +++ b/lib/tumblr.js @@ -791,12 +791,21 @@ class TumblrClient { /** * Gets posts tagged with the specified tag * - * @param {{tag:string; [param:string]: string|number}} params - optional parameters sent with the request + * @param {string} tag - The tag on the posts you'd like to retrieve + * @param {Record|TumblrClientCallback} [paramsOrCallback] - query parameters * @param {TumblrClientCallback} [callback] **Deprecated** Omit the callback and use the promise form * * @return {Promise|undefined} Request object, or Promise if {@link returnPromises} was used */ - taggedPosts(params, callback) { + taggedPosts(tag, paramsOrCallback, callback) { + const params = { tag }; + + if (typeof paramsOrCallback === 'function') { + callback = /** @type {TumblrClientCallback} */ (paramsOrCallback); + } else if (typeof paramsOrCallback === 'object') { + Object.assign(params, paramsOrCallback); + } + return this.getRequest('/v2/tagged', params, callback); } }