gamesheet_sdk.teams.cli.commands.schedule.helpers module

Datetime resolution helpers for schedule CLI commands.

gamesheet_sdk.teams.cli.commands.schedule.helpers.format_teams_window(start_iso, end_iso)[source]

Reshape an ISO 8601 start/end pair into the teams gateway’s split representation.

Parameters:
  • start_iso (str) – Start datetime, ISO 8601.

  • end_iso (str) – End datetime, ISO 8601.

Returns:

tuple[str, str](start, end) as YYYY-MM-DDTHH:MM and HH:MM.

Return type:

tuple[str, str]

gamesheet_sdk.teams.cli.commands.schedule.helpers.resolve_schedule_create_times(start_date_time, start_date, start_time, end_date_time, end_date, end_time, duration, *, all_day=False, is_practice=False)[source]

Resolve create command datetime inputs into formatted start and end strings.

Parameters:
  • start_date_time (str | None) – Optional combined start datetime string.

  • start_date (str | None) – Optional start date string.

  • start_time (str | None) – Optional start time string.

  • end_date_time (str | None) – Optional combined end datetime string.

  • end_date (str | None) – Optional end date string.

  • end_time (str | None) – Optional end time string.

  • duration (str | int | None) – Optional duration in minutes.

  • all_day (bool) – Whether event is all day.

  • is_practice (bool) – Whether event is a practice.

Returns:

tuple[str, str] – Formatted start and end ISO strings.

Return type:

tuple[str, str]

gamesheet_sdk.teams.cli.commands.schedule.helpers.resolve_occurrence_update_times(start_date_time, start_date, start_time, end_date_time, end_date, end_time, duration, current_start, current_end)[source]

Resolve occurrence update datetime inputs.

Returns:

tuple[str | None, str | None] – Resolved (start_iso, end_iso) datetime strings.

Return type:

tuple[str | None, str | None]

gamesheet_sdk.teams.cli.commands.schedule.helpers.resolve_game_update_times(start_date_time, start_date, start_time, end_date_time, end_date, end_time, duration, current_date_time, current_end_time)[source]

Resolve game update datetime inputs.

Returns:

tuple[str | None, str | None] – Resolved (start_iso, end_time_iso) strings.

Return type:

tuple[str | None, str | None]

gamesheet_sdk.teams.cli.commands.schedule.helpers.validate_update_scope(*, update_future, update_single)[source]

Reject mutually exclusive occurrence update scope flags.

Called from the command body ahead of build_authenticated_session so a usage error is reported as such even when no session is stored, rather than surfacing as a login failure.

Parameters:
  • update_future (bool) – Update this and future occurrences flag.

  • update_single (bool) – Update only this occurrence flag.

Raises:

UsageError – If both flags are specified.

gamesheet_sdk.teams.cli.commands.schedule.helpers.confirm_delete_or_abort(event_type, event_id, *, force)[source]

Confirm a destructive delete before any authenticated work happens.

Called from the command body ahead of build_authenticated_session so that declining costs no login round trip, and so an aborted delete reports Aborted. rather than a session error.

Parameters:
  • event_type (str) – Event type name shown in the prompt.

  • event_id (str) – Event identifier shown in the prompt.

  • force (bool) – Skip the confirmation prompt.

Raises:

Exit – If the user declines the confirmation.

gamesheet_sdk.teams.cli.commands.schedule.helpers.prompt_delete_scope(run_action, session, event_id, event_type, timeout, *, force=False, scope_flags=None, all_occurrences=False, delete_future=False)[source]

Resolve recurring delete scope and confirm destruction interactively.

Parameters:
  • run_action (Callable[..., Any]) – Helper to execute actions.

  • session (TeamsAuthenticatedSession) – Authenticated session.

  • event_id (str) – Event identifier.

  • event_type (str) – Event type name.

  • timeout (float | None) – Optional timeout in seconds.

  • force (bool) – Skip confirmation prompt.

  • scope_flags (list[bool] | None) – Scope flags provided on CLI.

  • all_occurrences (bool) – Delete all occurrences flag.

  • delete_future (bool) – Delete future occurrences flag.

Returns:

tuple[bool, bool] – Tuple of (resolved_all, resolved_future).

Return type:

tuple[bool, bool]

gamesheet_sdk.teams.cli.commands.schedule.helpers.prompt_update_scope(occ, *, update_future=False, update_single=False)[source]

Prompt interactively for update scope if recurring and scope not explicitly given.

Returns:

bool – True if future occurrences should also be updated.

Return type:

bool

gamesheet_sdk.teams.cli.commands.schedule.helpers.handle_game_update(run_action, session, event_id, *, game_type, start_date_time, end_time, start, end, date, duration, team_id, season_id, division_id, opposing_team_id, opposing_division, association_id, league_id, home_flag, game_number, location_name, scorekeeper_name, scorekeeper_phone, broadcast_provider, timezone, timeout)[source]

Execute game update action with datetime resolution.

Returns:

UpdatedGameResult – Result of updating the game.

Return type:

UpdatedGameResult

gamesheet_sdk.teams.cli.commands.schedule.helpers.handle_occurrence_update(run_action, session, event_id, event_type, *, title, notes, location_name, start_date_time, end_time, start, end, date, duration, repeat, repeat_interval, repeat_by_day, repeat_until, rrule, update_future, update_single, timeout)[source]

Execute calendar occurrence update with scope prompt and datetime resolution.

Returns:

CalendarEventCreated – Result of creating/updating the occurrence.

Return type:

CalendarEventCreated

gamesheet_sdk.teams.cli.commands.schedule.helpers.handle_occurrence_delete(run_action, session, item_id, item_type, delete_action, output_format, output_path, columns_spec, *, force, scope_flags, all_occurrences, delete_future, timeout, use_result_message=True)[source]

Execute calendar occurrence deletion with scope prompt and rendering.

Parameters:
  • run_action (Callable[..., Any]) – Runner for API actions.

  • session (TeamsAuthenticatedSession) – Authenticated session.

  • item_id (str) – ID of event/occurrence to delete.

  • item_type (str | None) – Event type label (‘event’, ‘practice’, etc.).

  • delete_action (Callable[..., Any]) – Delete API action callable.

  • output_format (str) – Output format string (‘plain’, ‘json’, ‘yaml’).

  • output_path (str | None) – Optional output file path.

  • columns_spec (str | None) – Optional columns spec string.

  • force (bool) – Bypass confirmation prompt.

  • scope_flags (bool) – Whether scope flags were supplied.

  • all_occurrences (bool) – Delete all occurrences flag.

  • delete_future (bool) – Delete future occurrences flag.

  • timeout (float | None) – Optional request timeout.

  • use_result_message (bool) – Whether to display result.message if present.

gamesheet_sdk.teams.cli.commands.schedule.helpers.occurrence_update_options(func)[source]

Add common occurrence update CLI options to a command.

Parameters:

func (F) – The Click command function to decorate.

Returns:

F – Decorated command function with occurrence update options.

Return type:

F

gamesheet_sdk.teams.cli.commands.schedule.helpers.run_occurrence_update(run_action, session, event_id, event_type, output_format, output_path, columns_spec, *, title=None, notes=None, location_name=None, start_date_time=None, end_time=None, start=None, end=None, date=None, duration=None, repeat=None, repeat_interval=1, repeat_by_day=None, repeat_until=None, rrule=None, update_future=False, update_single=False, timeout=None, **_extra_kwargs)[source]

Validate arguments and execute calendar occurrence update.

Parameters:
  • run_action (Callable[..., Any]) – Runner for API actions.

  • session (TeamsAuthenticatedSession) – Authenticated session.

  • event_id (str) – Event or occurrence ID to update.

  • event_type (str | None) – Event type (‘event’, ‘practice’, etc.).

  • output_format (str) – Output format string (‘plain’, ‘json’, ‘yaml’).

  • output_path (str | None) – Optional output file path.

  • columns_spec (str | None) – Optional columns spec string.

  • title (str | None) – Optional updated title.

  • notes (str | None) – Optional updated notes.

  • location_name (str | None) – Optional updated location name.

  • start_date_time (str | None) – Optional start datetime string.

  • end_time (str | None) – Optional end time string.

  • start (str | None) – Optional flexible start input.

  • end (str | None) – Optional flexible end input.

  • date (str | None) – Optional date string.

  • duration (str | None) – Optional duration string.

  • repeat (str | None) – Optional repeat frequency.

  • repeat_interval (int) – Repeat interval.

  • repeat_by_day (str | None) – Optional repeat by day string.

  • repeat_until (str | None) – Optional repeat until date string.

  • rrule (str | None) – Optional RRULE string.

  • update_future (bool) – Update future occurrences flag.

  • update_single (bool) – Update single occurrence flag.

  • timeout (float | None) – Optional request timeout.