Update machine-api spec (#3197)
YOYO NEW API SPEC! Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							1e07ea4986
						
					
				
				
					commit
					0df28abc4b
				
			
							
								
								
									
										335
									
								
								openapi/machine-api.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										335
									
								
								openapi/machine-api.json
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,335 @@
 | 
			
		||||
{
 | 
			
		||||
  "components": {
 | 
			
		||||
    "responses": {
 | 
			
		||||
      "Error": {
 | 
			
		||||
        "content": {
 | 
			
		||||
          "application/json": {
 | 
			
		||||
            "schema": {
 | 
			
		||||
              "$ref": "#/components/schemas/Error"
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "description": "Error"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "schemas": {
 | 
			
		||||
      "Error": {
 | 
			
		||||
        "description": "Error information from a response.",
 | 
			
		||||
        "properties": {
 | 
			
		||||
          "error_code": {
 | 
			
		||||
            "type": "string"
 | 
			
		||||
          },
 | 
			
		||||
          "message": {
 | 
			
		||||
            "type": "string"
 | 
			
		||||
          },
 | 
			
		||||
          "request_id": {
 | 
			
		||||
            "type": "string"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "required": [
 | 
			
		||||
          "message",
 | 
			
		||||
          "request_id"
 | 
			
		||||
        ],
 | 
			
		||||
        "type": "object"
 | 
			
		||||
      },
 | 
			
		||||
      "Machine": {
 | 
			
		||||
        "description": "Details for a 3d printer connected over USB.",
 | 
			
		||||
        "oneOf": [
 | 
			
		||||
          {
 | 
			
		||||
            "description": "Details for a 3d printer connected over USB.",
 | 
			
		||||
            "properties": {
 | 
			
		||||
              "id": {
 | 
			
		||||
                "type": "string"
 | 
			
		||||
              },
 | 
			
		||||
              "manufacturer": {
 | 
			
		||||
                "type": "string"
 | 
			
		||||
              },
 | 
			
		||||
              "model": {
 | 
			
		||||
                "type": "string"
 | 
			
		||||
              },
 | 
			
		||||
              "port": {
 | 
			
		||||
                "type": "string"
 | 
			
		||||
              },
 | 
			
		||||
              "type": {
 | 
			
		||||
                "enum": [
 | 
			
		||||
                  "UsbPrinter"
 | 
			
		||||
                ],
 | 
			
		||||
                "type": "string"
 | 
			
		||||
              }
 | 
			
		||||
            },
 | 
			
		||||
            "required": [
 | 
			
		||||
              "id",
 | 
			
		||||
              "manufacturer",
 | 
			
		||||
              "model",
 | 
			
		||||
              "port",
 | 
			
		||||
              "type"
 | 
			
		||||
            ],
 | 
			
		||||
            "type": "object"
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            "description": "Details for a 3d printer connected over USB.",
 | 
			
		||||
            "properties": {
 | 
			
		||||
              "hostname": {
 | 
			
		||||
                "description": "The hostname of the printer.",
 | 
			
		||||
                "nullable": true,
 | 
			
		||||
                "type": "string"
 | 
			
		||||
              },
 | 
			
		||||
              "ip": {
 | 
			
		||||
                "description": "The IP address of the printer.",
 | 
			
		||||
                "format": "ip",
 | 
			
		||||
                "type": "string"
 | 
			
		||||
              },
 | 
			
		||||
              "manufacturer": {
 | 
			
		||||
                "allOf": [
 | 
			
		||||
                  {
 | 
			
		||||
                    "$ref": "#/components/schemas/NetworkPrinterManufacturer"
 | 
			
		||||
                  }
 | 
			
		||||
                ],
 | 
			
		||||
                "description": "The manufacturer of the printer."
 | 
			
		||||
              },
 | 
			
		||||
              "model": {
 | 
			
		||||
                "description": "The model of the printer.",
 | 
			
		||||
                "nullable": true,
 | 
			
		||||
                "type": "string"
 | 
			
		||||
              },
 | 
			
		||||
              "port": {
 | 
			
		||||
                "description": "The port of the printer.",
 | 
			
		||||
                "format": "uint16",
 | 
			
		||||
                "minimum": 0,
 | 
			
		||||
                "nullable": true,
 | 
			
		||||
                "type": "integer"
 | 
			
		||||
              },
 | 
			
		||||
              "type": {
 | 
			
		||||
                "enum": [
 | 
			
		||||
                  "NetworkPrinter"
 | 
			
		||||
                ],
 | 
			
		||||
                "type": "string"
 | 
			
		||||
              }
 | 
			
		||||
            },
 | 
			
		||||
            "required": [
 | 
			
		||||
              "ip",
 | 
			
		||||
              "manufacturer",
 | 
			
		||||
              "type"
 | 
			
		||||
            ],
 | 
			
		||||
            "type": "object"
 | 
			
		||||
          }
 | 
			
		||||
        ]
 | 
			
		||||
      },
 | 
			
		||||
      "NetworkPrinterManufacturer": {
 | 
			
		||||
        "description": "Network printer manufacturer.",
 | 
			
		||||
        "oneOf": [
 | 
			
		||||
          {
 | 
			
		||||
            "description": "Bambu.",
 | 
			
		||||
            "enum": [
 | 
			
		||||
              "Bambu"
 | 
			
		||||
            ],
 | 
			
		||||
            "type": "string"
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            "description": "Formlabs.",
 | 
			
		||||
            "enum": [
 | 
			
		||||
              "Formlabs"
 | 
			
		||||
            ],
 | 
			
		||||
            "type": "string"
 | 
			
		||||
          }
 | 
			
		||||
        ]
 | 
			
		||||
      },
 | 
			
		||||
      "Pong": {
 | 
			
		||||
        "description": "The response from the `/ping` endpoint.",
 | 
			
		||||
        "properties": {
 | 
			
		||||
          "message": {
 | 
			
		||||
            "description": "The pong response.",
 | 
			
		||||
            "type": "string"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "required": [
 | 
			
		||||
          "message"
 | 
			
		||||
        ],
 | 
			
		||||
        "type": "object"
 | 
			
		||||
      },
 | 
			
		||||
      "PrintJobResponse": {
 | 
			
		||||
        "description": "The response from the `/print` endpoint.",
 | 
			
		||||
        "properties": {
 | 
			
		||||
          "job_id": {
 | 
			
		||||
            "description": "The job id used for this print.",
 | 
			
		||||
            "type": "string"
 | 
			
		||||
          },
 | 
			
		||||
          "parameters": {
 | 
			
		||||
            "allOf": [
 | 
			
		||||
              {
 | 
			
		||||
                "$ref": "#/components/schemas/PrintParameters"
 | 
			
		||||
              }
 | 
			
		||||
            ],
 | 
			
		||||
            "description": "The parameters used for this print."
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "required": [
 | 
			
		||||
          "job_id",
 | 
			
		||||
          "parameters"
 | 
			
		||||
        ],
 | 
			
		||||
        "type": "object"
 | 
			
		||||
      },
 | 
			
		||||
      "PrintParameters": {
 | 
			
		||||
        "description": "Parameters for printing.",
 | 
			
		||||
        "properties": {
 | 
			
		||||
          "machine_id": {
 | 
			
		||||
            "type": "string"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "required": [
 | 
			
		||||
          "machine_id"
 | 
			
		||||
        ],
 | 
			
		||||
        "type": "object"
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "info": {
 | 
			
		||||
    "contact": {
 | 
			
		||||
      "email": "machine-api@zoo.dev",
 | 
			
		||||
      "url": "https://zoo.dev"
 | 
			
		||||
    },
 | 
			
		||||
    "description": "",
 | 
			
		||||
    "title": "machine-api",
 | 
			
		||||
    "version": "0.1.0"
 | 
			
		||||
  },
 | 
			
		||||
  "openapi": "3.0.3",
 | 
			
		||||
  "paths": {
 | 
			
		||||
    "/": {
 | 
			
		||||
      "get": {
 | 
			
		||||
        "operationId": "api_get_schema",
 | 
			
		||||
        "responses": {
 | 
			
		||||
          "200": {
 | 
			
		||||
            "content": {
 | 
			
		||||
              "application/json": {
 | 
			
		||||
                "schema": {}
 | 
			
		||||
              }
 | 
			
		||||
            },
 | 
			
		||||
            "description": "successful operation"
 | 
			
		||||
          },
 | 
			
		||||
          "4XX": {
 | 
			
		||||
            "$ref": "#/components/responses/Error"
 | 
			
		||||
          },
 | 
			
		||||
          "5XX": {
 | 
			
		||||
            "$ref": "#/components/responses/Error"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "summary": "Return the OpenAPI schema in JSON format.",
 | 
			
		||||
        "tags": [
 | 
			
		||||
          "meta"
 | 
			
		||||
        ]
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "/machines": {
 | 
			
		||||
      "get": {
 | 
			
		||||
        "operationId": "get_machines",
 | 
			
		||||
        "responses": {
 | 
			
		||||
          "200": {
 | 
			
		||||
            "content": {
 | 
			
		||||
              "application/json": {
 | 
			
		||||
                "schema": {
 | 
			
		||||
                  "additionalProperties": {
 | 
			
		||||
                    "$ref": "#/components/schemas/Machine"
 | 
			
		||||
                  },
 | 
			
		||||
                  "title": "Map_of_Machine",
 | 
			
		||||
                  "type": "object"
 | 
			
		||||
                }
 | 
			
		||||
              }
 | 
			
		||||
            },
 | 
			
		||||
            "description": "successful operation"
 | 
			
		||||
          },
 | 
			
		||||
          "4XX": {
 | 
			
		||||
            "$ref": "#/components/responses/Error"
 | 
			
		||||
          },
 | 
			
		||||
          "5XX": {
 | 
			
		||||
            "$ref": "#/components/responses/Error"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "summary": "List available machines and their statuses",
 | 
			
		||||
        "tags": [
 | 
			
		||||
          "print"
 | 
			
		||||
        ]
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "/ping": {
 | 
			
		||||
      "get": {
 | 
			
		||||
        "operationId": "ping",
 | 
			
		||||
        "responses": {
 | 
			
		||||
          "200": {
 | 
			
		||||
            "content": {
 | 
			
		||||
              "application/json": {
 | 
			
		||||
                "schema": {
 | 
			
		||||
                  "$ref": "#/components/schemas/Pong"
 | 
			
		||||
                }
 | 
			
		||||
              }
 | 
			
		||||
            },
 | 
			
		||||
            "description": "successful operation"
 | 
			
		||||
          },
 | 
			
		||||
          "4XX": {
 | 
			
		||||
            "$ref": "#/components/responses/Error"
 | 
			
		||||
          },
 | 
			
		||||
          "5XX": {
 | 
			
		||||
            "$ref": "#/components/responses/Error"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "summary": "Return pong.",
 | 
			
		||||
        "tags": [
 | 
			
		||||
          "meta"
 | 
			
		||||
        ]
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "/print": {
 | 
			
		||||
      "post": {
 | 
			
		||||
        "operationId": "print_file",
 | 
			
		||||
        "requestBody": {
 | 
			
		||||
          "content": {
 | 
			
		||||
            "multipart/form-data": {
 | 
			
		||||
              "schema": {
 | 
			
		||||
                "format": "binary",
 | 
			
		||||
                "type": "string"
 | 
			
		||||
              }
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
          "required": true
 | 
			
		||||
        },
 | 
			
		||||
        "responses": {
 | 
			
		||||
          "200": {
 | 
			
		||||
            "content": {
 | 
			
		||||
              "application/json": {
 | 
			
		||||
                "schema": {
 | 
			
		||||
                  "$ref": "#/components/schemas/PrintJobResponse"
 | 
			
		||||
                }
 | 
			
		||||
              }
 | 
			
		||||
            },
 | 
			
		||||
            "description": "successful operation"
 | 
			
		||||
          },
 | 
			
		||||
          "4XX": {
 | 
			
		||||
            "$ref": "#/components/responses/Error"
 | 
			
		||||
          },
 | 
			
		||||
          "5XX": {
 | 
			
		||||
            "$ref": "#/components/responses/Error"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "summary": "Print a given file. File must be a sliceable 3D model.",
 | 
			
		||||
        "tags": [
 | 
			
		||||
          "print"
 | 
			
		||||
        ]
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "tags": [
 | 
			
		||||
    {
 | 
			
		||||
      "description": "Meta information about the API.",
 | 
			
		||||
      "externalDocs": {
 | 
			
		||||
        "url": "https://docs.zoo.dev/api/meta"
 | 
			
		||||
      },
 | 
			
		||||
      "name": "meta"
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "description": "Utilities for printing and discovering printers.",
 | 
			
		||||
      "externalDocs": {
 | 
			
		||||
        "url": "https://docs.zoo.dev/api/print"
 | 
			
		||||
      },
 | 
			
		||||
      "name": "print"
 | 
			
		||||
    }
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user