You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
vibed/.beans/vibed-iq16--implement-http-...

23 lines
837 B
Markdown

---
# vibed-iq16
title: Implement HTTP search function
status: todo
type: task
created_at: 2026-04-11T22:35:13Z
updated_at: 2026-04-11T22:35:13Z
parent: vibed-f05l
blocked_by:
- vibed-0t6e
- vibed-mn9a
---
Implement `async fn search(query: &str) -> Result<SearchResponse, AppError>` using reqwest.
## Todo
- [ ] Define `AppError { Network(reqwest::Error), Parse(serde_json::Error) }` with Display + From impls
- [ ] Implement `search()`: split query on whitespace for searchTerms, build full SearchRequest body
- [ ] POST to `https://howlongtobeat.com/api/search` with headers: User-Agent (Firefox), Referer, Content-Type
- [ ] Use `.json(&body)` for request and `.json::<SearchResponse>()` for response
- [ ] Wire into `main`: call search, match Ok/Err, print error to stderr and exit(1) on failure
- [ ] `cargo check` passes