MCPcopy Create free account
hub / github.com/LumaAI-API/Luma-API / FetchByID

Function FetchByID

api.go:44–70  ·  view source on GitHub ↗

@Summary Get luma generate video task @Schemes @Description @Accept json @Produce json @Param task_id path string true "fetch single task by id" @Success 200 {object} VideoTask "video single task" @Router /luma/generations/{task_id} [get]

(c *gin.Context)

Source from the content-addressed store, hash-verified

42// @Success 200 {object} VideoTask "video single task"
43// @Router /luma/generations/{task_id} [get]
44func FetchByID(c *gin.Context) {
45 id := c.Param("task_id")
46 url := fmt.Sprintf(common.BaseUrl+GetTaskEndpoint, "/"+id)
47 if c.Request.URL.RawQuery != "" {
48 url = fmt.Sprintf("%s?%s", url, c.Request.URL.RawQuery)
49 }
50 resp, err := DoRequest("GET", url, nil, nil)
51 if err != nil {
52 WrapperLumaError(c, err, http.StatusInternalServerError)
53 return
54 }
55 defer resp.Body.Close()
56
57 c.Writer.WriteHeader(resp.StatusCode)
58 for key, values := range resp.Header {
59 for _, value := range values {
60 c.Writer.Header().Add(key, value)
61 }
62 }
63 // 读取响应体
64 _, err = io.Copy(c.Writer, resp.Body)
65 if err != nil {
66 WrapperLumaError(c, err, http.StatusInternalServerError)
67 return
68 }
69 return
70}
71
72// @Summary Upload image to luma
73// @Schemes

Callers

nothing calls this directly

Calls 2

DoRequestFunction · 0.85
WrapperLumaErrorFunction · 0.85

Tested by

no test coverage detected