78 lines
		
	
	
		
			863 B
		
	
	
	
		
			GraphQL
		
	
	
	
	
	
			
		
		
	
	
			78 lines
		
	
	
		
			863 B
		
	
	
	
		
			GraphQL
		
	
	
	
	
	
# you first have to add a user to create todos
 | 
						|
 | 
						|
query getUser {
 | 
						|
	user(id: 1) {
 | 
						|
		id
 | 
						|
		userName
 | 
						|
		fullName
 | 
						|
		todos {
 | 
						|
			id
 | 
						|
			text
 | 
						|
			done
 | 
						|
		}
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
query getTodo {
 | 
						|
	todo(id: 1) {
 | 
						|
		id
 | 
						|
		text
 | 
						|
		done
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
query getTodos {
 | 
						|
	todos {
 | 
						|
		id
 | 
						|
		text
 | 
						|
		done
 | 
						|
		user {
 | 
						|
			id
 | 
						|
			userName
 | 
						|
			fullName
 | 
						|
			todos {
 | 
						|
				id # you could continue this
 | 
						|
			}
 | 
						|
		}
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
query getUsers {
 | 
						|
	users {
 | 
						|
		id
 | 
						|
		userName
 | 
						|
		fullName
 | 
						|
		todos {
 | 
						|
			id # ...and this too
 | 
						|
		}
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
mutation createTodo {
 | 
						|
	createTodo(input: { userId: 2, text: "adding a router and CSRF header" }) {
 | 
						|
		id
 | 
						|
		text
 | 
						|
		done
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
mutation updateTodo {
 | 
						|
	updateTodo(id: 1, changes: { done: true }) {
 | 
						|
		id
 | 
						|
		text
 | 
						|
		done
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
mutation createUser {
 | 
						|
	createUser(input: { userName: "1234Lorem", fullName: "Lorem I." }) {
 | 
						|
		id
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
mutation updateUser {
 | 
						|
	updateUser(id: "1", changes: { fullName: "Lorem Ipsum" }) {
 | 
						|
		fullName
 | 
						|
	}
 | 
						|
}
 |