HubChatLive

HubChatLive · GPT 작업

Chat Application API

This is a simple chat application API that allows users to post and retrieve messages.

  • POST /chats/{chat}/messagesPost Message

    This endpoint posts a new message to the chat.

  • GET /chats/{chat}/messagesGet Messages

    This endpoint retrieves messages from the chat.

  • PATCH /chats/{chat}/clearClear Messages

    This endpoint to clear messges from the chat.

원본 API 스키마
{
  "openapi": "3.1.0",
  "info": {
    "title": "Chat Application API",
    "description": "This is a simple chat application API that allows users to post and retrieve messages.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://gpts-chat.of-it.org/v1"
    }
  ],
  "paths": {
    "/chats/{chat}/messages": {
      "post": {
        "tags": [
          "v1"
        ],
        "summary": "Post Message",
        "description": "This endpoint posts a new message to the chat.",
        "operationId": "post_message_v1_chats__chat__messages_post",
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "chat",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Name of the chat, use main as default",
              "title": "Chat"
            },
            "description": "Name of the chat, use main as default"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Message"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Message posted successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ListMessage"
                  },
                  "title": "Response Post Message V1 Chats  Chat  Messages Post"
                }
              }
            }
          },
          "404": {
            "description": "Not found"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-openai-isConsequential": false
      },
      "get": {
        "tags": [
          "v1"
        ],
        "summary": "Get Messages",
        "description": "This endpoint retrieves messages from the chat.",
        "operationId": "get_messages_v1_chats__chat__messages_get",
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "chat",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Name of the chat, use main as default",
              "title": "Chat"
            },
            "description": "Name of the chat, use main as default"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ListMessage"
                  },
                  "title": "Response Get Messages V1 Chats  Chat  Messages Get"
                }
              }
            }
          },
          "404": {
            "description": "Not found"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/chats/{chat}/clear": {
      "patch": {
        "tags": [
          "v1"
        ],
        "summary": "Clear Messages",
        "description": "This endpoint to clear messges from the chat.",
        "operationId": "clear_messages_v1_chats__chat__clear_patch",
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "chat",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Name of the chat, use main as default",
              "title": "Chat"
            },
            "description": "Name of the chat, use main as default"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ListMessage"
                  },
                  "title": "Response Clear Messages V1 Chats  Chat  Clear Patch"
                }
              }
            }
          },
          "404": {
            "description": "Not found"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "ListMessage": {
        "properties": {
          "nickname": {
            "type": "string",
            "title": "Nickname",
            "default": ""
          },
          "text": {
            "type": "string",
            "title": "Text",
            "default": ""
          },
          "date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Date"
          }
        },
        "type": "object",
        "required": [
          "nickname",
          "text",
          "date"
        ],
        "title": "ListMessage"
      },
      "Message": {
        "properties": {
          "nickname": {
            "type": "string",
            "title": "Nickname",
            "default": "Anon"
          },
          "text": {
            "type": "string",
            "title": "Text"
          }
        },
        "type": "object",
        "required": [
          "text"
        ],
        "title": "Message"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    },
    "securitySchemes": {
      "APIKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-KEY"
      }
    }
  }
}