update machine-api openapi

This commit is contained in:
Paul R. Tagliamonte
2024-10-03 21:37:23 -04:00
parent d7bc92afd9
commit c1a450b15e
2 changed files with 379 additions and 306 deletions

View File

@ -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!", "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 "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": [ "required": [
"id", "id",
"machine_type", "machine_type",
"make_model" "make_model",
"state"
], ],
"type": "object" "type": "object"
}, },
@ -143,6 +152,67 @@
}, },
"type": "object" "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": { "MachineType": {
"description": "Specific technique by which this Machine takes a design, and produces a real-world 3D object.", "description": "Specific technique by which this Machine takes a design, and produces a real-world 3D object.",
"oneOf": [ "oneOf": [

View File

@ -4,313 +4,316 @@
*/ */
export interface paths { export interface paths {
'/': { "/": {
parameters: { parameters: {
query?: never query?: never;
header?: never header?: never;
path?: never path?: never;
cookie?: never cookie?: never;
} };
/** Return the OpenAPI schema in JSON format. */ /** Return the OpenAPI schema in JSON format. */
get: operations['api_get_schema'] get: operations["api_get_schema"];
put?: never put?: never;
post?: never post?: never;
delete?: never delete?: never;
options?: never options?: never;
head?: never head?: never;
patch?: never patch?: never;
trace?: never trace?: never;
} };
'/machines': { "/machines": {
parameters: { parameters: {
query?: never query?: never;
header?: never header?: never;
path?: never path?: never;
cookie?: never cookie?: never;
} };
/** List available machines and their statuses */ /** List available machines and their statuses */
get: operations['get_machines'] get: operations["get_machines"];
put?: never put?: never;
post?: never post?: never;
delete?: never delete?: never;
options?: never options?: never;
head?: never head?: never;
patch?: never patch?: never;
trace?: never trace?: never;
} };
'/machines/{id}': { "/machines/{id}": {
parameters: { parameters: {
query?: never query?: never;
header?: never header?: never;
path?: never path?: never;
cookie?: never cookie?: never;
} };
/** Get the status of a specific machine */ /** Get the status of a specific machine */
get: operations['get_machine'] get: operations["get_machine"];
put?: never put?: never;
post?: never post?: never;
delete?: never delete?: never;
options?: never options?: never;
head?: never head?: never;
patch?: never patch?: never;
trace?: never trace?: never;
} };
'/ping': { "/ping": {
parameters: { parameters: {
query?: never query?: never;
header?: never header?: never;
path?: never path?: never;
cookie?: never cookie?: never;
} };
/** Return pong. */ /** Return pong. */
get: operations['ping'] get: operations["ping"];
put?: never put?: never;
post?: never post?: never;
delete?: never delete?: never;
options?: never options?: never;
head?: never head?: never;
patch?: never patch?: never;
trace?: never trace?: never;
} };
'/print': { "/print": {
parameters: { parameters: {
query?: never query?: never;
header?: never header?: never;
path?: never path?: never;
cookie?: never cookie?: never;
} };
get?: never get?: never;
put?: never put?: never;
/** Print a given file. File must be a sliceable 3D model. */ /** Print a given file. File must be a sliceable 3D model. */
post: operations['print_file'] post: operations["print_file"];
delete?: never delete?: never;
options?: never options?: never;
head?: never head?: never;
patch?: never patch?: never;
trace?: never trace?: never;
} };
} }
export type webhooks = Record<string, never> export type webhooks = Record<string, never>;
export interface components { export interface components {
schemas: { schemas: {
/** @description Error information from a response. */ /** @description Error information from a response. */
Error: { Error: {
error_code?: string error_code?: string;
message: string message: string;
request_id: string request_id: string;
} };
/** @description Extra machine-specific information regarding a connected machine. */ /** @description Extra machine-specific information regarding a connected machine. */
ExtraMachineInfoResponse: ExtraMachineInfoResponse: {
| { Moonraker: Record<string, never>;
Moonraker: Record<string, never> } | {
} Usb: Record<string, never>;
| { } | {
Usb: Record<string, never> Bambu: Record<string, never>;
} };
| { /** @description Information regarding a connected machine. */
Bambu: Record<string, never> MachineInfoResponse: {
} /** @description Additional, per-machine information which is specific to the underlying machine type. */
/** @description Information regarding a connected machine. */ extra?: components["schemas"]["ExtraMachineInfoResponse"] | null;
MachineInfoResponse: { /** @description Machine Identifier (ID) for the specific Machine. */
/** @description Additional, per-machine information which is specific to the underlying machine type. */ id: string;
extra?: components['schemas']['ExtraMachineInfoResponse'] | null /** @description Information regarding the method of manufacture. */
/** @description Machine Identifier (ID) for the specific Machine. */ machine_type: components["schemas"]["MachineType"];
id: string /** @description Information regarding the make and model of the attached Machine. */
/** @description Information regarding the method of manufacture. */ make_model: components["schemas"]["MachineMakeModel"];
machine_type: components['schemas']['MachineType'] /** @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.
/** @description Information regarding the make and model of the attached Machine. */ *
make_model: components['schemas']['MachineMakeModel'] * This may be `None` if the maximum size is not knowable by the Machine API.
/** @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. *
* * What "close" means is up to you! */
* This may be `None` if the maximum size is not knowable by the Machine API. 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. */
* What "close" means is up to you! */ state: components["schemas"]["MachineState"];
max_part_volume?: components['schemas']['Volume'] | null };
} /** @description Information regarding the make/model of a discovered endpoint. */
/** @description Information regarding the make/model of a discovered endpoint. */ MachineMakeModel: {
MachineMakeModel: { /** @description The manufacturer that built the connected Machine. */
/** @description The manufacturer that built the connected Machine. */ manufacturer?: string | null;
manufacturer?: string | null /** @description The model of the connected Machine. */
/** @description The model of the connected Machine. */ model?: string | null;
model?: string | null /** @description The unique serial number of the connected Machine. */
/** @description The unique serial number of the connected Machine. */ serial?: string | null;
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. */
/** @description Specific technique by which this Machine takes a design, and produces a real-world 3D object. */ MachineState: "Unknown" | "Idle" | "Running" | "Offline" | "Paused" | "Complete" | {
MachineType: 'Stereolithography' | 'FusedDeposition' | 'Cnc' Failed: string | null;
/** @description The response from the `/ping` endpoint. */ };
Pong: { /** @description Specific technique by which this Machine takes a design, and produces a real-world 3D object. */
/** @description The pong response. */ MachineType: "Stereolithography" | "FusedDeposition" | "Cnc";
message: string /** @description The response from the `/ping` endpoint. */
} Pong: {
/** @description The response from the `/print` endpoint. */ /** @description The pong response. */
PrintJobResponse: { message: string;
/** @description The job id used for this print. */ };
job_id: string /** @description The response from the `/print` endpoint. */
/** @description The parameters used for this print. */ PrintJobResponse: {
parameters: components['schemas']['PrintParameters'] /** @description The job id used for this print. */
} job_id: string;
/** @description Parameters for printing. */ /** @description The parameters used for this print. */
PrintParameters: { parameters: components["schemas"]["PrintParameters"];
/** @description The name for the job. */ };
job_name: string /** @description Parameters for printing. */
/** @description The machine id to print to. */ PrintParameters: {
machine_id: string /** @description The name for the job. */
} job_name: 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. /** @description The machine id to print to. */
* machine_id: string;
* All measurements are in millimeters. */ };
Volume: { /** @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.
/** *
* Format: double * All measurements are in millimeters. */
* @description Depth of the volume ("front to back"), in millimeters. Volume: {
*/ /**
depth: number * Format: double
/** * @description Depth of the volume ("front to back"), in millimeters.
* Format: double */
* @description Height of the volume ("up and down"), in millimeters. depth: number;
*/ /**
height: number * Format: double
/** * @description Height of the volume ("up and down"), in millimeters.
* Format: double */
* @description Width of the volume ("left and right"), in millimeters. height: number;
*/ /**
width: number * Format: double
} * @description Width of the volume ("left and right"), in millimeters.
} */
responses: { width: number;
/** @description Error */ };
Error: { };
headers: { responses: {
[name: string]: unknown /** @description Error */
} Error: {
content: { headers: {
'application/json': components['schemas']['Error'] [name: string]: unknown;
} };
} content: {
} "application/json": components["schemas"]["Error"];
parameters: never };
requestBodies: never };
headers: never };
pathItems: never parameters: never;
requestBodies: never;
headers: never;
pathItems: never;
} }
export type $defs = Record<string, never> export type $defs = Record<string, never>;
export interface operations { export interface operations {
api_get_schema: { api_get_schema: {
parameters: { parameters: {
query?: never query?: never;
header?: never header?: never;
path?: never path?: never;
cookie?: never cookie?: never;
} };
requestBody?: never requestBody?: never;
responses: { responses: {
/** @description successful operation */ /** @description successful operation */
200: { 200: {
headers: { headers: {
[name: string]: unknown [name: string]: unknown;
} };
content: { content: {
'application/json': unknown "application/json": unknown;
} };
} };
'4XX': components['responses']['Error'] "4XX": components["responses"]["Error"];
'5XX': components['responses']['Error'] "5XX": components["responses"]["Error"];
} };
} };
get_machines: { get_machines: {
parameters: { parameters: {
query?: never query?: never;
header?: never header?: never;
path?: never path?: never;
cookie?: never cookie?: never;
} };
requestBody?: never requestBody?: never;
responses: { responses: {
/** @description successful operation */ /** @description successful operation */
200: { 200: {
headers: { headers: {
[name: string]: unknown [name: string]: unknown;
} };
content: { content: {
'application/json': components['schemas']['MachineInfoResponse'][] "application/json": components["schemas"]["MachineInfoResponse"][];
} };
} };
'4XX': components['responses']['Error'] "4XX": components["responses"]["Error"];
'5XX': components['responses']['Error'] "5XX": components["responses"]["Error"];
} };
} };
get_machine: { get_machine: {
parameters: { parameters: {
query?: never query?: never;
header?: never header?: never;
path: { path: {
/** @description The machine ID. */ /** @description The machine ID. */
id: string id: string;
} };
cookie?: never cookie?: never;
} };
requestBody?: never requestBody?: never;
responses: { responses: {
/** @description successful operation */ /** @description successful operation */
200: { 200: {
headers: { headers: {
[name: string]: unknown [name: string]: unknown;
} };
content: { content: {
'application/json': components['schemas']['MachineInfoResponse'] "application/json": components["schemas"]["MachineInfoResponse"];
} };
} };
'4XX': components['responses']['Error'] "4XX": components["responses"]["Error"];
'5XX': components['responses']['Error'] "5XX": components["responses"]["Error"];
} };
} };
ping: { ping: {
parameters: { parameters: {
query?: never query?: never;
header?: never header?: never;
path?: never path?: never;
cookie?: never cookie?: never;
} };
requestBody?: never requestBody?: never;
responses: { responses: {
/** @description successful operation */ /** @description successful operation */
200: { 200: {
headers: { headers: {
[name: string]: unknown [name: string]: unknown;
} };
content: { content: {
'application/json': components['schemas']['Pong'] "application/json": components["schemas"]["Pong"];
} };
} };
'4XX': components['responses']['Error'] "4XX": components["responses"]["Error"];
'5XX': components['responses']['Error'] "5XX": components["responses"]["Error"];
} };
} };
print_file: { print_file: {
parameters: { parameters: {
query?: never query?: never;
header?: never header?: never;
path?: never path?: never;
cookie?: never cookie?: never;
} };
requestBody: { requestBody: {
content: { content: {
'multipart/form-data': string "multipart/form-data": string;
} };
} };
responses: { responses: {
/** @description successful operation */ /** @description successful operation */
200: { 200: {
headers: { headers: {
[name: string]: unknown [name: string]: unknown;
} };
content: { content: {
'application/json': components['schemas']['PrintJobResponse'] "application/json": components["schemas"]["PrintJobResponse"];
} };
} };
'4XX': components['responses']['Error'] "4XX": components["responses"]["Error"];
'5XX': components['responses']['Error'] "5XX": components["responses"]["Error"];
} };
} };
} }