RemoteAPI.openapi.yaml 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026
  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}/assets:
  288. parameters:
  289. - $ref: "#/components/parameters/SessionId"
  290. post:
  291. tags: [Assets]
  292. operationId: uploadAsset
  293. description: |
  294. Used for files smaller than 16 MiB. `clientId` makes retries idempotent.
  295. A new upload returns `{asset, sessionRevision}`. An idempotent replay may
  296. return the asset directly; the iOS decoder intentionally accepts both.
  297. requestBody:
  298. required: true
  299. content:
  300. multipart/form-data:
  301. schema:
  302. type: object
  303. required: [clientId, kind, file]
  304. properties:
  305. clientId:
  306. type: string
  307. kind:
  308. $ref: "#/components/schemas/AssetKind"
  309. file:
  310. type: string
  311. format: binary
  312. responses:
  313. "200":
  314. description: Uploaded asset or idempotent existing asset
  315. content:
  316. application/json:
  317. schema:
  318. $ref: "#/components/schemas/AssetUploadEnvelope"
  319. "401":
  320. $ref: "#/components/responses/Error"
  321. "404":
  322. $ref: "#/components/responses/Error"
  323. "413":
  324. $ref: "#/components/responses/QuotaError"
  325. /sessions/{sessionId}/assets/init:
  326. parameters:
  327. - $ref: "#/components/parameters/SessionId"
  328. post:
  329. tags: [Assets]
  330. operationId: initializeChunkedUpload
  331. description: iOS uses this flow for files at least 16 MiB, with 8 MiB chunks.
  332. requestBody:
  333. required: true
  334. content:
  335. application/json:
  336. schema:
  337. $ref: "#/components/schemas/ChunkUploadInitRequest"
  338. responses:
  339. "200":
  340. description: Chunked upload initialized
  341. content:
  342. application/json:
  343. schema:
  344. $ref: "#/components/schemas/ChunkUploadInitEnvelope"
  345. "401":
  346. $ref: "#/components/responses/Error"
  347. "404":
  348. $ref: "#/components/responses/Error"
  349. "413":
  350. $ref: "#/components/responses/QuotaError"
  351. /sessions/{sessionId}/assets/chunk:
  352. parameters:
  353. - $ref: "#/components/parameters/SessionId"
  354. post:
  355. tags: [Assets]
  356. operationId: uploadChunk
  357. requestBody:
  358. required: true
  359. content:
  360. multipart/form-data:
  361. schema:
  362. type: object
  363. required: [uploadId, chunkIndex, file]
  364. properties:
  365. uploadId:
  366. type: string
  367. format: uuid
  368. chunkIndex:
  369. type: integer
  370. minimum: 0
  371. file:
  372. type: string
  373. format: binary
  374. responses:
  375. "200":
  376. description: Chunk accepted
  377. content:
  378. application/json:
  379. schema:
  380. $ref: "#/components/schemas/ChunkProgressEnvelope"
  381. "400":
  382. $ref: "#/components/responses/Error"
  383. "401":
  384. $ref: "#/components/responses/Error"
  385. "404":
  386. $ref: "#/components/responses/Error"
  387. "410":
  388. $ref: "#/components/responses/Error"
  389. /sessions/{sessionId}/assets/complete:
  390. parameters:
  391. - $ref: "#/components/parameters/SessionId"
  392. post:
  393. tags: [Assets]
  394. operationId: completeChunkedUpload
  395. requestBody:
  396. required: true
  397. content:
  398. application/json:
  399. schema:
  400. type: object
  401. required: [uploadId, totalChunks]
  402. properties:
  403. uploadId:
  404. type: string
  405. format: uuid
  406. totalChunks:
  407. type: integer
  408. minimum: 1
  409. responses:
  410. "200":
  411. description: Chunks merged and asset created
  412. content:
  413. application/json:
  414. schema:
  415. $ref: "#/components/schemas/AssetUploadEnvelope"
  416. "400":
  417. $ref: "#/components/responses/Error"
  418. "401":
  419. $ref: "#/components/responses/Error"
  420. "404":
  421. $ref: "#/components/responses/Error"
  422. "410":
  423. $ref: "#/components/responses/Error"
  424. /sessions/{sessionId}/assets/{assetId}:
  425. parameters:
  426. - $ref: "#/components/parameters/SessionId"
  427. - $ref: "#/components/parameters/AssetId"
  428. get:
  429. tags: [Assets]
  430. operationId: downloadAsset
  431. responses:
  432. "200":
  433. description: Attachment bytes; Content-Disposition contains the original filename
  434. content:
  435. application/octet-stream:
  436. schema:
  437. type: string
  438. format: binary
  439. "401":
  440. $ref: "#/components/responses/Error"
  441. "404":
  442. $ref: "#/components/responses/Error"
  443. /storage/quota:
  444. get:
  445. tags: [Sync]
  446. operationId: getStorageQuota
  447. description: Called before uploading the pending assets for a session.
  448. responses:
  449. "200":
  450. description: Current storage quota in bytes
  451. content:
  452. application/json:
  453. schema:
  454. $ref: "#/components/schemas/StorageQuotaEnvelope"
  455. "401":
  456. $ref: "#/components/responses/Error"
  457. /sync/trigger:
  458. post:
  459. tags: [Sync]
  460. operationId: recordSyncCheckpoint
  461. description: Called only after all session metadata and assets finish syncing.
  462. responses:
  463. "200":
  464. description: Client sync checkpoint recorded
  465. content:
  466. application/json:
  467. schema:
  468. $ref: "#/components/schemas/SyncCheckpointEnvelope"
  469. "401":
  470. $ref: "#/components/responses/Error"
  471. components:
  472. securitySchemes:
  473. bearerAuth:
  474. type: http
  475. scheme: bearer
  476. bearerFormat: JWT
  477. parameters:
  478. DeviceId:
  479. name: deviceId
  480. in: path
  481. required: true
  482. schema:
  483. type: string
  484. format: uuid
  485. SessionId:
  486. name: sessionId
  487. in: path
  488. required: true
  489. schema:
  490. type: string
  491. format: uuid
  492. AssetId:
  493. name: assetId
  494. in: path
  495. required: true
  496. schema:
  497. type: string
  498. format: uuid
  499. responses:
  500. EmptySuccess:
  501. description: Success without a data payload
  502. content:
  503. application/json:
  504. schema:
  505. $ref: "#/components/schemas/EmptyEnvelope"
  506. Error:
  507. description: Request failed
  508. content:
  509. application/json:
  510. schema:
  511. $ref: "#/components/schemas/ErrorEnvelope"
  512. QuotaError:
  513. description: Storage quota exceeded
  514. content:
  515. application/json:
  516. schema:
  517. $ref: "#/components/schemas/QuotaErrorEnvelope"
  518. schemas:
  519. EnvelopeBase:
  520. type: object
  521. required: [code, message]
  522. properties:
  523. code:
  524. type: integer
  525. message:
  526. type: string
  527. EmptyEnvelope:
  528. allOf:
  529. - $ref: "#/components/schemas/EnvelopeBase"
  530. - type: object
  531. properties:
  532. data:
  533. type: "null"
  534. ErrorEnvelope:
  535. allOf:
  536. - $ref: "#/components/schemas/EnvelopeBase"
  537. - type: object
  538. properties:
  539. data: {}
  540. HealthEnvelope:
  541. allOf:
  542. - $ref: "#/components/schemas/EnvelopeBase"
  543. - type: object
  544. required: [data]
  545. properties:
  546. data:
  547. type: string
  548. const: healthy
  549. RegisterRequest:
  550. type: object
  551. required: [username, identifier, password]
  552. properties:
  553. username:
  554. type: string
  555. minLength: 2
  556. identifier:
  557. type: string
  558. description: Email address or phone number.
  559. password:
  560. type: string
  561. minLength: 6
  562. LoginRequest:
  563. type: object
  564. required: [identifier, password]
  565. properties:
  566. identifier:
  567. type: string
  568. description: Username, email address, or phone number.
  569. password:
  570. type: string
  571. UpdateProfileRequest:
  572. type: object
  573. properties:
  574. username:
  575. type: [string, "null"]
  576. email:
  577. type: [string, "null"]
  578. phoneNumber:
  579. type: [string, "null"]
  580. avatarURL:
  581. type: [string, "null"]
  582. User:
  583. type: object
  584. required: [id, username, registeredAt]
  585. properties:
  586. id:
  587. type: string
  588. format: uuid
  589. username:
  590. type: string
  591. email:
  592. type: string
  593. phoneNumber:
  594. type: string
  595. avatarURL:
  596. type: string
  597. format: uri
  598. registeredAt:
  599. type: string
  600. format: date-time
  601. updatedAt:
  602. type: string
  603. format: date-time
  604. AuthData:
  605. type: object
  606. required: [user, token, refreshToken, expiresAt]
  607. properties:
  608. user:
  609. $ref: "#/components/schemas/User"
  610. token:
  611. type: string
  612. description: Short-lived access JWT.
  613. refreshToken:
  614. type: string
  615. description: Rotated on every refresh.
  616. expiresAt:
  617. type: string
  618. format: date-time
  619. AuthEnvelope:
  620. allOf:
  621. - $ref: "#/components/schemas/EnvelopeBase"
  622. - type: object
  623. required: [data]
  624. properties:
  625. data:
  626. $ref: "#/components/schemas/AuthData"
  627. UserEnvelope:
  628. allOf:
  629. - $ref: "#/components/schemas/EnvelopeBase"
  630. - type: object
  631. required: [data]
  632. properties:
  633. data:
  634. $ref: "#/components/schemas/User"
  635. BindDeviceRequest:
  636. type: object
  637. required: [name]
  638. properties:
  639. name:
  640. type: string
  641. peripheralUUID:
  642. type: string
  643. hardwareMAC:
  644. type: [string, "null"]
  645. firmwareVersion:
  646. type: [string, "null"]
  647. batteryLevel:
  648. type: [integer, "null"]
  649. minimum: 0
  650. maximum: 100
  651. freeStorageMB:
  652. type: [integer, "null"]
  653. totalStorageMB:
  654. type: [integer, "null"]
  655. UpdateDeviceRequest:
  656. type: object
  657. properties:
  658. name:
  659. type: [string, "null"]
  660. batteryLevel:
  661. type: [integer, "null"]
  662. minimum: 0
  663. maximum: 100
  664. isConnected:
  665. type: [boolean, "null"]
  666. firmwareVersion:
  667. type: [string, "null"]
  668. freeStorageMB:
  669. type: [integer, "null"]
  670. totalStorageMB:
  671. type: [integer, "null"]
  672. Device:
  673. type: object
  674. required: [id, name, peripheralUUID]
  675. properties:
  676. id:
  677. type: string
  678. format: uuid
  679. userId:
  680. type: string
  681. format: uuid
  682. name:
  683. type: string
  684. peripheralUUID:
  685. type: string
  686. hardwareMAC:
  687. type: string
  688. batteryLevel:
  689. type: integer
  690. firmwareVersion:
  691. type: string
  692. freeStorageMB:
  693. type: integer
  694. totalStorageMB:
  695. type: integer
  696. isConnected:
  697. type: boolean
  698. boundAt:
  699. type: string
  700. format: date-time
  701. updatedAt:
  702. type: string
  703. format: date-time
  704. DeviceEnvelope:
  705. allOf:
  706. - $ref: "#/components/schemas/EnvelopeBase"
  707. - type: object
  708. required: [data]
  709. properties:
  710. data:
  711. $ref: "#/components/schemas/Device"
  712. EventUpsert:
  713. type: object
  714. required: [clientId, relativeTimeMs, eventType]
  715. properties:
  716. clientId:
  717. type: string
  718. relativeTimeMs:
  719. type: integer
  720. format: int64
  721. eventType:
  722. type: string
  723. enum: [PHOTO, NOTE, MARKER, VOICE, CONTINUATION]
  724. textContent:
  725. type: [string, "null"]
  726. voiceStartOffsetMs:
  727. type: [integer, "null"]
  728. format: int64
  729. voiceEndOffsetMs:
  730. type: [integer, "null"]
  731. format: int64
  732. SessionUpsertRequest:
  733. type: object
  734. required: [clientId, title, startTime, durationMs, events, deletedEventClientIds]
  735. properties:
  736. clientId:
  737. type: string
  738. title:
  739. type: string
  740. startTime:
  741. type: string
  742. format: date-time
  743. endTime:
  744. type: [string, "null"]
  745. format: date-time
  746. durationMs:
  747. type: integer
  748. format: int64
  749. events:
  750. type: array
  751. items:
  752. $ref: "#/components/schemas/EventUpsert"
  753. baseRevision:
  754. type: [integer, "null"]
  755. format: int64
  756. deletedEventClientIds:
  757. type: array
  758. items:
  759. type: string
  760. RemoteEvent:
  761. allOf:
  762. - $ref: "#/components/schemas/EventUpsert"
  763. - type: object
  764. required: [id]
  765. properties:
  766. id:
  767. type: string
  768. format: uuid
  769. clientId:
  770. type: [string, "null"]
  771. createdAt:
  772. type: string
  773. format: date-time
  774. RemoteSession:
  775. type: object
  776. required: [id, title, startTime, durationMs, revision]
  777. properties:
  778. id:
  779. type: string
  780. format: uuid
  781. clientId:
  782. type: [string, "null"]
  783. title:
  784. type: string
  785. startTime:
  786. type: string
  787. format: date-time
  788. endTime:
  789. type: [string, "null"]
  790. format: date-time
  791. durationMs:
  792. type: integer
  793. format: int64
  794. revision:
  795. type: integer
  796. format: int64
  797. deletedAt:
  798. type: [string, "null"]
  799. format: date-time
  800. events:
  801. type: array
  802. items:
  803. $ref: "#/components/schemas/RemoteEvent"
  804. assets:
  805. type: array
  806. items:
  807. $ref: "#/components/schemas/Asset"
  808. SessionEnvelope:
  809. allOf:
  810. - $ref: "#/components/schemas/EnvelopeBase"
  811. - type: object
  812. required: [data]
  813. properties:
  814. data:
  815. $ref: "#/components/schemas/RemoteSession"
  816. SessionListEnvelope:
  817. allOf:
  818. - $ref: "#/components/schemas/EnvelopeBase"
  819. - type: object
  820. required: [data]
  821. properties:
  822. data:
  823. type: array
  824. items:
  825. $ref: "#/components/schemas/RemoteSession"
  826. ConflictEnvelope:
  827. allOf:
  828. - $ref: "#/components/schemas/EnvelopeBase"
  829. - type: object
  830. required: [data]
  831. properties:
  832. data:
  833. type: object
  834. required: [serverRevision]
  835. properties:
  836. serverRevision:
  837. type: integer
  838. format: int64
  839. AssetKind:
  840. type: string
  841. enum: [AUDIO, PHOTO]
  842. Asset:
  843. type: object
  844. required: [id, clientId, kind, fileName, mimeType, sizeBytes, sha256]
  845. properties:
  846. id:
  847. type: string
  848. format: uuid
  849. clientId:
  850. type: string
  851. kind:
  852. $ref: "#/components/schemas/AssetKind"
  853. fileName:
  854. type: string
  855. mimeType:
  856. type: string
  857. sizeBytes:
  858. type: integer
  859. format: int64
  860. sha256:
  861. type: string
  862. pattern: "^[a-fA-F0-9]{64}$"
  863. createdAt:
  864. type: string
  865. format: date-time
  866. AssetUploadData:
  867. type: object
  868. required: [asset, sessionRevision]
  869. properties:
  870. asset:
  871. $ref: "#/components/schemas/Asset"
  872. sessionRevision:
  873. type: integer
  874. format: int64
  875. AssetUploadEnvelope:
  876. allOf:
  877. - $ref: "#/components/schemas/EnvelopeBase"
  878. - type: object
  879. required: [data]
  880. properties:
  881. data:
  882. oneOf:
  883. - $ref: "#/components/schemas/AssetUploadData"
  884. - $ref: "#/components/schemas/Asset"
  885. ChunkUploadInitRequest:
  886. type: object
  887. required: [clientId, kind, fileName, mimeType, fileSize, chunkSize]
  888. properties:
  889. clientId:
  890. type: string
  891. kind:
  892. $ref: "#/components/schemas/AssetKind"
  893. fileName:
  894. type: string
  895. mimeType:
  896. type: string
  897. fileSize:
  898. type: integer
  899. format: int64
  900. minimum: 1
  901. chunkSize:
  902. type: integer
  903. minimum: 1
  904. ChunkUploadInitEnvelope:
  905. allOf:
  906. - $ref: "#/components/schemas/EnvelopeBase"
  907. - type: object
  908. required: [data]
  909. properties:
  910. data:
  911. type: object
  912. required: [uploadId, totalChunks, chunkSize, expiresAt]
  913. properties:
  914. uploadId:
  915. type: string
  916. format: uuid
  917. totalChunks:
  918. type: integer
  919. chunkSize:
  920. type: integer
  921. expiresAt:
  922. type: string
  923. format: date-time
  924. ChunkProgressEnvelope:
  925. allOf:
  926. - $ref: "#/components/schemas/EnvelopeBase"
  927. - type: object
  928. required: [data]
  929. properties:
  930. data:
  931. type: object
  932. required: [uploadId, chunkIndex, uploadedChunks, totalChunks]
  933. properties:
  934. uploadId:
  935. type: string
  936. format: uuid
  937. chunkIndex:
  938. type: integer
  939. uploadedChunks:
  940. type: integer
  941. totalChunks:
  942. type: integer
  943. StorageQuota:
  944. type: object
  945. required: [totalBytes, usedBytes, remainingBytes]
  946. properties:
  947. totalBytes:
  948. type: integer
  949. format: int64
  950. usedBytes:
  951. type: integer
  952. format: int64
  953. remainingBytes:
  954. type: integer
  955. format: int64
  956. StorageQuotaEnvelope:
  957. allOf:
  958. - $ref: "#/components/schemas/EnvelopeBase"
  959. - type: object
  960. required: [data]
  961. properties:
  962. data:
  963. $ref: "#/components/schemas/StorageQuota"
  964. QuotaErrorEnvelope:
  965. allOf:
  966. - $ref: "#/components/schemas/EnvelopeBase"
  967. - type: object
  968. required: [data]
  969. properties:
  970. data:
  971. allOf:
  972. - $ref: "#/components/schemas/StorageQuota"
  973. - type: object
  974. required: [requiredBytes]
  975. properties:
  976. requiredBytes:
  977. type: integer
  978. format: int64
  979. SyncCheckpointEnvelope:
  980. allOf:
  981. - $ref: "#/components/schemas/EnvelopeBase"
  982. - type: object
  983. required: [data]
  984. properties:
  985. data:
  986. type: object
  987. required: [syncedAt, message]
  988. properties:
  989. syncedAt:
  990. type: string
  991. format: date-time
  992. message:
  993. type: string
  994. DeleteEnvelope:
  995. allOf:
  996. - $ref: "#/components/schemas/EnvelopeBase"
  997. - type: object
  998. required: [data]
  999. properties:
  1000. data:
  1001. type: object
  1002. required: [deletedId]
  1003. properties:
  1004. deletedId:
  1005. type: string
  1006. security:
  1007. - bearerAuth: []