{
    "openapi": "3.1.0",
    "info": {
        "title": "Imperial Cushions public read API",
        "version": "1.0.0",
        "description": "Read-only operations over the diamonds, guides, journal and pages published on imperialcushions.com. Imperial Cushions is a family-run antique diamond house, specialists since 1976, offering Old Mine cut and cushion diamonds, including documented Type IIa stones, to private buyers, collectors and the trade worldwide.",
        "contact": {
            "email": "mort@imperialcushions.com",
            "url": "https://imperialcushions.com/"
        }
    },
    "servers": [
        {
            "url": "https://imperialcushions.com"
        }
    ],
    "paths": {
        "/wp-json/imperial-agent/v1/diamonds": {
            "get": {
                "operationId": "listDiamonds",
                "summary": "List the diamonds currently offered",
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Maximum number of diamonds to return",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 100
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Published diamonds with title and page address",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "count": {
                                            "type": "integer"
                                        },
                                        "diamonds": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "title": {
                                                        "type": "string"
                                                    },
                                                    "url": {
                                                        "type": "string",
                                                        "format": "uri"
                                                    },
                                                    "type": {
                                                        "type": "string",
                                                        "enum": [
                                                            "diamond",
                                                            "page",
                                                            "post"
                                                        ]
                                                    },
                                                    "summary": {
                                                        "type": "string"
                                                    },
                                                    "modified": {
                                                        "type": "string",
                                                        "format": "date-time"
                                                    },
                                                    "markdown": {
                                                        "type": "string",
                                                        "format": "uri"
                                                    },
                                                    "text": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "title",
                                                    "url",
                                                    "type"
                                                ]
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/wp-json/imperial-agent/v1/page": {
            "get": {
                "operationId": "getPage",
                "summary": "Read the text of one published page, diamond or article",
                "parameters": [
                    {
                        "name": "url",
                        "in": "query",
                        "required": true,
                        "description": "Full address of the page on imperialcushions.com",
                        "schema": {
                            "type": "string",
                            "format": "uri"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Page title, address, summary and text",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "title": {
                                            "type": "string"
                                        },
                                        "url": {
                                            "type": "string",
                                            "format": "uri"
                                        },
                                        "type": {
                                            "type": "string",
                                            "enum": [
                                                "diamond",
                                                "page",
                                                "post"
                                            ]
                                        },
                                        "summary": {
                                            "type": "string"
                                        },
                                        "modified": {
                                            "type": "string",
                                            "format": "date-time"
                                        },
                                        "markdown": {
                                            "type": "string",
                                            "format": "uri"
                                        },
                                        "text": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "title",
                                        "url",
                                        "type"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "No published page at that address",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "code": {
                                            "type": "string"
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/wp-json/wp/v2/search": {
            "get": {
                "operationId": "searchSite",
                "summary": "Search published pages and articles",
                "parameters": [
                    {
                        "name": "search",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 10
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Matching items with id, title, url and type",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "id": {
                                                "type": "integer"
                                            },
                                            "title": {
                                                "type": "string"
                                            },
                                            "url": {
                                                "type": "string",
                                                "format": "uri"
                                            },
                                            "type": {
                                                "type": "string"
                                            },
                                            "subtype": {
                                                "type": "string"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "Record": {
                "type": "object",
                "properties": {
                    "title": {
                        "type": "string"
                    },
                    "url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "type": {
                        "type": "string",
                        "enum": [
                            "diamond",
                            "page",
                            "post"
                        ]
                    },
                    "summary": {
                        "type": "string"
                    },
                    "modified": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "markdown": {
                        "type": "string",
                        "format": "uri"
                    },
                    "text": {
                        "type": "string"
                    }
                },
                "required": [
                    "title",
                    "url",
                    "type"
                ]
            }
        }
    }
}