RemoteAPI.openapi.yaml 28 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045
  1. openapi: 3.1.0
  2. info:
  3. title: Celestia Trace iOS Remote API
  4. version: 2026-07-24
  5. description: |
  6. iOS 客户端实际调用的远程接口契约。
  7. 维护规则:
  8. 1. backend 路由、请求字段或响应字段变化时,先更新本文件,再更新 Swift 模型。
  9. 2. 所有 JSON 接口使用统一响应 `{code, message, data}`。
  10. 3. 除登录、注册和刷新令牌外,接口均使用 Bearer access token。
  11. 4. 公网网关保留 `/celestia-trace/v1`;后端 Gin 路由本身使用 `/v1`。
  12. 5. 服务端时间使用 RFC 3339 / ISO 8601,客户端同时兼容带或不带小数秒。
  13. x-client-sources:
  14. - CelestiaTrace/Services/Network/APIClient.swift
  15. - CelestiaTrace/Services/Network/RemoteNetworkService.swift
  16. - CelestiaTrace/Services/Auth/RemoteAuthService.swift
  17. servers:
  18. - url: https://api.ccdw.life/celestia-trace/v1
  19. description: Production
  20. tags:
  21. - name: Health
  22. - name: Auth
  23. - name: User
  24. - name: Devices
  25. - name: Sessions
  26. - name: Assets
  27. - name: Sync
  28. paths:
  29. /health:
  30. get:
  31. tags: [Health]
  32. operationId: getHealth
  33. security: []
  34. responses:
  35. "200":
  36. description: API and database are healthy
  37. content:
  38. application/json:
  39. schema:
  40. $ref: "#/components/schemas/HealthEnvelope"
  41. "503":
  42. $ref: "#/components/responses/Error"
  43. /auth/register:
  44. post:
  45. tags: [Auth]
  46. operationId: register
  47. security: []
  48. requestBody:
  49. required: true
  50. content:
  51. application/json:
  52. schema:
  53. $ref: "#/components/schemas/RegisterRequest"
  54. responses:
  55. "200":
  56. description: Account and login session created
  57. content:
  58. application/json:
  59. schema:
  60. $ref: "#/components/schemas/AuthEnvelope"
  61. "400":
  62. $ref: "#/components/responses/Error"
  63. "409":
  64. $ref: "#/components/responses/Error"
  65. /auth/login:
  66. post:
  67. tags: [Auth]
  68. operationId: login
  69. security: []
  70. requestBody:
  71. required: true
  72. content:
  73. application/json:
  74. schema:
  75. $ref: "#/components/schemas/LoginRequest"
  76. responses:
  77. "200":
  78. description: Login session created
  79. content:
  80. application/json:
  81. schema:
  82. $ref: "#/components/schemas/AuthEnvelope"
  83. "400":
  84. $ref: "#/components/responses/Error"
  85. "401":
  86. $ref: "#/components/responses/Error"
  87. /auth/refresh:
  88. post:
  89. tags: [Auth]
  90. operationId: refreshAccessToken
  91. security: []
  92. requestBody:
  93. required: true
  94. content:
  95. application/json:
  96. schema:
  97. type: object
  98. required: [refreshToken]
  99. properties:
  100. refreshToken:
  101. type: string
  102. responses:
  103. "200":
  104. description: Tokens rotated; the old refresh token is no longer valid
  105. content:
  106. application/json:
  107. schema:
  108. $ref: "#/components/schemas/AuthEnvelope"
  109. "401":
  110. $ref: "#/components/responses/Error"
  111. /auth/logout:
  112. post:
  113. tags: [Auth]
  114. operationId: logout
  115. responses:
  116. "200":
  117. $ref: "#/components/responses/EmptySuccess"
  118. "401":
  119. $ref: "#/components/responses/Error"
  120. /user/profile:
  121. get:
  122. tags: [User]
  123. operationId: getProfile
  124. responses:
  125. "200":
  126. description: Current user
  127. content:
  128. application/json:
  129. schema:
  130. $ref: "#/components/schemas/UserEnvelope"
  131. "401":
  132. $ref: "#/components/responses/Error"
  133. put:
  134. tags: [User]
  135. operationId: updateProfile
  136. requestBody:
  137. required: true
  138. content:
  139. application/json:
  140. schema:
  141. $ref: "#/components/schemas/UpdateProfileRequest"
  142. responses:
  143. "200":
  144. description: Updated user
  145. content:
  146. application/json:
  147. schema:
  148. $ref: "#/components/schemas/UserEnvelope"
  149. "400":
  150. $ref: "#/components/responses/Error"
  151. "401":
  152. $ref: "#/components/responses/Error"
  153. "409":
  154. $ref: "#/components/responses/Error"
  155. /user/change-password:
  156. post:
  157. tags: [User]
  158. operationId: changePassword
  159. requestBody:
  160. required: true
  161. content:
  162. application/json:
  163. schema:
  164. type: object
  165. required: [oldPassword, newPassword]
  166. properties:
  167. oldPassword:
  168. type: string
  169. newPassword:
  170. type: string
  171. minLength: 6
  172. responses:
  173. "200":
  174. $ref: "#/components/responses/EmptySuccess"
  175. "400":
  176. $ref: "#/components/responses/Error"
  177. "401":
  178. $ref: "#/components/responses/Error"
  179. /devices:
  180. post:
  181. tags: [Devices]
  182. operationId: bindDevice
  183. requestBody:
  184. required: true
  185. content:
  186. application/json:
  187. schema:
  188. $ref: "#/components/schemas/BindDeviceRequest"
  189. responses:
  190. "200":
  191. description: Bound or updated cloud device
  192. content:
  193. application/json:
  194. schema:
  195. $ref: "#/components/schemas/DeviceEnvelope"
  196. "400":
  197. $ref: "#/components/responses/Error"
  198. "401":
  199. $ref: "#/components/responses/Error"
  200. /devices/{deviceId}:
  201. parameters:
  202. - $ref: "#/components/parameters/DeviceId"
  203. put:
  204. tags: [Devices]
  205. operationId: updateDevice
  206. requestBody:
  207. required: true
  208. content:
  209. application/json:
  210. schema:
  211. $ref: "#/components/schemas/UpdateDeviceRequest"
  212. responses:
  213. "200":
  214. description: Updated cloud device
  215. content:
  216. application/json:
  217. schema:
  218. $ref: "#/components/schemas/DeviceEnvelope"
  219. "401":
  220. $ref: "#/components/responses/Error"
  221. "404":
  222. $ref: "#/components/responses/Error"
  223. delete:
  224. tags: [Devices]
  225. operationId: unbindDevice
  226. responses:
  227. "200":
  228. description: Device unbound
  229. content:
  230. application/json:
  231. schema:
  232. $ref: "#/components/schemas/DeleteEnvelope"
  233. "401":
  234. $ref: "#/components/responses/Error"
  235. "404":
  236. $ref: "#/components/responses/Error"
  237. /sessions:
  238. get:
  239. tags: [Sessions]
  240. operationId: listSessions
  241. parameters:
  242. - name: includeDeleted
  243. in: query
  244. schema:
  245. type: boolean
  246. default: true
  247. description: iOS uses true to receive deletion tombstones.
  248. responses:
  249. "200":
  250. description: All sessions visible to the current user
  251. content:
  252. application/json:
  253. schema:
  254. $ref: "#/components/schemas/SessionListEnvelope"
  255. "401":
  256. $ref: "#/components/responses/Error"
  257. post:
  258. tags: [Sessions]
  259. operationId: upsertSession
  260. description: |
  261. Idempotent upsert by `(userId, clientId)`.
  262. Existing sessions must send `baseRevision`; a mismatch returns HTTP/code 409.
  263. `deletedEventClientIds` removes events deleted locally since the last pull.
  264. requestBody:
  265. required: true
  266. content:
  267. application/json:
  268. schema:
  269. $ref: "#/components/schemas/SessionUpsertRequest"
  270. responses:
  271. "200":
  272. description: Created or updated session
  273. content:
  274. application/json:
  275. schema:
  276. $ref: "#/components/schemas/SessionEnvelope"
  277. "400":
  278. $ref: "#/components/responses/Error"
  279. "401":
  280. $ref: "#/components/responses/Error"
  281. "409":
  282. description: Optimistic-lock conflict
  283. content:
  284. application/json:
  285. schema:
  286. $ref: "#/components/schemas/ConflictEnvelope"
  287. /sessions/{sessionId}:
  288. parameters:
  289. - $ref: "#/components/parameters/SessionId"
  290. delete:
  291. tags: [Sessions]
  292. operationId: deleteSession
  293. description: Soft-deletes the session and its assets for the current user.
  294. responses:
  295. "200":
  296. description: Session deleted
  297. content:
  298. application/json:
  299. schema:
  300. $ref: "#/components/schemas/DeleteEnvelope"
  301. "401":
  302. $ref: "#/components/responses/Error"
  303. "404":
  304. $ref: "#/components/responses/Error"
  305. /sessions/{sessionId}/assets:
  306. parameters:
  307. - $ref: "#/components/parameters/SessionId"
  308. post:
  309. tags: [Assets]
  310. operationId: uploadAsset
  311. description: |
  312. Used for files smaller than 16 MiB. `clientId` makes retries idempotent.
  313. A new upload returns `{asset, sessionRevision}`. An idempotent replay may
  314. return the asset directly; the iOS decoder intentionally accepts both.
  315. requestBody:
  316. required: true
  317. content:
  318. multipart/form-data:
  319. schema:
  320. type: object
  321. required: [clientId, kind, file]
  322. properties:
  323. clientId:
  324. type: string
  325. kind:
  326. $ref: "#/components/schemas/AssetKind"
  327. file:
  328. type: string
  329. format: binary
  330. responses:
  331. "200":
  332. description: Uploaded asset or idempotent existing asset
  333. content:
  334. application/json:
  335. schema:
  336. $ref: "#/components/schemas/AssetUploadEnvelope"
  337. "401":
  338. $ref: "#/components/responses/Error"
  339. "404":
  340. $ref: "#/components/responses/Error"
  341. "413":
  342. $ref: "#/components/responses/QuotaError"
  343. /sessions/{sessionId}/assets/init:
  344. parameters:
  345. - $ref: "#/components/parameters/SessionId"
  346. post:
  347. tags: [Assets]
  348. operationId: initializeChunkedUpload
  349. description: iOS uses this flow for files at least 16 MiB, with 8 MiB chunks.
  350. requestBody:
  351. required: true
  352. content:
  353. application/json:
  354. schema:
  355. $ref: "#/components/schemas/ChunkUploadInitRequest"
  356. responses:
  357. "200":
  358. description: Chunked upload initialized
  359. content:
  360. application/json:
  361. schema:
  362. $ref: "#/components/schemas/ChunkUploadInitEnvelope"
  363. "401":
  364. $ref: "#/components/responses/Error"
  365. "404":
  366. $ref: "#/components/responses/Error"
  367. "413":
  368. $ref: "#/components/responses/QuotaError"
  369. /sessions/{sessionId}/assets/chunk:
  370. parameters:
  371. - $ref: "#/components/parameters/SessionId"
  372. post:
  373. tags: [Assets]
  374. operationId: uploadChunk
  375. requestBody:
  376. required: true
  377. content:
  378. multipart/form-data:
  379. schema:
  380. type: object
  381. required: [uploadId, chunkIndex, file]
  382. properties:
  383. uploadId:
  384. type: string
  385. format: uuid
  386. chunkIndex:
  387. type: integer
  388. minimum: 0
  389. file:
  390. type: string
  391. format: binary
  392. responses:
  393. "200":
  394. description: Chunk accepted
  395. content:
  396. application/json:
  397. schema:
  398. $ref: "#/components/schemas/ChunkProgressEnvelope"
  399. "400":
  400. $ref: "#/components/responses/Error"
  401. "401":
  402. $ref: "#/components/responses/Error"
  403. "404":
  404. $ref: "#/components/responses/Error"
  405. "410":
  406. $ref: "#/components/responses/Error"
  407. /sessions/{sessionId}/assets/complete:
  408. parameters:
  409. - $ref: "#/components/parameters/SessionId"
  410. post:
  411. tags: [Assets]
  412. operationId: completeChunkedUpload
  413. requestBody:
  414. required: true
  415. content:
  416. application/json:
  417. schema:
  418. type: object
  419. required: [uploadId, totalChunks]
  420. properties:
  421. uploadId:
  422. type: string
  423. format: uuid
  424. totalChunks:
  425. type: integer
  426. minimum: 1
  427. responses:
  428. "200":
  429. description: Chunks merged and asset created
  430. content:
  431. application/json:
  432. schema:
  433. $ref: "#/components/schemas/AssetUploadEnvelope"
  434. "400":
  435. $ref: "#/components/responses/Error"
  436. "401":
  437. $ref: "#/components/responses/Error"
  438. "404":
  439. $ref: "#/components/responses/Error"
  440. "410":
  441. $ref: "#/components/responses/Error"
  442. /sessions/{sessionId}/assets/{assetId}:
  443. parameters:
  444. - $ref: "#/components/parameters/SessionId"
  445. - $ref: "#/components/parameters/AssetId"
  446. get:
  447. tags: [Assets]
  448. operationId: downloadAsset
  449. responses:
  450. "200":
  451. description: Attachment bytes; Content-Disposition contains the original filename
  452. content:
  453. application/octet-stream:
  454. schema:
  455. type: string
  456. format: binary
  457. "401":
  458. $ref: "#/components/responses/Error"
  459. "404":
  460. $ref: "#/components/responses/Error"
  461. /storage/quota:
  462. get:
  463. tags: [Sync]
  464. operationId: getStorageQuota
  465. description: Called before uploading the pending assets for a session.
  466. responses:
  467. "200":
  468. description: Current storage quota in bytes
  469. content:
  470. application/json:
  471. schema:
  472. $ref: "#/components/schemas/StorageQuotaEnvelope"
  473. "401":
  474. $ref: "#/components/responses/Error"
  475. /sync/trigger:
  476. post:
  477. tags: [Sync]
  478. operationId: recordSyncCheckpoint
  479. description: Called only after all session metadata and assets finish syncing.
  480. responses:
  481. "200":
  482. description: Client sync checkpoint recorded
  483. content:
  484. application/json:
  485. schema:
  486. $ref: "#/components/schemas/SyncCheckpointEnvelope"
  487. "401":
  488. $ref: "#/components/responses/Error"
  489. components:
  490. securitySchemes:
  491. bearerAuth:
  492. type: http
  493. scheme: bearer
  494. bearerFormat: JWT
  495. parameters:
  496. DeviceId:
  497. name: deviceId
  498. in: path
  499. required: true
  500. schema:
  501. type: string
  502. format: uuid
  503. SessionId:
  504. name: sessionId
  505. in: path
  506. required: true
  507. schema:
  508. type: string
  509. format: uuid
  510. AssetId:
  511. name: assetId
  512. in: path
  513. required: true
  514. schema:
  515. type: string
  516. format: uuid
  517. responses:
  518. EmptySuccess:
  519. description: Success without a data payload
  520. content:
  521. application/json:
  522. schema:
  523. $ref: "#/components/schemas/EmptyEnvelope"
  524. Error:
  525. description: Request failed
  526. content:
  527. application/json:
  528. schema:
  529. $ref: "#/components/schemas/ErrorEnvelope"
  530. QuotaError:
  531. description: Storage quota exceeded
  532. content:
  533. application/json:
  534. schema:
  535. $ref: "#/components/schemas/QuotaErrorEnvelope"
  536. schemas:
  537. EnvelopeBase:
  538. type: object
  539. required: [code, message]
  540. properties:
  541. code:
  542. type: integer
  543. message:
  544. type: string
  545. EmptyEnvelope:
  546. allOf:
  547. - $ref: "#/components/schemas/EnvelopeBase"
  548. - type: object
  549. properties:
  550. data:
  551. type: "null"
  552. ErrorEnvelope:
  553. allOf:
  554. - $ref: "#/components/schemas/EnvelopeBase"
  555. - type: object
  556. properties:
  557. data: {}
  558. HealthEnvelope:
  559. allOf:
  560. - $ref: "#/components/schemas/EnvelopeBase"
  561. - type: object
  562. required: [data]
  563. properties:
  564. data:
  565. type: string
  566. const: healthy
  567. RegisterRequest:
  568. type: object
  569. required: [username, identifier, password]
  570. properties:
  571. username:
  572. type: string
  573. minLength: 2
  574. identifier:
  575. type: string
  576. description: Email address or phone number.
  577. password:
  578. type: string
  579. minLength: 6
  580. LoginRequest:
  581. type: object
  582. required: [identifier, password]
  583. properties:
  584. identifier:
  585. type: string
  586. description: Username, email address, or phone number.
  587. password:
  588. type: string
  589. UpdateProfileRequest:
  590. type: object
  591. properties:
  592. username:
  593. type: [string, "null"]
  594. email:
  595. type: [string, "null"]
  596. phoneNumber:
  597. type: [string, "null"]
  598. avatarURL:
  599. type: [string, "null"]
  600. User:
  601. type: object
  602. required: [id, username, registeredAt]
  603. properties:
  604. id:
  605. type: string
  606. format: uuid
  607. username:
  608. type: string
  609. email:
  610. type: string
  611. phoneNumber:
  612. type: string
  613. avatarURL:
  614. type: string
  615. format: uri
  616. registeredAt:
  617. type: string
  618. format: date-time
  619. updatedAt:
  620. type: string
  621. format: date-time
  622. AuthData:
  623. type: object
  624. required: [user, token, refreshToken, expiresAt]
  625. properties:
  626. user:
  627. $ref: "#/components/schemas/User"
  628. token:
  629. type: string
  630. description: Short-lived access JWT.
  631. refreshToken:
  632. type: string
  633. description: Rotated on every refresh.
  634. expiresAt:
  635. type: string
  636. format: date-time
  637. AuthEnvelope:
  638. allOf:
  639. - $ref: "#/components/schemas/EnvelopeBase"
  640. - type: object
  641. required: [data]
  642. properties:
  643. data:
  644. $ref: "#/components/schemas/AuthData"
  645. UserEnvelope:
  646. allOf:
  647. - $ref: "#/components/schemas/EnvelopeBase"
  648. - type: object
  649. required: [data]
  650. properties:
  651. data:
  652. $ref: "#/components/schemas/User"
  653. BindDeviceRequest:
  654. type: object
  655. required: [name]
  656. properties:
  657. name:
  658. type: string
  659. peripheralUUID:
  660. type: string
  661. hardwareMAC:
  662. type: [string, "null"]
  663. firmwareVersion:
  664. type: [string, "null"]
  665. batteryLevel:
  666. type: [integer, "null"]
  667. minimum: 0
  668. maximum: 100
  669. freeStorageMB:
  670. type: [integer, "null"]
  671. totalStorageMB:
  672. type: [integer, "null"]
  673. UpdateDeviceRequest:
  674. type: object
  675. properties:
  676. name:
  677. type: [string, "null"]
  678. batteryLevel:
  679. type: [integer, "null"]
  680. minimum: 0
  681. maximum: 100
  682. isConnected:
  683. type: [boolean, "null"]
  684. firmwareVersion:
  685. type: [string, "null"]
  686. freeStorageMB:
  687. type: [integer, "null"]
  688. totalStorageMB:
  689. type: [integer, "null"]
  690. Device:
  691. type: object
  692. required: [id, name, peripheralUUID]
  693. properties:
  694. id:
  695. type: string
  696. format: uuid
  697. userId:
  698. type: string
  699. format: uuid
  700. name:
  701. type: string
  702. peripheralUUID:
  703. type: string
  704. hardwareMAC:
  705. type: string
  706. batteryLevel:
  707. type: integer
  708. firmwareVersion:
  709. type: string
  710. freeStorageMB:
  711. type: integer
  712. totalStorageMB:
  713. type: integer
  714. isConnected:
  715. type: boolean
  716. boundAt:
  717. type: string
  718. format: date-time
  719. updatedAt:
  720. type: string
  721. format: date-time
  722. DeviceEnvelope:
  723. allOf:
  724. - $ref: "#/components/schemas/EnvelopeBase"
  725. - type: object
  726. required: [data]
  727. properties:
  728. data:
  729. $ref: "#/components/schemas/Device"
  730. EventUpsert:
  731. type: object
  732. required: [clientId, relativeTimeMs, eventType]
  733. properties:
  734. clientId:
  735. type: string
  736. relativeTimeMs:
  737. type: integer
  738. format: int64
  739. eventType:
  740. type: string
  741. enum: [PHOTO, NOTE, MARKER, VOICE, CONTINUATION]
  742. textContent:
  743. type: [string, "null"]
  744. voiceStartOffsetMs:
  745. type: [integer, "null"]
  746. format: int64
  747. voiceEndOffsetMs:
  748. type: [integer, "null"]
  749. format: int64
  750. SessionUpsertRequest:
  751. type: object
  752. required: [clientId, title, startTime, durationMs, events, deletedEventClientIds]
  753. properties:
  754. clientId:
  755. type: string
  756. title:
  757. type: string
  758. startTime:
  759. type: string
  760. format: date-time
  761. endTime:
  762. type: [string, "null"]
  763. format: date-time
  764. durationMs:
  765. type: integer
  766. format: int64
  767. events:
  768. type: array
  769. items:
  770. $ref: "#/components/schemas/EventUpsert"
  771. baseRevision:
  772. type: [integer, "null"]
  773. format: int64
  774. deletedEventClientIds:
  775. type: array
  776. items:
  777. type: string
  778. RemoteEvent:
  779. allOf:
  780. - $ref: "#/components/schemas/EventUpsert"
  781. - type: object
  782. required: [id]
  783. properties:
  784. id:
  785. type: string
  786. format: uuid
  787. clientId:
  788. type: [string, "null"]
  789. createdAt:
  790. type: string
  791. format: date-time
  792. RemoteSession:
  793. type: object
  794. required: [id, title, startTime, durationMs, revision]
  795. properties:
  796. id:
  797. type: string
  798. format: uuid
  799. clientId:
  800. type: [string, "null"]
  801. title:
  802. type: string
  803. startTime:
  804. type: string
  805. format: date-time
  806. endTime:
  807. type: [string, "null"]
  808. format: date-time
  809. durationMs:
  810. type: integer
  811. format: int64
  812. revision:
  813. type: integer
  814. format: int64
  815. deletedAt:
  816. type: [string, "null"]
  817. format: date-time
  818. events:
  819. type: array
  820. items:
  821. $ref: "#/components/schemas/RemoteEvent"
  822. assets:
  823. type: array
  824. items:
  825. $ref: "#/components/schemas/Asset"
  826. SessionEnvelope:
  827. allOf:
  828. - $ref: "#/components/schemas/EnvelopeBase"
  829. - type: object
  830. required: [data]
  831. properties:
  832. data:
  833. $ref: "#/components/schemas/RemoteSession"
  834. SessionListEnvelope:
  835. allOf:
  836. - $ref: "#/components/schemas/EnvelopeBase"
  837. - type: object
  838. required: [data]
  839. properties:
  840. data:
  841. type: array
  842. items:
  843. $ref: "#/components/schemas/RemoteSession"
  844. ConflictEnvelope:
  845. allOf:
  846. - $ref: "#/components/schemas/EnvelopeBase"
  847. - type: object
  848. required: [data]
  849. properties:
  850. data:
  851. type: object
  852. required: [serverRevision]
  853. properties:
  854. serverRevision:
  855. type: integer
  856. format: int64
  857. AssetKind:
  858. type: string
  859. enum: [AUDIO, PHOTO]
  860. Asset:
  861. type: object
  862. required: [id, clientId, kind, fileName, mimeType, sizeBytes, sha256]
  863. properties:
  864. id:
  865. type: string
  866. format: uuid
  867. clientId:
  868. type: string
  869. kind:
  870. $ref: "#/components/schemas/AssetKind"
  871. fileName:
  872. type: string
  873. mimeType:
  874. type: string
  875. sizeBytes:
  876. type: integer
  877. format: int64
  878. sha256:
  879. type: string
  880. pattern: "^[a-fA-F0-9]{64}$"
  881. createdAt:
  882. type: string
  883. format: date-time
  884. AssetUploadData:
  885. type: object
  886. required: [asset, sessionRevision]
  887. properties:
  888. asset:
  889. $ref: "#/components/schemas/Asset"
  890. sessionRevision:
  891. type: integer
  892. format: int64
  893. AssetUploadEnvelope:
  894. allOf:
  895. - $ref: "#/components/schemas/EnvelopeBase"
  896. - type: object
  897. required: [data]
  898. properties:
  899. data:
  900. oneOf:
  901. - $ref: "#/components/schemas/AssetUploadData"
  902. - $ref: "#/components/schemas/Asset"
  903. ChunkUploadInitRequest:
  904. type: object
  905. required: [clientId, kind, fileName, mimeType, fileSize, chunkSize]
  906. properties:
  907. clientId:
  908. type: string
  909. kind:
  910. $ref: "#/components/schemas/AssetKind"
  911. fileName:
  912. type: string
  913. mimeType:
  914. type: string
  915. fileSize:
  916. type: integer
  917. format: int64
  918. minimum: 1
  919. chunkSize:
  920. type: integer
  921. minimum: 1
  922. ChunkUploadInitEnvelope:
  923. allOf:
  924. - $ref: "#/components/schemas/EnvelopeBase"
  925. - type: object
  926. required: [data]
  927. properties:
  928. data:
  929. type: object
  930. required: [uploadId, totalChunks, chunkSize, expiresAt]
  931. properties:
  932. uploadId:
  933. type: string
  934. format: uuid
  935. totalChunks:
  936. type: integer
  937. chunkSize:
  938. type: integer
  939. expiresAt:
  940. type: string
  941. format: date-time
  942. ChunkProgressEnvelope:
  943. allOf:
  944. - $ref: "#/components/schemas/EnvelopeBase"
  945. - type: object
  946. required: [data]
  947. properties:
  948. data:
  949. type: object
  950. required: [uploadId, chunkIndex, uploadedChunks, totalChunks]
  951. properties:
  952. uploadId:
  953. type: string
  954. format: uuid
  955. chunkIndex:
  956. type: integer
  957. uploadedChunks:
  958. type: integer
  959. totalChunks:
  960. type: integer
  961. StorageQuota:
  962. type: object
  963. required: [totalBytes, usedBytes, remainingBytes]
  964. properties:
  965. totalBytes:
  966. type: integer
  967. format: int64
  968. usedBytes:
  969. type: integer
  970. format: int64
  971. remainingBytes:
  972. type: integer
  973. format: int64
  974. StorageQuotaEnvelope:
  975. allOf:
  976. - $ref: "#/components/schemas/EnvelopeBase"
  977. - type: object
  978. required: [data]
  979. properties:
  980. data:
  981. $ref: "#/components/schemas/StorageQuota"
  982. QuotaErrorEnvelope:
  983. allOf:
  984. - $ref: "#/components/schemas/EnvelopeBase"
  985. - type: object
  986. required: [data]
  987. properties:
  988. data:
  989. allOf:
  990. - $ref: "#/components/schemas/StorageQuota"
  991. - type: object
  992. required: [requiredBytes]
  993. properties:
  994. requiredBytes:
  995. type: integer
  996. format: int64
  997. SyncCheckpointEnvelope:
  998. allOf:
  999. - $ref: "#/components/schemas/EnvelopeBase"
  1000. - type: object
  1001. required: [data]
  1002. properties:
  1003. data:
  1004. type: object
  1005. required: [syncedAt, message]
  1006. properties:
  1007. syncedAt:
  1008. type: string
  1009. format: date-time
  1010. message:
  1011. type: string
  1012. DeleteEnvelope:
  1013. allOf:
  1014. - $ref: "#/components/schemas/EnvelopeBase"
  1015. - type: object
  1016. required: [data]
  1017. properties:
  1018. data:
  1019. type: object
  1020. required: [deletedId]
  1021. properties:
  1022. deletedId:
  1023. type: string
  1024. security:
  1025. - bearerAuth: []