forgejo_api/generated/
structs.rs

1use crate::{impl_from_response, StructureError};
2use std::collections::BTreeMap;
3/// APIError is an api error with a message
4#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
5pub struct APIError {
6    pub message: Option<String>,
7    #[serde(deserialize_with = "crate::none_if_blank_url")]
8    pub url: Option<url::Url>,
9}
10
11impl_from_response!(APIError);
12
13#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
14pub struct APIForbiddenError {
15    pub message: Option<String>,
16    pub url: Option<String>,
17}
18
19impl_from_response!(APIForbiddenError);
20
21#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
22pub struct APIInternalServerError {
23    pub message: Option<String>,
24    pub url: Option<String>,
25}
26
27impl_from_response!(APIInternalServerError);
28
29#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
30pub struct APIInvalidTopicsError {
31    #[serde(rename = "invalidTopics")]
32    pub invalid_topics: Option<Vec<String>>,
33    pub message: Option<String>,
34}
35
36impl_from_response!(APIInvalidTopicsError);
37
38#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
39pub struct APINotFound {
40    pub errors: Option<Vec<String>>,
41    pub message: Option<String>,
42    pub url: Option<String>,
43}
44
45impl_from_response!(APINotFound);
46
47#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
48pub struct APIRepoArchivedError {
49    pub message: Option<String>,
50    pub url: Option<String>,
51}
52
53impl_from_response!(APIRepoArchivedError);
54
55#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
56pub struct APIUnauthorizedError {
57    pub message: Option<String>,
58    pub url: Option<String>,
59}
60
61impl_from_response!(APIUnauthorizedError);
62
63#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
64pub struct APIValidationError {
65    pub message: Option<String>,
66    pub url: Option<String>,
67}
68
69impl_from_response!(APIValidationError);
70
71#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
72pub struct APPersonFollowItem {
73    pub actor_id: Option<String>,
74    pub note: Option<String>,
75    pub original_item: Option<String>,
76    pub original_url: Option<String>,
77}
78
79impl_from_response!(APPersonFollowItem);
80
81#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
82pub struct AccessToken {
83    pub id: Option<i64>,
84    pub name: Option<String>,
85    pub scopes: Option<Vec<String>>,
86    pub sha1: Option<String>,
87    pub token_last_eight: Option<String>,
88}
89
90impl_from_response!(AccessToken);
91
92/// ActionRun represents an action run
93#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
94pub struct ActionRun {
95    /// the cron id for the schedule trigger
96    #[serde(rename = "ScheduleID")]
97    pub schedule_id: Option<i64>,
98    /// who approved this action run
99    pub approved_by: Option<i64>,
100    /// the commit sha the action run ran on
101    pub commit_sha: Option<String>,
102    #[serde(with = "time::serde::rfc3339::option")]
103    /// when the action run was created
104    pub created: Option<time::OffsetDateTime>,
105    pub duration: Option<i64>,
106    /// the webhook event that causes the workflow to run
107    pub event: Option<String>,
108    /// the payload of the webhook event that causes the workflow to run
109    pub event_payload: Option<String>,
110    #[serde(deserialize_with = "crate::none_if_blank_url")]
111    /// the url of this action run
112    pub html_url: Option<url::Url>,
113    /// the action run id
114    pub id: Option<i64>,
115    /// a unique number for each run of a repository
116    pub index_in_repo: Option<i64>,
117    /// If this is triggered by a PR from a forked repository or an untrusted user, we need to check if it is approved and limit permissions when running the workflow.
118    pub is_fork_pull_request: Option<bool>,
119    /// has the commit/tag/… the action run ran on been deleted
120    pub is_ref_deleted: Option<bool>,
121    /// may need approval if it's a fork pull request
122    pub need_approval: Option<bool>,
123    /// the commit/tag/… the action run ran on
124    pub prettyref: Option<String>,
125    pub repository: Option<Repository>,
126    #[serde(with = "time::serde::rfc3339::option")]
127    /// when the action run was started
128    pub started: Option<time::OffsetDateTime>,
129    /// the current status of this run
130    pub status: Option<String>,
131    #[serde(with = "time::serde::rfc3339::option")]
132    /// when the action run was stopped
133    pub stopped: Option<time::OffsetDateTime>,
134    /// the action run's title
135    pub title: Option<String>,
136    /// the trigger event defined in the `on` configuration of the triggered workflow
137    pub trigger_event: Option<String>,
138    pub trigger_user: Option<User>,
139    #[serde(with = "time::serde::rfc3339::option")]
140    /// when the action run was last updated
141    pub updated: Option<time::OffsetDateTime>,
142    /// the name of workflow file
143    pub workflow_id: Option<String>,
144}
145
146impl_from_response!(ActionRun);
147
148/// ActionRunJob represents a job of a run
149#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
150pub struct ActionRunJob {
151    /// the action run job id
152    pub id: Option<i64>,
153    /// the action run job name
154    pub name: Option<String>,
155    /// the action run job needed ids
156    pub needs: Option<Vec<String>>,
157    /// the owner id
158    pub owner_id: Option<i64>,
159    /// the repository id
160    pub repo_id: Option<i64>,
161    /// the action run job labels to run on
162    pub runs_on: Option<Vec<String>>,
163    /// the action run job status
164    pub status: Option<String>,
165    /// the action run job latest task id
166    pub task_id: Option<i64>,
167}
168
169impl_from_response!(ActionRunJob);
170
171/// ActionTask represents a ActionTask
172#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
173pub struct ActionTask {
174    #[serde(with = "time::serde::rfc3339::option")]
175    pub created_at: Option<time::OffsetDateTime>,
176    pub display_title: Option<String>,
177    pub event: Option<String>,
178    pub head_branch: Option<String>,
179    pub head_sha: Option<String>,
180    pub id: Option<i64>,
181    pub name: Option<String>,
182    pub run_number: Option<i64>,
183    #[serde(with = "time::serde::rfc3339::option")]
184    pub run_started_at: Option<time::OffsetDateTime>,
185    pub status: Option<String>,
186    #[serde(with = "time::serde::rfc3339::option")]
187    pub updated_at: Option<time::OffsetDateTime>,
188    #[serde(deserialize_with = "crate::none_if_blank_url")]
189    pub url: Option<url::Url>,
190    pub workflow_id: Option<String>,
191}
192
193/// ActionTaskResponse returns a ActionTask
194#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
195pub struct ActionTaskResponse {
196    pub total_count: Option<i64>,
197    pub workflow_runs: Option<Vec<ActionTask>>,
198}
199
200impl_from_response!(ActionTaskResponse);
201
202/// ActionVariable return value of the query API
203#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
204pub struct ActionVariable {
205    /// the value of the variable
206    pub data: Option<String>,
207    /// the name of the variable
208    pub name: Option<String>,
209    /// the owner to which the variable belongs
210    pub owner_id: Option<i64>,
211    /// the repository to which the variable belongs
212    pub repo_id: Option<i64>,
213}
214
215impl_from_response!(ActionVariable);
216
217#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
218pub struct Activity {
219    pub act_user: Option<User>,
220    pub act_user_id: Option<i64>,
221    pub comment: Option<Comment>,
222    pub comment_id: Option<i64>,
223    pub content: Option<String>,
224    #[serde(with = "time::serde::rfc3339::option")]
225    pub created: Option<time::OffsetDateTime>,
226    pub id: Option<i64>,
227    pub is_private: Option<bool>,
228    /// the type of action
229    pub op_type: Option<ActivityOpType>,
230    pub ref_name: Option<String>,
231    pub repo: Option<Repository>,
232    pub repo_id: Option<i64>,
233    pub user_id: Option<i64>,
234}
235
236impl_from_response!(Activity);
237
238/// the type of action
239
240#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
241pub enum ActivityOpType {
242    #[serde(rename = "create_repo")]
243    CreateRepo,
244    #[serde(rename = "rename_repo")]
245    RenameRepo,
246    #[serde(rename = "star_repo")]
247    StarRepo,
248    #[serde(rename = "watch_repo")]
249    WatchRepo,
250    #[serde(rename = "commit_repo")]
251    CommitRepo,
252    #[serde(rename = "create_issue")]
253    CreateIssue,
254    #[serde(rename = "create_pull_request")]
255    CreatePullRequest,
256    #[serde(rename = "transfer_repo")]
257    TransferRepo,
258    #[serde(rename = "push_tag")]
259    PushTag,
260    #[serde(rename = "comment_issue")]
261    CommentIssue,
262    #[serde(rename = "merge_pull_request")]
263    MergePullRequest,
264    #[serde(rename = "close_issue")]
265    CloseIssue,
266    #[serde(rename = "reopen_issue")]
267    ReopenIssue,
268    #[serde(rename = "close_pull_request")]
269    ClosePullRequest,
270    #[serde(rename = "reopen_pull_request")]
271    ReopenPullRequest,
272    #[serde(rename = "delete_tag")]
273    DeleteTag,
274    #[serde(rename = "delete_branch")]
275    DeleteBranch,
276    #[serde(rename = "mirror_sync_push")]
277    MirrorSyncPush,
278    #[serde(rename = "mirror_sync_create")]
279    MirrorSyncCreate,
280    #[serde(rename = "mirror_sync_delete")]
281    MirrorSyncDelete,
282    #[serde(rename = "approve_pull_request")]
283    ApprovePullRequest,
284    #[serde(rename = "reject_pull_request")]
285    RejectPullRequest,
286    #[serde(rename = "comment_pull")]
287    CommentPull,
288    #[serde(rename = "publish_release")]
289    PublishRelease,
290    #[serde(rename = "pull_review_dismissed")]
291    PullReviewDismissed,
292    #[serde(rename = "pull_request_ready_for_review")]
293    PullRequestReadyForReview,
294    #[serde(rename = "auto_merge_pull_request")]
295    AutoMergePullRequest,
296}
297/// ActivityPub type
298#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
299pub struct ActivityPub {
300    #[serde(rename = "@context")]
301    pub context: Option<String>,
302}
303
304impl_from_response!(ActivityPub);
305
306/// AddCollaboratorOption options when adding a user as a collaborator of a repository
307#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
308pub struct AddCollaboratorOption {
309    pub permission: Option<AddCollaboratorOptionPermission>,
310}
311
312#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
313pub enum AddCollaboratorOptionPermission {
314    #[serde(rename = "read")]
315    Read,
316    #[serde(rename = "write")]
317    Write,
318    #[serde(rename = "admin")]
319    Admin,
320}
321/// AddTimeOption options for adding time to an issue
322#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
323pub struct AddTimeOption {
324    #[serde(with = "time::serde::rfc3339::option")]
325    pub created: Option<time::OffsetDateTime>,
326    /// time in seconds
327    pub time: i64,
328    /// User who spent the time (optional)
329    pub user_name: Option<String>,
330}
331
332/// AnnotatedTag represents an annotated tag
333#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
334pub struct AnnotatedTag {
335    pub archive_download_count: Option<TagArchiveDownloadCount>,
336    pub message: Option<String>,
337    pub object: Option<AnnotatedTagObject>,
338    pub sha: Option<String>,
339    pub tag: Option<String>,
340    pub tagger: Option<CommitUser>,
341    #[serde(deserialize_with = "crate::none_if_blank_url")]
342    pub url: Option<url::Url>,
343    pub verification: Option<PayloadCommitVerification>,
344}
345
346impl_from_response!(AnnotatedTag);
347
348/// AnnotatedTagObject contains meta information of the tag object
349#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
350pub struct AnnotatedTagObject {
351    pub sha: Option<String>,
352    #[serde(rename = "type")]
353    pub r#type: Option<String>,
354    #[serde(deserialize_with = "crate::none_if_blank_url")]
355    pub url: Option<url::Url>,
356}
357
358/// Attachment a generic attachment
359#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
360pub struct Attachment {
361    #[serde(deserialize_with = "crate::none_if_blank_url")]
362    pub browser_download_url: Option<url::Url>,
363    #[serde(with = "time::serde::rfc3339::option")]
364    pub created_at: Option<time::OffsetDateTime>,
365    pub download_count: Option<i64>,
366    pub id: Option<i64>,
367    pub name: Option<String>,
368    pub size: Option<i64>,
369    #[serde(rename = "type")]
370    pub r#type: Option<AttachmentType>,
371    pub uuid: Option<String>,
372}
373
374impl_from_response!(Attachment);
375
376#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
377pub enum AttachmentType {
378    #[serde(rename = "attachment")]
379    Attachment,
380    #[serde(rename = "external")]
381    External,
382}
383#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
384pub struct BlockedUser {
385    pub block_id: Option<i64>,
386    #[serde(with = "time::serde::rfc3339::option")]
387    pub created_at: Option<time::OffsetDateTime>,
388}
389
390impl_from_response!(BlockedUser);
391
392/// Branch represents a repository branch
393#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
394pub struct Branch {
395    pub commit: Option<PayloadCommit>,
396    pub effective_branch_protection_name: Option<String>,
397    pub enable_status_check: Option<bool>,
398    pub name: Option<String>,
399    pub protected: Option<bool>,
400    pub required_approvals: Option<i64>,
401    pub status_check_contexts: Option<Vec<String>>,
402    pub user_can_merge: Option<bool>,
403    pub user_can_push: Option<bool>,
404}
405
406impl_from_response!(Branch);
407
408/// BranchProtection represents a branch protection for a repository
409#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
410pub struct BranchProtection {
411    pub apply_to_admins: Option<bool>,
412    pub approvals_whitelist_teams: Option<Vec<String>>,
413    pub approvals_whitelist_username: Option<Vec<String>>,
414    pub block_on_official_review_requests: Option<bool>,
415    pub block_on_outdated_branch: Option<bool>,
416    pub block_on_rejected_reviews: Option<bool>,
417    /// Deprecated: true
418    pub branch_name: Option<String>,
419    #[serde(with = "time::serde::rfc3339::option")]
420    pub created_at: Option<time::OffsetDateTime>,
421    pub dismiss_stale_approvals: Option<bool>,
422    pub enable_approvals_whitelist: Option<bool>,
423    pub enable_merge_whitelist: Option<bool>,
424    pub enable_push: Option<bool>,
425    pub enable_push_whitelist: Option<bool>,
426    pub enable_status_check: Option<bool>,
427    pub ignore_stale_approvals: Option<bool>,
428    pub merge_whitelist_teams: Option<Vec<String>>,
429    pub merge_whitelist_usernames: Option<Vec<String>>,
430    pub protected_file_patterns: Option<String>,
431    pub push_whitelist_deploy_keys: Option<bool>,
432    pub push_whitelist_teams: Option<Vec<String>>,
433    pub push_whitelist_usernames: Option<Vec<String>>,
434    pub require_signed_commits: Option<bool>,
435    pub required_approvals: Option<i64>,
436    pub rule_name: Option<String>,
437    pub status_check_contexts: Option<Vec<String>>,
438    pub unprotected_file_patterns: Option<String>,
439    #[serde(with = "time::serde::rfc3339::option")]
440    pub updated_at: Option<time::OffsetDateTime>,
441}
442
443impl_from_response!(BranchProtection);
444
445/// ChangeFileOperation for creating, updating or deleting a file
446#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
447pub struct ChangeFileOperation {
448    /// new or updated file content, must be base64 encoded
449    pub content: Option<String>,
450    /// old path of the file to move
451    pub from_path: Option<String>,
452    /// indicates what to do with the file
453    pub operation: ChangeFileOperationOperation,
454    /// path to the existing or new file
455    pub path: String,
456    /// sha is the SHA for the file that already exists, required for update or delete
457    pub sha: Option<String>,
458}
459
460/// indicates what to do with the file
461
462#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
463pub enum ChangeFileOperationOperation {
464    #[serde(rename = "create")]
465    Create,
466    #[serde(rename = "update")]
467    Update,
468    #[serde(rename = "delete")]
469    Delete,
470}
471/// ChangeFilesOptions options for creating, updating or deleting multiple files
472///
473/// Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
474#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
475pub struct ChangeFilesOptions {
476    pub author: Option<Identity>,
477    /// branch (optional) to base this file from. if not given, the default branch is used
478    pub branch: Option<String>,
479    pub committer: Option<Identity>,
480    pub dates: Option<CommitDateOptions>,
481    /// list of file operations
482    pub files: Vec<ChangeFileOperation>,
483    /// message (optional) for the commit of this file. if not supplied, a default message will be used
484    pub message: Option<String>,
485    /// new_branch (optional) will make a new branch from `branch` before creating the file
486    pub new_branch: Option<String>,
487    /// Add a Signed-off-by trailer by the committer at the end of the commit log message.
488    pub signoff: Option<bool>,
489}
490
491/// ChangedFile store information about files affected by the pull request
492#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
493pub struct ChangedFile {
494    pub additions: Option<i64>,
495    pub changes: Option<i64>,
496    #[serde(deserialize_with = "crate::none_if_blank_url")]
497    pub contents_url: Option<url::Url>,
498    pub deletions: Option<i64>,
499    pub filename: Option<String>,
500    #[serde(deserialize_with = "crate::none_if_blank_url")]
501    pub html_url: Option<url::Url>,
502    pub previous_filename: Option<String>,
503    #[serde(deserialize_with = "crate::none_if_blank_url")]
504    pub raw_url: Option<url::Url>,
505    pub status: Option<String>,
506}
507
508impl_from_response!(ChangedFile);
509
510/// CombinedStatus holds the combined state of several statuses for a single commit
511#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
512pub struct CombinedStatus {
513    #[serde(deserialize_with = "crate::none_if_blank_url")]
514    pub commit_url: Option<url::Url>,
515    pub repository: Option<Repository>,
516    pub sha: Option<String>,
517    pub state: Option<CommitStatusState>,
518    pub statuses: Option<Vec<CommitStatus>>,
519    pub total_count: Option<i64>,
520    #[serde(deserialize_with = "crate::none_if_blank_url")]
521    pub url: Option<url::Url>,
522}
523
524impl_from_response!(CombinedStatus);
525
526impl crate::sealed::Sealed for CombinedStatus {}
527impl crate::PageSize for CombinedStatus {
528    fn page_size(&self) -> usize {
529        self.statuses.as_ref().map(|x| x.page_size()).unwrap_or(0)
530    }
531}
532
533/// Comment represents a comment on a commit or issue
534#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
535pub struct Comment {
536    pub assets: Option<Vec<Attachment>>,
537    pub body: Option<String>,
538    #[serde(with = "time::serde::rfc3339::option")]
539    pub created_at: Option<time::OffsetDateTime>,
540    #[serde(deserialize_with = "crate::none_if_blank_url")]
541    pub html_url: Option<url::Url>,
542    pub id: Option<i64>,
543    #[serde(deserialize_with = "crate::none_if_blank_url")]
544    pub issue_url: Option<url::Url>,
545    pub original_author: Option<String>,
546    pub original_author_id: Option<i64>,
547    #[serde(deserialize_with = "crate::none_if_blank_url")]
548    pub pull_request_url: Option<url::Url>,
549    #[serde(with = "time::serde::rfc3339::option")]
550    pub updated_at: Option<time::OffsetDateTime>,
551    pub user: Option<User>,
552}
553
554impl_from_response!(Comment);
555
556#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
557pub struct Commit {
558    pub author: Option<User>,
559    pub commit: Option<RepoCommit>,
560    pub committer: Option<User>,
561    #[serde(with = "time::serde::rfc3339::option")]
562    pub created: Option<time::OffsetDateTime>,
563    pub files: Option<Vec<CommitAffectedFiles>>,
564    #[serde(deserialize_with = "crate::none_if_blank_url")]
565    pub html_url: Option<url::Url>,
566    pub parents: Option<Vec<CommitMeta>>,
567    pub sha: Option<String>,
568    pub stats: Option<CommitStats>,
569    #[serde(deserialize_with = "crate::none_if_blank_url")]
570    pub url: Option<url::Url>,
571}
572
573impl_from_response!(Commit);
574
575/// CommitAffectedFiles store information about files affected by the commit
576#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
577pub struct CommitAffectedFiles {
578    pub filename: Option<String>,
579    pub status: Option<String>,
580}
581
582/// CommitDateOptions store dates for GIT_AUTHOR_DATE and GIT_COMMITTER_DATE
583#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
584pub struct CommitDateOptions {
585    #[serde(with = "time::serde::rfc3339::option")]
586    pub author: Option<time::OffsetDateTime>,
587    #[serde(with = "time::serde::rfc3339::option")]
588    pub committer: Option<time::OffsetDateTime>,
589}
590
591#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
592pub struct CommitMeta {
593    #[serde(with = "time::serde::rfc3339::option")]
594    pub created: Option<time::OffsetDateTime>,
595    pub sha: Option<String>,
596    #[serde(deserialize_with = "crate::none_if_blank_url")]
597    pub url: Option<url::Url>,
598}
599
600/// CommitStats is statistics for a RepoCommit
601#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
602pub struct CommitStats {
603    pub additions: Option<i64>,
604    pub deletions: Option<i64>,
605    pub total: Option<i64>,
606}
607
608/// CommitStatus holds a single status of a single Commit
609#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
610pub struct CommitStatus {
611    pub context: Option<String>,
612    #[serde(with = "time::serde::rfc3339::option")]
613    pub created_at: Option<time::OffsetDateTime>,
614    pub creator: Option<User>,
615    pub description: Option<String>,
616    pub id: Option<i64>,
617    pub status: Option<CommitStatusState>,
618    #[serde(deserialize_with = "crate::none_if_blank_url")]
619    pub target_url: Option<url::Url>,
620    #[serde(with = "time::serde::rfc3339::option")]
621    pub updated_at: Option<time::OffsetDateTime>,
622    #[serde(deserialize_with = "crate::none_if_blank_url")]
623    pub url: Option<url::Url>,
624}
625
626impl_from_response!(CommitStatus);
627
628/// CommitStatusState holds the state of a CommitStatus
629///
630/// It can be "pending", "success", "error" or "failure"
631
632#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
633pub enum CommitStatusState {
634    #[serde(rename = "pending")]
635    Pending,
636    #[serde(rename = "success")]
637    Success,
638    #[serde(rename = "error")]
639    Error,
640    #[serde(rename = "failure")]
641    Failure,
642}
643#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
644pub struct CommitUser {
645    pub date: Option<String>,
646    pub email: Option<String>,
647    pub name: Option<String>,
648}
649
650#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
651pub struct Compare {
652    pub commits: Option<Vec<Commit>>,
653    pub files: Option<Vec<CommitAffectedFiles>>,
654    pub total_commits: Option<i64>,
655}
656
657impl_from_response!(Compare);
658
659/// ContentsResponse contains information about a repo's entry's (dir, file, symlink, submodule) metadata and content
660#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
661pub struct ContentsResponse {
662    #[serde(rename = "_links")]
663    pub links: Option<FileLinksResponse>,
664    /// `content` is populated when `type` is `file`, otherwise null
665    pub content: Option<String>,
666    #[serde(deserialize_with = "crate::none_if_blank_url")]
667    pub download_url: Option<url::Url>,
668    /// `encoding` is populated when `type` is `file`, otherwise null
669    pub encoding: Option<String>,
670    #[serde(deserialize_with = "crate::none_if_blank_url")]
671    pub git_url: Option<url::Url>,
672    #[serde(deserialize_with = "crate::none_if_blank_url")]
673    pub html_url: Option<url::Url>,
674    pub last_commit_sha: Option<String>,
675    #[serde(with = "time::serde::rfc3339::option")]
676    pub last_commit_when: Option<time::OffsetDateTime>,
677    pub name: Option<String>,
678    pub path: Option<String>,
679    pub sha: Option<String>,
680    pub size: Option<i64>,
681    #[serde(deserialize_with = "crate::none_if_blank_url")]
682    /// `submodule_git_url` is populated when `type` is `submodule`, otherwise null
683    pub submodule_git_url: Option<url::Url>,
684    /// `target` is populated when `type` is `symlink`, otherwise null
685    pub target: Option<String>,
686    /// `type` will be `file`, `dir`, `symlink`, or `submodule`
687    #[serde(rename = "type")]
688    pub r#type: Option<String>,
689    #[serde(deserialize_with = "crate::none_if_blank_url")]
690    pub url: Option<url::Url>,
691}
692
693impl_from_response!(ContentsResponse);
694
695/// CreateAccessTokenOption options when create access token
696#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
697pub struct CreateAccessTokenOption {
698    pub name: String,
699    pub scopes: Option<Vec<String>>,
700}
701
702/// CreateBranchProtectionOption options for creating a branch protection
703#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
704pub struct CreateBranchProtectionOption {
705    pub apply_to_admins: Option<bool>,
706    pub approvals_whitelist_teams: Option<Vec<String>>,
707    pub approvals_whitelist_username: Option<Vec<String>>,
708    pub block_on_official_review_requests: Option<bool>,
709    pub block_on_outdated_branch: Option<bool>,
710    pub block_on_rejected_reviews: Option<bool>,
711    /// Deprecated: true
712    pub branch_name: Option<String>,
713    pub dismiss_stale_approvals: Option<bool>,
714    pub enable_approvals_whitelist: Option<bool>,
715    pub enable_merge_whitelist: Option<bool>,
716    pub enable_push: Option<bool>,
717    pub enable_push_whitelist: Option<bool>,
718    pub enable_status_check: Option<bool>,
719    pub ignore_stale_approvals: Option<bool>,
720    pub merge_whitelist_teams: Option<Vec<String>>,
721    pub merge_whitelist_usernames: Option<Vec<String>>,
722    pub protected_file_patterns: Option<String>,
723    pub push_whitelist_deploy_keys: Option<bool>,
724    pub push_whitelist_teams: Option<Vec<String>>,
725    pub push_whitelist_usernames: Option<Vec<String>>,
726    pub require_signed_commits: Option<bool>,
727    pub required_approvals: Option<i64>,
728    pub rule_name: Option<String>,
729    pub status_check_contexts: Option<Vec<String>>,
730    pub unprotected_file_patterns: Option<String>,
731}
732
733/// CreateBranchRepoOption options when creating a branch in a repository
734#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
735pub struct CreateBranchRepoOption {
736    /// Name of the branch to create
737    pub new_branch_name: String,
738    /// Deprecated: true
739    ///
740    /// Name of the old branch to create from
741    pub old_branch_name: Option<String>,
742    /// Name of the old branch/tag/commit to create from
743    pub old_ref_name: Option<String>,
744}
745
746/// CreateEmailOption options when creating email addresses
747#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
748pub struct CreateEmailOption {
749    /// email addresses to add
750    pub emails: Option<Vec<String>>,
751}
752
753/// CreateFileOptions options for creating files
754///
755/// Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
756#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
757pub struct CreateFileOptions {
758    pub author: Option<Identity>,
759    /// branch (optional) to base this file from. if not given, the default branch is used
760    pub branch: Option<String>,
761    pub committer: Option<Identity>,
762    /// content must be base64 encoded
763    pub content: String,
764    pub dates: Option<CommitDateOptions>,
765    /// message (optional) for the commit of this file. if not supplied, a default message will be used
766    pub message: Option<String>,
767    /// new_branch (optional) will make a new branch from `branch` before creating the file
768    pub new_branch: Option<String>,
769    /// Add a Signed-off-by trailer by the committer at the end of the commit log message.
770    pub signoff: Option<bool>,
771}
772
773/// CreateForkOption options for creating a fork
774#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
775pub struct CreateForkOption {
776    /// name of the forked repository
777    pub name: Option<String>,
778    /// organization name, if forking into an organization
779    pub organization: Option<String>,
780}
781
782/// CreateGPGKeyOption options create user GPG key
783#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
784pub struct CreateGPGKeyOption {
785    /// An armored GPG key to add
786    pub armored_public_key: String,
787    pub armored_signature: Option<String>,
788}
789
790/// CreateHookOption options when create a hook
791#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
792pub struct CreateHookOption {
793    pub active: Option<bool>,
794    pub authorization_header: Option<String>,
795    pub branch_filter: Option<String>,
796    pub config: CreateHookOptionConfig,
797    pub events: Option<Vec<String>>,
798    #[serde(rename = "type")]
799    pub r#type: CreateHookOptionType,
800}
801
802#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
803pub enum CreateHookOptionType {
804    #[serde(rename = "forgejo")]
805    Forgejo,
806    #[serde(rename = "dingtalk")]
807    Dingtalk,
808    #[serde(rename = "discord")]
809    Discord,
810    #[serde(rename = "gitea")]
811    Gitea,
812    #[serde(rename = "gogs")]
813    Gogs,
814    #[serde(rename = "msteams")]
815    Msteams,
816    #[serde(rename = "slack")]
817    Slack,
818    #[serde(rename = "telegram")]
819    Telegram,
820    #[serde(rename = "feishu")]
821    Feishu,
822    #[serde(rename = "wechatwork")]
823    Wechatwork,
824    #[serde(rename = "packagist")]
825    Packagist,
826}
827/// CreateHookOptionConfig has all config options in it
828///
829/// required are "content_type" and "url" Required
830#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
831pub struct CreateHookOptionConfig {
832    pub content_type: String,
833    pub url: url::Url,
834    #[serde(flatten)]
835    pub additional: BTreeMap<String, String>,
836}
837
838/// CreateIssueCommentOption options for creating a comment on an issue
839#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
840pub struct CreateIssueCommentOption {
841    pub body: String,
842    #[serde(with = "time::serde::rfc3339::option")]
843    pub updated_at: Option<time::OffsetDateTime>,
844}
845
846/// CreateIssueOption options to create one issue
847#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
848pub struct CreateIssueOption {
849    /// deprecated
850    pub assignee: Option<String>,
851    pub assignees: Option<Vec<String>>,
852    pub body: Option<String>,
853    pub closed: Option<bool>,
854    #[serde(with = "time::serde::rfc3339::option")]
855    pub due_date: Option<time::OffsetDateTime>,
856    /// list of label ids
857    pub labels: Option<Vec<i64>>,
858    /// milestone id
859    pub milestone: Option<i64>,
860    #[serde(rename = "ref")]
861    pub r#ref: Option<String>,
862    pub title: String,
863}
864
865/// CreateKeyOption options when creating a key
866#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
867pub struct CreateKeyOption {
868    /// An armored SSH key to add
869    pub key: String,
870    /// Describe if the key has only read access or read/write
871    pub read_only: Option<bool>,
872    /// Title of the key to add
873    pub title: String,
874}
875
876/// CreateLabelOption options for creating a label
877#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
878pub struct CreateLabelOption {
879    pub color: String,
880    pub description: Option<String>,
881    pub exclusive: Option<bool>,
882    pub is_archived: Option<bool>,
883    pub name: String,
884}
885
886/// CreateMilestoneOption options for creating a milestone
887#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
888pub struct CreateMilestoneOption {
889    pub description: Option<String>,
890    #[serde(with = "time::serde::rfc3339::option")]
891    pub due_on: Option<time::OffsetDateTime>,
892    pub state: Option<CreateMilestoneOptionState>,
893    pub title: Option<String>,
894}
895
896#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
897pub enum CreateMilestoneOptionState {
898    #[serde(rename = "open")]
899    Open,
900    #[serde(rename = "closed")]
901    Closed,
902}
903/// CreateOAuth2ApplicationOptions holds options to create an oauth2 application
904#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
905pub struct CreateOAuth2ApplicationOptions {
906    pub confidential_client: Option<bool>,
907    pub name: Option<String>,
908    pub redirect_uris: Option<Vec<String>>,
909}
910
911/// CreateOrUpdateSecretOption options when creating or updating secret
912#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
913pub struct CreateOrUpdateSecretOption {
914    /// Data of the secret to update
915    pub data: String,
916}
917
918/// CreateOrgOption options for creating an organization
919#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
920pub struct CreateOrgOption {
921    pub description: Option<String>,
922    pub email: Option<String>,
923    pub full_name: Option<String>,
924    pub location: Option<String>,
925    pub repo_admin_change_team_access: Option<bool>,
926    pub username: String,
927    /// possible values are `public` (default), `limited` or `private`
928    pub visibility: Option<CreateOrgOptionVisibility>,
929    pub website: Option<String>,
930}
931
932/// possible values are `public` (default), `limited` or `private`
933
934#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
935pub enum CreateOrgOptionVisibility {
936    #[serde(rename = "public")]
937    Public,
938    #[serde(rename = "limited")]
939    Limited,
940    #[serde(rename = "private")]
941    Private,
942}
943/// CreatePullRequestOption options when creating a pull request
944#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
945pub struct CreatePullRequestOption {
946    pub assignee: Option<String>,
947    pub assignees: Option<Vec<String>>,
948    pub base: Option<String>,
949    pub body: Option<String>,
950    #[serde(with = "time::serde::rfc3339::option")]
951    pub due_date: Option<time::OffsetDateTime>,
952    pub head: Option<String>,
953    pub labels: Option<Vec<i64>>,
954    pub milestone: Option<i64>,
955    pub title: Option<String>,
956}
957
958/// CreatePullReviewComment represent a review comment for creation api
959#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
960pub struct CreatePullReviewComment {
961    pub body: Option<String>,
962    /// if comment to new file line or 0
963    pub new_position: Option<i64>,
964    /// if comment to old file line or 0
965    pub old_position: Option<i64>,
966    /// the tree path
967    pub path: Option<String>,
968}
969
970/// CreatePullReviewOptions are options to create a pull review
971#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
972pub struct CreatePullReviewOptions {
973    pub body: Option<String>,
974    pub comments: Option<Vec<CreatePullReviewComment>>,
975    pub commit_id: Option<String>,
976    pub event: Option<String>,
977}
978
979#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
980pub struct CreatePushMirrorOption {
981    pub branch_filter: Option<String>,
982    pub interval: Option<String>,
983    pub remote_address: Option<String>,
984    pub remote_password: Option<String>,
985    pub remote_username: Option<String>,
986    pub sync_on_commit: Option<bool>,
987    pub use_ssh: Option<bool>,
988}
989
990/// CreateQutaGroupOptions represents the options for creating a quota group
991#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
992pub struct CreateQuotaGroupOptions {
993    /// Name of the quota group to create
994    pub name: Option<String>,
995    /// Rules to add to the newly created group.
996    ///
997    /// If a rule does not exist, it will be created.
998    pub rules: Option<Vec<CreateQuotaRuleOptions>>,
999}
1000
1001/// CreateQuotaRuleOptions represents the options for creating a quota rule
1002#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1003pub struct CreateQuotaRuleOptions {
1004    /// The limit set by the rule
1005    pub limit: Option<i64>,
1006    /// Name of the rule to create
1007    pub name: Option<String>,
1008    /// The subjects affected by the rule
1009    pub subjects: Option<Vec<CreateQuotaRuleOptionsSubjects>>,
1010}
1011
1012#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
1013pub enum CreateQuotaRuleOptionsSubjects {
1014    #[serde(rename = "none")]
1015    None,
1016    #[serde(rename = "size:all")]
1017    SizeAll,
1018    #[serde(rename = "size:repos:all")]
1019    SizeReposAll,
1020    #[serde(rename = "size:repos:public")]
1021    SizeReposPublic,
1022    #[serde(rename = "size:repos:private")]
1023    SizeReposPrivate,
1024    #[serde(rename = "size:git:all")]
1025    SizeGitAll,
1026    #[serde(rename = "size:git:lfs")]
1027    SizeGitLfs,
1028    #[serde(rename = "size:assets:all")]
1029    SizeAssetsAll,
1030    #[serde(rename = "size:assets:attachments:all")]
1031    SizeAssetsAttachmentsAll,
1032    #[serde(rename = "size:assets:attachments:issues")]
1033    SizeAssetsAttachmentsIssues,
1034    #[serde(rename = "size:assets:attachments:releases")]
1035    SizeAssetsAttachmentsReleases,
1036    #[serde(rename = "size:assets:artifacts")]
1037    SizeAssetsArtifacts,
1038    #[serde(rename = "size:assets:packages:all")]
1039    SizeAssetsPackagesAll,
1040    #[serde(rename = "size:assets:wiki")]
1041    SizeAssetsWiki,
1042}
1043/// CreateReleaseOption options when creating a release
1044#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1045pub struct CreateReleaseOption {
1046    pub body: Option<String>,
1047    pub draft: Option<bool>,
1048    pub hide_archive_links: Option<bool>,
1049    pub name: Option<String>,
1050    pub prerelease: Option<bool>,
1051    pub tag_name: String,
1052    pub target_commitish: Option<String>,
1053}
1054
1055/// CreateRepoOption options when creating repository
1056#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1057pub struct CreateRepoOption {
1058    /// Whether the repository should be auto-initialized?
1059    pub auto_init: Option<bool>,
1060    /// DefaultBranch of the repository (used when initializes and in template)
1061    pub default_branch: Option<String>,
1062    /// Description of the repository to create
1063    pub description: Option<String>,
1064    /// Gitignores to use
1065    pub gitignores: Option<String>,
1066    /// Label-Set to use
1067    pub issue_labels: Option<String>,
1068    /// License to use
1069    pub license: Option<String>,
1070    /// Name of the repository to create
1071    pub name: String,
1072    pub object_format_name: Option<ObjectFormatName>,
1073    /// Whether the repository is private
1074    pub private: Option<bool>,
1075    /// Readme of the repository to create
1076    pub readme: Option<String>,
1077    /// Whether the repository is template
1078    pub template: Option<bool>,
1079    /// TrustModel of the repository
1080    pub trust_model: Option<CreateRepoOptionTrustModel>,
1081}
1082
1083/// TrustModel of the repository
1084
1085#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
1086pub enum CreateRepoOptionTrustModel {
1087    #[serde(rename = "default")]
1088    Default,
1089    #[serde(rename = "collaborator")]
1090    Collaborator,
1091    #[serde(rename = "committer")]
1092    Committer,
1093    #[serde(rename = "collaboratorcommitter")]
1094    Collaboratorcommitter,
1095}
1096/// CreateStatusOption holds the information needed to create a new CommitStatus for a Commit
1097#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1098pub struct CreateStatusOption {
1099    pub context: Option<String>,
1100    pub description: Option<String>,
1101    pub state: Option<CommitStatusState>,
1102    #[serde(deserialize_with = "crate::none_if_blank_url")]
1103    pub target_url: Option<url::Url>,
1104}
1105
1106/// CreateTagOption options when creating a tag
1107#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1108pub struct CreateTagOption {
1109    pub message: Option<String>,
1110    pub tag_name: String,
1111    pub target: Option<String>,
1112}
1113
1114/// CreateTagProtectionOption options for creating a tag protection
1115#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1116pub struct CreateTagProtectionOption {
1117    pub name_pattern: Option<String>,
1118    pub whitelist_teams: Option<Vec<String>>,
1119    pub whitelist_usernames: Option<Vec<String>>,
1120}
1121
1122/// CreateTeamOption options for creating a team
1123#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1124pub struct CreateTeamOption {
1125    pub can_create_org_repo: Option<bool>,
1126    pub description: Option<String>,
1127    pub includes_all_repositories: Option<bool>,
1128    pub name: String,
1129    pub permission: Option<CreateTeamOptionPermission>,
1130    pub units: Option<Vec<String>>,
1131    pub units_map: Option<BTreeMap<String, String>>,
1132}
1133
1134#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
1135pub enum CreateTeamOptionPermission {
1136    #[serde(rename = "read")]
1137    Read,
1138    #[serde(rename = "write")]
1139    Write,
1140    #[serde(rename = "admin")]
1141    Admin,
1142}
1143/// CreateUserOption create user options
1144#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1145pub struct CreateUserOption {
1146    #[serde(with = "time::serde::rfc3339::option")]
1147    /// For explicitly setting the user creation timestamp. Useful when users are
1148    ///
1149    /// migrated from other systems. When omitted, the user's creation timestamp
1150    ///
1151    /// will be set to "now".
1152    pub created_at: Option<time::OffsetDateTime>,
1153    pub email: String,
1154    pub full_name: Option<String>,
1155    pub login_name: Option<String>,
1156    pub must_change_password: Option<bool>,
1157    pub password: Option<String>,
1158    pub restricted: Option<bool>,
1159    pub send_notify: Option<bool>,
1160    pub source_id: Option<i64>,
1161    pub username: String,
1162    pub visibility: Option<String>,
1163}
1164
1165/// CreateVariableOption the option when creating variable
1166#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1167pub struct CreateVariableOption {
1168    /// Value of the variable to create
1169    pub value: String,
1170}
1171
1172/// CreateWikiPageOptions form for creating wiki
1173#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1174pub struct CreateWikiPageOptions {
1175    /// content must be base64 encoded
1176    pub content_base64: Option<String>,
1177    /// optional commit message summarizing the change
1178    pub message: Option<String>,
1179    /// page title. leave empty to keep unchanged
1180    pub title: Option<String>,
1181}
1182
1183/// Cron represents a Cron task
1184#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1185pub struct Cron {
1186    pub exec_times: Option<i64>,
1187    pub name: Option<String>,
1188    #[serde(with = "time::serde::rfc3339::option")]
1189    pub next: Option<time::OffsetDateTime>,
1190    #[serde(with = "time::serde::rfc3339::option")]
1191    pub prev: Option<time::OffsetDateTime>,
1192    pub schedule: Option<String>,
1193}
1194
1195impl_from_response!(Cron);
1196
1197#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
1198pub enum DefaultMergeStyle {
1199    #[serde(rename = "merge")]
1200    Merge,
1201    #[serde(rename = "rebase")]
1202    Rebase,
1203    #[serde(rename = "rebase-merge")]
1204    RebaseMerge,
1205    #[serde(rename = "squash")]
1206    Squash,
1207    #[serde(rename = "fast-forward-only")]
1208    FastForwardOnly,
1209}
1210/// DeleteEmailOption options when deleting email addresses
1211#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1212pub struct DeleteEmailOption {
1213    /// email addresses to delete
1214    pub emails: Option<Vec<String>>,
1215}
1216
1217/// DeleteFileOptions options for deleting files (used for other File structs below)
1218///
1219/// Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
1220#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1221pub struct DeleteFileOptions {
1222    pub author: Option<Identity>,
1223    /// branch (optional) to base this file from. if not given, the default branch is used
1224    pub branch: Option<String>,
1225    pub committer: Option<Identity>,
1226    pub dates: Option<CommitDateOptions>,
1227    /// message (optional) for the commit of this file. if not supplied, a default message will be used
1228    pub message: Option<String>,
1229    /// new_branch (optional) will make a new branch from `branch` before creating the file
1230    pub new_branch: Option<String>,
1231    /// sha is the SHA for the file that already exists
1232    pub sha: String,
1233    /// Add a Signed-off-by trailer by the committer at the end of the commit log message.
1234    pub signoff: Option<bool>,
1235}
1236
1237/// DeleteLabelOption options for deleting a label
1238#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1239pub struct DeleteLabelsOption {
1240    #[serde(with = "time::serde::rfc3339::option")]
1241    pub updated_at: Option<time::OffsetDateTime>,
1242}
1243
1244/// DeployKey a deploy key
1245#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1246pub struct DeployKey {
1247    #[serde(with = "time::serde::rfc3339::option")]
1248    pub created_at: Option<time::OffsetDateTime>,
1249    pub fingerprint: Option<String>,
1250    pub id: Option<i64>,
1251    pub key: Option<String>,
1252    pub key_id: Option<i64>,
1253    pub read_only: Option<bool>,
1254    pub repository: Option<Repository>,
1255    pub title: Option<String>,
1256    #[serde(deserialize_with = "crate::none_if_blank_url")]
1257    pub url: Option<url::Url>,
1258}
1259
1260impl_from_response!(DeployKey);
1261
1262/// DismissPullReviewOptions are options to dismiss a pull review
1263#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1264pub struct DismissPullReviewOptions {
1265    pub message: Option<String>,
1266    pub priors: Option<bool>,
1267}
1268
1269/// DispatchWorkflowOption options when dispatching a workflow
1270#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1271pub struct DispatchWorkflowOption {
1272    /// Input keys and values configured in the workflow file.
1273    pub inputs: Option<BTreeMap<String, String>>,
1274    /// Git reference for the workflow
1275    #[serde(rename = "ref")]
1276    pub r#ref: String,
1277    /// Flag to return the run info
1278    pub return_run_info: Option<bool>,
1279}
1280
1281/// DispatchWorkflowRun represents a workflow run
1282#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1283pub struct DispatchWorkflowRun {
1284    /// the workflow run id
1285    pub id: Option<i64>,
1286    /// the jobs name
1287    pub jobs: Option<Vec<String>>,
1288    /// a unique number for each run of a repository
1289    pub run_number: Option<i64>,
1290}
1291
1292impl_from_response!(DispatchWorkflowRun);
1293
1294/// EditAttachmentOptions options for editing attachments
1295#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1296pub struct EditAttachmentOptions {
1297    #[serde(deserialize_with = "crate::none_if_blank_url")]
1298    /// (Can only be set if existing attachment is of external type)
1299    pub browser_download_url: Option<url::Url>,
1300    pub name: Option<String>,
1301}
1302
1303/// EditBranchProtectionOption options for editing a branch protection
1304#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1305pub struct EditBranchProtectionOption {
1306    pub apply_to_admins: Option<bool>,
1307    pub approvals_whitelist_teams: Option<Vec<String>>,
1308    pub approvals_whitelist_username: Option<Vec<String>>,
1309    pub block_on_official_review_requests: Option<bool>,
1310    pub block_on_outdated_branch: Option<bool>,
1311    pub block_on_rejected_reviews: Option<bool>,
1312    pub dismiss_stale_approvals: Option<bool>,
1313    pub enable_approvals_whitelist: Option<bool>,
1314    pub enable_merge_whitelist: Option<bool>,
1315    pub enable_push: Option<bool>,
1316    pub enable_push_whitelist: Option<bool>,
1317    pub enable_status_check: Option<bool>,
1318    pub ignore_stale_approvals: Option<bool>,
1319    pub merge_whitelist_teams: Option<Vec<String>>,
1320    pub merge_whitelist_usernames: Option<Vec<String>>,
1321    pub protected_file_patterns: Option<String>,
1322    pub push_whitelist_deploy_keys: Option<bool>,
1323    pub push_whitelist_teams: Option<Vec<String>>,
1324    pub push_whitelist_usernames: Option<Vec<String>>,
1325    pub require_signed_commits: Option<bool>,
1326    pub required_approvals: Option<i64>,
1327    pub status_check_contexts: Option<Vec<String>>,
1328    pub unprotected_file_patterns: Option<String>,
1329}
1330
1331/// EditDeadlineOption options for creating a deadline
1332#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1333pub struct EditDeadlineOption {
1334    #[serde(with = "time::serde::rfc3339")]
1335    pub due_date: time::OffsetDateTime,
1336}
1337
1338/// EditGitHookOption options when modifying one Git hook
1339#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1340pub struct EditGitHookOption {
1341    pub content: Option<String>,
1342}
1343
1344/// EditHookOption options when modify one hook
1345#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1346pub struct EditHookOption {
1347    pub active: Option<bool>,
1348    pub authorization_header: Option<String>,
1349    pub branch_filter: Option<String>,
1350    pub config: Option<BTreeMap<String, String>>,
1351    pub events: Option<Vec<String>>,
1352}
1353
1354/// EditIssueCommentOption options for editing a comment
1355#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1356pub struct EditIssueCommentOption {
1357    pub body: String,
1358    #[serde(with = "time::serde::rfc3339::option")]
1359    pub updated_at: Option<time::OffsetDateTime>,
1360}
1361
1362/// EditIssueOption options for editing an issue
1363#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1364pub struct EditIssueOption {
1365    /// deprecated
1366    pub assignee: Option<String>,
1367    pub assignees: Option<Vec<String>>,
1368    pub body: Option<String>,
1369    #[serde(with = "time::serde::rfc3339::option")]
1370    pub due_date: Option<time::OffsetDateTime>,
1371    pub milestone: Option<i64>,
1372    #[serde(rename = "ref")]
1373    pub r#ref: Option<String>,
1374    pub state: Option<String>,
1375    pub title: Option<String>,
1376    pub unset_due_date: Option<bool>,
1377    #[serde(with = "time::serde::rfc3339::option")]
1378    pub updated_at: Option<time::OffsetDateTime>,
1379}
1380
1381/// EditLabelOption options for editing a label
1382#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1383pub struct EditLabelOption {
1384    pub color: Option<String>,
1385    pub description: Option<String>,
1386    pub exclusive: Option<bool>,
1387    pub is_archived: Option<bool>,
1388    pub name: Option<String>,
1389}
1390
1391/// EditMilestoneOption options for editing a milestone
1392#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1393pub struct EditMilestoneOption {
1394    pub description: Option<String>,
1395    #[serde(with = "time::serde::rfc3339::option")]
1396    pub due_on: Option<time::OffsetDateTime>,
1397    pub state: Option<String>,
1398    pub title: Option<String>,
1399}
1400
1401/// EditOrgOption options for editing an organization
1402#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1403pub struct EditOrgOption {
1404    pub description: Option<String>,
1405    pub email: Option<String>,
1406    pub full_name: Option<String>,
1407    pub location: Option<String>,
1408    pub repo_admin_change_team_access: Option<bool>,
1409    /// possible values are `public`, `limited` or `private`
1410    pub visibility: Option<EditOrgOptionVisibility>,
1411    pub website: Option<String>,
1412}
1413
1414/// possible values are `public`, `limited` or `private`
1415
1416#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
1417pub enum EditOrgOptionVisibility {
1418    #[serde(rename = "public")]
1419    Public,
1420    #[serde(rename = "limited")]
1421    Limited,
1422    #[serde(rename = "private")]
1423    Private,
1424}
1425/// EditPullRequestOption options when modify pull request
1426#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1427pub struct EditPullRequestOption {
1428    pub allow_maintainer_edit: Option<bool>,
1429    pub assignee: Option<String>,
1430    pub assignees: Option<Vec<String>>,
1431    pub base: Option<String>,
1432    pub body: Option<String>,
1433    #[serde(with = "time::serde::rfc3339::option")]
1434    pub due_date: Option<time::OffsetDateTime>,
1435    pub labels: Option<Vec<i64>>,
1436    pub milestone: Option<i64>,
1437    pub state: Option<String>,
1438    pub title: Option<String>,
1439    pub unset_due_date: Option<bool>,
1440}
1441
1442/// EditQuotaRuleOptions represents the options for editing a quota rule
1443#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1444pub struct EditQuotaRuleOptions {
1445    /// The limit set by the rule
1446    pub limit: Option<i64>,
1447    /// The subjects affected by the rule
1448    pub subjects: Option<Vec<String>>,
1449}
1450
1451/// EditReactionOption contain the reaction type
1452#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1453pub struct EditReactionOption {
1454    pub content: Option<String>,
1455}
1456
1457/// EditReleaseOption options when editing a release
1458#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1459pub struct EditReleaseOption {
1460    pub body: Option<String>,
1461    pub draft: Option<bool>,
1462    pub hide_archive_links: Option<bool>,
1463    pub name: Option<String>,
1464    pub prerelease: Option<bool>,
1465    pub tag_name: Option<String>,
1466    pub target_commitish: Option<String>,
1467}
1468
1469/// EditRepoOption options when editing a repository's properties
1470#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1471pub struct EditRepoOption {
1472    /// either `true` to allow fast-forward-only merging pull requests, or `false` to prevent fast-forward-only merging.
1473    pub allow_fast_forward_only_merge: Option<bool>,
1474    /// either `true` to allow mark pr as merged manually, or `false` to prevent it.
1475    pub allow_manual_merge: Option<bool>,
1476    /// either `true` to allow merging pull requests with a merge commit, or `false` to prevent merging pull requests with merge commits.
1477    pub allow_merge_commits: Option<bool>,
1478    /// either `true` to allow rebase-merging pull requests, or `false` to prevent rebase-merging.
1479    pub allow_rebase: Option<bool>,
1480    /// either `true` to allow rebase with explicit merge commits (--no-ff), or `false` to prevent rebase with explicit merge commits.
1481    pub allow_rebase_explicit: Option<bool>,
1482    /// either `true` to allow updating pull request branch by rebase, or `false` to prevent it.
1483    pub allow_rebase_update: Option<bool>,
1484    /// either `true` to allow squash-merging pull requests, or `false` to prevent squash-merging.
1485    pub allow_squash_merge: Option<bool>,
1486    /// set to `true` to archive this repository.
1487    pub archived: Option<bool>,
1488    /// either `true` to enable AutodetectManualMerge, or `false` to prevent it. Note: In some special cases, misjudgments can occur.
1489    pub autodetect_manual_merge: Option<bool>,
1490    /// set to `true` to allow edits from maintainers by default
1491    pub default_allow_maintainer_edit: Option<bool>,
1492    /// sets the default branch for this repository.
1493    pub default_branch: Option<String>,
1494    /// set to `true` to delete pr branch after merge by default
1495    pub default_delete_branch_after_merge: Option<bool>,
1496    pub default_merge_style: Option<DefaultMergeStyle>,
1497    /// set to a update style to be used by this repository: "rebase" or "merge"
1498    pub default_update_style: Option<String>,
1499    /// a short description of the repository.
1500    pub description: Option<String>,
1501    /// enable prune - remove obsolete remote-tracking references when mirroring
1502    pub enable_prune: Option<bool>,
1503    pub external_tracker: Option<ExternalTracker>,
1504    pub external_wiki: Option<ExternalWiki>,
1505    /// set the globally editable state of the wiki
1506    pub globally_editable_wiki: Option<bool>,
1507    /// either `true` to enable actions unit, or `false` to disable them.
1508    pub has_actions: Option<bool>,
1509    /// either `true` to enable issues for this repository or `false` to disable them.
1510    pub has_issues: Option<bool>,
1511    /// either `true` to enable packages unit, or `false` to disable them.
1512    pub has_packages: Option<bool>,
1513    /// either `true` to enable project unit, or `false` to disable them.
1514    pub has_projects: Option<bool>,
1515    /// either `true` to allow pull requests, or `false` to prevent pull request.
1516    pub has_pull_requests: Option<bool>,
1517    /// either `true` to enable releases unit, or `false` to disable them.
1518    pub has_releases: Option<bool>,
1519    /// either `true` to enable the wiki for this repository or `false` to disable it.
1520    pub has_wiki: Option<bool>,
1521    /// either `true` to ignore whitespace for conflicts, or `false` to not ignore whitespace.
1522    pub ignore_whitespace_conflicts: Option<bool>,
1523    pub internal_tracker: Option<InternalTracker>,
1524    /// set to a string like `8h30m0s` to set the mirror interval time
1525    pub mirror_interval: Option<String>,
1526    /// name of the repository
1527    pub name: Option<String>,
1528    /// either `true` to make the repository private or `false` to make it public.
1529    ///
1530    /// Note: you will get a 422 error if the organization restricts changing repository visibility to organization
1531    ///
1532    /// owners and a non-owner tries to change the value of private.
1533    pub private: Option<bool>,
1534    /// either `true` to make this repository a template or `false` to make it a normal repository
1535    pub template: Option<bool>,
1536    /// a URL with more information about the repository.
1537    pub website: Option<String>,
1538    /// sets the branch used for this repository's wiki.
1539    pub wiki_branch: Option<String>,
1540}
1541
1542/// EditTagProtectionOption options for editing a tag protection
1543#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1544pub struct EditTagProtectionOption {
1545    pub name_pattern: Option<String>,
1546    pub whitelist_teams: Option<Vec<String>>,
1547    pub whitelist_usernames: Option<Vec<String>>,
1548}
1549
1550/// EditTeamOption options for editing a team
1551#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1552pub struct EditTeamOption {
1553    pub can_create_org_repo: Option<bool>,
1554    pub description: Option<String>,
1555    pub includes_all_repositories: Option<bool>,
1556    pub name: String,
1557    pub permission: Option<EditTeamOptionPermission>,
1558    pub units: Option<Vec<String>>,
1559    pub units_map: Option<BTreeMap<String, String>>,
1560}
1561
1562#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
1563pub enum EditTeamOptionPermission {
1564    #[serde(rename = "read")]
1565    Read,
1566    #[serde(rename = "write")]
1567    Write,
1568    #[serde(rename = "admin")]
1569    Admin,
1570}
1571/// EditUserOption edit user options
1572#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1573pub struct EditUserOption {
1574    pub active: Option<bool>,
1575    pub admin: Option<bool>,
1576    pub allow_create_organization: Option<bool>,
1577    pub allow_git_hook: Option<bool>,
1578    pub allow_import_local: Option<bool>,
1579    pub description: Option<String>,
1580    pub email: Option<String>,
1581    pub full_name: Option<String>,
1582    pub location: Option<String>,
1583    pub login_name: Option<String>,
1584    pub max_repo_creation: Option<i64>,
1585    pub must_change_password: Option<bool>,
1586    pub password: Option<String>,
1587    pub prohibit_login: Option<bool>,
1588    pub pronouns: Option<String>,
1589    pub restricted: Option<bool>,
1590    pub source_id: Option<i64>,
1591    pub visibility: Option<String>,
1592    pub website: Option<String>,
1593}
1594
1595/// Email an email address belonging to a user
1596#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1597pub struct Email {
1598    pub email: Option<String>,
1599    pub primary: Option<bool>,
1600    pub user_id: Option<i64>,
1601    pub username: Option<String>,
1602    pub verified: Option<bool>,
1603}
1604
1605impl_from_response!(Email);
1606
1607/// ExternalTracker represents settings for external tracker
1608#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1609pub struct ExternalTracker {
1610    /// External Issue Tracker URL Format. Use the placeholders {user}, {repo} and {index} for the username, repository name and issue index.
1611    pub external_tracker_format: Option<String>,
1612    /// External Issue Tracker issue regular expression
1613    pub external_tracker_regexp_pattern: Option<String>,
1614    /// External Issue Tracker Number Format, either `numeric`, `alphanumeric`, or `regexp`
1615    pub external_tracker_style: Option<String>,
1616    #[serde(deserialize_with = "crate::none_if_blank_url")]
1617    /// URL of external issue tracker.
1618    pub external_tracker_url: Option<url::Url>,
1619}
1620
1621/// ExternalWiki represents setting for external wiki
1622#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1623pub struct ExternalWiki {
1624    #[serde(deserialize_with = "crate::none_if_blank_url")]
1625    /// URL of external wiki.
1626    pub external_wiki_url: Option<url::Url>,
1627}
1628
1629#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1630pub struct FileCommitResponse {
1631    pub author: Option<CommitUser>,
1632    pub committer: Option<CommitUser>,
1633    #[serde(with = "time::serde::rfc3339::option")]
1634    pub created: Option<time::OffsetDateTime>,
1635    #[serde(deserialize_with = "crate::none_if_blank_url")]
1636    pub html_url: Option<url::Url>,
1637    pub message: Option<String>,
1638    pub parents: Option<Vec<CommitMeta>>,
1639    pub sha: Option<String>,
1640    pub tree: Option<CommitMeta>,
1641    #[serde(deserialize_with = "crate::none_if_blank_url")]
1642    pub url: Option<url::Url>,
1643}
1644
1645/// FileDeleteResponse contains information about a repo's file that was deleted
1646#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1647pub struct FileDeleteResponse {
1648    pub commit: Option<FileCommitResponse>,
1649    pub content: Option<serde_json::Value>,
1650    pub verification: Option<PayloadCommitVerification>,
1651}
1652
1653impl_from_response!(FileDeleteResponse);
1654
1655/// FileLinksResponse contains the links for a repo's file
1656#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1657pub struct FileLinksResponse {
1658    pub git: Option<String>,
1659    pub html: Option<String>,
1660    #[serde(rename = "self")]
1661    pub this: Option<String>,
1662}
1663
1664/// FileResponse contains information about a repo's file
1665#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1666pub struct FileResponse {
1667    pub commit: Option<FileCommitResponse>,
1668    pub content: Option<ContentsResponse>,
1669    pub verification: Option<PayloadCommitVerification>,
1670}
1671
1672impl_from_response!(FileResponse);
1673
1674/// FilesResponse contains information about multiple files from a repo
1675#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1676pub struct FilesResponse {
1677    pub commit: Option<FileCommitResponse>,
1678    pub files: Option<Vec<ContentsResponse>>,
1679    pub verification: Option<PayloadCommitVerification>,
1680}
1681
1682impl_from_response!(FilesResponse);
1683
1684/// ForgeLike activity data type
1685#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1686pub struct ForgeLike {}
1687
1688/// GPGKey a user GPG key to sign commit and tag in repository
1689#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1690pub struct GPGKey {
1691    pub can_certify: Option<bool>,
1692    pub can_encrypt_comms: Option<bool>,
1693    pub can_encrypt_storage: Option<bool>,
1694    pub can_sign: Option<bool>,
1695    #[serde(with = "time::serde::rfc3339::option")]
1696    pub created_at: Option<time::OffsetDateTime>,
1697    pub emails: Option<Vec<GPGKeyEmail>>,
1698    #[serde(with = "time::serde::rfc3339::option")]
1699    pub expires_at: Option<time::OffsetDateTime>,
1700    pub id: Option<i64>,
1701    pub key_id: Option<String>,
1702    pub primary_key_id: Option<String>,
1703    pub public_key: Option<String>,
1704    pub subkeys: Option<Vec<GPGKey>>,
1705    pub verified: Option<bool>,
1706}
1707
1708impl_from_response!(GPGKey);
1709
1710/// GPGKeyEmail an email attached to a GPGKey
1711#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1712pub struct GPGKeyEmail {
1713    pub email: Option<String>,
1714    pub verified: Option<bool>,
1715}
1716
1717/// GeneralAPISettings contains global api settings exposed by it
1718#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1719pub struct GeneralAPISettings {
1720    pub default_git_trees_per_page: Option<i64>,
1721    pub default_max_blob_size: Option<i64>,
1722    pub default_paging_num: Option<i64>,
1723    pub max_response_items: Option<i64>,
1724}
1725
1726impl_from_response!(GeneralAPISettings);
1727
1728/// GeneralAttachmentSettings contains global Attachment settings exposed by API
1729#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1730pub struct GeneralAttachmentSettings {
1731    pub allowed_types: Option<String>,
1732    pub enabled: Option<bool>,
1733    pub max_files: Option<i64>,
1734    pub max_size: Option<i64>,
1735}
1736
1737impl_from_response!(GeneralAttachmentSettings);
1738
1739/// GeneralRepoSettings contains global repository settings exposed by API
1740#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1741pub struct GeneralRepoSettings {
1742    pub forks_disabled: Option<bool>,
1743    pub http_git_disabled: Option<bool>,
1744    pub lfs_disabled: Option<bool>,
1745    pub migrations_disabled: Option<bool>,
1746    pub mirrors_disabled: Option<bool>,
1747    pub stars_disabled: Option<bool>,
1748    pub time_tracking_disabled: Option<bool>,
1749}
1750
1751impl_from_response!(GeneralRepoSettings);
1752
1753/// GeneralUISettings contains global ui settings exposed by API
1754#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1755pub struct GeneralUISettings {
1756    pub allowed_reactions: Option<Vec<String>>,
1757    pub custom_emojis: Option<Vec<String>>,
1758    pub default_theme: Option<String>,
1759}
1760
1761impl_from_response!(GeneralUISettings);
1762
1763/// GenerateRepoOption options when creating repository using a template
1764#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1765pub struct GenerateRepoOption {
1766    /// include avatar of the template repo
1767    pub avatar: Option<bool>,
1768    /// Default branch of the new repository
1769    pub default_branch: Option<String>,
1770    /// Description of the repository to create
1771    pub description: Option<String>,
1772    /// include git content of default branch in template repo
1773    pub git_content: Option<bool>,
1774    /// include git hooks in template repo
1775    pub git_hooks: Option<bool>,
1776    /// include labels in template repo
1777    pub labels: Option<bool>,
1778    /// Name of the repository to create
1779    pub name: String,
1780    /// The organization or person who will own the new repository
1781    pub owner: String,
1782    /// Whether the repository is private
1783    pub private: Option<bool>,
1784    /// include protected branches in template repo
1785    pub protected_branch: Option<bool>,
1786    /// include topics in template repo
1787    pub topics: Option<bool>,
1788    /// include webhooks in template repo
1789    pub webhooks: Option<bool>,
1790}
1791
1792/// GitBlob represents a git blob
1793#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1794pub struct GitBlob {
1795    pub content: Option<String>,
1796    pub encoding: Option<String>,
1797    pub sha: Option<String>,
1798    pub size: Option<i64>,
1799    #[serde(deserialize_with = "crate::none_if_blank_url")]
1800    pub url: Option<url::Url>,
1801}
1802
1803impl_from_response!(GitBlob);
1804
1805/// GitEntry represents a git tree
1806#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1807pub struct GitEntry {
1808    pub mode: Option<String>,
1809    pub path: Option<String>,
1810    pub sha: Option<String>,
1811    pub size: Option<i64>,
1812    #[serde(rename = "type")]
1813    pub r#type: Option<String>,
1814    #[serde(deserialize_with = "crate::none_if_blank_url")]
1815    pub url: Option<url::Url>,
1816}
1817
1818/// GitHook represents a Git repository hook
1819#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1820pub struct GitHook {
1821    pub content: Option<String>,
1822    pub is_active: Option<bool>,
1823    pub name: Option<String>,
1824}
1825
1826impl_from_response!(GitHook);
1827
1828#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1829pub struct GitObject {
1830    pub sha: Option<String>,
1831    #[serde(rename = "type")]
1832    pub r#type: Option<String>,
1833    #[serde(deserialize_with = "crate::none_if_blank_url")]
1834    pub url: Option<url::Url>,
1835}
1836
1837/// GitTreeResponse returns a git tree
1838#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1839pub struct GitTreeResponse {
1840    pub page: Option<i64>,
1841    pub sha: Option<String>,
1842    pub total_count: Option<i64>,
1843    pub tree: Option<Vec<GitEntry>>,
1844    pub truncated: Option<bool>,
1845    #[serde(deserialize_with = "crate::none_if_blank_url")]
1846    pub url: Option<url::Url>,
1847}
1848
1849impl_from_response!(GitTreeResponse);
1850
1851/// GitignoreTemplateInfo name and text of a gitignore template
1852#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1853pub struct GitignoreTemplateInfo {
1854    pub name: Option<String>,
1855    pub source: Option<String>,
1856}
1857
1858impl_from_response!(GitignoreTemplateInfo);
1859
1860/// Hook a hook is a web hook when one repository changed
1861#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1862pub struct Hook {
1863    pub active: Option<bool>,
1864    pub authorization_header: Option<String>,
1865    pub branch_filter: Option<String>,
1866    /// Deprecated: use Metadata instead
1867    pub config: Option<BTreeMap<String, String>>,
1868    pub content_type: Option<String>,
1869    #[serde(with = "time::serde::rfc3339::option")]
1870    pub created_at: Option<time::OffsetDateTime>,
1871    pub events: Option<Vec<String>>,
1872    pub id: Option<i64>,
1873    pub metadata: Option<serde_json::Value>,
1874    #[serde(rename = "type")]
1875    pub r#type: Option<String>,
1876    #[serde(with = "time::serde::rfc3339::option")]
1877    pub updated_at: Option<time::OffsetDateTime>,
1878    #[serde(deserialize_with = "crate::none_if_blank_url")]
1879    pub url: Option<url::Url>,
1880}
1881
1882impl_from_response!(Hook);
1883
1884/// Identity for a person's identity like an author or committer
1885#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1886pub struct Identity {
1887    pub email: Option<String>,
1888    pub name: Option<String>,
1889}
1890
1891/// InternalTracker represents settings for internal tracker
1892#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1893pub struct InternalTracker {
1894    /// Let only contributors track time (Built-in issue tracker)
1895    pub allow_only_contributors_to_track_time: Option<bool>,
1896    /// Enable dependencies for issues and pull requests (Built-in issue tracker)
1897    pub enable_issue_dependencies: Option<bool>,
1898    /// Enable time tracking (Built-in issue tracker)
1899    pub enable_time_tracker: Option<bool>,
1900}
1901
1902/// Issue represents an issue in a repository
1903#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1904pub struct Issue {
1905    pub assets: Option<Vec<Attachment>>,
1906    pub assignee: Option<User>,
1907    pub assignees: Option<Vec<User>>,
1908    pub body: Option<String>,
1909    #[serde(with = "time::serde::rfc3339::option")]
1910    pub closed_at: Option<time::OffsetDateTime>,
1911    pub comments: Option<i64>,
1912    #[serde(with = "time::serde::rfc3339::option")]
1913    pub created_at: Option<time::OffsetDateTime>,
1914    #[serde(with = "time::serde::rfc3339::option")]
1915    pub due_date: Option<time::OffsetDateTime>,
1916    #[serde(deserialize_with = "crate::none_if_blank_url")]
1917    pub html_url: Option<url::Url>,
1918    pub id: Option<i64>,
1919    pub is_locked: Option<bool>,
1920    pub labels: Option<Vec<Label>>,
1921    pub milestone: Option<Milestone>,
1922    pub number: Option<i64>,
1923    pub original_author: Option<String>,
1924    pub original_author_id: Option<i64>,
1925    pub pin_order: Option<i64>,
1926    pub pull_request: Option<PullRequestMeta>,
1927    #[serde(rename = "ref")]
1928    pub r#ref: Option<String>,
1929    pub repository: Option<RepositoryMeta>,
1930    pub state: Option<StateType>,
1931    pub title: Option<String>,
1932    #[serde(with = "time::serde::rfc3339::option")]
1933    pub updated_at: Option<time::OffsetDateTime>,
1934    #[serde(deserialize_with = "crate::none_if_blank_url")]
1935    pub url: Option<url::Url>,
1936    pub user: Option<User>,
1937}
1938
1939impl_from_response!(Issue);
1940
1941#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1942pub struct IssueConfig {
1943    pub blank_issues_enabled: Option<bool>,
1944    pub contact_links: Option<Vec<IssueConfigContactLink>>,
1945}
1946
1947impl_from_response!(IssueConfig);
1948
1949#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1950pub struct IssueConfigContactLink {
1951    pub about: Option<String>,
1952    pub name: Option<String>,
1953    #[serde(deserialize_with = "crate::none_if_blank_url")]
1954    pub url: Option<url::Url>,
1955}
1956
1957#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1958pub struct IssueConfigValidation {
1959    pub message: Option<String>,
1960    pub valid: Option<bool>,
1961}
1962
1963impl_from_response!(IssueConfigValidation);
1964
1965/// IssueDeadline represents an issue deadline
1966#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1967pub struct IssueDeadline {
1968    #[serde(with = "time::serde::rfc3339::option")]
1969    pub due_date: Option<time::OffsetDateTime>,
1970}
1971
1972impl_from_response!(IssueDeadline);
1973
1974/// IssueFormField represents a form field
1975#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1976pub struct IssueFormField {
1977    pub attributes: Option<BTreeMap<String, serde_json::Value>>,
1978    pub id: Option<String>,
1979    #[serde(rename = "type")]
1980    pub r#type: Option<IssueFormFieldType>,
1981    pub validations: Option<BTreeMap<String, serde_json::Value>>,
1982    pub visible: Option<Vec<String>>,
1983}
1984
1985#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
1986pub enum IssueFormFieldType {
1987    #[serde(rename = "markdown")]
1988    Markdown,
1989    #[serde(rename = "textarea")]
1990    Textarea,
1991    #[serde(rename = "input")]
1992    Input,
1993    #[serde(rename = "dropdown")]
1994    Dropdown,
1995    #[serde(rename = "checkboxes")]
1996    Checkboxes,
1997}
1998/// IssueLabelsOption a collection of labels
1999#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2000pub struct IssueLabelsOption {
2001    /// Labels can be a list of integers representing label IDs
2002    ///
2003    /// or a list of strings representing label names
2004    pub labels: Option<Vec<serde_json::Value>>,
2005    #[serde(with = "time::serde::rfc3339::option")]
2006    pub updated_at: Option<time::OffsetDateTime>,
2007}
2008
2009/// IssueMeta basic issue information
2010#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2011pub struct IssueMeta {
2012    pub index: Option<i64>,
2013    pub owner: Option<String>,
2014    pub repo: Option<String>,
2015}
2016
2017/// IssueTemplate represents an issue template for a repository
2018#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2019pub struct IssueTemplate {
2020    pub about: Option<String>,
2021    pub body: Option<Vec<IssueFormField>>,
2022    pub content: Option<String>,
2023    pub file_name: Option<String>,
2024    pub labels: Option<Vec<String>>,
2025    pub name: Option<String>,
2026    #[serde(rename = "ref")]
2027    pub r#ref: Option<String>,
2028    pub title: Option<String>,
2029}
2030
2031impl_from_response!(IssueTemplate);
2032
2033/// Label a label to an issue or a pr
2034#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2035pub struct Label {
2036    pub color: Option<String>,
2037    pub description: Option<String>,
2038    pub exclusive: Option<bool>,
2039    pub id: Option<i64>,
2040    pub is_archived: Option<bool>,
2041    pub name: Option<String>,
2042    #[serde(deserialize_with = "crate::none_if_blank_url")]
2043    pub url: Option<url::Url>,
2044}
2045
2046impl_from_response!(Label);
2047
2048/// LabelTemplate info of a Label template
2049#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2050pub struct LabelTemplate {
2051    pub color: Option<String>,
2052    pub description: Option<String>,
2053    pub exclusive: Option<bool>,
2054    pub name: Option<String>,
2055}
2056
2057impl_from_response!(LabelTemplate);
2058
2059/// LicensesInfo contains information about a License
2060#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2061pub struct LicenseTemplateInfo {
2062    pub body: Option<String>,
2063    pub implementation: Option<String>,
2064    pub key: Option<String>,
2065    pub name: Option<String>,
2066    #[serde(deserialize_with = "crate::none_if_blank_url")]
2067    pub url: Option<url::Url>,
2068}
2069
2070impl_from_response!(LicenseTemplateInfo);
2071
2072/// LicensesListEntry is used for the API
2073#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2074pub struct LicensesTemplateListEntry {
2075    pub key: Option<String>,
2076    pub name: Option<String>,
2077    #[serde(deserialize_with = "crate::none_if_blank_url")]
2078    pub url: Option<url::Url>,
2079}
2080
2081impl_from_response!(LicensesTemplateListEntry);
2082
2083/// ListActionRunResponse return a list of ActionRun
2084#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2085pub struct ListActionRunResponse {
2086    pub total_count: Option<i64>,
2087    pub workflow_runs: Option<Vec<ActionRun>>,
2088}
2089
2090impl_from_response!(ListActionRunResponse);
2091
2092/// MarkdownOption markdown options
2093#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2094pub struct MarkdownOption {
2095    /// Context to render
2096    ///
2097    ///
2098    ///
2099    /// in: body
2100    #[serde(rename = "Context")]
2101    pub context: Option<String>,
2102    /// Mode to render (comment, gfm, markdown)
2103    ///
2104    ///
2105    ///
2106    /// in: body
2107    #[serde(rename = "Mode")]
2108    pub mode: Option<String>,
2109    /// Text markdown to render
2110    ///
2111    ///
2112    ///
2113    /// in: body
2114    #[serde(rename = "Text")]
2115    pub text: Option<String>,
2116    /// Is it a wiki page ?
2117    ///
2118    ///
2119    ///
2120    /// in: body
2121    #[serde(rename = "Wiki")]
2122    pub wiki: Option<bool>,
2123}
2124
2125/// MarkupOption markup options
2126#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2127pub struct MarkupOption {
2128    /// The current branch path where the form gets posted
2129    ///
2130    ///
2131    ///
2132    /// in: body
2133    #[serde(rename = "BranchPath")]
2134    pub branch_path: Option<String>,
2135    /// Context to render
2136    ///
2137    ///
2138    ///
2139    /// in: body
2140    #[serde(rename = "Context")]
2141    pub context: Option<String>,
2142    /// File path for detecting extension in file mode
2143    ///
2144    ///
2145    ///
2146    /// in: body
2147    #[serde(rename = "FilePath")]
2148    pub file_path: Option<String>,
2149    /// Mode to render (comment, gfm, markdown, file)
2150    ///
2151    ///
2152    ///
2153    /// in: body
2154    #[serde(rename = "Mode")]
2155    pub mode: Option<String>,
2156    /// Text markup to render
2157    ///
2158    ///
2159    ///
2160    /// in: body
2161    #[serde(rename = "Text")]
2162    pub text: Option<String>,
2163    /// Is it a wiki page ?
2164    ///
2165    ///
2166    ///
2167    /// in: body
2168    #[serde(rename = "Wiki")]
2169    pub wiki: Option<bool>,
2170}
2171
2172/// MergePullRequestForm form for merging Pull Request
2173#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2174pub struct MergePullRequestOption {
2175    #[serde(rename = "Do")]
2176    pub r#do: MergePullRequestOptionDo,
2177    #[serde(rename = "MergeCommitID")]
2178    pub merge_commit_id: Option<String>,
2179    #[serde(rename = "MergeMessageField")]
2180    pub merge_message_field: Option<String>,
2181    #[serde(rename = "MergeTitleField")]
2182    pub merge_title_field: Option<String>,
2183    pub delete_branch_after_merge: Option<bool>,
2184    pub force_merge: Option<bool>,
2185    pub head_commit_id: Option<String>,
2186    pub merge_when_checks_succeed: Option<bool>,
2187}
2188
2189#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
2190pub enum MergePullRequestOptionDo {
2191    #[serde(rename = "merge")]
2192    Merge,
2193    #[serde(rename = "rebase")]
2194    Rebase,
2195    #[serde(rename = "rebase-merge")]
2196    RebaseMerge,
2197    #[serde(rename = "squash")]
2198    Squash,
2199    #[serde(rename = "fast-forward-only")]
2200    FastForwardOnly,
2201    #[serde(rename = "manually-merged")]
2202    ManuallyMerged,
2203}
2204/// MigrateRepoOptions options for migrating repository's
2205///
2206/// this is used to interact with api v1
2207#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2208pub struct MigrateRepoOptions {
2209    pub auth_password: Option<String>,
2210    pub auth_token: Option<String>,
2211    pub auth_username: Option<String>,
2212    pub clone_addr: String,
2213    pub description: Option<String>,
2214    pub issues: Option<bool>,
2215    pub labels: Option<bool>,
2216    pub lfs: Option<bool>,
2217    pub lfs_endpoint: Option<String>,
2218    pub milestones: Option<bool>,
2219    pub mirror: Option<bool>,
2220    pub mirror_interval: Option<String>,
2221    pub private: Option<bool>,
2222    pub pull_requests: Option<bool>,
2223    pub releases: Option<bool>,
2224    pub repo_name: String,
2225    /// Name of User or Organisation who will own Repo after migration
2226    pub repo_owner: Option<String>,
2227    pub service: Option<MigrateRepoOptionsService>,
2228    /// deprecated (only for backwards compatibility)
2229    pub uid: Option<i64>,
2230    pub wiki: Option<bool>,
2231}
2232
2233#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
2234pub enum MigrateRepoOptionsService {
2235    #[serde(rename = "git")]
2236    Git,
2237    #[serde(rename = "github")]
2238    Github,
2239    #[serde(rename = "gitea")]
2240    Gitea,
2241    #[serde(rename = "gitlab")]
2242    Gitlab,
2243    #[serde(rename = "gogs")]
2244    Gogs,
2245    #[serde(rename = "onedev")]
2246    Onedev,
2247    #[serde(rename = "gitbucket")]
2248    Gitbucket,
2249    #[serde(rename = "codebase")]
2250    Codebase,
2251}
2252/// Milestone milestone is a collection of issues on one repository
2253#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2254pub struct Milestone {
2255    #[serde(with = "time::serde::rfc3339::option")]
2256    pub closed_at: Option<time::OffsetDateTime>,
2257    pub closed_issues: Option<i64>,
2258    #[serde(with = "time::serde::rfc3339::option")]
2259    pub created_at: Option<time::OffsetDateTime>,
2260    pub description: Option<String>,
2261    #[serde(with = "time::serde::rfc3339::option")]
2262    pub due_on: Option<time::OffsetDateTime>,
2263    pub id: Option<i64>,
2264    pub open_issues: Option<i64>,
2265    pub state: Option<StateType>,
2266    pub title: Option<String>,
2267    #[serde(with = "time::serde::rfc3339::option")]
2268    pub updated_at: Option<time::OffsetDateTime>,
2269}
2270
2271impl_from_response!(Milestone);
2272
2273/// NewIssuePinsAllowed represents an API response that says if new Issue Pins are allowed
2274#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2275pub struct NewIssuePinsAllowed {
2276    pub issues: Option<bool>,
2277    pub pull_requests: Option<bool>,
2278}
2279
2280impl_from_response!(NewIssuePinsAllowed);
2281
2282/// NodeInfo contains standardized way of exposing metadata about a server running one of the distributed social networks
2283#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2284pub struct NodeInfo {
2285    pub metadata: Option<BTreeMap<String, serde_json::Value>>,
2286    #[serde(rename = "openRegistrations")]
2287    pub open_registrations: Option<bool>,
2288    pub protocols: Option<Vec<String>>,
2289    pub services: Option<NodeInfoServices>,
2290    pub software: Option<NodeInfoSoftware>,
2291    pub usage: Option<NodeInfoUsage>,
2292    pub version: Option<String>,
2293}
2294
2295impl_from_response!(NodeInfo);
2296
2297/// NodeInfoServices contains the third party sites this server can connect to via their application API
2298#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2299pub struct NodeInfoServices {
2300    pub inbound: Option<Vec<String>>,
2301    pub outbound: Option<Vec<String>>,
2302}
2303
2304/// NodeInfoSoftware contains Metadata about server software in use
2305#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2306pub struct NodeInfoSoftware {
2307    pub homepage: Option<String>,
2308    pub name: Option<String>,
2309    pub repository: Option<String>,
2310    pub version: Option<String>,
2311}
2312
2313/// NodeInfoUsage contains usage statistics for this server
2314#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2315pub struct NodeInfoUsage {
2316    #[serde(rename = "localComments")]
2317    pub local_comments: Option<i64>,
2318    #[serde(rename = "localPosts")]
2319    pub local_posts: Option<i64>,
2320    pub users: Option<NodeInfoUsageUsers>,
2321}
2322
2323/// NodeInfoUsageUsers contains statistics about the users of this server
2324#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2325pub struct NodeInfoUsageUsers {
2326    #[serde(rename = "activeHalfyear")]
2327    pub active_halfyear: Option<i64>,
2328    #[serde(rename = "activeMonth")]
2329    pub active_month: Option<i64>,
2330    pub total: Option<i64>,
2331}
2332
2333/// Note contains information related to a git note
2334#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2335pub struct Note {
2336    pub commit: Option<Commit>,
2337    pub message: Option<String>,
2338}
2339
2340impl_from_response!(Note);
2341
2342#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2343pub struct NoteOptions {
2344    pub message: Option<String>,
2345}
2346
2347/// NotificationCount number of unread notifications
2348#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2349pub struct NotificationCount {
2350    pub new: Option<i64>,
2351}
2352
2353impl_from_response!(NotificationCount);
2354
2355/// NotificationSubject contains the notification subject (Issue/Pull/Commit)
2356#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2357pub struct NotificationSubject {
2358    #[serde(deserialize_with = "crate::none_if_blank_url")]
2359    pub html_url: Option<url::Url>,
2360    #[serde(deserialize_with = "crate::none_if_blank_url")]
2361    pub latest_comment_html_url: Option<url::Url>,
2362    #[serde(deserialize_with = "crate::none_if_blank_url")]
2363    pub latest_comment_url: Option<url::Url>,
2364    pub state: Option<StateType>,
2365    pub title: Option<String>,
2366    #[serde(rename = "type")]
2367    pub r#type: Option<NotifySubjectType>,
2368    #[serde(deserialize_with = "crate::none_if_blank_url")]
2369    pub url: Option<url::Url>,
2370}
2371
2372/// NotificationThread expose Notification on API
2373#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2374pub struct NotificationThread {
2375    pub id: Option<i64>,
2376    pub pinned: Option<bool>,
2377    pub repository: Option<Repository>,
2378    pub subject: Option<NotificationSubject>,
2379    pub unread: Option<bool>,
2380    #[serde(with = "time::serde::rfc3339::option")]
2381    pub updated_at: Option<time::OffsetDateTime>,
2382    #[serde(deserialize_with = "crate::none_if_blank_url")]
2383    pub url: Option<url::Url>,
2384}
2385
2386impl_from_response!(NotificationThread);
2387
2388/// NotifySubjectType represent type of notification subject
2389
2390#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
2391pub enum NotifySubjectType {
2392    #[serde(rename = "Issue")]
2393    Issue,
2394    #[serde(rename = "Pull")]
2395    Pull,
2396    #[serde(rename = "Commit")]
2397    Commit,
2398    #[serde(rename = "Repository")]
2399    Repository,
2400}
2401#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2402pub struct OAuth2Application {
2403    pub client_id: Option<String>,
2404    pub client_secret: Option<String>,
2405    pub confidential_client: Option<bool>,
2406    #[serde(with = "time::serde::rfc3339::option")]
2407    pub created: Option<time::OffsetDateTime>,
2408    pub id: Option<i64>,
2409    pub name: Option<String>,
2410    pub redirect_uris: Option<Vec<String>>,
2411}
2412
2413impl_from_response!(OAuth2Application);
2414
2415/// ObjectFormatName of the underlying git repository
2416
2417#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
2418pub enum ObjectFormatName {
2419    #[serde(rename = "sha1")]
2420    Sha1,
2421    #[serde(rename = "sha256")]
2422    Sha256,
2423}
2424/// Organization represents an organization
2425#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2426pub struct Organization {
2427    #[serde(deserialize_with = "crate::none_if_blank_url")]
2428    pub avatar_url: Option<url::Url>,
2429    pub description: Option<String>,
2430    pub email: Option<String>,
2431    pub full_name: Option<String>,
2432    pub id: Option<i64>,
2433    pub location: Option<String>,
2434    pub name: Option<String>,
2435    pub repo_admin_change_team_access: Option<bool>,
2436    /// deprecated
2437    pub username: Option<String>,
2438    pub visibility: Option<String>,
2439    pub website: Option<String>,
2440}
2441
2442impl_from_response!(Organization);
2443
2444/// OrganizationPermissions list different users permissions on an organization
2445#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2446pub struct OrganizationPermissions {
2447    pub can_create_repository: Option<bool>,
2448    pub can_read: Option<bool>,
2449    pub can_write: Option<bool>,
2450    pub is_admin: Option<bool>,
2451    pub is_owner: Option<bool>,
2452}
2453
2454impl_from_response!(OrganizationPermissions);
2455
2456/// PRBranchInfo information about a branch
2457#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2458pub struct PRBranchInfo {
2459    pub label: Option<String>,
2460    #[serde(rename = "ref")]
2461    pub r#ref: Option<String>,
2462    pub repo: Option<Repository>,
2463    pub repo_id: Option<i64>,
2464    pub sha: Option<String>,
2465}
2466
2467/// Package represents a package
2468#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2469pub struct Package {
2470    #[serde(with = "time::serde::rfc3339::option")]
2471    pub created_at: Option<time::OffsetDateTime>,
2472    pub creator: Option<User>,
2473    #[serde(deserialize_with = "crate::none_if_blank_url")]
2474    pub html_url: Option<url::Url>,
2475    pub id: Option<i64>,
2476    pub name: Option<String>,
2477    pub owner: Option<User>,
2478    pub repository: Option<Repository>,
2479    #[serde(rename = "type")]
2480    pub r#type: Option<String>,
2481    pub version: Option<String>,
2482}
2483
2484impl_from_response!(Package);
2485
2486/// PackageFile represents a package file
2487#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2488pub struct PackageFile {
2489    #[serde(rename = "Size")]
2490    pub size: Option<i64>,
2491    pub id: Option<i64>,
2492    pub md5: Option<String>,
2493    pub name: Option<String>,
2494    pub sha1: Option<String>,
2495    pub sha256: Option<String>,
2496    pub sha512: Option<String>,
2497}
2498
2499impl_from_response!(PackageFile);
2500
2501/// PayloadCommit represents a commit
2502#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2503pub struct PayloadCommit {
2504    pub added: Option<Vec<String>>,
2505    pub author: Option<PayloadUser>,
2506    pub committer: Option<PayloadUser>,
2507    /// sha1 hash of the commit
2508    pub id: Option<String>,
2509    pub message: Option<String>,
2510    pub modified: Option<Vec<String>>,
2511    pub removed: Option<Vec<String>>,
2512    #[serde(with = "time::serde::rfc3339::option")]
2513    pub timestamp: Option<time::OffsetDateTime>,
2514    #[serde(deserialize_with = "crate::none_if_blank_url")]
2515    pub url: Option<url::Url>,
2516    pub verification: Option<PayloadCommitVerification>,
2517}
2518
2519/// PayloadCommitVerification represents the GPG verification of a commit
2520#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2521pub struct PayloadCommitVerification {
2522    pub payload: Option<String>,
2523    pub reason: Option<String>,
2524    pub signature: Option<String>,
2525    pub signer: Option<PayloadUser>,
2526    pub verified: Option<bool>,
2527}
2528
2529/// PayloadUser represents the author or committer of a commit
2530#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2531pub struct PayloadUser {
2532    pub email: Option<String>,
2533    /// Full name of the commit author
2534    pub name: Option<String>,
2535    pub username: Option<String>,
2536}
2537
2538/// Permission represents a set of permissions
2539#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2540pub struct Permission {
2541    pub admin: Option<bool>,
2542    pub pull: Option<bool>,
2543    pub push: Option<bool>,
2544}
2545
2546/// PublicKey publickey is a user key to push code to repository
2547#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2548pub struct PublicKey {
2549    #[serde(with = "time::serde::rfc3339::option")]
2550    pub created_at: Option<time::OffsetDateTime>,
2551    pub fingerprint: Option<String>,
2552    pub id: Option<i64>,
2553    pub key: Option<String>,
2554    pub key_type: Option<String>,
2555    pub read_only: Option<bool>,
2556    pub title: Option<String>,
2557    #[serde(deserialize_with = "crate::none_if_blank_url")]
2558    pub url: Option<url::Url>,
2559    pub user: Option<User>,
2560}
2561
2562impl_from_response!(PublicKey);
2563
2564/// PullRequest represents a pull request
2565#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2566pub struct PullRequest {
2567    pub additions: Option<i64>,
2568    pub allow_maintainer_edit: Option<bool>,
2569    pub assignee: Option<User>,
2570    pub assignees: Option<Vec<User>>,
2571    pub base: Option<PRBranchInfo>,
2572    pub body: Option<String>,
2573    pub changed_files: Option<i64>,
2574    #[serde(with = "time::serde::rfc3339::option")]
2575    pub closed_at: Option<time::OffsetDateTime>,
2576    pub comments: Option<i64>,
2577    #[serde(with = "time::serde::rfc3339::option")]
2578    pub created_at: Option<time::OffsetDateTime>,
2579    pub deletions: Option<i64>,
2580    #[serde(deserialize_with = "crate::none_if_blank_url")]
2581    pub diff_url: Option<url::Url>,
2582    pub draft: Option<bool>,
2583    #[serde(with = "time::serde::rfc3339::option")]
2584    pub due_date: Option<time::OffsetDateTime>,
2585    pub flow: Option<i64>,
2586    pub head: Option<PRBranchInfo>,
2587    #[serde(deserialize_with = "crate::none_if_blank_url")]
2588    pub html_url: Option<url::Url>,
2589    pub id: Option<i64>,
2590    pub is_locked: Option<bool>,
2591    pub labels: Option<Vec<Label>>,
2592    pub merge_base: Option<String>,
2593    pub merge_commit_sha: Option<String>,
2594    pub mergeable: Option<bool>,
2595    pub merged: Option<bool>,
2596    #[serde(with = "time::serde::rfc3339::option")]
2597    pub merged_at: Option<time::OffsetDateTime>,
2598    pub merged_by: Option<User>,
2599    pub milestone: Option<Milestone>,
2600    pub number: Option<i64>,
2601    #[serde(deserialize_with = "crate::none_if_blank_url")]
2602    pub patch_url: Option<url::Url>,
2603    pub pin_order: Option<i64>,
2604    #[serde(deserialize_with = "crate::requested_reviewers_ignore_null")]
2605    pub requested_reviewers: Option<Vec<User>>,
2606    pub requested_reviewers_teams: Option<Vec<Team>>,
2607    /// number of review comments made on the diff of a PR review (not including comments on commits or issues in a PR)
2608    pub review_comments: Option<i64>,
2609    pub state: Option<StateType>,
2610    pub title: Option<String>,
2611    #[serde(with = "time::serde::rfc3339::option")]
2612    pub updated_at: Option<time::OffsetDateTime>,
2613    #[serde(deserialize_with = "crate::none_if_blank_url")]
2614    pub url: Option<url::Url>,
2615    pub user: Option<User>,
2616}
2617
2618impl_from_response!(PullRequest);
2619
2620/// PullRequestMeta PR info if an issue is a PR
2621#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2622pub struct PullRequestMeta {
2623    pub draft: Option<bool>,
2624    #[serde(deserialize_with = "crate::none_if_blank_url")]
2625    pub html_url: Option<url::Url>,
2626    pub merged: Option<bool>,
2627    #[serde(with = "time::serde::rfc3339::option")]
2628    pub merged_at: Option<time::OffsetDateTime>,
2629}
2630
2631/// PullReview represents a pull request review
2632#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2633pub struct PullReview {
2634    pub body: Option<String>,
2635    pub comments_count: Option<i64>,
2636    pub commit_id: Option<String>,
2637    pub dismissed: Option<bool>,
2638    #[serde(deserialize_with = "crate::none_if_blank_url")]
2639    pub html_url: Option<url::Url>,
2640    pub id: Option<i64>,
2641    pub official: Option<bool>,
2642    #[serde(deserialize_with = "crate::none_if_blank_url")]
2643    pub pull_request_url: Option<url::Url>,
2644    pub stale: Option<bool>,
2645    pub state: Option<String>,
2646    #[serde(with = "time::serde::rfc3339::option")]
2647    pub submitted_at: Option<time::OffsetDateTime>,
2648    pub team: Option<Team>,
2649    #[serde(with = "time::serde::rfc3339::option")]
2650    pub updated_at: Option<time::OffsetDateTime>,
2651    pub user: Option<User>,
2652}
2653
2654impl_from_response!(PullReview);
2655
2656/// PullReviewComment represents a comment on a pull request review
2657#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2658pub struct PullReviewComment {
2659    pub body: Option<String>,
2660    pub commit_id: Option<String>,
2661    #[serde(with = "time::serde::rfc3339::option")]
2662    pub created_at: Option<time::OffsetDateTime>,
2663    pub diff_hunk: Option<String>,
2664    #[serde(deserialize_with = "crate::none_if_blank_url")]
2665    pub html_url: Option<url::Url>,
2666    pub id: Option<i64>,
2667    pub original_commit_id: Option<String>,
2668    pub original_position: Option<u64>,
2669    pub path: Option<String>,
2670    pub position: Option<u64>,
2671    pub pull_request_review_id: Option<i64>,
2672    #[serde(deserialize_with = "crate::none_if_blank_url")]
2673    pub pull_request_url: Option<url::Url>,
2674    pub resolver: Option<User>,
2675    #[serde(with = "time::serde::rfc3339::option")]
2676    pub updated_at: Option<time::OffsetDateTime>,
2677    pub user: Option<User>,
2678}
2679
2680impl_from_response!(PullReviewComment);
2681
2682/// PullReviewRequestOptions are options to add or remove pull review requests
2683#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2684pub struct PullReviewRequestOptions {
2685    pub reviewers: Option<Vec<String>>,
2686    pub team_reviewers: Option<Vec<String>>,
2687}
2688
2689/// PushMirror represents information of a push mirror
2690#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2691pub struct PushMirror {
2692    pub branch_filter: Option<String>,
2693    #[serde(with = "time::serde::rfc3339::option")]
2694    pub created: Option<time::OffsetDateTime>,
2695    pub interval: Option<String>,
2696    pub last_error: Option<String>,
2697    #[serde(with = "time::serde::rfc3339::option")]
2698    pub last_update: Option<time::OffsetDateTime>,
2699    pub public_key: Option<String>,
2700    pub remote_address: Option<String>,
2701    pub remote_name: Option<String>,
2702    pub repo_name: Option<String>,
2703    pub sync_on_commit: Option<bool>,
2704}
2705
2706impl_from_response!(PushMirror);
2707
2708/// QuotaGroup represents a quota group
2709#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2710pub struct QuotaGroup {
2711    /// Name of the group
2712    pub name: Option<String>,
2713    /// Rules associated with the group
2714    pub rules: Option<Vec<QuotaRuleInfo>>,
2715}
2716
2717impl_from_response!(QuotaGroup);
2718
2719/// QuotaInfo represents information about a user's quota
2720#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2721pub struct QuotaInfo {
2722    pub groups: Option<Vec<QuotaGroup>>,
2723    pub used: Option<QuotaUsed>,
2724}
2725
2726impl_from_response!(QuotaInfo);
2727
2728/// QuotaRuleInfo contains information about a quota rule
2729#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2730pub struct QuotaRuleInfo {
2731    /// The limit set by the rule
2732    pub limit: Option<i64>,
2733    /// Name of the rule (only shown to admins)
2734    pub name: Option<String>,
2735    /// Subjects the rule affects
2736    pub subjects: Option<Vec<String>>,
2737}
2738
2739impl_from_response!(QuotaRuleInfo);
2740
2741/// QuotaUsed represents the quota usage of a user
2742#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2743pub struct QuotaUsed {
2744    pub size: Option<QuotaUsedSize>,
2745}
2746
2747/// QuotaUsedArtifact represents an artifact counting towards a user's quota
2748#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2749pub struct QuotaUsedArtifact {
2750    #[serde(deserialize_with = "crate::none_if_blank_url")]
2751    /// HTML URL to the action run containing the artifact
2752    pub html_url: Option<url::Url>,
2753    /// Name of the artifact
2754    pub name: Option<String>,
2755    /// Size of the artifact (compressed)
2756    pub size: Option<i64>,
2757}
2758
2759impl_from_response!(QuotaUsedArtifact);
2760
2761/// QuotaUsedAttachment represents an attachment counting towards a user's quota
2762#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2763pub struct QuotaUsedAttachment {
2764    #[serde(deserialize_with = "crate::none_if_blank_url")]
2765    /// API URL for the attachment
2766    pub api_url: Option<url::Url>,
2767    /// Context for the attachment: URLs to the containing object
2768    pub contained_in: Option<QuotaUsedAttachmentContainedIn>,
2769    /// Filename of the attachment
2770    pub name: Option<String>,
2771    /// Size of the attachment (in bytes)
2772    pub size: Option<i64>,
2773}
2774
2775impl_from_response!(QuotaUsedAttachment);
2776
2777/// Context for the attachment: URLs to the containing object
2778#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2779pub struct QuotaUsedAttachmentContainedIn {
2780    #[serde(deserialize_with = "crate::none_if_blank_url")]
2781    /// API URL for the object that contains this attachment
2782    pub api_url: Option<url::Url>,
2783    #[serde(deserialize_with = "crate::none_if_blank_url")]
2784    /// HTML URL for the object that contains this attachment
2785    pub html_url: Option<url::Url>,
2786}
2787
2788/// QuotaUsedPackage represents a package counting towards a user's quota
2789#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2790pub struct QuotaUsedPackage {
2791    #[serde(deserialize_with = "crate::none_if_blank_url")]
2792    /// HTML URL to the package version
2793    pub html_url: Option<url::Url>,
2794    /// Name of the package
2795    pub name: Option<String>,
2796    /// Size of the package version
2797    pub size: Option<i64>,
2798    /// Type of the package
2799    #[serde(rename = "type")]
2800    pub r#type: Option<String>,
2801    /// Version of the package
2802    pub version: Option<String>,
2803}
2804
2805impl_from_response!(QuotaUsedPackage);
2806
2807/// QuotaUsedSize represents the size-based quota usage of a user
2808#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2809pub struct QuotaUsedSize {
2810    pub assets: Option<QuotaUsedSizeAssets>,
2811    pub git: Option<QuotaUsedSizeGit>,
2812    pub repos: Option<QuotaUsedSizeRepos>,
2813}
2814
2815/// QuotaUsedSizeAssets represents the size-based asset usage of a user
2816#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2817pub struct QuotaUsedSizeAssets {
2818    /// Storage size used for the user's artifacts
2819    pub artifacts: Option<i64>,
2820    pub attachments: Option<QuotaUsedSizeAssetsAttachments>,
2821    pub packages: Option<QuotaUsedSizeAssetsPackages>,
2822}
2823
2824/// QuotaUsedSizeAssetsAttachments represents the size-based attachment quota usage of a user
2825#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2826pub struct QuotaUsedSizeAssetsAttachments {
2827    /// Storage size used for the user's issue & comment attachments
2828    pub issues: Option<i64>,
2829    /// Storage size used for the user's release attachments
2830    pub releases: Option<i64>,
2831}
2832
2833/// QuotaUsedSizeAssetsPackages represents the size-based package quota usage of a user
2834#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2835pub struct QuotaUsedSizeAssetsPackages {
2836    /// Storage suze used for the user's packages
2837    pub all: Option<i64>,
2838}
2839
2840/// QuotaUsedSizeGit represents the size-based git (lfs) quota usage of a user
2841#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2842pub struct QuotaUsedSizeGit {
2843    /// Storage size of the user's Git LFS objects
2844    #[serde(rename = "LFS")]
2845    pub lfs: Option<i64>,
2846}
2847
2848/// QuotaUsedSizeRepos represents the size-based repository quota usage of a user
2849#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2850pub struct QuotaUsedSizeRepos {
2851    /// Storage size of the user's private repositories
2852    pub private: Option<i64>,
2853    /// Storage size of the user's public repositories
2854    pub public: Option<i64>,
2855}
2856
2857/// Reaction contain one reaction
2858#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2859pub struct Reaction {
2860    pub content: Option<String>,
2861    #[serde(with = "time::serde::rfc3339::option")]
2862    pub created_at: Option<time::OffsetDateTime>,
2863    pub user: Option<User>,
2864}
2865
2866impl_from_response!(Reaction);
2867
2868#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2869pub struct Reference {
2870    pub object: Option<GitObject>,
2871    #[serde(rename = "ref")]
2872    pub r#ref: Option<String>,
2873    #[serde(deserialize_with = "crate::none_if_blank_url")]
2874    pub url: Option<url::Url>,
2875}
2876
2877impl_from_response!(Reference);
2878
2879/// RegistrationToken is a string used to register a runner with a server
2880#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2881pub struct RegistrationToken {
2882    pub token: Option<String>,
2883}
2884
2885impl_from_response!(RegistrationToken);
2886
2887/// Release represents a repository release
2888#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2889pub struct Release {
2890    pub archive_download_count: Option<TagArchiveDownloadCount>,
2891    pub assets: Option<Vec<Attachment>>,
2892    pub author: Option<User>,
2893    pub body: Option<String>,
2894    #[serde(with = "time::serde::rfc3339::option")]
2895    pub created_at: Option<time::OffsetDateTime>,
2896    pub draft: Option<bool>,
2897    pub hide_archive_links: Option<bool>,
2898    #[serde(deserialize_with = "crate::none_if_blank_url")]
2899    pub html_url: Option<url::Url>,
2900    pub id: Option<i64>,
2901    pub name: Option<String>,
2902    pub prerelease: Option<bool>,
2903    #[serde(with = "time::serde::rfc3339::option")]
2904    pub published_at: Option<time::OffsetDateTime>,
2905    pub tag_name: Option<String>,
2906    #[serde(deserialize_with = "crate::none_if_blank_url")]
2907    pub tarball_url: Option<url::Url>,
2908    pub target_commitish: Option<String>,
2909    #[serde(deserialize_with = "crate::none_if_blank_url")]
2910    pub upload_url: Option<url::Url>,
2911    #[serde(deserialize_with = "crate::none_if_blank_url")]
2912    pub url: Option<url::Url>,
2913    #[serde(deserialize_with = "crate::none_if_blank_url")]
2914    pub zipball_url: Option<url::Url>,
2915}
2916
2917impl_from_response!(Release);
2918
2919/// RenameOrgOption options when renaming an organization
2920#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2921pub struct RenameOrgOption {
2922    /// New username for this org. This name cannot be in use yet by any other user.
2923    pub new_name: String,
2924}
2925
2926/// RenameUserOption options when renaming a user
2927#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2928pub struct RenameUserOption {
2929    /// New username for this user. This name cannot be in use yet by any other user.
2930    pub new_username: String,
2931}
2932
2933/// ReplaceFlagsOption options when replacing the flags of a repository
2934#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2935pub struct ReplaceFlagsOption {
2936    pub flags: Option<Vec<String>>,
2937}
2938
2939/// RepoCollaboratorPermission to get repository permission for a collaborator
2940#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2941pub struct RepoCollaboratorPermission {
2942    pub permission: Option<String>,
2943    pub role_name: Option<String>,
2944    pub user: Option<User>,
2945}
2946
2947impl_from_response!(RepoCollaboratorPermission);
2948
2949#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2950pub struct RepoCommit {
2951    pub author: Option<CommitUser>,
2952    pub committer: Option<CommitUser>,
2953    pub message: Option<String>,
2954    pub tree: Option<CommitMeta>,
2955    #[serde(deserialize_with = "crate::none_if_blank_url")]
2956    pub url: Option<url::Url>,
2957    pub verification: Option<PayloadCommitVerification>,
2958}
2959
2960/// RepoTopicOptions a collection of repo topic names
2961#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2962pub struct RepoTopicOptions {
2963    /// list of topic names
2964    pub topics: Option<Vec<String>>,
2965}
2966
2967/// RepoTransfer represents a pending repo transfer
2968#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2969pub struct RepoTransfer {
2970    pub doer: Option<User>,
2971    pub recipient: Option<User>,
2972    pub teams: Option<Vec<Team>>,
2973}
2974
2975/// Repository represents a repository
2976#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2977pub struct Repository {
2978    pub allow_fast_forward_only_merge: Option<bool>,
2979    pub allow_merge_commits: Option<bool>,
2980    pub allow_rebase: Option<bool>,
2981    pub allow_rebase_explicit: Option<bool>,
2982    pub allow_rebase_update: Option<bool>,
2983    pub allow_squash_merge: Option<bool>,
2984    pub archived: Option<bool>,
2985    #[serde(with = "time::serde::rfc3339::option")]
2986    pub archived_at: Option<time::OffsetDateTime>,
2987    #[serde(deserialize_with = "crate::none_if_blank_url")]
2988    pub avatar_url: Option<url::Url>,
2989    #[serde(deserialize_with = "crate::none_if_blank_url")]
2990    pub clone_url: Option<url::Url>,
2991    #[serde(with = "time::serde::rfc3339::option")]
2992    pub created_at: Option<time::OffsetDateTime>,
2993    pub default_allow_maintainer_edit: Option<bool>,
2994    pub default_branch: Option<String>,
2995    pub default_delete_branch_after_merge: Option<bool>,
2996    pub default_merge_style: Option<DefaultMergeStyle>,
2997    pub default_update_style: Option<String>,
2998    pub description: Option<String>,
2999    pub empty: Option<bool>,
3000    pub external_tracker: Option<ExternalTracker>,
3001    pub external_wiki: Option<ExternalWiki>,
3002    pub fork: Option<bool>,
3003    pub forks_count: Option<i64>,
3004    pub full_name: Option<String>,
3005    pub globally_editable_wiki: Option<bool>,
3006    pub has_actions: Option<bool>,
3007    pub has_issues: Option<bool>,
3008    pub has_packages: Option<bool>,
3009    pub has_projects: Option<bool>,
3010    pub has_pull_requests: Option<bool>,
3011    pub has_releases: Option<bool>,
3012    pub has_wiki: Option<bool>,
3013    #[serde(deserialize_with = "crate::none_if_blank_url")]
3014    pub html_url: Option<url::Url>,
3015    pub id: Option<i64>,
3016    pub ignore_whitespace_conflicts: Option<bool>,
3017    pub internal: Option<bool>,
3018    pub internal_tracker: Option<InternalTracker>,
3019    pub language: Option<String>,
3020    #[serde(deserialize_with = "crate::none_if_blank_url")]
3021    pub languages_url: Option<url::Url>,
3022    pub link: Option<String>,
3023    pub mirror: Option<bool>,
3024    pub mirror_interval: Option<String>,
3025    #[serde(with = "time::serde::rfc3339::option")]
3026    pub mirror_updated: Option<time::OffsetDateTime>,
3027    pub name: Option<String>,
3028    pub object_format_name: Option<ObjectFormatName>,
3029    pub open_issues_count: Option<i64>,
3030    pub open_pr_counter: Option<i64>,
3031    #[serde(deserialize_with = "crate::none_if_blank_url")]
3032    pub original_url: Option<url::Url>,
3033    pub owner: Option<User>,
3034    pub parent: Option<Box<Repository>>,
3035    pub permissions: Option<Permission>,
3036    pub private: Option<bool>,
3037    pub release_counter: Option<i64>,
3038    pub repo_transfer: Option<RepoTransfer>,
3039    pub size: Option<i64>,
3040    #[serde(deserialize_with = "crate::deserialize_optional_ssh_url")]
3041    pub ssh_url: Option<url::Url>,
3042    pub stars_count: Option<i64>,
3043    pub template: Option<bool>,
3044    pub topics: Option<Vec<String>>,
3045    #[serde(with = "time::serde::rfc3339::option")]
3046    pub updated_at: Option<time::OffsetDateTime>,
3047    #[serde(deserialize_with = "crate::none_if_blank_url")]
3048    pub url: Option<url::Url>,
3049    pub watchers_count: Option<i64>,
3050    pub website: Option<String>,
3051    pub wiki_branch: Option<String>,
3052}
3053
3054impl_from_response!(Repository);
3055
3056/// RepositoryMeta basic repository information
3057#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3058pub struct RepositoryMeta {
3059    pub full_name: Option<String>,
3060    pub id: Option<i64>,
3061    pub name: Option<String>,
3062    pub owner: Option<String>,
3063}
3064
3065/// SearchResults results of a successful search
3066#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3067pub struct SearchResults {
3068    pub data: Option<Vec<Repository>>,
3069    pub ok: Option<bool>,
3070}
3071
3072impl_from_response!(SearchResults);
3073
3074/// Secret represents a secret
3075#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3076pub struct Secret {
3077    #[serde(with = "time::serde::rfc3339::option")]
3078    pub created_at: Option<time::OffsetDateTime>,
3079    /// the secret's name
3080    pub name: Option<String>,
3081}
3082
3083impl_from_response!(Secret);
3084
3085/// ServerVersion wraps the version of the server
3086#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3087pub struct ServerVersion {
3088    pub version: Option<String>,
3089}
3090
3091impl_from_response!(ServerVersion);
3092
3093/// SetUserQuotaGroupsOptions represents the quota groups of a user
3094#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3095pub struct SetUserQuotaGroupsOptions {
3096    /// Quota groups the user shall have
3097    pub groups: Vec<String>,
3098}
3099
3100/// StateType issue state type
3101
3102#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
3103pub enum StateType {
3104    #[serde(rename = "open")]
3105    Open,
3106    #[serde(rename = "closed")]
3107    Closed,
3108}
3109/// StopWatch represent a running stopwatch
3110#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3111pub struct StopWatch {
3112    #[serde(with = "time::serde::rfc3339::option")]
3113    pub created: Option<time::OffsetDateTime>,
3114    pub duration: Option<String>,
3115    pub issue_index: Option<i64>,
3116    pub issue_title: Option<String>,
3117    pub repo_name: Option<String>,
3118    pub repo_owner_name: Option<String>,
3119    pub seconds: Option<i64>,
3120}
3121
3122impl_from_response!(StopWatch);
3123
3124/// SubmitPullReviewOptions are options to submit a pending pull review
3125#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3126pub struct SubmitPullReviewOptions {
3127    pub body: Option<String>,
3128    pub event: Option<String>,
3129}
3130
3131/// SyncForkInfo information about syncing a fork
3132#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3133pub struct SyncForkInfo {
3134    pub allowed: Option<bool>,
3135    pub base_commit: Option<String>,
3136    pub commits_behind: Option<i64>,
3137    pub fork_commit: Option<String>,
3138}
3139
3140impl_from_response!(SyncForkInfo);
3141
3142/// Tag represents a repository tag
3143#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3144pub struct Tag {
3145    pub archive_download_count: Option<TagArchiveDownloadCount>,
3146    pub commit: Option<CommitMeta>,
3147    pub id: Option<String>,
3148    pub message: Option<String>,
3149    pub name: Option<String>,
3150    #[serde(deserialize_with = "crate::none_if_blank_url")]
3151    pub tarball_url: Option<url::Url>,
3152    #[serde(deserialize_with = "crate::none_if_blank_url")]
3153    pub zipball_url: Option<url::Url>,
3154}
3155
3156impl_from_response!(Tag);
3157
3158/// TagArchiveDownloadCount counts how many times a archive was downloaded
3159#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3160pub struct TagArchiveDownloadCount {
3161    pub tar_gz: Option<i64>,
3162    pub zip: Option<i64>,
3163}
3164
3165/// TagProtection represents a tag protection
3166#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3167pub struct TagProtection {
3168    #[serde(with = "time::serde::rfc3339::option")]
3169    pub created_at: Option<time::OffsetDateTime>,
3170    pub id: Option<i64>,
3171    pub name_pattern: Option<String>,
3172    #[serde(with = "time::serde::rfc3339::option")]
3173    pub updated_at: Option<time::OffsetDateTime>,
3174    pub whitelist_teams: Option<Vec<String>>,
3175    pub whitelist_usernames: Option<Vec<String>>,
3176}
3177
3178impl_from_response!(TagProtection);
3179
3180/// Team represents a team in an organization
3181#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3182pub struct Team {
3183    pub can_create_org_repo: Option<bool>,
3184    pub description: Option<String>,
3185    pub id: Option<i64>,
3186    pub includes_all_repositories: Option<bool>,
3187    pub name: Option<String>,
3188    pub organization: Option<Organization>,
3189    pub permission: Option<TeamPermission>,
3190    pub units: Option<Vec<String>>,
3191    pub units_map: Option<BTreeMap<String, String>>,
3192}
3193
3194impl_from_response!(Team);
3195
3196#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
3197pub enum TeamPermission {
3198    #[serde(rename = "none")]
3199    None,
3200    #[serde(rename = "read")]
3201    Read,
3202    #[serde(rename = "write")]
3203    Write,
3204    #[serde(rename = "admin")]
3205    Admin,
3206    #[serde(rename = "owner")]
3207    Owner,
3208}
3209/// TimelineComment represents a timeline comment (comment of any type) on a commit or issue
3210#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3211pub struct TimelineComment {
3212    pub assignee: Option<User>,
3213    pub assignee_team: Option<Team>,
3214    pub body: Option<String>,
3215    #[serde(with = "time::serde::rfc3339::option")]
3216    pub created_at: Option<time::OffsetDateTime>,
3217    pub dependent_issue: Option<Issue>,
3218    #[serde(deserialize_with = "crate::none_if_blank_url")]
3219    pub html_url: Option<url::Url>,
3220    pub id: Option<i64>,
3221    #[serde(deserialize_with = "crate::none_if_blank_url")]
3222    pub issue_url: Option<url::Url>,
3223    pub label: Option<Label>,
3224    pub milestone: Option<Milestone>,
3225    pub new_ref: Option<String>,
3226    pub new_title: Option<String>,
3227    pub old_milestone: Option<Milestone>,
3228    pub old_project_id: Option<i64>,
3229    pub old_ref: Option<String>,
3230    pub old_title: Option<String>,
3231    pub project_id: Option<i64>,
3232    #[serde(deserialize_with = "crate::none_if_blank_url")]
3233    pub pull_request_url: Option<url::Url>,
3234    pub ref_action: Option<String>,
3235    pub ref_comment: Option<Comment>,
3236    /// commit SHA where issue/PR was referenced
3237    pub ref_commit_sha: Option<String>,
3238    pub ref_issue: Option<Issue>,
3239    /// whether the assignees were removed or added
3240    pub removed_assignee: Option<bool>,
3241    pub resolve_doer: Option<User>,
3242    pub review_id: Option<i64>,
3243    pub tracked_time: Option<TrackedTime>,
3244    #[serde(rename = "type")]
3245    pub r#type: Option<String>,
3246    #[serde(with = "time::serde::rfc3339::option")]
3247    pub updated_at: Option<time::OffsetDateTime>,
3248    pub user: Option<User>,
3249}
3250
3251impl_from_response!(TimelineComment);
3252
3253/// TopicName a list of repo topic names
3254#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3255pub struct TopicName {
3256    pub topics: Option<Vec<String>>,
3257}
3258
3259impl_from_response!(TopicName);
3260
3261/// TopicResponse for returning topics
3262#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3263pub struct TopicResponse {
3264    #[serde(with = "time::serde::rfc3339::option")]
3265    pub created: Option<time::OffsetDateTime>,
3266    pub id: Option<i64>,
3267    pub repo_count: Option<i64>,
3268    pub topic_name: Option<String>,
3269    #[serde(with = "time::serde::rfc3339::option")]
3270    pub updated: Option<time::OffsetDateTime>,
3271}
3272
3273/// TrackedTime worked time for an issue / pr
3274#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3275pub struct TrackedTime {
3276    #[serde(with = "time::serde::rfc3339::option")]
3277    pub created: Option<time::OffsetDateTime>,
3278    pub id: Option<i64>,
3279    pub issue: Option<Issue>,
3280    /// deprecated (only for backwards compatibility)
3281    pub issue_id: Option<i64>,
3282    /// Time in seconds
3283    pub time: Option<i64>,
3284    /// deprecated (only for backwards compatibility)
3285    pub user_id: Option<i64>,
3286    pub user_name: Option<String>,
3287}
3288
3289impl_from_response!(TrackedTime);
3290
3291/// TransferRepoOption options when transfer a repository's ownership
3292#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3293pub struct TransferRepoOption {
3294    pub new_owner: String,
3295    /// ID of the team or teams to add to the repository. Teams can only be added to organization-owned repositories.
3296    pub team_ids: Option<Vec<i64>>,
3297}
3298
3299/// UpdateBranchRepoOption options when updating a branch in a repository
3300#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3301pub struct UpdateBranchRepoOption {
3302    /// New branch name
3303    pub name: String,
3304}
3305
3306/// UpdateFileOptions options for updating files
3307///
3308/// Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
3309#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3310pub struct UpdateFileOptions {
3311    pub author: Option<Identity>,
3312    /// branch (optional) to base this file from. if not given, the default branch is used
3313    pub branch: Option<String>,
3314    pub committer: Option<Identity>,
3315    /// content must be base64 encoded
3316    pub content: String,
3317    pub dates: Option<CommitDateOptions>,
3318    /// from_path (optional) is the path of the original file which will be moved/renamed to the path in the URL
3319    pub from_path: Option<String>,
3320    /// message (optional) for the commit of this file. if not supplied, a default message will be used
3321    pub message: Option<String>,
3322    /// new_branch (optional) will make a new branch from `branch` before creating the file
3323    pub new_branch: Option<String>,
3324    /// sha is the SHA for the file that already exists
3325    pub sha: String,
3326    /// Add a Signed-off-by trailer by the committer at the end of the commit log message.
3327    pub signoff: Option<bool>,
3328}
3329
3330/// UpdateRepoAvatarUserOption options when updating the repo avatar
3331#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3332pub struct UpdateRepoAvatarOption {
3333    /// image must be base64 encoded
3334    pub image: Option<String>,
3335}
3336
3337/// UpdateUserAvatarUserOption options when updating the user avatar
3338#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3339pub struct UpdateUserAvatarOption {
3340    /// image must be base64 encoded
3341    pub image: Option<String>,
3342}
3343
3344/// UpdateVariableOption the option when updating variable
3345#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3346pub struct UpdateVariableOption {
3347    /// New name for the variable. If the field is empty, the variable name won't be updated.
3348    pub name: Option<String>,
3349    /// Value of the variable to update
3350    pub value: String,
3351}
3352
3353/// User represents a user
3354#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3355pub struct User {
3356    /// Is user active
3357    pub active: Option<bool>,
3358    #[serde(deserialize_with = "crate::none_if_blank_url")]
3359    /// URL to the user's avatar
3360    pub avatar_url: Option<url::Url>,
3361    #[serde(with = "time::serde::rfc3339::option")]
3362    pub created: Option<time::OffsetDateTime>,
3363    /// the user's description
3364    pub description: Option<String>,
3365    pub email: Option<String>,
3366    /// user counts
3367    pub followers_count: Option<i64>,
3368    pub following_count: Option<i64>,
3369    /// the user's full name
3370    pub full_name: Option<String>,
3371    #[serde(deserialize_with = "crate::none_if_blank_url")]
3372    /// URL to the user's profile page
3373    pub html_url: Option<url::Url>,
3374    /// the user's id
3375    pub id: Option<i64>,
3376    /// Is the user an administrator
3377    pub is_admin: Option<bool>,
3378    /// User locale
3379    pub language: Option<String>,
3380    #[serde(with = "time::serde::rfc3339::option")]
3381    pub last_login: Option<time::OffsetDateTime>,
3382    /// the user's location
3383    pub location: Option<String>,
3384    /// the user's username
3385    pub login: Option<String>,
3386    /// the user's authentication sign-in name.
3387    pub login_name: Option<String>,
3388    /// Is user login prohibited
3389    pub prohibit_login: Option<bool>,
3390    /// the user's pronouns
3391    pub pronouns: Option<String>,
3392    /// Is user restricted
3393    pub restricted: Option<bool>,
3394    /// The ID of the user's Authentication Source
3395    pub source_id: Option<i64>,
3396    pub starred_repos_count: Option<i64>,
3397    /// User visibility level option: public, limited, private
3398    pub visibility: Option<String>,
3399    /// the user's website
3400    pub website: Option<String>,
3401}
3402
3403impl_from_response!(User);
3404
3405/// UserHeatmapData represents the data needed to create a heatmap
3406#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3407pub struct UserHeatmapData {
3408    pub contributions: Option<i64>,
3409    pub timestamp: Option<i64>,
3410}
3411
3412impl_from_response!(UserHeatmapData);
3413
3414/// UserSettings represents user settings
3415#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3416pub struct UserSettings {
3417    pub description: Option<String>,
3418    pub diff_view_style: Option<String>,
3419    pub enable_repo_unit_hints: Option<bool>,
3420    pub full_name: Option<String>,
3421    pub hide_activity: Option<bool>,
3422    /// Privacy
3423    pub hide_email: Option<bool>,
3424    pub hide_pronouns: Option<bool>,
3425    pub language: Option<String>,
3426    pub location: Option<String>,
3427    pub pronouns: Option<String>,
3428    pub theme: Option<String>,
3429    pub website: Option<String>,
3430}
3431
3432impl_from_response!(UserSettings);
3433
3434/// UserSettingsOptions represents options to change user settings
3435#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3436pub struct UserSettingsOptions {
3437    pub description: Option<String>,
3438    pub diff_view_style: Option<String>,
3439    pub enable_repo_unit_hints: Option<bool>,
3440    pub full_name: Option<String>,
3441    pub hide_activity: Option<bool>,
3442    /// Privacy
3443    pub hide_email: Option<bool>,
3444    pub hide_pronouns: Option<bool>,
3445    pub language: Option<String>,
3446    pub location: Option<String>,
3447    pub pronouns: Option<String>,
3448    pub theme: Option<String>,
3449    pub website: Option<String>,
3450}
3451
3452/// VerifyGPGKeyOption options verifies user GPG key
3453#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3454pub struct VerifyGPGKeyOption {
3455    pub armored_signature: Option<String>,
3456    /// An Signature for a GPG key token
3457    pub key_id: String,
3458}
3459
3460/// WatchInfo represents an API watch status of one repository
3461#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3462pub struct WatchInfo {
3463    #[serde(with = "time::serde::rfc3339::option")]
3464    pub created_at: Option<time::OffsetDateTime>,
3465    pub ignored: Option<bool>,
3466    pub reason: Option<serde_json::Value>,
3467    #[serde(deserialize_with = "crate::none_if_blank_url")]
3468    pub repository_url: Option<url::Url>,
3469    pub subscribed: Option<bool>,
3470    #[serde(deserialize_with = "crate::none_if_blank_url")]
3471    pub url: Option<url::Url>,
3472}
3473
3474impl_from_response!(WatchInfo);
3475
3476/// WikiCommit page commit/revision
3477#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3478pub struct WikiCommit {
3479    pub author: Option<CommitUser>,
3480    pub commiter: Option<CommitUser>,
3481    pub message: Option<String>,
3482    pub sha: Option<String>,
3483}
3484
3485/// WikiCommitList commit/revision list
3486#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3487pub struct WikiCommitList {
3488    pub commits: Option<Vec<WikiCommit>>,
3489    pub count: Option<i64>,
3490}
3491
3492impl_from_response!(WikiCommitList);
3493
3494/// WikiPage a wiki page
3495#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3496pub struct WikiPage {
3497    pub commit_count: Option<i64>,
3498    /// Page content, base64 encoded
3499    pub content_base64: Option<String>,
3500    pub footer: Option<String>,
3501    #[serde(deserialize_with = "crate::none_if_blank_url")]
3502    pub html_url: Option<url::Url>,
3503    pub last_commit: Option<WikiCommit>,
3504    pub sidebar: Option<String>,
3505    pub sub_url: Option<String>,
3506    pub title: Option<String>,
3507}
3508
3509impl_from_response!(WikiPage);
3510
3511/// WikiPageMetaData wiki page meta information
3512#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
3513pub struct WikiPageMetaData {
3514    #[serde(deserialize_with = "crate::none_if_blank_url")]
3515    pub html_url: Option<url::Url>,
3516    pub last_commit: Option<WikiCommit>,
3517    pub sub_url: Option<String>,
3518    pub title: Option<String>,
3519}
3520
3521impl_from_response!(WikiPageMetaData);
3522
3523pub struct AccessTokenListHeaders {
3524    pub x_total_count: Option<i64>,
3525}
3526
3527impl TryFrom<&reqwest::header::HeaderMap> for AccessTokenListHeaders {
3528    type Error = StructureError;
3529
3530    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3531        let x_total_count = map
3532            .get("x-total-count")
3533            .map(|s| -> Result<_, _> {
3534                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3535                s.parse::<i64>()
3536                    .map_err(|_| StructureError::HeaderParseFailed)
3537            })
3538            .transpose()?;
3539        Ok(Self { x_total_count })
3540    }
3541}
3542
3543impl crate::sealed::Sealed for AccessTokenListHeaders {}
3544impl crate::CountHeader for AccessTokenListHeaders {
3545    fn count(&self) -> Option<usize> {
3546        self.x_total_count.map(|x| x as usize)
3547    }
3548}
3549
3550pub struct ActivityFeedsListHeaders {
3551    pub x_total_count: Option<i64>,
3552}
3553
3554impl TryFrom<&reqwest::header::HeaderMap> for ActivityFeedsListHeaders {
3555    type Error = StructureError;
3556
3557    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3558        let x_total_count = map
3559            .get("x-total-count")
3560            .map(|s| -> Result<_, _> {
3561                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3562                s.parse::<i64>()
3563                    .map_err(|_| StructureError::HeaderParseFailed)
3564            })
3565            .transpose()?;
3566        Ok(Self { x_total_count })
3567    }
3568}
3569
3570impl crate::sealed::Sealed for ActivityFeedsListHeaders {}
3571impl crate::CountHeader for ActivityFeedsListHeaders {
3572    fn count(&self) -> Option<usize> {
3573        self.x_total_count.map(|x| x as usize)
3574    }
3575}
3576
3577pub struct BlockedUserListHeaders {
3578    pub x_total_count: Option<i64>,
3579}
3580
3581impl TryFrom<&reqwest::header::HeaderMap> for BlockedUserListHeaders {
3582    type Error = StructureError;
3583
3584    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3585        let x_total_count = map
3586            .get("x-total-count")
3587            .map(|s| -> Result<_, _> {
3588                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3589                s.parse::<i64>()
3590                    .map_err(|_| StructureError::HeaderParseFailed)
3591            })
3592            .transpose()?;
3593        Ok(Self { x_total_count })
3594    }
3595}
3596
3597impl crate::sealed::Sealed for BlockedUserListHeaders {}
3598impl crate::CountHeader for BlockedUserListHeaders {
3599    fn count(&self) -> Option<usize> {
3600        self.x_total_count.map(|x| x as usize)
3601    }
3602}
3603
3604pub struct BranchListHeaders {
3605    pub x_total_count: Option<i64>,
3606}
3607
3608impl TryFrom<&reqwest::header::HeaderMap> for BranchListHeaders {
3609    type Error = StructureError;
3610
3611    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3612        let x_total_count = map
3613            .get("x-total-count")
3614            .map(|s| -> Result<_, _> {
3615                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3616                s.parse::<i64>()
3617                    .map_err(|_| StructureError::HeaderParseFailed)
3618            })
3619            .transpose()?;
3620        Ok(Self { x_total_count })
3621    }
3622}
3623
3624impl crate::sealed::Sealed for BranchListHeaders {}
3625impl crate::CountHeader for BranchListHeaders {
3626    fn count(&self) -> Option<usize> {
3627        self.x_total_count.map(|x| x as usize)
3628    }
3629}
3630
3631pub struct ChangedFileListHeaders {
3632    pub x_has_more: Option<bool>,
3633    pub x_total_count: Option<i64>,
3634}
3635
3636impl TryFrom<&reqwest::header::HeaderMap> for ChangedFileListHeaders {
3637    type Error = StructureError;
3638
3639    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3640        let x_has_more = map
3641            .get("x-hasmore")
3642            .map(|s| -> Result<_, _> {
3643                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3644                s.parse::<bool>()
3645                    .map_err(|_| StructureError::HeaderParseFailed)
3646            })
3647            .transpose()?;
3648        let x_total_count = map
3649            .get("x-total-count")
3650            .map(|s| -> Result<_, _> {
3651                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3652                s.parse::<i64>()
3653                    .map_err(|_| StructureError::HeaderParseFailed)
3654            })
3655            .transpose()?;
3656        Ok(Self {
3657            x_has_more,
3658            x_total_count,
3659        })
3660    }
3661}
3662
3663impl crate::sealed::Sealed for ChangedFileListHeaders {}
3664impl crate::CountHeader for ChangedFileListHeaders {
3665    fn count(&self) -> Option<usize> {
3666        self.x_total_count.map(|x| x as usize)
3667    }
3668}
3669
3670pub struct CombinedStatusHeaders {
3671    pub x_total_count: Option<i64>,
3672}
3673
3674impl TryFrom<&reqwest::header::HeaderMap> for CombinedStatusHeaders {
3675    type Error = StructureError;
3676
3677    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3678        let x_total_count = map
3679            .get("x-total-count")
3680            .map(|s| -> Result<_, _> {
3681                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3682                s.parse::<i64>()
3683                    .map_err(|_| StructureError::HeaderParseFailed)
3684            })
3685            .transpose()?;
3686        Ok(Self { x_total_count })
3687    }
3688}
3689
3690impl crate::sealed::Sealed for CombinedStatusHeaders {}
3691impl crate::CountHeader for CombinedStatusHeaders {
3692    fn count(&self) -> Option<usize> {
3693        self.x_total_count.map(|x| x as usize)
3694    }
3695}
3696
3697pub struct CommentListHeaders {
3698    pub x_total_count: Option<i64>,
3699}
3700
3701impl TryFrom<&reqwest::header::HeaderMap> for CommentListHeaders {
3702    type Error = StructureError;
3703
3704    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3705        let x_total_count = map
3706            .get("x-total-count")
3707            .map(|s| -> Result<_, _> {
3708                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3709                s.parse::<i64>()
3710                    .map_err(|_| StructureError::HeaderParseFailed)
3711            })
3712            .transpose()?;
3713        Ok(Self { x_total_count })
3714    }
3715}
3716
3717impl crate::sealed::Sealed for CommentListHeaders {}
3718impl crate::CountHeader for CommentListHeaders {
3719    fn count(&self) -> Option<usize> {
3720        self.x_total_count.map(|x| x as usize)
3721    }
3722}
3723
3724pub struct CommitListHeaders {
3725    pub x_has_more: Option<bool>,
3726    pub x_total_count: Option<i64>,
3727}
3728
3729impl TryFrom<&reqwest::header::HeaderMap> for CommitListHeaders {
3730    type Error = StructureError;
3731
3732    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3733        let x_has_more = map
3734            .get("x-hasmore")
3735            .map(|s| -> Result<_, _> {
3736                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3737                s.parse::<bool>()
3738                    .map_err(|_| StructureError::HeaderParseFailed)
3739            })
3740            .transpose()?;
3741        let x_total_count = map
3742            .get("x-total-count")
3743            .map(|s| -> Result<_, _> {
3744                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3745                s.parse::<i64>()
3746                    .map_err(|_| StructureError::HeaderParseFailed)
3747            })
3748            .transpose()?;
3749        Ok(Self {
3750            x_has_more,
3751            x_total_count,
3752        })
3753    }
3754}
3755
3756impl crate::sealed::Sealed for CommitListHeaders {}
3757impl crate::CountHeader for CommitListHeaders {
3758    fn count(&self) -> Option<usize> {
3759        self.x_total_count.map(|x| x as usize)
3760    }
3761}
3762
3763pub struct CommitStatusListHeaders {
3764    pub x_total_count: Option<i64>,
3765}
3766
3767impl TryFrom<&reqwest::header::HeaderMap> for CommitStatusListHeaders {
3768    type Error = StructureError;
3769
3770    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3771        let x_total_count = map
3772            .get("x-total-count")
3773            .map(|s| -> Result<_, _> {
3774                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3775                s.parse::<i64>()
3776                    .map_err(|_| StructureError::HeaderParseFailed)
3777            })
3778            .transpose()?;
3779        Ok(Self { x_total_count })
3780    }
3781}
3782
3783impl crate::sealed::Sealed for CommitStatusListHeaders {}
3784impl crate::CountHeader for CommitStatusListHeaders {
3785    fn count(&self) -> Option<usize> {
3786        self.x_total_count.map(|x| x as usize)
3787    }
3788}
3789
3790pub struct CronListHeaders {
3791    pub x_total_count: Option<i64>,
3792}
3793
3794impl TryFrom<&reqwest::header::HeaderMap> for CronListHeaders {
3795    type Error = StructureError;
3796
3797    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3798        let x_total_count = map
3799            .get("x-total-count")
3800            .map(|s| -> Result<_, _> {
3801                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3802                s.parse::<i64>()
3803                    .map_err(|_| StructureError::HeaderParseFailed)
3804            })
3805            .transpose()?;
3806        Ok(Self { x_total_count })
3807    }
3808}
3809
3810impl crate::sealed::Sealed for CronListHeaders {}
3811impl crate::CountHeader for CronListHeaders {
3812    fn count(&self) -> Option<usize> {
3813        self.x_total_count.map(|x| x as usize)
3814    }
3815}
3816
3817pub struct DeployKeyListHeaders {
3818    pub x_total_count: Option<i64>,
3819}
3820
3821impl TryFrom<&reqwest::header::HeaderMap> for DeployKeyListHeaders {
3822    type Error = StructureError;
3823
3824    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3825        let x_total_count = map
3826            .get("x-total-count")
3827            .map(|s| -> Result<_, _> {
3828                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3829                s.parse::<i64>()
3830                    .map_err(|_| StructureError::HeaderParseFailed)
3831            })
3832            .transpose()?;
3833        Ok(Self { x_total_count })
3834    }
3835}
3836
3837impl crate::sealed::Sealed for DeployKeyListHeaders {}
3838impl crate::CountHeader for DeployKeyListHeaders {
3839    fn count(&self) -> Option<usize> {
3840        self.x_total_count.map(|x| x as usize)
3841    }
3842}
3843
3844pub struct GpgKeyListHeaders {
3845    pub x_total_count: Option<i64>,
3846}
3847
3848impl TryFrom<&reqwest::header::HeaderMap> for GpgKeyListHeaders {
3849    type Error = StructureError;
3850
3851    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3852        let x_total_count = map
3853            .get("x-total-count")
3854            .map(|s| -> Result<_, _> {
3855                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3856                s.parse::<i64>()
3857                    .map_err(|_| StructureError::HeaderParseFailed)
3858            })
3859            .transpose()?;
3860        Ok(Self { x_total_count })
3861    }
3862}
3863
3864impl crate::sealed::Sealed for GpgKeyListHeaders {}
3865impl crate::CountHeader for GpgKeyListHeaders {
3866    fn count(&self) -> Option<usize> {
3867        self.x_total_count.map(|x| x as usize)
3868    }
3869}
3870
3871pub struct GitHookListHeaders {
3872    pub x_total_count: Option<i64>,
3873}
3874
3875impl TryFrom<&reqwest::header::HeaderMap> for GitHookListHeaders {
3876    type Error = StructureError;
3877
3878    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3879        let x_total_count = map
3880            .get("x-total-count")
3881            .map(|s| -> Result<_, _> {
3882                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3883                s.parse::<i64>()
3884                    .map_err(|_| StructureError::HeaderParseFailed)
3885            })
3886            .transpose()?;
3887        Ok(Self { x_total_count })
3888    }
3889}
3890
3891impl crate::sealed::Sealed for GitHookListHeaders {}
3892impl crate::CountHeader for GitHookListHeaders {
3893    fn count(&self) -> Option<usize> {
3894        self.x_total_count.map(|x| x as usize)
3895    }
3896}
3897
3898pub struct HookListHeaders {
3899    pub x_total_count: Option<i64>,
3900}
3901
3902impl TryFrom<&reqwest::header::HeaderMap> for HookListHeaders {
3903    type Error = StructureError;
3904
3905    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3906        let x_total_count = map
3907            .get("x-total-count")
3908            .map(|s| -> Result<_, _> {
3909                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3910                s.parse::<i64>()
3911                    .map_err(|_| StructureError::HeaderParseFailed)
3912            })
3913            .transpose()?;
3914        Ok(Self { x_total_count })
3915    }
3916}
3917
3918impl crate::sealed::Sealed for HookListHeaders {}
3919impl crate::CountHeader for HookListHeaders {
3920    fn count(&self) -> Option<usize> {
3921        self.x_total_count.map(|x| x as usize)
3922    }
3923}
3924
3925pub struct IssueListHeaders {
3926    pub x_total_count: Option<i64>,
3927}
3928
3929impl TryFrom<&reqwest::header::HeaderMap> for IssueListHeaders {
3930    type Error = StructureError;
3931
3932    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3933        let x_total_count = map
3934            .get("x-total-count")
3935            .map(|s| -> Result<_, _> {
3936                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3937                s.parse::<i64>()
3938                    .map_err(|_| StructureError::HeaderParseFailed)
3939            })
3940            .transpose()?;
3941        Ok(Self { x_total_count })
3942    }
3943}
3944
3945impl crate::sealed::Sealed for IssueListHeaders {}
3946impl crate::CountHeader for IssueListHeaders {
3947    fn count(&self) -> Option<usize> {
3948        self.x_total_count.map(|x| x as usize)
3949    }
3950}
3951
3952pub struct LabelListHeaders {
3953    pub x_total_count: Option<i64>,
3954}
3955
3956impl TryFrom<&reqwest::header::HeaderMap> for LabelListHeaders {
3957    type Error = StructureError;
3958
3959    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3960        let x_total_count = map
3961            .get("x-total-count")
3962            .map(|s| -> Result<_, _> {
3963                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3964                s.parse::<i64>()
3965                    .map_err(|_| StructureError::HeaderParseFailed)
3966            })
3967            .transpose()?;
3968        Ok(Self { x_total_count })
3969    }
3970}
3971
3972impl crate::sealed::Sealed for LabelListHeaders {}
3973impl crate::CountHeader for LabelListHeaders {
3974    fn count(&self) -> Option<usize> {
3975        self.x_total_count.map(|x| x as usize)
3976    }
3977}
3978
3979pub struct MilestoneListHeaders {
3980    pub x_total_count: Option<i64>,
3981}
3982
3983impl TryFrom<&reqwest::header::HeaderMap> for MilestoneListHeaders {
3984    type Error = StructureError;
3985
3986    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3987        let x_total_count = map
3988            .get("x-total-count")
3989            .map(|s| -> Result<_, _> {
3990                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3991                s.parse::<i64>()
3992                    .map_err(|_| StructureError::HeaderParseFailed)
3993            })
3994            .transpose()?;
3995        Ok(Self { x_total_count })
3996    }
3997}
3998
3999impl crate::sealed::Sealed for MilestoneListHeaders {}
4000impl crate::CountHeader for MilestoneListHeaders {
4001    fn count(&self) -> Option<usize> {
4002        self.x_total_count.map(|x| x as usize)
4003    }
4004}
4005
4006pub struct NotificationThreadListHeaders {
4007    pub x_total_count: Option<i64>,
4008}
4009
4010impl TryFrom<&reqwest::header::HeaderMap> for NotificationThreadListHeaders {
4011    type Error = StructureError;
4012
4013    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4014        let x_total_count = map
4015            .get("x-total-count")
4016            .map(|s| -> Result<_, _> {
4017                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4018                s.parse::<i64>()
4019                    .map_err(|_| StructureError::HeaderParseFailed)
4020            })
4021            .transpose()?;
4022        Ok(Self { x_total_count })
4023    }
4024}
4025
4026impl crate::sealed::Sealed for NotificationThreadListHeaders {}
4027impl crate::CountHeader for NotificationThreadListHeaders {
4028    fn count(&self) -> Option<usize> {
4029        self.x_total_count.map(|x| x as usize)
4030    }
4031}
4032
4033pub struct OAuth2ApplicationListHeaders {
4034    pub x_total_count: Option<i64>,
4035}
4036
4037impl TryFrom<&reqwest::header::HeaderMap> for OAuth2ApplicationListHeaders {
4038    type Error = StructureError;
4039
4040    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4041        let x_total_count = map
4042            .get("x-total-count")
4043            .map(|s| -> Result<_, _> {
4044                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4045                s.parse::<i64>()
4046                    .map_err(|_| StructureError::HeaderParseFailed)
4047            })
4048            .transpose()?;
4049        Ok(Self { x_total_count })
4050    }
4051}
4052
4053impl crate::sealed::Sealed for OAuth2ApplicationListHeaders {}
4054impl crate::CountHeader for OAuth2ApplicationListHeaders {
4055    fn count(&self) -> Option<usize> {
4056        self.x_total_count.map(|x| x as usize)
4057    }
4058}
4059
4060pub struct OrganizationListHeaders {
4061    pub x_total_count: Option<i64>,
4062}
4063
4064impl TryFrom<&reqwest::header::HeaderMap> for OrganizationListHeaders {
4065    type Error = StructureError;
4066
4067    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4068        let x_total_count = map
4069            .get("x-total-count")
4070            .map(|s| -> Result<_, _> {
4071                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4072                s.parse::<i64>()
4073                    .map_err(|_| StructureError::HeaderParseFailed)
4074            })
4075            .transpose()?;
4076        Ok(Self { x_total_count })
4077    }
4078}
4079
4080impl crate::sealed::Sealed for OrganizationListHeaders {}
4081impl crate::CountHeader for OrganizationListHeaders {
4082    fn count(&self) -> Option<usize> {
4083        self.x_total_count.map(|x| x as usize)
4084    }
4085}
4086
4087pub struct PackageFileListHeaders {
4088    pub x_total_count: Option<i64>,
4089}
4090
4091impl TryFrom<&reqwest::header::HeaderMap> for PackageFileListHeaders {
4092    type Error = StructureError;
4093
4094    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4095        let x_total_count = map
4096            .get("x-total-count")
4097            .map(|s| -> Result<_, _> {
4098                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4099                s.parse::<i64>()
4100                    .map_err(|_| StructureError::HeaderParseFailed)
4101            })
4102            .transpose()?;
4103        Ok(Self { x_total_count })
4104    }
4105}
4106
4107impl crate::sealed::Sealed for PackageFileListHeaders {}
4108impl crate::CountHeader for PackageFileListHeaders {
4109    fn count(&self) -> Option<usize> {
4110        self.x_total_count.map(|x| x as usize)
4111    }
4112}
4113
4114pub struct PackageListHeaders {
4115    pub x_total_count: Option<i64>,
4116}
4117
4118impl TryFrom<&reqwest::header::HeaderMap> for PackageListHeaders {
4119    type Error = StructureError;
4120
4121    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4122        let x_total_count = map
4123            .get("x-total-count")
4124            .map(|s| -> Result<_, _> {
4125                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4126                s.parse::<i64>()
4127                    .map_err(|_| StructureError::HeaderParseFailed)
4128            })
4129            .transpose()?;
4130        Ok(Self { x_total_count })
4131    }
4132}
4133
4134impl crate::sealed::Sealed for PackageListHeaders {}
4135impl crate::CountHeader for PackageListHeaders {
4136    fn count(&self) -> Option<usize> {
4137        self.x_total_count.map(|x| x as usize)
4138    }
4139}
4140
4141pub struct PublicKeyListHeaders {
4142    pub x_total_count: Option<i64>,
4143}
4144
4145impl TryFrom<&reqwest::header::HeaderMap> for PublicKeyListHeaders {
4146    type Error = StructureError;
4147
4148    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4149        let x_total_count = map
4150            .get("x-total-count")
4151            .map(|s| -> Result<_, _> {
4152                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4153                s.parse::<i64>()
4154                    .map_err(|_| StructureError::HeaderParseFailed)
4155            })
4156            .transpose()?;
4157        Ok(Self { x_total_count })
4158    }
4159}
4160
4161impl crate::sealed::Sealed for PublicKeyListHeaders {}
4162impl crate::CountHeader for PublicKeyListHeaders {
4163    fn count(&self) -> Option<usize> {
4164        self.x_total_count.map(|x| x as usize)
4165    }
4166}
4167
4168pub struct PullRequestListHeaders {
4169    pub x_total_count: Option<i64>,
4170}
4171
4172impl TryFrom<&reqwest::header::HeaderMap> for PullRequestListHeaders {
4173    type Error = StructureError;
4174
4175    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4176        let x_total_count = map
4177            .get("x-total-count")
4178            .map(|s| -> Result<_, _> {
4179                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4180                s.parse::<i64>()
4181                    .map_err(|_| StructureError::HeaderParseFailed)
4182            })
4183            .transpose()?;
4184        Ok(Self { x_total_count })
4185    }
4186}
4187
4188impl crate::sealed::Sealed for PullRequestListHeaders {}
4189impl crate::CountHeader for PullRequestListHeaders {
4190    fn count(&self) -> Option<usize> {
4191        self.x_total_count.map(|x| x as usize)
4192    }
4193}
4194
4195pub struct PullReviewListHeaders {
4196    pub x_total_count: Option<i64>,
4197}
4198
4199impl TryFrom<&reqwest::header::HeaderMap> for PullReviewListHeaders {
4200    type Error = StructureError;
4201
4202    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4203        let x_total_count = map
4204            .get("x-total-count")
4205            .map(|s| -> Result<_, _> {
4206                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4207                s.parse::<i64>()
4208                    .map_err(|_| StructureError::HeaderParseFailed)
4209            })
4210            .transpose()?;
4211        Ok(Self { x_total_count })
4212    }
4213}
4214
4215impl crate::sealed::Sealed for PullReviewListHeaders {}
4216impl crate::CountHeader for PullReviewListHeaders {
4217    fn count(&self) -> Option<usize> {
4218        self.x_total_count.map(|x| x as usize)
4219    }
4220}
4221
4222pub struct PushMirrorListHeaders {
4223    pub x_total_count: Option<i64>,
4224}
4225
4226impl TryFrom<&reqwest::header::HeaderMap> for PushMirrorListHeaders {
4227    type Error = StructureError;
4228
4229    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4230        let x_total_count = map
4231            .get("x-total-count")
4232            .map(|s| -> Result<_, _> {
4233                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4234                s.parse::<i64>()
4235                    .map_err(|_| StructureError::HeaderParseFailed)
4236            })
4237            .transpose()?;
4238        Ok(Self { x_total_count })
4239    }
4240}
4241
4242impl crate::sealed::Sealed for PushMirrorListHeaders {}
4243impl crate::CountHeader for PushMirrorListHeaders {
4244    fn count(&self) -> Option<usize> {
4245        self.x_total_count.map(|x| x as usize)
4246    }
4247}
4248
4249pub struct QuotaGroupListHeaders {
4250    pub x_total_count: Option<i64>,
4251}
4252
4253impl TryFrom<&reqwest::header::HeaderMap> for QuotaGroupListHeaders {
4254    type Error = StructureError;
4255
4256    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4257        let x_total_count = map
4258            .get("x-total-count")
4259            .map(|s| -> Result<_, _> {
4260                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4261                s.parse::<i64>()
4262                    .map_err(|_| StructureError::HeaderParseFailed)
4263            })
4264            .transpose()?;
4265        Ok(Self { x_total_count })
4266    }
4267}
4268
4269impl crate::sealed::Sealed for QuotaGroupListHeaders {}
4270impl crate::CountHeader for QuotaGroupListHeaders {
4271    fn count(&self) -> Option<usize> {
4272        self.x_total_count.map(|x| x as usize)
4273    }
4274}
4275
4276pub struct QuotaRuleInfoListHeaders {
4277    pub x_total_count: Option<i64>,
4278}
4279
4280impl TryFrom<&reqwest::header::HeaderMap> for QuotaRuleInfoListHeaders {
4281    type Error = StructureError;
4282
4283    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4284        let x_total_count = map
4285            .get("x-total-count")
4286            .map(|s| -> Result<_, _> {
4287                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4288                s.parse::<i64>()
4289                    .map_err(|_| StructureError::HeaderParseFailed)
4290            })
4291            .transpose()?;
4292        Ok(Self { x_total_count })
4293    }
4294}
4295
4296impl crate::sealed::Sealed for QuotaRuleInfoListHeaders {}
4297impl crate::CountHeader for QuotaRuleInfoListHeaders {
4298    fn count(&self) -> Option<usize> {
4299        self.x_total_count.map(|x| x as usize)
4300    }
4301}
4302
4303pub struct QuotaUsedArtifactListHeaders {
4304    pub x_total_count: Option<i64>,
4305}
4306
4307impl TryFrom<&reqwest::header::HeaderMap> for QuotaUsedArtifactListHeaders {
4308    type Error = StructureError;
4309
4310    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4311        let x_total_count = map
4312            .get("x-total-count")
4313            .map(|s| -> Result<_, _> {
4314                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4315                s.parse::<i64>()
4316                    .map_err(|_| StructureError::HeaderParseFailed)
4317            })
4318            .transpose()?;
4319        Ok(Self { x_total_count })
4320    }
4321}
4322
4323impl crate::sealed::Sealed for QuotaUsedArtifactListHeaders {}
4324impl crate::CountHeader for QuotaUsedArtifactListHeaders {
4325    fn count(&self) -> Option<usize> {
4326        self.x_total_count.map(|x| x as usize)
4327    }
4328}
4329
4330pub struct QuotaUsedAttachmentListHeaders {
4331    pub x_total_count: Option<i64>,
4332}
4333
4334impl TryFrom<&reqwest::header::HeaderMap> for QuotaUsedAttachmentListHeaders {
4335    type Error = StructureError;
4336
4337    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4338        let x_total_count = map
4339            .get("x-total-count")
4340            .map(|s| -> Result<_, _> {
4341                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4342                s.parse::<i64>()
4343                    .map_err(|_| StructureError::HeaderParseFailed)
4344            })
4345            .transpose()?;
4346        Ok(Self { x_total_count })
4347    }
4348}
4349
4350impl crate::sealed::Sealed for QuotaUsedAttachmentListHeaders {}
4351impl crate::CountHeader for QuotaUsedAttachmentListHeaders {
4352    fn count(&self) -> Option<usize> {
4353        self.x_total_count.map(|x| x as usize)
4354    }
4355}
4356
4357pub struct QuotaUsedPackageListHeaders {
4358    pub x_total_count: Option<i64>,
4359}
4360
4361impl TryFrom<&reqwest::header::HeaderMap> for QuotaUsedPackageListHeaders {
4362    type Error = StructureError;
4363
4364    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4365        let x_total_count = map
4366            .get("x-total-count")
4367            .map(|s| -> Result<_, _> {
4368                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4369                s.parse::<i64>()
4370                    .map_err(|_| StructureError::HeaderParseFailed)
4371            })
4372            .transpose()?;
4373        Ok(Self { x_total_count })
4374    }
4375}
4376
4377impl crate::sealed::Sealed for QuotaUsedPackageListHeaders {}
4378impl crate::CountHeader for QuotaUsedPackageListHeaders {
4379    fn count(&self) -> Option<usize> {
4380        self.x_total_count.map(|x| x as usize)
4381    }
4382}
4383
4384pub struct ReactionListHeaders {
4385    pub x_total_count: Option<i64>,
4386}
4387
4388impl TryFrom<&reqwest::header::HeaderMap> for ReactionListHeaders {
4389    type Error = StructureError;
4390
4391    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4392        let x_total_count = map
4393            .get("x-total-count")
4394            .map(|s| -> Result<_, _> {
4395                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4396                s.parse::<i64>()
4397                    .map_err(|_| StructureError::HeaderParseFailed)
4398            })
4399            .transpose()?;
4400        Ok(Self { x_total_count })
4401    }
4402}
4403
4404impl crate::sealed::Sealed for ReactionListHeaders {}
4405impl crate::CountHeader for ReactionListHeaders {
4406    fn count(&self) -> Option<usize> {
4407        self.x_total_count.map(|x| x as usize)
4408    }
4409}
4410
4411pub struct ReleaseListHeaders {
4412    pub x_total_count: Option<i64>,
4413}
4414
4415impl TryFrom<&reqwest::header::HeaderMap> for ReleaseListHeaders {
4416    type Error = StructureError;
4417
4418    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4419        let x_total_count = map
4420            .get("x-total-count")
4421            .map(|s| -> Result<_, _> {
4422                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4423                s.parse::<i64>()
4424                    .map_err(|_| StructureError::HeaderParseFailed)
4425            })
4426            .transpose()?;
4427        Ok(Self { x_total_count })
4428    }
4429}
4430
4431impl crate::sealed::Sealed for ReleaseListHeaders {}
4432impl crate::CountHeader for ReleaseListHeaders {
4433    fn count(&self) -> Option<usize> {
4434        self.x_total_count.map(|x| x as usize)
4435    }
4436}
4437
4438pub struct RepositoryListHeaders {
4439    pub x_total_count: Option<i64>,
4440}
4441
4442impl TryFrom<&reqwest::header::HeaderMap> for RepositoryListHeaders {
4443    type Error = StructureError;
4444
4445    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4446        let x_total_count = map
4447            .get("x-total-count")
4448            .map(|s| -> Result<_, _> {
4449                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4450                s.parse::<i64>()
4451                    .map_err(|_| StructureError::HeaderParseFailed)
4452            })
4453            .transpose()?;
4454        Ok(Self { x_total_count })
4455    }
4456}
4457
4458impl crate::sealed::Sealed for RepositoryListHeaders {}
4459impl crate::CountHeader for RepositoryListHeaders {
4460    fn count(&self) -> Option<usize> {
4461        self.x_total_count.map(|x| x as usize)
4462    }
4463}
4464
4465pub struct SecretListHeaders {
4466    pub x_total_count: Option<i64>,
4467}
4468
4469impl TryFrom<&reqwest::header::HeaderMap> for SecretListHeaders {
4470    type Error = StructureError;
4471
4472    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4473        let x_total_count = map
4474            .get("x-total-count")
4475            .map(|s| -> Result<_, _> {
4476                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4477                s.parse::<i64>()
4478                    .map_err(|_| StructureError::HeaderParseFailed)
4479            })
4480            .transpose()?;
4481        Ok(Self { x_total_count })
4482    }
4483}
4484
4485impl crate::sealed::Sealed for SecretListHeaders {}
4486impl crate::CountHeader for SecretListHeaders {
4487    fn count(&self) -> Option<usize> {
4488        self.x_total_count.map(|x| x as usize)
4489    }
4490}
4491
4492pub struct StopWatchListHeaders {
4493    pub x_total_count: Option<i64>,
4494}
4495
4496impl TryFrom<&reqwest::header::HeaderMap> for StopWatchListHeaders {
4497    type Error = StructureError;
4498
4499    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4500        let x_total_count = map
4501            .get("x-total-count")
4502            .map(|s| -> Result<_, _> {
4503                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4504                s.parse::<i64>()
4505                    .map_err(|_| StructureError::HeaderParseFailed)
4506            })
4507            .transpose()?;
4508        Ok(Self { x_total_count })
4509    }
4510}
4511
4512impl crate::sealed::Sealed for StopWatchListHeaders {}
4513impl crate::CountHeader for StopWatchListHeaders {
4514    fn count(&self) -> Option<usize> {
4515        self.x_total_count.map(|x| x as usize)
4516    }
4517}
4518
4519pub struct TagListHeaders {
4520    pub x_total_count: Option<i64>,
4521}
4522
4523impl TryFrom<&reqwest::header::HeaderMap> for TagListHeaders {
4524    type Error = StructureError;
4525
4526    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4527        let x_total_count = map
4528            .get("x-total-count")
4529            .map(|s| -> Result<_, _> {
4530                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4531                s.parse::<i64>()
4532                    .map_err(|_| StructureError::HeaderParseFailed)
4533            })
4534            .transpose()?;
4535        Ok(Self { x_total_count })
4536    }
4537}
4538
4539impl crate::sealed::Sealed for TagListHeaders {}
4540impl crate::CountHeader for TagListHeaders {
4541    fn count(&self) -> Option<usize> {
4542        self.x_total_count.map(|x| x as usize)
4543    }
4544}
4545
4546pub struct TeamListHeaders {
4547    pub x_total_count: Option<i64>,
4548}
4549
4550impl TryFrom<&reqwest::header::HeaderMap> for TeamListHeaders {
4551    type Error = StructureError;
4552
4553    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4554        let x_total_count = map
4555            .get("x-total-count")
4556            .map(|s| -> Result<_, _> {
4557                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4558                s.parse::<i64>()
4559                    .map_err(|_| StructureError::HeaderParseFailed)
4560            })
4561            .transpose()?;
4562        Ok(Self { x_total_count })
4563    }
4564}
4565
4566impl crate::sealed::Sealed for TeamListHeaders {}
4567impl crate::CountHeader for TeamListHeaders {
4568    fn count(&self) -> Option<usize> {
4569        self.x_total_count.map(|x| x as usize)
4570    }
4571}
4572
4573pub struct TimelineListHeaders {
4574    pub x_total_count: Option<i64>,
4575}
4576
4577impl TryFrom<&reqwest::header::HeaderMap> for TimelineListHeaders {
4578    type Error = StructureError;
4579
4580    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4581        let x_total_count = map
4582            .get("x-total-count")
4583            .map(|s| -> Result<_, _> {
4584                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4585                s.parse::<i64>()
4586                    .map_err(|_| StructureError::HeaderParseFailed)
4587            })
4588            .transpose()?;
4589        Ok(Self { x_total_count })
4590    }
4591}
4592
4593impl crate::sealed::Sealed for TimelineListHeaders {}
4594impl crate::CountHeader for TimelineListHeaders {
4595    fn count(&self) -> Option<usize> {
4596        self.x_total_count.map(|x| x as usize)
4597    }
4598}
4599
4600pub struct TrackedTimeListHeaders {
4601    pub x_total_count: Option<i64>,
4602}
4603
4604impl TryFrom<&reqwest::header::HeaderMap> for TrackedTimeListHeaders {
4605    type Error = StructureError;
4606
4607    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4608        let x_total_count = map
4609            .get("x-total-count")
4610            .map(|s| -> Result<_, _> {
4611                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4612                s.parse::<i64>()
4613                    .map_err(|_| StructureError::HeaderParseFailed)
4614            })
4615            .transpose()?;
4616        Ok(Self { x_total_count })
4617    }
4618}
4619
4620impl crate::sealed::Sealed for TrackedTimeListHeaders {}
4621impl crate::CountHeader for TrackedTimeListHeaders {
4622    fn count(&self) -> Option<usize> {
4623        self.x_total_count.map(|x| x as usize)
4624    }
4625}
4626
4627pub struct UserListHeaders {
4628    pub x_total_count: Option<i64>,
4629}
4630
4631impl TryFrom<&reqwest::header::HeaderMap> for UserListHeaders {
4632    type Error = StructureError;
4633
4634    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4635        let x_total_count = map
4636            .get("x-total-count")
4637            .map(|s| -> Result<_, _> {
4638                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4639                s.parse::<i64>()
4640                    .map_err(|_| StructureError::HeaderParseFailed)
4641            })
4642            .transpose()?;
4643        Ok(Self { x_total_count })
4644    }
4645}
4646
4647impl crate::sealed::Sealed for UserListHeaders {}
4648impl crate::CountHeader for UserListHeaders {
4649    fn count(&self) -> Option<usize> {
4650        self.x_total_count.map(|x| x as usize)
4651    }
4652}
4653
4654pub struct VariableListHeaders {
4655    pub x_total_count: Option<i64>,
4656}
4657
4658impl TryFrom<&reqwest::header::HeaderMap> for VariableListHeaders {
4659    type Error = StructureError;
4660
4661    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4662        let x_total_count = map
4663            .get("x-total-count")
4664            .map(|s| -> Result<_, _> {
4665                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4666                s.parse::<i64>()
4667                    .map_err(|_| StructureError::HeaderParseFailed)
4668            })
4669            .transpose()?;
4670        Ok(Self { x_total_count })
4671    }
4672}
4673
4674impl crate::sealed::Sealed for VariableListHeaders {}
4675impl crate::CountHeader for VariableListHeaders {
4676    fn count(&self) -> Option<usize> {
4677        self.x_total_count.map(|x| x as usize)
4678    }
4679}
4680
4681pub struct WikiCommitListHeaders {
4682    pub x_total_count: Option<i64>,
4683}
4684
4685impl TryFrom<&reqwest::header::HeaderMap> for WikiCommitListHeaders {
4686    type Error = StructureError;
4687
4688    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4689        let x_total_count = map
4690            .get("x-total-count")
4691            .map(|s| -> Result<_, _> {
4692                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4693                s.parse::<i64>()
4694                    .map_err(|_| StructureError::HeaderParseFailed)
4695            })
4696            .transpose()?;
4697        Ok(Self { x_total_count })
4698    }
4699}
4700
4701impl crate::sealed::Sealed for WikiCommitListHeaders {}
4702impl crate::CountHeader for WikiCommitListHeaders {
4703    fn count(&self) -> Option<usize> {
4704        self.x_total_count.map(|x| x as usize)
4705    }
4706}
4707
4708pub struct WikiPageListHeaders {
4709    pub x_total_count: Option<i64>,
4710}
4711
4712impl TryFrom<&reqwest::header::HeaderMap> for WikiPageListHeaders {
4713    type Error = StructureError;
4714
4715    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4716        let x_total_count = map
4717            .get("x-total-count")
4718            .map(|s| -> Result<_, _> {
4719                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4720                s.parse::<i64>()
4721                    .map_err(|_| StructureError::HeaderParseFailed)
4722            })
4723            .transpose()?;
4724        Ok(Self { x_total_count })
4725    }
4726}
4727
4728impl crate::sealed::Sealed for WikiPageListHeaders {}
4729impl crate::CountHeader for WikiPageListHeaders {
4730    fn count(&self) -> Option<usize> {
4731        self.x_total_count.map(|x| x as usize)
4732    }
4733}
4734
4735pub struct QuotaExceededHeaders {
4736    pub message: Option<String>,
4737    pub user_id: Option<i64>,
4738    pub username: Option<String>,
4739}
4740
4741impl TryFrom<&reqwest::header::HeaderMap> for QuotaExceededHeaders {
4742    type Error = StructureError;
4743
4744    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4745        let message = map
4746            .get("message")
4747            .map(|s| -> Result<_, _> {
4748                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4749                Ok::<_, StructureError>(s.to_string())
4750            })
4751            .transpose()?;
4752        let user_id = map
4753            .get("user_id")
4754            .map(|s| -> Result<_, _> {
4755                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4756                s.parse::<i64>()
4757                    .map_err(|_| StructureError::HeaderParseFailed)
4758            })
4759            .transpose()?;
4760        let username = map
4761            .get("username")
4762            .map(|s| -> Result<_, _> {
4763                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4764                Ok::<_, StructureError>(s.to_string())
4765            })
4766            .transpose()?;
4767        Ok(Self {
4768            message,
4769            user_id,
4770            username,
4771        })
4772    }
4773}
4774
4775#[derive(Debug, Clone, PartialEq, Default)]
4776pub struct AdminSearchEmailsQuery {
4777    /// keyword
4778    pub q: Option<String>,
4779}
4780
4781impl AdminSearchEmailsQuery {
4782    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
4783        let mut list = Vec::new();
4784        if let Some(q) = self.q {
4785            list.push(("q", q));
4786        }
4787
4788        list
4789    }
4790}
4791
4792#[derive(Debug, Clone, PartialEq, Default)]
4793pub struct AdminSearchRunJobsQuery {
4794    /// a comma separated list of run job labels to search for
4795    pub labels: Option<String>,
4796}
4797
4798impl AdminSearchRunJobsQuery {
4799    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
4800        let mut list = Vec::new();
4801        if let Some(labels) = self.labels {
4802            list.push(("labels", labels));
4803        }
4804
4805        list
4806    }
4807}
4808
4809#[derive(Debug, Clone, PartialEq, Default)]
4810pub struct AdminUnadoptedListQuery {
4811    /// pattern of repositories to search for
4812    pub pattern: Option<String>,
4813}
4814
4815impl AdminUnadoptedListQuery {
4816    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
4817        let mut list = Vec::new();
4818        if let Some(pattern) = self.pattern {
4819            list.push(("pattern", pattern));
4820        }
4821
4822        list
4823    }
4824}
4825
4826#[derive(Debug, Clone, PartialEq, Default)]
4827pub struct AdminSearchUsersQuery {
4828    /// ID of the user's login source to search for
4829    pub source_id: Option<i64>,
4830    /// user's login name to search for
4831    pub login_name: Option<String>,
4832    /// sort order of results
4833    pub sort: Option<AdminSearchUsersQuerySort>,
4834}
4835
4836impl AdminSearchUsersQuery {
4837    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
4838        let mut list = Vec::new();
4839        if let Some(source_id) = self.source_id {
4840            list.push(("source_id", source_id.to_string()));
4841        }
4842        if let Some(login_name) = self.login_name {
4843            list.push(("login_name", login_name));
4844        }
4845        if let Some(sort) = self.sort {
4846            list.push(("sort", sort.as_str().to_string()));
4847        }
4848
4849        list
4850    }
4851}
4852
4853#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
4854pub enum AdminSearchUsersQuerySort {
4855    #[serde(rename = "oldest")]
4856    Oldest,
4857    #[serde(rename = "newest")]
4858    Newest,
4859    #[serde(rename = "alphabetically")]
4860    Alphabetically,
4861    #[serde(rename = "reversealphabetically")]
4862    Reversealphabetically,
4863    #[serde(rename = "recentupdate")]
4864    Recentupdate,
4865    #[serde(rename = "leastupdate")]
4866    Leastupdate,
4867}
4868
4869impl AdminSearchUsersQuerySort {
4870    fn as_str(&self) -> &'static str {
4871        match self {
4872            AdminSearchUsersQuerySort::Oldest => "oldest",
4873            AdminSearchUsersQuerySort::Newest => "newest",
4874            AdminSearchUsersQuerySort::Alphabetically => "alphabetically",
4875            AdminSearchUsersQuerySort::Reversealphabetically => "reversealphabetically",
4876            AdminSearchUsersQuerySort::Recentupdate => "recentupdate",
4877            AdminSearchUsersQuerySort::Leastupdate => "leastupdate",
4878        }
4879    }
4880}
4881#[derive(Debug, Clone, PartialEq, Default)]
4882pub struct AdminDeleteUserQuery {
4883    /// purge the user from the system completely
4884    pub purge: Option<bool>,
4885}
4886
4887impl AdminDeleteUserQuery {
4888    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
4889        let mut list = Vec::new();
4890        if let Some(purge) = self.purge {
4891            list.push(("purge", purge.to_string()));
4892        }
4893
4894        list
4895    }
4896}
4897
4898#[derive(Debug, Clone, PartialEq, Default)]
4899pub struct NotifyGetListQuery {
4900    /// If true, show notifications marked as read. Default value is false
4901    pub all: Option<bool>,
4902    /// Show notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread & pinned.
4903    pub status_types: Option<Vec<String>>,
4904    /// filter notifications by subject type
4905    pub subject_type: Option<Vec<NotifyGetListQuerySubjectType>>,
4906    /// Only show notifications updated after the given time. This is a timestamp in RFC 3339 format
4907    pub since: Option<time::OffsetDateTime>,
4908    /// Only show notifications updated before the given time. This is a timestamp in RFC 3339 format
4909    pub before: Option<time::OffsetDateTime>,
4910}
4911
4912impl NotifyGetListQuery {
4913    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
4914        let mut list = Vec::new();
4915        if let Some(all) = self.all {
4916            list.push(("all", all.to_string()));
4917        }
4918        if let Some(status_types) = self.status_types {
4919            if !status_types.is_empty() {
4920                for item in status_types {
4921                    list.push(("status-types", item.to_string()));
4922                }
4923            }
4924        }
4925        if let Some(subject_type) = self.subject_type {
4926            if !subject_type.is_empty() {
4927                for item in subject_type {
4928                    list.push(("subject-type", item.as_str().to_string()));
4929                }
4930            }
4931        }
4932        if let Some(since) = self.since {
4933            list.push((
4934                "since",
4935                since
4936                    .format(&time::format_description::well_known::Rfc3339)
4937                    .unwrap(),
4938            ));
4939        }
4940        if let Some(before) = self.before {
4941            list.push((
4942                "before",
4943                before
4944                    .format(&time::format_description::well_known::Rfc3339)
4945                    .unwrap(),
4946            ));
4947        }
4948
4949        list
4950    }
4951}
4952
4953#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
4954pub enum NotifyGetListQuerySubjectType {
4955    #[serde(rename = "issue")]
4956    Issue,
4957    #[serde(rename = "pull")]
4958    Pull,
4959    #[serde(rename = "commit")]
4960    Commit,
4961    #[serde(rename = "repository")]
4962    Repository,
4963}
4964
4965impl NotifyGetListQuerySubjectType {
4966    fn as_str(&self) -> &'static str {
4967        match self {
4968            NotifyGetListQuerySubjectType::Issue => "issue",
4969            NotifyGetListQuerySubjectType::Pull => "pull",
4970            NotifyGetListQuerySubjectType::Commit => "commit",
4971            NotifyGetListQuerySubjectType::Repository => "repository",
4972        }
4973    }
4974}
4975#[derive(Debug, Clone, PartialEq, Default)]
4976pub struct NotifyReadListQuery {
4977    /// Describes the last point that notifications were checked. Anything updated since this time will not be updated.
4978    pub last_read_at: Option<time::OffsetDateTime>,
4979    /// If true, mark all notifications on this repo. Default value is false
4980    pub all: Option<bool>,
4981    /// Mark notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread.
4982    pub status_types: Option<Vec<String>>,
4983    /// Status to mark notifications as, Defaults to read.
4984    pub to_status: Option<String>,
4985}
4986
4987impl NotifyReadListQuery {
4988    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
4989        let mut list = Vec::new();
4990        if let Some(last_read_at) = self.last_read_at {
4991            list.push((
4992                "last_read_at",
4993                last_read_at
4994                    .format(&time::format_description::well_known::Rfc3339)
4995                    .unwrap(),
4996            ));
4997        }
4998        if let Some(all) = self.all {
4999            list.push(("all", all.to_string()));
5000        }
5001        if let Some(status_types) = self.status_types {
5002            if !status_types.is_empty() {
5003                for item in status_types {
5004                    list.push(("status-types", item.to_string()));
5005                }
5006            }
5007        }
5008        if let Some(to_status) = self.to_status {
5009            list.push(("to-status", to_status));
5010        }
5011
5012        list
5013    }
5014}
5015
5016#[derive(Debug, Clone, PartialEq, Default)]
5017pub struct NotifyReadThreadQuery {
5018    /// Status to mark notifications as
5019    pub to_status: Option<String>,
5020}
5021
5022impl NotifyReadThreadQuery {
5023    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5024        let mut list = Vec::new();
5025        if let Some(to_status) = self.to_status {
5026            list.push(("to-status", to_status));
5027        }
5028
5029        list
5030    }
5031}
5032
5033#[derive(Debug, Clone, PartialEq, Default)]
5034pub struct OrgSearchRunJobsQuery {
5035    /// a comma separated list of run job labels to search for
5036    pub labels: Option<String>,
5037}
5038
5039impl OrgSearchRunJobsQuery {
5040    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5041        let mut list = Vec::new();
5042        if let Some(labels) = self.labels {
5043            list.push(("labels", labels));
5044        }
5045
5046        list
5047    }
5048}
5049
5050#[derive(Debug, Clone, PartialEq, Default)]
5051pub struct OrgListActivityFeedsQuery {
5052    /// the date of the activities to be found
5053    pub date: Option<time::Date>,
5054}
5055
5056impl OrgListActivityFeedsQuery {
5057    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5058        let mut list = Vec::new();
5059        if let Some(date) = self.date {
5060            list.push((
5061                "date",
5062                date.format(&time::format_description::well_known::Rfc3339)
5063                    .unwrap(),
5064            ));
5065        }
5066
5067        list
5068    }
5069}
5070
5071#[derive(Debug, Clone, PartialEq, Default)]
5072pub struct OrgListLabelsQuery {
5073    /// Specifies the sorting method: mostissues, leastissues, or reversealphabetically.
5074    pub sort: Option<OrgListLabelsQuerySort>,
5075}
5076
5077impl OrgListLabelsQuery {
5078    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5079        let mut list = Vec::new();
5080        if let Some(sort) = self.sort {
5081            list.push(("sort", sort.as_str().to_string()));
5082        }
5083
5084        list
5085    }
5086}
5087
5088#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5089pub enum OrgListLabelsQuerySort {
5090    #[serde(rename = "mostissues")]
5091    Mostissues,
5092    #[serde(rename = "leastissues")]
5093    Leastissues,
5094    #[serde(rename = "reversealphabetically")]
5095    Reversealphabetically,
5096}
5097
5098impl OrgListLabelsQuerySort {
5099    fn as_str(&self) -> &'static str {
5100        match self {
5101            OrgListLabelsQuerySort::Mostissues => "mostissues",
5102            OrgListLabelsQuerySort::Leastissues => "leastissues",
5103            OrgListLabelsQuerySort::Reversealphabetically => "reversealphabetically",
5104        }
5105    }
5106}
5107#[derive(Debug, Clone, PartialEq)]
5108pub struct OrgCheckQuotaQuery {
5109    /// subject of the quota
5110    pub subject: String,
5111}
5112
5113impl OrgCheckQuotaQuery {
5114    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5115        let mut list = Vec::new();
5116        let subject = self.subject;
5117        list.push(("subject", subject));
5118
5119        list
5120    }
5121}
5122
5123#[derive(Debug, Clone, PartialEq, Default)]
5124pub struct TeamSearchQuery {
5125    /// keywords to search
5126    pub q: Option<String>,
5127    /// include search within team description (defaults to true)
5128    pub include_desc: Option<bool>,
5129}
5130
5131impl TeamSearchQuery {
5132    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5133        let mut list = Vec::new();
5134        if let Some(q) = self.q {
5135            list.push(("q", q));
5136        }
5137        if let Some(include_desc) = self.include_desc {
5138            list.push(("include_desc", include_desc.to_string()));
5139        }
5140
5141        list
5142    }
5143}
5144#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
5145pub struct TeamSearchResults {
5146    pub data: Option<Vec<Team>>,
5147    pub ok: Option<bool>,
5148}
5149
5150impl_from_response!(TeamSearchResults);
5151
5152#[derive(Debug, Clone, PartialEq, Default)]
5153pub struct ListPackagesQuery {
5154    /// package type filter
5155    pub r#type: Option<ListPackagesQueryType>,
5156    /// name filter
5157    pub q: Option<String>,
5158}
5159
5160impl ListPackagesQuery {
5161    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5162        let mut list = Vec::new();
5163        if let Some(r#type) = self.r#type {
5164            list.push(("type", r#type.as_str().to_string()));
5165        }
5166        if let Some(q) = self.q {
5167            list.push(("q", q));
5168        }
5169
5170        list
5171    }
5172}
5173
5174#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5175pub enum ListPackagesQueryType {
5176    #[serde(rename = "alpine")]
5177    Alpine,
5178    #[serde(rename = "cargo")]
5179    Cargo,
5180    #[serde(rename = "chef")]
5181    Chef,
5182    #[serde(rename = "composer")]
5183    Composer,
5184    #[serde(rename = "conan")]
5185    Conan,
5186    #[serde(rename = "conda")]
5187    Conda,
5188    #[serde(rename = "container")]
5189    Container,
5190    #[serde(rename = "cran")]
5191    Cran,
5192    #[serde(rename = "debian")]
5193    Debian,
5194    #[serde(rename = "generic")]
5195    Generic,
5196    #[serde(rename = "go")]
5197    Go,
5198    #[serde(rename = "helm")]
5199    Helm,
5200    #[serde(rename = "maven")]
5201    Maven,
5202    #[serde(rename = "npm")]
5203    Npm,
5204    #[serde(rename = "nuget")]
5205    Nuget,
5206    #[serde(rename = "pub")]
5207    Pub,
5208    #[serde(rename = "pypi")]
5209    Pypi,
5210    #[serde(rename = "rpm")]
5211    Rpm,
5212    #[serde(rename = "rubygems")]
5213    Rubygems,
5214    #[serde(rename = "swift")]
5215    Swift,
5216    #[serde(rename = "vagrant")]
5217    Vagrant,
5218}
5219
5220impl ListPackagesQueryType {
5221    fn as_str(&self) -> &'static str {
5222        match self {
5223            ListPackagesQueryType::Alpine => "alpine",
5224            ListPackagesQueryType::Cargo => "cargo",
5225            ListPackagesQueryType::Chef => "chef",
5226            ListPackagesQueryType::Composer => "composer",
5227            ListPackagesQueryType::Conan => "conan",
5228            ListPackagesQueryType::Conda => "conda",
5229            ListPackagesQueryType::Container => "container",
5230            ListPackagesQueryType::Cran => "cran",
5231            ListPackagesQueryType::Debian => "debian",
5232            ListPackagesQueryType::Generic => "generic",
5233            ListPackagesQueryType::Go => "go",
5234            ListPackagesQueryType::Helm => "helm",
5235            ListPackagesQueryType::Maven => "maven",
5236            ListPackagesQueryType::Npm => "npm",
5237            ListPackagesQueryType::Nuget => "nuget",
5238            ListPackagesQueryType::Pub => "pub",
5239            ListPackagesQueryType::Pypi => "pypi",
5240            ListPackagesQueryType::Rpm => "rpm",
5241            ListPackagesQueryType::Rubygems => "rubygems",
5242            ListPackagesQueryType::Swift => "swift",
5243            ListPackagesQueryType::Vagrant => "vagrant",
5244        }
5245    }
5246}
5247#[derive(Debug, Clone, PartialEq, Default)]
5248pub struct IssueSearchIssuesQuery {
5249    /// State of the issue
5250    pub state: Option<IssueSearchIssuesQueryState>,
5251    /// Comma-separated list of label names. Fetch only issues that have any of these labels. Non existent labels are discarded.
5252    pub labels: Option<String>,
5253    /// Comma-separated list of milestone names. Fetch only issues that have any of these milestones. Non existent milestones are discarded.
5254    pub milestones: Option<String>,
5255    /// Search string
5256    pub q: Option<String>,
5257    /// Repository ID to prioritize in the results
5258    pub priority_repo_id: Option<i64>,
5259    /// Filter by issue type
5260    pub r#type: Option<IssueSearchIssuesQueryType>,
5261    /// Only show issues updated after the given time (RFC 3339 format)
5262    pub since: Option<time::OffsetDateTime>,
5263    /// Only show issues updated before the given time (RFC 3339 format)
5264    pub before: Option<time::OffsetDateTime>,
5265    /// Filter issues or pulls assigned to the authenticated user
5266    pub assigned: Option<bool>,
5267    /// Filter issues or pulls created by the authenticated user
5268    pub created: Option<bool>,
5269    /// Filter issues or pulls mentioning the authenticated user
5270    pub mentioned: Option<bool>,
5271    /// Filter pull requests where the authenticated user's review was requested
5272    pub review_requested: Option<bool>,
5273    /// Filter pull requests reviewed by the authenticated user
5274    pub reviewed: Option<bool>,
5275    /// Filter by repository owner
5276    pub owner: Option<String>,
5277    /// Filter by team (requires organization owner parameter)
5278    pub team: Option<String>,
5279    /// Type of sort
5280    pub sort: Option<IssueSearchIssuesQuerySort>,
5281}
5282
5283impl IssueSearchIssuesQuery {
5284    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5285        let mut list = Vec::new();
5286        if let Some(state) = self.state {
5287            list.push(("state", state.as_str().to_string()));
5288        }
5289        if let Some(labels) = self.labels {
5290            list.push(("labels", labels));
5291        }
5292        if let Some(milestones) = self.milestones {
5293            list.push(("milestones", milestones));
5294        }
5295        if let Some(q) = self.q {
5296            list.push(("q", q));
5297        }
5298        if let Some(priority_repo_id) = self.priority_repo_id {
5299            list.push(("priority_repo_id", priority_repo_id.to_string()));
5300        }
5301        if let Some(r#type) = self.r#type {
5302            list.push(("type", r#type.as_str().to_string()));
5303        }
5304        if let Some(since) = self.since {
5305            list.push((
5306                "since",
5307                since
5308                    .format(&time::format_description::well_known::Rfc3339)
5309                    .unwrap(),
5310            ));
5311        }
5312        if let Some(before) = self.before {
5313            list.push((
5314                "before",
5315                before
5316                    .format(&time::format_description::well_known::Rfc3339)
5317                    .unwrap(),
5318            ));
5319        }
5320        if let Some(assigned) = self.assigned {
5321            list.push(("assigned", assigned.to_string()));
5322        }
5323        if let Some(created) = self.created {
5324            list.push(("created", created.to_string()));
5325        }
5326        if let Some(mentioned) = self.mentioned {
5327            list.push(("mentioned", mentioned.to_string()));
5328        }
5329        if let Some(review_requested) = self.review_requested {
5330            list.push(("review_requested", review_requested.to_string()));
5331        }
5332        if let Some(reviewed) = self.reviewed {
5333            list.push(("reviewed", reviewed.to_string()));
5334        }
5335        if let Some(owner) = self.owner {
5336            list.push(("owner", owner));
5337        }
5338        if let Some(team) = self.team {
5339            list.push(("team", team));
5340        }
5341        if let Some(sort) = self.sort {
5342            list.push(("sort", sort.as_str().to_string()));
5343        }
5344
5345        list
5346    }
5347}
5348
5349#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5350pub enum IssueSearchIssuesQueryState {
5351    #[serde(rename = "open")]
5352    Open,
5353    #[serde(rename = "closed")]
5354    Closed,
5355    #[serde(rename = "all")]
5356    All,
5357}
5358
5359impl IssueSearchIssuesQueryState {
5360    fn as_str(&self) -> &'static str {
5361        match self {
5362            IssueSearchIssuesQueryState::Open => "open",
5363            IssueSearchIssuesQueryState::Closed => "closed",
5364            IssueSearchIssuesQueryState::All => "all",
5365        }
5366    }
5367}
5368
5369#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5370pub enum IssueSearchIssuesQueryType {
5371    #[serde(rename = "issues")]
5372    Issues,
5373    #[serde(rename = "pulls")]
5374    Pulls,
5375}
5376
5377impl IssueSearchIssuesQueryType {
5378    fn as_str(&self) -> &'static str {
5379        match self {
5380            IssueSearchIssuesQueryType::Issues => "issues",
5381            IssueSearchIssuesQueryType::Pulls => "pulls",
5382        }
5383    }
5384}
5385
5386#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5387pub enum IssueSearchIssuesQuerySort {
5388    #[serde(rename = "relevance")]
5389    Relevance,
5390    #[serde(rename = "latest")]
5391    Latest,
5392    #[serde(rename = "oldest")]
5393    Oldest,
5394    #[serde(rename = "recentupdate")]
5395    Recentupdate,
5396    #[serde(rename = "leastupdate")]
5397    Leastupdate,
5398    #[serde(rename = "mostcomment")]
5399    Mostcomment,
5400    #[serde(rename = "leastcomment")]
5401    Leastcomment,
5402    #[serde(rename = "nearduedate")]
5403    Nearduedate,
5404    #[serde(rename = "farduedate")]
5405    Farduedate,
5406}
5407
5408impl IssueSearchIssuesQuerySort {
5409    fn as_str(&self) -> &'static str {
5410        match self {
5411            IssueSearchIssuesQuerySort::Relevance => "relevance",
5412            IssueSearchIssuesQuerySort::Latest => "latest",
5413            IssueSearchIssuesQuerySort::Oldest => "oldest",
5414            IssueSearchIssuesQuerySort::Recentupdate => "recentupdate",
5415            IssueSearchIssuesQuerySort::Leastupdate => "leastupdate",
5416            IssueSearchIssuesQuerySort::Mostcomment => "mostcomment",
5417            IssueSearchIssuesQuerySort::Leastcomment => "leastcomment",
5418            IssueSearchIssuesQuerySort::Nearduedate => "nearduedate",
5419            IssueSearchIssuesQuerySort::Farduedate => "farduedate",
5420        }
5421    }
5422}
5423#[derive(Debug, Clone, PartialEq, Default)]
5424pub struct RepoSearchQuery {
5425    /// keyword
5426    pub q: Option<String>,
5427    /// Limit search to repositories with keyword as topic
5428    pub topic: Option<bool>,
5429    /// include search of keyword within repository description
5430    pub include_desc: Option<bool>,
5431    /// search only for repos that the user with the given id owns or contributes to
5432    pub uid: Option<i64>,
5433    /// repo owner to prioritize in the results
5434    pub priority_owner_id: Option<i64>,
5435    /// search only for repos that belong to the given team id
5436    pub team_id: Option<i64>,
5437    /// search only for repos that the user with the given id has starred
5438    pub starred_by: Option<i64>,
5439    /// include private repositories this user has access to (defaults to true)
5440    pub private: Option<bool>,
5441    /// show only public, private or all repositories (defaults to all)
5442    pub is_private: Option<bool>,
5443    /// include template repositories this user has access to (defaults to true)
5444    pub template: Option<bool>,
5445    /// show only archived, non-archived or all repositories (defaults to all)
5446    pub archived: Option<bool>,
5447    /// type of repository to search for. Supported values are "fork", "source", "mirror" and "collaborative"
5448    pub mode: Option<String>,
5449    /// if `uid` is given, search only for repos that the user owns
5450    pub exclusive: Option<bool>,
5451    /// sort repos by attribute. Supported values are "alpha", "created", "updated", "size", "git_size", "lfs_size", "stars", "forks" and "id". Default is "alpha"
5452    pub sort: Option<RepoSearchQuerySort>,
5453    /// sort order, either "asc" (ascending) or "desc" (descending). Default is "asc", ignored if "sort" is not specified.
5454    pub order: Option<RepoSearchQueryOrder>,
5455}
5456
5457impl RepoSearchQuery {
5458    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5459        let mut list = Vec::new();
5460        if let Some(q) = self.q {
5461            list.push(("q", q));
5462        }
5463        if let Some(topic) = self.topic {
5464            list.push(("topic", topic.to_string()));
5465        }
5466        if let Some(include_desc) = self.include_desc {
5467            list.push(("includeDesc", include_desc.to_string()));
5468        }
5469        if let Some(uid) = self.uid {
5470            list.push(("uid", uid.to_string()));
5471        }
5472        if let Some(priority_owner_id) = self.priority_owner_id {
5473            list.push(("priority_owner_id", priority_owner_id.to_string()));
5474        }
5475        if let Some(team_id) = self.team_id {
5476            list.push(("team_id", team_id.to_string()));
5477        }
5478        if let Some(starred_by) = self.starred_by {
5479            list.push(("starredBy", starred_by.to_string()));
5480        }
5481        if let Some(private) = self.private {
5482            list.push(("private", private.to_string()));
5483        }
5484        if let Some(is_private) = self.is_private {
5485            list.push(("is_private", is_private.to_string()));
5486        }
5487        if let Some(template) = self.template {
5488            list.push(("template", template.to_string()));
5489        }
5490        if let Some(archived) = self.archived {
5491            list.push(("archived", archived.to_string()));
5492        }
5493        if let Some(mode) = self.mode {
5494            list.push(("mode", mode));
5495        }
5496        if let Some(exclusive) = self.exclusive {
5497            list.push(("exclusive", exclusive.to_string()));
5498        }
5499        if let Some(sort) = self.sort {
5500            list.push(("sort", sort.as_str().to_string()));
5501        }
5502        if let Some(order) = self.order {
5503            list.push(("order", order.as_str().to_string()));
5504        }
5505
5506        list
5507    }
5508}
5509
5510#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5511pub enum RepoSearchQuerySort {
5512    #[serde(rename = "alpha")]
5513    Alpha,
5514    #[serde(rename = "created")]
5515    Created,
5516    #[serde(rename = "updated")]
5517    Updated,
5518    #[serde(rename = "size")]
5519    Size,
5520    #[serde(rename = "git_size")]
5521    GitSize,
5522    #[serde(rename = "lfs_size")]
5523    LfsSize,
5524    #[serde(rename = "id")]
5525    Id,
5526    #[serde(rename = "stars")]
5527    Stars,
5528    #[serde(rename = "forks")]
5529    Forks,
5530}
5531
5532impl RepoSearchQuerySort {
5533    fn as_str(&self) -> &'static str {
5534        match self {
5535            RepoSearchQuerySort::Alpha => "alpha",
5536            RepoSearchQuerySort::Created => "created",
5537            RepoSearchQuerySort::Updated => "updated",
5538            RepoSearchQuerySort::Size => "size",
5539            RepoSearchQuerySort::GitSize => "git_size",
5540            RepoSearchQuerySort::LfsSize => "lfs_size",
5541            RepoSearchQuerySort::Id => "id",
5542            RepoSearchQuerySort::Stars => "stars",
5543            RepoSearchQuerySort::Forks => "forks",
5544        }
5545    }
5546}
5547
5548#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5549pub enum RepoSearchQueryOrder {
5550    #[serde(rename = "asc")]
5551    Asc,
5552    #[serde(rename = "desc")]
5553    Desc,
5554}
5555
5556impl RepoSearchQueryOrder {
5557    fn as_str(&self) -> &'static str {
5558        match self {
5559            RepoSearchQueryOrder::Asc => "asc",
5560            RepoSearchQueryOrder::Desc => "desc",
5561        }
5562    }
5563}
5564#[derive(Debug, Clone, PartialEq, Default)]
5565pub struct RepoSearchRunJobsQuery {
5566    /// a comma separated list of run job labels to search for
5567    pub labels: Option<String>,
5568}
5569
5570impl RepoSearchRunJobsQuery {
5571    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5572        let mut list = Vec::new();
5573        if let Some(labels) = self.labels {
5574            list.push(("labels", labels));
5575        }
5576
5577        list
5578    }
5579}
5580
5581#[derive(Debug, Clone, PartialEq, Default)]
5582pub struct ListActionRunsQuery {
5583    /// Returns workflow run triggered by the specified events. For example, `push`, `pull_request` or `workflow_dispatch`.
5584    pub event: Option<Vec<String>>,
5585    /// Returns workflow runs with the check run status or conclusion that is specified. For example, a conclusion can be success or a status can be in_progress. Only Forgejo Actions can set a status of waiting, pending, or requested.
5586    pub status: Option<Vec<ListActionRunsQueryStatus>>,
5587    /// Returns the workflow run associated with the run number.
5588    pub run_number: Option<i64>,
5589    /// Only returns workflow runs that are associated with the specified head_sha.
5590    pub head_sha: Option<String>,
5591}
5592
5593impl ListActionRunsQuery {
5594    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5595        let mut list = Vec::new();
5596        if let Some(event) = self.event {
5597            if !event.is_empty() {
5598                let mut s = String::new();
5599                for (i, item) in event.iter().enumerate() {
5600                    s.push_str(item);
5601                    if i < event.len() - 1 {
5602                        s.push(',')
5603                    }
5604                }
5605                list.push(("event", s));
5606            }
5607        }
5608        if let Some(status) = self.status {
5609            if !status.is_empty() {
5610                let mut s = String::new();
5611                for (i, item) in status.iter().enumerate() {
5612                    s.push_str(item.as_str());
5613                    if i < status.len() - 1 {
5614                        s.push(',')
5615                    }
5616                }
5617                list.push(("status", s));
5618            }
5619        }
5620        if let Some(run_number) = self.run_number {
5621            list.push(("run_number", run_number.to_string()));
5622        }
5623        if let Some(head_sha) = self.head_sha {
5624            list.push(("head_sha", head_sha));
5625        }
5626
5627        list
5628    }
5629}
5630
5631#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5632pub enum ListActionRunsQueryStatus {
5633    #[serde(rename = "unknown")]
5634    Unknown,
5635    #[serde(rename = "waiting")]
5636    Waiting,
5637    #[serde(rename = "running")]
5638    Running,
5639    #[serde(rename = "success")]
5640    Success,
5641    #[serde(rename = "failure")]
5642    Failure,
5643    #[serde(rename = "cancelled")]
5644    Cancelled,
5645    #[serde(rename = "skipped")]
5646    Skipped,
5647    #[serde(rename = "blocked")]
5648    Blocked,
5649}
5650
5651impl ListActionRunsQueryStatus {
5652    fn as_str(&self) -> &'static str {
5653        match self {
5654            ListActionRunsQueryStatus::Unknown => "unknown",
5655            ListActionRunsQueryStatus::Waiting => "waiting",
5656            ListActionRunsQueryStatus::Running => "running",
5657            ListActionRunsQueryStatus::Success => "success",
5658            ListActionRunsQueryStatus::Failure => "failure",
5659            ListActionRunsQueryStatus::Cancelled => "cancelled",
5660            ListActionRunsQueryStatus::Skipped => "skipped",
5661            ListActionRunsQueryStatus::Blocked => "blocked",
5662        }
5663    }
5664}
5665#[derive(Debug, Clone, PartialEq, Default)]
5666pub struct RepoListActivityFeedsQuery {
5667    /// the date of the activities to be found
5668    pub date: Option<time::Date>,
5669}
5670
5671impl RepoListActivityFeedsQuery {
5672    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5673        let mut list = Vec::new();
5674        if let Some(date) = self.date {
5675            list.push((
5676                "date",
5677                date.format(&time::format_description::well_known::Rfc3339)
5678                    .unwrap(),
5679            ));
5680        }
5681
5682        list
5683    }
5684}
5685
5686#[derive(Debug, Clone, PartialEq, Default)]
5687pub struct RepoGetAllCommitsQuery {
5688    /// SHA or branch to start listing commits from (usually 'master')
5689    pub sha: Option<String>,
5690    /// filepath of a file/dir
5691    pub path: Option<String>,
5692    /// include diff stats for every commit (disable for speedup, default 'true')
5693    pub stat: Option<bool>,
5694    /// include verification for every commit (disable for speedup, default 'true')
5695    pub verification: Option<bool>,
5696    /// include a list of affected files for every commit (disable for speedup, default 'true')
5697    pub files: Option<bool>,
5698    /// commits that match the given specifier will not be listed.
5699    pub not: Option<String>,
5700}
5701
5702impl RepoGetAllCommitsQuery {
5703    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5704        let mut list = Vec::new();
5705        if let Some(sha) = self.sha {
5706            list.push(("sha", sha));
5707        }
5708        if let Some(path) = self.path {
5709            list.push(("path", path));
5710        }
5711        if let Some(stat) = self.stat {
5712            list.push(("stat", stat.to_string()));
5713        }
5714        if let Some(verification) = self.verification {
5715            list.push(("verification", verification.to_string()));
5716        }
5717        if let Some(files) = self.files {
5718            list.push(("files", files.to_string()));
5719        }
5720        if let Some(not) = self.not {
5721            list.push(("not", not));
5722        }
5723
5724        list
5725    }
5726}
5727
5728#[derive(Debug, Clone, PartialEq, Default)]
5729pub struct RepoListStatusesByRefQuery {
5730    /// type of sort
5731    pub sort: Option<RepoListStatusesByRefQuerySort>,
5732    /// type of state
5733    pub state: Option<RepoListStatusesByRefQueryState>,
5734}
5735
5736impl RepoListStatusesByRefQuery {
5737    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5738        let mut list = Vec::new();
5739        if let Some(sort) = self.sort {
5740            list.push(("sort", sort.as_str().to_string()));
5741        }
5742        if let Some(state) = self.state {
5743            list.push(("state", state.as_str().to_string()));
5744        }
5745
5746        list
5747    }
5748}
5749
5750#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5751pub enum RepoListStatusesByRefQuerySort {
5752    #[serde(rename = "oldest")]
5753    Oldest,
5754    #[serde(rename = "recentupdate")]
5755    Recentupdate,
5756    #[serde(rename = "leastupdate")]
5757    Leastupdate,
5758    #[serde(rename = "leastindex")]
5759    Leastindex,
5760    #[serde(rename = "highestindex")]
5761    Highestindex,
5762}
5763
5764impl RepoListStatusesByRefQuerySort {
5765    fn as_str(&self) -> &'static str {
5766        match self {
5767            RepoListStatusesByRefQuerySort::Oldest => "oldest",
5768            RepoListStatusesByRefQuerySort::Recentupdate => "recentupdate",
5769            RepoListStatusesByRefQuerySort::Leastupdate => "leastupdate",
5770            RepoListStatusesByRefQuerySort::Leastindex => "leastindex",
5771            RepoListStatusesByRefQuerySort::Highestindex => "highestindex",
5772        }
5773    }
5774}
5775
5776#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5777pub enum RepoListStatusesByRefQueryState {
5778    #[serde(rename = "pending")]
5779    Pending,
5780    #[serde(rename = "success")]
5781    Success,
5782    #[serde(rename = "error")]
5783    Error,
5784    #[serde(rename = "failure")]
5785    Failure,
5786    #[serde(rename = "warning")]
5787    Warning,
5788}
5789
5790impl RepoListStatusesByRefQueryState {
5791    fn as_str(&self) -> &'static str {
5792        match self {
5793            RepoListStatusesByRefQueryState::Pending => "pending",
5794            RepoListStatusesByRefQueryState::Success => "success",
5795            RepoListStatusesByRefQueryState::Error => "error",
5796            RepoListStatusesByRefQueryState::Failure => "failure",
5797            RepoListStatusesByRefQueryState::Warning => "warning",
5798        }
5799    }
5800}
5801#[derive(Debug, Clone, PartialEq, Default)]
5802pub struct RepoGetContentsListQuery {
5803    /// The name of the commit/branch/tag. Default the repository’s default branch (usually master)
5804    pub r#ref: Option<String>,
5805}
5806
5807impl RepoGetContentsListQuery {
5808    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5809        let mut list = Vec::new();
5810        if let Some(r#ref) = self.r#ref {
5811            list.push(("ref", r#ref));
5812        }
5813
5814        list
5815    }
5816}
5817
5818#[derive(Debug, Clone, PartialEq, Default)]
5819pub struct RepoGetContentsQuery {
5820    /// The name of the commit/branch/tag. Default the repository’s default branch (usually master)
5821    pub r#ref: Option<String>,
5822}
5823
5824impl RepoGetContentsQuery {
5825    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5826        let mut list = Vec::new();
5827        if let Some(r#ref) = self.r#ref {
5828            list.push(("ref", r#ref));
5829        }
5830
5831        list
5832    }
5833}
5834
5835#[derive(Debug, Clone, PartialEq, Default)]
5836pub struct RepoGetEditorConfigQuery {
5837    /// The name of the commit/branch/tag. Default the repository’s default branch (usually master)
5838    pub r#ref: Option<String>,
5839}
5840
5841impl RepoGetEditorConfigQuery {
5842    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5843        let mut list = Vec::new();
5844        if let Some(r#ref) = self.r#ref {
5845            list.push(("ref", r#ref));
5846        }
5847
5848        list
5849    }
5850}
5851
5852#[derive(Debug, Clone, PartialEq)]
5853pub struct GetBlobsQuery {
5854    /// a comma separated list of blob-sha (mind the overall URL-length limit of ~2,083 chars)
5855    pub shas: String,
5856}
5857
5858impl GetBlobsQuery {
5859    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5860        let mut list = Vec::new();
5861        let shas = self.shas;
5862        list.push(("shas", shas));
5863
5864        list
5865    }
5866}
5867
5868#[derive(Debug, Clone, PartialEq, Default)]
5869pub struct RepoGetSingleCommitQuery {
5870    /// include diff stats for every commit (disable for speedup, default 'true')
5871    pub stat: Option<bool>,
5872    /// include verification for every commit (disable for speedup, default 'true')
5873    pub verification: Option<bool>,
5874    /// include a list of affected files for every commit (disable for speedup, default 'true')
5875    pub files: Option<bool>,
5876}
5877
5878impl RepoGetSingleCommitQuery {
5879    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5880        let mut list = Vec::new();
5881        if let Some(stat) = self.stat {
5882            list.push(("stat", stat.to_string()));
5883        }
5884        if let Some(verification) = self.verification {
5885            list.push(("verification", verification.to_string()));
5886        }
5887        if let Some(files) = self.files {
5888            list.push(("files", files.to_string()));
5889        }
5890
5891        list
5892    }
5893}
5894
5895#[derive(Debug, Clone, PartialEq, Default)]
5896pub struct RepoGetNoteQuery {
5897    /// include verification for every commit (disable for speedup, default 'true')
5898    pub verification: Option<bool>,
5899    /// include a list of affected files for every commit (disable for speedup, default 'true')
5900    pub files: Option<bool>,
5901}
5902
5903impl RepoGetNoteQuery {
5904    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5905        let mut list = Vec::new();
5906        if let Some(verification) = self.verification {
5907            list.push(("verification", verification.to_string()));
5908        }
5909        if let Some(files) = self.files {
5910            list.push(("files", files.to_string()));
5911        }
5912
5913        list
5914    }
5915}
5916
5917#[derive(Debug, Clone, PartialEq, Default)]
5918pub struct GetTreeQuery {
5919    /// show all directories and files
5920    pub recursive: Option<bool>,
5921    /// number of items per page
5922    pub per_page: Option<u32>,
5923}
5924
5925impl GetTreeQuery {
5926    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5927        let mut list = Vec::new();
5928        if let Some(recursive) = self.recursive {
5929            list.push(("recursive", recursive.to_string()));
5930        }
5931        if let Some(per_page) = self.per_page {
5932            list.push(("per_page", per_page.to_string()));
5933        }
5934
5935        list
5936    }
5937}
5938
5939#[derive(Debug, Clone, PartialEq, Default)]
5940pub struct RepoTestHookQuery {
5941    /// The name of the commit/branch/tag, indicates which commit will be loaded to the webhook payload.
5942    pub r#ref: Option<String>,
5943}
5944
5945impl RepoTestHookQuery {
5946    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5947        let mut list = Vec::new();
5948        if let Some(r#ref) = self.r#ref {
5949            list.push(("ref", r#ref));
5950        }
5951
5952        list
5953    }
5954}
5955
5956#[derive(Debug, Clone, PartialEq, Default)]
5957pub struct IssueListIssuesQuery {
5958    /// whether issue is open or closed
5959    pub state: Option<IssueListIssuesQueryState>,
5960    /// comma separated list of labels. Fetch only issues that have any of this labels. Non existent labels are discarded
5961    pub labels: Option<String>,
5962    /// search string
5963    pub q: Option<String>,
5964    /// filter by type (issues / pulls) if set
5965    pub r#type: Option<IssueListIssuesQueryType>,
5966    /// comma separated list of milestone names or ids. It uses names and fall back to ids. Fetch only issues that have any of this milestones. Non existent milestones are discarded
5967    pub milestones: Option<String>,
5968    /// Only show items updated after the given time. This is a timestamp in RFC 3339 format
5969    pub since: Option<time::OffsetDateTime>,
5970    /// Only show items updated before the given time. This is a timestamp in RFC 3339 format
5971    pub before: Option<time::OffsetDateTime>,
5972    /// Only show items which were created by the given user
5973    pub created_by: Option<String>,
5974    /// Only show items for which the given user is assigned
5975    pub assigned_by: Option<String>,
5976    /// Only show items in which the given user was mentioned
5977    pub mentioned_by: Option<String>,
5978    /// Type of sort
5979    pub sort: Option<IssueListIssuesQuerySort>,
5980}
5981
5982impl IssueListIssuesQuery {
5983    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5984        let mut list = Vec::new();
5985        if let Some(state) = self.state {
5986            list.push(("state", state.as_str().to_string()));
5987        }
5988        if let Some(labels) = self.labels {
5989            list.push(("labels", labels));
5990        }
5991        if let Some(q) = self.q {
5992            list.push(("q", q));
5993        }
5994        if let Some(r#type) = self.r#type {
5995            list.push(("type", r#type.as_str().to_string()));
5996        }
5997        if let Some(milestones) = self.milestones {
5998            list.push(("milestones", milestones));
5999        }
6000        if let Some(since) = self.since {
6001            list.push((
6002                "since",
6003                since
6004                    .format(&time::format_description::well_known::Rfc3339)
6005                    .unwrap(),
6006            ));
6007        }
6008        if let Some(before) = self.before {
6009            list.push((
6010                "before",
6011                before
6012                    .format(&time::format_description::well_known::Rfc3339)
6013                    .unwrap(),
6014            ));
6015        }
6016        if let Some(created_by) = self.created_by {
6017            list.push(("created_by", created_by));
6018        }
6019        if let Some(assigned_by) = self.assigned_by {
6020            list.push(("assigned_by", assigned_by));
6021        }
6022        if let Some(mentioned_by) = self.mentioned_by {
6023            list.push(("mentioned_by", mentioned_by));
6024        }
6025        if let Some(sort) = self.sort {
6026            list.push(("sort", sort.as_str().to_string()));
6027        }
6028
6029        list
6030    }
6031}
6032
6033#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6034pub enum IssueListIssuesQueryState {
6035    #[serde(rename = "closed")]
6036    Closed,
6037    #[serde(rename = "open")]
6038    Open,
6039    #[serde(rename = "all")]
6040    All,
6041}
6042
6043impl IssueListIssuesQueryState {
6044    fn as_str(&self) -> &'static str {
6045        match self {
6046            IssueListIssuesQueryState::Closed => "closed",
6047            IssueListIssuesQueryState::Open => "open",
6048            IssueListIssuesQueryState::All => "all",
6049        }
6050    }
6051}
6052
6053#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6054pub enum IssueListIssuesQueryType {
6055    #[serde(rename = "issues")]
6056    Issues,
6057    #[serde(rename = "pulls")]
6058    Pulls,
6059}
6060
6061impl IssueListIssuesQueryType {
6062    fn as_str(&self) -> &'static str {
6063        match self {
6064            IssueListIssuesQueryType::Issues => "issues",
6065            IssueListIssuesQueryType::Pulls => "pulls",
6066        }
6067    }
6068}
6069
6070#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6071pub enum IssueListIssuesQuerySort {
6072    #[serde(rename = "relevance")]
6073    Relevance,
6074    #[serde(rename = "latest")]
6075    Latest,
6076    #[serde(rename = "oldest")]
6077    Oldest,
6078    #[serde(rename = "recentupdate")]
6079    Recentupdate,
6080    #[serde(rename = "leastupdate")]
6081    Leastupdate,
6082    #[serde(rename = "mostcomment")]
6083    Mostcomment,
6084    #[serde(rename = "leastcomment")]
6085    Leastcomment,
6086    #[serde(rename = "nearduedate")]
6087    Nearduedate,
6088    #[serde(rename = "farduedate")]
6089    Farduedate,
6090}
6091
6092impl IssueListIssuesQuerySort {
6093    fn as_str(&self) -> &'static str {
6094        match self {
6095            IssueListIssuesQuerySort::Relevance => "relevance",
6096            IssueListIssuesQuerySort::Latest => "latest",
6097            IssueListIssuesQuerySort::Oldest => "oldest",
6098            IssueListIssuesQuerySort::Recentupdate => "recentupdate",
6099            IssueListIssuesQuerySort::Leastupdate => "leastupdate",
6100            IssueListIssuesQuerySort::Mostcomment => "mostcomment",
6101            IssueListIssuesQuerySort::Leastcomment => "leastcomment",
6102            IssueListIssuesQuerySort::Nearduedate => "nearduedate",
6103            IssueListIssuesQuerySort::Farduedate => "farduedate",
6104        }
6105    }
6106}
6107#[derive(Debug, Clone, PartialEq, Default)]
6108pub struct IssueGetRepoCommentsQuery {
6109    /// if provided, only comments updated since the provided time are returned.
6110    pub since: Option<time::OffsetDateTime>,
6111    /// if provided, only comments updated before the provided time are returned.
6112    pub before: Option<time::OffsetDateTime>,
6113}
6114
6115impl IssueGetRepoCommentsQuery {
6116    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6117        let mut list = Vec::new();
6118        if let Some(since) = self.since {
6119            list.push((
6120                "since",
6121                since
6122                    .format(&time::format_description::well_known::Rfc3339)
6123                    .unwrap(),
6124            ));
6125        }
6126        if let Some(before) = self.before {
6127            list.push((
6128                "before",
6129                before
6130                    .format(&time::format_description::well_known::Rfc3339)
6131                    .unwrap(),
6132            ));
6133        }
6134
6135        list
6136    }
6137}
6138
6139#[derive(Debug, Clone, PartialEq, Default)]
6140pub struct IssueCreateIssueCommentAttachmentQuery {
6141    /// name of the attachment
6142    pub name: Option<String>,
6143    /// time of the attachment's creation. This is a timestamp in RFC 3339 format
6144    pub updated_at: Option<time::OffsetDateTime>,
6145}
6146
6147impl IssueCreateIssueCommentAttachmentQuery {
6148    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6149        let mut list = Vec::new();
6150        if let Some(name) = self.name {
6151            list.push(("name", name));
6152        }
6153        if let Some(updated_at) = self.updated_at {
6154            list.push((
6155                "updated_at",
6156                updated_at
6157                    .format(&time::format_description::well_known::Rfc3339)
6158                    .unwrap(),
6159            ));
6160        }
6161
6162        list
6163    }
6164}
6165
6166#[derive(Debug, Clone, PartialEq, Default)]
6167pub struct IssueCreateIssueAttachmentQuery {
6168    /// name of the attachment
6169    pub name: Option<String>,
6170    /// time of the attachment's creation. This is a timestamp in RFC 3339 format
6171    pub updated_at: Option<time::OffsetDateTime>,
6172}
6173
6174impl IssueCreateIssueAttachmentQuery {
6175    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6176        let mut list = Vec::new();
6177        if let Some(name) = self.name {
6178            list.push(("name", name));
6179        }
6180        if let Some(updated_at) = self.updated_at {
6181            list.push((
6182                "updated_at",
6183                updated_at
6184                    .format(&time::format_description::well_known::Rfc3339)
6185                    .unwrap(),
6186            ));
6187        }
6188
6189        list
6190    }
6191}
6192
6193#[derive(Debug, Clone, PartialEq, Default)]
6194pub struct IssueGetCommentsQuery {
6195    /// if provided, only comments updated since the specified time are returned.
6196    pub since: Option<time::OffsetDateTime>,
6197    /// if provided, only comments updated before the provided time are returned.
6198    pub before: Option<time::OffsetDateTime>,
6199}
6200
6201impl IssueGetCommentsQuery {
6202    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6203        let mut list = Vec::new();
6204        if let Some(since) = self.since {
6205            list.push((
6206                "since",
6207                since
6208                    .format(&time::format_description::well_known::Rfc3339)
6209                    .unwrap(),
6210            ));
6211        }
6212        if let Some(before) = self.before {
6213            list.push((
6214                "before",
6215                before
6216                    .format(&time::format_description::well_known::Rfc3339)
6217                    .unwrap(),
6218            ));
6219        }
6220
6221        list
6222    }
6223}
6224
6225#[derive(Debug, Clone, PartialEq, Default)]
6226pub struct IssueGetCommentsAndTimelineQuery {
6227    /// if provided, only comments updated since the specified time are returned.
6228    pub since: Option<time::OffsetDateTime>,
6229    /// if provided, only comments updated before the provided time are returned.
6230    pub before: Option<time::OffsetDateTime>,
6231}
6232
6233impl IssueGetCommentsAndTimelineQuery {
6234    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6235        let mut list = Vec::new();
6236        if let Some(since) = self.since {
6237            list.push((
6238                "since",
6239                since
6240                    .format(&time::format_description::well_known::Rfc3339)
6241                    .unwrap(),
6242            ));
6243        }
6244        if let Some(before) = self.before {
6245            list.push((
6246                "before",
6247                before
6248                    .format(&time::format_description::well_known::Rfc3339)
6249                    .unwrap(),
6250            ));
6251        }
6252
6253        list
6254    }
6255}
6256
6257#[derive(Debug, Clone, PartialEq, Default)]
6258pub struct IssueTrackedTimesQuery {
6259    /// optional filter by user (available for issue managers)
6260    pub user: Option<String>,
6261    /// Only show times updated after the given time. This is a timestamp in RFC 3339 format
6262    pub since: Option<time::OffsetDateTime>,
6263    /// Only show times updated before the given time. This is a timestamp in RFC 3339 format
6264    pub before: Option<time::OffsetDateTime>,
6265}
6266
6267impl IssueTrackedTimesQuery {
6268    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6269        let mut list = Vec::new();
6270        if let Some(user) = self.user {
6271            list.push(("user", user));
6272        }
6273        if let Some(since) = self.since {
6274            list.push((
6275                "since",
6276                since
6277                    .format(&time::format_description::well_known::Rfc3339)
6278                    .unwrap(),
6279            ));
6280        }
6281        if let Some(before) = self.before {
6282            list.push((
6283                "before",
6284                before
6285                    .format(&time::format_description::well_known::Rfc3339)
6286                    .unwrap(),
6287            ));
6288        }
6289
6290        list
6291    }
6292}
6293
6294#[derive(Debug, Clone, PartialEq, Default)]
6295pub struct RepoListKeysQuery {
6296    /// the key_id to search for
6297    pub key_id: Option<u32>,
6298    /// fingerprint of the key
6299    pub fingerprint: Option<String>,
6300}
6301
6302impl RepoListKeysQuery {
6303    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6304        let mut list = Vec::new();
6305        if let Some(key_id) = self.key_id {
6306            list.push(("key_id", key_id.to_string()));
6307        }
6308        if let Some(fingerprint) = self.fingerprint {
6309            list.push(("fingerprint", fingerprint));
6310        }
6311
6312        list
6313    }
6314}
6315
6316#[derive(Debug, Clone, PartialEq, Default)]
6317pub struct IssueListLabelsQuery {
6318    /// Specifies the sorting method: mostissues, leastissues, or reversealphabetically.
6319    pub sort: Option<IssueListLabelsQuerySort>,
6320}
6321
6322impl IssueListLabelsQuery {
6323    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6324        let mut list = Vec::new();
6325        if let Some(sort) = self.sort {
6326            list.push(("sort", sort.as_str().to_string()));
6327        }
6328
6329        list
6330    }
6331}
6332
6333#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6334pub enum IssueListLabelsQuerySort {
6335    #[serde(rename = "mostissues")]
6336    Mostissues,
6337    #[serde(rename = "leastissues")]
6338    Leastissues,
6339    #[serde(rename = "reversealphabetically")]
6340    Reversealphabetically,
6341}
6342
6343impl IssueListLabelsQuerySort {
6344    fn as_str(&self) -> &'static str {
6345        match self {
6346            IssueListLabelsQuerySort::Mostissues => "mostissues",
6347            IssueListLabelsQuerySort::Leastissues => "leastissues",
6348            IssueListLabelsQuerySort::Reversealphabetically => "reversealphabetically",
6349        }
6350    }
6351}
6352#[derive(Debug, Clone, PartialEq, Default)]
6353pub struct RepoGetRawFileOrLfsQuery {
6354    /// The name of the commit/branch/tag. Default the repository’s default branch (usually master)
6355    pub r#ref: Option<String>,
6356}
6357
6358impl RepoGetRawFileOrLfsQuery {
6359    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6360        let mut list = Vec::new();
6361        if let Some(r#ref) = self.r#ref {
6362            list.push(("ref", r#ref));
6363        }
6364
6365        list
6366    }
6367}
6368
6369#[derive(Debug, Clone, PartialEq, Default)]
6370pub struct IssueGetMilestonesListQuery {
6371    /// Milestone state, Recognized values are open, closed and all. Defaults to "open"
6372    pub state: Option<String>,
6373    /// filter by milestone name
6374    pub name: Option<String>,
6375}
6376
6377impl IssueGetMilestonesListQuery {
6378    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6379        let mut list = Vec::new();
6380        if let Some(state) = self.state {
6381            list.push(("state", state));
6382        }
6383        if let Some(name) = self.name {
6384            list.push(("name", name));
6385        }
6386
6387        list
6388    }
6389}
6390
6391#[derive(Debug, Clone, PartialEq, Default)]
6392pub struct NotifyGetRepoListQuery {
6393    /// If true, show notifications marked as read. Default value is false
6394    pub all: Option<bool>,
6395    /// Show notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread & pinned
6396    pub status_types: Option<Vec<String>>,
6397    /// filter notifications by subject type
6398    pub subject_type: Option<Vec<NotifyGetRepoListQuerySubjectType>>,
6399    /// Only show notifications updated after the given time. This is a timestamp in RFC 3339 format
6400    pub since: Option<time::OffsetDateTime>,
6401    /// Only show notifications updated before the given time. This is a timestamp in RFC 3339 format
6402    pub before: Option<time::OffsetDateTime>,
6403}
6404
6405impl NotifyGetRepoListQuery {
6406    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6407        let mut list = Vec::new();
6408        if let Some(all) = self.all {
6409            list.push(("all", all.to_string()));
6410        }
6411        if let Some(status_types) = self.status_types {
6412            if !status_types.is_empty() {
6413                for item in status_types {
6414                    list.push(("status-types", item.to_string()));
6415                }
6416            }
6417        }
6418        if let Some(subject_type) = self.subject_type {
6419            if !subject_type.is_empty() {
6420                for item in subject_type {
6421                    list.push(("subject-type", item.as_str().to_string()));
6422                }
6423            }
6424        }
6425        if let Some(since) = self.since {
6426            list.push((
6427                "since",
6428                since
6429                    .format(&time::format_description::well_known::Rfc3339)
6430                    .unwrap(),
6431            ));
6432        }
6433        if let Some(before) = self.before {
6434            list.push((
6435                "before",
6436                before
6437                    .format(&time::format_description::well_known::Rfc3339)
6438                    .unwrap(),
6439            ));
6440        }
6441
6442        list
6443    }
6444}
6445
6446#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6447pub enum NotifyGetRepoListQuerySubjectType {
6448    #[serde(rename = "issue")]
6449    Issue,
6450    #[serde(rename = "pull")]
6451    Pull,
6452    #[serde(rename = "commit")]
6453    Commit,
6454    #[serde(rename = "repository")]
6455    Repository,
6456}
6457
6458impl NotifyGetRepoListQuerySubjectType {
6459    fn as_str(&self) -> &'static str {
6460        match self {
6461            NotifyGetRepoListQuerySubjectType::Issue => "issue",
6462            NotifyGetRepoListQuerySubjectType::Pull => "pull",
6463            NotifyGetRepoListQuerySubjectType::Commit => "commit",
6464            NotifyGetRepoListQuerySubjectType::Repository => "repository",
6465        }
6466    }
6467}
6468#[derive(Debug, Clone, PartialEq, Default)]
6469pub struct NotifyReadRepoListQuery {
6470    /// If true, mark all notifications on this repo. Default value is false
6471    pub all: Option<bool>,
6472    /// Mark notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread.
6473    pub status_types: Option<Vec<String>>,
6474    /// Status to mark notifications as. Defaults to read.
6475    pub to_status: Option<String>,
6476    /// Describes the last point that notifications were checked. Anything updated since this time will not be updated.
6477    pub last_read_at: Option<time::OffsetDateTime>,
6478}
6479
6480impl NotifyReadRepoListQuery {
6481    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6482        let mut list = Vec::new();
6483        if let Some(all) = self.all {
6484            list.push(("all", all.to_string()));
6485        }
6486        if let Some(status_types) = self.status_types {
6487            if !status_types.is_empty() {
6488                for item in status_types {
6489                    list.push(("status-types", item.to_string()));
6490                }
6491            }
6492        }
6493        if let Some(to_status) = self.to_status {
6494            list.push(("to-status", to_status));
6495        }
6496        if let Some(last_read_at) = self.last_read_at {
6497            list.push((
6498                "last_read_at",
6499                last_read_at
6500                    .format(&time::format_description::well_known::Rfc3339)
6501                    .unwrap(),
6502            ));
6503        }
6504
6505        list
6506    }
6507}
6508
6509#[derive(Debug, Clone, PartialEq, Default)]
6510pub struct RepoListPullRequestsQuery {
6511    /// State of pull request
6512    pub state: Option<RepoListPullRequestsQueryState>,
6513    /// Type of sort
6514    pub sort: Option<RepoListPullRequestsQuerySort>,
6515    /// ID of the milestone
6516    pub milestone: Option<i64>,
6517    /// Label IDs
6518    pub labels: Option<Vec<i64>>,
6519    /// Filter by pull request author
6520    pub poster: Option<String>,
6521}
6522
6523impl RepoListPullRequestsQuery {
6524    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6525        let mut list = Vec::new();
6526        if let Some(state) = self.state {
6527            list.push(("state", state.as_str().to_string()));
6528        }
6529        if let Some(sort) = self.sort {
6530            list.push(("sort", sort.as_str().to_string()));
6531        }
6532        if let Some(milestone) = self.milestone {
6533            list.push(("milestone", milestone.to_string()));
6534        }
6535        if let Some(labels) = self.labels {
6536            if !labels.is_empty() {
6537                for item in labels {
6538                    list.push(("labels", format!("{item}")));
6539                }
6540            }
6541        }
6542        if let Some(poster) = self.poster {
6543            list.push(("poster", poster));
6544        }
6545
6546        list
6547    }
6548}
6549
6550#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6551pub enum RepoListPullRequestsQueryState {
6552    #[serde(rename = "open")]
6553    Open,
6554    #[serde(rename = "closed")]
6555    Closed,
6556    #[serde(rename = "all")]
6557    All,
6558}
6559
6560impl RepoListPullRequestsQueryState {
6561    fn as_str(&self) -> &'static str {
6562        match self {
6563            RepoListPullRequestsQueryState::Open => "open",
6564            RepoListPullRequestsQueryState::Closed => "closed",
6565            RepoListPullRequestsQueryState::All => "all",
6566        }
6567    }
6568}
6569
6570#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6571pub enum RepoListPullRequestsQuerySort {
6572    #[serde(rename = "oldest")]
6573    Oldest,
6574    #[serde(rename = "recentupdate")]
6575    Recentupdate,
6576    #[serde(rename = "recentclose")]
6577    Recentclose,
6578    #[serde(rename = "leastupdate")]
6579    Leastupdate,
6580    #[serde(rename = "mostcomment")]
6581    Mostcomment,
6582    #[serde(rename = "leastcomment")]
6583    Leastcomment,
6584    #[serde(rename = "priority")]
6585    Priority,
6586}
6587
6588impl RepoListPullRequestsQuerySort {
6589    fn as_str(&self) -> &'static str {
6590        match self {
6591            RepoListPullRequestsQuerySort::Oldest => "oldest",
6592            RepoListPullRequestsQuerySort::Recentupdate => "recentupdate",
6593            RepoListPullRequestsQuerySort::Recentclose => "recentclose",
6594            RepoListPullRequestsQuerySort::Leastupdate => "leastupdate",
6595            RepoListPullRequestsQuerySort::Mostcomment => "mostcomment",
6596            RepoListPullRequestsQuerySort::Leastcomment => "leastcomment",
6597            RepoListPullRequestsQuerySort::Priority => "priority",
6598        }
6599    }
6600}
6601#[derive(Debug, Clone, PartialEq, Default)]
6602pub struct RepoDownloadPullDiffOrPatchQuery {
6603    /// whether to include binary file changes. if true, the diff is applicable with `git apply`
6604    pub binary: Option<bool>,
6605}
6606
6607impl RepoDownloadPullDiffOrPatchQuery {
6608    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6609        let mut list = Vec::new();
6610        if let Some(binary) = self.binary {
6611            list.push(("binary", binary.to_string()));
6612        }
6613
6614        list
6615    }
6616}
6617
6618#[derive(Debug, Clone, PartialEq, Default)]
6619pub struct RepoGetPullRequestCommitsQuery {
6620    /// include verification for every commit (disable for speedup, default 'true')
6621    pub verification: Option<bool>,
6622    /// include a list of affected files for every commit (disable for speedup, default 'true')
6623    pub files: Option<bool>,
6624}
6625
6626impl RepoGetPullRequestCommitsQuery {
6627    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6628        let mut list = Vec::new();
6629        if let Some(verification) = self.verification {
6630            list.push(("verification", verification.to_string()));
6631        }
6632        if let Some(files) = self.files {
6633            list.push(("files", files.to_string()));
6634        }
6635
6636        list
6637    }
6638}
6639
6640#[derive(Debug, Clone, PartialEq, Default)]
6641pub struct RepoGetPullRequestFilesQuery {
6642    /// skip to given file
6643    pub skip_to: Option<String>,
6644    /// whitespace behavior
6645    pub whitespace: Option<RepoGetPullRequestFilesQueryWhitespace>,
6646}
6647
6648impl RepoGetPullRequestFilesQuery {
6649    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6650        let mut list = Vec::new();
6651        if let Some(skip_to) = self.skip_to {
6652            list.push(("skip-to", skip_to));
6653        }
6654        if let Some(whitespace) = self.whitespace {
6655            list.push(("whitespace", whitespace.as_str().to_string()));
6656        }
6657
6658        list
6659    }
6660}
6661
6662#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6663pub enum RepoGetPullRequestFilesQueryWhitespace {
6664    #[serde(rename = "ignore-all")]
6665    IgnoreAll,
6666    #[serde(rename = "ignore-change")]
6667    IgnoreChange,
6668    #[serde(rename = "ignore-eol")]
6669    IgnoreEol,
6670    #[serde(rename = "show-all")]
6671    ShowAll,
6672}
6673
6674impl RepoGetPullRequestFilesQueryWhitespace {
6675    fn as_str(&self) -> &'static str {
6676        match self {
6677            RepoGetPullRequestFilesQueryWhitespace::IgnoreAll => "ignore-all",
6678            RepoGetPullRequestFilesQueryWhitespace::IgnoreChange => "ignore-change",
6679            RepoGetPullRequestFilesQueryWhitespace::IgnoreEol => "ignore-eol",
6680            RepoGetPullRequestFilesQueryWhitespace::ShowAll => "show-all",
6681        }
6682    }
6683}
6684#[derive(Debug, Clone, PartialEq, Default)]
6685pub struct RepoUpdatePullRequestQuery {
6686    /// how to update pull request
6687    pub style: Option<RepoUpdatePullRequestQueryStyle>,
6688}
6689
6690impl RepoUpdatePullRequestQuery {
6691    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6692        let mut list = Vec::new();
6693        if let Some(style) = self.style {
6694            list.push(("style", style.as_str().to_string()));
6695        }
6696
6697        list
6698    }
6699}
6700
6701#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6702pub enum RepoUpdatePullRequestQueryStyle {
6703    #[serde(rename = "merge")]
6704    Merge,
6705    #[serde(rename = "rebase")]
6706    Rebase,
6707}
6708
6709impl RepoUpdatePullRequestQueryStyle {
6710    fn as_str(&self) -> &'static str {
6711        match self {
6712            RepoUpdatePullRequestQueryStyle::Merge => "merge",
6713            RepoUpdatePullRequestQueryStyle::Rebase => "rebase",
6714        }
6715    }
6716}
6717#[derive(Debug, Clone, PartialEq, Default)]
6718pub struct RepoGetRawFileQuery {
6719    /// The name of the commit/branch/tag. Default the repository’s default branch (usually master)
6720    pub r#ref: Option<String>,
6721}
6722
6723impl RepoGetRawFileQuery {
6724    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6725        let mut list = Vec::new();
6726        if let Some(r#ref) = self.r#ref {
6727            list.push(("ref", r#ref));
6728        }
6729
6730        list
6731    }
6732}
6733
6734#[derive(Debug, Clone, PartialEq, Default)]
6735pub struct RepoListReleasesQuery {
6736    /// filter (exclude / include) drafts, if you dont have repo write access none will show
6737    pub draft: Option<bool>,
6738    /// filter (exclude / include) pre-releases
6739    pub pre_release: Option<bool>,
6740    /// Search string
6741    pub q: Option<String>,
6742}
6743
6744impl RepoListReleasesQuery {
6745    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6746        let mut list = Vec::new();
6747        if let Some(draft) = self.draft {
6748            list.push(("draft", draft.to_string()));
6749        }
6750        if let Some(pre_release) = self.pre_release {
6751            list.push(("pre-release", pre_release.to_string()));
6752        }
6753        if let Some(q) = self.q {
6754            list.push(("q", q));
6755        }
6756
6757        list
6758    }
6759}
6760
6761#[derive(Debug, Clone, PartialEq, Default)]
6762pub struct RepoCreateReleaseAttachmentQuery {
6763    /// name of the attachment
6764    pub name: Option<String>,
6765}
6766
6767impl RepoCreateReleaseAttachmentQuery {
6768    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6769        let mut list = Vec::new();
6770        if let Some(name) = self.name {
6771            list.push(("name", name));
6772        }
6773
6774        list
6775    }
6776}
6777
6778#[derive(Debug, Clone, PartialEq, Default)]
6779pub struct RepoListStatusesQuery {
6780    /// type of sort
6781    pub sort: Option<RepoListStatusesQuerySort>,
6782    /// type of state
6783    pub state: Option<RepoListStatusesQueryState>,
6784}
6785
6786impl RepoListStatusesQuery {
6787    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6788        let mut list = Vec::new();
6789        if let Some(sort) = self.sort {
6790            list.push(("sort", sort.as_str().to_string()));
6791        }
6792        if let Some(state) = self.state {
6793            list.push(("state", state.as_str().to_string()));
6794        }
6795
6796        list
6797    }
6798}
6799
6800#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6801pub enum RepoListStatusesQuerySort {
6802    #[serde(rename = "oldest")]
6803    Oldest,
6804    #[serde(rename = "recentupdate")]
6805    Recentupdate,
6806    #[serde(rename = "leastupdate")]
6807    Leastupdate,
6808    #[serde(rename = "leastindex")]
6809    Leastindex,
6810    #[serde(rename = "highestindex")]
6811    Highestindex,
6812}
6813
6814impl RepoListStatusesQuerySort {
6815    fn as_str(&self) -> &'static str {
6816        match self {
6817            RepoListStatusesQuerySort::Oldest => "oldest",
6818            RepoListStatusesQuerySort::Recentupdate => "recentupdate",
6819            RepoListStatusesQuerySort::Leastupdate => "leastupdate",
6820            RepoListStatusesQuerySort::Leastindex => "leastindex",
6821            RepoListStatusesQuerySort::Highestindex => "highestindex",
6822        }
6823    }
6824}
6825
6826#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6827pub enum RepoListStatusesQueryState {
6828    #[serde(rename = "pending")]
6829    Pending,
6830    #[serde(rename = "success")]
6831    Success,
6832    #[serde(rename = "error")]
6833    Error,
6834    #[serde(rename = "failure")]
6835    Failure,
6836    #[serde(rename = "warning")]
6837    Warning,
6838}
6839
6840impl RepoListStatusesQueryState {
6841    fn as_str(&self) -> &'static str {
6842        match self {
6843            RepoListStatusesQueryState::Pending => "pending",
6844            RepoListStatusesQueryState::Success => "success",
6845            RepoListStatusesQueryState::Error => "error",
6846            RepoListStatusesQueryState::Failure => "failure",
6847            RepoListStatusesQueryState::Warning => "warning",
6848        }
6849    }
6850}
6851#[derive(Debug, Clone, PartialEq, Default)]
6852pub struct RepoTrackedTimesQuery {
6853    /// optional filter by user (available for issue managers)
6854    pub user: Option<String>,
6855    /// Only show times updated after the given time. This is a timestamp in RFC 3339 format
6856    pub since: Option<time::OffsetDateTime>,
6857    /// Only show times updated before the given time. This is a timestamp in RFC 3339 format
6858    pub before: Option<time::OffsetDateTime>,
6859}
6860
6861impl RepoTrackedTimesQuery {
6862    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6863        let mut list = Vec::new();
6864        if let Some(user) = self.user {
6865            list.push(("user", user));
6866        }
6867        if let Some(since) = self.since {
6868            list.push((
6869                "since",
6870                since
6871                    .format(&time::format_description::well_known::Rfc3339)
6872                    .unwrap(),
6873            ));
6874        }
6875        if let Some(before) = self.before {
6876            list.push((
6877                "before",
6878                before
6879                    .format(&time::format_description::well_known::Rfc3339)
6880                    .unwrap(),
6881            ));
6882        }
6883
6884        list
6885    }
6886}
6887
6888#[derive(Debug, Clone, PartialEq, Default)]
6889pub struct OrgListTeamActivityFeedsQuery {
6890    /// the date of the activities to be found
6891    pub date: Option<time::Date>,
6892}
6893
6894impl OrgListTeamActivityFeedsQuery {
6895    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6896        let mut list = Vec::new();
6897        if let Some(date) = self.date {
6898            list.push((
6899                "date",
6900                date.format(&time::format_description::well_known::Rfc3339)
6901                    .unwrap(),
6902            ));
6903        }
6904
6905        list
6906    }
6907}
6908
6909#[derive(Debug, Clone, PartialEq)]
6910pub struct TopicSearchQuery {
6911    /// keyword to search for
6912    pub q: String,
6913}
6914
6915impl TopicSearchQuery {
6916    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6917        let mut list = Vec::new();
6918        let q = self.q;
6919        list.push(("q", q));
6920
6921        list
6922    }
6923}
6924#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
6925pub struct TopicSearchResults {
6926    pub topics: Option<Vec<TopicResponse>>,
6927}
6928
6929impl_from_response!(TopicSearchResults);
6930
6931#[derive(Debug, Clone, PartialEq, Default)]
6932pub struct UserSearchRunJobsQuery {
6933    /// a comma separated list of run job labels to search for
6934    pub labels: Option<String>,
6935}
6936
6937impl UserSearchRunJobsQuery {
6938    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6939        let mut list = Vec::new();
6940        if let Some(labels) = self.labels {
6941            list.push(("labels", labels));
6942        }
6943
6944        list
6945    }
6946}
6947
6948#[derive(Debug, Clone, PartialEq, Default)]
6949pub struct UserCurrentListKeysQuery {
6950    /// fingerprint of the key
6951    pub fingerprint: Option<String>,
6952}
6953
6954impl UserCurrentListKeysQuery {
6955    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6956        let mut list = Vec::new();
6957        if let Some(fingerprint) = self.fingerprint {
6958            list.push(("fingerprint", fingerprint));
6959        }
6960
6961        list
6962    }
6963}
6964
6965#[derive(Debug, Clone, PartialEq)]
6966pub struct UserCheckQuotaQuery {
6967    /// subject of the quota
6968    pub subject: String,
6969}
6970
6971impl UserCheckQuotaQuery {
6972    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6973        let mut list = Vec::new();
6974        let subject = self.subject;
6975        list.push(("subject", subject));
6976
6977        list
6978    }
6979}
6980
6981#[derive(Debug, Clone, PartialEq, Default)]
6982pub struct UserCurrentListReposQuery {
6983    /// order the repositories
6984    pub order_by: Option<UserCurrentListReposQueryOrderBy>,
6985}
6986
6987impl UserCurrentListReposQuery {
6988    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6989        let mut list = Vec::new();
6990        if let Some(order_by) = self.order_by {
6991            list.push(("order_by", order_by.as_str().to_string()));
6992        }
6993
6994        list
6995    }
6996}
6997
6998#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6999pub enum UserCurrentListReposQueryOrderBy {
7000    #[serde(rename = "name")]
7001    Name,
7002    #[serde(rename = "id")]
7003    Id,
7004    #[serde(rename = "newest")]
7005    Newest,
7006    #[serde(rename = "oldest")]
7007    Oldest,
7008    #[serde(rename = "recentupdate")]
7009    Recentupdate,
7010    #[serde(rename = "leastupdate")]
7011    Leastupdate,
7012    #[serde(rename = "reversealphabetically")]
7013    Reversealphabetically,
7014    #[serde(rename = "alphabetically")]
7015    Alphabetically,
7016    #[serde(rename = "reversesize")]
7017    Reversesize,
7018    #[serde(rename = "size")]
7019    Size,
7020    #[serde(rename = "reversegitsize")]
7021    Reversegitsize,
7022    #[serde(rename = "gitsize")]
7023    Gitsize,
7024    #[serde(rename = "reverselfssize")]
7025    Reverselfssize,
7026    #[serde(rename = "lfssize")]
7027    Lfssize,
7028    #[serde(rename = "moststars")]
7029    Moststars,
7030    #[serde(rename = "feweststars")]
7031    Feweststars,
7032    #[serde(rename = "mostforks")]
7033    Mostforks,
7034    #[serde(rename = "fewestforks")]
7035    Fewestforks,
7036}
7037
7038impl UserCurrentListReposQueryOrderBy {
7039    fn as_str(&self) -> &'static str {
7040        match self {
7041            UserCurrentListReposQueryOrderBy::Name => "name",
7042            UserCurrentListReposQueryOrderBy::Id => "id",
7043            UserCurrentListReposQueryOrderBy::Newest => "newest",
7044            UserCurrentListReposQueryOrderBy::Oldest => "oldest",
7045            UserCurrentListReposQueryOrderBy::Recentupdate => "recentupdate",
7046            UserCurrentListReposQueryOrderBy::Leastupdate => "leastupdate",
7047            UserCurrentListReposQueryOrderBy::Reversealphabetically => "reversealphabetically",
7048            UserCurrentListReposQueryOrderBy::Alphabetically => "alphabetically",
7049            UserCurrentListReposQueryOrderBy::Reversesize => "reversesize",
7050            UserCurrentListReposQueryOrderBy::Size => "size",
7051            UserCurrentListReposQueryOrderBy::Reversegitsize => "reversegitsize",
7052            UserCurrentListReposQueryOrderBy::Gitsize => "gitsize",
7053            UserCurrentListReposQueryOrderBy::Reverselfssize => "reverselfssize",
7054            UserCurrentListReposQueryOrderBy::Lfssize => "lfssize",
7055            UserCurrentListReposQueryOrderBy::Moststars => "moststars",
7056            UserCurrentListReposQueryOrderBy::Feweststars => "feweststars",
7057            UserCurrentListReposQueryOrderBy::Mostforks => "mostforks",
7058            UserCurrentListReposQueryOrderBy::Fewestforks => "fewestforks",
7059        }
7060    }
7061}
7062#[derive(Debug, Clone, PartialEq, Default)]
7063pub struct UserCurrentTrackedTimesQuery {
7064    /// Only show times updated after the given time. This is a timestamp in RFC 3339 format
7065    pub since: Option<time::OffsetDateTime>,
7066    /// Only show times updated before the given time. This is a timestamp in RFC 3339 format
7067    pub before: Option<time::OffsetDateTime>,
7068}
7069
7070impl UserCurrentTrackedTimesQuery {
7071    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
7072        let mut list = Vec::new();
7073        if let Some(since) = self.since {
7074            list.push((
7075                "since",
7076                since
7077                    .format(&time::format_description::well_known::Rfc3339)
7078                    .unwrap(),
7079            ));
7080        }
7081        if let Some(before) = self.before {
7082            list.push((
7083                "before",
7084                before
7085                    .format(&time::format_description::well_known::Rfc3339)
7086                    .unwrap(),
7087            ));
7088        }
7089
7090        list
7091    }
7092}
7093
7094#[derive(Debug, Clone, PartialEq, Default)]
7095pub struct UserSearchQuery {
7096    /// keyword
7097    pub q: Option<String>,
7098    /// ID of the user to search for
7099    pub uid: Option<i64>,
7100    /// sort order of results
7101    pub sort: Option<UserSearchQuerySort>,
7102}
7103
7104impl UserSearchQuery {
7105    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
7106        let mut list = Vec::new();
7107        if let Some(q) = self.q {
7108            list.push(("q", q));
7109        }
7110        if let Some(uid) = self.uid {
7111            list.push(("uid", uid.to_string()));
7112        }
7113        if let Some(sort) = self.sort {
7114            list.push(("sort", sort.as_str().to_string()));
7115        }
7116
7117        list
7118    }
7119}
7120
7121#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
7122pub enum UserSearchQuerySort {
7123    #[serde(rename = "oldest")]
7124    Oldest,
7125    #[serde(rename = "newest")]
7126    Newest,
7127    #[serde(rename = "alphabetically")]
7128    Alphabetically,
7129    #[serde(rename = "reversealphabetically")]
7130    Reversealphabetically,
7131    #[serde(rename = "recentupdate")]
7132    Recentupdate,
7133    #[serde(rename = "leastupdate")]
7134    Leastupdate,
7135}
7136
7137impl UserSearchQuerySort {
7138    fn as_str(&self) -> &'static str {
7139        match self {
7140            UserSearchQuerySort::Oldest => "oldest",
7141            UserSearchQuerySort::Newest => "newest",
7142            UserSearchQuerySort::Alphabetically => "alphabetically",
7143            UserSearchQuerySort::Reversealphabetically => "reversealphabetically",
7144            UserSearchQuerySort::Recentupdate => "recentupdate",
7145            UserSearchQuerySort::Leastupdate => "leastupdate",
7146        }
7147    }
7148}
7149#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
7150pub struct UserSearchResults {
7151    pub data: Option<Vec<User>>,
7152    pub ok: Option<bool>,
7153}
7154
7155impl_from_response!(UserSearchResults);
7156
7157#[derive(Debug, Clone, PartialEq, Default)]
7158pub struct UserListActivityFeedsQuery {
7159    /// if true, only show actions performed by the requested user
7160    pub only_performed_by: Option<bool>,
7161    /// the date of the activities to be found
7162    pub date: Option<time::Date>,
7163}
7164
7165impl UserListActivityFeedsQuery {
7166    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
7167        let mut list = Vec::new();
7168        if let Some(only_performed_by) = self.only_performed_by {
7169            list.push(("only-performed-by", only_performed_by.to_string()));
7170        }
7171        if let Some(date) = self.date {
7172            list.push((
7173                "date",
7174                date.format(&time::format_description::well_known::Rfc3339)
7175                    .unwrap(),
7176            ));
7177        }
7178
7179        list
7180    }
7181}
7182
7183#[derive(Debug, Clone, PartialEq, Default)]
7184pub struct UserListKeysQuery {
7185    /// fingerprint of the key
7186    pub fingerprint: Option<String>,
7187}
7188
7189impl UserListKeysQuery {
7190    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
7191        let mut list = Vec::new();
7192        if let Some(fingerprint) = self.fingerprint {
7193            list.push(("fingerprint", fingerprint));
7194        }
7195
7196        list
7197    }
7198}