docs: added sizes 16, 32, 64 (#2666)

* documented sizes 16, 32, 64

* Removed space

* Added typedef

* The options to provide => Options for the Image URL

* fixed
This commit is contained in:
PLASMAchicken
2018-07-26 03:04:47 +02:00
committed by Isabella
parent 3a7a7d730b
commit c46cbbfd84
5 changed files with 14 additions and 23 deletions

View File

@@ -121,9 +121,7 @@ class ClientApplication extends Base {
/**
* A link to the application's icon.
* @param {Object} [options={}] Options for the icon url
* @param {string} [options.format='webp'] One of `webp`, `png`, `jpg`
* @param {number} [options.size=128] One of `128`, `256`, `512`, `1024`, `2048`
* @param {ImageURLOptions} [options={}] Options for the Image URL
* @returns {?string} URL to the icon
*/
iconURL({ format, size } = {}) {
@@ -133,9 +131,7 @@ class ClientApplication extends Base {
/**
* A link to this application's cover image.
* @param {Object} [options={}] Options for the cover image url
* @param {string} [options.format='webp'] One of `webp`, `png`, `jpg`
* @param {number} [options.size=128] One of `128`, `256`, `512`, `1024`, `2048`
* @param {ImageURLOptions} [options={}] Options for the Image URL
* @returns {?string} URL to the cover image
*/
coverImage({ format, size } = {}) {

View File

@@ -116,9 +116,7 @@ class GroupDMChannel extends Channel {
/**
* Gets the URL to this Group DM's icon.
* @param {Object} [options={}] Options for the icon url
* @param {string} [options.format='webp'] One of `webp`, `png`, `jpg`
* @param {number} [options.size=128] One of `128`, `256`, `512`, `1024`, `2048`
* @param {ImageURLOptions} [options={}] Options for the Image URL
* @returns {?string}
*/
iconURL({ format, size } = {}) {

View File

@@ -288,9 +288,7 @@ class Guild extends Base {
/**
* The URL to this guild's icon.
* @param {Object} [options={}] Options for the icon url
* @param {string} [options.format='webp'] One of `webp`, `png`, `jpg`
* @param {number} [options.size=128] One of `128`, `256`, `512`, `1024`, `2048`
* @param {ImageURLOptions} [options={}] Options for the Image URL
* @returns {?string}
*/
iconURL({ format, size } = {}) {
@@ -309,9 +307,7 @@ class Guild extends Base {
/**
* The URL to this guild's splash.
* @param {Object} [options={}] Options for the splash url
* @param {string} [options.format='webp'] One of `webp`, `png`, `jpg`
* @param {number} [options.size=128] One of `128`, `256`, `512`, `1024`, `2048`
* @param {ImageURLOptions} [options={}] Options for the Image URL
* @returns {?string}
*/
splashURL({ format, size } = {}) {

View File

@@ -115,10 +115,7 @@ class User extends Base {
/**
* A link to the user's avatar.
* @param {Object} [options={}] Options for the avatar url
* @param {string} [options.format='webp'] One of `webp`, `png`, `jpg`, `gif`. If no format is provided,
* it will be `gif` for animated avatars or otherwise `webp`
* @param {number} [options.size=128] One of `128`, `256`, `512`, `1024`, `2048`
* @param {ImageURLOptions} [options={}] Options for the Image URL
* @returns {?string}
*/
avatarURL({ format, size } = {}) {
@@ -138,10 +135,7 @@ class User extends Base {
/**
* A link to the user's avatar if they have one.
* Otherwise a link to their default avatar will be returned.
* @param {Object} [options={}] Options for the avatar url
* @param {string} [options.format='webp'] One of `webp`, `png`, `jpg`, `gif`. If no format is provided,
* it will be `gif` for animated avatars or otherwise `webp`
* @param {number} [options.size=128] One of `128`, `256`, `512`, `1024`, `2048`
* @param {ImageURLOptions} [options={}] Options for the Image URL
* @returns {string}
*/
displayAvatarURL(options) {

View File

@@ -111,6 +111,13 @@ function makeImageUrl(root, { format = 'webp', size } = {}) {
if (size && !AllowedImageSizes.includes(size)) throw new RangeError('IMAGE_SIZE', size);
return `${root}.${format}${size ? `?size=${size}` : ''}`;
}
/**
* Options for Image URLs.
* @typedef {Object} ImageURLOptions
* @property {string} [format] One of `webp`, `png`, `jpg`, `gif`. If no format is provided,
* it will be `gif` for animated avatars or otherwise `webp`
* @property {number} [size] One of `16`, `32`, `64`, `128`, `256`, `512`, `1024`, `2048`
*/
exports.Endpoints = {
CDN(root) {