requests.py 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. import typing
  2. import pydantic
  3. class user_login_request(pydantic.BaseModel):
  4. nick: str
  5. password: str
  6. model_config = {
  7. "json_schema_extra": {
  8. "excamples": [
  9. {
  10. "nick": "test",
  11. "password": "QWERTYZ"
  12. }
  13. ]
  14. }
  15. }
  16. class reservation_request(pydantic.BaseModel):
  17. apikey: str
  18. target_name: typing.Optional[str] = None
  19. target_barcode: typing.Optional[str] = None
  20. email: typing.Optional[str] = None
  21. phone_number: typing.Optional[str] = None
  22. model_config = {
  23. "json_schema_extra": {
  24. "excamples": [
  25. {
  26. "target_barcode": "123456789012",
  27. "email": "sample@noreply"
  28. },
  29. {
  30. "target_name": "Sample",
  31. "phone_number": "+48 123456789"
  32. }
  33. ]
  34. }
  35. }
  36. class user_get_request(pydantic.BaseModel):
  37. apikey: str
  38. model_config = {
  39. "json_schema_extra": {
  40. "excamples": [
  41. {
  42. "apikey": "af...699",
  43. }
  44. ]
  45. }
  46. }
  47. class product_update_request(pydantic.BaseModel):
  48. apikey: str
  49. name: str
  50. description: str
  51. author: str
  52. stock_count: int
  53. barcode: str
  54. model_config = {
  55. "json_schema_extra": {
  56. "excamples": [
  57. {
  58. "apikey": "af...69",
  59. "name": "Product Name",
  60. "description": "Product description.",
  61. "author": "Product author.",
  62. "stocik_count": 10,
  63. "barcode": "509282819938"
  64. }
  65. ]
  66. }
  67. }
  68. class product_create_request(pydantic.BaseModel):
  69. apikey: str
  70. name: str
  71. description: str
  72. author: str
  73. image: str
  74. stock_count: str
  75. barcode: str
  76. model_config = {
  77. "json_schema_extra": {
  78. "examples": [
  79. {
  80. "apikey": "af...69",
  81. "name": "Product Name",
  82. "description": "Product description.",
  83. "author": "Product author.",
  84. "image": "ddshfgiuhiugde... base64 encoded image",
  85. "stocik_count": 10,
  86. "barcode": "509282819938"
  87. }
  88. ]
  89. }
  90. }
  91. class product_update_image_request(pydantic.BaseModel):
  92. apikey: str
  93. image: str
  94. model_config = {
  95. "json_schema_extra": {
  96. "examples": [
  97. {
  98. "apikey": "af...69",
  99. "image": "lfjskhgshgkfj base64 encoded image"
  100. }
  101. ]
  102. }
  103. }
  104. class apikey_request(pydantic.BaseModel):
  105. apikey: str
  106. model_config = {
  107. "json_schema_extra": {
  108. "excamples": [
  109. {
  110. "apikey": "af...699",
  111. }
  112. ]
  113. }
  114. }