api-config.json 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. {
  2. "name": "quickly-video-library",
  3. "displayName": "一键成片 - 视频库管理",
  4. "description": "查询一键成片历史视频列表,支持按 taskId、日期筛选和分页,并可记录视频下载次数。",
  5. "category": "video-creation",
  6. "version": "1.0.0",
  7. "endpoint": {
  8. "method": "POST",
  9. "url": "https://server.fmode.cn/api/functions",
  10. "headers": {
  11. "Content-Type": "application/json"
  12. }
  13. },
  14. "actions": {
  15. "list": {
  16. "description": "分页查询视频库(主操作)",
  17. "parameters": {
  18. "type": "object",
  19. "required": [],
  20. "properties": {
  21. "page": {
  22. "type": "integer",
  23. "description": "页码,从1开始",
  24. "default": 1,
  25. "minimum": 1
  26. },
  27. "pageSize": {
  28. "type": "integer",
  29. "description": "每页条数",
  30. "default": 20,
  31. "minimum": 1,
  32. "maximum": 100
  33. },
  34. "taskId": {
  35. "type": "string",
  36. "description": "按任务ID筛选,不传则查全部"
  37. },
  38. "dateStart": {
  39. "type": "string",
  40. "description": "开始日期 ISO 8601,如 '2026-03-01T00:00:00.000Z'"
  41. },
  42. "dateEnd": {
  43. "type": "string",
  44. "description": "结束日期 ISO 8601,如 '2026-03-31T23:59:59.000Z'"
  45. }
  46. }
  47. }
  48. },
  49. "recordDownload": {
  50. "description": "记录视频下载次数(用户保存视频后调用)",
  51. "parameters": {
  52. "videoId": {
  53. "type": "string",
  54. "required": true,
  55. "description": "视频 objectId(优先)或 preId"
  56. }
  57. }
  58. }
  59. },
  60. "requestTransform": {
  61. "description": "根据 action 构建 Parse 云函数调用参数",
  62. "list": {
  63. "body": {
  64. "id": "sWvRr8RvPT",
  65. "_ApplicationId": "ncloudmaster",
  66. "action": "list",
  67. "page": "{{page}}",
  68. "pageSize": "{{pageSize}}",
  69. "taskId": "{{taskId}}",
  70. "dateStart": "{{dateStart}}",
  71. "dateEnd": "{{dateEnd}}"
  72. }
  73. },
  74. "recordDownload": {
  75. "body": {
  76. "id": "sWvRr8RvPT",
  77. "_ApplicationId": "ncloudmaster",
  78. "action": "recordDownload",
  79. "videoId": "{{videoId}}"
  80. }
  81. }
  82. },
  83. "response": {
  84. "type": "object",
  85. "description": "视频库查询结果",
  86. "properties": {
  87. "code": {
  88. "type": "integer",
  89. "description": "200 = 成功"
  90. },
  91. "success": {
  92. "type": "boolean"
  93. },
  94. "total": {
  95. "type": "integer",
  96. "description": "符合筛选条件的总视频数"
  97. },
  98. "data": {
  99. "type": "array",
  100. "description": "当前页视频列表",
  101. "items": {
  102. "type": "object",
  103. "properties": {
  104. "objectId": { "type": "string", "description": "视频记录唯一ID" },
  105. "taskId": { "type": "string", "description": "生成任务ID" },
  106. "preId": { "type": "string", "description": "预定视频ID" },
  107. "coverUrl": { "type": "string", "description": "封面图URL" },
  108. "videoUrl": { "type": "string", "description": "视频播放URL(mp4)" },
  109. "videoName": { "type": "string", "description": "视频名称" },
  110. "videoDuration": { "type": "number", "description": "时长(秒)" },
  111. "downloadCount": { "type": "integer", "description": "全局下载次数(所有用户累计)" },
  112. "createdAt": { "type": "string", "description": "生成时间 ISO 8601" }
  113. }
  114. }
  115. }
  116. }
  117. },
  118. "mobileDownloadStrategy": {
  119. "description": "移动端保存视频到相册的策略",
  120. "steps": [
  121. {
  122. "priority": 1,
  123. "condition": "navigator.share && navigator.canShare({ files: [videoFile] })",
  124. "action": "调用 navigator.share() 分享视频文件",
  125. "onSuccess": "标记 actuallySaved=true,显示'视频已保存'",
  126. "onCancel": "AbortError 时 actuallySaved=false,不标记已保存"
  127. },
  128. {
  129. "priority": 2,
  130. "condition": "Share API 不可用(微信/UC/QQ浏览器等)",
  131. "action": "显示保存引导弹窗,播放原始视频URL(非blob URL)",
  132. "videoAttributes": ["controls", "autoplay", "playsinline", "webkit-playsinline", "x5-video-player-type=h5", "preload=auto"],
  133. "tip": "长按上方视频,选择「保存视频」即可保存到手机相册",
  134. "onClose": "关闭弹窗时标记已保存,调用 recordDownload",
  135. "warning": "必须使用原始HTTP视频URL,不能用 blob URL,否则微信长按无法触发保存"
  136. }
  137. ]
  138. },
  139. "usageExamples": [
  140. {
  141. "name": "查询所有视频(首页加载)",
  142. "input": {
  143. "action": "list",
  144. "page": 1,
  145. "pageSize": 20
  146. },
  147. "description": "加载视频库第一页"
  148. },
  149. {
  150. "name": "按任务ID查询视频",
  151. "input": {
  152. "action": "list",
  153. "taskId": "987654321"
  154. },
  155. "description": "查询指定任务生成的所有视频"
  156. },
  157. {
  158. "name": "按日期筛选(近7天)",
  159. "input": {
  160. "action": "list",
  161. "page": 1,
  162. "pageSize": 20,
  163. "dateStart": "2026-03-24T00:00:00.000Z",
  164. "dateEnd": "2026-03-31T23:59:59.000Z"
  165. },
  166. "description": "查询近7天的视频"
  167. },
  168. {
  169. "name": "记录视频下载",
  170. "input": {
  171. "action": "recordDownload",
  172. "videoId": "abc123objectId"
  173. },
  174. "description": "用户保存视频后调用,全局下载计数+1"
  175. }
  176. ],
  177. "timeout": 15000,
  178. "retry": {
  179. "maxAttempts": 3,
  180. "delay": 1000,
  181. "backoffMultiplier": 2
  182. }
  183. }