{
  "openapi": "3.1.0",
  "info": {
    "title": "zpe-reports",
    "version": "1.0.1",
    "description": "A client's own migration report at zpe.vc/reports/<slug>, behind the door. The page is generated by the client's repo and published to the reports bucket; this app decides who may read it and serves the bytes. The machine surface answers at exactly one base, /_/api/v1, and its document is at /_/api/v1/openapi.json."
  },
  "servers": [
    {
      "url": "/reports",
      "description": "zpe-reports on zpe.vc"
    }
  ],
  "paths": {
    "/_/api/v1/reports": {
      "get": {
        "operationId": "getReportIndex",
        "summary": "Every report this caller may read, as a keyset page",
        "tags": [
          "reports"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "How many rows to answer, at most 50.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "The last slug of the previous page, from x-next-cursor.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The caller's reports, name order, with the cursor for the next page in the body.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "reports",
                    "next_cursor"
                  ],
                  "properties": {
                    "reports": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "slug",
                          "label",
                          "published"
                        ],
                        "properties": {
                          "slug": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "published": {
                            "type": "boolean"
                          },
                          "built_at": {
                            "type": "string"
                          },
                          "parts": {
                            "type": "integer"
                          },
                          "sections": {
                            "type": "integer"
                          },
                          "tables": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "No session cookie, and no key the door knows.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "A key was presented that is not granted this app for a read.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "The door is rate-limiting this caller's key, so the read was not attempted.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "This app failed while answering",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The door did not answer, so nothing could be named and nothing was read.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/_/api/v1/reports/{slug}": {
      "get": {
        "operationId": "getReportBySlug",
        "summary": "One report's build facts, to the caller that owns the slug",
        "tags": [
          "reports"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "description": "The client slug, as it appears in the report's address.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "What the publisher wrote: the build time, the page's size, its counts, and the loop's last pass.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "slug",
                    "published"
                  ],
                  "properties": {
                    "slug": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    },
                    "published": {
                      "type": "boolean"
                    },
                    "built_at": {
                      "type": "string"
                    },
                    "bytes": {
                      "type": "integer"
                    },
                    "parts": {
                      "type": "integer"
                    },
                    "sections": {
                      "type": "integer"
                    },
                    "tables": {
                      "type": "integer"
                    },
                    "loop": {
                      "type": "object",
                      "properties": {
                        "last_pass": {
                          "type": "string"
                        },
                        "outcome": {
                          "type": "string"
                        },
                        "last_publish": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "No session cookie, and no key the door knows.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "A key was presented that is not granted this app for a read.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No report at this slug for this caller. A slug that belongs to another account answers the same.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "The door is rate-limiting this caller's key, so the read was not attempted.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "This app failed while answering",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The door did not answer, so nothing could be named and nothing was read.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API key minted on the account's settings page at zpe.vc/home/settings. Send it as `Authorization: Bearer <key>`."
      }
    },
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem+json: `type`, `title`, `status`, `code` and `instance`, plus `detail` when a person should read a sentence.",
        "required": [
          "type",
          "title",
          "status",
          "code",
          "instance"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "code": {
            "type": "string",
            "enum": [
              "bad-request",
              "unauthenticated",
              "malformed",
              "unknown",
              "mismatch",
              "revoked",
              "expired",
              "another-account",
              "scope-refused",
              "grant-refused",
              "forbidden",
              "not-found",
              "method-not-allowed",
              "conflict",
              "gone",
              "payload-too-large",
              "unsupported-media-type",
              "unprocessable",
              "rate-limited",
              "payment-required",
              "not-open",
              "internal",
              "unavailable"
            ]
          },
          "instance": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          }
        }
      }
    }
  },
  "x-surface": {
    "app": "zpe-reports",
    "base": "/_/api/v1",
    "document": "/_/api/v1/openapi.json",
    "generated_by": "zpe-kit machineDocument"
  },
  "x-zpe-routes": 2,
  "x-zpe-documented": 2,
  "x-zpe-internal": []
}
