gamesheet_sdk.common.shared

Shared utilities for domain modules.

Functions

check_bff_response_status(data, endpoint)

Validate BFF API response status field.

handle_response(response, endpoint[, ...])

Centralized HTTP error handling for all domain modules.

upload_image(session, image_path[, image_type])

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:
  • data (dict[str, Any]) – The parsed JSON response data.

  • endpoint (str) – The endpoint that was called.

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:
gamesheet_sdk.common.shared.upload_image(session, image_path, image_type='image')[source]

Upload an image file and return its Cloudflare CDN URL.

Parameters:
  • session (Session) – An authenticated Session.

  • image_path (str) – Path to a local image file.

  • image_type (str) – Type of image for error messages (e.g., “photo”, “logo”).

Returns:

The Cloudflare CDN URL for the uploaded image.

Return type:

str

Raises: