Debian Codegraph @

srht/hubsrht/schema.graphqls

raw
1 # This schema definition is available in the public domain, or under the terms
2 # of CC-0, at your choice.
3
4 scalar Cursor
5
6 "String of the format %Y-%m-%dT%H:%M:%SZ"
7 scalar Time
8
9 """
10 A file uploaded alongside the GraphQL request. This API is compatible with the
11 multipart request specification for requests that include uploads:
12
13 https://github.com/jaydenseric/graphql-multipart-request-spec
14 """
15 scalar Upload
16
17 "Used to provide a human-friendly description of an access scope"
18 directive @scopehelp(details: String!) on ENUM_VALUE
19
20 """
21 This is used to decorate fields which are for internal use, and are not
22 available to normal API users.
23 """
24 directive @internal on FIELD_DEFINITION
25
26 enum AccessScope {
27 PROFILE @scopehelp(details: "profile information")
28 PROJECTS @scopehelp(details: "projects")
29 LISTS @scopehelp(details: "mailing lists")
30 SOURCES @scopehelp(details: "source repositories")
31 TRACKERS @scopehelp(details: "trackers")
32 }
33
34 enum AccessKind {
35 RO @scopehelp(details: "read")
36 RW @scopehelp(details: "read and write")
37 }
38
39 """
40 Decorates fields for which access requires a particular OAuth 2.0 scope with
41 read or write access.
42 """
43 directive @access(scope: AccessScope!, kind: AccessKind!) on FIELD_DEFINITION
44
45 # https://semver.org
46 type Version {
47 major: Int!
48 minor: Int!
49 patch: Int!
50 buildVersion: String!
51 buildDate: String!
52 """
53 If this API version is scheduled for deprecation, this is the date on which
54 it will stop working; or null if this API version is not scheduled for
55 deprecation.
56 """
57 deprecationDate: Time
58
59 "Optional features"
60 features: Features!
61 }
62
63 "Describes the status of optional features"
64 type Features {
65 lists: Boolean!
66 git: Boolean!
67 hg: Boolean!
68 todo: Boolean!
69 }
70
71 interface Entity {
72 canonicalName: String!
73 }
74
75 enum Visibility {
76 PUBLIC
77 UNLISTED
78 PRIVATE
79 }
80
81 enum RepoType {
82 GIT
83 HG
84 }
85
86 type User implements Entity {
87 id: Int!
88 canonicalName: String!
89 username: String!
90
91 project(name: String!): Project @access(scope: PROJECTS, kind: RO)
92 projects(cursor: Cursor): ProjectCursor! @access(scope: PROJECTS, kind: RO)
93 }
94
95 type Project {
96 rid: ID!
97 created: Time!
98 updated: Time!
99 owner: Entity! @access(scope: PROFILE, kind: RO)
100 name: String!
101 description: String
102 website: String
103 visibility: Visibility!
104 checklistComplete: Boolean!
105 tags: [String!]!
106
107 mailingLists(cursor: Cursor): MailingListCursor! @access(scope: LISTS, kind: RO)
108 sources(cursor: Cursor): SourceRepoCursor! @access(scope: SOURCES, kind: RO)
109 trackers(cursor: Cursor): TrackerCursor! @access(scope: TRACKERS, kind: RO)
110
111 resource(rid: ID!): ProjectResource @access(scope: LISTS, kind: RO)
112 mailingList(name: String!): MailingList @access(scope: LISTS, kind: RO)
113 source(name: String!): SourceRepo @access(scope: SOURCES, kind: RO)
114 tracker(name: String!): Tracker @access(scope: TRACKERS, kind: RO)
115 }
116
117 type ProjectCursor {
118 results: [Project!]!
119 cursor: Cursor
120 }
121
122 interface ProjectResource {
123 rid: ID!
124 linked: Time!
125 updated: Time!
126 owner: Entity! @access(scope: PROFILE, kind: RO)
127 name: String!
128 description: String
129 visibility: Visibility!
130 }
131
132 type MailingList implements ProjectResource {
133 rid: ID!
134 linked: Time!
135 updated: Time!
136 owner: Entity! @access(scope: PROFILE, kind: RO)
137 name: String!
138 description: String
139 visibility: Visibility!
140 }
141
142 type MailingListCursor {
143 results: [MailingList!]!
144 cursor: Cursor
145 }
146
147 type SourceRepo implements ProjectResource {
148 rid: ID!
149 linked: Time!
150 updated: Time!
151 owner: Entity! @access(scope: PROFILE, kind: RO)
152 name: String!
153 description: String
154 repoType: RepoType!
155 visibility: Visibility!
156 }
157
158 type SourceRepoCursor {
159 results: [SourceRepo!]!
160 cursor: Cursor
161 }
162
163 type Tracker implements ProjectResource {
164 rid: ID!
165 linked: Time!
166 updated: Time!
167 owner: Entity! @access(scope: PROFILE, kind: RO)
168 name: String!
169 description: String
170 visibility: Visibility!
171 }
172
173 type TrackerCursor {
174 results: [Tracker!]!
175 cursor: Cursor
176 }
177
178 type Query {
179 "Returns API version information."
180 version: Version!
181
182 "Returns the authenticated user"
183 me: User! @access(scope: PROFILE, kind: RO)
184
185 "Looks up a specific user"
186 user(username: String!): User @access(scope: PROFILE, kind: RO)
187
188 "Looks up a specific project"
189 project(rid: ID!): Project @access(scope: PROJECTS, kind: RO)
190
191 "Looks up a specific resource"
192 resource(rid: ID!): ProjectResource @access(scope: PROJECTS, kind: RO)
193
194 "Looks up a specific mailing list"
195 mailingList(rid: ID!): MailingList @access(scope: LISTS, kind: RO)
196
197 "Looks up a specific source repository"
198 source(rid: ID!): SourceRepo @access(scope: SOURCES, kind: RO)
199
200 "Looks up a specific tracker"
201 tracker(rid: ID!): Tracker @access(scope: TRACKERS, kind: RO)
202 }
203
204 type Mutation {
205 """
206 Deletes the authenticated user's account. Internal use only.
207 """
208 deleteUser: Int! @internal
209 }