forked from google/go-github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactivity-events_test.go
More file actions
6264 lines (4822 loc) · 307 KB
/
activity-events_test.go
File metadata and controls
6264 lines (4822 loc) · 307 KB
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
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2020 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"testing"
)
func newActivitiesEventsPipeline() *pipelineSetup {
return &pipelineSetup{
baseURL: "https://docs.github.com/en/free-pro-team@latest/rest/reference/activity/events/",
endpointsFromWebsite: activityEventsWant,
filename: "activity_events.go",
serviceName: "ActivityService",
originalGoSource: activityEventsGoFileOriginal,
wantGoSource: activityEventsGoFileWant,
wantNumEndpoints: 7,
}
}
func TestPipeline_ActivityEvents(t *testing.T) {
ps := newActivitiesEventsPipeline()
ps.setup(t, false, false)
ps.validate(t)
}
func TestPipeline_ActivityEvents_FirstStripAllURLs(t *testing.T) {
ps := newActivitiesEventsPipeline()
ps.setup(t, true, false)
ps.validate(t)
}
func TestPipeline_ActivityEvents_FirstDestroyReceivers(t *testing.T) {
ps := newActivitiesEventsPipeline()
ps.setup(t, false, true)
ps.validate(t)
}
func TestPipeline_ActivityEvents_FirstStripAllURLsAndDestroyReceivers(t *testing.T) {
ps := newActivitiesEventsPipeline()
ps.setup(t, true, true)
ps.validate(t)
}
func TestParseWebPageEndpoints_ActivityEvents(t *testing.T) {
got, want := parseWebPageEndpoints(activityEventsTestWebPage), activityEventsWant
testWebPageHelper(t, got, want)
}
var activityEventsWant = endpointsByFragmentID{
"list-public-events": []*Endpoint{
{urlFormats: []string{"events"}, httpMethod: "GET"},
},
"list-repository-events": []*Endpoint{
{urlFormats: []string{"repos/%v/%v/events"}, httpMethod: "GET"},
},
"list-public-events-for-a-network-of-repositories": []*Endpoint{
{urlFormats: []string{"networks/%v/%v/events"}, httpMethod: "GET"},
},
"list-events-received-by-the-authenticated-user": []*Endpoint{
{urlFormats: []string{"users/%v/received_events"}, httpMethod: "GET"},
},
"list-events-for-the-authenticated-user": []*Endpoint{
{urlFormats: []string{"users/%v/events"}, httpMethod: "GET"},
},
"list-public-events-for-a-user": []*Endpoint{
{urlFormats: []string{"users/%v/events/public"}, httpMethod: "GET"},
},
"list-organization-events-for-the-authenticated-user": []*Endpoint{
{urlFormats: []string{"users/%v/events/orgs/%v"}, httpMethod: "GET"},
},
"list-public-organization-events": []*Endpoint{
{urlFormats: []string{"orgs/%v/events"}, httpMethod: "GET"},
},
"list-public-events-received-by-a-user": []*Endpoint{
{urlFormats: []string{"users/%v/received_events/public"}, httpMethod: "GET"},
},
// Updated docs - consolidated into single page.
"delete-a-thread-subscription": []*Endpoint{
{urlFormats: []string{"notifications/threads/%v/subscription"}, httpMethod: "DELETE"},
},
"mark-notifications-as-read": []*Endpoint{
{urlFormats: []string{"notifications"}, httpMethod: "PUT"},
},
"set-a-thread-subscription": []*Endpoint{
{urlFormats: []string{"notifications/threads/%v/subscription"}, httpMethod: "PUT"},
},
"delete-a-repository-subscription": []*Endpoint{
{urlFormats: []string{"repos/%v/%v/subscription"}, httpMethod: "DELETE"},
},
"star-a-repository-for-the-authenticated-user": []*Endpoint{
{urlFormats: []string{"user/starred/%v/%v"}, httpMethod: "PUT"},
},
"list-repositories-starred-by-the-authenticated-user": []*Endpoint{
{urlFormats: []string{"user/starred"}, httpMethod: "GET"},
},
"list-watchers": []*Endpoint{
{urlFormats: []string{"repos/%v/%v/subscribers"}, httpMethod: "GET"},
},
"get-feeds": []*Endpoint{
{urlFormats: []string{"feeds"}, httpMethod: "GET"},
},
"get-a-thread": []*Endpoint{
{urlFormats: []string{"notifications/threads/%v"}, httpMethod: "GET"},
},
"mark-a-thread-as-read": []*Endpoint{
{urlFormats: []string{"notifications/threads/%v"}, httpMethod: "PATCH"},
},
"list-stargazers": []*Endpoint{
{urlFormats: []string{"repos/%v/%v/stargazers"}, httpMethod: "GET"},
},
"list-repositories-watched-by-a-user": []*Endpoint{
{urlFormats: []string{"users/%v/subscriptions"}, httpMethod: "GET"},
},
"list-repository-notifications-for-the-authenticated-user": []*Endpoint{
{urlFormats: []string{"repos/%v/%v/notifications"}, httpMethod: "GET"},
},
"mark-repository-notifications-as-read": []*Endpoint{
{urlFormats: []string{"repos/%v/%v/notifications"}, httpMethod: "PUT"},
},
"check-if-a-repository-is-starred-by-the-authenticated-user": []*Endpoint{
{urlFormats: []string{"user/starred/%v/%v"}, httpMethod: "GET"},
},
"list-notifications-for-the-authenticated-user": []*Endpoint{
{urlFormats: []string{"notifications"}, httpMethod: "GET"},
},
"get-a-thread-subscription-for-the-authenticated-user": []*Endpoint{
{urlFormats: []string{"notifications/threads/%v/subscription"}, httpMethod: "GET"},
},
"unstar-a-repository-for-the-authenticated-user": []*Endpoint{
{urlFormats: []string{"user/starred/%v/%v"}, httpMethod: "DELETE"},
},
"list-repositories-watched-by-the-authenticated-user": []*Endpoint{
{urlFormats: []string{"user/subscriptions"}, httpMethod: "GET"},
},
"get-a-repository-subscription": []*Endpoint{
{urlFormats: []string{"repos/%v/%v/subscription"}, httpMethod: "GET"},
},
"set-a-repository-subscription": []*Endpoint{
{urlFormats: []string{"repos/%v/%v/subscription"}, httpMethod: "PUT"},
},
"list-repositories-starred-by-a-user": []*Endpoint{
{urlFormats: []string{"users/%v/starred"}, httpMethod: "GET"},
},
}
var activityEventsTestWebPage = `
<html lang="en">
<head>
<title>Activity - GitHub Docs</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="google-site-verification" content="OgdQc0GZfjDI52wDv1bkMT-SLpBUo_h5nn9mI9L22xQ" />
<meta name="google-site-verification" content="c1kuD-K2HIVF635lypcsWPoD4kilo5-jA_wBFyT4uMY" />
<!-- localized data needed by client-side JS -->
<meta name="site.data.ui.search.placeholder" content="Search topics, products...">
<!-- end localized data -->
<!-- hreflangs -->
<link
rel="alternate"
hreflang="en"
href="https://docs.github.com/en/free-pro-team@latest/rest/reference/activity"
/>
<link
rel="alternate"
hreflang="zh-Hans"
href="https://docs.github.com/cn/rest/reference/activity"
/>
<link
rel="alternate"
hreflang="ja"
href="https://docs.github.com/ja/rest/reference/activity"
/>
<link
rel="alternate"
hreflang="es"
href="https://docs.github.com/es/rest/reference/activity"
/>
<link
rel="alternate"
hreflang="pt"
href="https://docs.github.com/pt/rest/reference/activity"
/>
<link
rel="alternate"
hreflang="de"
href="https://docs.github.com/de/rest/reference/activity"
/>
<link rel="stylesheet" href="/dist/index.css">
<link rel="alternate icon" type="image/png" href="/assets/images/site/favicon.png">
<link rel="icon" type="image/svg+xml" href="/assets/images/site/favicon.svg">
</head>
<body class="d-lg-flex">
<!-- product > category > maptopic > article -->
<div class="sidebar d-none d-lg-block">
<div class="d-flex flex-items-center p-4" style="z-index: 3;" id="github-logo">
<a href="/en" class="text-white" aria-hidden="true">
<svg version="1.1" width="32" height="32" viewBox="0 0 16 16" class="octicon octicon-mark-github" aria-hidden="true"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg>
</a>
<a href="/en" class="h4-mktg text-white no-underline no-wrap pl-2 flex-auto">GitHub Docs</a>
</div>
<ul class="sidebar-products">
<!--
Styling note:
Categories, Maptopics, and Articles list items get a class of "active" when they correspond to content
hierarchy of the current page. If an item's URL is also the same as the current URL, the item
also gets an "is-current-page" class.
-->
<li title="Home">
<a href="/" class="f6 pl-4 pr-5 ml-n1 pb-1">
<svg xmlns="http://www.w3.org/2000/svg" class="octicon" viewBox="0 0 16 16" width="16" height="16"> <path fill-rule="evenodd" clip-rule="evenodd" d="M7.78033 12.5303C7.48744 12.8232 7.01256 12.8232 6.71967 12.5303L2.46967 8.28033C2.17678 7.98744 2.17678 7.51256 2.46967 7.21967L6.71967 2.96967C7.01256 2.67678 7.48744 2.67678 7.78033 2.96967C8.07322 3.26256 8.07322 3.73744 7.78033 4.03033L4.81066 7L12.25 7C12.6642 7 13 7.33579 13 7.75C13 8.16421 12.6642 8.5 12.25 8.5L4.81066 8.5L7.78033 11.4697C8.07322 11.7626 8.07322 12.2374 7.78033 12.5303Z"></path></svg>
All products
</a>
</li>
<li title="REST API" class="sidebar-product mb-2">
<a href="/en/rest" class="pl-4 pr-5 pb-1 f4">REST API</a>
</li>
<ul class="sidebar-categories list-style-none">
<li class="sidebar-category py-1 ">
<details class="dropdown-withArrow details details-reset" open>
<summary>
<div class="d-flex flex-justify-between">
<a href="/en/free-pro-team@latest/rest/overview" class="pl-4 pr-2 py-2 f6 text-uppercase d-block flex-auto mr-3">Overview</a>
<svg xmlns="http://www.w3.org/2000/svg" class="octicon flex-shrink-0 arrow mr-3" style="margin-top:7px" viewBox="0 0 16 16" width="16" height="16"> <path fill-rule="evenodd" clip-rule="evenodd" d="M12.7803 6.21967C13.0732 6.51256 13.0732 6.98744 12.7803 7.28033L8.53033 11.5303C8.23744 11.8232 7.76256 11.8232 7.46967 11.5303L3.21967 7.28033C2.92678 6.98744 2.92678 6.51256 3.21967 6.21967C3.51256 5.92678 3.98744 5.92678 4.28033 6.21967L8 9.93934L11.7197 6.21967C12.0126 5.92678 12.4874 5.92678 12.7803 6.21967Z"></path></svg>
</div>
</summary>
<!-- some categories have maptopics with child articles -->
<ul class="sidebar-articles list-style-none">
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/overview/resources-in-the-rest-api" class="pl-4 pr-5 py-1">Resources in the REST API</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/overview/media-types" class="pl-4 pr-5 py-1">Media types</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/overview/other-authentication-methods" class="pl-4 pr-5 py-1">Other authentication methods</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/overview/troubleshooting" class="pl-4 pr-5 py-1">Troubleshooting</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/overview/api-previews" class="pl-4 pr-5 py-1">API previews</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/overview/libraries" class="pl-4 pr-5 py-1">Libraries</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/overview/endpoints-available-for-github-apps" class="pl-4 pr-5 py-1 pb-2">Endpoints available for GitHub Apps</a>
</li>
</ul>
</details>
</li>
<li class="sidebar-category py-1 active ">
<details class="dropdown-withArrow details details-reset" open>
<summary>
<div class="d-flex flex-justify-between">
<a href="/en/free-pro-team@latest/rest/reference" class="pl-4 pr-2 py-2 f6 text-uppercase d-block flex-auto mr-3">Reference</a>
<svg xmlns="http://www.w3.org/2000/svg" class="octicon flex-shrink-0 arrow mr-3" style="margin-top:7px" viewBox="0 0 16 16" width="16" height="16"> <path fill-rule="evenodd" clip-rule="evenodd" d="M12.7803 6.21967C13.0732 6.51256 13.0732 6.98744 12.7803 7.28033L8.53033 11.5303C8.23744 11.8232 7.76256 11.8232 7.46967 11.5303L3.21967 7.28033C2.92678 6.98744 2.92678 6.51256 3.21967 6.21967C3.51256 5.92678 3.98744 5.92678 4.28033 6.21967L8 9.93934L11.7197 6.21967C12.0126 5.92678 12.4874 5.92678 12.7803 6.21967Z"></path></svg>
</div>
</summary>
<!-- some categories have maptopics with child articles -->
<ul class="sidebar-articles list-style-none">
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/actions" class="pl-4 pr-5 py-1">Actions</a>
</li>
<li class="sidebar-article active is-current-page">
<a href="/en/free-pro-team@latest/rest/reference/activity" class="pl-4 pr-5 py-1">Activity</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/apps" class="pl-4 pr-5 py-1">Apps</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/billing" class="pl-4 pr-5 py-1">Billing</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/checks" class="pl-4 pr-5 py-1">Checks</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/code-scanning" class="pl-4 pr-5 py-1">Code Scanning</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/codes-of-conduct" class="pl-4 pr-5 py-1">Codes of conduct</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/emojis" class="pl-4 pr-5 py-1">Emojis</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/enterprise-admin" class="pl-4 pr-5 py-1">GitHub Enterprise administration</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/gists" class="pl-4 pr-5 py-1">Gists</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/git" class="pl-4 pr-5 py-1">Git database</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/gitignore" class="pl-4 pr-5 py-1">Gitignore</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/interactions" class="pl-4 pr-5 py-1">Interactions</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/issues" class="pl-4 pr-5 py-1">Issues</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/licenses" class="pl-4 pr-5 py-1">Licenses</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/markdown" class="pl-4 pr-5 py-1">Markdown</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/meta" class="pl-4 pr-5 py-1">Meta</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/migrations" class="pl-4 pr-5 py-1">Migrations</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/oauth-authorizations" class="pl-4 pr-5 py-1">OAuth Authorizations</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/orgs" class="pl-4 pr-5 py-1">Organizations</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/projects" class="pl-4 pr-5 py-1">Projects</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/pulls" class="pl-4 pr-5 py-1">Pulls</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/rate-limit" class="pl-4 pr-5 py-1">Rate limit</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/reactions" class="pl-4 pr-5 py-1">Reactions</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/repos" class="pl-4 pr-5 py-1">Repositories</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/scim" class="pl-4 pr-5 py-1">SCIM</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/search" class="pl-4 pr-5 py-1">Search</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/teams" class="pl-4 pr-5 py-1">Teams</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/users" class="pl-4 pr-5 py-1">Users</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/reference/permissions-required-for-github-apps" class="pl-4 pr-5 py-1 pb-2">Permissions required for GitHub Apps</a>
</li>
</ul>
</details>
</li>
<li class="sidebar-category py-1 ">
<details class="dropdown-withArrow details details-reset" open>
<summary>
<div class="d-flex flex-justify-between">
<a href="/en/free-pro-team@latest/rest/guides" class="pl-4 pr-2 py-2 f6 text-uppercase d-block flex-auto mr-3">Guides</a>
<svg xmlns="http://www.w3.org/2000/svg" class="octicon flex-shrink-0 arrow mr-3" style="margin-top:7px" viewBox="0 0 16 16" width="16" height="16"> <path fill-rule="evenodd" clip-rule="evenodd" d="M12.7803 6.21967C13.0732 6.51256 13.0732 6.98744 12.7803 7.28033L8.53033 11.5303C8.23744 11.8232 7.76256 11.8232 7.46967 11.5303L3.21967 7.28033C2.92678 6.98744 2.92678 6.51256 3.21967 6.21967C3.51256 5.92678 3.98744 5.92678 4.28033 6.21967L8 9.93934L11.7197 6.21967C12.0126 5.92678 12.4874 5.92678 12.7803 6.21967Z"></path></svg>
</div>
</summary>
<!-- some categories have maptopics with child articles -->
<ul class="sidebar-articles list-style-none">
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/guides/getting-started-with-the-rest-api" class="pl-4 pr-5 py-1">Getting started with the REST API</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/guides/basics-of-authentication" class="pl-4 pr-5 py-1">Basics of authentication</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/guides/discovering-resources-for-a-user" class="pl-4 pr-5 py-1">Discovering resources for a user</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/guides/delivering-deployments" class="pl-4 pr-5 py-1">Delivering deployments</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/guides/rendering-data-as-graphs" class="pl-4 pr-5 py-1">Rendering data as graphs</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/guides/working-with-comments" class="pl-4 pr-5 py-1">Working with comments</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/guides/traversing-with-pagination" class="pl-4 pr-5 py-1">Traversing with pagination</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/guides/building-a-ci-server" class="pl-4 pr-5 py-1">Building a CI server</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/guides/best-practices-for-integrators" class="pl-4 pr-5 py-1">Best practices for integrators</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/guides/getting-started-with-the-git-database-api" class="pl-4 pr-5 py-1">Getting started with the Git Database API</a>
</li>
<li class="sidebar-article ">
<a href="/en/free-pro-team@latest/rest/guides/getting-started-with-the-checks-api" class="pl-4 pr-5 py-1 pb-2">Getting started with the Checks API</a>
</li>
</ul>
</details>
</li>
</ul>
</ul>
</div>
<main class="width-full">
<div class="border-bottom border-gray-light no-print">
<header class="container-xl px-3 px-md-6 pt-3 pb-2 position-relative d-flex flex-justify-between width-full ">
<div class="d-flex flex-items-center d-md-none" style="z-index: 3;" id="github-logo-mobile">
<a href="/en" aria-hidden="true">
<svg version="1.1" width="32" height="32" viewBox="0 0 16 16" class="octicon octicon-mark-github text-black" aria-hidden="true"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg>
</a>
<a href="/en" class="h4-mktg text-gray-dark no-underline no-wrap pl-2">GitHub Docs</a>
</div>
<div class="width-full">
<div class="d-inline-block width-full d-md-flex" style="z-index: 1;">
<button class="nav-mobile-burgerIcon float-right mt-1 border-0 d-md-none" type="button" aria-label="Toggle navigation">
<!-- Hamburger icon added with css -->
</button>
<div style="z-index: 2;" class="nav-mobile-dropdown width-full">
<div class="d-md-flex flex-justify-between flex-items-center">
<div class="py-2 py-md-0 d-md-inline-block">
<h4 class="text-mono f5 text-normal text-gray d-md-none">Explore by product</h4>
<details class="dropdown-withArrow position-relative details details-reset d-md-none close-when-clicked-outside">
<summary class="nav-desktop-productDropdownButton text-blue-mktg py-2" role="button" aria-label="Toggle products list">
<div id="current-product" class="d-flex flex-items-center flex-justify-between" style="padding-top: 2px;">
<!-- Product switcher - GitHub.com, Enterprise Server, etc -->
<!-- 404 and 500 error layouts are not real pages so we need to hardcode the name for those -->
REST API
<svg class="arrow ml-md-1" width="14px" height="8px" viewBox="0 0 14 8" xml:space="preserve" fill="none" stroke="#1277eb"><path d="M1,1l6.2,6L13,1"></path></svg>
</div>
</summary>
<div id="homepages" class="position-md-absolute nav-desktop-productDropdown p-md-4 left-md-n4 top-md-6" style="z-index: 6;">
<a href="/en/github"
class="d-block py-2 link-gray-dark no-underline">
GitHub.com
</a>
<a href="/en/enterprise/admin"
class="d-block py-2 link-gray-dark no-underline">
Enterprise Server
</a>
<a href="/en/actions"
class="d-block py-2 link-gray-dark no-underline">
GitHub Actions
</a>
<a href="/en/packages"
class="d-block py-2 link-gray-dark no-underline">
GitHub Packages
</a>
<a href="/en/developers"
class="d-block py-2 link-gray-dark no-underline">
Developers
</a>
<a href="/en/rest"
class="d-block py-2 text-blue-mktg text-underline active">
REST API
</a>
<a href="/en/graphql"
class="d-block py-2 link-gray-dark no-underline">
GraphQL API
</a>
<a href="/en/insights"
class="d-block py-2 link-gray-dark no-underline">
GitHub Insights
</a>
<a href="/en/desktop"
class="d-block py-2 link-gray-dark no-underline">
GitHub Desktop
</a>
<a href="https://atom.io/docs"
class="d-block py-2 link-gray-dark no-underline">
Atom
<span class="ml-1"><svg width="9" height="10" viewBox="0 0 9 10" fill="none" xmlns="http://www.w3.org/2000/svg"><path stroke="#24292e" d="M.646 8.789l8-8M8.5 9V1M1 .643h8"/></svg></span>
</a>
<a href="https://electronjs.org/docs"
class="d-block py-2 link-gray-dark no-underline">
Electron
<span class="ml-1"><svg width="9" height="10" viewBox="0 0 9 10" fill="none" xmlns="http://www.w3.org/2000/svg"><path stroke="#24292e" d="M.646 8.789l8-8M8.5 9V1M1 .643h8"/></svg></span>
</a>
</div>
</details>
</div>
<div class="d-md-inline-block">
<div class="border-top border-md-top-0 py-2 py-md-0 d-md-inline-block">
<details class="dropdown-withArrow position-relative details details-reset mr-md-3 close-when-clicked-outside">
<summary class="py-2 text-gray-dark" role="button" aria-label="Toggle languages list">
<div class="d-flex flex-items-center flex-justify-between">
<!-- Language switcher - 'English', 'Japanese', etc -->
English
<svg class="arrow ml-md-1" width="14px" height="8px" viewBox="0 0 14 8" xml:space="preserve" fill="none" stroke="#1B1F23"><path d="M1,1l6.2,6L13,1"></path></svg>
</div>
</summary>
<div id="languages-selector" class="position-md-absolute nav-desktop-langDropdown p-md-4 right-md-n4 top-md-6" style="z-index: 6;">
<a
href="/en/free-pro-team@latest/rest/reference/activity"
class="d-block py-2 no-underline active link-gray"
style="white-space: nowrap"
>
English
</a>
<a
href="/cn/rest/reference/activity"
class="d-block py-2 no-underline link-gray-dark"
style="white-space: nowrap"
>
简体中文 (Simplified Chinese)
</a>
<a
href="/ja/rest/reference/activity"
class="d-block py-2 no-underline link-gray-dark"
style="white-space: nowrap"
>
日本語 (Japanese)
</a>
<a
href="/es/rest/reference/activity"
class="d-block py-2 no-underline link-gray-dark"
style="white-space: nowrap"
>
Español (Spanish)
</a>
<a
href="/pt/rest/reference/activity"
class="d-block py-2 no-underline link-gray-dark"
style="white-space: nowrap"
>
Português do Brasil (Portuguese)
</a>
</div>
</details>
</div>
<!-- GitHub.com homepage and 404 page has a stylized search; Enterprise homepages do not -->
<div class="pt-3 pt-md-0 d-md-inline-block ml-md-3 bord'er-top border-md-top-0">
<!--
This form is used in two places:
- On the homepage, front and center
- On all other pages, in the header
-->
<form class="mb-0">
<div id="search-input-container" aria-hidden="true">
<!-- Aloglia instantsearch.js will add a search input here -->
</div>
</form>
<div id="search-results-container"></div>
<div class="search-overlay-desktop"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</header>
</div>
<main class="container-xl px-3 px-md-6 my-4 my-lg-4 d-lg-flex">
<article class="markdown-body width-full">
<div class="article-grid-container">
<div class="article-grid-toc">
<details id="article-versions" class="dropdown-withArrow d-inline-block details details-reset mb-4 mb-md-0 position-relative close-when-clicked-outside">
<summary class="d-flex flex-items-center flex-justify-between f4 h5-mktg btn-outline-mktg btn-mktg p-2">
<!-- GitHub.com, Enterprise Server 2.16, etc -->
<span class="d-md-none d-xl-inline-block mr-1">Article version:</span> GitHub.com
<svg class="arrow ml-1" width="14px" height="8px" viewBox="0 0 14 8" xml:space="preserve" fill="none" stroke="#1277eb"><path d="M1,1l6.2,6L13,1"></path></svg>
</summary>
<div class="nav-dropdown position-md-absolute bg-white rounded-1 px-4 py-3 top-7 box-shadow-large" style="z-index: 6; width: 210px;">
<a
href="/en/free-pro-team@latest/rest/reference/activity"
class="d-block py-2 link-blue active"
>GitHub.com</a>
<a
href="/en/enterprise/2.21/user/rest/reference/activity"
class="d-block py-2 link-gray-dark no-underline"
>Enterprise Server 2.21</a>
<a
href="/en/enterprise/2.20/user/rest/reference/activity"
class="d-block py-2 link-gray-dark no-underline"
>Enterprise Server 2.20</a>
<a
href="/en/enterprise/2.19/user/rest/reference/activity"
class="d-block py-2 link-gray-dark no-underline"
>Enterprise Server 2.19</a>
</div>
</details>
</div>
<div class="article-grid-body d-flex flex-items-center" style="height: 39px;">
<nav class="breadcrumbs f5" aria-label="Breadcrumb">
<a title="product: REST API" href="/en/rest" class="d-inline-block ">
REST API</a>
<a title="category: Reference" href="/en/free-pro-team@latest/rest/reference" class="d-inline-block ">
Reference</a>
<a title="article: Activity" href="/en/free-pro-team@latest/rest/reference/activity" class="d-inline-block text-gray-light">
Activity</a>
</nav>
</div>
</div>
<div class="mt-2 article-grid-container">
<div class="article-grid-head">
<div class="d-flex flex-items-baseline flex-justify-between mt-3">
<h1 class="border-bottom-0">Activity</h1>
<div class="d-none d-lg-block ml-2">
<button class="btn-link link-gray js-print tooltipped tooltipped-n" aria-label="Print this article">
<!-- From https://heroicons.dev/ -->
<svg fill="none" height="18" width="18" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" stroke="currentColor"><path d="M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z"></path></svg>
</button>
</div>
</div>
</div>
<div class="article-grid-toc border-bottom border-xl-0 pb-4 mb-5 pb-xl-0 mb-xl-0">
<div class="article-grid-toc-content">
<h3 id="in-this-article" class="f5 mb-2"><a class="link-gray-dark" href="#in-this-article">In this article</a></h3>
<ul class="list-style-none pl-0 f5 mb-0">
<li class="ml-0 mb-2 lh-condensed"><a href="#events">Events</a></li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#list-public-events">List public events</a>
</li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#list-public-events-for-a-network-of-repositories">List public events for a network of repositories</a>
</li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#list-public-organization-events">List public organization events</a>
</li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#list-repository-events">List repository events</a>
</li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#list-events-for-the-authenticated-user">List events for the authenticated user</a>
</li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#list-organization-events-for-the-authenticated-user">List organization events for the authenticated user</a>
</li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#list-public-events-for-a-user">List public events for a user</a>
</li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#list-events-received-by-the-authenticated-user">List events received by the authenticated user</a>
</li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#list-public-events-received-by-a-user">List public events received by a user</a>
</li>
<li class="ml-0 mb-2 lh-condensed"><a href="#feeds">Feeds</a></li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#get-feeds">Get feeds</a>
</li>
<li class="ml-3 mb-2 lh-condensed"><a href="#example-of-getting-an-atom-feed">Example of getting an Atom feed</a></li>
<li class="ml-0 mb-2 lh-condensed"><a href="#notifications">Notifications</a></li>
<li class="ml-3 mb-2 lh-condensed"><a href="#notification-reasons">Notification reasons</a></li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#list-notifications-for-the-authenticated-user">List notifications for the authenticated user</a>
</li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#mark-notifications-as-read">Mark notifications as read</a>
</li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#get-a-thread">Get a thread</a>
</li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#mark-a-thread-as-read">Mark a thread as read</a>
</li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#get-a-thread-subscription-for-the-authenticated-user">Get a thread subscription for the authenticated user</a>
</li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#set-a-thread-subscription">Set a thread subscription</a>
</li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#delete-a-thread-subscription">Delete a thread subscription</a>
</li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#list-repository-notifications-for-the-authenticated-user">List repository notifications for the authenticated user</a>
</li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#mark-repository-notifications-as-read">Mark repository notifications as read</a>
</li>
<li class="ml-0 mb-2 lh-condensed"><a href="#starring">Starring</a></li>
<li class="ml-3 mb-2 lh-condensed"><a href="#starring-vs-watching">Starring vs. Watching</a></li>
<li class="ml-3 mb-2 lh-condensed"><a href="#custom-media-types-for-starring">Custom media types for starring</a></li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#list-stargazers">List stargazers</a>
</li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#list-repositories-starred-by-the-authenticated-user">List repositories starred by the authenticated user</a>
</li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#check-if-a-repository-is-starred-by-the-authenticated-user">Check if a repository is starred by the authenticated user</a>
</li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#star-a-repository-for-the-authenticated-user">Star a repository for the authenticated user</a>
</li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#unstar-a-repository-for-the-authenticated-user">Unstar a repository for the authenticated user</a>
</li>
<li class="ml-3 mb-2 lh-condensed">
<a href="#list-repositories-starred-by-a-user">List repositories starred by a user</a>
</li>