Module: ReplTalk::GQL::Queries

Defined in:
lib/repltalk/graphql.rb

Constant Summary collapse

GET_USER =
"
	query userByUsername($username: String!) {
		user: userByUsername(username: $username) {
			#{Fields::USER}
		}
	}
"
GET_USER_BY_ID =
"
	query user($user_id: Int!) {
		user: user(id: $user_id) {
			#{Fields::USER}
		}
	}
"
USER_SEARCH =
"
	query usernameSearch($username: String!, $count: Int) {
		usernameSearch(query: $username, limit: $count) {
			#{Fields::USER}
		}
	}
"
GET_USER_POSTS =
"
	query user($username: String!, $after: String, $order: String, $count: Int) {
		user: userByUsername(username: $username) {
			posts(after: $after, order: $order, count: $count) {
				items {
					#{Fields::POST}
				}
			}
		}
	}
"
GET_USER_COMMENTS =
"
	query user($username: String!, $after: String, $order: String, $count: Int) {
		user: userByUsername(username: $username) {
			comments(after: $after, order: $order, count: $count) {
				items {
					#{Fields::COMMENT}
				}
			}
		}
	}
"
GET_USER_REPLS =
"
	query user($username: String!, $count: Int, $order: String, $direction: String, $before: String, $after: String, $pinnedReplsFirst: Boolean, $showUnnamed: Boolean) {
		user: userByUsername(username: $username) {
			publicRepls(count: $count, order: $order, direction: $direction, before: $before, after: $after, pinnedReplsFirst: $pinnedReplsFirst, showUnnamed: $showUnnamed) {
				items {
					#{Fields::REPL}
				}
			}
		}
	}
"
GET_POST =
"
	query post($id: Int!) {
		post(id: $id) {
			#{Fields::POST}
		}
	}
"
GET_POSTS_COMMENTS =
"
	query post($postId: Int!, $order: String, $count: Int, $after: String) {
		post(id: $postId) {
			comments(order: $order, count: $count, after: $after) {
				items {
					#{Fields::COMMENT}
				}
			}
		}
	}
"
GET_POSTS_UPVOTERS =
"
	query post($id: Int!, $count: Int) {
		post(id: $id) {
			votes(count: $count) {
				items {
					user {
						#{Fields::POST}
					}
				}
			}
		}
	}
"
GET_COMMENT =
"
	query comment ($id: Int!) {
		comment(id: $id) {
			#{Fields::COMMENT}
		}
	}
"
GET_COMMENTS_COMMENTS =
"
	query comment ($id: Int!) {
		comment(id: $id) {
			comments {
				#{Fields::COMMENT}
			}
		}
	}
"
GET_PARENT_COMMENT =
"
	query comment ($id: Int!) {
		comment(id: $id) {
			parentComment {
				#{Fields::COMMENT}
			}
		}
	}
"
GET_REPL =
"
	query ReplView($url: String!) {
		repl(url: $url) {
			... on Repl {
				#{Fields::REPL}
			}
		}
	}
"
GET_REPL_FORKS =
"
	query ReplViewForks($url: String!, $count: Int!, $after: String) {
		repl(url: $url) {
			... on Repl {
				publicForks(count: $count, after: $after) {
					items {
						#{Fields::REPL}
					}
				}
			}
		}
	}
"
GET_REPL_COMMENTS =
"
	query ReplViewComments($url: String!, $count: Int, $after: String) {
		repl(url: $url) {
			... on Repl {
				comments(count: $count, after: $after) {
					items {
						#{Fields::REPL_COMMENT}
						replies {
							#{Fields::REPL_COMMENT}
						}
					}
				}
			}
		}
	}
"
GET_REPL_COMMENT =
"
	query ReplViewComment($id: Int!) {
		replComment(id: $id) {
			... on ReplComment {
					#{Fields::REPL_COMMENT}
			}
		}
	}
"
GET_BOARD =
"
	query boardBySlug($slug: String!) {
		board: boardBySlug(slug: $slug) {
			#{Fields::BOARD}
		}
	}
"
GET_POSTS =
"
	query ReplPostsFeed($options: ReplPostsQueryOptions) {	
		replPosts(options: $options) {		
			items {
				#{Fields::POST}
			}
		}
	}
"
"
	query ExploreFeaturedRepls {
		featuredRepls {
			#{Fields::REPL}
		}
	}
"
GET_TAG =
"
	query ExploreTrendingRepls($tag: String!) {
		tag(id: $tag) {
			#{Fields::TAG}
		}
	}
"
"
	query ExploreFeed($count: Int) {
		trendingTagsFeed(initialTagsCount: $count) {
			initialTags {
				#{Fields::TAG}
			}
		}
	}
"
GET_TAGS_REPLS =
"
	query ExploreTrendingRepls($tag: String!, $count: Int, $after: String) {
		tag(id: $tag) {
			repls(limit: $count, after: $after) {
				items {
					#{Fields::REPL}
				}
			}
		}
	}
"