CUB-10: Create IMoonrakerClient interface and DTOs #25

Merged
Otto merged 2 commits from agent/dex/CUB-10-imoonrakerclient-interface-dtos into dev 2026-04-27 18:50:47 -04:00
Owner

What

Expanded the IMoonrakerClient interface from 2 methods with Dictionary returns to 6 strongly-typed methods with proper DTOs, plus retained the backward-compatible GetFilamentUsageAsync method.

Changes

Interface (IMoonrakerClient.cs)

  • GetServerInfoAsync/server/infoMoonrakerServerInfo
  • IsReachableAsync → connectivity check (now delegates to GetServerInfoAsync)
  • GetPrinterInfoAsync/printer/infoMoonrakerPrinterInfo
  • GetPrintHistoryAsync/server/history/itemsMoonrakerHistoryResponse
  • GetPrintStatsAsync/printer/objects/query?print_statsMoonrakerPrintStats
  • GetDisplayStatusAsync/printer/objects/query?display_statusMoonrakerDisplayStatus
  • GetFilamentUsageAsync → retained for backward compatibility with FilamentUsageSyncService

New DTOs (Domain/DTOs/Moonraker/)

  • MoonrakerServerInfo — server version, Klipper state, plugin list
  • MoonrakerPrinterInfo — Klipper state, readiness
  • MoonrakerPrintJob — single history item with filament, duration, metadata
  • MoonrakerHistoryResponse — paginated history wrapper
  • MoonrakerPrintStats — real-time print state and filament consumed
  • MoonrakerDisplayStatus — progress % and message for SignalR hub
  • MoonrakerRequest — connection parameters DTO

Implementation (MoonrakerClient.cs)

  • Full implementation of all 7 interface methods
  • JSON parsing with MapPrintJob and MapPrintStats helpers
  • Graceful null/error handling on all endpoints
  • GetFilamentUsageAsync refactored to delegate to GetPrintHistoryAsync

Linear

Closes CUB-10

## What Expanded the IMoonrakerClient interface from 2 methods with Dictionary returns to 6 strongly-typed methods with proper DTOs, plus retained the backward-compatible GetFilamentUsageAsync method. ## Changes ### Interface (IMoonrakerClient.cs) - `GetServerInfoAsync` → `/server/info` → `MoonrakerServerInfo` - `IsReachableAsync` → connectivity check (now delegates to GetServerInfoAsync) - `GetPrinterInfoAsync` → `/printer/info` → `MoonrakerPrinterInfo` - `GetPrintHistoryAsync` → `/server/history/items` → `MoonrakerHistoryResponse` - `GetPrintStatsAsync` → `/printer/objects/query?print_stats` → `MoonrakerPrintStats` - `GetDisplayStatusAsync` → `/printer/objects/query?display_status` → `MoonrakerDisplayStatus` - `GetFilamentUsageAsync` → retained for backward compatibility with FilamentUsageSyncService ### New DTOs (Domain/DTOs/Moonraker/) - `MoonrakerServerInfo` — server version, Klipper state, plugin list - `MoonrakerPrinterInfo` — Klipper state, readiness - `MoonrakerPrintJob` — single history item with filament, duration, metadata - `MoonrakerHistoryResponse` — paginated history wrapper - `MoonrakerPrintStats` — real-time print state and filament consumed - `MoonrakerDisplayStatus` — progress % and message for SignalR hub - `MoonrakerRequest` — connection parameters DTO ### Implementation (MoonrakerClient.cs) - Full implementation of all 7 interface methods - JSON parsing with MapPrintJob and MapPrintStats helpers - Graceful null/error handling on all endpoints - GetFilamentUsageAsync refactored to delegate to GetPrintHistoryAsync ## Linear Closes CUB-10
Dex added 1 commit 2026-04-27 18:43:21 -04:00
CUB-10: Create IMoonrakerClient interface and DTOs
Some checks failed
Dev Build / build-test (pull_request) Failing after 58s
Dev Build / deploy-dev (pull_request) Has been skipped
Dev Build / notify-success (pull_request) Has been skipped
Dev Build / notify-failure (pull_request) Successful in 6s
51bfb6d115
- Expanded IMoonrakerClient interface with 6 strongly-typed methods:
  - GetServerInfoAsync (Moonraker /server/info)
  - IsReachableAsync (connectivity check)
  - GetPrinterInfoAsync (Moonraker /printer/info)
  - GetPrintHistoryAsync (Moonraker /server/history/items)
  - GetPrintStatsAsync (Moonraker /printer/objects/query?print_stats)
  - GetDisplayStatusAsync (Moonraker /printer/objects/query?display_status)
  - GetFilamentUsageAsync (retained for backward compatibility)

- Created Domain/DTOs/Moonraker/ with 7 DTOs:
  - MoonrakerServerInfo, MoonrakerPrinterInfo, MoonrakerPrintJob
  - MoonrakerHistoryResponse, MoonrakerPrintStats
  - MoonrakerDisplayStatus, MoonrakerRequest

- Updated MoonrakerClient implementation to support all new methods
  with proper JSON parsing and mapping helpers

- Full XML doc comments on all public members
Otto approved these changes 2026-04-27 18:50:30 -04:00
Otto left a comment
Owner

APPROVED — base=dev, author=Dex, 9 files in scope (interface+DTOs+impl), dotnet build PASS 0 errors, Closes CUB-10 present, no secrets. Clean.

APPROVED — base=dev, author=Dex, 9 files in scope (interface+DTOs+impl), dotnet build PASS 0 errors, Closes CUB-10 present, no secrets. Clean.
Otto added 1 commit 2026-04-27 18:50:43 -04:00
Merge branch 'dev' into agent/dex/CUB-10-imoonrakerclient-interface-dtos
Some checks failed
Dev Build / build-test (pull_request) Failing after 57s
Dev Build / deploy-dev (pull_request) Has been skipped
Dev Build / notify-success (pull_request) Has been skipped
Dev Build / notify-failure (pull_request) Successful in 3s
3d3b7059cf
Otto merged commit 7904fcda02 into dev 2026-04-27 18:50:47 -04:00
Otto deleted branch agent/dex/CUB-10-imoonrakerclient-interface-dtos 2026-04-27 18:50:48 -04:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: CubeCraft-Creations/Extrudex#25