PokerFoe

PokerFoe · Ações GPT

Deck of Cards API Integration

Integration with the Deck of Cards API.

  • GET /deck/new/shuffle/Create a new shuffled deck
  • GET /deck/{deck_id}/draw/Draw cards from the deck
Esquema API original
{
  "openapi": "3.1.0",
  "info": {
    "title": "Deck of Cards API Integration",
    "description": "Integration with the Deck of Cards API.",
    "version": "v1.0.0"
  },
  "servers": [
    {
      "url": "https://deckofcardsapi.com/api/"
    }
  ],
  "paths": {
    "/deck/new/shuffle/": {
      "get": {
        "summary": "Create a new shuffled deck",
        "operationId": "createShuffledDeck",
        "parameters": [
          {
            "name": "deck_count",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A successfully shuffled deck",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShuffleResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request"
          }
        }
      }
    },
    "/deck/{deck_id}/draw/": {
      "get": {
        "summary": "Draw cards from the deck",
        "operationId": "drawCards",
        "parameters": [
          {
            "name": "deck_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "count",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cards drawn successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DrawResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ShuffleResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "deck_id": {
            "type": "string"
          },
          "shuffled": {
            "type": "boolean"
          },
          "remaining": {
            "type": "integer"
          }
        }
      },
      "DrawResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "cards": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Card"
            }
          },
          "deck_id": {
            "type": "string"
          },
          "remaining": {
            "type": "integer"
          }
        }
      },
      "Card": {
        "type": "object",
        "properties": {
          "suit": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "image": {
            "type": "string"
          }
        }
      }
    }
  }
}