npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gatsby-source-dogapi

v2.0.0-beta.1

Published

Gatsby source plugin to add thedogapi.com datas to your website

Downloads

11

Readme

🐕 Introduction

gatsby-source-dogapi is a simple Gatsby source plugin to add thedogapi.com doggy features to your Gatsby website.

This source plugin lack of features right now but you can use it to play with the API and get random dog pictures. I'll add more options as soon as I can.

Prerequisites

The Dog API is a free service and you can play with it without the needs for an API key.

However if you want to play with more datas, you'll need to signup here and get your API key ready for the next steps.

☕️ Installation Guide

  1. Install Gatsby
  2. Install the plugin using yarn add -D gatsby-source-dogapi or npm i -D gatsby-source-dogapi
  3. Configure the plugin in gatsby-config.js file:
module.exports = {
  siteMetadata: {
    title: 'Wow! Such site! Very title',
  },
  plugins: [
    {
      resolve: "gatsby-source-dogapi",
      options: {
        "limit": 10,
        "page": 0,
        "order": "DESC",
        "x-api-key": "YOUR_API_KEY",
      },
    },
    'gatsby-plugin-offline',
  ],
}

📖 Usage

This source plugin supports all options present within the Dog API but you can only get images for now. Here's the options you can use:

| Option | Default | Description | | ----------------- | ----------------- | ---------------------------------------------------------------------------------------------- | | limit | 1 | [Optional] number of images to return valid 1 to 10 | | page | 0 | [Optional] only works if account_id is present to page through your own uploads | | order | DESC | [Optional] only works if account_id is present, either ASC or DESC - ascending or descending | | x-api-key | null | [Optional] your API key (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) |

Get more documentation about The Dog API here.

How to Query

To query 10 random images:

{
  allDogApiPic {
    edges {
      node {
        id
        url
        sub_id
        created_at
        original_filename
      }
    }
  }
}

To query 1 random image:

{
  allDogApiPic(limit: 1) {
    edges {
      node {
        id
        url
        sub_id
        created_at
        original_filename
      }
    }
  }
}

Example output:

{
  "data": {
    "allDogApiPic": {
      "edges": [
        {
          "node": {
            "id": "22ae1251-42f1-55b7-835a-77b59115b76c",
            "url": "https://cdn2.thedogapi.com/images/Skx45T6EQ.gif",
            "sub_id": "tumblr_o6kk05nXYJ1tlb56zo1_400.gif",
            "created_at": "2018-07-31T11:38:15.000Z",
            "original_filename": "tumblr_o6kk05nXYJ1tlb56zo1_400.gif"
          }
        }
      ]
    }
  }
}

Here's a link to your localhost query.

License

Released under the MIT license.