Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(image): explain deprecation of category methods #2040

Merged
merged 6 commits into from
Apr 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 85 additions & 27 deletions src/modules/image/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Unsplash } from './providers/unsplash';
*
* For a random user avatar image, use [`avatar()`](https://next.fakerjs.dev/api/image.html#avatar).
*
* This module previously also contained methods for specifically themed images like "fashion" or "food", but these are now deprecated. If you need more control over image type, you are recommended to use an image provider directly or provide your own set of placeholder images.
* This module previously also contained methods for specifically themed images like "fashion" or "food", but these are now deprecated. If you need more control over image type, you can request categorized images using [`urlLoremFlickr()`](https://next.fakerjs.dev/api/image.html#urlloremflickr), use an image provider directly or provide your own set of placeholder images.
*/
export class ImageModule {
/**
Expand Down Expand Up @@ -501,19 +501,24 @@ export class ImageModule {
* @param height The height of the image. Defaults to `480`.
* @param randomize Whether to randomize the image or not. Defaults to `false`.
*
* @see faker.image.url()
* @see faker.image.urlLoremFlickr()
*
* @example
* faker.image.abstract() // 'https://loremflickr.com/640/480/abstract'
* faker.image.abstract(1234, 2345) // 'https://loremflickr.com/1234/2345/abstract'
* faker.image.abstract(1234, 2345, true) // 'https://loremflickr.com/1234/2345/abstract?lock=56789'
*
* @since 2.0.1
*
* @deprecated Use `faker.image.url` instead.
* @deprecated Use `faker.image.urlLoremFlickr({ category: 'abstract' })` if you want an image from LoremFlickr in the correct category, or `faker.image.url()` if you just want any image.
*
*/
abstract(width?: number, height?: number, randomize?: boolean): string {
deprecated({
deprecated: 'faker.image.abstract',
proposed: 'faker.image.url',
proposed:
"faker.image.urlLoremFlickr({ category: 'abstract' }) or faker.image.url",
since: '8.0',
until: '9.0',
});
Expand All @@ -528,19 +533,24 @@ export class ImageModule {
* @param height The height of the image. Defaults to `480`.
* @param randomize Whether to randomize the image or not. Defaults to `false`.
*
* @see faker.image.url()
* @see faker.image.urlLoremFlickr()
*
* @example
* faker.image.animals() // 'https://loremflickr.com/640/480/animals'
* faker.image.animals(1234, 2345) // 'https://loremflickr.com/1234/2345/animals'
* faker.image.animals(1234, 2345, true) // 'https://loremflickr.com/1234/2345/animals?lock=56789'
*
* @since 2.0.1
*
* @deprecated Use `faker.image.url` instead.
* @deprecated Use `faker.image.urlLoremFlickr({ category: 'animals' })` if you want an image from LoremFlickr in the correct category, or `faker.image.url()` if you just want any image.
*
*/
animals(width?: number, height?: number, randomize?: boolean): string {
deprecated({
deprecated: 'faker.image.animals',
proposed: 'faker.image.url',
proposed:
"faker.image.urlLoremFlickr({ category: 'animals' }) or faker.image.url",
since: '8.0',
until: '9.0',
});
Expand All @@ -555,19 +565,25 @@ export class ImageModule {
* @param height The height of the image. Defaults to `480`.
* @param randomize Whether to randomize the image or not. Defaults to `false`.
*
* @see faker.image.url()
* @see faker.image.urlLoremFlickr()
*
* @example
* faker.image.business() // 'https://loremflickr.com/640/480/business'
* faker.image.business(1234, 2345) // 'https://loremflickr.com/1234/2345/business'
* faker.image.business(1234, 2345, true) // 'https://loremflickr.com/1234/2345/business?lock=56789'
*
* @since 2.0.1
*
* @deprecated Use `faker.image.url` instead.
* @deprecated Use `faker.image.urlLoremFlickr({ category: 'business' })` if you want an image from LoremFlickr in the correct category, or `faker.image.url()` if you just want any image.
*
*
*/
business(width?: number, height?: number, randomize?: boolean): string {
deprecated({
deprecated: 'faker.image.business',
proposed: 'faker.image.url',
proposed:
"faker.image.urlLoremFlickr({ category: 'business' }) or faker.image.url",
since: '8.0',
until: '9.0',
});
Expand All @@ -582,19 +598,23 @@ export class ImageModule {
* @param height The height of the image. Defaults to `480`.
* @param randomize Whether to randomize the image or not. Defaults to `false`.
*
* @see faker.image.url()
* @see faker.image.urlLoremFlickr()
*
* @example
* faker.image.cats() // 'https://loremflickr.com/640/480/cats'
* faker.image.cats(1234, 2345) // 'https://loremflickr.com/1234/2345/cats'
* faker.image.cats(1234, 2345, true) // 'https://loremflickr.com/1234/2345/cats?lock=56789'
*
* @since 2.0.1
*
* @deprecated Use `faker.image.url` instead.
* @deprecated Use `faker.image.urlLoremFlickr({ category: 'cats' })` if you want an image from LoremFlickr in the correct category, or `faker.image.url()` if you just want any image.
*/
cats(width?: number, height?: number, randomize?: boolean): string {
deprecated({
deprecated: 'faker.image.cats',
proposed: 'faker.image.url',
proposed:
"faker.image.urlLoremFlickr({ category: 'cats' }) or faker.image.url",
since: '8.0',
until: '9.0',
});
Expand All @@ -609,19 +629,23 @@ export class ImageModule {
* @param height The height of the image. Defaults to `480`.
* @param randomize Whether to randomize the image or not. Defaults to `false`.
*
* @see faker.image.url()
* @see faker.image.urlLoremFlickr()
*
* @example
* faker.image.city() // 'https://loremflickr.com/640/480/city'
* faker.image.city(1234, 2345) // 'https://loremflickr.com/1234/2345/city'
* faker.image.city(1234, 2345, true) // 'https://loremflickr.com/1234/2345/city?lock=56789'
*
* @since 2.0.1
*
* @deprecated Use `faker.image.url` instead.
* @deprecated Use `faker.image.urlLoremFlickr({ category: 'city' })` if you want an image from LoremFlickr in the correct category, or `faker.image.url()` if you just want any image.
*/
city(width?: number, height?: number, randomize?: boolean): string {
deprecated({
deprecated: 'faker.image.city',
proposed: 'faker.image.url',
proposed:
"faker.image.urlLoremFlickr({ category: 'city' }) or faker.image.url",
since: '8.0',
until: '9.0',
});
Expand All @@ -636,19 +660,23 @@ export class ImageModule {
* @param height The height of the image. Defaults to `480`.
* @param randomize Whether to randomize the image or not. Defaults to `false`.
*
* @see faker.image.url()
* @see faker.image.urlLoremFlickr()
*
* @example
* faker.image.food() // 'https://loremflickr.com/640/480/food'
* faker.image.food(1234, 2345) // 'https://loremflickr.com/1234/2345/food'
* faker.image.food(1234, 2345, true) // 'https://loremflickr.com/1234/2345/food?lock=56789'
*
* @since 2.0.1
*
* @deprecated Use `faker.image.url` instead.
* @deprecated Use `faker.image.urlLoremFlickr({ category: 'food' })` if you want an image from LoremFlickr in the correct category, or `faker.image.url()` if you just want any image.
*/
food(width?: number, height?: number, randomize?: boolean): string {
deprecated({
deprecated: 'faker.image.food',
proposed: 'faker.image.url',
proposed:
"faker.image.urlLoremFlickr({ category: 'food' }) or faker.image.url",
since: '8.0',
until: '9.0',
});
Expand All @@ -663,19 +691,23 @@ export class ImageModule {
* @param height The height of the image. Defaults to `480`.
* @param randomize Whether to randomize the image or not. Defaults to `false`.
*
* @see faker.image.url()
* @see faker.image.urlLoremFlickr()
*
* @example
* faker.image.nightlife() // 'https://loremflickr.com/640/480/nightlife'
* faker.image.nightlife(1234, 2345) // 'https://loremflickr.com/1234/2345/nightlife'
* faker.image.nightlife(1234, 2345, true) // 'https://loremflickr.com/1234/2345/nightlife?lock=56789'
*
* @since 2.0.1
*
* @deprecated Use `faker.image.url` instead.
* @deprecated Use `faker.image.urlLoremFlickr({ category: 'nightlife' })` if you want an image from LoremFlickr in the correct category, or `faker.image.url()` if you just want any image.
*/
nightlife(width?: number, height?: number, randomize?: boolean): string {
deprecated({
deprecated: 'faker.image.nightlife',
proposed: 'faker.image.url',
proposed:
"faker.image.urlLoremFlickr({ category: 'nightlife' }) or faker.image.url",
since: '8.0',
until: '9.0',
});
Expand All @@ -690,19 +722,23 @@ export class ImageModule {
* @param height The height of the image. Defaults to `480`.
* @param randomize Whether to randomize the image or not. Defaults to `false`.
*
* @see faker.image.url()
* @see faker.image.urlLoremFlickr()
*
* @example
* faker.image.fashion() // 'https://loremflickr.com/640/480/fashion'
* faker.image.fashion(1234, 2345) // 'https://loremflickr.com/1234/2345/fashion'
* faker.image.fashion(1234, 2345, true) // 'https://loremflickr.com/1234/2345/fashion?lock=56789'
*
* @since 2.0.1
*
* @deprecated Use `faker.image.url` instead.
* @deprecated Use `faker.image.urlLoremFlickr({ category: 'fashion' })` if you want an image from LoremFlickr in the correct category, or `faker.image.url()` if you just want any image.
*/
fashion(width?: number, height?: number, randomize?: boolean): string {
deprecated({
deprecated: 'faker.image.fashion',
proposed: 'faker.image.url',
proposed:
"faker.image.urlLoremFlickr({ category: 'fashion' }) or faker.image.url",
since: '8.0',
until: '9.0',
});
Expand All @@ -717,19 +753,23 @@ export class ImageModule {
* @param height The height of the image. Defaults to `480`.
* @param randomize Whether to randomize the image or not. Defaults to `false`.
*
* @see faker.image.url()
* @see faker.image.urlLoremFlickr()
*
* @example
* faker.image.people() // 'https://loremflickr.com/640/480/people'
* faker.image.people(1234, 2345) // 'https://loremflickr.com/1234/2345/people'
* faker.image.people(1234, 2345, true) // 'https://loremflickr.com/1234/2345/people?lock=56789'
*
* @since 2.0.1
*
* @deprecated Use `faker.image.url` instead.
* @deprecated Use `faker.image.urlLoremFlickr({ category: 'people' })` if you want an image from LoremFlickr in the correct category, or `faker.image.url()` if you just want any image.
*/
people(width?: number, height?: number, randomize?: boolean): string {
deprecated({
deprecated: 'faker.image.people',
proposed: 'faker.image.url',
proposed:
"faker.image.urlLoremFlickr({ category: 'people' }) or faker.image.url",
since: '8.0',
until: '9.0',
});
Expand All @@ -744,19 +784,23 @@ export class ImageModule {
* @param height The height of the image. Defaults to `480`.
* @param randomize Whether to randomize the image or not. Defaults to `false`.
*
* @see faker.image.url()
* @see faker.image.urlLoremFlickr()
*
* @example
* faker.image.nature() // 'https://loremflickr.com/640/480/nature'
* faker.image.nature(1234, 2345) // 'https://loremflickr.com/1234/2345/nature'
* faker.image.nature(1234, 2345, true) // 'https://loremflickr.com/1234/2345/nature?lock=56789'
*
* @since 2.0.1
*
* @deprecated Use `faker.image.url` instead.
* @deprecated Use `faker.image.urlLoremFlickr({ category: 'nature' })` if you want an image from LoremFlickr in the correct category, or `faker.image.url()` if you just want any image.
*/
nature(width?: number, height?: number, randomize?: boolean): string {
deprecated({
deprecated: 'faker.image.nature',
proposed: 'faker.image.url',
proposed:
"faker.image.urlLoremFlickr({ category: 'nature' }) or faker.image.url",
since: '8.0',
until: '9.0',
});
Expand All @@ -771,19 +815,23 @@ export class ImageModule {
* @param height The height of the image. Defaults to `480`.
* @param randomize Whether to randomize the image or not. Defaults to `false`.
*
* @see faker.image.url()
* @see faker.image.urlLoremFlickr()
*
* @example
* faker.image.sports() // 'https://loremflickr.com/640/480/sports'
* faker.image.sports(1234, 2345) // 'https://loremflickr.com/1234/2345/sports'
* faker.image.sports(1234, 2345, true) // 'https://loremflickr.com/1234/2345/sports?lock=56789'
*
* @since 2.0.1
*
* @deprecated Use `faker.image.url` instead.
* @deprecated Use `faker.image.urlLoremFlickr({ category: 'sports' })` if you want an image from LoremFlickr in the correct category, or `faker.image.url()` if you just want any image.
*/
sports(width?: number, height?: number, randomize?: boolean): string {
deprecated({
deprecated: 'faker.image.sports',
proposed: 'faker.image.url',
proposed:
"faker.image.urlLoremFlickr({ category: 'sports' }) or faker.image.url",
since: '8.0',
until: '9.0',
});
Expand All @@ -798,19 +846,23 @@ export class ImageModule {
* @param height The height of the image. Defaults to `480`.
* @param randomize Whether to randomize the image or not. Defaults to `false`.
*
* @see faker.image.url()
* @see faker.image.urlLoremFlickr()
*
* @example
* faker.image.technics() // 'https://loremflickr.com/640/480/technics'
* faker.image.technics(1234, 2345) // 'https://loremflickr.com/1234/2345/technics'
* faker.image.technics(1234, 2345, true) // 'https://loremflickr.com/1234/2345/technics?lock=56789'
*
* @since 2.0.1
*
* @deprecated Use `faker.image.url` instead.
* @deprecated Use `faker.image.urlLoremFlickr({ category: 'technics' })` if you want an image from LoremFlickr in the correct category, or `faker.image.url()` if you just want any image.
*/
technics(width?: number, height?: number, randomize?: boolean): string {
deprecated({
deprecated: 'faker.image.technics',
proposed: 'faker.image.url',
proposed:
"faker.image.urlLoremFlickr({ category: 'technics' }) or faker.image.url",
since: '8.0',
until: '9.0',
});
Expand All @@ -825,19 +877,25 @@ export class ImageModule {
* @param height The height of the image. Defaults to `480`.
* @param randomize Whether to randomize the image or not. Defaults to `false`.
*
* @see faker.image.url()
* @see faker.image.urlLoremFlickr()
*
* @example
* faker.image.transport() // 'https://loremflickr.com/640/480/transport'
* faker.image.transport(1234, 2345) // 'https://loremflickr.com/1234/2345/transport'
* faker.image.transport(1234, 2345, true) // 'https://loremflickr.com/1234/2345/transport?lock=56789'
*
* @since 2.0.1
*
* @deprecated Use `faker.image.url` instead.
* @deprecated Use `faker.image.urlLoremFlickr({ category: 'transport' })` if you want an image from LoremFlickr in the correct category, or `faker.image.url()` if you just want any image.
*
*
*/
transport(width?: number, height?: number, randomize?: boolean): string {
deprecated({
deprecated: 'faker.image.transport',
proposed: 'faker.image.url',
proposed:
"faker.image.urlLoremFlickr({ category: 'transport' }) or faker.image.url",
since: '8.0',
until: '9.0',
});
Expand Down