This commit is contained in:
seb
2026-09-27 18:01:08 +02:00
parent 9f97e3f3c6
commit 65b4ce5098
6 changed files with 516 additions and 1 deletions

View File

@@ -132,6 +132,7 @@ Generated from `@openapi` annotations in [`src/api/routes/`](../../src/api/route
| [`routes/quote/delete.md`](routes/quote/delete.md) | `DELETE /quote/{id}` |
| [`routes/quote/get.md`](routes/quote/get.md) | `GET /quote/{id}` |
| [`routes/quote/update.md`](routes/quote/update.md) | `PATCH /quote/{id}` |
| [`routes/serper/image.md`](routes/serper/image.md) | `POST /serper/image` |
| [`routes/serper/images.md`](routes/serper/images.md) | `POST /serper/images` |
| [`routes/stock/adjust.md`](routes/stock/adjust.md) | `POST /stock/adjust` |
| [`routes/supplier/list.md`](routes/supplier/list.md) | `GET /supplier` |

View File

@@ -1126,6 +1126,114 @@
}
}
},
"/serper/image": {
"post": {
"tags": [
"Serper"
],
"summary": "Crawl image from URL, crop white/transparency borders, and return AVIF",
"description": "Fetches the image at the provided `url`, crops surrounding white and\ntransparent border margins, resizes to max 1000px, and returns the AVIF image.\n",
"security": [
{
"cookieAuth": []
}
],
"x-markdown": "serper/image.md",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"url"
],
"properties": {
"url": {
"type": "string",
"description": "Absolute HTTP/HTTPS URL of the image to crawl",
"example": "https://example.com/logo.png"
}
}
}
}
}
},
"responses": {
"200": {
"description": "AVIF image bytes",
"headers": {
"Content-Type": {
"schema": {
"type": "string",
"example": "image/avif"
}
},
"X-Image-Width": {
"schema": {
"type": "integer",
"example": 540
}
},
"X-Image-Height": {
"schema": {
"type": "integer",
"example": 179
}
}
},
"content": {
"image/avif": {
"schema": {
"type": "string",
"format": "binary"
}
}
}
},
"400": {
"description": "URL missing, invalid input, or image processing error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "Not authorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"502": {
"description": "Bad Gateway (crawling the upstream image URL failed)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/quote": {
"get": {
"tags": [

View File

@@ -0,0 +1,34 @@
# `POST /serper/image`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Crawl image from URL, crop white/transparency borders, and return AVIF
Fetches the image at the provided `url`, crops surrounding white and
transparent border margins, resizes to max 1000px, and returns the AVIF image.
## Body (JSON)
```json
{
"url": "https://example.com/logo.png"
}
```
## Response `200`
AVIF image bytes
## Errors
| Status | Description |
|--------|-------------|
| 400 | URL missing, invalid input, or image processing error — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 502 | Bad Gateway (crawling the upstream image URL failed) — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._