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 1 commit
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
73 changes: 59 additions & 14 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,14 +501,18 @@ 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.
matthewmayer marked this conversation as resolved.
Show resolved Hide resolved
*
*/
abstract(width?: number, height?: number, randomize?: boolean): string {
deprecated({
Expand All @@ -528,14 +532,18 @@ 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.
matthewmayer marked this conversation as resolved.
Show resolved Hide resolved
*
*/
animals(width?: number, height?: number, randomize?: boolean): string {
deprecated({
Expand All @@ -555,14 +563,19 @@ 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.
matthewmayer marked this conversation as resolved.
Show resolved Hide resolved
*
*
*/
business(width?: number, height?: number, randomize?: boolean): string {
deprecated({
Expand All @@ -582,14 +595,17 @@ 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.
matthewmayer marked this conversation as resolved.
Show resolved Hide resolved
*/
cats(width?: number, height?: number, randomize?: boolean): string {
deprecated({
Expand All @@ -609,14 +625,17 @@ 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.
matthewmayer marked this conversation as resolved.
Show resolved Hide resolved
*/
city(width?: number, height?: number, randomize?: boolean): string {
deprecated({
Expand All @@ -636,14 +655,17 @@ 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.
matthewmayer marked this conversation as resolved.
Show resolved Hide resolved
*/
food(width?: number, height?: number, randomize?: boolean): string {
deprecated({
Expand All @@ -663,14 +685,17 @@ 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.
matthewmayer marked this conversation as resolved.
Show resolved Hide resolved
*/
nightlife(width?: number, height?: number, randomize?: boolean): string {
deprecated({
Expand All @@ -690,14 +715,17 @@ 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.
matthewmayer marked this conversation as resolved.
Show resolved Hide resolved
*/
fashion(width?: number, height?: number, randomize?: boolean): string {
deprecated({
Expand All @@ -717,14 +745,17 @@ 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.
matthewmayer marked this conversation as resolved.
Show resolved Hide resolved
*/
people(width?: number, height?: number, randomize?: boolean): string {
deprecated({
Expand All @@ -744,14 +775,17 @@ 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.
matthewmayer marked this conversation as resolved.
Show resolved Hide resolved
*/
nature(width?: number, height?: number, randomize?: boolean): string {
deprecated({
Expand All @@ -771,14 +805,17 @@ 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.
matthewmayer marked this conversation as resolved.
Show resolved Hide resolved
*/
sports(width?: number, height?: number, randomize?: boolean): string {
deprecated({
Expand All @@ -798,14 +835,17 @@ 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.
matthewmayer marked this conversation as resolved.
Show resolved Hide resolved
*/
technics(width?: number, height?: number, randomize?: boolean): string {
deprecated({
Expand All @@ -825,14 +865,19 @@ 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.
matthewmayer marked this conversation as resolved.
Show resolved Hide resolved
*
*
*/
transport(width?: number, height?: number, randomize?: boolean): string {
deprecated({
Expand Down