instruction stringlengths 56 120 | input stringclasses 1
value | output stringlengths 58 279 |
|---|---|---|
Write a GraphQL query to fetch a user's name, email, and address by their user ID. | query GetUser($userId: ID!) {
user(id: $userId) {
name
email
address {
street
city
state
zip
}
}
} | |
Generate a GraphQL mutation to update a product's name and price using the product ID. | mutation UpdateProduct($productId: ID!, $name: String!, $price: Float!) {
updateProduct(id: $productId, input: { name: $name, price: $price }) {
id
name
price
}
} | |
Write a GraphQL query to retrieve the titles of all books published after a specific year. | query GetBooksAfterYear($year: Int!) {
books(where: { publishedAfter: $year }) {
title
}
} | |
Create a GraphQL mutation to delete a user account by ID, returning the deleted user's ID and name. | mutation DeleteUser($userId: ID!) {
deleteUser(id: $userId) {
id
name
}
} | |
Write a query to fetch all posts along with their author names and comment counts. | query GetPosts {
posts {
title
author {
name
}
comments {
count
}
}
} | |
Generate a GraphQL mutation to add a new event with fields for title, date, and location. | mutation AddEvent($title: String!, $date: String!, $location: String!) {
addEvent(input: { title: $title, date: $date, location: $location }) {
id
title
date
location
}
} | |
Write a GraphQL query to get the details of an order by ID, including items and total price. | query GetOrder($orderId: ID!) {
order(id: $orderId) {
id
items {
product {
name
price
}
quantity
}
totalPrice
}
} | |
Create a GraphQL mutation to update the status of an order by its ID. | mutation UpdateOrderStatus($orderId: ID!, $status: String!) {
updateOrder(id: $orderId, input: { status: $status }) {
id
status
}
} | |
Write a GraphQL query to get a list of all users including their ID, name, and email. | query GetAllUsers {
users {
id
name
email
}
} | |
Generate a mutation to add a new product with fields for name, description, and price. | mutation AddProduct($name: String!, $description: String!, $price: Float!) {
addProduct(input: { name: $name, description: $description, price: $price }) {
id
name
description
price
}
} | |
Write a query to fetch details of a specific category by its ID. | query GetCategory($categoryId: ID!) {
category(id: $categoryId) {
id
name
description
}
} | |
Create a query to list all comments on a post by post ID, including commenter name and comment text. | query GetCommentsByPost($postId: ID!) {
post(id: $postId) {
comments {
commenter {
name
}
text
}
}
} | |
Generate a mutation to update a user's email by their ID. | mutation UpdateUserEmail($userId: ID!, $email: String!) {
updateUser(id: $userId, input: { email: $email }) {
id
email
}
} | |
Write a query to retrieve all products with their name and price, filtered by category. | query GetProductsByCategory($category: String!) {
products(where: { category: $category }) {
name
price
}
} | |
Create a mutation to delete a product by its ID and return the product's name. | mutation DeleteProduct($productId: ID!) {
deleteProduct(id: $productId) {
name
}
} | |
Write a query to get the order history of a user by user ID. | query GetOrderHistory($userId: ID!) {
user(id: $userId) {
orders {
id
total
date
}
}
} | |
Generate a mutation to create a new blog post with fields for title, content, and tags. | mutation CreatePost($title: String!, $content: String!, $tags: [String!]) {
createPost(input: { title: $title, content: $content, tags: $tags }) {
id
title
content
tags
}
} | |
Write a GraphQL query to fetch all categories available in the product catalog. | query GetCategories {
categories {
id
name
}
} | |
Create a mutation to add a new user with fields for name, email, and password. | mutation AddUser($name: String!, $email: String!, $password: String!) {
addUser(input: { name: $name, email: $email, password: $password }) {
id
name
email
}
} | |
Write a query to retrieve a list of users along with the number of posts each user has made. | query GetUserPostCounts {
users {
name
postCount
}
} | |
Generate a mutation to change the status of an order by its ID. | mutation ChangeOrderStatus($orderId: ID!, $status: String!) {
updateOrderStatus(id: $orderId, status: $status) {
id
status
}
} | |
Write a query to get the latest posts including title, date, and author name. | query GetLatestPosts {
posts(orderBy: { date: desc }, limit: 5) {
title
date
author {
name
}
}
} | |
Create a query to fetch product details including related products by product ID. | query GetProductWithRelated($productId: ID!) {
product(id: $productId) {
name
price
relatedProducts {
name
price
}
}
} | |
Generate a mutation to add a review to a product by product ID, with rating and comment fields. | mutation AddReview($productId: ID!, $rating: Int!, $comment: String!) {
addReview(productId: $productId, input: { rating: $rating, comment: $comment }) {
id
rating
comment
}
} | |
Write a query to list all employees in a department by department ID. | query GetEmployeesByDepartment($departmentId: ID!) {
department(id: $departmentId) {
employees {
id
name
position
}
}
} | |
Generate a mutation to update the stock quantity of a product by product ID. | mutation UpdateProductStock($productId: ID!, $stock: Int!) {
updateProduct(id: $productId, input: { stock: $stock }) {
id
stock
}
} | |
Write a query to retrieve a user's profile, including their bio and profile picture. | query GetUserProfile($userId: ID!) {
user(id: $userId) {
bio
profilePicture
}
} | |
Create a mutation to send a message from one user to another, with fields for sender ID, recipient ID, and message text. | mutation SendMessage($senderId: ID!, $recipientId: ID!, $message: String!) {
sendMessage(input: { senderId: $senderId, recipientId: $recipientId, message: $message }) {
id
message
timestamp
}
} | |
Write a query to get all messages between two users, ordered by date. | query GetMessagesBetweenUsers($userId1: ID!, $userId2: ID!) {
messagesBetween(user1: $userId1, user2: $userId2, orderBy: { date: asc }) {
id
sender {
name
}
content
date
}
} | |
Generate a mutation to mark a message as read by its ID. | mutation MarkMessageRead($messageId: ID!) {
markMessageAsRead(id: $messageId) {
id
readStatus
}
} | |
Write a query to fetch the details of a product along with its reviews, including review author and rating. | query GetProductReviews($productId: ID!) {
product(id: $productId) {
name
reviews {
author {
name
}
rating
comment
}
}
} | |
Create a mutation to add an address to a user's profile with fields for street, city, state, and zip. | mutation AddAddress($userId: ID!, $street: String!, $city: String!, $state: String!, $zip: String!) {
addAddress(userId: $userId, input: { street: $street, city: $city, state: $state, zip: $zip }) {
id
address {
street
city
state
zip
}
}
} | |
Write a query to get the details of all events, including their title, date, and location. | query GetAllEvents {
events {
title
date
location
}
} | |
Generate a mutation to update a user's password by their ID. | mutation UpdateUserPassword($userId: ID!, $password: String!) {
updateUser(id: $userId, input: { password: $password }) {
id
password
}
} | |
Write a query to fetch all books in a specific genre by genre name. | query GetBooksByGenre($genre: String!) {
books(where: { genre: $genre }) {
title
author
}
} | |
Create a mutation to add a new category with fields for name and description. | mutation AddCategory($name: String!, $description: String!) {
addCategory(input: { name: $name, description: $description }) {
id
name
description
}
} | |
Write a query to get the contact details of all users, including their phone number and email. | query GetUserContacts {
users {
id
phone
email
}
} | |
Generate a mutation to archive a post by post ID, returning the post's ID and title. | mutation ArchivePost($postId: ID!) {
archivePost(id: $postId) {
id
title
}
} | |
Write a query to retrieve a list of all comments made by a specific user by their user ID. | query GetUserComments($userId: ID!) {
user(id: $userId) {
comments {
id
text
date
}
}
} | |
Create a mutation to add a product to a user's cart with product ID and quantity. | mutation AddProductToCart($userId: ID!, $productId: ID!, $quantity: Int!) {
addToCart(userId: $userId, input: { productId: $productId, quantity: $quantity }) {
id
cartItems {
product {
name
}
quantity
}
}
} | |
Write a query to fetch all available discounts, including discount codes and expiration dates. | query GetDiscounts {
discounts {
code
expirationDate
discountValue
}
} | |
Generate a mutation to update a post's tags by post ID, allowing an array of tags to be passed. | mutation UpdatePostTags($postId: ID!, $tags: [String!]) {
updatePost(id: $postId, input: { tags: $tags }) {
id
tags
}
} | |
Write a query to retrieve the names and genres of all movies directed by a specific director by director name. | query GetMoviesByDirector($directorName: String!) {
movies(where: { director: $directorName }) {
title
genre
}
} | |
Create a mutation to mark a notification as read by its notification ID, returning the notification ID and status. | mutation MarkNotificationRead($notificationId: ID!) {
markNotificationAsRead(id: $notificationId) {
id
status
}
} | |
Write a query to get all followers of a user by their user ID, including follower names and profile pictures. | query GetFollowers($userId: ID!) {
user(id: $userId) {
followers {
name
profilePicture
}
}
} | |
Generate a mutation to update the shipping address of an order by order ID. | mutation UpdateOrderShippingAddress($orderId: ID!, $address: AddressInput!) {
updateOrder(id: $orderId, input: { shippingAddress: $address }) {
id
shippingAddress {
street
city
zip
}
}
} | |
Write a query to fetch a user's favorite products by user ID. | query GetFavoriteProducts($userId: ID!) {
user(id: $userId) {
favorites {
product {
name
price
}
}
}
} | |
Create a mutation to unsubscribe a user from a mailing list by user ID. | mutation UnsubscribeUser($userId: ID!) {
unsubscribe(userId: $userId) {
success
message
}
} | |
Write a query to retrieve the latest 10 transactions of a user by user ID. | query GetUserTransactions($userId: ID!) {
user(id: $userId) {
transactions(limit: 10, orderBy: { date: desc }) {
id
amount
date
}
}
} | |
Generate a mutation to add a product to the wishlist by user ID and product ID. | mutation AddToWishlist($userId: ID!, $productId: ID!) {
addToWishlist(userId: $userId, productId: $productId) {
id
wishlistItems {
product {
name
}
}
}
} | |
Write a query to fetch a detailed report of an order by order ID, including product names, quantities, and prices. | query GetOrderReport($orderId: ID!) {
order(id: $orderId) {
products {
name
quantity
price
}
total
}
} | |
Create a mutation to reset a user's password by their email, sending a reset link. | mutation ResetPassword($email: String!) {
requestPasswordReset(email: $email) {
success
message
}
} |
No dataset card yet
- Downloads last month
- 19