-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
generics.graphql
186 lines (154 loc) · 3.1 KB
/
generics.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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
schema {
query: Query
mutation: Mutation
}
directive @hasRole(role: Role!) on FIELD_DEFINITION
directive @loggedIn on FIELD_DEFINITION
enum Role {
admin
normal
}
interface Searchable {
summary: String!
}
interface Linkable {
uri: URI!
}
"""
A link is a link I have save on pinboard or a link in a post.
"""
type Link implements Linkable {
id: ID!
title: String!
uri: URI!
created: Time!
description: String!
screenshot: URI!
tags: [String!]!
modified: Time!
}
"""
A stat is a key value pair of two interesting strings.
"""
type Stat {
key: String!
value: Float!
when: Time!
}
"""
A user is a logged in user.
"""
type User {
id: ID!
role: String!
apikey: String!
name: String!
created: Time!
modified: Time!
}
"""
A Tweet is an archived tweet.
"""
type Tweet implements Linkable {
id: ID!
text: String!
hashtags: [String!]!
symbols: [String!]!
user_mentions: [String!]!
urls: [URI!]!
screen_name: String!
favorite_count: Int!
retweet_count: Int!
posted: Time!
uri: URI!
}
type TwitterURL implements Linkable {
link: URI
tweetIDs: [ID!]!
createdAt: Time!
modifiedAt: Time!
tweets: [Tweet]!
uri: URI!
}
"""
A book is a book on Goodreads.
"""
type Book implements Linkable {
id: ID!
uri: URI!
title: String!
}
"""
Time is a datetime scalar with timezone.
"""
scalar Time
"""
Duration is float of seconds that something took.
"""
scalar Duration
"""
A URI is a url or url like thing.
"""
scalar URI
input EditBook {
id: ID,
title: String,
goodreads_id: String!,
}
input NewLink {
title: String!
uri: URI!
description: String!
tags: [String!]!
created: Time
}
input NewStat {
key: String!
value: Float!
}
input NewTweet {
favorite_count: Int!
hashtags: [String!]
id: ID!
posted: Time!
retweet_count: Int!
symbols: [String!]
text: String!
urls: [URI!]
screen_name: String!
user_mentions: [String!]
}
"""
The query type, represents all of the entry points into our object graph.
"""
type Query {
"Returns some books."
books(input: Limit): [Book]!
"Returns a subset of all links ever, in reverse chronological order, using provided limit and offset."
links(input: Limit): [Link]!
"Returns a single link by id or url."
link(id: ID, url: URI): Link
"Returns a number of stats, ordered by most recently updated."
stats(count: Int): [Stat]!
"stat returns the history of a stat."
stat(key: String!, input: Limit): [Stat]!
"Returns counts of entries in the database."
counts: [Stat]!
"If logged in, returns a user."
whoami: User
"Returns tweets in database."
tweets(input: Limit): [Tweet]!
"Returns just one tweet."
tweet(id: ID!): Tweet
"Returns a user's tweets by screen name."
tweetsByScreenName(screen_name: String!, input: Limit): [Tweet]!
homeTimelineURLs(input: Limit): [TwitterURL]!
"The current server time."
time: Time!
}
type Mutation {
upsertBook(input: EditBook!): Book! @hasRole(role: admin)
upsertLink(input: NewLink!): Link! @hasRole(role: admin)
upsertStat(input: NewStat!): Stat! @hasRole(role: admin)
upsertTweet(input: NewTweet!): Tweet! @hasRole(role: admin)
}