@trivia-api/models
Version:
Models for The Trivia API.
131 lines (130 loc) • 3.48 kB
TypeScript
/**
* When a question includes images, each image will be in this format, where
* as well as the URL to the image file there is other information on the image,
* its source, and its license information.
*
* @openapi
* components:
* schemas:
* ImageOption:
* type: object
* properties:
* url:
* type: string
* description: Full URL of the image
* example: 'https://example.com/images/12345/an-interesting-image.jpg'
* height:
* type: number
* description: Height of the image in pixels
* example: 400
* width:
* type: number
* description: Width of the image in pixels
* example: 300
* size:
* type: number
* description: Size of the image in bytes
* example: 256612
* author:
* type: object
* properties:
* name:
* type: string
* description: The author's name
* example: 'John Smith'
* url:
* type:
* - string
* - 'null'
* description: URL to the author's website or social media profile
* example: 'https://john-smith.example.com'
* source:
* type: object
* properties:
* url:
* type:
* - string
* - 'null'
* description: Where the image is originally credited
* example: 'https://example.com/some-source-gallery'
* description:
* type: string
* description: Description of what the image is showing, can be used as alt text.
* example: 'A picture of a cat'
* license:
* type: object
* properties:
* url:
* type:
* - string
* - 'null'
* description: URL to the license of the image
* example: 'https://creativecommons.org/licenses/by/4.0/'
* name:
* type: string
* description: Name of the license
* example: 'Creative Commons Attribution 4.0 International'
* required:
* - url
* - height
* - width
* - size
* - author
* - source
* - description
* - license
*/
export type ImageOption = {
/**
* Full URL of the image
*/
url: string;
/**
* Height of the image in pixels
*/
height: number;
/**
* Width of the image in pixels
*/
width: number;
/**
* Size of the image in bytes
*/
size: number;
/**
* Information on the author of this image.
*/
author: {
/**
* The author's name
*/
name?: string;
/**
* URL to the author's website or social media profile
*/
url?: string | null;
};
source: {
/**
* Where the image is originally credited
*/
url: string | null;
};
/**
* Description of what the image is showing, can be used as alt text.
*/
description: string;
/**
* Information on how this image is licensed.
*/
license: {
/**
* URL to information on this license
*/
url?: string;
/**
* Name of the license
*/
name?: string;
};
};