gamesheet_sdk.common.shared¶
Shared utilities for domain modules.
Functions
|
Validate BFF API response status field. |
|
Centralized HTTP error handling for all domain modules. |
|
Upload an image file and return its Cloudflare CDN URL. |
- gamesheet_sdk.common.shared.check_bff_response_status(data, endpoint)[source]¶
Validate BFF API response status field.
BFF API responses include a
"status"field that should be"success".- Parameters:
- Raises:
GameSheetError – If status is not
"success".
- gamesheet_sdk.common.shared.handle_response(response, endpoint, context_msg='request')[source]¶
Centralized HTTP error handling for all domain modules.
- Parameters:
response (requests.Response) – The HTTP response object.
endpoint (str) – The endpoint that was called.
context_msg (str) – Context message for error reporting (e.g.,
"GET associations").
- Raises:
AuthenticationError – If response status is 401 (Unauthorized) or 403 (Forbidden).
GameSheetError – If response status is 404 or any other >= 400.
- gamesheet_sdk.common.shared.upload_image(session, image_path, image_type='image')[source]¶
Upload an image file and return its Cloudflare CDN URL.
- Parameters:
- Returns:
The Cloudflare CDN URL for the uploaded image.
- Return type:
- Raises:
GameSheetError – If the file is not found, is not a valid image, or the upload fails.
AuthenticationError – If the server returns 401.