~sircmpwn/pages.sr.ht

pages.sr.ht/graph/schema.graphqls -rw-r--r-- 3.2 KiB
c724d77aDrew DeVault server.go: defer MultipartForm.RemoveAll() 27 days ago
                                                                                
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
scalar Cursor
scalar Time
scalar Upload

# Used to provide a human-friendly description of an access scope
directive @scopehelp(details: String!) on ENUM_VALUE

enum AccessScope {
  PROFILE @scopehelp(details: "profile information")
  SITES   @scopehelp(details: "registered sites")
  PAGES   @scopehelp(details: "contents of registered sites")
}

enum AccessKind {
  RO @scopehelp(details: "read")
  RW @scopehelp(details: "read and write")
}

# Decorates fields for which access requires a particular OAuth 2.0 scope with
# read or write access.
directive @access(scope: AccessScope!, kind: AccessKind!) on FIELD_DEFINITION

enum Protocol {
  HTTPS
  GEMINI
}

# https://semver.org
type Version {
  major: Int!
  minor: Int!
  patch: Int!
  # If this API version is scheduled for deprecation, this is the date on which
  # it will stop working; or null if this API version is not scheduled for
  # deprecation.
  deprecationDate: Time
}

interface Entity {
  id: Int!
  created: Time!
  updated: Time!
  # The canonical name of this entity. For users, this is their username
  # prefixed with '~'. Additional entity types will be supported in the future.
  canonicalName: String!
}

type User implements Entity {
  id: Int!
  created: Time!
  updated: Time!
  canonicalName: String!
  username: String!
  email: String!
  url: String
  location: String
  bio: String
}

# A published website
type Site {
  id: Int!
  created: Time!
  updated: Time!
  # Domain name the site services
  domain: String!
  # The site protocol
  protocol: Protocol!
  # SHA-256 checksum of the source tarball (uncompressed)
  version: String!
}

# A cursor for enumerating site entries
#
# If there are additional results available, the cursor object may be passed
# back into the same endpoint to retrieve another page. If the cursor is null,
# there are no remaining results to return.
type SiteCursor {
  results: [Site]!
  cursor: Cursor
}

type Query {
  # Returns API version information.
  version: Version!

  # Returns the authenticated user.
  me: User! @access(scope: PROFILE, kind: RO)

  # Returns a list of registered sites on your account.
  sites(cursor: Cursor): SiteCursor! @access(scope: SITES, kind: RO)
}

type Mutation {
  # Publishes a website. If the domain already exists on your account, it is
  # updated to a new version. If the domain already exists under someone else's
  # account, the request is rejected. If the domain does not exist, a new site
  # is created.
  #
  # Every user is given exclusive use over the 'username.srht.site' domain, and
  # it requires no special configuration to use. Users may also bring their own
  # domain name, in which case they should consult the configuration docs:
  #
  # https://man.sr.ht/pages.sr.ht
  #
  # 'content' must be a .tar.gz file. It must contain only directories and
  # regular files of mode 644. Symlinks are not supported. No error is returned
  # for an invalid tarball; the invalid data is simply discarded.
  #
  # If protocol is unset, HTTPS is presumed.
  publish(domain: String!, content: Upload!,
    protocol: Protocol): Site! @access(scope: PAGES, kind: RW)

  # Deletes a previously published website.
  #
  # If protocol is unset, HTTPS is presumed.
  unpublish(domain: String!, protocol: Protocol): Site @access(scope: SITES, kind: RW)
}