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
//! Get data about the currently authenticated user.
use crate::models::interaction_limits::{
InteractionLimit, InteractionLimitExpiry, InteractionLimitType,
};
use crate::models::{interaction_limits, UpdateUserProfile};
use crate::{
models::{self, gists::Gist, orgs::MembershipInvitation, Installation, Repository},
Octocrab, Page, Result,
};
use chrono::{DateTime, Utc};
/// Handler for the current authenication API. **Note** All of the methods
/// provided below require at least some authenication such as personal token
/// in order to be used.
///
/// Created with [`Octocrab::current`].
pub struct CurrentAuthHandler<'octo> {
crab: &'octo Octocrab,
}
impl<'octo> CurrentAuthHandler<'octo> {
pub(crate) fn new(crab: &'octo Octocrab) -> Self {
Self { crab }
}
/// Fetches information about the current user.
pub async fn user(&self) -> Result<models::Author> {
self.crab.get("/user", None::<&()>).await
}
/// ### Update the authenticated user
///
///works with the following fine-grained token types:
///
/// * [GitHub App user access tokens](https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-user-access-token-for-a-github-app)
/// * [Fine-grained personal access tokens](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token)
///
/// The fine-grained token must have the following permission set:
///
/// * "Profile" user permissions (write)
pub async fn update_user(&self, new_data: UpdateUserProfile) -> Result<models::Author> {
let params = serde_json::to_value(new_data).unwrap();
self.crab.patch("/user", Some(¶ms)).await
}
/// Fetches information about the currently authenticated app.
///
/// ```no_run
/// # async fn run() -> octocrab::Result<()> {
/// # let octocrab = octocrab::Octocrab::default();
///
/// let app = octocrab
/// .current()
/// .app()
/// .await?;
///
/// println!("{}", app.name);
/// # Ok(())
/// # }
/// ```
pub async fn app(&self) -> Result<models::App> {
self.crab.get("/app", None::<&()>).await
}
/// List repositories starred by current authenticated user.
///
/// ```no_run
/// # async fn run() -> octocrab::Result<()> {
/// octocrab::instance()
/// .current()
/// .list_repos_starred_by_authenticated_user()
/// .send()
/// .await?;
/// # Ok(())
/// # }
/// ```
///
/// [See the GitHub API documentation](https://docs.github.com/en/rest/reference/activity#list-repositories-starred-by-the-authenticated-user)
pub fn list_repos_starred_by_authenticated_user(&self) -> ListStarredReposBuilder<'octo> {
ListStarredReposBuilder::new(self.crab)
}
/// Lists repositories that the current authenticated user.
///
/// ```no_run
/// # async fn run() -> octocrab::Result<()> {
/// octocrab::instance()
/// .current()
/// .list_repos_for_authenticated_user()
/// .send()
/// .await?;
/// # Ok(())
/// # }
/// ```
///
/// [See the GitHub API documentation](https://docs.github.com/en/rest/reference/repos#list-repositories-for-the-authenticated-user)
pub fn list_repos_for_authenticated_user(&self) -> ListReposForAuthenticatedUserBuilder<'octo> {
ListReposForAuthenticatedUserBuilder::new(self.crab)
}
/// List gists for the current authenticated user.
///
/// # Examples
///
/// 1. The following snippet retrieves the most recent gist:
/// ```no_run
/// # async fn run() -> octocrab::Result<()> {
/// octocrab::instance()
/// .current()
/// .list_gists_for_authenticated_user()
/// .per_page(1)
/// .page(1)
/// .send()
/// .await?;
/// # Ok(())
/// # }
/// ```
///
/// 2. This retrieves the first 100 gists, which is maximum number that
/// can be fetched in a single page:
/// ```no_run
/// # async fn run() -> octocrab::Result<()> {
/// octocrab::instance()
/// .current()
/// .list_gists_for_authenticated_user()
/// .per_page(100)
/// .page(1)
/// .send()
/// .await?;
/// # Ok(())
/// # }
/// ```
///
/// [See the GitHub API documentation](https://docs.github.com/en/rest/gists/gists?apiVersion=latest#list-gists-for-the-authenticated-user)
pub fn list_gists_for_authenticated_user(&self) -> ListGistsForAuthenticatedUserBuilder<'octo> {
// self.crab.get("/gists", None::<&()>).await
ListGistsForAuthenticatedUserBuilder::new(self.crab)
}
/// List gists that were starred by the authenticated user.
pub fn list_gists_starred_by_authenticated_user(&self) -> ListStarredGistsBuilder<'octo> {
ListStarredGistsBuilder::new(self.crab)
}
/// Lists installations of your GitHub App that the authenticated user has explicit permission (:read, :write, or :admin) to access.
///
/// ```no_run
/// # async fn run() -> octocrab::Result<()> {
/// octocrab::instance()
/// .current()
/// .list_app_installations_accessible_to_user()
/// .send()
/// .await?;
/// # Ok(())
/// # }
/// ```
///
/// [See the GitHub API documentation](https://docs.github.com/en/rest/apps/installations?apiVersion=2022-11-28#list-app-installations-accessible-to-the-user-access-token)
pub fn list_app_installations_accessible_to_user(
&self,
) -> ListAppInstallationsAccessibleToUserBuilder<'octo> {
ListAppInstallationsAccessibleToUserBuilder::new(self.crab)
}
/// Lists organizations that the current authenticated user is a member of.
///
/// ```no_run
/// # async fn run() -> octocrab::Result<()> {
/// octocrab::instance()
/// .current()
/// .list_org_memberships_for_authenticated_user()
/// .send()
/// .await?;
/// # Ok(())
/// # }
/// ```
///
/// [See the GitHub API documentation](https://docs.github.com/en/rest/orgs/members#list-organization-memberships-for-the-authenticated-user)
pub fn list_org_memberships_for_authenticated_user(
&self,
) -> ListOrgMembershipsForAuthenticatedUserBuilder<'octo> {
ListOrgMembershipsForAuthenticatedUserBuilder::new(self.crab)
}
/// ### Get interaction restrictions for your public repositories
///
/// Shows which type of GitHub user can interact with your public repositories and when the restriction expires.
///
/// Fine-grained access tokens for "Get interaction restrictions for your public repositories"
///
/// This endpoint works with the following fine-grained token types:
///
/// - GitHub App user access tokens
/// - Fine-grained personal access tokens
///
/// The fine-grained token must have the following permission set:
///
/// - "Interaction limits" user permissions (read)
///
pub async fn get_interaction_restrictions(
&self,
) -> crate::Result<interaction_limits::InteractionLimit> {
let route = "/user/interaction-limits";
self.crab.get(route, None::<&()>).await
}
/// ### Set interaction restrictions for your public repositories
///
/// Temporarily restricts which type of GitHub user can interact with your public repositories. Setting the interaction limit at the user level will overwrite any interaction limits that are set for individual repositories owned by the user.
///
/// Fine-grained access tokens for "Set interaction restrictions for your public repositories"
///
/// This endpoint works with the following fine-grained token types:
///
/// - GitHub App user access tokens
/// - Fine-grained personal access tokens
///
/// The fine-grained token must have the following permission set:
///
/// - "Interaction limits" user permissions (write)
///
pub async fn set_interaction_restrictions(
&self,
limit_type: InteractionLimitType,
expiry: InteractionLimitExpiry,
) -> crate::Result<InteractionLimit> {
let route = "/user/interaction-limits";
let body = serde_json::json!({
"limit": limit_type,
"expiry": expiry,
});
self.crab.put(route, Some(&body)).await
}
/// ### Remove interaction restrictions from your public repositories
///
/// Removes any interaction restrictions from your public repositories.
///
/// Fine-grained access tokens for "Remove interaction restrictions from your public repositories"
///
/// This endpoint works with the following fine-grained token types:
///
/// - GitHub App user access tokens
/// - Fine-grained personal access tokens
///
/// The fine-grained token must have the following permission set:
///
/// - "Interaction limits" user permissions (write)
///
pub async fn remove_interaction_restrictions(&self) -> crate::Result<()> {
let route = "/user/interaction-limits";
let response = self.crab._delete(route, None::<&()>).await?;
crate::map_github_error(response).await.map(drop)
}
}
/// A builder pattern struct for listing starred repositories.
///
/// Created by [`CurrentAuthHandler::list_repos_starred_by_authenticated_user`].
///
/// [`CurrentAuthHandler::list_repos_starred_by_authenticated_user`]: ./struct.CurrentAuthHandler.html#method.list_repos_starred_by_authenticated_user
#[derive(serde::Serialize)]
pub struct ListStarredReposBuilder<'octo> {
#[serde(skip)]
crab: &'octo Octocrab,
#[serde(skip_serializing_if = "Option::is_none")]
sort: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
direction: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
per_page: Option<u8>,
#[serde(skip_serializing_if = "Option::is_none")]
page: Option<u8>,
}
impl<'octo> ListStarredReposBuilder<'octo> {
fn new(crab: &'octo Octocrab) -> Self {
Self {
crab,
sort: None,
direction: None,
per_page: None,
page: None,
}
}
/// One of `created` (when the repository was starred) or `updated` (when it was last pushed to).
///
/// [See the GitHub API documentation](https://docs.github.com/en/rest/reference/activity#list-repositories-starred-by-the-authenticated-user--parameters)
pub fn sort(mut self, sort: impl Into<String>) -> Self {
self.sort = Some(sort.into());
self
}
/// One of `asc` (ascending) or `desc` (descending).
///
/// [See the GitHub API documentation](https://docs.github.com/en/rest/reference/activity#list-repositories-starred-by-the-authenticated-user--parameters)
pub fn direction(mut self, direction: impl Into<String>) -> Self {
self.direction = Some(direction.into());
self
}
/// Results per page (max 100).
///
/// [See the GitHub API documentation](https://docs.github.com/en/rest/reference/activity#list-repositories-starred-by-the-authenticated-user--parameters)
pub fn per_page(mut self, per_page: impl Into<u8>) -> Self {
self.per_page = Some(per_page.into());
self
}
/// Page number of the results to fetch.
///
/// [See the GitHub API documentation](https://docs.github.com/en/rest/reference/activity#list-repositories-starred-by-the-authenticated-user--parameters)
pub fn page(mut self, page: impl Into<u8>) -> Self {
self.page = Some(page.into());
self
}
/// Sends the actual request.
pub async fn send(self) -> crate::Result<Page<Repository>> {
self.crab.get("/user/starred", Some(&self)).await
}
}
/// A builder pattern struct for listing repositories for authenticated user.
///
/// Created by [`CurrentAuthHandler::list_repos_for_authenticated_user`].
///
/// [`CurrentAuthHandler::list_repos_for_authenticated_user`]: ./struct.CurrentAuthHandler.html#method.list_repos_for_authenticated_user
#[derive(serde::Serialize)]
pub struct ListReposForAuthenticatedUserBuilder<'octo> {
#[serde(skip)]
crab: &'octo Octocrab,
#[serde(skip_serializing_if = "Option::is_none")]
visibility: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
affiliation: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
r#type: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
sort: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
direction: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
per_page: Option<u8>,
#[serde(skip_serializing_if = "Option::is_none")]
page: Option<u8>,
#[serde(skip_serializing_if = "Option::is_none")]
since: Option<DateTime<Utc>>,
#[serde(skip_serializing_if = "Option::is_none")]
before: Option<DateTime<Utc>>,
}
impl<'octo> ListReposForAuthenticatedUserBuilder<'octo> {
fn new(crab: &'octo Octocrab) -> Self {
Self {
crab,
visibility: None,
affiliation: None,
r#type: None,
sort: None,
direction: None,
per_page: None,
page: None,
since: None,
before: None,
}
}
/// Can be one of `all`, `public`, or `private`. Note: For GitHub AE, can be one of `all`, `internal`, or `private`.
///
/// [See the GitHub API documentation](https://docs.github.com/en/rest/reference/repos#list-repositories-for-the-authenticated-user--parameters)
pub fn visibility(mut self, visibility: impl Into<String>) -> Self {
self.visibility = Some(visibility.into());
self
}
/// Comma-separated list of values. Can include:
/// * `owner`: Repositories that are owned by the authenticated user.
/// * `collaborator`: Repositories that the user has been added to as a collaborator.
/// * `organization_member`: Repositories that the user has access to through being a member of an organization. This includes every repository on every team that the user is on.
///
/// [See the GitHub API documentation](https://docs.github.com/en/rest/reference/repos#list-repositories-for-the-authenticated-user--parameters)
pub fn affiliation(mut self, affiliation: impl Into<String>) -> Self {
self.affiliation = Some(affiliation.into());
self
}
/// Can be one of `all`, `owner`, `public`, `private`, `member`.
///
/// Note: For GitHub AE, can be one of `all`, `owner`, `internal`, `private`, `member`.
///
/// [See the GitHub API documentation](https://docs.github.com/en/rest/reference/repos#list-repositories-for-the-authenticated-user--parameters)
pub fn type_(mut self, type_: impl Into<String>) -> Self {
self.r#type = Some(type_.into());
self
}
/// Can be one of `created`, `updated`, `pushed`, `full_name`.
///
/// [See the GitHub API documentation](https://docs.github.com/en/rest/reference/repos#list-repositories-for-the-authenticated-user--parameters)
pub fn sort(mut self, sort: impl Into<String>) -> Self {
self.sort = Some(sort.into());
self
}
/// Can be one of `asc` or `desc`.
///
/// [See the GitHub API documentation](https://docs.github.com/en/rest/reference/repos#list-repositories-for-the-authenticated-user--parameters)
pub fn direction(mut self, direction: impl Into<String>) -> Self {
self.direction = Some(direction.into());
self
}
/// Results per page (max 100).
///
/// [See the GitHub API documentation](https://docs.github.com/en/rest/reference/repos#list-repositories-for-the-authenticated-user--parameters)
pub fn per_page(mut self, per_page: impl Into<u8>) -> Self {
self.per_page = Some(per_page.into());
self
}
/// Page number of the results to fetch.
///
/// [See the GitHub API documentation](https://docs.github.com/en/rest/reference/repos#list-repositories-for-the-authenticated-user--parameters)
pub fn page(mut self, page: impl Into<u8>) -> Self {
self.page = Some(page.into());
self
}
/// Only show notifications updated after the given time.
///
/// [See the GitHub API documentation](https://docs.github.com/en/rest/reference/repos#list-repositories-for-the-authenticated-user--parameters)
pub fn since(mut self, since: impl Into<DateTime<Utc>>) -> Self {
self.since = Some(since.into());
self
}
/// Only show notifications updated before the given time.
///
/// [See the GitHub API documentation](https://docs.github.com/en/rest/reference/repos#list-repositories-for-the-authenticated-user--parameters)
pub fn before(mut self, before: impl Into<DateTime<Utc>>) -> Self {
self.before = Some(before.into());
self
}
/// Sends the actual request.
pub async fn send(self) -> crate::Result<Page<Repository>> {
self.crab.get("/user/repos", (&self).into()).await
}
}
/// A builder struct for initializing query parameters for use with the
/// `/gists` endpoint.
///
/// Created by: [`CurrentAuthHandler::list_gists_for_authenticated_user`].
///
/// [`CurrentAuthHandler::list_repos_starred_by_authenticated_user`]: ./struct.CurrentAuthHandler.html#method.list_gists_for_authenticated_user
#[derive(serde::Serialize)]
pub struct ListGistsForAuthenticatedUserBuilder<'octo> {
/// Client under use for building the request.
#[serde(skip)]
crab: &'octo Octocrab,
/// Only show gists that were updated after the given ISO 8601 UTC timestamp.
#[serde(skip_serializing_if = "Option::is_none")]
since: Option<DateTime<Utc>>,
/// The number of results per page (max 100).
#[serde(skip_serializing_if = "Option::is_none")]
per_page: Option<u8>,
/// Page number of the results to fetch, starting at 1.
#[serde(skip_serializing_if = "Option::is_none")]
page: Option<u32>,
}
impl<'octo> ListGistsForAuthenticatedUserBuilder<'octo> {
/// Create a new builder using the given client and default options as
/// described in GitHub's API docs.
///
/// [See the GitHub API documentation](https://docs.github.com/en/rest/gists/gists?apiVersion=latest#list-gists-for-the-authenticated-user)
pub fn new(crab: &'octo Octocrab) -> Self {
Self {
crab,
since: None,
per_page: None,
page: None,
}
}
/// Only show gists that were updated after the given ISO 8601 UTC timestamp.
pub fn since(mut self, last_updated: DateTime<Utc>) -> Self {
self.since = Some(last_updated);
self
}
/// The number of results per page (max 100).
pub fn per_page(mut self, count: u8) -> Self {
self.per_page = Some(count);
self
}
/// Page number of the results to fetch, starting at 1.
pub fn page(mut self, page_num: u32) -> Self {
self.page = Some(page_num);
self
}
/// Sends the actual request.
pub async fn send(self) -> crate::Result<Page<Gist>> {
self.crab.get("/gists", Some(&self)).await
}
}
#[derive(serde::Serialize)]
pub struct ListStarredGistsBuilder<'octo> {
/// Client under use for building the request.
#[serde(skip)]
crab: &'octo Octocrab,
/// Only show gists that were starred after the given ISO 8601 UTC timestamp.
#[serde(skip_serializing_if = "Option::is_none")]
since: Option<DateTime<Utc>>,
/// Number of results to return per page. Maximum supported value is `100`.
/// Larger values are clamped to `100`. Defaults to `30`
#[serde(skip_serializing_if = "Option::is_none")]
per_page: Option<u8>,
/// Page number of the results to fetch. Defaults to `1`.
#[serde(skip_serializing_if = "Option::is_none")]
page: Option<u32>,
}
impl<'octo> ListStarredGistsBuilder<'octo> {
pub fn new(crab: &'octo Octocrab) -> Self {
Self {
crab,
since: None,
per_page: None,
page: None,
}
}
/// Only show gists that were starred after the given ISO 8601 UTC timestamp.
pub fn since(mut self, last_updated: DateTime<Utc>) -> Self {
self.since = Some(last_updated);
self
}
/// The page number from the result set to fetch.
pub fn page(mut self, page_num: u32) -> Self {
self.page = Some(page_num);
self
}
pub fn per_page(mut self, count: u8) -> Self {
self.per_page = Some(count);
self
}
/// Sends the actual request.
pub async fn send(self) -> crate::Result<Page<Gist>> {
self.crab.get("/gists/starred", Some(&self)).await
}
}
/// A builder pattern struct for listing organizations the authenticated user is a member of.
///
/// Created by [`CurrentAuthHandler::list_org_memberships_for_authenticated_user`].
///
/// [`CurrentAuthHandler::list_org_memberships_for_authenticated_user`]: ./struct.CurrentAuthHandler.html#method.list_org_memberships_for_authenticated_user
#[derive(serde::Serialize)]
pub struct ListOrgMembershipsForAuthenticatedUserBuilder<'octo> {
#[serde(skip)]
crab: &'octo Octocrab,
#[serde(skip_serializing_if = "Option::is_none")]
per_page: Option<u8>,
#[serde(skip_serializing_if = "Option::is_none")]
page: Option<u8>,
}
impl<'octo> ListOrgMembershipsForAuthenticatedUserBuilder<'octo> {
fn new(crab: &'octo Octocrab) -> Self {
Self {
crab,
per_page: None,
page: None,
}
}
/// Results per page (max 100).
///
/// [See the GitHub API documentation](https://docs.github.com/en/rest/orgs/members#list-organization-memberships-for-the-authenticated-user--parameters)
pub fn per_page(mut self, per_page: impl Into<u8>) -> Self {
self.per_page = Some(per_page.into());
self
}
/// Page number of the results to fetch.
///
/// [See the GitHub API documentation](https://docs.github.com/en/rest/orgs/members#list-organization-memberships-for-the-authenticated-user--parameters)
pub fn page(mut self, page: impl Into<u8>) -> Self {
self.page = Some(page.into());
self
}
/// Sends the actual request.
pub async fn send(self) -> crate::Result<Page<MembershipInvitation>> {
self.crab
.get("/user/memberships/orgs", (&self).into())
.await
}
}
/// A builder pattern struct for listing the installations accessible to a user access token.
///
/// Created by [`CurrentAuthHandler::list_app_installations_accessible_to_user`].
///
/// [`CurrentAuthHandler::list_app_installations_accessible_to_user`]: ./struct.CurrentAuthHandler.html#method.list_app_installations_accessible_to_user
#[derive(serde::Serialize)]
pub struct ListAppInstallationsAccessibleToUserBuilder<'octo> {
#[serde(skip)]
crab: &'octo Octocrab,
#[serde(skip_serializing_if = "Option::is_none")]
per_page: Option<u8>,
#[serde(skip_serializing_if = "Option::is_none")]
page: Option<u8>,
}
impl<'octo> ListAppInstallationsAccessibleToUserBuilder<'octo> {
fn new(crab: &'octo Octocrab) -> Self {
Self {
crab,
per_page: None,
page: None,
}
}
/// Results per page (max 100).
///
/// [See the GitHub API documentation](https://docs.github.com/en/rest/apps/installations?apiVersion=2022-11-28#list-app-installations-accessible-to-the-user-access-token--parameters)
pub fn per_page(mut self, per_page: impl Into<u8>) -> Self {
self.per_page = Some(per_page.into());
self
}
/// Page number of the results to fetch.
///
/// [See the GitHub API documentation](https://docs.github.com/en/rest/apps/installations?apiVersion=2022-11-28#list-app-installations-accessible-to-the-user-access-token--parameters)
pub fn page(mut self, page: impl Into<u8>) -> Self {
self.page = Some(page.into());
self
}
/// Sends the actual request.
pub async fn send(self) -> crate::Result<Page<Installation>> {
self.crab.get("/user/installations", (&self).into()).await
}
}