{
  "openapi": "3.1.0",
  "info": {
    "title": "TH83 Public Content API",
    "version": "1.0.0",
    "description": "อ่านเนื้อหาสาธารณะจาก WordPress REST API ของ TH83 ใช้ลิงก์ในฟิลด์ link เพื่อเปิดหน้าเว็บภาษาไทย"
  },
  "externalDocs": {
    "url": "https://th83slots.com/docs/"
  },
  "servers": [
    {
      "url": "https://th83slots.com/wp-json/wp/v2"
    }
  ],
  "security": [],
  "paths": {
    "/posts": {
      "get": {
        "operationId": "listGuides",
        "summary": "ค้นหาบทความ",
        "parameters": [
          {
            "$ref": "#/components/parameters/page"
          },
          {
            "$ref": "#/components/parameters/per_page"
          },
          {
            "$ref": "#/components/parameters/search"
          },
          {
            "$ref": "#/components/parameters/slug"
          },
          {
            "$ref": "#/components/parameters/_fields"
          }
        ],
        "responses": {
          "200": {
            "description": "รายการที่เผยแพร่",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Content"
                  }
                }
              }
            },
            "headers": {
              "X-WP-Total": {
                "description": "จำนวนรายการทั้งหมด",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-WP-TotalPages": {
                "description": "จำนวนหน้าทั้งหมด",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          },
          "400": {
            "description": "พารามิเตอร์ไม่ถูกต้อง หรือหน้าที่ขอเกินช่วง",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/posts/{id}": {
      "get": {
        "operationId": "getGuidesById",
        "summary": "อ่านบทความตามรหัส",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "$ref": "#/components/parameters/_fields"
          }
        ],
        "responses": {
          "200": {
            "description": "เนื้อหาที่เผยแพร่",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Content"
                }
              }
            }
          },
          "404": {
            "description": "ไม่พบรายการสาธารณะ",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/pages": {
      "get": {
        "operationId": "listPages",
        "summary": "ค้นหาหน้าเว็บไซต์",
        "parameters": [
          {
            "$ref": "#/components/parameters/page"
          },
          {
            "$ref": "#/components/parameters/per_page"
          },
          {
            "$ref": "#/components/parameters/search"
          },
          {
            "$ref": "#/components/parameters/slug"
          },
          {
            "$ref": "#/components/parameters/_fields"
          }
        ],
        "responses": {
          "200": {
            "description": "รายการที่เผยแพร่",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Content"
                  }
                }
              }
            },
            "headers": {
              "X-WP-Total": {
                "description": "จำนวนรายการทั้งหมด",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-WP-TotalPages": {
                "description": "จำนวนหน้าทั้งหมด",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          },
          "400": {
            "description": "พารามิเตอร์ไม่ถูกต้อง หรือหน้าที่ขอเกินช่วง",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/pages/{id}": {
      "get": {
        "operationId": "getPagesById",
        "summary": "อ่านหน้าเว็บไซต์ตามรหัส",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "$ref": "#/components/parameters/_fields"
          }
        ],
        "responses": {
          "200": {
            "description": "เนื้อหาที่เผยแพร่",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Content"
                }
              }
            }
          },
          "404": {
            "description": "ไม่พบรายการสาธารณะ",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/th83_game": {
      "get": {
        "operationId": "listGames",
        "summary": "ค้นหาเกม",
        "parameters": [
          {
            "$ref": "#/components/parameters/page"
          },
          {
            "$ref": "#/components/parameters/per_page"
          },
          {
            "$ref": "#/components/parameters/search"
          },
          {
            "$ref": "#/components/parameters/slug"
          },
          {
            "$ref": "#/components/parameters/_fields"
          }
        ],
        "responses": {
          "200": {
            "description": "รายการที่เผยแพร่",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Content"
                  }
                }
              }
            },
            "headers": {
              "X-WP-Total": {
                "description": "จำนวนรายการทั้งหมด",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-WP-TotalPages": {
                "description": "จำนวนหน้าทั้งหมด",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          },
          "400": {
            "description": "พารามิเตอร์ไม่ถูกต้อง หรือหน้าที่ขอเกินช่วง",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/th83_game/{id}": {
      "get": {
        "operationId": "getGamesById",
        "summary": "อ่านเกมตามรหัส",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "$ref": "#/components/parameters/_fields"
          }
        ],
        "responses": {
          "200": {
            "description": "เนื้อหาที่เผยแพร่",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Content"
                }
              }
            }
          },
          "404": {
            "description": "ไม่พบรายการสาธารณะ",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/th83_provider": {
      "get": {
        "operationId": "listProviders",
        "summary": "ค้นหาค่ายเกม",
        "parameters": [
          {
            "$ref": "#/components/parameters/page"
          },
          {
            "$ref": "#/components/parameters/per_page"
          },
          {
            "$ref": "#/components/parameters/search"
          },
          {
            "$ref": "#/components/parameters/slug"
          },
          {
            "$ref": "#/components/parameters/_fields"
          }
        ],
        "responses": {
          "200": {
            "description": "รายการที่เผยแพร่",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Content"
                  }
                }
              }
            },
            "headers": {
              "X-WP-Total": {
                "description": "จำนวนรายการทั้งหมด",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "X-WP-TotalPages": {
                "description": "จำนวนหน้าทั้งหมด",
                "schema": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          },
          "400": {
            "description": "พารามิเตอร์ไม่ถูกต้อง หรือหน้าที่ขอเกินช่วง",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/th83_provider/{id}": {
      "get": {
        "operationId": "getProvidersById",
        "summary": "อ่านค่ายเกมตามรหัส",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "$ref": "#/components/parameters/_fields"
          }
        ],
        "responses": {
          "200": {
            "description": "เนื้อหาที่เผยแพร่",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Content"
                }
              }
            }
          },
          "404": {
            "description": "ไม่พบรายการสาธารณะ",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "page": {
        "name": "page",
        "in": "query",
        "description": "หมายเลขหน้าของผลลัพธ์",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "default": 1
        }
      },
      "per_page": {
        "name": "per_page",
        "in": "query",
        "description": "จำนวนรายการต่อหน้า",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 10
        }
      },
      "search": {
        "name": "search",
        "in": "query",
        "description": "ค้นหาจากคำในเนื้อหา",
        "schema": {
          "type": "string"
        }
      },
      "slug": {
        "name": "slug",
        "in": "query",
        "description": "กรองตาม slug ของรายการ",
        "schema": {
          "type": "string"
        }
      },
      "_fields": {
        "name": "_fields",
        "in": "query",
        "description": "ชื่อฟิลด์ที่ต้องการ คั่นด้วยจุลภาค เช่น id,slug,link,title",
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "Content": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "type": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "link": {
            "type": "string",
            "format": "uri"
          },
          "modified_gmt": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "$ref": "#/components/schemas/Rendered"
          },
          "excerpt": {
            "$ref": "#/components/schemas/Rendered"
          },
          "content": {
            "$ref": "#/components/schemas/Rendered"
          }
        }
      },
      "Rendered": {
        "type": "object",
        "properties": {
          "rendered": {
            "type": "string",
            "description": "HTML ที่สร้างโดย WordPress"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "data": {
            "type": "object"
          }
        }
      }
    }
  }
}
