Gatsby source plugin for pulling data into Gatsby from Dog API (https://dog.ceo/dog-api/)
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
www
.babelrc
.eslintrc
.gitignore
.npmignore
.prettierrc
README.md
gatsby-node.js
netlify.toml
package.json
yarn.lock

README.md

Gatsby Source Dog

Fetch data from Dog CEO API


Installation

yarn add gatsby-source-dog

How to Use

Visit this or this to get the list of available dog breeds.

In your gatsby-config.js, add the plugin and options:

{
  ...
    plugins: [
      ...
      {
        resolve: 'gatsby-source-dog',
        options: {
          breeds: {
            list: true,
            random: true,
            number: 5,
          },
          breed: [
            "husky",
            "Border Collie",
            "retriever-golden",
            {
              name: "corgi",
            },
            {
              name: "Great Dane",
              random: true,
            },
            {
              name: "pug",
              random: true,
              number: 3,
            },
          ],
        },
      },
    ],
    ...
}

How to Query

To query all images:

  allDogImage {
    edges {
      node {
        id
        breed
        url
        internal {
          ...
        }
      }
    }
  }

To query all images based on dog breed:

  allDogImage(filter: { breed: { eq:  "Border Collie" } }) {
    edges {
      node {
        id
        breed
        url
        internal {
          ...
        }
      }
    }
  }

To query one image based on id:

  dogImage(id: { eq: "cb75eb4f-0bf4-56ca-ba4a-680b5678526d" }) {
    id
    breed
    url
    internal {
      ...
    }
  }