Name | zombie-nomnom-api JSON |
Version |
1.0.0
JSON |
| download |
home_page | None |
Summary | An API for the zombie-nomnom pypi package exposing functionality via a graphql api. |
upload_time | 2024-11-16 19:37:04 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | None |
keywords |
game
api
dice
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
|
Zombie Nom Nom API
===
This is a game engine that is modeled after the popular board game zombie dice. This is meant for practice to be able to be messed with and explored.
[![Test and Deploy Docs](https://github.com/Carrera-Dev-Consulting/zombie-nomnom-api/actions/workflows/deploy-docs.yaml/badge.svg)](https://github.com/Carrera-Dev-Consulting/zombie-nomnom-api/actions/workflows/deploy-docs.yaml)
Table of Contents
---
- [Useful Links](#useful-links)
- [Installation](#installation)
- [Usage](#usage)
- [Running Locally](#running-locally)
- [GraphQL Usage](#graphql-usage)
- [Queries](#queries)
- [Mutations](#mutations)
Useful Links
---
Links to result of code coverage and pytest of latest builds.
* [Coverage Report](https://consulting.gxldcptrick.dev/zombie-nomnom-api/coverage/)
* [Latest Test Run](https://consulting.gxldcptrick.dev/zombie-nomnom-api/coverage/report.html)
* [Documentation](https://consulting.gxldcptrick.dev/zombie-nomnom-api/)
Installation
---
`pip install zombie-nomnom-api`
We require at least python 3.10 to be able to run properly.
Usage
---
To launch the app you will just need to run the package directly.
```bash
> zombie-nomnom-api
DEBUG:zombie_nomnom_api.graphql_app.schema:Registered schemas: ['Query', 'Mutation', 'Game', 'Round', 'Player', 'DieBag', 'Die', 'Move', 'DieColor', 'DieFace']
DEBUG:asyncio:Using proactor: IocpProactor
INFO: Started server process [16240]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://localhost:5000 (Press CTRL+C to quit)
```
CLI Support the following params
- `--host/-h` hostname you want to server your api from. defaults to `"localhost"`
- `--port/-p` port you want to listen on. defaults to `5000`
- `--worker-count/-w` amount of worker tasks to run concurrently. defaults to `1`
```bash
> zombie-nomnom-api -p 5000 -h 0.0.0.0 -w 10
```
### Configurations
<details>
<summary>Cross Origin Resource Sharing (CORS)</summary>
|Environment Variables|Description|
|---|---|
|`CORS_ORIGINS`|Comma separated list of origins to allow. Default: `["*"]`|
|`CORS_ALLOW_CREDENTIALS`|Whether or not to allow credentials. Default: `True`|
|`CORS_METHODS`|Comma separated list of methods to allow. Default: `["*"]`|
|`CORS_HEADERS`|Comma separated list of headers to allow. Default: `["*"]`|
</details>
<details>
<summary>Logging</summary>
|Environment Variables|Description|
|---|---|
|`LOG_LEVEL`|The log level to use. Default: `"DEBUG"`
</details>
Running locally
---
To run the service locally you simply need to run the module directly with python like:
```bash
> python -m zombie_nomnom_api
```
GraphQL Usage
---
For playing around with graphql queries please refer to [our hosted playground](https://zombie-nomnom-api-dev.gxldcptrick.dev)
### Queries
**Query All Games**
<details>
<summary>GQL Query</summary>
```graphql
query GetAllGames {
games {
id
moves {
name
player {
id
name
}
}
players {
id
name
score
hand {
color
currentFace
}
}
round {
player {
id
}
bag {
dice {
color
currentFace
sides
}
drawnDice {
color
currentFace
}
}
points
ended
}
gameOver
winner {
id
name
}
}
}
```
</details>
<details>
<summary>Example JSON</summary>
```json
{
"data": {
"games": [
{
"id": "b7ca3741-a850-4c11-83d5-15901b1b371b",
"moves": [
{
"name": "Score",
"player": {
"id": "61da55d0-0fee-48da-a613-0cb767d8eab2",
"name": "player"
}
}
],
"players": [
{
"id": "61da55d0-0fee-48da-a613-0cb767d8eab2",
"name": "player",
"score": 0,
"hand": []
}
],
"round": {
"player": {
"id": "61da55d0-0fee-48da-a613-0cb767d8eab2"
},
"bag": {
"dice": [
{
"color": "GREEN",
"currentFace": null,
"sides": [
"BRAIN",
"BRAIN",
"BRAIN",
"FOOT",
"FOOT",
"SHOTGUN"
]
},
{
"color": "GREEN",
"currentFace": null,
"sides": [
"BRAIN",
"BRAIN",
"BRAIN",
"FOOT",
"FOOT",
"SHOTGUN"
]
},
{
"color": "GREEN",
"currentFace": null,
"sides": [
"BRAIN",
"BRAIN",
"BRAIN",
"FOOT",
"FOOT",
"SHOTGUN"
]
},
{
"color": "GREEN",
"currentFace": null,
"sides": [
"BRAIN",
"BRAIN",
"BRAIN",
"FOOT",
"FOOT",
"SHOTGUN"
]
},
{
"color": "GREEN",
"currentFace": null,
"sides": [
"BRAIN",
"BRAIN",
"BRAIN",
"FOOT",
"FOOT",
"SHOTGUN"
]
},
{
"color": "GREEN",
"currentFace": null,
"sides": [
"BRAIN",
"BRAIN",
"BRAIN",
"FOOT",
"FOOT",
"SHOTGUN"
]
},
{
"color": "YELLOW",
"currentFace": null,
"sides": [
"BRAIN",
"BRAIN",
"FOOT",
"FOOT",
"SHOTGUN",
"SHOTGUN"
]
},
{
"color": "YELLOW",
"currentFace": null,
"sides": [
"BRAIN",
"BRAIN",
"FOOT",
"FOOT",
"SHOTGUN",
"SHOTGUN"
]
},
{
"color": "YELLOW",
"currentFace": null,
"sides": [
"BRAIN",
"BRAIN",
"FOOT",
"FOOT",
"SHOTGUN",
"SHOTGUN"
]
},
{
"color": "YELLOW",
"currentFace": null,
"sides": [
"BRAIN",
"BRAIN",
"FOOT",
"FOOT",
"SHOTGUN",
"SHOTGUN"
]
},
{
"color": "RED",
"currentFace": null,
"sides": [
"BRAIN",
"FOOT",
"FOOT",
"SHOTGUN",
"SHOTGUN",
"SHOTGUN"
]
},
{
"color": "RED",
"currentFace": null,
"sides": [
"BRAIN",
"FOOT",
"FOOT",
"SHOTGUN",
"SHOTGUN",
"SHOTGUN"
]
},
{
"color": "RED",
"currentFace": null,
"sides": [
"BRAIN",
"FOOT",
"FOOT",
"SHOTGUN",
"SHOTGUN",
"SHOTGUN"
]
}
],
"drawnDice": []
},
"points": 0,
"ended": false
},
"gameOver": false,
"winner": null
}
]
}
}
```
</details>
### Mutations
Play Zombie nom nom through mutations
**Creates a Game**
<details>
<summary>GQL Query</summary>
```graphql
mutation MakeAGame($players: [String!]!){
createGame(players: $players) {
errors
game {
id
moves {
name
player {
id
name
}
}
players {
id
name
}
}
}
}
```
</details>
<details>
<summary>Example JSON</summary>
```json
{
"data": {
"createGame": {
"errors": [],
"game": {
"id": "88041563-5774-4d4a-bcee-5bde15fd2b38",
"moves": [],
"players": [
{
"id": "069d9123-4dea-4d33-8bbf-8fe3cff6fd32",
"name": "player"
}
]
}
}
}
}
```
</details>
**Draw dice**
<details>
<summary>GQL Query</summary>
```graphql
mutation DrawDice($gameId: ID!) {
drawDice(gameId: $gameId) {
errors
round {
player {
hand {
currentFace
}
}
}
}
}
```
</details>
<details>
<summary>Example JSON</summary>
```json
{
"data": {
"drawDice": {
"errors": [],
"round": {
"player": {
"hand": [
{
"currentFace": "BRAIN"
},
{
"currentFace": "BRAIN"
},
{
"currentFace": "FOOT"
}
]
}
}
}
}
}
```
</details>
**End your turn**
<details>
<summary>GQL Query</summary>
```graphql
mutation EndRound($gameId: ID!){
endRound(gameId: $gameId){
errors
round{
player{
score
}
ended
}
}
}
```
</details>
<details>
<summary>Example JSON</summary>
```json
{
"data": {
"endRound": {
"errors": [],
"round": {
"player": {
"score": 0
},
"ended": true
}
}
}
}
```
</details>
Contribution
---
For details of conduct and expactations please refer to [CONTRIBUTION.md](https://github.com/Carrera-Dev-Consulting/zombie-nomnom-api/blob/main/CONTRIBUTING.md)
Pull requests will be pending review of at least one maintainer.
Pull requests are required to have finished the template checklist before they will be reviewed by a maintainer.
All code is formatted with the black formatter and we expect types and may run mypy to check that your code is properly typed as expected.
Names should make sense and be self descriptive of the proposed changes.
Raw data
{
"_id": null,
"home_page": null,
"name": "zombie-nomnom-api",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "game, api, dice",
"author": null,
"author_email": "Andres Carrera <andreshcar@live.com>",
"download_url": "https://files.pythonhosted.org/packages/5d/44/26a0b86176fd0e104956abdd0386988b7f3560e17c79844e15b8ddb89b52/zombie_nomnom_api-1.0.0.tar.gz",
"platform": null,
"description": "Zombie Nom Nom API\n===\n\nThis is a game engine that is modeled after the popular board game zombie dice. This is meant for practice to be able to be messed with and explored.\n\n[![Test and Deploy Docs](https://github.com/Carrera-Dev-Consulting/zombie-nomnom-api/actions/workflows/deploy-docs.yaml/badge.svg)](https://github.com/Carrera-Dev-Consulting/zombie-nomnom-api/actions/workflows/deploy-docs.yaml)\n\nTable of Contents\n---\n\n- [Useful Links](#useful-links)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Running Locally](#running-locally)\n- [GraphQL Usage](#graphql-usage)\n - [Queries](#queries)\n - [Mutations](#mutations)\n\nUseful Links\n---\n\nLinks to result of code coverage and pytest of latest builds.\n\n* [Coverage Report](https://consulting.gxldcptrick.dev/zombie-nomnom-api/coverage/)\n* [Latest Test Run](https://consulting.gxldcptrick.dev/zombie-nomnom-api/coverage/report.html)\n* [Documentation](https://consulting.gxldcptrick.dev/zombie-nomnom-api/)\n\nInstallation\n---\n\n`pip install zombie-nomnom-api`\n\n\nWe require at least python 3.10 to be able to run properly.\n\n\nUsage\n---\n\nTo launch the app you will just need to run the package directly.\n\n```bash\n > zombie-nomnom-api\n\nDEBUG:zombie_nomnom_api.graphql_app.schema:Registered schemas: ['Query', 'Mutation', 'Game', 'Round', 'Player', 'DieBag', 'Die', 'Move', 'DieColor', 'DieFace'] \nDEBUG:asyncio:Using proactor: IocpProactor\nINFO: Started server process [16240]\nINFO: Waiting for application startup.\nINFO: Application startup complete.\nINFO: Uvicorn running on http://localhost:5000 (Press CTRL+C to quit)\n```\n\nCLI Support the following params\n\n- `--host/-h` hostname you want to server your api from. defaults to `\"localhost\"`\n- `--port/-p` port you want to listen on. defaults to `5000`\n- `--worker-count/-w` amount of worker tasks to run concurrently. defaults to `1`\n\n```bash\n > zombie-nomnom-api -p 5000 -h 0.0.0.0 -w 10\n```\n\n### Configurations\n\n<details>\n <summary>Cross Origin Resource Sharing (CORS)</summary>\n\n|Environment Variables|Description|\n|---|---|\n|`CORS_ORIGINS`|Comma separated list of origins to allow. Default: `[\"*\"]`|\n|`CORS_ALLOW_CREDENTIALS`|Whether or not to allow credentials. Default: `True`|\n|`CORS_METHODS`|Comma separated list of methods to allow. Default: `[\"*\"]`|\n|`CORS_HEADERS`|Comma separated list of headers to allow. Default: `[\"*\"]`|\n\n</details>\n\n<details>\n <summary>Logging</summary>\n\n|Environment Variables|Description|\n|---|---|\n|`LOG_LEVEL`|The log level to use. Default: `\"DEBUG\"`\n\n</details>\n\nRunning locally\n---\n\nTo run the service locally you simply need to run the module directly with python like:\n\n```bash\n > python -m zombie_nomnom_api\n```\n\nGraphQL Usage\n---\n\nFor playing around with graphql queries please refer to [our hosted playground](https://zombie-nomnom-api-dev.gxldcptrick.dev)\n\n### Queries\n\n**Query All Games**\n\n<details>\n <summary>GQL Query</summary>\n\n```graphql\n query GetAllGames {\n games {\n id\n moves {\n name\n player {\n id\n name\n }\n }\n players {\n id\n name\n score\n hand {\n color\n currentFace\n }\n }\n round {\n player {\n id\n }\n bag {\n dice {\n color\n currentFace\n sides\n }\n drawnDice {\n color\n currentFace\n }\n }\n points\n ended\n }\n gameOver\n winner {\n id\n name\n }\n }\n }\n```\n\n</details>\n\n<details>\n <summary>Example JSON</summary>\n\n```json\n{\n \"data\": {\n \"games\": [\n {\n \"id\": \"b7ca3741-a850-4c11-83d5-15901b1b371b\",\n \"moves\": [\n {\n \"name\": \"Score\",\n \"player\": {\n \"id\": \"61da55d0-0fee-48da-a613-0cb767d8eab2\",\n \"name\": \"player\"\n }\n }\n ],\n \"players\": [\n {\n \"id\": \"61da55d0-0fee-48da-a613-0cb767d8eab2\",\n \"name\": \"player\",\n \"score\": 0,\n \"hand\": []\n }\n ],\n \"round\": {\n \"player\": {\n \"id\": \"61da55d0-0fee-48da-a613-0cb767d8eab2\"\n },\n \"bag\": {\n \"dice\": [\n {\n \"color\": \"GREEN\",\n \"currentFace\": null,\n \"sides\": [\n \"BRAIN\",\n \"BRAIN\",\n \"BRAIN\",\n \"FOOT\",\n \"FOOT\",\n \"SHOTGUN\"\n ]\n },\n {\n \"color\": \"GREEN\",\n \"currentFace\": null,\n \"sides\": [\n \"BRAIN\",\n \"BRAIN\",\n \"BRAIN\",\n \"FOOT\",\n \"FOOT\",\n \"SHOTGUN\"\n ]\n },\n {\n \"color\": \"GREEN\",\n \"currentFace\": null,\n \"sides\": [\n \"BRAIN\",\n \"BRAIN\",\n \"BRAIN\",\n \"FOOT\",\n \"FOOT\",\n \"SHOTGUN\"\n ]\n },\n {\n \"color\": \"GREEN\",\n \"currentFace\": null,\n \"sides\": [\n \"BRAIN\",\n \"BRAIN\",\n \"BRAIN\",\n \"FOOT\",\n \"FOOT\",\n \"SHOTGUN\"\n ]\n },\n {\n \"color\": \"GREEN\",\n \"currentFace\": null,\n \"sides\": [\n \"BRAIN\",\n \"BRAIN\",\n \"BRAIN\",\n \"FOOT\",\n \"FOOT\",\n \"SHOTGUN\"\n ]\n },\n {\n \"color\": \"GREEN\",\n \"currentFace\": null,\n \"sides\": [\n \"BRAIN\",\n \"BRAIN\",\n \"BRAIN\",\n \"FOOT\",\n \"FOOT\",\n \"SHOTGUN\"\n ]\n },\n {\n \"color\": \"YELLOW\",\n \"currentFace\": null,\n \"sides\": [\n \"BRAIN\",\n \"BRAIN\",\n \"FOOT\",\n \"FOOT\",\n \"SHOTGUN\",\n \"SHOTGUN\"\n ]\n },\n {\n \"color\": \"YELLOW\",\n \"currentFace\": null,\n \"sides\": [\n \"BRAIN\",\n \"BRAIN\",\n \"FOOT\",\n \"FOOT\",\n \"SHOTGUN\",\n \"SHOTGUN\"\n ]\n },\n {\n \"color\": \"YELLOW\",\n \"currentFace\": null,\n \"sides\": [\n \"BRAIN\",\n \"BRAIN\",\n \"FOOT\",\n \"FOOT\",\n \"SHOTGUN\",\n \"SHOTGUN\"\n ]\n },\n {\n \"color\": \"YELLOW\",\n \"currentFace\": null,\n \"sides\": [\n \"BRAIN\",\n \"BRAIN\",\n \"FOOT\",\n \"FOOT\",\n \"SHOTGUN\",\n \"SHOTGUN\"\n ]\n },\n {\n \"color\": \"RED\",\n \"currentFace\": null,\n \"sides\": [\n \"BRAIN\",\n \"FOOT\",\n \"FOOT\",\n \"SHOTGUN\",\n \"SHOTGUN\",\n \"SHOTGUN\"\n ]\n },\n {\n \"color\": \"RED\",\n \"currentFace\": null,\n \"sides\": [\n \"BRAIN\",\n \"FOOT\",\n \"FOOT\",\n \"SHOTGUN\",\n \"SHOTGUN\",\n \"SHOTGUN\"\n ]\n },\n {\n \"color\": \"RED\",\n \"currentFace\": null,\n \"sides\": [\n \"BRAIN\",\n \"FOOT\",\n \"FOOT\",\n \"SHOTGUN\",\n \"SHOTGUN\",\n \"SHOTGUN\"\n ]\n }\n ],\n \"drawnDice\": []\n },\n \"points\": 0,\n \"ended\": false\n },\n \"gameOver\": false,\n \"winner\": null\n }\n ]\n }\n}\n```\n\n</details>\n\n### Mutations\n\nPlay Zombie nom nom through mutations\n\n**Creates a Game**\n\n<details>\n <summary>GQL Query</summary>\n\n```graphql\n mutation MakeAGame($players: [String!]!){\n createGame(players: $players) {\n errors\n game {\n id\n moves {\n name\n player {\n id\n name\n }\n }\n players {\n id\n name\n }\n }\n }\n }\n```\n\n</details>\n\n<details>\n <summary>Example JSON</summary>\n\n```json\n{\n \"data\": {\n \"createGame\": {\n \"errors\": [],\n \"game\": {\n \"id\": \"88041563-5774-4d4a-bcee-5bde15fd2b38\",\n \"moves\": [],\n \"players\": [\n {\n \"id\": \"069d9123-4dea-4d33-8bbf-8fe3cff6fd32\",\n \"name\": \"player\"\n }\n ]\n }\n }\n }\n}\n```\n\n</details>\n\n\n**Draw dice**\n\n<details>\n<summary>GQL Query</summary>\n```graphql\n mutation DrawDice($gameId: ID!) {\n drawDice(gameId: $gameId) {\n errors\n round {\n player {\n hand {\n currentFace\n }\n }\n }\n }\n }\n```\n</details>\n\n<details>\n<summary>Example JSON</summary>\n\n```json\n{\n \"data\": {\n \"drawDice\": {\n \"errors\": [],\n \"round\": {\n \"player\": {\n \"hand\": [\n {\n \"currentFace\": \"BRAIN\"\n },\n {\n \"currentFace\": \"BRAIN\"\n },\n {\n \"currentFace\": \"FOOT\"\n }\n ]\n }\n }\n }\n }\n}\n```\n\n</details>\n\n\n**End your turn**\n<details>\n<summary>GQL Query</summary>\n```graphql\n mutation EndRound($gameId: ID!){\n endRound(gameId: $gameId){\n errors\n round{\n player{\n score\n }\n ended\n }\n }\n }\n```\n</details>\n\n<details>\n<summary>Example JSON</summary>\n\n```json\n{\n \"data\": {\n \"endRound\": {\n \"errors\": [],\n \"round\": {\n \"player\": {\n \"score\": 0\n },\n \"ended\": true\n }\n }\n }\n}\n```\n\n</details>\n\nContribution\n---\n\nFor details of conduct and expactations please refer to [CONTRIBUTION.md](https://github.com/Carrera-Dev-Consulting/zombie-nomnom-api/blob/main/CONTRIBUTING.md)\n\nPull requests will be pending review of at least one maintainer.\n\nPull requests are required to have finished the template checklist before they will be reviewed by a maintainer. \n\nAll code is formatted with the black formatter and we expect types and may run mypy to check that your code is properly typed as expected.\n\nNames should make sense and be self descriptive of the proposed changes.\n",
"bugtrack_url": null,
"license": null,
"summary": "An API for the zombie-nomnom pypi package exposing functionality via a graphql api.",
"version": "1.0.0",
"project_urls": {
"Changelog": "https://github.com/carrera-dev-consulting/zombie-nomnom-api/releases",
"Documentation": "https://consulting.gxldcptrick.dev/zombie-nomnom-api/docs",
"Homepage": "https://github.com/carrera-dev-consulting/zombie-nomnom-api",
"Issues": "https://github.com/carrera-dev-consulting/zombie-nomnom-api/issues",
"Repository": "https://github.com/carrera-dev-consulting/zombie-nomnom-api"
},
"split_keywords": [
"game",
" api",
" dice"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3ce041999f03154a6f4a88fe305c4cd54701b44d747cdc0a4ad3eb9013e4f959",
"md5": "f9f668d8f0940be6bb7aaa07b938e51d",
"sha256": "899f9291bf2eff811e066b00b51ad23ff9e08fe68e9ff08aed8841238d865ea6"
},
"downloads": -1,
"filename": "zombie_nomnom_api-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f9f668d8f0940be6bb7aaa07b938e51d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 12527,
"upload_time": "2024-11-16T19:37:03",
"upload_time_iso_8601": "2024-11-16T19:37:03.158194Z",
"url": "https://files.pythonhosted.org/packages/3c/e0/41999f03154a6f4a88fe305c4cd54701b44d747cdc0a4ad3eb9013e4f959/zombie_nomnom_api-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5d4426a0b86176fd0e104956abdd0386988b7f3560e17c79844e15b8ddb89b52",
"md5": "295fde6e5e80310f2c5d38eea4584c17",
"sha256": "b7be60d26186edc00126de8b456a423e70e3bf8ae7201291eff0a815a633c193"
},
"downloads": -1,
"filename": "zombie_nomnom_api-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "295fde6e5e80310f2c5d38eea4584c17",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 14944,
"upload_time": "2024-11-16T19:37:04",
"upload_time_iso_8601": "2024-11-16T19:37:04.773979Z",
"url": "https://files.pythonhosted.org/packages/5d/44/26a0b86176fd0e104956abdd0386988b7f3560e17c79844e15b8ddb89b52/zombie_nomnom_api-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-16 19:37:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "carrera-dev-consulting",
"github_project": "zombie-nomnom-api",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "zombie-nomnom-api"
}