Skip to main content

getCollections

const collections = await client.getCollections()
Returns the list of collections for the project ordered by creation date. Does not include photos — use getCollection(id) to get those.

Parameters

None.

Returns

interface GalleryCollection {
  id:        string  // UUID
  name:      string  // e.g. "Ceremony"
  createdAt: string  // ISO-8601
}

Example

nav.ts
const collections = await client.getCollections()

for (const col of collections) {
  renderNavItem({ href: `/collections/${col.id}`, label: col.name })
}

getCollection

const collection = await client.getCollection(id)
Returns a single collection with all its approved photos, sorted by position within the collection.

Parameters

id
string
required
UUID of the collection. Obtain it from getCollections().

Returns

interface GalleryCollectionDetail extends GalleryCollection {
  photos: GalleryPhoto[]  // Same shape as getPhotos()
}

Example

collection-page.ts
const collections = await client.getCollections()
const first = collections[0]

if (first) {
  const detail = await client.getCollection(first.id)
  console.log(`${detail.name}: ${detail.photos.length} photos`)
}

Errors

StatusCodeCause
401UNAUTHORIZEDToken invalid
404NOT_FOUNDCollection not found (getCollection only)
500INTERNAL_ERRORServer error