cnb 0.2.2

CNB (cnb.cool) API client for Rust — typed, async, production-ready
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
// @generated DO NOT EDIT.
//
// Generated from the CNB OpenAPI specification by `cnb-codegen`.
// Run `cargo run -p cnb-codegen --manifest-path codegen/Cargo.toml \
//      -- --spec codegen/spec/swagger.json --out src` to refresh.

#![allow(clippy::all)]
#![allow(missing_docs)]
#![allow(unused_imports)]
#![allow(unused_mut)]

use reqwest::Method;
use serde::Serialize;

use crate::error::{ApiError, Result};
use crate::http::HttpInner;
use crate::models;

// `Repositories` resource client (generated, 15 operations).

/// Resource client.
#[derive(Debug, Clone)]
pub struct RepositoriesClient {
    inner: HttpInner,
}

impl RepositoriesClient {
    /// Construct a new resource client. Normally obtained
    /// via [`crate::ApiClient`] rather than directly.
    pub fn new(inner: HttpInner) -> Self {
        Self { inner }
    }

    /// 仓库归档。Archive a repository.
    ///
    /// `POST /{slug}/-/settings/archive`
    pub async fn archive_repo(&self, slug: String) -> Result<serde_json::Value> {
        let path = format!("/{}/-/settings/archive", slug);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute::<serde_json::Value>(Method::POST, url)
            .await
    }

    /// 创建仓库。Create repositories.
    ///
    /// `POST /{slug}/-/repos`
    pub async fn create_repo(
        &self,
        slug: String,
        body: &crate::models::CreateRepoReq,
    ) -> Result<serde_json::Value> {
        let path = format!("/{}/-/repos", slug);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute_with_body::<serde_json::Value, _>(Method::POST, url, body)
            .await
    }

    /// 删除指定仓库。Delete the specified repository.
    ///
    /// `DELETE /{repo}`
    pub async fn delete_repo(&self, repo: String) -> Result<serde_json::Value> {
        let path = format!("/{}", repo);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute::<serde_json::Value>(Method::DELETE, url)
            .await
    }

    /// 获取指定仓库信息。Get information for the specified repository.
    ///
    /// `GET /{repo}`
    pub async fn get_by_id(&self, repo: String) -> Result<crate::models::Repos4User> {
        let path = format!("/{}", repo);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute::<crate::models::Repos4User>(Method::GET, url)
            .await
    }

    /// 查询组织下访问用户有权限查看到仓库。List the repositories that the user has access to.
    ///
    /// `GET /{slug}/-/repos`
    pub async fn get_group_sub_repos(
        &self,
        slug: String,
        query: &GetGroupSubReposQuery,
    ) -> Result<Vec<crate::models::Repos4User>> {
        let path = format!("/{}/-/repos", slug);
        let mut url = self.inner.url(&path)?;
        {
            let mut pairs = url.query_pairs_mut();
            if let Some(v) = query.page {
                pairs.append_pair("page", &v.to_string());
            }
            if let Some(v) = query.page_size {
                pairs.append_pair("page_size", &v.to_string());
            }
            if let Some(ref v) = query.filter_type {
                pairs.append_pair("filter_type", v);
            }
            if let Some(ref v) = query.flags {
                pairs.append_pair("flags", v);
            }
            if let Some(ref v) = query.flags_match {
                pairs.append_pair("flags_match", v);
            }
            if let Some(ref v) = query.status {
                pairs.append_pair("status", v);
            }
            if let Some(ref v) = query.order_by {
                pairs.append_pair("order_by", v);
            }
            if let Some(v) = query.desc {
                pairs.append_pair("desc", &v.to_string());
            }
            if let Some(ref v) = query.descendant {
                pairs.append_pair("descendant", v);
            }
            if let Some(ref v) = query.search {
                pairs.append_pair("search", v);
            }
            drop(pairs);
        }
        self.inner
            .execute::<Vec<crate::models::Repos4User>>(Method::GET, url)
            .await
    }

    /// 获取指定组织的仓库墙列表。List the pinned repositories of a group.
    ///
    /// `GET /{slug}/-/pinned-repos`
    pub async fn get_pinned_repo_by_group(
        &self,
        slug: String,
    ) -> Result<Vec<crate::models::Repos4UserBase>> {
        let path = format!("/{}/-/pinned-repos", slug);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute::<Vec<crate::models::Repos4UserBase>>(Method::GET, url)
            .await
    }

    /// 获取指定用户的用户仓库墙。 Get a list of repositories that the specified user has pinned.
    ///
    /// `GET /users/{username}/pinned-repos`
    pub async fn get_pinned_repo_by_id(
        &self,
        username: String,
    ) -> Result<Vec<crate::models::Repos4User>> {
        let path = format!("/users/{}/pinned-repos", username);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute::<Vec<crate::models::Repos4User>>(Method::GET, url)
            .await
    }

    /// 获取当前用户拥有指定权限及其以上权限的仓库。List repositories owned by the current user with the specified permissions or higher.
    ///
    /// `GET /user/repos`
    pub async fn get_repos(&self, query: &GetReposQuery) -> Result<Vec<crate::models::Repos4User>> {
        let path = "/user/repos".to_string();
        let mut url = self.inner.url(&path)?;
        {
            let mut pairs = url.query_pairs_mut();
            if let Some(v) = query.page {
                pairs.append_pair("page", &v.to_string());
            }
            if let Some(v) = query.page_size {
                pairs.append_pair("page_size", &v.to_string());
            }
            if let Some(ref v) = query.search {
                pairs.append_pair("search", v);
            }
            if let Some(ref v) = query.filter_type {
                pairs.append_pair("filter_type", v);
            }
            if let Some(ref v) = query.role {
                pairs.append_pair("role", v);
            }
            if let Some(ref v) = query.flags {
                pairs.append_pair("flags", v);
            }
            if let Some(ref v) = query.flags_match {
                pairs.append_pair("flags_match", v);
            }
            if let Some(ref v) = query.status {
                pairs.append_pair("status", v);
            }
            if let Some(ref v) = query.order_by {
                pairs.append_pair("order_by", v);
            }
            if let Some(v) = query.desc {
                pairs.append_pair("desc", &v.to_string());
            }
            drop(pairs);
        }
        self.inner
            .execute::<Vec<crate::models::Repos4User>>(Method::GET, url)
            .await
    }

    /// 获取指定用户有指定以上权限并且客人态可见的仓库。List repositories where the specified user has the specified permission level or higher and are visible to guests.
    ///
    /// `GET /users/{username}/repos`
    pub async fn get_repos_by_user_name(
        &self,
        username: String,
        query: &GetReposByUserNameQuery,
    ) -> Result<Vec<crate::models::Repos4User>> {
        let path = format!("/users/{}/repos", username);
        let mut url = self.inner.url(&path)?;
        {
            let mut pairs = url.query_pairs_mut();
            if let Some(ref v) = query.search {
                pairs.append_pair("search", v);
            }
            if let Some(ref v) = query.filter_type {
                pairs.append_pair("filter_type", v);
            }
            if let Some(ref v) = query.flags {
                pairs.append_pair("flags", v);
            }
            if let Some(ref v) = query.flags_match {
                pairs.append_pair("flags_match", v);
            }
            if let Some(ref v) = query.status {
                pairs.append_pair("status", v);
            }
            if let Some(ref v) = query.role {
                pairs.append_pair("role", v);
            }
            if let Some(v) = query.page {
                pairs.append_pair("page", &v.to_string());
            }
            if let Some(v) = query.page_size {
                pairs.append_pair("page_size", &v.to_string());
            }
            if let Some(v) = query.desc {
                pairs.append_pair("desc", &v.to_string());
            }
            if let Some(ref v) = query.order_by {
                pairs.append_pair("order_by", v);
            }
            drop(pairs);
        }
        self.inner
            .execute::<Vec<crate::models::Repos4User>>(Method::GET, url)
            .await
    }

    /// 获取指定仓库的 fork 列表。Get fork list for specified repository.
    ///
    /// `GET /{repo}/-/forks`
    pub async fn list_forks_repos(
        &self,
        repo: String,
        query: &ListForksReposQuery,
    ) -> Result<crate::models::ListForks> {
        let path = format!("/{}/-/forks", repo);
        let mut url = self.inner.url(&path)?;
        {
            let mut pairs = url.query_pairs_mut();
            if let Some(v) = query.start_from_root {
                pairs.append_pair("start_from_root", &v.to_string());
            }
            if let Some(v) = query.page {
                pairs.append_pair("page", &v.to_string());
            }
            if let Some(v) = query.page_size {
                pairs.append_pair("page_size", &v.to_string());
            }
            drop(pairs);
        }
        self.inner
            .execute::<crate::models::ListForks>(Method::GET, url)
            .await
    }

    /// 更新指定组织仓库墙。Update the pinned repositories of a group.
    ///
    /// `PUT /{slug}/-/pinned-repos`
    pub async fn set_pinned_repo_by_group(
        &self,
        slug: String,
        body: &Vec<String>,
    ) -> Result<Vec<crate::models::Repos4UserBase>> {
        let path = format!("/{}/-/pinned-repos", slug);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute_with_body::<Vec<crate::models::Repos4UserBase>, _>(Method::PUT, url, body)
            .await
    }

    /// 改变仓库可见性。Update visibility of repository.
    ///
    /// `POST /{repo}/-/settings/set_visibility`
    pub async fn set_repo_visibility(
        &self,
        repo: String,
        query: &SetRepoVisibilityQuery,
    ) -> Result<serde_json::Value> {
        let path = format!("/{}/-/settings/set_visibility", repo);
        let mut url = self.inner.url(&path)?;
        {
            let mut pairs = url.query_pairs_mut();
            if let Some(ref v) = query.visibility {
                pairs.append_pair("visibility", v);
            }
            drop(pairs);
        }
        self.inner
            .execute::<serde_json::Value>(Method::POST, url)
            .await
    }

    /// 转移仓库。Transfer a repository.
    ///
    /// `POST /{repo}/-/transfer`
    pub async fn transfer_repo(
        &self,
        repo: String,
        body: &crate::models::TransferSlugReq,
    ) -> Result<serde_json::Value> {
        let path = format!("/{}/-/transfer", repo);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute_with_body::<serde_json::Value, _>(Method::POST, url, body)
            .await
    }

    /// 解除仓库归档。Unarchive a repository.
    ///
    /// `POST /{slug}/-/settings/unarchive`
    pub async fn un_archive_repo(&self, slug: String) -> Result<serde_json::Value> {
        let path = format!("/{}/-/settings/unarchive", slug);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute::<serde_json::Value>(Method::POST, url)
            .await
    }

    /// 更新仓库信息, 可更新的内容为: 仓库简介, 仓库站点, 仓库主题, 开源许可证。updates repository details including description, website URL,topics and license type.
    ///
    /// `PATCH /{repo}`
    pub async fn update_repo(
        &self,
        repo: String,
        body: &crate::models::RepoPatch,
    ) -> Result<serde_json::Value> {
        let path = format!("/{}", repo);
        let mut url = self.inner.url(&path)?;
        self.inner
            .execute_with_body::<serde_json::Value, _>(Method::PATCH, url, body)
            .await
    }
}

/// Query parameters for the matching method on the resource client.
#[derive(Debug, Clone, Default, Serialize)]
#[non_exhaustive]
pub struct GetGroupSubReposQuery {
    /// Pagination page number
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub page: Option<i64>,
    /// Pagination page size
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub page_size: Option<i64>,
    /// Repositories type
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub filter_type: Option<String>,
    /// 仓库类型标记,逗号分隔。Repository type flags, comma separated
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub flags: Option<String>,
    /// flags 多值匹配模式。Flags match mode when multiple flags provided
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub flags_match: Option<String>,
    /// 仓库状态。Repository status
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub status: Option<String>,
    /// Order field
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub order_by: Option<String>,
    /// Ordering
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub desc: Option<bool>,
    /// 查全部/查询直接属于当前组织的仓库/查询子组织的仓库。Get all/Get repos belong to current org or sub-organization
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub descendant: Option<String>,
    /// Key word
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub search: Option<String>,
}

impl GetGroupSubReposQuery {
    /// Construct an empty query.
    pub fn new() -> Self {
        Self::default()
    }
    /// Set `page` query parameter.
    pub fn page(mut self, v: impl Into<i64>) -> Self {
        self.page = Some(v.into());
        self
    }
    /// Set `page_size` query parameter.
    pub fn page_size(mut self, v: impl Into<i64>) -> Self {
        self.page_size = Some(v.into());
        self
    }
    /// Set `filter_type` query parameter.
    pub fn filter_type(mut self, v: impl Into<String>) -> Self {
        self.filter_type = Some(v.into());
        self
    }
    /// Set `flags` query parameter.
    pub fn flags(mut self, v: impl Into<String>) -> Self {
        self.flags = Some(v.into());
        self
    }
    /// Set `flags_match` query parameter.
    pub fn flags_match(mut self, v: impl Into<String>) -> Self {
        self.flags_match = Some(v.into());
        self
    }
    /// Set `status` query parameter.
    pub fn status(mut self, v: impl Into<String>) -> Self {
        self.status = Some(v.into());
        self
    }
    /// Set `order_by` query parameter.
    pub fn order_by(mut self, v: impl Into<String>) -> Self {
        self.order_by = Some(v.into());
        self
    }
    /// Set `desc` query parameter.
    pub fn desc(mut self, v: impl Into<bool>) -> Self {
        self.desc = Some(v.into());
        self
    }
    /// Set `descendant` query parameter.
    pub fn descendant(mut self, v: impl Into<String>) -> Self {
        self.descendant = Some(v.into());
        self
    }
    /// Set `search` query parameter.
    pub fn search(mut self, v: impl Into<String>) -> Self {
        self.search = Some(v.into());
        self
    }
}

/// Query parameters for the matching method on the resource client.
#[derive(Debug, Clone, Default, Serialize)]
#[non_exhaustive]
pub struct GetReposQuery {
    /// Pagination page number
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub page: Option<i64>,
    /// Pagination page size
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub page_size: Option<i64>,
    /// Filter by repositories
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub search: Option<String>,
    /// RType
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub filter_type: Option<String>,
    /// 最小仓库权限,默认owner。Minima repository permissions
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub role: Option<String>,
    /// 仓库类型标记,逗号分隔。Repository type flags, comma separated
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub flags: Option<String>,
    /// flags 多值匹配模式。Flags match mode when multiple flags provided
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub flags_match: Option<String>,
    /// 仓库状态。Repository status
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub status: Option<String>,
    /// Order field
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub order_by: Option<String>,
    /// 排序顺序。Ordering.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub desc: Option<bool>,
}

impl GetReposQuery {
    /// Construct an empty query.
    pub fn new() -> Self {
        Self::default()
    }
    /// Set `page` query parameter.
    pub fn page(mut self, v: impl Into<i64>) -> Self {
        self.page = Some(v.into());
        self
    }
    /// Set `page_size` query parameter.
    pub fn page_size(mut self, v: impl Into<i64>) -> Self {
        self.page_size = Some(v.into());
        self
    }
    /// Set `search` query parameter.
    pub fn search(mut self, v: impl Into<String>) -> Self {
        self.search = Some(v.into());
        self
    }
    /// Set `filter_type` query parameter.
    pub fn filter_type(mut self, v: impl Into<String>) -> Self {
        self.filter_type = Some(v.into());
        self
    }
    /// Set `role` query parameter.
    pub fn role(mut self, v: impl Into<String>) -> Self {
        self.role = Some(v.into());
        self
    }
    /// Set `flags` query parameter.
    pub fn flags(mut self, v: impl Into<String>) -> Self {
        self.flags = Some(v.into());
        self
    }
    /// Set `flags_match` query parameter.
    pub fn flags_match(mut self, v: impl Into<String>) -> Self {
        self.flags_match = Some(v.into());
        self
    }
    /// Set `status` query parameter.
    pub fn status(mut self, v: impl Into<String>) -> Self {
        self.status = Some(v.into());
        self
    }
    /// Set `order_by` query parameter.
    pub fn order_by(mut self, v: impl Into<String>) -> Self {
        self.order_by = Some(v.into());
        self
    }
    /// Set `desc` query parameter.
    pub fn desc(mut self, v: impl Into<bool>) -> Self {
        self.desc = Some(v.into());
        self
    }
}

/// Query parameters for the matching method on the resource client.
#[derive(Debug, Clone, Default, Serialize)]
#[non_exhaustive]
pub struct GetReposByUserNameQuery {
    /// Filter by repositories
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub search: Option<String>,
    /// Repositories type
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub filter_type: Option<String>,
    /// 仓库类型标记,逗号分隔。Repository type flags, comma separated
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub flags: Option<String>,
    /// flags 多值匹配模式。Flags match mode when multiple flags provided
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub flags_match: Option<String>,
    /// 仓库状态。Repository status
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub status: Option<String>,
    /// 最小仓库权限,默认owner。Minima repository permissions.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub role: Option<String>,
    /// Pagination page number
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub page: Option<i64>,
    /// Pagination page size
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub page_size: Option<i64>,
    /// 排序顺序。Ordering.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub desc: Option<bool>,
    /// Order field
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub order_by: Option<String>,
}

impl GetReposByUserNameQuery {
    /// Construct an empty query.
    pub fn new() -> Self {
        Self::default()
    }
    /// Set `search` query parameter.
    pub fn search(mut self, v: impl Into<String>) -> Self {
        self.search = Some(v.into());
        self
    }
    /// Set `filter_type` query parameter.
    pub fn filter_type(mut self, v: impl Into<String>) -> Self {
        self.filter_type = Some(v.into());
        self
    }
    /// Set `flags` query parameter.
    pub fn flags(mut self, v: impl Into<String>) -> Self {
        self.flags = Some(v.into());
        self
    }
    /// Set `flags_match` query parameter.
    pub fn flags_match(mut self, v: impl Into<String>) -> Self {
        self.flags_match = Some(v.into());
        self
    }
    /// Set `status` query parameter.
    pub fn status(mut self, v: impl Into<String>) -> Self {
        self.status = Some(v.into());
        self
    }
    /// Set `role` query parameter.
    pub fn role(mut self, v: impl Into<String>) -> Self {
        self.role = Some(v.into());
        self
    }
    /// Set `page` query parameter.
    pub fn page(mut self, v: impl Into<i64>) -> Self {
        self.page = Some(v.into());
        self
    }
    /// Set `page_size` query parameter.
    pub fn page_size(mut self, v: impl Into<i64>) -> Self {
        self.page_size = Some(v.into());
        self
    }
    /// Set `desc` query parameter.
    pub fn desc(mut self, v: impl Into<bool>) -> Self {
        self.desc = Some(v.into());
        self
    }
    /// Set `order_by` query parameter.
    pub fn order_by(mut self, v: impl Into<String>) -> Self {
        self.order_by = Some(v.into());
        self
    }
}

/// Query parameters for the matching method on the resource client.
#[derive(Debug, Clone, Default, Serialize)]
#[non_exhaustive]
pub struct ListForksReposQuery {
    /// 是否从fork根节点开始展示。Whether to start from the root node of the fork.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub start_from_root: Option<bool>,
    /// 页码。Pagination page number.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub page: Option<i64>,
    /// 每页大小。Pagination page size.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub page_size: Option<i64>,
}

impl ListForksReposQuery {
    /// Construct an empty query.
    pub fn new() -> Self {
        Self::default()
    }
    /// Set `start_from_root` query parameter.
    pub fn start_from_root(mut self, v: impl Into<bool>) -> Self {
        self.start_from_root = Some(v.into());
        self
    }
    /// Set `page` query parameter.
    pub fn page(mut self, v: impl Into<i64>) -> Self {
        self.page = Some(v.into());
        self
    }
    /// Set `page_size` query parameter.
    pub fn page_size(mut self, v: impl Into<i64>) -> Self {
        self.page_size = Some(v.into());
        self
    }
}

/// Query parameters for the matching method on the resource client.
#[derive(Debug, Clone, Default, Serialize)]
#[non_exhaustive]
pub struct SetRepoVisibilityQuery {
    /// 仓库可见性
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub visibility: Option<String>,
}

impl SetRepoVisibilityQuery {
    /// Construct an empty query.
    pub fn new() -> Self {
        Self::default()
    }
    /// Set `visibility` query parameter.
    pub fn visibility(mut self, v: impl Into<String>) -> Self {
        self.visibility = Some(v.into());
        self
    }
}