Giter Site home page Giter Site logo

commandergql's Introduction

CommanderGQL

GraphQL API with .NET 6 and Hot Chocolate

Queries

Get Platforms Query

  • Request
query {
	platform {
		id
		name
	}
}
  • Response
{
	"data": {
		"platform": [
			{
				"id": 7,
				"name": ".NET 6"
			},
			{
				"id": 8,
				"name": ".Docker"
			}
		]
	}
}

Get Commands query

  • Request
query{
	command{
		id
		howTo
		commandLine,
		platform {
			name
			id
		}
	}
}
  • Response
{
	"data": {
		"command": [
			{
				"id": 3,
				"howTo": "Build a project",
				"commandLine": "dotnet build",
				"platform": {
					"name": ".NET 6",
					"id": 7
				}
			},
			{
				"id": 4,
				"howTo": "Start a docker compose file",
				"commandLine": "docker-componse up",
				"platform": {
					"name": ".Docker",
					"id": 8
				}
			}
		]
	}
}

Parallel Platforms

  • Request
query{
	a: platform{
		id
		name
	},
	b: platform{
		id
		name
	},
	c: platform{
		id
		name
	}
}
  • Response
{
	"data": {
		"a": [
			{
				"id": 7,
				"name": ".NET 6"
			},
			{
				"id": 8,
				"name": ".Docker"
			}
		],
		"b": [
			{
				"id": 7,
				"name": ".NET 6"
			},
			{
				"id": 8,
				"name": ".Docker"
			}
		],
		"c": [
			{
				"id": 7,
				"name": ".NET 6"
			},
			{
				"id": 8,
				"name": ".Docker"
			}
		]
	}
}

Get Platform Commands

  • Request
query{
	platform{
		id
		name
		commands {
			id
			howTo
		}
	}
}
  • Response
{
	"data": {
		"platform": [
			{
				"id": 7,
				"name": ".NET 6",
				"commands": [
					{
						"id": 3,
						"howTo": "Build a project"
					}
				]
			},
			{
				"id": 8,
				"name": ".Docker",
				"commands": [
					{
						"id": 4,
						"howTo": "Start a docker compose file"
					}
				]
			}
		]
	}
}

Filter request

  • Request
query {
	command(where: { platformId: { eq: 7 }}) {
		id
		platform {
			name
		}
		commandLine
		howTo
	}
}
  • Response
{
	"data": {
		"command": [
			{
				"id": 3,
				"platform": {
					"name": ".NET 6"
				},
				"commandLine": "dotnet build",
				"howTo": "Build a project"
			}
		]
	}
}

Sorting request

  • Request
query {
	platform(order: {name: ASC}) {
		name
	}
}
  • Response
{
	"data": {
		"platform": [
			{
				"name": ".Docker"
			},
			{
				"name": ".NET 6"
			}
		]
	}
}

Mutations

Add Platform

  • Request
mutation {
	addPlatform(input: {
		name: "RedHat"
	}) {
		platform {
			name
		}
	}
}
  • Response
{
	"data": {
		"addPlatform": {
			"platform": {
				"name": "RedHat"
			}
		}
	}
}

Add Command

  • Request
mutation {
	addCommnad(input: {
		howTo: "Platform directory listing"
		commandLine: "ls"
		platformId: 7
	}) {
		command {
			howTo
			commandLine
			id
		}
	}
}
  • Response
{
	"data": {
		"addCommnad": {
			"command": {
				"howTo": "Platform directory listing",
				"commandLine": "ls",
				"id": 5
			}
		}
	}
}

Subscriptions

subscription {
  onPlatformAdded {
    id
    name
  }
}
{
  "data": {
    "onPlatformAdded": {
      "id": 13,
      "name": "EF Core"
    }
  }
}

commandergql's People

Contributors

naskovasilev avatar

Watchers

James Cloos 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.