gamesheet_sdk.admin.cli.helpers module¶
CLI helper functions shared across commands.
- gamesheet_sdk.admin.cli.helpers.build_authenticated_session(config)[source]¶
Build an AuthenticatedSession from saved tokens.
- Parameters:
config (Config) – The application config.
- Returns:
AuthenticatedSession – An AuthenticatedSession ready to use.
- Raises:
Exit – If no tokens are saved.
- Return type:
- gamesheet_sdk.admin.cli.helpers.run_team_update(ctx, season_id, team_id, title, division_id, external_id, logo_path, *, remove_logo, output_format, output_path)[source]¶
Run team update action and render output.
Shared implementation for teams update and divisions teams update commands.
- Parameters:
ctx (Context) – The click context containing the config.
season_id (str) – Season ID containing the team.
team_id (str) – Team ID to update.
title (str | None) – New team name/title.
division_id (str | None) – New division ID.
external_id (str | None) – New external identifier.
logo_path (str | None) – Path to a new logo image file.
remove_logo (bool) – Remove the team’s logo.
output_format (str) – Output format for rendering.
output_path (str | None) – Optional output file path.
- Raises:
Exit – If no fields are provided for update.
- gamesheet_sdk.admin.cli.helpers.run_team_create(ctx, season_id, title, division_id, external_id, logo_path, output_format, output_path)[source]¶
Run team create action and render output with success message.
Shared implementation for teams create and divisions teams create commands.
- Parameters:
ctx (Context) – The click context containing the config.
season_id (str) – Season ID to create the team in.
title (str) – Team name/title.
division_id (str) – Division ID the team belongs to.
external_id (str | None) – Optional external identifier.
logo_path (str | None) – Optional path to a logo image file.
output_format (str) – Output format for rendering.
output_path (str | None) – Optional output file path.
- gamesheet_sdk.admin.cli.helpers.run_team_delete(ctx, season_id, team_id)[source]¶
Run team delete action with success message.
Shared implementation for teams delete and divisions teams delete commands.
- gamesheet_sdk.admin.cli.helpers.run_roster_assign_with_output(action, session, resource_type, resource_id, target_id, output_format, output_path, *args, **kwargs)[source]¶
Run roster assign action with error handling and output rendering.
- Parameters:
action (Any) – The assign action function to call.
session (AuthenticatedSession) – Authenticated session.
resource_type (str) – Type of resource being assigned (player/coach).
resource_id (str) – ID of the resource being assigned.
target_id (str) – ID of the target team.
output_format (str) – Output format for rendering.
output_path (str | None) – Optional output file path.
*args (Any) – Positional arguments forwarded to
action.**kwargs (Any) – Keyword arguments forwarded to
action.
- Raises:
Exit – If the action raises an exception.
- gamesheet_sdk.admin.cli.helpers.run_roster_unassign(action, session, resource_type, resource_id, target_id, *args)[source]¶
Run roster unassign action with error handling.
- Parameters:
action (Any) – The unassign action function to call.
session (AuthenticatedSession) – Authenticated session.
resource_type (str) – Type of resource being unassigned (player/coach).
resource_id (str) – ID of the resource being unassigned.
target_id (str) – ID of the target team.
*args (Any) – Positional arguments forwarded to
action.
- Raises:
Exit – If the action raises an exception.
- gamesheet_sdk.admin.cli.helpers.run_roster_update_with_output(action, session, resource_type, output_format, output_path, *args, **kwargs)[source]¶
Run roster update action with error handling and output rendering.
- Parameters:
action (Any) – The update action function to call.
session (AuthenticatedSession) – Authenticated session.
resource_type (str) – Type of resource being updated (player/coach).
output_format (str) – Output format for rendering.
output_path (str | None) – Optional output file path.
*args (Any) – Positional arguments forwarded to
action.**kwargs (Any) – Keyword arguments forwarded to
action.
- Raises:
Exit – If the action raises an exception.
- gamesheet_sdk.admin.cli.helpers.run_roster_create_with_output(action, session, resource_type, output_format, output_path, *args, success_message=None, **kwargs)[source]¶
Run roster create action with error handling and output rendering.
- Parameters:
action (Any) – The create action function to call.
session (AuthenticatedSession) – Authenticated session.
resource_type (str) – Type of resource being created (player/coach).
output_format (str) – Output format for rendering.
output_path (str | None) – Optional output file path.
*args (Any) – Positional arguments forwarded to
action.success_message (str | None) – Optional custom success message (uses result.id formatting if contains {id}).
**kwargs (Any) – Keyword arguments forwarded to
action.
- Raises:
Exit – If the action raises an exception.
- gamesheet_sdk.admin.cli.helpers.run_roster_delete(action, session, resource_type, resource_id, *args)[source]¶
Run roster delete action with error handling.
- Parameters:
action (Callable[..., Any]) – The delete action function to call.
session (AuthenticatedSession) – Authenticated session.
resource_type (str) – Type of resource being deleted (player/coach).
resource_id (str) – ID of the resource being deleted.
*args (object) – Positional arguments forwarded to
action.
- Raises:
Exit – If the action raises an exception.