trustfall_stubgen 0.5.0

Generate a Trustfall adapter stub for a given schema.
Documentation
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
schema {
    query: RootSchemaQuery
}
directive @filter(
    """
    Name of the filter operation to perform.
    """
    op: String!
    """
    List of string operands for the operator.
    """
    value: [String!]
) repeatable on FIELD | INLINE_FRAGMENT
directive @tag(
    """
    Name to apply to the given property field.
    """
    name: String
) on FIELD
directive @output(
    """
    What to designate the output field generated from this property field.
    """
    name: String
) on FIELD
directive @optional on FIELD
directive @recurse(
    """
    Recurse up to this many times on this edge. A depth of 1 produces the current
    vertex and its immediate neighbors along the given edge.
    """
    depth: Int!
) on FIELD
directive @fold on FIELD
directive @transform(
    """
    Name of the transformation operation to perform.
    """
    op: String!
) on FIELD

"""
All the possible data types where querying can begin in this API.
"""
type RootSchemaQuery {
    """
    Items on the front page of HackerNews. Equivalent to Top(max: 30).
    """
    FrontPage: [Item!]!

    """
    The top items on HackerNews. Items on the front page are the top 30.

    The `max` parameter can be used to limit queries to the selected number
    of topmost items. Otherwise, queries will continue fetching top items
    as deep as the HackerNews API allows.
    """
    Top(max: Int): [Item!]!

    """
    Latest story submissions on HackerNews.

    The `max` parameter can be used to limit queries to the selected number
    of latest items. Otherwise, queries will continue fetching latest stories
    as deep as the HackerNews API allows.
    """
    Latest(max: Int): [Story!]!

    """
    Best (recent & most highly-rated) story submissions on HackerNews.

    The `max` parameter can be used to limit queries to the selected number
    of latest items. Otherwise, queries will continue fetching stories
    as deep as the HackerNews API allows.
    """
    Best(max: Int): [Story!]!

    """
    Most recent "Ask HN" story submissions.

    The `max` parameter can be used to limit queries to the selected number
    of latest items. Otherwise, queries will continue fetching stories
    as deep as the HackerNews API allows.
    """
    AskHN(max: Int): [Story!]!

    """
    Most recent "Show HN" story submissions.

    The `max` parameter can be used to limit queries to the selected number
    of latest items. Otherwise, queries will continue fetching stories
    as deep as the HackerNews API allows.
    """
    ShowHN(max: Int): [Story!]!

    """
    Most recent Job submissions.

    The `max` parameter can be used to limit queries to the selected number
    of latest items. Otherwise, queries will continue fetching jobs
    as deep as the HackerNews API allows.
    """
    RecentJob(max: Int): [Story!]!

    """
    Look up a user by their username.
    """
    User(name: String!): User

    """
    Look up an item by its ID number.
    """
    Item(id: Int!): Item

    """
    Most-recently updated items, such as stories or job postings.

    The `max` parameter can be used to limit queries to the selected number
    of latest items. Otherwise, queries will continue fetching items
    as deep as the HackerNews API allows.
    """
    UpdatedItem(max: Int): [Item!]!

    """
    Most-recently updated user profiles.

    The `max` parameter can be used to limit queries to the selected number
    of latest items. Otherwise, queries will continue fetching items
    as deep as the HackerNews API allows.
    """
    UpdatedUserProfile(max: Int): [User!]!

    """
    Use HackerNews search to find items (stories, comments, etc.) based on the given query string.

    Items are returned sorted by relevance, then points, then number of comments.

    Search API docs: https://hn.algolia.com/api
    """
    SearchByRelevance(query: String!): [Item!]

    """
    Use HackerNews search to find items (stories, comments, etc.) based on the given query string.

    Items are returned sorted by date, more recent first.

    Search API docs: https://hn.algolia.com/api
    """
    SearchByDate(query: String!): [Item!]
}

"""
One of the kinds of items on HackerNews: a story, job, comment, etc.
"""
interface Item implements Webpage {
    """
    The item's unique identifier.
    """
    id: Int!

    """
    The item's timestamp, as a number in Unix time.
    """
    unixTime: Int!

    """
    The item's URL on HackerNews.
    """
    url: String!
}

"""
A HackerNews job posting linking to the job opening site.
"""
type Job implements Item & Webpage {
    # properties from Item
    """
    The item's unique identifier.
    """
    id: Int!

    """
    The item's timestamp, as a number in Unix time.
    """
    unixTime: Int!

    """
    The item's URL on HackerNews.
    """
    url: String!

    # own properties
    """
    The job posting's title: the one-liner seen on the front page, for example.
    """
    title: String!

    """
    The total number of points this submission has received.
    """
    score: Int!

    """
    The URL this job posting points to.
    """
    submittedUrl: String!

    # edges
    """
    The web page this job posting links to.
    """
    link: Webpage!
}

"""
A story submitted to HackerNews: either a link, or a text submission like Show HN.
"""
type Story implements Item & Webpage {
    # properties from Item
    """
    The item's unique identifier.
    """
    id: Int!

    """
    The item's timestamp, as a number in Unix time.
    """
    unixTime: Int!

    """
    The item's URL on HackerNews.
    """
    url: String!

    # own properties
    """
    The display name of the user that submitted this story.
    """
    byUsername: String!

    """
    The current score of this story submission.
    """
    score: Int!

    """
    For text submissions, contains the submitted text as HTML.
    For link submissions, this field is null.
    """
    textHtml: String

    """
    For text submissions, contains the submitted text as plain text,
    stripped of any HTML tags. For link submissions, this field is null.
    """
    textPlain: String

    """
    The story's title: the one-liner seen on the front page, for example.
    """
    title: String!

    """
    For link submissions, contains the submitted link.
    For text submissions, this field is null.
    """
    submittedUrl: String

    # edges
    """
    The profile of the user that submitted this story.
    """
    byUser: User!

    """
    The top-level comments on this story.
    """
    comment: [Comment!]

    """
    The web pages this story links to, if any.
    For link submissions, this is the submitted link.
    For text submissions, this includes all links in the text.
    """
    link: [Webpage!]
}

"""
A comment submitted, for example, on a HackerNews story or job submission.
"""
type Comment implements Item & Webpage {
    # properties from Item
    """
    The item's unique identifier.
    """
    id: Int!

    """
    The item's timestamp, as a number in Unix time.
    """
    unixTime: Int!

    """
    The item's URL on HackerNews.
    """
    url: String!

    # own properties
    """
    The text contained in the comment, represented as HTML.
    """
    textHtml: String!

    """
    The text contained in the comment, as plain text with HTML tags removed.
    """
    textPlain: String!

    """
    The name of the user that submitted this comment.
    """
    byUsername: String!

    # edges
    """
    The profile of the user that submitted this comment.
    """
    byUser: User!

    """
    The replies to this comment, if any.
    """
    reply: [Comment!]

    """
    Links contained within the comment, if any.
    """
    link: [Webpage!]

    """
    The parent item: for top-level comments, this is the story or job
    where the comment was submitted, and for replies it's the comment
    which is being replied to.
    """
    parent: Item! # either a parent comment or the story being commented on
}

"""
The profile of a HackerNews user.
"""
type User implements Webpage {
    """
    The username of this user.
    """
    id: String!

    """
    The user's accumulated karma points.
    """
    karma: Int!

    """
    The HTML text the user has set in their "About" section, if any.
    """
    aboutHtml: String

    """
    The text the user has set in their "About" section, if any,
    as plain text with HTML tags removed.
    """
    aboutPlain: String

    """
    The timestamp when the user account was created, as a number in Unix time.
    """
    unixCreatedAt: Int!

    """
    The URL of the user's HackerNews profile page.
    """
    url: String!

    # The HackerNews API treats submissions of comments and stories the same way.
    # The way to get only a user's submitted stories is to use this edge then
    # apply a type coercion on the `Item` vertex on edge endpoint:
    # `... on Story`
    """
    All submissions of this user, including all their stories and comments.

    To get a user's submitted stories, apply a type coercion to the edge:
    ```
    submitted {
      ... on Story {
        < query submitted stories here >
      }
    }
    ```
    """
    submitted: [Item!]

    """
    The web pages this user's "about" profile section links to, if any.
    """
    link: [Webpage!]
}

"""
A web page.
"""
interface Webpage {
    """
    The URL of the web page.
    """
    url: String!
}