Giter VIP home page Giter VIP logo

gatsby-source-helix's Introduction

gatsby-source-helix

Gatsby source plugin for building websites using Twitch as a data source.

Installation

npm install --save gatsby-source-helix

Usage

  1. Register an app at the Twitch Dev Console and get your Client ID and Client Secret.
  2. Obtain the user ID for filtering. There are multiple ways of doing this. See Getting Your User ID.
  3. Add the plugin to your gatsby-config.js:
module.exports = {
  plugins: [
    {
      resolve: 'gatsby-source-helix',
      options: {
        clientId: 'Your Client ID',
        clientSecret: 'Your Client Secret',
        userId: 'Your user ID',
      },
    },
  ],
};
  1. Query for nodes from your pages:
{
  allHelixClip {
    edges {
      node {
        title
        broadcaster_name
      }
    }
  }
}
{
  allHelixVideo {
    edges {
      node {
        title
        user_name
        description
      }
    }
  }
}

A list of available fields can be found here. Note that the id field is assigned by the plugin and does not correspond to a Twitch ID.

Getting Your User ID

This can be done using the Twitch CLI. Follow the instructions provided by Twitch, and then run the following:

twitch api get users -q login=<username>

replacing <username> with the actual name of the user whose ID you want to fetch. The JSON response will contain the user ID:

{
  "data": [
    {
      ...
      "id": "123456789",
      ...
    }
  ]
}

Options

Name Type Description Default
clientId String Twitch API Client ID (required)
clientSecret String Twitch API Client Secret (required)
userId String User ID filter (required)

gatsby-source-helix's People

Contributors

flygsand avatar dependabot[bot] avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.