-
Notifications
You must be signed in to change notification settings - Fork 22
/
schema.graphql
162 lines (123 loc) · 3.74 KB
/
schema.graphql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# A comment about an entry, submitted by a user
type Comment {
# The SQL ID of this entry
id: Int!
# The GitHub user who posted the comment
postedBy: User!
# A timestamp of when the comment was posted
createdAt: Float!
# The text of the comment
content: String!
# The repository which this comment is about
repoName: String!
}
# Information about a GitHub repository submitted to GitHunt
type Entry {
# Information about the repository from GitHub
repository: Repository!
# The GitHub user who submitted this entry
postedBy: User!
# A timestamp of when the entry was submitted
createdAt: Float!
# The score of this repository, upvotes - downvotes
score: Int!
# The hot score of this repository
hotScore: Float!
# Comments posted about this repository
comments(limit: Int, offset: Int): [Comment]!
# The number of comments posted about this repository
commentCount: Int!
# The SQL ID of this entry
id: Int!
# XXX to be changed
vote: Vote!
}
# A list of options for the sort order of the feed
enum FeedType {
# Sort by a combination of freshness and score, using Reddit's algorithm
HOT
# Newest entries first
NEW
# Highest score entries first
TOP
}
type Mutation {
# Submit a new repository, returns the new submission
submitRepository(
# The full repository name from GitHub, e.g. "apollostack/GitHunt-API"
repoFullName: String!
): Entry
# Vote on a repository submission, returns the submission that was voted on
vote(
# The full repository name from GitHub, e.g. "apollostack/GitHunt-API"
repoFullName: String!
# The type of vote - UP, DOWN, or CANCEL
type: VoteType!
): Entry
# Comment on a repository, returns the new comment
submitComment(
# The full repository name from GitHub, e.g. "apollostack/GitHunt-API"
repoFullName: String!
# The text content for the new comment
commentContent: String!
): Comment
}
type Query {
# A feed of repository submissions
feed(
# The sort order for the feed
type: FeedType!
# The number of items to skip, for pagination
offset: Int
# The number of items to fetch starting from the offset, for pagination
limit: Int
): [Entry]
# A single entry
entry(
# The full repository name from GitHub, e.g. "apollostack/GitHunt-API"
repoFullName: String!
): Entry
# Return the currently logged in user, or null if nobody is logged in
currentUser: User
}
# A repository object from the GitHub API. This uses the exact field names returned by the
# GitHub API for simplicity, even though the convention for GraphQL is usually to camel case.
type Repository {
# Just the name of the repository, e.g. GitHunt-API
name: String!
# The full name of the repository with the username, e.g. apollostack/GitHunt-API
full_name: String!
# The description of the repository
description: String
# The link to the repository on GitHub
html_url: String!
# The number of people who have starred this repository on GitHub
stargazers_count: Int!
# The number of open issues on this repository on GitHub
open_issues_count: Int
# The owner of this repository on GitHub, e.g. apollostack
owner: User
}
type Subscription {
# Subscription fires on every comment added
commentAdded(repoFullName: String!): Comment
}
# A user object from the GitHub API. This uses the exact field names returned from the GitHub API.
type User {
# The name of the user, e.g. apollostack
login: String!
# The URL to a directly embeddable image for this user's avatar
avatar_url: String!
# The URL of this user's GitHub page
html_url: String!
}
# XXX to be removed
type Vote {
vote_value: Int!
}
# The type of vote to record, when submitting a vote
enum VoteType {
UP
DOWN
CANCEL
}