-
Notifications
You must be signed in to change notification settings - Fork 3
/
telegraph.json
608 lines (608 loc) · 20.1 KB
/
telegraph.json
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
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
{
"methods": [
{
"name": "createAccount",
"returns": "Account",
"description": "Use this method to create a new Telegraph account. Most users only need one account, but this can be useful for channel administrators who would like to keep individual author names and profile links for each of their channels. On success, returns an Account object with the regular fields and an additional access_token field.",
"sample_request": "https://api.telegra.ph/createAccount?short_name=Sandbox\u0026author_name=Anonymous",
"parameters": [
{
"name": "short_name",
"data_type": {
"name": "String",
"is_array": false
},
"required": true,
"description": "Required. Account name, helps users with several accounts remember which they are currently using. Displayed to the user above the \"Edit/Publish\" button on Telegra.ph, other users don't see this name."
},
{
"name": "author_name",
"data_type": {
"name": "String",
"is_array": false
},
"required": false,
"description": "Default author name used when creating new articles."
},
{
"name": "author_url",
"data_type": {
"name": "String",
"is_array": false
},
"required": false,
"description": "Default profile link, opened when users click on the author's name below the title. Can be any link, not necessarily to a Telegram profile or channel."
}
]
},
{
"name": "createPage",
"returns": "Page",
"description": "Use this method to create a new Telegraph page. On success, returns a Page object.",
"sample_request": "https://api.telegra.ph/createPage?access_token=d3b25feccb89e508a9114afb82aa421fe2a9712b963b387cc5ad71e58722\u0026title=Sample+Page\u0026author_name=Anonymous\u0026content=[{\"tag\":\"p\",\"children\":[\"Hello,+world!\"]}]\u0026return_content=true",
"parameters": [
{
"name": "access_token",
"data_type": {
"name": "String",
"is_array": false
},
"required": true,
"description": "Required. Access token of the Telegraph account."
},
{
"name": "title",
"data_type": {
"name": "String",
"is_array": false
},
"required": true,
"description": "Required. Page title."
},
{
"name": "author_name",
"data_type": {
"name": "String",
"is_array": false
},
"required": false,
"description": "Author name, displayed below the article's title."
},
{
"name": "author_url",
"data_type": {
"name": "String",
"is_array": false
},
"required": false,
"description": "Profile link, opened when users click on the author's name below the title. Can be any link, not necessarily to a Telegram profile or channel."
},
{
"name": "content",
"data_type": {
"name": "Node",
"is_array": true
},
"required": true,
"description": "Required. Content of the page. "
},
{
"name": "return_content",
"data_type": {
"name": "Boolean",
"is_array": false
},
"required": false,
"description": "If true, a content field will be returned in the Page object (see: Content format)."
}
]
},
{
"name": "editAccountInfo",
"returns": "Account",
"description": "Use this method to update information about a Telegraph account. Pass only the parameters that you want to edit. On success, returns an Account object with the default fields.",
"sample_request": "https://api.telegra.ph/editAccountInfo?access_token=d3b25feccb89e508a9114afb82aa421fe2a9712b963b387cc5ad71e58722\u0026short_name=Sandbox\u0026author_name=Anonymous",
"parameters": [
{
"name": "access_token",
"data_type": {
"name": "String",
"is_array": false
},
"required": true,
"description": "Required. Access token of the Telegraph account."
},
{
"name": "short_name",
"data_type": {
"name": "String",
"is_array": false
},
"required": false,
"description": "New account name."
},
{
"name": "author_name",
"data_type": {
"name": "String",
"is_array": false
},
"required": false,
"description": "New default author name used when creating new articles."
},
{
"name": "author_url",
"data_type": {
"name": "String",
"is_array": false
},
"required": false,
"description": "New default profile link, opened when users click on the author's name below the title. Can be any link, not necessarily to a Telegram profile or channel."
}
]
},
{
"name": "editPage",
"returns": "Page",
"description": "Use this method to edit an existing Telegraph page. On success, returns a Page object.",
"sample_request": "https://api.telegra.ph/editPage/Sample-Page-12-15?access_token=d3b25feccb89e508a9114afb82aa421fe2a9712b963b387cc5ad71e58722\u0026title=Sample+Page\u0026author_name=Anonymous\u0026content=[{\"tag\":\"p\",\"children\":[\"Hello,+world!\"]}]\u0026return_content=true",
"parameters": [
{
"name": "access_token",
"data_type": {
"name": "String",
"is_array": false
},
"required": true,
"description": "Required. Access token of the Telegraph account."
},
{
"name": "path",
"data_type": {
"name": "String",
"is_array": false
},
"required": true,
"description": "Required. Path to the page."
},
{
"name": "title",
"data_type": {
"name": "String",
"is_array": false
},
"required": true,
"description": "Required. Page title."
},
{
"name": "content",
"data_type": {
"name": "Node",
"is_array": true
},
"required": true,
"description": "Required. Content of the page."
},
{
"name": "author_name",
"data_type": {
"name": "String",
"is_array": false
},
"required": false,
"description": "Author name, displayed below the article's title."
},
{
"name": "author_url",
"data_type": {
"name": "String",
"is_array": false
},
"required": false,
"description": "Profile link, opened when users click on the author's name below the title. Can be any link, not necessarily to a Telegram profile or channel."
},
{
"name": "return_content",
"data_type": {
"name": "Boolean",
"is_array": false
},
"required": false,
"description": "If true, a content field will be returned in the Page object."
}
]
},
{
"name": "getAccountInfo",
"returns": "Account",
"description": "Use this method to get information about a Telegraph account. Returns an Account object on success.",
"sample_request": "https://api.telegra.ph/getAccountInfo?access_token=d3b25feccb89e508a9114afb82aa421fe2a9712b963b387cc5ad71e58722\u0026fields=[\"short_name\",\"page_count\"]",
"parameters": [
{
"name": "access_token",
"data_type": {
"name": "String",
"is_array": false
},
"required": true,
"description": "Required. Access token of the Telegraph account."
},
{
"name": "fields",
"data_type": {
"name": "String",
"is_array": true
},
"required": false,
"description": "List of account fields to return. Available fields: short_name, author_name, author_url, auth_url, page_count."
}
]
},
{
"name": "getPage",
"returns": "Page",
"description": "Use this method to get a Telegraph page. Returns a Page object on success.",
"sample_request": "https://api.telegra.ph/getPage/Sample-Page-12-15?return_content=true",
"parameters": [
{
"name": "path",
"data_type": {
"name": "String",
"is_array": false
},
"required": true,
"description": "Required. Path to the Telegraph page (in the format Title-12-31, i.e. everything that comes after http://telegra.ph/)."
},
{
"name": "return_content",
"data_type": {
"name": "Boolean",
"is_array": false
},
"required": false,
"description": "If true, content field will be returned in Page object."
}
]
},
{
"name": "getPageList",
"returns": "PageList",
"description": "Use this method to get a list of pages belonging to a Telegraph account. Returns a PageList object, sorted by most recently created pages first.",
"sample_request": "https://api.telegra.ph/getPageList?access_token=d3b25feccb89e508a9114afb82aa421fe2a9712b963b387cc5ad71e58722\u0026limit=3",
"parameters": [
{
"name": "access_token",
"data_type": {
"name": "String",
"is_array": false
},
"required": true,
"description": "Required. Access token of the Telegraph account."
},
{
"name": "offset",
"data_type": {
"name": "Integer",
"is_array": false
},
"required": false,
"description": "Sequential number of the first page to be returned."
},
{
"name": "limit",
"data_type": {
"name": "Integer",
"is_array": false
},
"required": false,
"description": "Limits the number of pages to be retrieved."
}
]
},
{
"name": "getViews",
"returns": "PageViews",
"description": "Use this method to get the number of views for a Telegraph article. Returns a PageViews object on success. By default, the total number of page views will be returned.",
"sample_request": "https://api.telegra.ph/getViews/Sample-Page-12-15?year=2016\u0026month=12",
"parameters": [
{
"name": "path",
"data_type": {
"name": "String",
"is_array": false
},
"required": true,
"description": "Required. Path to the Telegraph page (in the format Title-12-31, where 12 is the month and 31 the day the article was first published)."
},
{
"name": "year",
"data_type": {
"name": "Integer",
"is_array": false
},
"required": false,
"description": "Required if month is passed. If passed, the number of page views for the requested year will be returned."
},
{
"name": "month",
"data_type": {
"name": "Integer",
"is_array": false
},
"required": false,
"description": "Required if day is passed. If passed, the number of page views for the requested month will be returned."
},
{
"name": "day",
"data_type": {
"name": "Integer",
"is_array": false
},
"required": false,
"description": "Required if hour is passed. If passed, the number of page views for the requested day will be returned."
},
{
"name": "hour",
"data_type": {
"name": "Integer",
"is_array": false
},
"required": false,
"description": "If passed, the number of page views for the requested hour will be returned."
}
]
},
{
"name": "revokeAccessToken",
"returns": "Account",
"description": "Use this method to revoke access_token and generate a new one, for example, if the user would like to reset all connected sessions, or you have reasons to believe the token was compromised. On success, returns an Account object with new access_token and auth_url fields.",
"sample_request": "https://api.telegra.ph/revokeAccessToken?access_token=d3b25feccb89e508a9114afb82aa421fe2a9712b963b387cc5ad71e58722",
"parameters": [
{
"name": "access_token",
"data_type": {
"name": "String",
"is_array": false
},
"required": true,
"description": "Required. Access token of the Telegraph account."
}
]
}
],
"types": [
{
"name": "Account",
"description": "This object represents a Telegraph account. ",
"attributes": [
{
"name": "short_name",
"data_type": {
"name": "String",
"is_array": false
},
"optional": false,
"description": "Account name, helps users with several accounts remember which they are currently using. Displayed to the user above the \"Edit/Publish\" button on Telegra.ph, other users don't see this name."
},
{
"name": "author_name",
"data_type": {
"name": "String",
"is_array": false
},
"optional": false,
"description": "Default author name used when creating new articles."
},
{
"name": "author_url",
"data_type": {
"name": "String",
"is_array": false
},
"optional": false,
"description": "Profile link, opened when users click on the author's name below the title. Can be any link, not necessarily to a Telegram profile or channel."
},
{
"name": "access_token",
"data_type": {
"name": "String",
"is_array": false
},
"optional": true,
"description": "Optional. Only returned by the createAccount and revokeAccessToken method. Access token of the Telegraph account."
},
{
"name": "auth_url",
"data_type": {
"name": "String",
"is_array": false
},
"optional": true,
"description": "Optional. URL to authorize a browser on telegra.ph and connect it to a Telegraph account. This URL is valid for only one use and for 5 minutes only."
},
{
"name": "page_count",
"data_type": {
"name": "Integer",
"is_array": false
},
"optional": true,
"description": "Optional. Number of pages belonging to the Telegraph account."
}
]
},
{
"name": "Node",
"description": "This abstract object represents a DOM Node. It can be a String which represents a DOM text node or a NodeElement object.",
"attributes": []
},
{
"name": "NodeElement",
"description": "This object represents a DOM element node.",
"attributes": [
{
"name": "tag",
"data_type": {
"name": "String",
"is_array": false
},
"optional": false,
"description": "Name of the DOM element. Available tags: a, aside, b, blockquote, br, code, em, figcaption, figure, h3, h4, hr, i, iframe, img, li, ol, p, pre, s, strong, u, ul, video."
},
{
"name": "attrs",
"data_type": {
"name": "Object",
"is_array": false
},
"optional": true,
"description": "Optional. Attributes of the DOM element. Key of object represents name of attribute, value represents value of attribute. Available attributes: href, src."
},
{
"name": "children",
"data_type": {
"name": "Node",
"is_array": true
},
"optional": true,
"description": "Optional. List of child nodes for the DOM element."
}
]
},
{
"name": "Page",
"description": "This object represents a page on Telegraph.",
"attributes": [
{
"name": "path",
"data_type": {
"name": "String",
"is_array": false
},
"optional": false,
"description": "Path to the page."
},
{
"name": "url",
"data_type": {
"name": "String",
"is_array": false
},
"optional": false,
"description": "URL of the page."
},
{
"name": "title",
"data_type": {
"name": "String",
"is_array": false
},
"optional": false,
"description": "Title of the page."
},
{
"name": "description",
"data_type": {
"name": "String",
"is_array": false
},
"optional": false,
"description": "Description of the page."
},
{
"name": "author_name",
"data_type": {
"name": "String",
"is_array": false
},
"optional": true,
"description": "Optional. Name of the author, displayed below the title."
},
{
"name": "author_url",
"data_type": {
"name": "String",
"is_array": false
},
"optional": true,
"description": "Optional. Profile link, opened when users click on the author's name below the title. Can be any link, not necessarily to a Telegram profile or channel."
},
{
"name": "image_url",
"data_type": {
"name": "String",
"is_array": false
},
"optional": true,
"description": "Optional. Image URL of the page."
},
{
"name": "content",
"data_type": {
"name": "Node",
"is_array": true
},
"optional": true,
"description": "Optional. Content of the page."
},
{
"name": "views",
"data_type": {
"name": "Integer",
"is_array": false
},
"optional": false,
"description": "Number of page views for the page."
},
{
"name": "can_edit",
"data_type": {
"name": "Boolean",
"is_array": false
},
"optional": true,
"description": "Optional. Only returned if access_token passed. True, if the target Telegraph account can edit the page."
}
]
},
{
"name": "PageList",
"description": "This object represents a list of Telegraph articles belonging to an account. Most recently created articles first.",
"attributes": [
{
"name": "total_count",
"data_type": {
"name": "Integer",
"is_array": false
},
"optional": false,
"description": "Total number of pages belonging to the target Telegraph account."
},
{
"name": "pages",
"data_type": {
"name": "Page",
"is_array": true
},
"optional": false,
"description": "Requested pages of the target Telegraph account."
}
]
},
{
"name": "PageViews",
"description": "This object represents the number of page views for a Telegraph article.",
"attributes": [
{
"name": "views",
"data_type": {
"name": "Integer",
"is_array": false
},
"optional": false,
"description": "Number of page views for the target page."
}
]
}
]
}