Skip to content

Commit

Permalink
stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
ckuhtz committed Jul 23, 2024
1 parent 04c1bd9 commit 0876f05
Showing 1 changed file with 61 additions and 8 deletions.
69 changes: 61 additions & 8 deletions api/routers/configuration.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,80 @@
# Configuration operations

from enum import Enum
from fastapi import APIRouter
import redis
from fastapi import APIRouter, Body

router = APIRouter()

# Data models

class SectionName(str, Enum):
n0nbh = 'n0nbh'
couchbase = 'couchbase'



# GET

@router.get('/configuration')
async def get_configuration():
return {'instance': 'instance'}
async def get_config():
return {'message': 'that\'s everything.'}

@router.get('/configuration/{instance}')
async def get_configuration_instance(instance: str):
async def get_config_instance(instance: str):
return {'instance': instance}

@router.get('/configuration/{instance}/{section}')
async def get_configuration_instance_section(instance: str, section: SectionName):
async def get_config_instance_section(instance: str, section: SectionName):
match section:
case SectionName.couchbase:
return {'instance': instance}, {'message': 'I am a futon.'}
return {'message': 'i am a futon.'}
case SectionName.n0nbh:
return {'instance': instance}, {'message': 'It is dark.'}
return {'message': 'it is dark.'}



# PUT

@router.put('/configuration')
async def put_config(body: dict = Body (...)):
return body

@router.get('/configuration/{instance}')
async def put_config_instance(instance: str, body: dict = Body (...)):
return body

@router.get('/configuration/{instance}/{section}')
async def put_config_instance_section(instance: str, section: SectionName, body: dict = Body (...)):
return body



# PATCH

@router.patch('/configuration')
async def patch_config():
return {'instance': 'instance'}

@router.patch('/configuration/{instance}')
async def patch_config_instance(instance: str):
return {'instance': 'instance'}

@router.patch('/configuration/{instance}/{section}')
async def patch_config_instance_section(instance: str, section: SectionName):
return {'instance': 'instance'}



# DELETE

@router.delete('/configuration')
async def delete_config():
return {'message': 'he\'s dead, jim.'}

@router.delete('/configuration/{instance}')
async def delete_config_instance(instance: str):
return {'message': 'he\'s dead, jim.'}

@router.delete('/configuration/{instance}/{section}')
async def delete_config_instance_section(instance: str, section: SectionName):
return {'message': 'he\'s dead, jim.'}

0 comments on commit 0876f05

Please sign in to comment.