Skip to content

Expose solution cost from getTaskResult via SolvedTask - #3

Merged
grk717 merged 2 commits into
mainfrom
sdk-bot/fedc0362-expose-solution-cost-from-gettaskresult--05c9
Nov 19, 2026
Merged

grk717 merged 2 commits into
mainfrom
sdk-bot/fedc0362-expose-solution-cost-from-gettaskresult--05c9

Conversation

@capmonster-sdk-bot

Copy link
Copy Markdown

Context

The getTaskResult response contains cost (Float), the solution cost in USD, returned only when status is ready.
Doc: https://docs.capmonster.cloud/docs/api/methods/get-task-result.txt

Solution cost in US dollars (USD). The value depends on the task type and matches the current pricing. The field is returned only in the ready response, when status is ready.

Changes

  • src/client.rs: ApiResponse.cost: Option<f64>; new public SolvedTask { solution: Value, cost: Option<f64> }; TaskStatus::Ready now carries SolvedTask; solve_captcha returns SolvedTask.
  • src/lib.rs: re-export SolvedTask, doc example updated.
  • tests/client.rs: new tests for ready with cost, ready without cost, solve_captcha cost; existing test adapted to the new return type.
  • README.md, examples/: updated usage, cost example.
  • Cargo.toml 0.3.0, CHANGELOG.md.

Breaking change

TaskStatus::Ready(Value) became TaskStatus::Ready(SolvedTask) and solve_captcha returns SolvedTask instead of Value; use .solution to get the previous value. Minor bump while major is 0.

Testing

Mocked-API tests in tests/client.rs.

Open questions

None.


Prepared automatically by the SDK update bot. Please review before merging.

@grk717
grk717 merged commit d1ed654 into main Nov 19, 2026
3 checks passed
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