Debian Codegraph @

srht/pagessrht/schema.graphqls

raw
1 scalar Cursor
2 scalar Time
3 scalar Upload
4
5 "Used to provide a human-friendly description of an access scope"
6 directive @scopehelp(details: String!) on ENUM_VALUE
7
8 """
9 This is used to decorate fields which are only accessible with a personal
10 access token, and are not available to clients using OAuth 2.0 access tokens.
11 """
12 directive @private on FIELD_DEFINITION
13
14 """
15 This is used to decorate fields which are for internal use, and are not
16 available to normal API users.
17 """
18 directive @internal on FIELD_DEFINITION
19
20 enum AccessScope {
21 PROFILE @scopehelp(details: "profile information")
22 SITES @scopehelp(details: "registered sites")
23 PAGES @scopehelp(details: "contents of registered sites")
24 ACLS @scopehelp(details: "access control lists")
25 }
26
27 enum AccessKind {
28 RO @scopehelp(details: "read")
29 RW @scopehelp(details: "read and write")
30 }
31
32 """
33 Decorates fields for which access requires a particular OAuth 0.0 scope with
34 read or write access.
35 """
36 directive @access(scope: AccessScope!, kind: AccessKind!) on FIELD_DEFINITION
37
38 enum Protocol {
39 HTTPS
40 GEMINI
41 }
42
43 # https://semver.org
44 type Version {
45 major: Int!
46 minor: Int!
47 patch: Int!
48 """
49 If this API version is scheduled for deprecation, this is the date on which
50 it will stop working; or null if this API version is not scheduled for
51 deprecation.
52 """
53 deprecationDate: Time
54 }
55
56 interface Entity {
57 id: Int!
58 created: Time!
59 updated: Time!
60 """
61 The canonical name of this entity. For users, this is their username
62 prefixed with '~'. Additional entity types will be supported in the future.
63 """
64 canonicalName: String!
65 }
66
67 type User implements Entity {
68 id: Int!
69 created: Time!
70 updated: Time!
71 canonicalName: String!
72 username: String!
73 email: String!
74 url: String
75 location: String
76 bio: String
77 }
78
79 "A published website"
80 type Site {
81 id: Int!
82 created: Time!
83 updated: Time!
84 "Domain name the site services"
85 domain: String!
86 "The site protocol"
87 protocol: Protocol!
88 "SHA-256 checksum of the source tarball (uncompressed)"
89 version: String!
90 "Path to the file to serve for 404 Not Found responses"
91 notFound: String
92
93 # Only available to the site owner
94 acls(cursor: Cursor): SiteACLCursor! @access(scope: ACLS, kind: RO)
95 }
96
97 """
98 A cursor for enumerating site entries
99
100 If there are additional results available, the cursor object may be passed
101 back into the same endpoint to retrieve another page. If the cursor is null,
102 there are no remaining results to return.
103 """
104 type SiteCursor {
105 results: [Site!]!
106 cursor: Cursor
107 }
108
109 """
110 Options for a file being served.
111 """
112 input FileOptions {
113 "Value of the Cache-Control header to be used when serving the file."
114 cacheControl: String
115 }
116
117 """
118 Provides a way to configure options for a set of files matching the glob
119 pattern.
120 """
121 input FileConfig {
122 glob: String!
123 options: FileOptions!
124 }
125
126 input SiteConfig {
127 "Path to the file to serve for 404 Not Found responses"
128 notFound: String
129 fileConfigs: [FileConfig!]
130 }
131
132 type OAuthClient {
133 uuid: String!
134 }
135
136 """
137 An access control list item.
138 """
139 interface ACL {
140 "Permission to publish this site"
141 publish: Boolean!
142 }
143
144 """
145 These ACLs are configured for specific sites, and may be used to expand or
146 constrain the rights of a participant.
147 """
148 type SiteACL implements ACL {
149 id: Int!
150 created: Time!
151 site: Site! @access(scope: SITES, kind: RO)
152 entity: Entity! @access(scope: PROFILE, kind: RO)
153
154 publish: Boolean!
155 }
156
157 """
158 A cursor for enumerating access control list entries
159
160 If there are additional results available, the cursor object may be passed
161 back into the same endpoint to retrieve another page. If the cursor is null,
162 there are no remaining results to return.
163 """
164 type SiteACLCursor {
165 results: [SiteACL!]!
166 cursor: Cursor
167 }
168
169 enum WebhookEvent {
170 SITE_PUBLISHED
171 SITE_UNPUBLISHED
172 }
173
174 interface WebhookSubscription {
175 id: Int!
176 events: [WebhookEvent!]!
177 query: String!
178 url: String!
179
180 """
181 If this webhook was registered by an authorized OAuth 2.0 client, this
182 field is non-null.
183 """
184 client: OAuthClient @private
185
186 "All deliveries which have been sent to this webhook."
187 deliveries(cursor: Cursor): WebhookDeliveryCursor!
188
189 "Returns a sample payload for this subscription, for testing purposes"
190 sample(event: WebhookEvent!): String!
191 }
192
193 type UserWebhookSubscription implements WebhookSubscription {
194 id: Int!
195 events: [WebhookEvent!]!
196 query: String!
197 url: String!
198 client: OAuthClient @private
199 deliveries(cursor: Cursor): WebhookDeliveryCursor!
200 sample(event: WebhookEvent!): String!
201 }
202
203 type WebhookDelivery {
204 uuid: String!
205 date: Time!
206 event: WebhookEvent!
207 subscription: WebhookSubscription!
208 requestBody: String!
209
210 """
211 These details are provided only after a response is received from the
212 remote server. If a response is sent whose Content-Type is not text/*, or
213 cannot be decoded as UTF-8, the response body will be null. It will be
214 truncated after 64 KiB.
215 """
216 responseBody: String
217 responseHeaders: String
218 responseStatus: Int
219 }
220
221 interface WebhookPayload {
222 uuid: String!
223 event: WebhookEvent!
224 date: Time!
225 }
226
227 type SiteEvent implements WebhookPayload {
228 uuid: String!
229 event: WebhookEvent!
230 date: Time!
231
232 site: Site!
233 }
234
235 """
236 A cursor for enumerating a list of webhook deliveries
237
238 If there are additional results available, the cursor object may be passed
239 back into the same endpoint to retrieve another page. If the cursor is null,
240 there are no remaining results to return.
241 """
242 type WebhookDeliveryCursor {
243 results: [WebhookDelivery!]!
244 cursor: Cursor
245 }
246
247 """
248 A cursor for enumerating a list of webhook subscriptions
249
250 If there are additional results available, the cursor object may be passed
251 back into the same endpoint to retrieve another page. If the cursor is null,
252 there are no remaining results to return.
253 """
254 type WebhookSubscriptionCursor {
255 results: [WebhookSubscription!]!
256 cursor: Cursor
257 }
258
259 type Query {
260 "Returns API version information."
261 version: Version!
262
263 "Returns the authenticated user."
264 me: User! @access(scope: PROFILE, kind: RO)
265
266 "Returns a specific user."
267 user(username: String!): User @access(scope: PROFILE, kind: RO)
268
269 """
270 Returns a specific site registered on your account.
271
272 Protocol defaults to HTTPS.
273 """
274 site(domain: String!, protocol: Protocol): Site! @access(scope: SITES, kind: RO)
275
276 "Returns a list of registered sites on your account."
277 sites(cursor: Cursor): SiteCursor! @access(scope: SITES, kind: RO)
278
279 """
280 Returns a list of user webhook subscriptions. For clients
281 authenticated with a personal access token, this returns all webhooks
282 configured by all GraphQL clients for your account. For clients
283 authenticated with an OAuth 2.0 access token, this returns only webhooks
284 registered for your client.
285 """
286 userWebhooks(cursor: Cursor): WebhookSubscriptionCursor!
287
288 "Returns details of a user webhook subscription by its ID."
289 userWebhook(id: Int!): WebhookSubscription
290
291 """
292 Returns information about the webhook currently being processed. This is
293 not valid during normal queries over HTTP, and will return an error if used
294 outside of a webhook context.
295 """
296 webhook: WebhookPayload!
297 }
298
299 input UserWebhookInput {
300 url: String!
301 events: [WebhookEvent!]!
302 query: String!
303 }
304
305 input ACLInput {
306 "Permission to publish the site"
307 publish: Boolean!
308 }
309
310 type Mutation {
311 """
312 Publishes a website. If the domain already exists on your account, it is
313 updated to a new version. If the domain already exists under someone else's
314 account, the request is rejected. If the domain does not exist, a new site
315 is created.
316
317 Every user is given exclusive use over the 'username.srht.site' domain, and
318 it requires no special configuration to use. Users may also bring their own
319 domain name, in which case they should consult the configuration docs:
320
321 https://man.sr.ht/pages.sr.ht
322
323 'content' must be a .tar.gz file. It must contain only directories and
324 regular files of mode 644. Symlinks are not supported. No error is returned
325 for an invalid tarball; the invalid data is simply discarded.
326
327 If protocol is unset, HTTPS is presumed.
328
329 If subdirectory is set, only the specified directory is updated. The rest
330 of the files are unchanged.
331 """
332 publish(domain: String!, content: Upload!, protocol: Protocol,
333 subdirectory: String, siteConfig: SiteConfig): Site! @access(scope: PAGES, kind: RW)
334
335 """
336 Deletes a previously published website.
337
338 If protocol is unset, HTTPS is presumed.
339 """
340 unpublish(domain: String!, protocol: Protocol): Site @access(scope: SITES, kind: RW)
341
342 "Adds or updates the ACL for a specific user on a site"
343 updateSiteACL(
344 siteId: Int!,
345 userId: Int!,
346 input: ACLInput!): SiteACL! @access(scope: ACLS, kind: RW)
347
348 """
349 Removes a site ACL. Following this change, the default site ACL will
350 apply to this user, which currently means "no access".
351 """
352 deleteSiteACL(id: Int!): SiteACL! @access(scope: ACLS, kind: RW)
353
354 """
355 Creates a new user webhook subscription. When an event from the
356 provided list of events occurs, the 'query' parameter (a GraphQL query)
357 will be evaluated and the results will be sent to the provided URL as the
358 body of an HTTP POST request. The list of events must include at least one
359 event, and no duplicates.
360
361 This query is evaluated in the webhook context, such that query { webhook }
362 may be used to access details of the event which trigged the webhook. The
363 query may not make any mutations.
364 """
365 createUserWebhook(config: UserWebhookInput!): WebhookSubscription!
366
367 """
368 Deletes a user webhook. Any events already queued may still be
369 delivered after this request completes. Clients authenticated with a
370 personal access token may delete any webhook registered for their account,
371 but authorized OAuth 2.0 clients may only delete their own webhooks.
372 Manually deleting a webhook configured by a third-party client may cause
373 unexpected behavior with the third-party integration.
374 """
375 deleteUserWebhook(id: Int!): WebhookSubscription!
376
377 """
378 Deletes the authenticated user's account. Internal use only.
379 """
380 deleteUser: Int! @internal
381 }