-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement basics of moonraker API
- Loading branch information
David Zwart
committed
Mar 26, 2024
1 parent
b947d87
commit 0312919
Showing
28 changed files
with
659 additions
and
13 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
src/services/moonraker/dto/machine/machine-device-power-device-state.dto.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface MachineDevicePowerDeviceStateDto { | ||
[k: string]: "off" | "on"; | ||
} |
10 changes: 10 additions & 0 deletions
10
src/services/moonraker/dto/machine/machine-device-power-devices.dto.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export interface MachineDevicePowerDevicesDto { | ||
devices: Device[]; | ||
} | ||
|
||
export interface Device { | ||
device: string; | ||
status: string; | ||
locked_while_printing: boolean; | ||
type: string; | ||
} |
115 changes: 115 additions & 0 deletions
115
src/services/moonraker/dto/machine/machine-update-status.dto.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
export interface MachineUpdateStatusDto { | ||
busy: boolean; | ||
github_rate_limit: number; | ||
github_requests_remaining: number; | ||
github_limit_reset_time: number; | ||
version_info: VersionInfo; | ||
} | ||
|
||
export interface VersionInfo { | ||
system: System; | ||
moonraker: Moonraker; | ||
mainsail: Mainsail; | ||
fluidd: Fluidd; | ||
klipper: Klipper; | ||
} | ||
|
||
export interface System { | ||
package_count: number; | ||
package_list: string[]; | ||
} | ||
|
||
export interface Moonraker { | ||
channel: string; | ||
debug_enabled: boolean; | ||
is_valid: boolean; | ||
configured_type: string; | ||
corrupt: boolean; | ||
info_tags: any[]; | ||
detected_type: string; | ||
remote_alias: string; | ||
branch: string; | ||
owner: string; | ||
repo_name: string; | ||
version: string; | ||
remote_version: string; | ||
rollback_version: string; | ||
current_hash: string; | ||
remote_hash: string; | ||
is_dirty: boolean; | ||
detached: boolean; | ||
commits_behind: any[]; | ||
git_messages: any[]; | ||
full_version_string: string; | ||
pristine: boolean; | ||
recovery_url: string; | ||
remote_url: string; | ||
warnings: any[]; | ||
anomalies: string[]; | ||
} | ||
|
||
export interface Mainsail { | ||
name: string; | ||
owner: string; | ||
version: string; | ||
remote_version: string; | ||
rollback_version: string; | ||
configured_type: string; | ||
channel: string; | ||
info_tags: string[]; | ||
warnings: any[]; | ||
anomalies: any[]; | ||
is_valid: boolean; | ||
} | ||
|
||
export interface Fluidd { | ||
name: string; | ||
owner: string; | ||
version: string; | ||
remote_version: string; | ||
rollback_version: string; | ||
configured_type: string; | ||
channel: string; | ||
info_tags: any[]; | ||
warnings: any[]; | ||
anomalies: any[]; | ||
is_valid: boolean; | ||
} | ||
|
||
export interface Klipper { | ||
channel: string; | ||
debug_enabled: boolean; | ||
is_valid: boolean; | ||
configured_type: string; | ||
corrupt: boolean; | ||
info_tags: any[]; | ||
detected_type: string; | ||
remote_alias: string; | ||
branch: string; | ||
owner: string; | ||
repo_name: string; | ||
version: string; | ||
remote_version: string; | ||
rollback_version: string; | ||
current_hash: string; | ||
remote_hash: string; | ||
is_dirty: boolean; | ||
detached: boolean; | ||
commits_behind: CommitsBehind[]; | ||
git_messages: any[]; | ||
full_version_string: string; | ||
pristine: boolean; | ||
recovery_url: string; | ||
remote_url: string; | ||
warnings: any[]; | ||
anomalies: any[]; | ||
} | ||
|
||
export interface CommitsBehind { | ||
sha: string; | ||
author: string; | ||
date: string; | ||
subject: string; | ||
message: string; | ||
tag: any; | ||
} |
20 changes: 20 additions & 0 deletions
20
src/services/moonraker/dto/machine/machine-wled-strips.dto.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export interface MachineWledStripsDto { | ||
strips: Strips; | ||
} | ||
|
||
export interface Strips { | ||
lights: StripStatus; | ||
desk: StripStatus; | ||
[k: string]: StripStatus; | ||
} | ||
|
||
export interface StripStatus { | ||
strip: string; | ||
status: string; | ||
chain_count: number; | ||
preset: number; | ||
brightness: number; | ||
intensity: number; | ||
speed: number; | ||
error: any; | ||
} |
File renamed without changes.
28 changes: 28 additions & 0 deletions
28
src/services/moonraker/dto/octoprint-compat/api-job.dto.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
export interface ApiJobDto { | ||
job: Job; | ||
progress: Progress; | ||
state: string; | ||
} | ||
|
||
export interface Job { | ||
file: File; | ||
estimatedPrintTime: any; | ||
filament: Filament; | ||
user: any; | ||
} | ||
|
||
export interface File { | ||
name: any; | ||
} | ||
|
||
export interface Filament { | ||
length: any; | ||
} | ||
|
||
export interface Progress { | ||
completion: any; | ||
filepos: any; | ||
printTime: any; | ||
printTimeLeft: any; | ||
printTimeOrigin: any; | ||
} |
11 changes: 11 additions & 0 deletions
11
src/services/moonraker/dto/octoprint-compat/api-login.dto.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export interface ApiLoginDto { | ||
_is_external_client: boolean; | ||
_login_mechanism: string; | ||
name: string; | ||
active: boolean; | ||
user: boolean; | ||
admin: boolean; | ||
apikey: any; | ||
permissions: any[]; | ||
groups: string[]; | ||
} |
40 changes: 40 additions & 0 deletions
40
src/services/moonraker/dto/octoprint-compat/api-printer.dto.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
export interface ApiPrinterDto { | ||
temperature: Temperature; | ||
state: State; | ||
} | ||
|
||
export interface Temperature { | ||
tool0: Tool0; | ||
bed: Bed; | ||
"...additionalHeaters": AdditionalHeaters; | ||
} | ||
|
||
export interface Tool0 { | ||
actual: number; | ||
offset: number; | ||
target: number; | ||
} | ||
|
||
export interface Bed { | ||
actual: number; | ||
offset: number; | ||
target: number; | ||
} | ||
|
||
export interface AdditionalHeaters {} | ||
|
||
export interface State { | ||
text: string; | ||
flags: Flags; | ||
} | ||
|
||
export interface Flags { | ||
operational: boolean; | ||
paused: boolean; | ||
printing: boolean; | ||
cancelling: boolean; | ||
pausing: boolean; | ||
error: boolean; | ||
ready: boolean; | ||
closedOrError: boolean; | ||
} |
18 changes: 18 additions & 0 deletions
18
src/services/moonraker/dto/octoprint-compat/api-profiles.dto.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export interface ApiProfilesDto { | ||
profiles: Profiles; | ||
} | ||
|
||
export interface Profiles { | ||
_default: Default; | ||
} | ||
|
||
export interface Default { | ||
id: string; | ||
name: string; | ||
color: string; | ||
model: string; | ||
default: boolean; | ||
current: boolean; | ||
heatedBed: boolean; | ||
heatedChamber: boolean; | ||
} |
33 changes: 33 additions & 0 deletions
33
src/services/moonraker/dto/octoprint-compat/api-settings.dto.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
export interface ApiSettingsDto { | ||
plugins: Plugins; | ||
feature: Feature; | ||
webcam: Webcam; | ||
} | ||
|
||
export interface Plugins { | ||
UltimakerFormatPackage: UltimakerFormatPackage; | ||
} | ||
|
||
export interface UltimakerFormatPackage { | ||
align_inline_thumbnail: boolean; | ||
inline_thumbnail: boolean; | ||
inline_thumbnail_align_value: string; | ||
inline_thumbnail_scale_value: string; | ||
installed: boolean; | ||
installed_version: string; | ||
scale_inline_thumbnail: boolean; | ||
state_panel_thumbnail: boolean; | ||
} | ||
|
||
export interface Feature { | ||
sdSupport: boolean; | ||
temperatureGraph: boolean; | ||
} | ||
|
||
export interface Webcam { | ||
flipH: boolean; | ||
flipV: boolean; | ||
rotate90: boolean; | ||
streamUrl: string; | ||
webcamEnabled: boolean; | ||
} |
5 changes: 5 additions & 0 deletions
5
src/services/moonraker/dto/octoprint-compat/api-version.dto.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export interface ApiVersionDto { | ||
server: string; | ||
api: string; | ||
text: string; | ||
} |
4 changes: 4 additions & 0 deletions
4
src/services/moonraker/dto/octoprint-compat/server-version.dto.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface ServerVersionDto { | ||
server: string; | ||
safemode: string; | ||
} |
6 changes: 3 additions & 3 deletions
6
...rvices/moonraker/dto/rpc/rpc-error.dto.ts → ...s/moonraker/dto/rpc/json-rpc-error.dto.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
export interface RpcErrorDto { | ||
export interface JsonRpcErrorDto { | ||
jsonrpc: string; | ||
error: Error; | ||
id: number; | ||
} | ||
|
||
export interface Error { | ||
code: number | ||
message: string | ||
code: number; | ||
message: string; | ||
} |
8 changes: 4 additions & 4 deletions
8
...ices/moonraker/dto/rpc/rpc-request.dto.ts → ...moonraker/dto/rpc/json-rpc-request.dto.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
export interface JsonRpcRequestDto { | ||
jsonrpc: string; | ||
export interface JsonRpcRequestDto<I = Record<string, any>> { | ||
jsonrpc: "2.0" | string; | ||
method: string; | ||
id: number; | ||
// MQTT may provide mqtt_timestamp param | ||
// "To avoid potential collisions from time drift it is recommended to specify the timestamp in microseconds since the Unix Epoch" | ||
// QoS 0 or 2 | ||
params: Record<string, any>; | ||
id: number; | ||
params?: I; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export interface JsonRpcResponseDto<T> { | ||
jsonrpc: "2.0" | string; | ||
id: number; | ||
result: T; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { JobDto } from "@/services/moonraker/dto/server-history/history-list.dto"; | ||
|
||
export interface HistoryJobDto { | ||
job: JobDto; | ||
} |
5 changes: 5 additions & 0 deletions
5
src/services/moonraker/dto/server-history/history-last-totals.dto.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { JobTotals } from "@/services/moonraker/dto/server-history/history-totals.dto"; | ||
|
||
export interface HistoryLastTotalsDto { | ||
last_totals: JobTotals; | ||
} |
19 changes: 19 additions & 0 deletions
19
src/services/moonraker/dto/server-history/history-list.dto.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export interface HistoryListDto { | ||
count: number; | ||
jobs: JobDto[]; | ||
} | ||
|
||
export interface JobDto { | ||
job_id: string; | ||
exists: boolean; | ||
end_time: number; | ||
filament_used: number; | ||
filename: string; | ||
metadata: Metadata; | ||
print_duration: number; | ||
status: string; | ||
start_time: number; | ||
total_duration: number; | ||
} | ||
|
||
export interface Metadata {} |
12 changes: 12 additions & 0 deletions
12
src/services/moonraker/dto/server-history/history-totals.dto.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export interface HistoryTotalsDto { | ||
job_totals: JobTotals; | ||
} | ||
|
||
export interface JobTotals { | ||
total_jobs: number; | ||
total_time: number; | ||
total_print_time: number; | ||
total_filament_used: number; | ||
longest_job: number; | ||
longest_print: number; | ||
} |
12 changes: 12 additions & 0 deletions
12
src/services/moonraker/dto/server-sensors/sensor-info.dto.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export interface SensorDto { | ||
id: string; | ||
friendly_name: string; | ||
type: string; | ||
values: SensorValues; | ||
} | ||
|
||
export interface SensorValues { | ||
value1: number; | ||
value2: number; | ||
[k: string]: number; | ||
} |
Oops, something went wrong.