Skip to content

Instantly share code, notes, and snippets.

@kinlane
Last active August 12, 2020 00:52
Show Gist options
  • Save kinlane/46de46d66abb79a112a4 to your computer and use it in GitHub Desktop.
Save kinlane/46de46d66abb79a112a4 to your computer and use it in GitHub Desktop.
Deck of Cards API
{
"swagger": "2.0",
"info": {
"title": "Deck of Cards",
"description": "An API to simulate a deck of cards",
"termsOfService": "https://github.com/crobertsbmw/deckofcards/blob/master/LICENSE.txt",
"version": "v1"
},
"host": "deckofcardsapi.com",
"basePath": "/api/",
"schemes": [
"http"
],
"produces": [
"application/json"
],
"consumes": [
"application/json"
],
"paths": {
"/draw/{deck_id}/": {
"get": {
"summary": "Draw a Card",
"description": "The count variable defines how many cards to draw from the deck. Be sure to replace deck_id with a valid deck_id. We use the deck_id as an identifier so we know who is playing with what deck. After two weeks, if no actions have been made on the deck then we throw it away.",
"operationId": "draw-card",
"parameters": [
{
"in": "path",
"name": "deck_id",
"description": "The id of the deck.",
"type": "string",
"format": "string"
}
],
"responses": {
"200": {
"description": "draw response",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/cards"
}
}
}
},
"tags": [
" Draw"
]
}
},
"/shuffle/": {
"get": {
"summary": "Shuffle Deck",
"description": "Add deck_count as a GET or POST parameter to define the number of Decks you want to use. Blackjack typically uses 6 decks. The default is 1.",
"operationId": "shuffle-deck",
"parameters": [
{
"in": "query",
"name": "deck_count",
"description": "The deck count.",
"type": "string",
"format": "string"
}
],
"responses": {
"200": {
"description": "shuffle response",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/shuffle"
}
}
}
},
"tags": [
"Shuffle"
]
}
},
"/shuffle/{deck_id}/": {
"get": {
"summary": "Shuffle Deck",
"description": "Don't throw away a deck when all you want to do is shuffle. Include the deck_id on your call to shuffle your cards. Don't worry about reminding us how many decks you are playing with.",
"operationId": "shuffle-deck",
"parameters": [
{
"in": "path",
"name": "deck_id",
"description": "The id of the deck.",
"type": "string",
"format": "string"
}
],
"responses": {
"200": {
"description": "shuffle response",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/shuffle"
}
}
}
},
"tags": [
" Shuffle"
]
}
}
},
"definitions": {
"shuffle": {
"properties": {
"success": {
"description": "Whether it was success or not.",
"type": "boolean"
},
"deck_id": {
"description": "The deck id.",
"type": "string"
},
"remaining": {
"description": "Number of remaining cards.",
"type": "integer"
}
}
},
"card": {
"properties": {
"image": {
"description": "Image for the card.",
"type": "string"
},
"value": {
"description": "The value for the card.",
"type": "string"
},
"suit": {
"description": "The suit for the card.",
"type": "string"
}
}
},
"cards": {
"properties": {
"success": {
"description": "Whether it was success or not.",
"type": "boolean"
},
"deck_id": {
"description": "The deck id.",
"type": "string"
},
"remaining": {
"description": "Number of remaining cards.",
"type": "integer"
},
"cards": {
"type": "array",
"items": {
"$ref": "#/definitions/card"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment