Superhero API (akabab) · Capability

Superheroes Images

Run with Naftiko

Capability Spec

superheroes-images.yaml Raw ↑
apiVersion: naftiko.io/v1
kind: Capability
metadata:
  name: superheroes-images
  title: Superhero Images
  description: Multi-resolution character image assets served as static JPGs.
  provider: akabab/superhero-api
  baseURL: https://akabab.github.io/superhero-api/api
  license: MIT
  authentication: none
spec:
  operations:
    - id: getCharacterImage
      method: GET
      path: /images/{size}/{filename}
      description: Returns a JPG image at the requested size for a character (filename uses the character slug, e.g. `1-a-bomb.jpg`).
      tags: [Images]
      parameters:
        - name: size
          in: path
          type: string
          enum: [xs, sm, md, lg]
        - name: filename
          in: path
          type: string
          pattern: "^[0-9]+-[a-z0-9-]+\\.jpg$"
      idempotent: true

  workflows:
    - id: thumbnail-grid
      description: Render a grid of character thumbnails (xs) from a list of ids/slugs.
      steps:
        - foreach: "{{input.characters}}"
          call: getCharacterImage
          with:
            size: xs
            filename: "{{item.slug}}.jpg"

    - id: hero-detail-image
      description: Fetch the largest available image for a character detail page.
      steps:
        - call: getCharacterImage
          with:
            size: lg
            filename: "{{input.slug}}.jpg"