requests.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import pydantic
  2. class user_login_request(pydantic.BaseModel):
  3. nick: str
  4. password: str
  5. model_config = {
  6. "json_schema_extra": {
  7. "excamples": [
  8. {
  9. "nick": "test",
  10. "password": "QWERTYZ"
  11. }
  12. ]
  13. }
  14. }
  15. class user_get_request(pydantic.BaseModel):
  16. apikey: str
  17. model_config = {
  18. "json_schema_extra": {
  19. "excamples": [
  20. {
  21. "apikey": "af...699",
  22. }
  23. ]
  24. }
  25. }
  26. class product_request(pydantic.BaseModel):
  27. apikey: str
  28. name: str
  29. description: str
  30. author: str
  31. image: str
  32. stock_count: int
  33. barcode: str
  34. model_config = {
  35. "json_schema_extra": {
  36. "excamples": [
  37. {
  38. "apikey": "af...69",
  39. "name": "Product Name",
  40. "description": "Product description.",
  41. "author": "Product author.",
  42. "image": "https://api.com/image.png",
  43. "stocik_count": 10,
  44. "barcode": "509282819938"
  45. }
  46. ]
  47. }
  48. }
  49. class apikey_request(pydantic.BaseModel):
  50. apikey: str
  51. model_config = {
  52. "json_schema_extra": {
  53. "excamples": [
  54. {
  55. "apikey": "af...699",
  56. }
  57. ]
  58. }
  59. }