Giao diện
API · media
Trang sinh tự động
Parse từ schema.graphql (SDL backend export) bằng parser graphql. Mô tả và quyền lấy nguyên văn từ description trong SDL.
4 query · 3 mutation.
Query
media
Requires media.read (own: MD-02/MD-05; another account's PUBLIC READY media: MD-05). Deleted -> not_found.
query · quyền: media.read
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
id | ID! |
Trả về Media!
| Field | Kiểu | Mô tả |
|---|---|---|
id | ID! | |
purpose | MediaPurpose! | |
visibility | MediaVisibility! | |
kind | MediaKind! | |
mimeType | String! | |
originalName | String! | Name the uploader gave the file, for display only. |
fileName | String! | Normalized download name (slug + extension of the validated MIME type). |
declaredSizeBytes | Int! | Size declared when the ticket was requested, in bytes (<= the purpose limit, never above 20 MiB). |
sizeBytes | Int | Actual stored size in bytes; null until READY. |
status | MediaStatus! | |
ownedByViewer | Boolean! | True when the caller uploaded this item. |
version | Int! | |
createdAt | DateTime! | |
readyAt | DateTime | |
deletedAt | DateTime | Set by deleteMedia (soft delete); the stored object is kept. |
mediaLibrary
M-02 AC01: the library. Requires media.read. Lists READY, not-deleted media only (PENDING tickets and soft-deleted items never appear): the caller's own items, plus other accounts' PUBLIC items when the caller holds media.read on ALL (MD-05). Newest first. page >= 1, pageSize 1..100 (default 20).
query · quyền: media.read
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
filter | MediaLibraryFilter | ||
page | Int | ||
pageSize | Int |
Trả về MediaPage!
| Field | Kiểu | Mô tả |
|---|---|---|
items | [Media!]! | |
page | Int! | |
pageSize | Int! | |
total | Int! | |
sourceStatus | SourceStatus! |
mediaSignedView
Requires media.read. PUBLIC: stable URL. PRIVATE: signed URL (1 hour), never a public URL.
query · quyền: media.read
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
id | ID! |
Trả về MediaView!
| Field | Kiểu | Mô tả |
|---|---|---|
mediaId | ID! | |
visibility | MediaVisibility! | |
url | String! | |
expiresAt | DateTime |
mediaUploadPolicies
U6-P3-38: upload rules (MIME, maxBytes, maxCount) of the purposes the caller's app may create, one line per purpose then one per use case. Requires an upload permission (media.upload, catalog_media.upload or sale_media.upload). The single source for upload widgets; the server enforces the same values.
query · SDL không ghi quyền
Không có tham số.
Trả về [MediaUploadPolicy!]!
| Field | Kiểu | Mô tả |
|---|---|---|
purpose | MediaPurpose! | |
useCase | MediaUseCase | |
mimeTypes | [String!]! | Accepted content types (checked again against the stored bytes). |
maxBytes | Int! | |
maxCount | Int | Most media on one record; null when the source sets no limit. |
Mutation
completeMediaUpload
Requires the upload permission of the item's purpose, uploader only. READY after the stored object is verified (size, MIME, bytes).
mutation · SDL không ghi quyền
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | MediaCommandInput! |
Trả về MediaCommandResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | |
media | Media! |
createMediaUpload
Requires media.upload (MD-01/MD-04); PRODUCT_IMAGE requires catalog_media.upload (MD-12), SALE_PROFILE_* requires sale_media.upload (MD-14). Returns a PENDING item and a one-object signed upload URL.
mutation · quyền: media.upload
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | CreateMediaUploadInput! |
Trả về CreateMediaUploadResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | |
media | Media! | |
upload | MediaUrl | PUT the file here before completeMediaUpload; null once the item is READY. |
deleteMedia
Requires media.delete (own: MD-03/MD-06; another account's PUBLIC media: MD-06); PRODUCT_IMAGE: catalog_media.delete (MD-13, own), SALE_PROFILE_*: sale_media.delete (MD-15, own). Soft delete.
mutation · quyền: media.delete
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | MediaCommandInput! |
Trả về MediaCommandResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | |
media | Media! |