octocrate 1.0.0

A comprehensive GitHub REST API library based on Rust.
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
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
use octocrate_core::*;
#[allow(unused_imports)]
use octocrate_types::*;

/// Interact with GitHub Issues.
pub struct GitHubIssuesAPI {
  config: SharedAPIConfig,
}

impl GitHubIssuesAPI {
  pub fn new(config: &SharedAPIConfig) -> Self {
    Self {
      config: config.clone(),
    }
  }

  /// **List issues assigned to the authenticated user**
  ///
  /// List issues assigned to the authenticated user across all visible repositories including owned repositories, member
  /// repositories, and organization repositories. You can use the `filter` query parameter to fetch issues that are not
  /// necessarily assigned to you.
  ///
  /// **Note**: GitHub's REST API considers every pull request an issue, but not every issue is a pull request. For this
  /// reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by
  /// the `pull_request` key. Be aware that the `id` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull
  /// request id, use the "[List pull requests](https://docs.github.com/rest/pulls/pulls#list-pull-requests)" endpoint.
  ///
  /// This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types)."
  ///
  /// - **`application/vnd.github.raw+json`**: Returns the raw markdown body. Response will include `body`. This is the default if you do not pass any specific media type.
  /// - **`application/vnd.github.text+json`**: Returns a text only representation of the markdown body. Response will include `body_text`.
  /// - **`application/vnd.github.html+json`**: Returns HTML rendered from the body's markdown. Response will include `body_html`.
  /// - **`application/vnd.github.full+json`**: Returns raw, text, and HTML representations. Response will include `body`, `body_text`, and `body_html`.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/issues#list-issues-assigned-to-the-authenticated-user](https://docs.github.com/rest/issues/issues#list-issues-assigned-to-the-authenticated-user)
  pub fn list(&self) -> Request<(), IssuesListQuery, Vec<Issue>> {
    let url = format!("/issues");

    Request::<(), IssuesListQuery, Vec<Issue>>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **List organization issues assigned to the authenticated user**
  ///
  /// List issues in an organization assigned to the authenticated user.
  ///
  /// **Note**: GitHub's REST API considers every pull request an issue, but not every issue is a pull request. For this
  /// reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by
  /// the `pull_request` key. Be aware that the `id` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull
  /// request id, use the "[List pull requests](https://docs.github.com/rest/pulls/pulls#list-pull-requests)" endpoint.
  ///
  /// This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types)."
  ///
  /// - **`application/vnd.github.raw+json`**: Returns the raw markdown body. Response will include `body`. This is the default if you do not pass any specific media type.
  /// - **`application/vnd.github.text+json`**: Returns a text only representation of the markdown body. Response will include `body_text`.
  /// - **`application/vnd.github.html+json`**: Returns HTML rendered from the body's markdown. Response will include `body_html`.
  /// - **`application/vnd.github.full+json`**: Returns raw, text, and HTML representations. Response will include `body`, `body_text`, and `body_html`.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/issues#list-organization-issues-assigned-to-the-authenticated-user](https://docs.github.com/rest/issues/issues#list-organization-issues-assigned-to-the-authenticated-user)
  pub fn list_for_org(
    &self,
    org: impl Into<String>,
  ) -> Request<(), IssuesListForOrgQuery, Vec<Issue>> {
    let org = org.into();
    let url = format!("/orgs/{org}/issues");

    Request::<(), IssuesListForOrgQuery, Vec<Issue>>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **List assignees**
  ///
  /// Lists the [available assignees](https://docs.github.com/articles/assigning-issues-and-pull-requests-to-other-github-users/) for issues in a repository.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/assignees#list-assignees](https://docs.github.com/rest/issues/assignees#list-assignees)
  pub fn list_assignees(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
  ) -> Request<(), IssuesListAssigneesQuery, Vec<SimpleUser>> {
    let owner = owner.into();
    let repo = repo.into();
    let url = format!("/repos/{owner}/{repo}/assignees");

    Request::<(), IssuesListAssigneesQuery, Vec<SimpleUser>>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **Check if a user can be assigned**
  ///
  /// Checks if a user has permission to be assigned to an issue in this repository.
  ///
  /// If the `assignee` can be assigned to issues in the repository, a `204` header with no content is returned.
  ///
  /// Otherwise a `404` status code is returned.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/assignees#check-if-a-user-can-be-assigned](https://docs.github.com/rest/issues/assignees#check-if-a-user-can-be-assigned)
  pub fn check_user_can_be_assigned(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    assignee: impl Into<String>,
  ) -> NoContentRequest<(), ()> {
    let owner = owner.into();
    let repo = repo.into();
    let assignee = assignee.into();
    let url = format!("/repos/{owner}/{repo}/assignees/{assignee}");

    NoContentRequest::<(), ()>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **List repository issues**
  ///
  /// List issues in a repository. Only open issues will be listed.
  ///
  /// **Note**: GitHub's REST API considers every pull request an issue, but not every issue is a pull request. For this
  /// reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by
  /// the `pull_request` key. Be aware that the `id` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull
  /// request id, use the "[List pull requests](https://docs.github.com/rest/pulls/pulls#list-pull-requests)" endpoint.
  ///
  /// This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types)."
  ///
  /// - **`application/vnd.github.raw+json`**: Returns the raw markdown body. Response will include `body`. This is the default if you do not pass any specific media type.
  /// - **`application/vnd.github.text+json`**: Returns a text only representation of the markdown body. Response will include `body_text`.
  /// - **`application/vnd.github.html+json`**: Returns HTML rendered from the body's markdown. Response will include `body_html`.
  /// - **`application/vnd.github.full+json`**: Returns raw, text, and HTML representations. Response will include `body`, `body_text`, and `body_html`.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/issues#list-repository-issues](https://docs.github.com/rest/issues/issues#list-repository-issues)
  pub fn list_for_repo(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
  ) -> Request<(), IssuesListForRepoQuery, Vec<Issue>> {
    let owner = owner.into();
    let repo = repo.into();
    let url = format!("/repos/{owner}/{repo}/issues");

    Request::<(), IssuesListForRepoQuery, Vec<Issue>>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **Create an issue**
  ///
  /// Any user with pull access to a repository can create an issue. If [issues are disabled in the repository](https://docs.github.com/articles/disabling-issues/), the API returns a `410 Gone` status.
  ///
  /// This endpoint triggers [notifications](https://docs.github.com/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in secondary rate limiting. For more information, see "[Rate limits for the API](https://docs.github.com/rest/overview/rate-limits-for-the-rest-api#about-secondary-rate-limits)"
  /// and "[Best practices for using the REST API](https://docs.github.com/rest/guides/best-practices-for-using-the-rest-api)."
  ///
  /// This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types)."
  ///
  /// - **`application/vnd.github.raw+json`**: Returns the raw markdown body. Response will include `body`. This is the default if you do not pass any specific media type.
  /// - **`application/vnd.github.text+json`**: Returns a text only representation of the markdown body. Response will include `body_text`.
  /// - **`application/vnd.github.html+json`**: Returns HTML rendered from the body's markdown. Response will include `body_html`.
  /// - **`application/vnd.github.full+json`**: Returns raw, text, and HTML representations. Response will include `body`, `body_text`, and `body_html`.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/issues#create-an-issue](https://docs.github.com/rest/issues/issues#create-an-issue)
  pub fn create(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
  ) -> Request<IssuesCreateRequest, (), Issue> {
    let owner = owner.into();
    let repo = repo.into();
    let url = format!("/repos/{owner}/{repo}/issues");

    Request::<IssuesCreateRequest, (), Issue>::builder(&self.config)
      .post(url)
      .build()
  }

  /// **List issue comments for a repository**
  ///
  /// You can use the REST API to list comments on issues and pull requests for a repository. Every pull request is an issue, but not every issue is a pull request.
  ///
  /// By default, issue comments are ordered by ascending ID.
  ///
  /// This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types)."
  ///
  /// - **`application/vnd.github.raw+json`**: Returns the raw markdown body. Response will include `body`. This is the default if you do not pass any specific media type.
  /// - **`application/vnd.github.text+json`**: Returns a text only representation of the markdown body. Response will include `body_text`.
  /// - **`application/vnd.github.html+json`**: Returns HTML rendered from the body's markdown. Response will include `body_html`.
  /// - **`application/vnd.github.full+json`**: Returns raw, text, and HTML representations. Response will include `body`, `body_text`, and `body_html`.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/comments#list-issue-comments-for-a-repository](https://docs.github.com/rest/issues/comments#list-issue-comments-for-a-repository)
  pub fn list_comments_for_repo(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
  ) -> Request<(), IssuesListCommentsForRepoQuery, Vec<IssueComment>> {
    let owner = owner.into();
    let repo = repo.into();
    let url = format!("/repos/{owner}/{repo}/issues/comments");

    Request::<(), IssuesListCommentsForRepoQuery, Vec<IssueComment>>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **Get an issue comment**
  ///
  /// You can use the REST API to get comments on issues and pull requests. Every pull request is an issue, but not every issue is a pull request.
  ///
  /// This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types)."
  ///
  /// - **`application/vnd.github.raw+json`**: Returns the raw markdown body. Response will include `body`. This is the default if you do not pass any specific media type.
  /// - **`application/vnd.github.text+json`**: Returns a text only representation of the markdown body. Response will include `body_text`.
  /// - **`application/vnd.github.html+json`**: Returns HTML rendered from the body's markdown. Response will include `body_html`.
  /// - **`application/vnd.github.full+json`**: Returns raw, text, and HTML representations. Response will include `body`, `body_text`, and `body_html`.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/comments#get-an-issue-comment](https://docs.github.com/rest/issues/comments#get-an-issue-comment)
  pub fn get_comment(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    comment_id: impl Into<i64>,
  ) -> Request<(), (), IssueComment> {
    let owner = owner.into();
    let repo = repo.into();
    let comment_id = comment_id.into();
    let url = format!("/repos/{owner}/{repo}/issues/comments/{comment_id}");

    Request::<(), (), IssueComment>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **Update an issue comment**
  ///
  /// You can use the REST API to update comments on issues and pull requests. Every pull request is an issue, but not every issue is a pull request.
  ///
  /// This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types)."
  ///
  /// - **`application/vnd.github.raw+json`**: Returns the raw markdown body. Response will include `body`. This is the default if you do not pass any specific media type.
  /// - **`application/vnd.github.text+json`**: Returns a text only representation of the markdown body. Response will include `body_text`.
  /// - **`application/vnd.github.html+json`**: Returns HTML rendered from the body's markdown. Response will include `body_html`.
  /// - **`application/vnd.github.full+json`**: Returns raw, text, and HTML representations. Response will include `body`, `body_text`, and `body_html`.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/comments#update-an-issue-comment](https://docs.github.com/rest/issues/comments#update-an-issue-comment)
  pub fn update_comment(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    comment_id: impl Into<i64>,
  ) -> Request<IssuesUpdateCommentRequest, (), IssueComment> {
    let owner = owner.into();
    let repo = repo.into();
    let comment_id = comment_id.into();
    let url = format!("/repos/{owner}/{repo}/issues/comments/{comment_id}");

    Request::<IssuesUpdateCommentRequest, (), IssueComment>::builder(&self.config)
      .patch(url)
      .build()
  }

  /// **Delete an issue comment**
  ///
  /// You can use the REST API to delete comments on issues and pull requests. Every pull request is an issue, but not every issue is a pull request.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/comments#delete-an-issue-comment](https://docs.github.com/rest/issues/comments#delete-an-issue-comment)
  pub fn delete_comment(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    comment_id: impl Into<i64>,
  ) -> NoContentRequest<(), ()> {
    let owner = owner.into();
    let repo = repo.into();
    let comment_id = comment_id.into();
    let url = format!("/repos/{owner}/{repo}/issues/comments/{comment_id}");

    NoContentRequest::<(), ()>::builder(&self.config)
      .delete(url)
      .build()
  }

  /// **List issue events for a repository**
  ///
  /// Lists events for a repository.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/events#list-issue-events-for-a-repository](https://docs.github.com/rest/issues/events#list-issue-events-for-a-repository)
  pub fn list_events_for_repo(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
  ) -> Request<(), IssuesListEventsForRepoQuery, Vec<IssueEvent>> {
    let owner = owner.into();
    let repo = repo.into();
    let url = format!("/repos/{owner}/{repo}/issues/events");

    Request::<(), IssuesListEventsForRepoQuery, Vec<IssueEvent>>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **Get an issue event**
  ///
  /// Gets a single event by the event id.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/events#get-an-issue-event](https://docs.github.com/rest/issues/events#get-an-issue-event)
  pub fn get_event(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    event_id: impl Into<i64>,
  ) -> Request<(), (), IssueEvent> {
    let owner = owner.into();
    let repo = repo.into();
    let event_id = event_id.into();
    let url = format!("/repos/{owner}/{repo}/issues/events/{event_id}");

    Request::<(), (), IssueEvent>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **Get an issue**
  ///
  /// The API returns a [`301 Moved Permanently` status](https://docs.github.com/rest/guides/best-practices-for-using-the-rest-api#follow-redirects) if the issue was
  /// [transferred](https://docs.github.com/articles/transferring-an-issue-to-another-repository/) to another repository. If
  /// the issue was transferred to or deleted from a repository where the authenticated user lacks read access, the API
  /// returns a `404 Not Found` status. If the issue was deleted from a repository where the authenticated user has read
  /// access, the API returns a `410 Gone` status. To receive webhook events for transferred and deleted issues, subscribe
  /// to the [`issues`](https://docs.github.com/webhooks/event-payloads/#issues) webhook.
  ///
  /// **Note**: GitHub's REST API considers every pull request an issue, but not every issue is a pull request. For this
  /// reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by
  /// the `pull_request` key. Be aware that the `id` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull
  /// request id, use the "[List pull requests](https://docs.github.com/rest/pulls/pulls#list-pull-requests)" endpoint.
  ///
  /// This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types)."
  ///
  /// - **`application/vnd.github.raw+json`**: Returns the raw markdown body. Response will include `body`. This is the default if you do not pass any specific media type.
  /// - **`application/vnd.github.text+json`**: Returns a text only representation of the markdown body. Response will include `body_text`.
  /// - **`application/vnd.github.html+json`**: Returns HTML rendered from the body's markdown. Response will include `body_html`.
  /// - **`application/vnd.github.full+json`**: Returns raw, text, and HTML representations. Response will include `body`, `body_text`, and `body_html`.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/issues#get-an-issue](https://docs.github.com/rest/issues/issues#get-an-issue)
  pub fn get(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    issue_number: impl Into<i64>,
  ) -> Request<(), (), Issue> {
    let owner = owner.into();
    let repo = repo.into();
    let issue_number = issue_number.into();
    let url = format!("/repos/{owner}/{repo}/issues/{issue_number}");

    Request::<(), (), Issue>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **Update an issue**
  ///
  /// Issue owners and users with push access can edit an issue.
  ///
  /// This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types)."
  ///
  /// - **`application/vnd.github.raw+json`**: Returns the raw markdown body. Response will include `body`. This is the default if you do not pass any specific media type.
  /// - **`application/vnd.github.text+json`**: Returns a text only representation of the markdown body. Response will include `body_text`.
  /// - **`application/vnd.github.html+json`**: Returns HTML rendered from the body's markdown. Response will include `body_html`.
  /// - **`application/vnd.github.full+json`**: Returns raw, text, and HTML representations. Response will include `body`, `body_text`, and `body_html`.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/issues#update-an-issue](https://docs.github.com/rest/issues/issues#update-an-issue)
  pub fn update(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    issue_number: impl Into<i64>,
  ) -> Request<IssuesUpdateRequest, (), Issue> {
    let owner = owner.into();
    let repo = repo.into();
    let issue_number = issue_number.into();
    let url = format!("/repos/{owner}/{repo}/issues/{issue_number}");

    Request::<IssuesUpdateRequest, (), Issue>::builder(&self.config)
      .patch(url)
      .build()
  }

  /// **Add assignees to an issue**
  ///
  /// Adds up to 10 assignees to an issue. Users already assigned to an issue are not replaced.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/assignees#add-assignees-to-an-issue](https://docs.github.com/rest/issues/assignees#add-assignees-to-an-issue)
  pub fn add_assignees(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    issue_number: impl Into<i64>,
  ) -> Request<IssuesAddAssigneesRequest, (), Issue> {
    let owner = owner.into();
    let repo = repo.into();
    let issue_number = issue_number.into();
    let url = format!("/repos/{owner}/{repo}/issues/{issue_number}/assignees");

    Request::<IssuesAddAssigneesRequest, (), Issue>::builder(&self.config)
      .post(url)
      .build()
  }

  /// **Remove assignees from an issue**
  ///
  /// Removes one or more assignees from an issue.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/assignees#remove-assignees-from-an-issue](https://docs.github.com/rest/issues/assignees#remove-assignees-from-an-issue)
  pub fn remove_assignees(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    issue_number: impl Into<i64>,
  ) -> Request<IssuesRemoveAssigneesRequest, (), Issue> {
    let owner = owner.into();
    let repo = repo.into();
    let issue_number = issue_number.into();
    let url = format!("/repos/{owner}/{repo}/issues/{issue_number}/assignees");

    Request::<IssuesRemoveAssigneesRequest, (), Issue>::builder(&self.config)
      .delete(url)
      .build()
  }

  /// **Check if a user can be assigned to a issue**
  ///
  /// Checks if a user has permission to be assigned to a specific issue.
  ///
  /// If the `assignee` can be assigned to this issue, a `204` status code with no content is returned.
  ///
  /// Otherwise a `404` status code is returned.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/assignees#check-if-a-user-can-be-assigned-to-a-issue](https://docs.github.com/rest/issues/assignees#check-if-a-user-can-be-assigned-to-a-issue)
  pub fn check_user_can_be_assigned_to_issue(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    issue_number: impl Into<i64>,
    assignee: impl Into<String>,
  ) -> NoContentRequest<(), ()> {
    let owner = owner.into();
    let repo = repo.into();
    let issue_number = issue_number.into();
    let assignee = assignee.into();
    let url = format!("/repos/{owner}/{repo}/issues/{issue_number}/assignees/{assignee}");

    NoContentRequest::<(), ()>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **List issue comments**
  ///
  /// You can use the REST API to list comments on issues and pull requests. Every pull request is an issue, but not every issue is a pull request.
  ///
  /// Issue comments are ordered by ascending ID.
  ///
  /// This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types)."
  ///
  /// - **`application/vnd.github.raw+json`**: Returns the raw markdown body. Response will include `body`. This is the default if you do not pass any specific media type.
  /// - **`application/vnd.github.text+json`**: Returns a text only representation of the markdown body. Response will include `body_text`.
  /// - **`application/vnd.github.html+json`**: Returns HTML rendered from the body's markdown. Response will include `body_html`.
  /// - **`application/vnd.github.full+json`**: Returns raw, text, and HTML representations. Response will include `body`, `body_text`, and `body_html`.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/comments#list-issue-comments](https://docs.github.com/rest/issues/comments#list-issue-comments)
  pub fn list_comments(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    issue_number: impl Into<i64>,
  ) -> Request<(), IssuesListCommentsQuery, Vec<IssueComment>> {
    let owner = owner.into();
    let repo = repo.into();
    let issue_number = issue_number.into();
    let url = format!("/repos/{owner}/{repo}/issues/{issue_number}/comments");

    Request::<(), IssuesListCommentsQuery, Vec<IssueComment>>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **Create an issue comment**
  ///
  /// You can use the REST API to create comments on issues and pull requests. Every pull request is an issue, but not every issue is a pull request.
  ///
  /// This endpoint triggers [notifications](https://docs.github.com/github/managing-subscriptions-and-notifications-on-github/about-notifications).
  /// Creating content too quickly using this endpoint may result in secondary rate limiting.
  /// For more information, see "[Rate limits for the API](https://docs.github.com/rest/overview/rate-limits-for-the-rest-api#about-secondary-rate-limits)"
  /// and "[Best practices for using the REST API](https://docs.github.com/rest/guides/best-practices-for-using-the-rest-api)."
  ///
  /// This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types)."
  ///
  /// - **`application/vnd.github.raw+json`**: Returns the raw markdown body. Response will include `body`. This is the default if you do not pass any specific media type.
  /// - **`application/vnd.github.text+json`**: Returns a text only representation of the markdown body. Response will include `body_text`.
  /// - **`application/vnd.github.html+json`**: Returns HTML rendered from the body's markdown. Response will include `body_html`.
  /// - **`application/vnd.github.full+json`**: Returns raw, text, and HTML representations. Response will include `body`, `body_text`, and `body_html`.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/comments#create-an-issue-comment](https://docs.github.com/rest/issues/comments#create-an-issue-comment)
  pub fn create_comment(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    issue_number: impl Into<i64>,
  ) -> Request<IssuesCreateCommentRequest, (), IssueComment> {
    let owner = owner.into();
    let repo = repo.into();
    let issue_number = issue_number.into();
    let url = format!("/repos/{owner}/{repo}/issues/{issue_number}/comments");

    Request::<IssuesCreateCommentRequest, (), IssueComment>::builder(&self.config)
      .post(url)
      .build()
  }

  /// **List issue events**
  ///
  /// Lists all events for an issue.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/events#list-issue-events](https://docs.github.com/rest/issues/events#list-issue-events)
  pub fn list_events(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    issue_number: impl Into<i64>,
  ) -> Request<(), IssuesListEventsQuery, Vec<IssueEventForIssue>> {
    let owner = owner.into();
    let repo = repo.into();
    let issue_number = issue_number.into();
    let url = format!("/repos/{owner}/{repo}/issues/{issue_number}/events");

    Request::<(), IssuesListEventsQuery, Vec<IssueEventForIssue>>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **List labels for an issue**
  ///
  /// Lists all labels for an issue.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/labels#list-labels-for-an-issue](https://docs.github.com/rest/issues/labels#list-labels-for-an-issue)
  pub fn list_labels_on_issue(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    issue_number: impl Into<i64>,
  ) -> Request<(), IssuesListLabelsOnIssueQuery, Vec<Label>> {
    let owner = owner.into();
    let repo = repo.into();
    let issue_number = issue_number.into();
    let url = format!("/repos/{owner}/{repo}/issues/{issue_number}/labels");

    Request::<(), IssuesListLabelsOnIssueQuery, Vec<Label>>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **Add labels to an issue**
  ///
  /// Adds labels to an issue. If you provide an empty array of labels, all labels are removed from the issue.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/labels#add-labels-to-an-issue](https://docs.github.com/rest/issues/labels#add-labels-to-an-issue)
  pub fn add_labels(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    issue_number: impl Into<i64>,
  ) -> Request<IssuesAddLabelsRequest, (), Vec<Label>> {
    let owner = owner.into();
    let repo = repo.into();
    let issue_number = issue_number.into();
    let url = format!("/repos/{owner}/{repo}/issues/{issue_number}/labels");

    Request::<IssuesAddLabelsRequest, (), Vec<Label>>::builder(&self.config)
      .post(url)
      .build()
  }

  /// **Set labels for an issue**
  ///
  /// Removes any previous labels and sets the new labels for an issue.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/labels#set-labels-for-an-issue](https://docs.github.com/rest/issues/labels#set-labels-for-an-issue)
  pub fn set_labels(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    issue_number: impl Into<i64>,
  ) -> Request<IssuesSetLabelsRequest, (), Vec<Label>> {
    let owner = owner.into();
    let repo = repo.into();
    let issue_number = issue_number.into();
    let url = format!("/repos/{owner}/{repo}/issues/{issue_number}/labels");

    Request::<IssuesSetLabelsRequest, (), Vec<Label>>::builder(&self.config)
      .put(url)
      .build()
  }

  /// **Remove all labels from an issue**
  ///
  /// Removes all labels from an issue.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/labels#remove-all-labels-from-an-issue](https://docs.github.com/rest/issues/labels#remove-all-labels-from-an-issue)
  pub fn remove_all_labels(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    issue_number: impl Into<i64>,
  ) -> NoContentRequest<(), ()> {
    let owner = owner.into();
    let repo = repo.into();
    let issue_number = issue_number.into();
    let url = format!("/repos/{owner}/{repo}/issues/{issue_number}/labels");

    NoContentRequest::<(), ()>::builder(&self.config)
      .delete(url)
      .build()
  }

  /// **Remove a label from an issue**
  ///
  /// Removes the specified label from the issue, and returns the remaining labels on the issue. This endpoint returns a `404 Not Found` status if the label does not exist.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/labels#remove-a-label-from-an-issue](https://docs.github.com/rest/issues/labels#remove-a-label-from-an-issue)
  pub fn remove_label(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    issue_number: impl Into<i64>,
    name: impl Into<String>,
  ) -> Request<(), (), Vec<Label>> {
    let owner = owner.into();
    let repo = repo.into();
    let issue_number = issue_number.into();
    let name = name.into();
    let url = format!("/repos/{owner}/{repo}/issues/{issue_number}/labels/{name}");

    Request::<(), (), Vec<Label>>::builder(&self.config)
      .delete(url)
      .build()
  }

  /// **Lock an issue**
  ///
  /// Users with push access can lock an issue or pull request's conversation.
  ///
  /// Note that, if you choose not to pass any parameters, you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see "[HTTP method](https://docs.github.com/rest/guides/getting-started-with-the-rest-api#http-method)."
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/issues#lock-an-issue](https://docs.github.com/rest/issues/issues#lock-an-issue)
  pub fn lock(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    issue_number: impl Into<i64>,
  ) -> NoContentRequest<IssuesLockRequest, ()> {
    let owner = owner.into();
    let repo = repo.into();
    let issue_number = issue_number.into();
    let url = format!("/repos/{owner}/{repo}/issues/{issue_number}/lock");

    NoContentRequest::<IssuesLockRequest, ()>::builder(&self.config)
      .put(url)
      .build()
  }

  /// **Unlock an issue**
  ///
  /// Users with push access can unlock an issue's conversation.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/issues#unlock-an-issue](https://docs.github.com/rest/issues/issues#unlock-an-issue)
  pub fn unlock(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    issue_number: impl Into<i64>,
  ) -> NoContentRequest<(), ()> {
    let owner = owner.into();
    let repo = repo.into();
    let issue_number = issue_number.into();
    let url = format!("/repos/{owner}/{repo}/issues/{issue_number}/lock");

    NoContentRequest::<(), ()>::builder(&self.config)
      .delete(url)
      .build()
  }

  /// **List timeline events for an issue**
  ///
  /// List all timeline events for an issue.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/timeline#list-timeline-events-for-an-issue](https://docs.github.com/rest/issues/timeline#list-timeline-events-for-an-issue)
  pub fn list_events_for_timeline(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    issue_number: impl Into<i64>,
  ) -> Request<(), IssuesListEventsForTimelineQuery, Vec<TimelineIssueEvents>> {
    let owner = owner.into();
    let repo = repo.into();
    let issue_number = issue_number.into();
    let url = format!("/repos/{owner}/{repo}/issues/{issue_number}/timeline");

    Request::<(), IssuesListEventsForTimelineQuery, Vec<TimelineIssueEvents>>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **List labels for a repository**
  ///
  /// Lists all labels for a repository.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/labels#list-labels-for-a-repository](https://docs.github.com/rest/issues/labels#list-labels-for-a-repository)
  pub fn list_labels_for_repo(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
  ) -> Request<(), IssuesListLabelsForRepoQuery, Vec<Label>> {
    let owner = owner.into();
    let repo = repo.into();
    let url = format!("/repos/{owner}/{repo}/labels");

    Request::<(), IssuesListLabelsForRepoQuery, Vec<Label>>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **Create a label**
  ///
  /// Creates a label for the specified repository with the given name and color. The name and color parameters are required. The color must be a valid [hexadecimal color code](http://www.color-hex.com/).
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/labels#create-a-label](https://docs.github.com/rest/issues/labels#create-a-label)
  pub fn create_label(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
  ) -> Request<IssuesCreateLabelRequest, (), Label> {
    let owner = owner.into();
    let repo = repo.into();
    let url = format!("/repos/{owner}/{repo}/labels");

    Request::<IssuesCreateLabelRequest, (), Label>::builder(&self.config)
      .post(url)
      .build()
  }

  /// **Get a label**
  ///
  /// Gets a label using the given name.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/labels#get-a-label](https://docs.github.com/rest/issues/labels#get-a-label)
  pub fn get_label(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    name: impl Into<String>,
  ) -> Request<(), (), Label> {
    let owner = owner.into();
    let repo = repo.into();
    let name = name.into();
    let url = format!("/repos/{owner}/{repo}/labels/{name}");

    Request::<(), (), Label>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **Update a label**
  ///
  /// Updates a label using the given label name.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/labels#update-a-label](https://docs.github.com/rest/issues/labels#update-a-label)
  pub fn update_label(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    name: impl Into<String>,
  ) -> Request<IssuesUpdateLabelRequest, (), Label> {
    let owner = owner.into();
    let repo = repo.into();
    let name = name.into();
    let url = format!("/repos/{owner}/{repo}/labels/{name}");

    Request::<IssuesUpdateLabelRequest, (), Label>::builder(&self.config)
      .patch(url)
      .build()
  }

  /// **Delete a label**
  ///
  /// Deletes a label using the given label name.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/labels#delete-a-label](https://docs.github.com/rest/issues/labels#delete-a-label)
  pub fn delete_label(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    name: impl Into<String>,
  ) -> NoContentRequest<(), ()> {
    let owner = owner.into();
    let repo = repo.into();
    let name = name.into();
    let url = format!("/repos/{owner}/{repo}/labels/{name}");

    NoContentRequest::<(), ()>::builder(&self.config)
      .delete(url)
      .build()
  }

  /// **List milestones**
  ///
  /// Lists milestones for a repository.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/milestones#list-milestones](https://docs.github.com/rest/issues/milestones#list-milestones)
  pub fn list_milestones(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
  ) -> Request<(), IssuesListMilestonesQuery, Vec<Milestone>> {
    let owner = owner.into();
    let repo = repo.into();
    let url = format!("/repos/{owner}/{repo}/milestones");

    Request::<(), IssuesListMilestonesQuery, Vec<Milestone>>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **Create a milestone**
  ///
  /// Creates a milestone.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/milestones#create-a-milestone](https://docs.github.com/rest/issues/milestones#create-a-milestone)
  pub fn create_milestone(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
  ) -> Request<IssuesCreateMilestoneRequest, (), Milestone> {
    let owner = owner.into();
    let repo = repo.into();
    let url = format!("/repos/{owner}/{repo}/milestones");

    Request::<IssuesCreateMilestoneRequest, (), Milestone>::builder(&self.config)
      .post(url)
      .build()
  }

  /// **Get a milestone**
  ///
  /// Gets a milestone using the given milestone number.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/milestones#get-a-milestone](https://docs.github.com/rest/issues/milestones#get-a-milestone)
  pub fn get_milestone(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    milestone_number: impl Into<i64>,
  ) -> Request<(), (), Milestone> {
    let owner = owner.into();
    let repo = repo.into();
    let milestone_number = milestone_number.into();
    let url = format!("/repos/{owner}/{repo}/milestones/{milestone_number}");

    Request::<(), (), Milestone>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **Update a milestone**
  ///
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/milestones#update-a-milestone](https://docs.github.com/rest/issues/milestones#update-a-milestone)
  pub fn update_milestone(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    milestone_number: impl Into<i64>,
  ) -> Request<IssuesUpdateMilestoneRequest, (), Milestone> {
    let owner = owner.into();
    let repo = repo.into();
    let milestone_number = milestone_number.into();
    let url = format!("/repos/{owner}/{repo}/milestones/{milestone_number}");

    Request::<IssuesUpdateMilestoneRequest, (), Milestone>::builder(&self.config)
      .patch(url)
      .build()
  }

  /// **Delete a milestone**
  ///
  /// Deletes a milestone using the given milestone number.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/milestones#delete-a-milestone](https://docs.github.com/rest/issues/milestones#delete-a-milestone)
  pub fn delete_milestone(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    milestone_number: impl Into<i64>,
  ) -> NoContentRequest<(), ()> {
    let owner = owner.into();
    let repo = repo.into();
    let milestone_number = milestone_number.into();
    let url = format!("/repos/{owner}/{repo}/milestones/{milestone_number}");

    NoContentRequest::<(), ()>::builder(&self.config)
      .delete(url)
      .build()
  }

  /// **List labels for issues in a milestone**
  ///
  /// Lists labels for issues in a milestone.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/labels#list-labels-for-issues-in-a-milestone](https://docs.github.com/rest/issues/labels#list-labels-for-issues-in-a-milestone)
  pub fn list_labels_for_milestone(
    &self,
    owner: impl Into<String>,
    repo: impl Into<String>,
    milestone_number: impl Into<i64>,
  ) -> Request<(), IssuesListLabelsForMilestoneQuery, Vec<Label>> {
    let owner = owner.into();
    let repo = repo.into();
    let milestone_number = milestone_number.into();
    let url = format!("/repos/{owner}/{repo}/milestones/{milestone_number}/labels");

    Request::<(), IssuesListLabelsForMilestoneQuery, Vec<Label>>::builder(&self.config)
      .get(url)
      .build()
  }

  /// **List user account issues assigned to the authenticated user**
  ///
  /// List issues across owned and member repositories assigned to the authenticated user.
  ///
  /// **Note**: GitHub's REST API considers every pull request an issue, but not every issue is a pull request. For this
  /// reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by
  /// the `pull_request` key. Be aware that the `id` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull
  /// request id, use the "[List pull requests](https://docs.github.com/rest/pulls/pulls#list-pull-requests)" endpoint.
  ///
  /// This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types)."
  ///
  /// - **`application/vnd.github.raw+json`**: Returns the raw markdown body. Response will include `body`. This is the default if you do not pass any specific media type.
  /// - **`application/vnd.github.text+json`**: Returns a text only representation of the markdown body. Response will include `body_text`.
  /// - **`application/vnd.github.html+json`**: Returns HTML rendered from the body's markdown. Response will include `body_html`.
  /// - **`application/vnd.github.full+json`**: Returns raw, text, and HTML representations. Response will include `body`, `body_text`, and `body_html`.
  ///
  /// *Documentation*: [https://docs.github.com/rest/issues/issues#list-user-account-issues-assigned-to-the-authenticated-user](https://docs.github.com/rest/issues/issues#list-user-account-issues-assigned-to-the-authenticated-user)
  pub fn list_for_authenticated_user(
    &self,
  ) -> Request<(), IssuesListForAuthenticatedUserQuery, Vec<Issue>> {
    let url = format!("/user/issues");

    Request::<(), IssuesListForAuthenticatedUserQuery, Vec<Issue>>::builder(&self.config)
      .get(url)
      .build()
  }
}