poll

package
v0.42.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseVideoJSON

func ParseVideoJSON(body []byte) (url string, done bool, err error)

ParseVideoJSON 解析任务 JSON:若已完成则 Done=true;若失败则 Err 非空。

Types

type TaskMetrics added in v0.25.0

type TaskMetrics struct {
	Total     int `json:"TOTAL"`
	Succeeded int `json:"SUCCEEDED"`
	Failed    int `json:"FAILED"`
}

TaskMetrics carries upstream progress information from DashScope-style APIs.

type VideoParseResult added in v0.25.0

type VideoParseResult struct {
	Result  string
	Done    bool
	Err     error
	Percent float64
}

VideoParseResult holds the extended result from ParseVideoJSONV2.

func ParseVideoJSONV2 added in v0.25.0

func ParseVideoJSONV2(body []byte) VideoParseResult

ParseVideoJSONV2 parses task JSON with extended progress info.

func (VideoParseResult) ToFetchResult added in v0.25.0

func (r VideoParseResult) ToFetchResult() (sdkpoll.FetchResult, error)

ToFetchResult converts a VideoParseResult to a poll.FetchResult for use with PollV2.

type VideoTask

type VideoTask struct {
	Status      string       `json:"status"`
	URL         string       `json:"url"`
	TaskMetrics *TaskMetrics `json:"task_metrics,omitempty"`
	Error       *struct {
		Message string `json:"message"`
		Code    any    `json:"code"`
	} `json:"error"`
}

VideoTask 与 New API 统一视频轮询、Kling 等 JSON 形态一致。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL