diff --git a/openapi/machine-api.json b/openapi/machine-api.json index 9af909f36..f9605887d 100644 --- a/openapi/machine-api.json +++ b/openapi/machine-api.json @@ -113,12 +113,21 @@ ], "description": "Maximum part size that can be manufactured by this device. This may be some sort of theoretical upper bound, getting close to this limit seems like maybe a bad idea.\n\nThis may be `None` if the maximum size is not knowable by the Machine API.\n\nWhat \"close\" means is up to you!", "nullable": true + }, + "state": { + "allOf": [ + { + "$ref": "#/components/schemas/MachineState" + } + ], + "description": "Status of the printer -- be it printing, idle, or unreachable. This may dictate if a machine is capable of taking a new job." } }, "required": [ "id", "machine_type", - "make_model" + "make_model", + "state" ], "type": "object" }, @@ -143,6 +152,67 @@ }, "type": "object" }, + "MachineState": { + "description": "Current state of the machine -- be it printing, idle or offline. This can be used to determine if a printer is in the correct state to take a new job.", + "oneOf": [ + { + "description": "If a print state can not be resolved at this time, an Unknown may be returned.", + "enum": [ + "Unknown" + ], + "type": "string" + }, + { + "description": "Idle, and ready for another job.", + "enum": [ + "Idle" + ], + "type": "string" + }, + { + "description": "Running a job -- 3D printing or CNC-ing a part.", + "enum": [ + "Running" + ], + "type": "string" + }, + { + "description": "Machine is currently offline or unreachable.", + "enum": [ + "Offline" + ], + "type": "string" + }, + { + "description": "Job is underway but halted, waiting for some action to take place.", + "enum": [ + "Paused" + ], + "type": "string" + }, + { + "description": "Job is finished, but waiting manual action to move back to Idle.", + "enum": [ + "Complete" + ], + "type": "string" + }, + { + "additionalProperties": false, + "description": "The printer has failed and is in an unknown state that may require manual attention to resolve. The inner value is a human readable description of what specifically has failed.", + "properties": { + "Failed": { + "nullable": true, + "type": "string" + } + }, + "required": [ + "Failed" + ], + "type": "object" + } + ] + }, "MachineType": { "description": "Specific technique by which this Machine takes a design, and produces a real-world 3D object.", "oneOf": [ diff --git a/src/lib/machine-api.d.ts b/src/lib/machine-api.d.ts index 5b450a16d..fae5c676f 100644 --- a/src/lib/machine-api.d.ts +++ b/src/lib/machine-api.d.ts @@ -4,313 +4,316 @@ */ export interface paths { - '/': { - parameters: { - query?: never - header?: never - path?: never - cookie?: never - } - /** Return the OpenAPI schema in JSON format. */ - get: operations['api_get_schema'] - put?: never - post?: never - delete?: never - options?: never - head?: never - patch?: never - trace?: never - } - '/machines': { - parameters: { - query?: never - header?: never - path?: never - cookie?: never - } - /** List available machines and their statuses */ - get: operations['get_machines'] - put?: never - post?: never - delete?: never - options?: never - head?: never - patch?: never - trace?: never - } - '/machines/{id}': { - parameters: { - query?: never - header?: never - path?: never - cookie?: never - } - /** Get the status of a specific machine */ - get: operations['get_machine'] - put?: never - post?: never - delete?: never - options?: never - head?: never - patch?: never - trace?: never - } - '/ping': { - parameters: { - query?: never - header?: never - path?: never - cookie?: never - } - /** Return pong. */ - get: operations['ping'] - put?: never - post?: never - delete?: never - options?: never - head?: never - patch?: never - trace?: never - } - '/print': { - parameters: { - query?: never - header?: never - path?: never - cookie?: never - } - get?: never - put?: never - /** Print a given file. File must be a sliceable 3D model. */ - post: operations['print_file'] - delete?: never - options?: never - head?: never - patch?: never - trace?: never - } + "/": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Return the OpenAPI schema in JSON format. */ + get: operations["api_get_schema"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/machines": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** List available machines and their statuses */ + get: operations["get_machines"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/machines/{id}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get the status of a specific machine */ + get: operations["get_machine"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/ping": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Return pong. */ + get: operations["ping"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/print": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Print a given file. File must be a sliceable 3D model. */ + post: operations["print_file"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; } -export type webhooks = Record +export type webhooks = Record; export interface components { - schemas: { - /** @description Error information from a response. */ - Error: { - error_code?: string - message: string - request_id: string - } - /** @description Extra machine-specific information regarding a connected machine. */ - ExtraMachineInfoResponse: - | { - Moonraker: Record - } - | { - Usb: Record - } - | { - Bambu: Record - } - /** @description Information regarding a connected machine. */ - MachineInfoResponse: { - /** @description Additional, per-machine information which is specific to the underlying machine type. */ - extra?: components['schemas']['ExtraMachineInfoResponse'] | null - /** @description Machine Identifier (ID) for the specific Machine. */ - id: string - /** @description Information regarding the method of manufacture. */ - machine_type: components['schemas']['MachineType'] - /** @description Information regarding the make and model of the attached Machine. */ - make_model: components['schemas']['MachineMakeModel'] - /** @description Maximum part size that can be manufactured by this device. This may be some sort of theoretical upper bound, getting close to this limit seems like maybe a bad idea. - * - * This may be `None` if the maximum size is not knowable by the Machine API. - * - * What "close" means is up to you! */ - max_part_volume?: components['schemas']['Volume'] | null - } - /** @description Information regarding the make/model of a discovered endpoint. */ - MachineMakeModel: { - /** @description The manufacturer that built the connected Machine. */ - manufacturer?: string | null - /** @description The model of the connected Machine. */ - model?: string | null - /** @description The unique serial number of the connected Machine. */ - serial?: string | null - } - /** @description Specific technique by which this Machine takes a design, and produces a real-world 3D object. */ - MachineType: 'Stereolithography' | 'FusedDeposition' | 'Cnc' - /** @description The response from the `/ping` endpoint. */ - Pong: { - /** @description The pong response. */ - message: string - } - /** @description The response from the `/print` endpoint. */ - PrintJobResponse: { - /** @description The job id used for this print. */ - job_id: string - /** @description The parameters used for this print. */ - parameters: components['schemas']['PrintParameters'] - } - /** @description Parameters for printing. */ - PrintParameters: { - /** @description The name for the job. */ - job_name: string - /** @description The machine id to print to. */ - machine_id: string - } - /** @description Set of three values to represent the extent of a 3-D Volume. This contains the width, depth, and height values, generally used to represent some maximum or minimum. - * - * All measurements are in millimeters. */ - Volume: { - /** - * Format: double - * @description Depth of the volume ("front to back"), in millimeters. - */ - depth: number - /** - * Format: double - * @description Height of the volume ("up and down"), in millimeters. - */ - height: number - /** - * Format: double - * @description Width of the volume ("left and right"), in millimeters. - */ - width: number - } - } - responses: { - /** @description Error */ - Error: { - headers: { - [name: string]: unknown - } - content: { - 'application/json': components['schemas']['Error'] - } - } - } - parameters: never - requestBodies: never - headers: never - pathItems: never + schemas: { + /** @description Error information from a response. */ + Error: { + error_code?: string; + message: string; + request_id: string; + }; + /** @description Extra machine-specific information regarding a connected machine. */ + ExtraMachineInfoResponse: { + Moonraker: Record; + } | { + Usb: Record; + } | { + Bambu: Record; + }; + /** @description Information regarding a connected machine. */ + MachineInfoResponse: { + /** @description Additional, per-machine information which is specific to the underlying machine type. */ + extra?: components["schemas"]["ExtraMachineInfoResponse"] | null; + /** @description Machine Identifier (ID) for the specific Machine. */ + id: string; + /** @description Information regarding the method of manufacture. */ + machine_type: components["schemas"]["MachineType"]; + /** @description Information regarding the make and model of the attached Machine. */ + make_model: components["schemas"]["MachineMakeModel"]; + /** @description Maximum part size that can be manufactured by this device. This may be some sort of theoretical upper bound, getting close to this limit seems like maybe a bad idea. + * + * This may be `None` if the maximum size is not knowable by the Machine API. + * + * What "close" means is up to you! */ + max_part_volume?: components["schemas"]["Volume"] | null; + /** @description Status of the printer -- be it printing, idle, or unreachable. This may dictate if a machine is capable of taking a new job. */ + state: components["schemas"]["MachineState"]; + }; + /** @description Information regarding the make/model of a discovered endpoint. */ + MachineMakeModel: { + /** @description The manufacturer that built the connected Machine. */ + manufacturer?: string | null; + /** @description The model of the connected Machine. */ + model?: string | null; + /** @description The unique serial number of the connected Machine. */ + serial?: string | null; + }; + /** @description Current state of the machine -- be it printing, idle or offline. This can be used to determine if a printer is in the correct state to take a new job. */ + MachineState: "Unknown" | "Idle" | "Running" | "Offline" | "Paused" | "Complete" | { + Failed: string | null; + }; + /** @description Specific technique by which this Machine takes a design, and produces a real-world 3D object. */ + MachineType: "Stereolithography" | "FusedDeposition" | "Cnc"; + /** @description The response from the `/ping` endpoint. */ + Pong: { + /** @description The pong response. */ + message: string; + }; + /** @description The response from the `/print` endpoint. */ + PrintJobResponse: { + /** @description The job id used for this print. */ + job_id: string; + /** @description The parameters used for this print. */ + parameters: components["schemas"]["PrintParameters"]; + }; + /** @description Parameters for printing. */ + PrintParameters: { + /** @description The name for the job. */ + job_name: string; + /** @description The machine id to print to. */ + machine_id: string; + }; + /** @description Set of three values to represent the extent of a 3-D Volume. This contains the width, depth, and height values, generally used to represent some maximum or minimum. + * + * All measurements are in millimeters. */ + Volume: { + /** + * Format: double + * @description Depth of the volume ("front to back"), in millimeters. + */ + depth: number; + /** + * Format: double + * @description Height of the volume ("up and down"), in millimeters. + */ + height: number; + /** + * Format: double + * @description Width of the volume ("left and right"), in millimeters. + */ + width: number; + }; + }; + responses: { + /** @description Error */ + Error: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Error"]; + }; + }; + }; + parameters: never; + requestBodies: never; + headers: never; + pathItems: never; } -export type $defs = Record +export type $defs = Record; export interface operations { - api_get_schema: { - parameters: { - query?: never - header?: never - path?: never - cookie?: never - } - requestBody?: never - responses: { - /** @description successful operation */ - 200: { - headers: { - [name: string]: unknown - } - content: { - 'application/json': unknown - } - } - '4XX': components['responses']['Error'] - '5XX': components['responses']['Error'] - } - } - get_machines: { - parameters: { - query?: never - header?: never - path?: never - cookie?: never - } - requestBody?: never - responses: { - /** @description successful operation */ - 200: { - headers: { - [name: string]: unknown - } - content: { - 'application/json': components['schemas']['MachineInfoResponse'][] - } - } - '4XX': components['responses']['Error'] - '5XX': components['responses']['Error'] - } - } - get_machine: { - parameters: { - query?: never - header?: never - path: { - /** @description The machine ID. */ - id: string - } - cookie?: never - } - requestBody?: never - responses: { - /** @description successful operation */ - 200: { - headers: { - [name: string]: unknown - } - content: { - 'application/json': components['schemas']['MachineInfoResponse'] - } - } - '4XX': components['responses']['Error'] - '5XX': components['responses']['Error'] - } - } - ping: { - parameters: { - query?: never - header?: never - path?: never - cookie?: never - } - requestBody?: never - responses: { - /** @description successful operation */ - 200: { - headers: { - [name: string]: unknown - } - content: { - 'application/json': components['schemas']['Pong'] - } - } - '4XX': components['responses']['Error'] - '5XX': components['responses']['Error'] - } - } - print_file: { - parameters: { - query?: never - header?: never - path?: never - cookie?: never - } - requestBody: { - content: { - 'multipart/form-data': string - } - } - responses: { - /** @description successful operation */ - 200: { - headers: { - [name: string]: unknown - } - content: { - 'application/json': components['schemas']['PrintJobResponse'] - } - } - '4XX': components['responses']['Error'] - '5XX': components['responses']['Error'] - } - } + api_get_schema: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description successful operation */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": unknown; + }; + }; + "4XX": components["responses"]["Error"]; + "5XX": components["responses"]["Error"]; + }; + }; + get_machines: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description successful operation */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["MachineInfoResponse"][]; + }; + }; + "4XX": components["responses"]["Error"]; + "5XX": components["responses"]["Error"]; + }; + }; + get_machine: { + parameters: { + query?: never; + header?: never; + path: { + /** @description The machine ID. */ + id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description successful operation */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["MachineInfoResponse"]; + }; + }; + "4XX": components["responses"]["Error"]; + "5XX": components["responses"]["Error"]; + }; + }; + ping: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description successful operation */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Pong"]; + }; + }; + "4XX": components["responses"]["Error"]; + "5XX": components["responses"]["Error"]; + }; + }; + print_file: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "multipart/form-data": string; + }; + }; + responses: { + /** @description successful operation */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["PrintJobResponse"]; + }; + }; + "4XX": components["responses"]["Error"]; + "5XX": components["responses"]["Error"]; + }; + }; }