Superlocal

Superlocal · GPT-Aktionen

Superlocal

Superlocal is an API that provides endpoints for writing to a file at a specified path and executing bash commands.

  • POST /api/get-urlGet the user's remote endpoint URL
  • POST /api/update-urlUpdate the user's remote endpoint URL
  • POST /api/write-fileWrite to a file at a specified path with given content
  • POST /api/read-fileRead a file at a specified path
  • POST /api/execute-commandExecute a bash command
Ursprüngliches API-Schema
{
  "openapi": "3.0.1",
  "info": {
    "title": "Superlocal",
    "description": "Superlocal is an API that provides endpoints for writing to a file at a specified path and executing bash commands.",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://superlocal.dev"
    }
  ],
  "paths": {
    "/api/get-url": {
      "post": {
        "operationId": "getUrl",
        "x-openai-isConsequential": false,
        "summary": "Get the user's remote endpoint URL",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/update-url": {
      "post": {
        "operationId": "updateUrl",
        "x-openai-isConsequential": false,
        "summary": "Update the user's remote endpoint URL",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/write-file": {
      "post": {
        "operationId": "writeFile",
        "x-openai-isConsequential": false,
        "summary": "Write to a file at a specified path with given content",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "string",
                    "example": "/home/user/documents/myfile.txt"
                  },
                  "content": {
                    "type": "string",
                    "example": "Hello, World!"
                  },
                  "append": {
                    "type": "boolean",
                    "example": false
                  }
                },
                "required": [
                  "path",
                  "content"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "The success message."
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "The error message."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/read-file": {
      "post": {
        "operationId": "readFile",
        "x-openai-isConsequential": false,
        "summary": "Read a file at a specified path",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "string",
                    "example": "/home/user/documents/myfile.txt"
                  }
                },
                "required": [
                  "path"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "content": {
                      "type": "string",
                      "description": "The content of the file."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "The error message."
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "The error message."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/execute-command": {
      "post": {
        "operationId": "executeCommand",
        "x-openai-isConsequential": false,
        "summary": "Execute a bash command",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "command": {
                    "type": "string",
                    "example": "ls -la"
                  }
                },
                "required": [
                  "command"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "The success message."
                    },
                    "output": {
                      "type": "string",
                      "description": "The output of the command execution."
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "The error message."
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}