fix(CDNRoutes): make format optional and default to png (#869)

This commit is contained in:
Danial Raza
2024-02-01 01:59:16 +01:00
committed by GitHub
parent 6f541d58d2
commit 55efcca4f8
4 changed files with 36 additions and 36 deletions

View File

@@ -934,6 +934,14 @@ export const Routes = {
export const StickerPackApplicationId = '710982414301790216';
export enum ImageFormat {
JPEG = 'jpeg',
PNG = 'png',
WebP = 'webp',
GIF = 'gif',
Lottie = 'json',
}
export const CDNRoutes = {
/**
* Route for:
@@ -1112,7 +1120,7 @@ export const CDNRoutes = {
*
* This route supports the extensions: PNG, JPEG, WebP
*/
storePageAsset(applicationId: Snowflake, assetId: string, format: StorePageAssetFormat) {
storePageAsset(applicationId: Snowflake, assetId: string, format: StorePageAssetFormat = ImageFormat.PNG) {
return `/app-assets/${applicationId}/store/${assetId}.${format}` as const;
},
@@ -1194,14 +1202,6 @@ export type RoleIconFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageForm
export type GuildScheduledEventCoverFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type GuildMemberBannerFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export enum ImageFormat {
JPEG = 'jpeg',
PNG = 'png',
WebP = 'webp',
GIF = 'gif',
Lottie = 'json',
}
export interface CDNQuery {
/**
* The returned image can have the size changed by using this query parameter

View File

@@ -943,6 +943,14 @@ export const Routes = {
export const StickerPackApplicationId = '710982414301790216';
export enum ImageFormat {
JPEG = 'jpeg',
PNG = 'png',
WebP = 'webp',
GIF = 'gif',
Lottie = 'json',
}
export const CDNRoutes = {
/**
* Route for:
@@ -1121,7 +1129,7 @@ export const CDNRoutes = {
*
* This route supports the extensions: PNG, JPEG, WebP
*/
storePageAsset(applicationId: Snowflake, assetId: string, format: StorePageAssetFormat) {
storePageAsset(applicationId: Snowflake, assetId: string, format: StorePageAssetFormat = ImageFormat.PNG) {
return `/app-assets/${applicationId}/store/${assetId}.${format}` as const;
},
@@ -1203,14 +1211,6 @@ export type RoleIconFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageForm
export type GuildScheduledEventCoverFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type GuildMemberBannerFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export enum ImageFormat {
JPEG = 'jpeg',
PNG = 'png',
WebP = 'webp',
GIF = 'gif',
Lottie = 'json',
}
export interface CDNQuery {
/**
* The returned image can have the size changed by using this query parameter

View File

@@ -934,6 +934,14 @@ export const Routes = {
export const StickerPackApplicationId = '710982414301790216';
export enum ImageFormat {
JPEG = 'jpeg',
PNG = 'png',
WebP = 'webp',
GIF = 'gif',
Lottie = 'json',
}
export const CDNRoutes = {
/**
* Route for:
@@ -1112,7 +1120,7 @@ export const CDNRoutes = {
*
* This route supports the extensions: PNG, JPEG, WebP
*/
storePageAsset(applicationId: Snowflake, assetId: string, format: StorePageAssetFormat) {
storePageAsset(applicationId: Snowflake, assetId: string, format: StorePageAssetFormat = ImageFormat.PNG) {
return `/app-assets/${applicationId}/store/${assetId}.${format}` as const;
},
@@ -1194,14 +1202,6 @@ export type RoleIconFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageForm
export type GuildScheduledEventCoverFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type GuildMemberBannerFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export enum ImageFormat {
JPEG = 'jpeg',
PNG = 'png',
WebP = 'webp',
GIF = 'gif',
Lottie = 'json',
}
export interface CDNQuery {
/**
* The returned image can have the size changed by using this query parameter

View File

@@ -943,6 +943,14 @@ export const Routes = {
export const StickerPackApplicationId = '710982414301790216';
export enum ImageFormat {
JPEG = 'jpeg',
PNG = 'png',
WebP = 'webp',
GIF = 'gif',
Lottie = 'json',
}
export const CDNRoutes = {
/**
* Route for:
@@ -1121,7 +1129,7 @@ export const CDNRoutes = {
*
* This route supports the extensions: PNG, JPEG, WebP
*/
storePageAsset(applicationId: Snowflake, assetId: string, format: StorePageAssetFormat) {
storePageAsset(applicationId: Snowflake, assetId: string, format: StorePageAssetFormat = ImageFormat.PNG) {
return `/app-assets/${applicationId}/store/${assetId}.${format}` as const;
},
@@ -1203,14 +1211,6 @@ export type RoleIconFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageForm
export type GuildScheduledEventCoverFormat = Exclude<ImageFormat, ImageFormat.Lottie | ImageFormat.GIF>;
export type GuildMemberBannerFormat = Exclude<ImageFormat, ImageFormat.Lottie>;
export enum ImageFormat {
JPEG = 'jpeg',
PNG = 'png',
WebP = 'webp',
GIF = 'gif',
Lottie = 'json',
}
export interface CDNQuery {
/**
* The returned image can have the size changed by using this query parameter