Skip to content

Commit

Permalink
Fix blogAvatar signature, undefined size (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
sirreal authored Aug 18, 2023
1 parent 7e91a8d commit 751e319
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/tumblr.js
Original file line number Diff line number Diff line change
Expand Up @@ -730,15 +730,19 @@ class TumblrClient {
* Gets the avatar URL for a blog
*
* @param {string} blogIdentifier - blog name or URL
* @param {{size?: 16|24|30|40|48|64|96|128|512}|TumblrClientCallback} [paramsOrCallback] - optional data sent with the request
* @param {16|24|30|40|48|64|96|128|512|TumblrClientCallback} [sizeOrCallback] - optional data sent with the request
* @param {TumblrClientCallback} [maybeCallback] - invoked when the request completes
*
* @return {Promise<any>|undefined} Request object, or Promise if {@link returnPromises} was used
*/
blogAvatar(blogIdentifier, paramsOrCallback, maybeCallback) {
const size = typeof paramsOrCallback === 'function' ? undefined : paramsOrCallback?.size;
const callback = typeof paramsOrCallback === 'function' ? paramsOrCallback : maybeCallback;
return this.getRequest(`/v2/blog/${blogIdentifier}/avatar/${size}`, undefined, callback);
blogAvatar(blogIdentifier, sizeOrCallback, maybeCallback) {
const size = typeof sizeOrCallback === 'function' ? undefined : sizeOrCallback;
const callback = typeof sizeOrCallback === 'function' ? sizeOrCallback : maybeCallback;
return this.getRequest(
`/v2/blog/${blogIdentifier}/avatar${size ? `/${size}` : ''}`,
undefined,
callback,
);
}

/**
Expand Down

0 comments on commit 751e319

Please sign in to comment.