Expose job and storage sub-objects from /api/v1/status#158
Merged
Conversation
PrinterStatus previously only typed the printer key. The status endpoint also returns job (absent when idle) and storage, which are useful for consumers polling a single endpoint. Verified against a live Core One printer running firmware 6.5.3. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
04b3529 to
c777a1b
Compare
agners
requested changes
Apr 28, 2026
| id: int | ||
| progress: float | ||
| time_printing: int | ||
| time_remaining: int | None |
Contributor
There was a problem hiding this comment.
Do printers return null? From OpenAPI spec (https://github.com/prusa3d/Prusa-Link-Web/blob/master/spec/openapi.yaml) it doesn't seem this field is optional.
- Add `free_space: NotRequired[int]` to StatusStorage (per OpenAPI spec) - Drop `| None` from time_remaining (spec doesn't mark it nullable; printer omits the field rather than returning null) - Drop `| None` from job/storage in PrinterStatus (printer omits, doesn't return null — `NotRequired` alone is sufficient) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Pushed 98b444e addressing all three points:
Test updated to include |
agners
approved these changes
May 7, 2026
| status_connect: StatusInfo | None | ||
|
|
||
|
|
||
| class StatusJob(TypedDict, total=False): |
Contributor
There was a problem hiding this comment.
We could argue using NotRequired on all the fields is a bit more consistent, but then again the API spec says all fields are optional for StatusJob, which this global flag captures nicely,
I am fine as is.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PrinterStatuspreviously only typed theprinterkey. The/api/v1/statusendpoint also returns:job— present while printing, absent in IDLE (typed withNotRequired)storage— the active storage deviceBoth are useful for consumers who want to poll a single endpoint instead of combining
/api/v1/statusand/api/v1/job.New types added to
types.py:StatusJob— job summary as it appears in the status responseStatusStorage— storage device as it appears in the status responseVerification
Verified the actual response structure against a live Core One printer (firmware 6.5.3) in both IDLE and PRINTING states. The
jobkey is genuinely absent (not null) when no job is running, henceNotRequiredrather than| None.Test plan
test_get_status— assertsjobandstoragefields during printingtest_get_status_idle— assertsjobkey is absent in IDLE response🤖 Generated with Claude Code