mediaList
The mediaList query retrieves a paginated list of NFT media assets and associated data with comprehensive filtering, sorting, and pagination capabilities.
It returns a MediaList object containing an array of Media objects containing an NFT's media assets and associated data.
Schema Definition
mediaList(
first: Int = 10
skip: Int = 0
where: MediaFilter
orderBy: MediaOrderBy = CREATED_AT
orderDirection: Ordering = DESC
): MediaList!
Arguments
| Argument | Type | Description |
|---|---|---|
first | Int = 10 scalar | Maximum number of media items to retrieve per page. Maximum value is 100. |
skip | Int = 0 scalar | Number of media items to bypass before assembling the page. Set to the first value from the previous page for offset pagination. |
where | MediaFilter input | Specifies subsets of media data to be retrieved. |
orderBy | MediaOrderBy enum | Sets how the list of media items is ordered. |
orderDirection | Ordering enum | Sets the direction in which the list of media items is ordered. |
Return Type
MediaList object
Common Use Cases
- Display media galleries for NFT collections by filtering on contract address or token IDs.
- Generate optimized image displays using available thumbnail presets for faster page loads.
- Track recently added or updated media using
createdAtGte/createdAtLteandupdatedAtGte/updatedAtLtefilters. - Filter by media and file type using the
mediaTypeandfileTypeparameters for type-specific galleries.
Example
Query
Display NFT Collection Media Gallery
query CollectionGallery($first: Int!, $skip: Int!, $mediaType: MediaType) {
mediaList(
first: $first
skip: $skip
where: { mediaType: $mediaType }
orderBy: CREATED_AT
orderDirection: DESC
) {
numEntries
cursor
entries {
url
mediaType
fileType
thumbnails(preset: MEDIUM) {
url
width
height
}
createdAt
updatedAt
}
}
}
Variables
{
"first": 10,
"skip": 0,
"mediaType": "IMAGE"
}
Response
{
"data": {
"mediaList": {
"numEntries": 10,
"cursor": "10",
"entries": [
{
"url": "https://example.com/nft-media/1.png",
"mediaType": "IMAGE",
"fileType": "image/png",
"thumbnails": [
{
"url": "https://example.com/nft-media/thumbnails/1_medium.png",
"width": 300,
"height": 300
}
],
"createdAt": "2024-01-15T12:34:56Z",
"updatedAt": "2024-02-20T08:22:10Z"
}
// More media entries...
]
}
}
}
Implementation Notes
note
- The default
firstvalue is 10 transactions. OneSource enforces a maximumfirstvalue of 100. Adjust based on your UI needs. - Use
skipfor offset-based pagination. To get the next page, use askipvalue equal to the previousfirstvalue. - All range filters use
Gte(greater than or equal to) andLte(less than or equal to) suffixes for inclusive ranges. - Use orderBy and orderDirection to ensure consistent ordering when paginating through large result sets.
- Use thumbnail presets (
SMALL,MEDIUM,LARGE) for optimized image loading rather than full-size assets. - The
fileTypefield contains the MIME type (e.g.,image/png,video/mp4) for proper rendering. - Media URLs may point to IPFS, Arweave, or centralized storage. Implement fallback handling for reliability.