Graphql: Difference between revisions

From bibbleWiki
Jump to navigation Jump to search
Line 17: Line 17:
* ID Unique identifier, Used to re-fetch an object or a the key for a cache
* ID Unique identifier, Used to re-fetch an object or a the key for a cache
=== Types ===
=== Types ===
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="graphql">
type Author {
type Author {
   id: ID,
   id: ID,
Line 24: Line 24:
   rating: Float
   rating: Float
   numOfCourses: Int
   numOfCourses: Int
}
</syntaxhighlight>
=== Enums ===
<syntaxhighlight lang="graphql">
enum language {
  ENGLISH
  SPANISH
  FRENCH
}
}
</syntaxhighlight>
</syntaxhighlight>

Revision as of 02:59, 6 August 2020

Introduction

This is a query language for your API.

Example

A example Query and Response provides an example. It is used by

  • Facebook
  • PsyPal
  • Twitter
  • Github

Core Concepts

Data Types

  • Int signed 32-bit integer
  • Float signed double-precision floating-point value
  • String utf8 character sequence
  • Boolean true or false values
  • ID Unique identifier, Used to re-fetch an object or a the key for a cache

Types

type Author {
  id: ID,
  firstName: String
  lastName: String
  rating: Float
  numOfCourses: Int
}

Enums

enum language {
  ENGLISH
  SPANISH
  FRENCH
}