Astro Loaders by LekoArts

Need to pull in content using Astro's content layer? Reach for one of the provided loaders below and stop dealing with complicated third-party APIs.

Star on Github

Use loaders for

  • Clerk
  • Flickr
  • Plausible
  • Trakt

clerkLoader({ clientOptions?: ClerkClientOptions; method: { name: string; options: string | Object } })

Access certain Clerk Backend APIs by choosing a method name.

Example Output

Return values of users.getUserList():

test-05test-04test-03test-02test-01arsaurea

flickrPeopleGetPhotosLoader({ username: string })

Return photos from the given user's photostream. Only photos visible to the calling user will be returned.

Example Output
A orange-blue-purple patternA pink streak going through a black and white mountain rangeWinter overlook from mountainIcy branchYellow spheres in front of blue background

flickrPhotosetsGetListLoader({ username: string })

Returns the photosets belonging to the specified user.

Example Output
3D (3)Winter (2)

flickrPhotosetsGetPhotosLoader({ username: string; photoset_id: string })

Get the list of photos in a photoset.

Example Output

Title: 3D - Total images: 3

Yellow spheres in front of blue backgroundA pink streak going through a black and white mountain rangeA orange-blue-purple pattern

flickrPhotosetsGetListWithPhotosLoader({ username: string })

This loader combines the flickrPhotosetsGetListLoader() and flickrPhotosetsGetPhotosLoader() loaders to get the most out of photosets. You'll get back the photosets and their list of photos.

Example Output

Title: 3D - Total images: 3

Yellow spheres in front of blue backgroundA pink streak going through a black and white mountain rangeA orange-blue-purple pattern

Title: Winter - Total images: 2

Icy branchWinter overlook from mountain

plausibleLoader({ query: PlausibleQuery })

Access the Plausible Stats API with your custom query.

Example Output

Return value of a custom query:

{
  "results": [
    {
      "metrics": [
        744
      ],
      "dimensions": []
    }
  ],
  "meta": {}
}

traktUsersStatsLoader({ id: string })

Returns stats about the movies, shows, and episodes a user has watched, collected, and rated.

Example Output
{
  "movies": {
    "plays": 543,
    "watched": 500,
    "minutes": 66399,
    "collected": 0,
    "ratings": 478,
    "comments": 0
  },
  "shows": {
    "watched": 238,
    "collected": 0,
    "ratings": 217,
    "comments": 0
  },
  "seasons": {
    "ratings": 6,
    "comments": 0
  },
  "episodes": {
    "plays": 9444,
    "watched": 9400,
    "minutes": 373305,
    "collected": 0,
    "ratings": 8,
    "comments": 0
  },
  "network": {
    "friends": 2,
    "followers": 9,
    "following": 2
  },
  "ratings": {
    "total": 709,
    "distribution": {
      "1": 2,
      "2": 4,
      "3": 8,
      "4": 21,
      "5": 62,
      "6": 136,
      "7": 212,
      "8": 178,
      "9": 69,
      "10": 17
    }
  }
}

traktUsersWatchedLoader({ id: string; type: 'movies' | 'shows'; extended: string[] })

Returns all movies or shows a user has watched sorted by most plays.

traktUsersListsLoader({ id: string })

Returns all personal lists for a user.

traktUsersRatingsLoader({ id: string; type: string; rating?: string; extended?: string[] })

Get a user's ratings filtered by type. You can optionally filter for a specific rating between 1 and 10.

traktUsersHistoryLoader({ id: string; type: string; item_id?: number; start_at?: string; end_at?: string; extended?: string[] })

Returns movies and episodes that a user has watched, sorted by most recent.