This document contains the operations that can be performed on the GraphQL API.
Query operations are used to fetch data from the server.
- By directly passing the Argument (userId)
query getAContributor {
getAContributor(userId: "1") {
userId
githubUsername
name
email
contributions {
contributionId
projectName
type
date
}
}
}
- By passing the Argument (userId) as a variable.
= "1"
is the default value.
query getContributor($userId: String! = "1") {
getContributor(userId: $userId) {
userId
githubUsername
name
email
contributions {
contributionId
projectName
type
date
}
}
}
{
"userId": "1"
}
query getAllContributors {
getAllContributors {
userId
githubUsername
name
email
contributions {
contributionId
projectName
type
date
}
}
}
Mutation operations are used to modify data on the server.
mutation addAContributor {
addAContributor(
input: {
githubUsername: "Pradumnasaraf"
name: "Pradumna Saraf"
email: "[email protected]"
}
) {
userId
githubUsername
name
email
}
}
mutation addContributor_contributions {
addAContributor(
input: {
githubUsername: "Pradumnasaraf"
name: "Pradumna Saraf"
email: "[email protected]"
contributions: {
projectName: "Pradumnasaraf/DevOps"
type: "code"
date: "2023"
}
}
) {
userId
githubUsername
name
email
contributions {
contributionId
projectName
type
date
}
}
}
mutation updateAConbributor {
updateAContributor(
userId: "UPradumnasaraf"
input: {
name: "Pradumna Saraf"
email: "[email protected]"
githubUsername: "Pradumnasaraf"
}
) {
userId
githubUsername
name
email
}
}
mutation DeleteAContributor {
deleteAContributor(userId: "UPradumnasaraf") {
userId
}
}
mutation addAcontributions {
addAContribution(
userId: "UPradumnasaraf"
input: { projectName: "UPradumnasaraf/DevOps", type: "code", date: "2023" }
) {
contributionId
}
}
mutation deleteContribution {
deleteAContribution(userId: "UPradumnasaraf", contributionId: "CPradumnasaraf/DevOps") {
contributionId
}
}