Skip to content

feat: API-call action for buttons and sliders#8

Merged
PalmarHealer merged 1 commit into
mainfrom
feature/api-call-action
Jun 14, 2026
Merged

feat: API-call action for buttons and sliders#8
PalmarHealer merged 1 commit into
mainfrom
feature/api-call-action

Conversation

@PalmarHealer

Copy link
Copy Markdown
Contributor

Summary

Adds a configurable API call action to the button/slider wizard, so a button press or slider movement can fire an HTTP request.

  • Method GET/POST/PUT/PATCH/DELETE, endpoint URL, optional JSON payload, optional bearer token.
  • Sliders: the {value} placeholder in the URL and payload is replaced with the live slider percent (0–100).
  • Per-action update interval (50–1000 ms, default 500) throttles slider-driven requests and always flushes the final value once the slider stops. Validated in the wizard (Next is gated + a hint when out of range). Buttons fire once per press, so they don't use the interval.

Implementation

  • New ApiCall model (method, url, payload, bearer, throttle_ms) on ButtonAction and AudioStream; ActionKind::ApiCall.
  • Cmd::ApiCall executed on a detached thread in the actuator so a slow endpoint never stalls audio. Uses ureq (blocking, rustls TLS).
  • Engine throttles slider API calls per slider using each action's interval (smallest if several), with a trailing flush.
  • Wizard UI: method dropdown, URL/payload/bearer fields, slider-only interval with range validation.

Compatibility

Existing presets load unchanged — new fields use serde defaults.

Tests

cargo test — 14 passed (4 new: {value} substitution for sliders vs. buttons, HttpMethod index round-trip, ApiCall label/stream).

🤖 Generated with Claude Code

Adds a configurable HTTP request action in the button/slider wizard:

- Method (GET/POST/PUT/PATCH/DELETE), endpoint URL, optional JSON
  payload, and optional bearer token.
- Slider actions substitute the {value} placeholder in URL and payload
  with the live slider percent (0-100).
- Per-action update interval (50-1000 ms, default 500) throttles
  slider-driven requests and always flushes the final value; validated
  in the wizard. Buttons fire once per press.

Requests run on a detached thread in the actuator so a slow endpoint
never stalls audio. Uses ureq (blocking, rustls TLS). Existing presets
stay compatible via serde defaults.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@PalmarHealer
PalmarHealer merged commit 3faa19a into main Jun 14, 2026
@PalmarHealer
PalmarHealer deleted the feature/api-call-action branch June 14, 2026 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant