Closed Aviortheking closed 3 years ago
using https://editor.swagger.io/ I made a basic Swagger 2.0 api design document or idk what
swagger: "2.0"
info:
description: "A Multilanguage Pokémon TCG Database with Cards Pictures and most of the informations contained on the cards. \nYou can find out more about TCGdex at [https://www.tcgdex.net](https://www.tcgdex.net) or on [Discord](https://discord.gg/NehYTAhsZE)."
version: "2.0.0"
title: "TCGdex API"
contact:
email: "contact@tcgdex.net"
license:
name: "MIT License"
url: "https://github.com/tcgdex/cards-database/blob/master/LICENSE"
host: "api.tcgdex.net"
basePath: "/v2/{lang}"
schemes:
- "https"
tags:
- name: "cards"
description: "Fetch cards globally"
- name: "filters"
description: "differents requests to filter cards"
paths:
/cards:
get:
tags:
- cards
summary: "fetch the list of cards"
description: "desc"
operationId: "cards"
responses:
"200":
description: ""
schema:
type: "array"
items:
$ref: "#/definitions/CardResume"
/cards/{cardId}:
get:
tags:
- cards
summary: "Finds Card by Global ID"
description: "Find a defined card thatusing its global id"
operationId: "findPetsByTags"
produces:
#- "application/xml"
- "application/json"
parameters:
- name: "cardId"
in: "path"
description: "Tags to filter by"
required: true
type: "string"
responses:
"200":
description: "successful operation"
schema:
$ref: "#/definitions/Card"
"404":
description: "Invalid card ID"
/sets:
get:
tags:
- filters
responses:
"200":
description: "Successful request"
schema:
type: "array"
items:
$ref: "#/definitions/SetResume"
/sets/{set}:
get:
tags:
- filters
parameters:
- name: "set"
in: "path"
description: "the set ID"
required: true
type: "string"
responses:
"200":
description: "Success"
schema:
$ref: "#/definitions/Set"
"404":
description: "set is non existing"
/sets/{set}/{cardLocalId}:
get:
tags:
- cards
parameters:
- name: "set"
in: "path"
required: true
type: "string"
- name: "cardLocalId"
in: "path"
required: true
type: "string"
responses:
"200":
description: "Success"
schema:
$ref: "#/definitions/Card"
"404":
description: "Set or cardLocalId incorrect"
/series:
get:
tags:
- filters
responses:
"200":
description: "Successful request"
schema:
type: "array"
items:
$ref: "#/definitions/SerieResume"
/series/{serie}:
get:
tags:
- filters
parameters:
- name: "serie"
in: "path"
description: "the serie ID"
required: true
type: "string"
responses:
"200":
description: "Success"
schema:
$ref: "#/definitions/Serie"
"404":
description: "serie is not existing"
/categories:
get:
tags:
- filters
responses:
"200":
description: "List cards categories"
schema:
type: "array"
items:
type: "string"
/categories/{category}:
get:
tags:
- filters
parameters:
- name: "category"
in: "path"
required: true
type: "string"
responses:
"200":
description: "List cards with the category"
schema:
type: "array"
items:
$ref: "#/definitions/CardResume"
/hp:
get:
tags:
- filters
responses:
"200":
description: "List all different possibilities number of HP a card can have"
schema:
type: "array"
items:
type: "string"
/hp/{hp}:
get:
tags:
- filters
parameters:
- name: "hp"
in: "path"
required: true
type: "string"
responses:
"200":
description: "Get the Pokémon cards containing specified number of HP"
schema:
type: "array"
items:
$ref: "#/definitions/CardResume"
/illustrators:
get:
tags:
- filters
responses:
"200":
description: "Get all the Pokémon cards illustrators"
schema:
type: "array"
items:
type: "string"
/illustrators/{illustrator}:
get:
tags:
- filters
parameters:
- name: "illustrator"
in: "path"
required: true
type: "string"
responses:
"200":
description: "Get the cards containing the specified illustrator"
schema:
type: "array"
items:
$ref: "#/definitions/CardResume"
/rarities:
get:
tags:
- filters
responses:
"200":
description: "List cards rarities"
schema:
type: "array"
items:
type: "string"
/rarities/{rarity}:
get:
tags:
- filters
parameters:
- name: "rarity"
in: "path"
required: true
type: "string"
responses:
"200":
description: "Get the cards containing the specified rarity"
schema:
type: "array"
items:
$ref: "#/definitions/CardResume"
/retreats:
get:
tags:
- filters
responses:
"200":
description: "return the different number of retreats count"
schema:
type: "array"
items:
type: "string"
/retreats/{retreat}:
get:
tags:
- filters
parameters:
- name: "retreat"
in: "path"
required: true
type: "string"
responses:
"200":
description: "Get the cards containing the specified retreat count"
schema:
type: "array"
items:
$ref: "#/definitions/CardResume"
/types:
get:
tags:
- filters
responses:
"200":
description: "List all possible cards types"
schema:
type: "array"
items:
type: "string"
/types/{type}:
get:
tags:
- filters
parameters:
- name: "type"
in: "path"
required: true
type: "string"
responses:
"200":
description: "Get the cards containing the specified type"
schema:
type: "array"
items:
$ref: "#/definitions/CardResume"
definitions:
WeakRes:
type: "array"
xml:
name: "WeakResItem"
wrapped: true
items:
type: "object"
required:
- "type"
properties:
type:
type: "string"
example: "Psychic"
value:
type: "string"
example: "x2"
SerieResume:
type: "object"
required:
- "id"
- "name"
properties:
id:
type: "string"
name:
type: "string"
logo:
type: "string"
Serie:
type: "object"
required:
- "id"
- "name"
- "sets"
properties:
id:
type: "string"
name:
type: "string"
logo:
type: "string"
sets:
type: "array"
items:
$ref: "#/definitions/SetResume"
Set:
type: "object"
required:
- "id"
- "name"
- "cardCount"
- "serie"
- "releaseDate"
- "legal"
- "cards"
properties:
id:
type: "string"
example: "base1"
name:
type: "string"
example: "Base Set"
logo:
type: "string"
example: "https://assets.tcgdex.net/en/base/base1/logo"
symbol:
type: "string"
example: "https://assets.tcgdex.net/univ/base/base1/symbol"
cardCount:
type: "object"
required:
- "total"
- "official"
properties:
total:
type: "number"
example: 101
official:
type: "number"
example: 100
normal:
type: "number"
reverse:
type: "number"
holo:
type: "number"
firstEd:
type: "number"
cards:
type: "array"
items:
$ref: "#/definitions/CardResume"
SetResume:
type: "object"
required:
- "id"
- "name"
- "cardCount"
properties:
id:
type: "string"
example: "base1"
name:
type: "string"
example: "Base Set"
logo:
type: "string"
example: "https://assets.tcgdex.net/en/base/base1/logo"
symbol:
type: "string"
example: "https://assets.tcgdex.net/univ/base/base1/symbol"
cardCount:
type: "object"
required:
- "total"
- "official"
properties:
total:
type: "number"
example: 101
official:
type: "number"
example: 100
CardResume:
type: "object"
required:
- "id"
- "localId"
- "name"
properties:
id:
type: "string"
example: "base1-1"
localId:
type: "string"
example: "1"
image:
type: "string"
example: "https://assets.tcgdex.net/en/base/base1/1"
name:
type: "string"
example: "Alakazam"
Card:
type: "object"
required:
- "name"
- "id"
- "localId"
- "rarity"
- "category"
- "set"
- "legal"
properties:
id:
type: "string"
example: "base1-1"
localId:
type: "string"
example: "1"
image:
type: "string"
example: "https://assets.tcgdex.net/en/base/base1/1"
name:
type: "string"
example: "Alakazam"
illustrator:
type: "string"
example: "Ken Sugimori"
category:
type: "string"
example: "Pokemon"
rarity:
type: "string"
example: "Rare"
set:
$ref: "#/definitions/SetResume"
variants:
type: "object"
required:
- "normal"
- "reverse"
- "holo"
- "firstEdition"
properties:
normal:
type: "boolean"
reverse:
type: "boolean"
holo:
type: "boolean"
firstEdition:
type: "boolean"
hp:
type: "number"
example: 80
types:
type: "array"
items:
type: "string"
example: "Psychic"
evolveFrom:
type: "string"
example: "Kadabra"
stage:
type: "string"
example: "Stage2"
suffix:
type: "string"
item:
type: "object"
required:
- "name"
- "effect"
properties:
name:
type: "string"
effect:
type: "string"
trainerType:
type: "string"
energyType:
type: "string"
regulationMark:
type: "string"
example: "D"
legal:
type: "object"
properties:
standard:
type: "boolean"
example: false
expanded:
type: "boolean"
example: false
description:
type: "string"
level:
type: "number"
example: 30
abilities:
type: "array"
items:
type: "object"
properties:
type:
type: "string"
example: "Poke-POWER"
name:
type: "string"
example: "Damage Swap"
effect:
type: "string"
example: "As often as you like..."
attacks:
type: "array"
items:
type: "object"
required:
- "name"
properties:
cost:
type: "array"
items:
type: "string"
example:
- "Psychic"
- "Psychic"
- "Psychic"
name:
type: "string"
example: "Confuse Ray"
effect:
type: "string"
example: "Flip a coint. If heads, ..."
damage:
type: "number"
example: 30
retreat:
type: "number"
example: 3
dexId:
type: "array"
xml:
name: "dexIdItem"
wrapped: true
items:
type: "number"
weaknesses:
type: "array"
xml:
name: "weakness"
wrapped: true
items:
$ref: "#/definitions/WeakRes"
resistances:
type: "array"
xml:
name: "resistance"
wrapped: true
items:
$ref: "#/definitions/WeakRes"
xml:
name: "Card"
StringEndpoint:
type: "object"
required:
- "name"
- "cards"
properties:
name:
type: "string"
cards:
type: "array"
items:
$ref: "#/definitions/CardResume"
externalDocs:
description: "Find out more about TCGdex"
url: "http://www.tcgdex.net/docs"
openapi 3.0.0 definition
{
"openapi": "3.0.3",
"info": {
"title": "TCGdex API",
"description": "A Multilanguage Pokémon TCG Database with Cards Pictures and most of the informations contained on the cards. \nYou can find out more about TCGdex at [https://www.tcgdex.net](https://www.tcgdex.net) or on [Discord](https://discord.gg/NehYTAhsZE).",
"contact": {
"name": "TCGdex",
"url": "https://github.com/tcgdex/cards-database",
"email": "contact@tcgdex.net"
},
"license": {
"name": "MIT License",
"url": "https://github.com/tcgdex/cards-database/blob/master/LICENSE"
},
"version": "2.0.0"
},
"externalDocs": {
"description": "Find out more about TCGdex",
"url": "http://www.tcgdex.net/docs"
},
"servers": [
{
"url": "https://api.tcgdex.net/v2/{lang}",
"variables": {
"lang": {
"enum": [
"en",
"fr",
"es",
"it",
"pt"
],
"default": "en"
}
}
}
],
"tags": [
{
"name": "cards",
"description": "Fetch cards globally"
},
{
"name": "filters",
"description": "differents requests to filter cards"
}
],
"paths": {
"/cards": {
"get": {
"tags": [
"cards"
],
"summary": "fetch the list of cards",
"description": "desc",
"operationId": "cards",
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CardResume"
}
}
}
}
}
}
}
},
"/cards/{cardId}": {
"get": {
"tags": [
"cards"
],
"summary": "Finds Card by Global ID",
"description": "Find a defined card thatusing its global id",
"operationId": "findPetsByTags",
"parameters": [
{
"name": "cardId",
"in": "path",
"description": "Tags to filter by",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Card"
}
}
}
},
"404": {
"description": "Invalid card ID",
"content": {}
}
}
}
},
"/sets": {
"get": {
"tags": [
"filters"
],
"responses": {
"200": {
"description": "Successful request",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/SetResume"
}
}
}
}
}
}
}
},
"/sets/{set}": {
"get": {
"tags": [
"filters"
],
"parameters": [
{
"name": "set",
"in": "path",
"description": "the set ID",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Set"
}
}
}
},
"404": {
"description": "set is non existing",
"content": {}
}
}
}
},
"/sets/{set}/{cardLocalId}": {
"get": {
"tags": [
"cards"
],
"parameters": [
{
"name": "set",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "cardLocalId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Card"
}
}
}
},
"404": {
"description": "Set or cardLocalId incorrect",
"content": {}
}
}
}
},
"/series": {
"get": {
"tags": [
"filters"
],
"responses": {
"200": {
"description": "Successful request",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/SerieResume"
}
}
}
}
}
}
}
},
"/series/{serie}": {
"get": {
"tags": [
"filters"
],
"parameters": [
{
"name": "serie",
"in": "path",
"description": "the serie ID",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Serie"
}
}
}
},
"404": {
"description": "serie is not existing",
"content": {}
}
}
}
},
"/categories": {
"get": {
"tags": [
"filters"
],
"responses": {
"200": {
"description": "List cards categories",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
},
"/categories/{category}": {
"get": {
"tags": [
"filters"
],
"parameters": [
{
"name": "category",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "List cards with the category",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StringEndpoint"
}
}
}
}
}
}
},
"/hp": {
"get": {
"tags": [
"filters"
],
"responses": {
"200": {
"description": "List all different possibilities number of HP a card can have",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
},
"/hp/{hp}": {
"get": {
"tags": [
"filters"
],
"parameters": [
{
"name": "hp",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Get the Pokémon cards containing specified number of HP",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StringEndpoint"
}
}
}
}
}
}
},
"/illustrators": {
"get": {
"tags": [
"filters"
],
"responses": {
"200": {
"description": "Get all the Pokémon cards illustrators",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
},
"/illustrators/{illustrator}": {
"get": {
"tags": [
"filters"
],
"parameters": [
{
"name": "illustrator",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Get the cards containing the specified illustrator",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StringEndpoint"
}
}
}
}
}
}
},
"/rarities": {
"get": {
"tags": [
"filters"
],
"responses": {
"200": {
"description": "List cards rarities",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
},
"/rarities/{rarity}": {
"get": {
"tags": [
"filters"
],
"parameters": [
{
"name": "rarity",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Get the cards containing the specified rarity",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StringEndpoint"
}
}
}
}
}
}
},
"/retreats": {
"get": {
"tags": [
"filters"
],
"responses": {
"200": {
"description": "return the different number of retreats count",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
},
"/retreats/{retreat}": {
"get": {
"tags": [
"filters"
],
"parameters": [
{
"name": "retreat",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Get the cards containing the specified retreat count",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StringEndpoint"
}
}
}
}
}
}
},
"/types": {
"get": {
"tags": [
"filters"
],
"responses": {
"200": {
"description": "List all possible cards types",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
},
"/types/{type}": {
"get": {
"tags": [
"filters"
],
"parameters": [
{
"name": "type",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Get the cards containing the specified type",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CardResume"
}
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"WeakRes": {
"type": "array",
"xml": {
"name": "WeakResItem",
"wrapped": true
},
"items": {
"required": [
"type"
],
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "Psychic"
},
"value": {
"type": "string",
"example": "x2"
}
}
}
},
"SerieResume": {
"required": [
"id",
"name"
],
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"logo": {
"type": "string"
}
}
},
"Serie": {
"required": [
"id",
"name",
"sets"
],
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"logo": {
"type": "string"
},
"sets": {
"type": "array",
"items": {
"$ref": "#/components/schemas/SetResume"
}
}
}
},
"Set": {
"required": [
"cardCount",
"cards",
"id",
"name"
],
"type": "object",
"properties": {
"id": {
"type": "string",
"example": "base1"
},
"name": {
"type": "string",
"example": "Base Set"
},
"logo": {
"type": "string",
"example": "https://assets.tcgdex.net/en/base/base1/logo"
},
"symbol": {
"type": "string",
"example": "https://assets.tcgdex.net/univ/base/base1/symbol"
},
"cardCount": {
"required": [
"official",
"total"
],
"type": "object",
"properties": {
"total": {
"type": "number",
"example": 101
},
"official": {
"type": "number",
"example": 100
},
"normal": {
"type": "number"
},
"reverse": {
"type": "number"
},
"holo": {
"type": "number"
},
"firstEd": {
"type": "number"
}
}
},
"cards": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CardResume"
}
}
}
},
"SetResume": {
"required": [
"cardCount",
"id",
"name"
],
"type": "object",
"properties": {
"id": {
"type": "string",
"example": "base1"
},
"name": {
"type": "string",
"example": "Base Set"
},
"logo": {
"type": "string",
"example": "https://assets.tcgdex.net/en/base/base1/logo"
},
"symbol": {
"type": "string",
"example": "https://assets.tcgdex.net/univ/base/base1/symbol"
},
"cardCount": {
"required": [
"official",
"total"
],
"type": "object",
"properties": {
"total": {
"type": "number",
"example": 101
},
"official": {
"type": "number",
"example": 100
}
}
}
}
},
"CardResume": {
"required": [
"id",
"localId",
"name"
],
"type": "object",
"properties": {
"id": {
"type": "string",
"example": "base1-1"
},
"localId": {
"type": "string",
"example": "1"
},
"image": {
"type": "string",
"example": "https://assets.tcgdex.net/en/base/base1/1"
},
"name": {
"type": "string",
"example": "Alakazam"
}
}
},
"Card": {
"required": [
"category",
"id",
"legal",
"localId",
"name",
"rarity",
"set"
],
"type": "object",
"properties": {
"id": {
"type": "string",
"example": "base1-1"
},
"localId": {
"type": "string",
"example": "1"
},
"image": {
"type": "string",
"example": "https://assets.tcgdex.net/en/base/base1/1"
},
"name": {
"type": "string",
"example": "Alakazam"
},
"illustrator": {
"type": "string",
"example": "Ken Sugimori"
},
"category": {
"type": "string",
"example": "Pokemon"
},
"rarity": {
"type": "string",
"example": "Rare"
},
"set": {
"$ref": "#/components/schemas/SetResume"
},
"variants": {
"required": [
"firstEdition",
"holo",
"normal",
"reverse"
],
"type": "object",
"properties": {
"normal": {
"type": "boolean"
},
"reverse": {
"type": "boolean"
},
"holo": {
"type": "boolean"
},
"firstEdition": {
"type": "boolean"
}
}
},
"hp": {
"type": "number",
"example": 80
},
"types": {
"type": "array",
"items": {
"type": "string",
"example": "Psychic"
}
},
"evolveFrom": {
"type": "string",
"example": "Kadabra"
},
"stage": {
"type": "string",
"example": "Stage2"
},
"suffix": {
"type": "string"
},
"item": {
"required": [
"effect",
"name"
],
"type": "object",
"properties": {
"name": {
"type": "string"
},
"effect": {
"type": "string"
}
}
},
"trainerType": {
"type": "string"
},
"energyType": {
"type": "string"
},
"regulationMark": {
"type": "string",
"example": "D"
},
"legal": {
"type": "object",
"properties": {
"standard": {
"type": "boolean",
"example": false
},
"expanded": {
"type": "boolean",
"example": false
}
}
},
"description": {
"type": "string"
},
"level": {
"type": "number",
"example": 30
},
"abilities": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "Poke-POWER"
},
"name": {
"type": "string",
"example": "Damage Swap"
},
"effect": {
"type": "string",
"example": "As often as you like..."
}
}
}
},
"attacks": {
"type": "array",
"items": {
"required": [
"name"
],
"type": "object",
"properties": {
"cost": {
"type": "array",
"items": {
"type": "string",
"example": ""
}
},
"name": {
"type": "string",
"example": "Confuse Ray"
},
"effect": {
"type": "string",
"example": "Flip a coint. If heads, ..."
},
"damage": {
"type": "number",
"example": 30
}
}
}
},
"retreat": {
"type": "number",
"example": 3
},
"dexId": {
"type": "array",
"xml": {
"name": "dexIdItem",
"wrapped": true
},
"items": {
"type": "number"
}
},
"weaknesses": {
"type": "array",
"xml": {
"name": "weakness",
"wrapped": true
},
"items": {
"$ref": "#/components/schemas/WeakRes"
}
},
"resistances": {
"type": "array",
"xml": {
"name": "resistance",
"wrapped": true
},
"items": {
"$ref": "#/components/schemas/WeakRes"
}
}
},
"xml": {
"name": "Card"
}
},
"StringEndpoint": {
"required": [
"cards",
"name"
],
"type": "object",
"properties": {
"name": {
"type": "string"
},
"cards": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CardResume"
}
}
}
}
}
}
}
Add an OpenAPI