Favware.Graphqlpokemon 0.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Favware.Graphqlpokemon --version 0.0.1                
NuGet\Install-Package Favware.Graphqlpokemon -Version 0.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Favware.Graphqlpokemon" Version="0.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Favware.Graphqlpokemon --version 0.0.1                
#r "nuget: Favware.Graphqlpokemon, 0.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Favware.Graphqlpokemon as a Cake Addin
#addin nuget:?package=Favware.Graphqlpokemon&version=0.0.1

// Install Favware.Graphqlpokemon as a Cake Tool
#tool nuget:?package=Favware.Graphqlpokemon&version=0.0.1                

GraphQL-Pokemon

Expansive Pokemon GraphQL API!


Table of Contents


Project Status

GitHub Continuous Delivery Continuous Integration Showdown Tierlists

Social Media and Donations

Join Discord server Twitter Follow Patreon Donate PayPal Donate

Typings

npm nuget


Query for Pokemon data using GraphQL

Key Features

  • Fully generated client-side TypeScript typings published to
  • Fully generated client-side .NET Core typings published to nuget
  • Docker images of the API for private hosting published to
  • Provides information about various assets in Pokémon
    • Pokédex
    • Items
    • Abilities
    • Moves
    • Learnsets
    • Type matchups

Installation

NodeJS

Install client side typings from yarn or npm:

yarn add -D @favware/graphql-pokemon
npm install -D @favware/graphql-pokemon

.NET Core

Install client side typings from NuGet.

Search Favware.Graphqlpokemon in your NuGet manager and install it from there


API Documentation

For the full documentation of the deployed version please see the GraphQL Playground on the API.

Usage

NodeJS

With browser Fetch API or node-fetch

import { Query } from '@favware/graphql-pokemon';

interface GraphQLPokemonResponse<K extends keyof Omit<Query, '__typename'>> {
  data: Record<K, Omit<Query[K], '__typename'>>;
}

fetch('https://favware.tech/api', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    query: `
      {
        getPokemonDetails(pokemon: dragonite skip: 0 take: 2 reverse: true) {
            sprite
            num
            species
            color
        }
      }
    `
  })
})
  .then((res) => res.json() as GraphQLPokemonResponse<'getPokemonDetails'>)
  .then((json) => console.log(json.data));

With Apollo Client React

// ApolloClient setup
import { ApolloClient } from 'apollo-client';
import { InMemoryCache } from 'apollo-cache-inmemory';
import { HttpLink } from 'apollo-link-http';

// Instantiate required constructor fields
const cache = new InMemoryCache();
const link = new HttpLink({
  uri: 'https://favware.tech/api'
});

export const client = new ApolloClient({
  // Provide required constructor fields
  cache: cache,
  link: link,

  // Provide some optional constructor fields
  name: 'graphql-pokemon-client',
  version: '1.0',
  queryDeduplication: false,
  defaultOptions: {
    watchQuery: {
      fetchPolicy: 'cache-and-network'
    }
  }
});
// Component
import React from 'react';
import gql from 'graphql-tag';
import { useQuery } from '@apollo/react-hooks';
import { Query } from '@favware/graphql-pokemon';
import { client } from './ApolloClient';

interface GraphQLPokemonResponse<K extends keyof Omit<Query, '__typename'>> {
  data: Record<K, Omit<Query[K], '__typename'>>;
}

const GET_POKEMON_DETAILS = gql`
  {
    getPokemonDetails(pokemon: dragonite, skip: 0, take: 2, reverse: true) {
      sprite
      num
      species
      color
    }
  }
`;

export const Pokemon: React.FC = () => {
  const { loading, error, data } = useQuery<GraphQLPokemonResponse<'getPokemonDetails'>>(GET_POKEMON_DETAILS, { client: client });

  if (loading) return 'Loading...';
  if (error) return `Error! ${error.message}`;

  return <div> Insert how you want to display the data here </div>;
};

.NET Core

More will be added here in due time, once I get more familiarized with .NET. Or if anyone wants to contribute usage then please do

using GraphQLCodeGen;

namespace MyProject.Consumer
{
  public class GraphqlConsumer
  {
    private Graphqlpokemon.Abilities Abilities;
  }
}

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.2.3 608 7/5/2020
4.2.2 463 7/1/2020
4.2.1 559 6/20/2020
4.2.0 573 6/20/2020
4.1.0 451 6/19/2020
4.0.4 514 6/14/2020
4.0.3 482 6/13/2020
4.0.2 471 6/8/2020
4.0.1 468 5/26/2020
4.0.0 462 5/18/2020
3.1.1 490 5/4/2020
3.1.0 514 5/3/2020
3.0.3 498 5/2/2020
3.0.2 457 5/2/2020
3.0.1 488 4/25/2020
3.0.0 460 4/25/2020
1.8.4 466 4/25/2020
1.8.3 436 4/25/2020
0.0.1 465 4/24/2020

Alpha Release