GitHub

client = TRMNL::API.new { |settings| settings.uri = "https://trmnl.com" }
client.recipes                     # Answers first page.
client.recipes page: 10            # Answers page ten.
client.recipes search: "comic"     # Answers first page of comics.
client.recipes sort: "popularity"  # Answers first page sorted by popularity.
# Success(
#  #<data TRMNL::API::Models::Recipe
#    data = [
#      #<Struct:TRMNL::API::Models::Recipes::Data:0x00010fe0
#        author = #<Struct:TRMNL::API::Models::Recipes::Author:0x00010ff0
#          category = nil,
#          description = nil,
#          description_locales = {},
#          email_address = nil,
#          field_type = nil,
#          github_url = nil,
#          keyname = nil,
#          learn_more_url = nil,
#          name = nil,
#          youtube_url = nil
#        >,
#        custom_fields = [
#          {
#                "keyname" => "user_location",
#             "field_type" => "string",
#                   "name" => "Weather Location",
#            "placeholder" => "New York, NY",
#            "description" => "Choose a location",
#              "help_text" => "Please be precise...",
#               "required" => true
#          },
#          {
#                "keyname" => "metric",
#                   "name" => "Temperature Metric",
#            "description" => "Celsius or Fahrenheit?",
#             "field_type" => "select",
#                "options" => [
#              "Fahrenheit",
#              "Celsius"
#            ],
#                "default" => "Fahrenheit"
#          }
#        ],
#        icon_content_type = "image/png",
#        icon_url = "https://trmnl-public.s3.us-east-2.amazonaws.com/ajjlbek4cabcvhk3s1lxggn8cgon",
#        id = 49610,
#        name = "Weather Chum",
#        published_at = 2025-05-14 05:32:00 UTC,
#        screenshot_url = "https://trmnl.s3.us-east-2.amazonaws.com...",
#        statistics = #<data TRMNL::API::Models::Recipes::Statistics:0x00011170
#          forks = 1710,
#          installs = 1
#        >
#      >
#    ],
#    meta = #<data TRMNL::API::Models::Recipes::Meta:0x00016e20
#      current_page = 1,
#      from = 1,
#      next_page_url = "/recipes.json?page=2&sort_by=popularity",
#      per_page = 25,
#      prev_page_url = nil,
#      to = 25,
#      total = 678
#    >
#  >
# )

⚠️ This does not use the TRMNL API like every other endpoint documented here. Instead, you must customize the settings URI to point to the root of the TRMNL application (i.e. https://trmnl.com) instead of using the default API endpoint.

You’ll always get a data array which may or may not be filled and meta (metadata) for handling pagination information. You can also combine the page, search, and page parameters as you see fit.

Read the original on github.com ↗