Cat Feeder  1.0.0
The Cat feeder project
Loading...
Searching...
No Matches
decorator_constants.py
Go to the documentation of this file.
1r"""
2# +==== BEGIN CatFeeder =================+
3# LOGO:
4# ..............(..../\
5# ...............)..(.')
6# ..............(../..)
7# ...............\‍(__)|
8# Inspired by Joan Stark
9# source https://www.asciiart.eu/
10# animals/cats
11# /STOP
12# PROJECT: CatFeeder
13# FILE: decorator_constants.py
14# CREATION DATE: 24-01-2026
15# LAST Modified: 23:49:49 24-01-2026
16# DESCRIPTION:
17# This is the project in charge of making the connected cat feeder project work.
18# /STOP
19# COPYRIGHT: (c) Cat Feeder
20# PURPOSE: This is the file containing the constants for the decorators.
21# Constants for API endpoint decorators.
22#
23# Provides enums and constants to ensure consistency and reduce spelling mistakes in decorator usage.
24# // AR
25# +==== END CatFeeder =================+
26"""
27
28from enum import Enum
29# Fix the import - use the actual DataTypes from http_constants
30from ...http_codes.http_constants import DataTypes as ContentType
31
32
33class AuthScheme(Enum):
34 """Enumeration of supported authentication schemes."""
35 BEARER = "Bearer"
36 BASIC = "Basic"
37 DIGEST = "Digest"
38 API_KEY = "API-Key"
39 OAUTH = "OAuth"
40 JWT = "JWT"
41
42
43class CommonHeaders(Enum):
44 """Enumeration of commonly used HTTP headers."""
45 AUTHORIZATION = "Authorization"
46 API_KEY = "X-API-Key"
47 API_TOKEN = "X-API-Token"
48 CLIENT_ID = "X-Client-ID"
49 CONTENT_TYPE = "Content-Type"
50 USER_AGENT = "User-Agent"
51 ACCEPT = "Accept"
52 ACCEPT_LANGUAGE = "Accept-Language"
53
54
55class SecurityLevel(Enum):
56 """Enumeration of security levels for endpoints."""
57 PUBLIC = "public"
58 AUTHENTICATED = "authenticated"
59 ADMIN = "admin"
60 SUPER_ADMIN = "super_admin"
61 INTERNAL = "internal"
62
63
64class Environment(Enum):
65 """Enumeration of deployment environments."""
66 DEVELOPMENT = "development"
67 TESTING = "testing"
68 STAGING = "staging"
69 PRODUCTION = "production"
70 ALL = "all"
71
72
73class HttpMethod(Enum):
74 """Enumeration of HTTP methods."""
75 GET = "GET"
76 POST = "POST"
77 PUT = "PUT"
78 PATCH = "PATCH"
79 DELETE = "DELETE"
80 HEAD = "HEAD"
81 OPTIONS = "OPTIONS"
82
83
84class TagCategory(Enum):
85 """Enumeration of common API endpoint categories for tagging."""
86 ADMIN = "Admin"
87 USERS = "Users"
88 OAUTH = "OAuth"
89 PUBLIC = "Public"
90 SYSTEM = "System"
91 TESTING = "Testing"
92 FRONT_END = "Front-End"
93 AUTHENTICATED = "Authenticated"
94 CAT_MANAGEMENT = "Cat Management"
95 AUTHENTICATION = "Authentication"
96 FRONT_END_ASSETS = "Front-End Assets"
97
98
99class StatusCode(Enum):
100 """Common HTTP status codes for response documentation."""
101 OK = 200
102 CREATED = 201
103 ACCEPTED = 202
104 NO_CONTENT = 204
105 BAD_REQUEST = 400
106 UNAUTHORIZED = 401
107 FORBIDDEN = 403
108 NOT_FOUND = 404
109 METHOD_NOT_ALLOWED = 405
110 CONFLICT = 409
111 UNPROCESSABLE_ENTITY = 422
112 INTERNAL_SERVER_ERROR = 500
113 BAD_GATEWAY = 502
114 SERVICE_UNAVAILABLE = 503
115
116
117class QueryParamType(Enum):
118 """Common query parameter types."""
119 STRING = str
120 INTEGER = int
121 FLOAT = float
122 BOOLEAN = bool
123 LIST = list
124
125
126# Convenience constants for the most common combinations
127BEARER_AUTH = AuthScheme.BEARER.value
128BASIC_AUTH = AuthScheme.BASIC.value
129AUTH_HEADER = CommonHeaders.AUTHORIZATION.value
130API_KEY_HEADER = CommonHeaders.API_KEY.value
131
132# Security constants
133PUBLIC_SECURITY = SecurityLevel.PUBLIC.value
134AUTHENTICATED_SECURITY = SecurityLevel.AUTHENTICATED.value
135ADMIN_SECURITY = SecurityLevel.ADMIN.value
136
137# Environment constants
138DEV_ENV = Environment.DEVELOPMENT.value
139PROD_ENV = Environment.PRODUCTION.value
140TEST_ENV = Environment.TESTING.value
141
142# Common tag categories
143PUBLIC_TAG = TagCategory.PUBLIC.value
144USER_TAG = TagCategory.USERS.value
145ADMIN_TAG = TagCategory.ADMIN.value
146
147# Common content types from ContentType
148JSON_CONTENT = ContentType.JSON
149FORM_CONTENT = ContentType.FORM
150MULTIPART_CONTENT = ContentType.MULTIPART
151TEXT_CONTENT = ContentType.TEXT
152HTML_CONTENT = ContentType.HTML
153BINARY_CONTENT = ContentType.OCTET_STREAM