GraphQL API with .NET 6 and Hot Chocolate
- Request
query {
platform {
id
name
}
}
- Response
{
"data": {
"platform": [
{
"id": 7,
"name": ".NET 6"
},
{
"id": 8,
"name": ".Docker"
}
]
}
}
- 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
}
}
]
}
}
- 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"
}
]
}
}
- 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"
}
]
}
]
}
}
- 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"
}
]
}
}
- Request
query {
platform(order: {name: ASC}) {
name
}
}
- Response
{
"data": {
"platform": [
{
"name": ".Docker"
},
{
"name": ".NET 6"
}
]
}
}
- Request
mutation {
addPlatform(input: {
name: "RedHat"
}) {
platform {
name
}
}
}
- Response
{
"data": {
"addPlatform": {
"platform": {
"name": "RedHat"
}
}
}
}
- 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
}
}
}
}
subscription {
onPlatformAdded {
id
name
}
}
{
"data": {
"onPlatformAdded": {
"id": 13,
"name": "EF Core"
}
}
}