Skip to main content

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 AccessToken {
73    pub id: Option<i64>,
74    pub name: Option<String>,
75    pub scopes: Option<Vec<String>>,
76    pub sha1: Option<String>,
77    pub token_last_eight: Option<String>,
78}
79
80impl_from_response!(AccessToken);
81
82/// ActionRun represents an action run
83#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
84pub struct ActionRun {
85    /// the cron id for the schedule trigger
86    #[serde(rename = "ScheduleID")]
87    pub schedule_id: Option<i64>,
88    /// who approved this action run
89    pub approved_by: Option<i64>,
90    /// the commit sha the action run ran on
91    pub commit_sha: Option<String>,
92    #[serde(with = "time::serde::rfc3339::option")]
93    /// when the action run was created
94    pub created: Option<time::OffsetDateTime>,
95    pub duration: Option<i64>,
96    /// the webhook event that causes the workflow to run
97    pub event: Option<String>,
98    /// the payload of the webhook event that causes the workflow to run
99    pub event_payload: Option<String>,
100    #[serde(deserialize_with = "crate::none_if_blank_url")]
101    /// the url of this action run
102    pub html_url: Option<url::Url>,
103    /// the action run id
104    pub id: Option<i64>,
105    /// a unique number for each run of a repository
106    pub index_in_repo: Option<i64>,
107    /// 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.
108    pub is_fork_pull_request: Option<bool>,
109    /// has the commit/tag/… the action run ran on been deleted
110    pub is_ref_deleted: Option<bool>,
111    /// may need approval if it's a fork pull request
112    pub need_approval: Option<bool>,
113    /// the commit/tag/… the action run ran on
114    pub prettyref: Option<String>,
115    pub repository: Option<Repository>,
116    #[serde(with = "time::serde::rfc3339::option")]
117    /// when the action run was started
118    pub started: Option<time::OffsetDateTime>,
119    /// the current status of this run
120    pub status: Option<String>,
121    #[serde(with = "time::serde::rfc3339::option")]
122    /// when the action run was stopped
123    pub stopped: Option<time::OffsetDateTime>,
124    /// the action run's title
125    pub title: Option<String>,
126    /// the trigger event defined in the `on` configuration of the triggered workflow
127    pub trigger_event: Option<String>,
128    pub trigger_user: Option<User>,
129    #[serde(with = "time::serde::rfc3339::option")]
130    /// when the action run was last updated
131    pub updated: Option<time::OffsetDateTime>,
132    /// the name of workflow file
133    pub workflow_id: Option<String>,
134}
135
136impl_from_response!(ActionRun);
137
138/// ActionRunJob represents a job of a run
139#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
140pub struct ActionRunJob {
141    /// the action run job id
142    pub id: Option<i64>,
143    /// the action run job name
144    pub name: Option<String>,
145    /// the action run job needed ids
146    pub needs: Option<Vec<String>>,
147    /// the owner id
148    pub owner_id: Option<i64>,
149    /// the repository id
150    pub repo_id: Option<i64>,
151    /// the action run job labels to run on
152    pub runs_on: Option<Vec<String>>,
153    /// the action run job status
154    pub status: Option<String>,
155    /// the action run job latest task id
156    pub task_id: Option<i64>,
157}
158
159impl_from_response!(ActionRunJob);
160
161/// ActionTask represents a ActionTask
162#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
163pub struct ActionTask {
164    #[serde(with = "time::serde::rfc3339::option")]
165    pub created_at: Option<time::OffsetDateTime>,
166    pub display_title: Option<String>,
167    pub event: Option<String>,
168    pub head_branch: Option<String>,
169    pub head_sha: Option<String>,
170    pub id: Option<i64>,
171    pub name: Option<String>,
172    pub run_number: Option<i64>,
173    #[serde(with = "time::serde::rfc3339::option")]
174    pub run_started_at: Option<time::OffsetDateTime>,
175    pub status: Option<String>,
176    #[serde(with = "time::serde::rfc3339::option")]
177    pub updated_at: Option<time::OffsetDateTime>,
178    #[serde(deserialize_with = "crate::none_if_blank_url")]
179    pub url: Option<url::Url>,
180    pub workflow_id: Option<String>,
181}
182
183/// ActionTaskResponse returns a ActionTask
184#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
185pub struct ActionTaskResponse {
186    pub total_count: Option<i64>,
187    pub workflow_runs: Option<Vec<ActionTask>>,
188}
189
190impl_from_response!(ActionTaskResponse);
191
192/// ActionVariable return value of the query API
193#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
194pub struct ActionVariable {
195    /// the value of the variable
196    pub data: Option<String>,
197    /// the name of the variable
198    pub name: Option<String>,
199    /// the owner to which the variable belongs
200    pub owner_id: Option<i64>,
201    /// the repository to which the variable belongs
202    pub repo_id: Option<i64>,
203}
204
205impl_from_response!(ActionVariable);
206
207#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
208pub struct Activity {
209    pub act_user: Option<User>,
210    pub act_user_id: Option<i64>,
211    pub comment: Option<Comment>,
212    pub comment_id: Option<i64>,
213    pub content: Option<String>,
214    #[serde(with = "time::serde::rfc3339::option")]
215    pub created: Option<time::OffsetDateTime>,
216    pub id: Option<i64>,
217    pub is_private: Option<bool>,
218    /// the type of action
219    pub op_type: Option<ActivityOpType>,
220    pub ref_name: Option<String>,
221    pub repo: Option<Repository>,
222    pub repo_id: Option<i64>,
223    pub user_id: Option<i64>,
224}
225
226impl_from_response!(Activity);
227
228/// the type of action
229
230#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
231pub enum ActivityOpType {
232    #[serde(rename = "create_repo")]
233    CreateRepo,
234    #[serde(rename = "rename_repo")]
235    RenameRepo,
236    #[serde(rename = "star_repo")]
237    StarRepo,
238    #[serde(rename = "watch_repo")]
239    WatchRepo,
240    #[serde(rename = "commit_repo")]
241    CommitRepo,
242    #[serde(rename = "create_issue")]
243    CreateIssue,
244    #[serde(rename = "create_pull_request")]
245    CreatePullRequest,
246    #[serde(rename = "transfer_repo")]
247    TransferRepo,
248    #[serde(rename = "push_tag")]
249    PushTag,
250    #[serde(rename = "comment_issue")]
251    CommentIssue,
252    #[serde(rename = "merge_pull_request")]
253    MergePullRequest,
254    #[serde(rename = "close_issue")]
255    CloseIssue,
256    #[serde(rename = "reopen_issue")]
257    ReopenIssue,
258    #[serde(rename = "close_pull_request")]
259    ClosePullRequest,
260    #[serde(rename = "reopen_pull_request")]
261    ReopenPullRequest,
262    #[serde(rename = "delete_tag")]
263    DeleteTag,
264    #[serde(rename = "delete_branch")]
265    DeleteBranch,
266    #[serde(rename = "mirror_sync_push")]
267    MirrorSyncPush,
268    #[serde(rename = "mirror_sync_create")]
269    MirrorSyncCreate,
270    #[serde(rename = "mirror_sync_delete")]
271    MirrorSyncDelete,
272    #[serde(rename = "approve_pull_request")]
273    ApprovePullRequest,
274    #[serde(rename = "reject_pull_request")]
275    RejectPullRequest,
276    #[serde(rename = "comment_pull")]
277    CommentPull,
278    #[serde(rename = "publish_release")]
279    PublishRelease,
280    #[serde(rename = "pull_review_dismissed")]
281    PullReviewDismissed,
282    #[serde(rename = "pull_request_ready_for_review")]
283    PullRequestReadyForReview,
284    #[serde(rename = "auto_merge_pull_request")]
285    AutoMergePullRequest,
286}
287/// ActivityPub type
288#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
289pub struct ActivityPub {
290    #[serde(rename = "@context")]
291    pub context: Option<String>,
292}
293
294impl_from_response!(ActivityPub);
295
296/// AddCollaboratorOption options when adding a user as a collaborator of a repository
297#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
298pub struct AddCollaboratorOption {
299    pub permission: Option<AddCollaboratorOptionPermission>,
300}
301
302#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
303pub enum AddCollaboratorOptionPermission {
304    #[serde(rename = "read")]
305    Read,
306    #[serde(rename = "write")]
307    Write,
308    #[serde(rename = "admin")]
309    Admin,
310}
311/// AddTimeOption options for adding time to an issue
312#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
313pub struct AddTimeOption {
314    #[serde(with = "time::serde::rfc3339::option")]
315    pub created: Option<time::OffsetDateTime>,
316    /// time in seconds
317    pub time: i64,
318    /// User who spent the time (optional)
319    pub user_name: Option<String>,
320}
321
322/// AnnotatedTag represents an annotated tag
323#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
324pub struct AnnotatedTag {
325    pub archive_download_count: Option<TagArchiveDownloadCount>,
326    pub message: Option<String>,
327    pub object: Option<AnnotatedTagObject>,
328    pub sha: Option<String>,
329    pub tag: Option<String>,
330    pub tagger: Option<CommitUser>,
331    #[serde(deserialize_with = "crate::none_if_blank_url")]
332    pub url: Option<url::Url>,
333    pub verification: Option<PayloadCommitVerification>,
334}
335
336impl_from_response!(AnnotatedTag);
337
338/// AnnotatedTagObject contains meta information of the tag object
339#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
340pub struct AnnotatedTagObject {
341    pub sha: Option<String>,
342    #[serde(rename = "type")]
343    pub r#type: Option<String>,
344    #[serde(deserialize_with = "crate::none_if_blank_url")]
345    pub url: Option<url::Url>,
346}
347
348/// Attachment a generic attachment
349#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
350pub struct Attachment {
351    #[serde(deserialize_with = "crate::none_if_blank_url")]
352    pub browser_download_url: Option<url::Url>,
353    #[serde(with = "time::serde::rfc3339::option")]
354    pub created_at: Option<time::OffsetDateTime>,
355    pub download_count: Option<i64>,
356    pub id: Option<i64>,
357    pub name: Option<String>,
358    pub size: Option<i64>,
359    #[serde(rename = "type")]
360    pub r#type: Option<AttachmentType>,
361    pub uuid: Option<String>,
362}
363
364impl_from_response!(Attachment);
365
366#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
367pub enum AttachmentType {
368    #[serde(rename = "attachment")]
369    Attachment,
370    #[serde(rename = "external")]
371    External,
372}
373#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
374pub struct BlockedUser {
375    pub block_id: Option<i64>,
376    #[serde(with = "time::serde::rfc3339::option")]
377    pub created_at: Option<time::OffsetDateTime>,
378}
379
380impl_from_response!(BlockedUser);
381
382/// Branch represents a repository branch
383#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
384pub struct Branch {
385    pub commit: Option<PayloadCommit>,
386    pub effective_branch_protection_name: Option<String>,
387    pub enable_status_check: Option<bool>,
388    pub name: Option<String>,
389    pub protected: Option<bool>,
390    pub required_approvals: Option<i64>,
391    pub status_check_contexts: Option<Vec<String>>,
392    pub user_can_merge: Option<bool>,
393    pub user_can_push: Option<bool>,
394}
395
396impl_from_response!(Branch);
397
398/// BranchProtection represents a branch protection for a repository
399#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
400pub struct BranchProtection {
401    pub apply_to_admins: Option<bool>,
402    pub approvals_whitelist_teams: Option<Vec<String>>,
403    pub approvals_whitelist_username: Option<Vec<String>>,
404    pub block_on_official_review_requests: Option<bool>,
405    pub block_on_outdated_branch: Option<bool>,
406    pub block_on_rejected_reviews: Option<bool>,
407    /// Deprecated: true
408    pub branch_name: Option<String>,
409    #[serde(with = "time::serde::rfc3339::option")]
410    pub created_at: Option<time::OffsetDateTime>,
411    pub dismiss_stale_approvals: Option<bool>,
412    pub enable_approvals_whitelist: Option<bool>,
413    pub enable_merge_whitelist: Option<bool>,
414    pub enable_push: Option<bool>,
415    pub enable_push_whitelist: Option<bool>,
416    pub enable_status_check: Option<bool>,
417    pub ignore_stale_approvals: Option<bool>,
418    pub merge_whitelist_teams: Option<Vec<String>>,
419    pub merge_whitelist_usernames: Option<Vec<String>>,
420    pub protected_file_patterns: Option<String>,
421    pub push_whitelist_deploy_keys: Option<bool>,
422    pub push_whitelist_teams: Option<Vec<String>>,
423    pub push_whitelist_usernames: Option<Vec<String>>,
424    pub require_signed_commits: Option<bool>,
425    pub required_approvals: Option<i64>,
426    pub rule_name: Option<String>,
427    pub status_check_contexts: Option<Vec<String>>,
428    pub unprotected_file_patterns: Option<String>,
429    #[serde(with = "time::serde::rfc3339::option")]
430    pub updated_at: Option<time::OffsetDateTime>,
431}
432
433impl_from_response!(BranchProtection);
434
435/// ChangeFileOperation for creating, updating or deleting a file
436#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
437pub struct ChangeFileOperation {
438    /// new or updated file content, must be base64 encoded
439    pub content: Option<String>,
440    /// old path of the file to move
441    pub from_path: Option<String>,
442    /// indicates what to do with the file
443    pub operation: ChangeFileOperationOperation,
444    /// path to the existing or new file
445    pub path: String,
446    /// sha is the SHA for the file that already exists, required for update or delete
447    pub sha: Option<String>,
448}
449
450/// indicates what to do with the file
451
452#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
453pub enum ChangeFileOperationOperation {
454    #[serde(rename = "create")]
455    Create,
456    #[serde(rename = "update")]
457    Update,
458    #[serde(rename = "delete")]
459    Delete,
460}
461/// ChangeFilesOptions options for creating, updating or deleting multiple files
462///
463/// 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)
464#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
465pub struct ChangeFilesOptions {
466    pub author: Option<Identity>,
467    /// branch (optional) to base this file from. if not given, the default branch is used
468    pub branch: Option<String>,
469    pub committer: Option<Identity>,
470    pub dates: Option<CommitDateOptions>,
471    /// list of file operations
472    pub files: Vec<ChangeFileOperation>,
473    /// message (optional) for the commit of this file. if not supplied, a default message will be used
474    pub message: Option<String>,
475    /// new_branch (optional) will make a new branch from `branch` before creating the file
476    pub new_branch: Option<String>,
477    /// Add a Signed-off-by trailer by the committer at the end of the commit log message.
478    pub signoff: Option<bool>,
479}
480
481/// ChangedFile store information about files affected by the pull request
482#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
483pub struct ChangedFile {
484    pub additions: Option<i64>,
485    pub changes: Option<i64>,
486    #[serde(deserialize_with = "crate::none_if_blank_url")]
487    pub contents_url: Option<url::Url>,
488    pub deletions: Option<i64>,
489    pub filename: Option<String>,
490    #[serde(deserialize_with = "crate::none_if_blank_url")]
491    pub html_url: Option<url::Url>,
492    pub previous_filename: Option<String>,
493    #[serde(deserialize_with = "crate::none_if_blank_url")]
494    pub raw_url: Option<url::Url>,
495    pub status: Option<String>,
496}
497
498impl_from_response!(ChangedFile);
499
500/// CombinedStatus holds the combined state of several statuses for a single commit
501#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
502pub struct CombinedStatus {
503    #[serde(deserialize_with = "crate::none_if_blank_url")]
504    pub commit_url: Option<url::Url>,
505    pub repository: Option<Repository>,
506    pub sha: Option<String>,
507    pub state: Option<CommitStatusState>,
508    pub statuses: Option<Vec<CommitStatus>>,
509    pub total_count: Option<i64>,
510    #[serde(deserialize_with = "crate::none_if_blank_url")]
511    pub url: Option<url::Url>,
512}
513
514impl_from_response!(CombinedStatus);
515
516impl crate::sealed::Sealed for CombinedStatus {}
517impl crate::PageSize for CombinedStatus {
518    fn page_size(&self) -> usize {
519        self.statuses.as_ref().map(|x| x.page_size()).unwrap_or(0)
520    }
521}
522
523/// Comment represents a comment on a commit or issue
524#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
525pub struct Comment {
526    pub assets: Option<Vec<Attachment>>,
527    pub body: Option<String>,
528    #[serde(with = "time::serde::rfc3339::option")]
529    pub created_at: Option<time::OffsetDateTime>,
530    #[serde(deserialize_with = "crate::none_if_blank_url")]
531    pub html_url: Option<url::Url>,
532    pub id: Option<i64>,
533    #[serde(deserialize_with = "crate::none_if_blank_url")]
534    pub issue_url: Option<url::Url>,
535    pub original_author: Option<String>,
536    pub original_author_id: Option<i64>,
537    #[serde(deserialize_with = "crate::none_if_blank_url")]
538    pub pull_request_url: Option<url::Url>,
539    #[serde(with = "time::serde::rfc3339::option")]
540    pub updated_at: Option<time::OffsetDateTime>,
541    pub user: Option<User>,
542}
543
544impl_from_response!(Comment);
545
546#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
547pub struct Commit {
548    pub author: Option<User>,
549    pub commit: Option<RepoCommit>,
550    pub committer: Option<User>,
551    #[serde(with = "time::serde::rfc3339::option")]
552    pub created: Option<time::OffsetDateTime>,
553    pub files: Option<Vec<CommitAffectedFiles>>,
554    #[serde(deserialize_with = "crate::none_if_blank_url")]
555    pub html_url: Option<url::Url>,
556    pub parents: Option<Vec<CommitMeta>>,
557    pub sha: Option<String>,
558    pub stats: Option<CommitStats>,
559    #[serde(deserialize_with = "crate::none_if_blank_url")]
560    pub url: Option<url::Url>,
561}
562
563impl_from_response!(Commit);
564
565/// CommitAffectedFiles store information about files affected by the commit
566#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
567pub struct CommitAffectedFiles {
568    pub filename: Option<String>,
569    pub status: Option<String>,
570}
571
572/// CommitDateOptions store dates for GIT_AUTHOR_DATE and GIT_COMMITTER_DATE
573#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
574pub struct CommitDateOptions {
575    #[serde(with = "time::serde::rfc3339::option")]
576    pub author: Option<time::OffsetDateTime>,
577    #[serde(with = "time::serde::rfc3339::option")]
578    pub committer: Option<time::OffsetDateTime>,
579}
580
581#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
582pub struct CommitMeta {
583    #[serde(with = "time::serde::rfc3339::option")]
584    pub created: Option<time::OffsetDateTime>,
585    pub sha: Option<String>,
586    #[serde(deserialize_with = "crate::none_if_blank_url")]
587    pub url: Option<url::Url>,
588}
589
590/// CommitStats is statistics for a RepoCommit
591#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
592pub struct CommitStats {
593    pub additions: Option<i64>,
594    pub deletions: Option<i64>,
595    pub total: Option<i64>,
596}
597
598/// CommitStatus holds a single status of a single Commit
599#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
600pub struct CommitStatus {
601    pub context: Option<String>,
602    #[serde(with = "time::serde::rfc3339::option")]
603    pub created_at: Option<time::OffsetDateTime>,
604    pub creator: Option<User>,
605    pub description: Option<String>,
606    pub id: Option<i64>,
607    pub status: Option<CommitStatusState>,
608    #[serde(deserialize_with = "crate::none_if_blank_url")]
609    pub target_url: Option<url::Url>,
610    #[serde(with = "time::serde::rfc3339::option")]
611    pub updated_at: Option<time::OffsetDateTime>,
612    #[serde(deserialize_with = "crate::none_if_blank_url")]
613    pub url: Option<url::Url>,
614}
615
616impl_from_response!(CommitStatus);
617
618/// CommitStatusState holds the state of a CommitStatus
619///
620/// It can be "pending", "success", "error", "failure" and "warning"
621
622#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
623pub enum CommitStatusState {
624    #[serde(rename = "pending")]
625    Pending,
626    #[serde(rename = "success")]
627    Success,
628    #[serde(rename = "error")]
629    Error,
630    #[serde(rename = "failure")]
631    Failure,
632    #[serde(rename = "warning")]
633    Warning,
634}
635#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
636pub struct CommitUser {
637    #[serde(with = "time::serde::rfc3339::option")]
638    pub date: Option<time::OffsetDateTime>,
639    pub email: Option<String>,
640    pub name: Option<String>,
641}
642
643#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
644pub struct Compare {
645    pub commits: Option<Vec<Commit>>,
646    pub files: Option<Vec<CommitAffectedFiles>>,
647    pub total_commits: Option<i64>,
648}
649
650impl_from_response!(Compare);
651
652/// ContentsResponse contains information about a repo's entry's (dir, file, symlink, submodule) metadata and content
653#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
654pub struct ContentsResponse {
655    #[serde(rename = "_links")]
656    pub links: Option<FileLinksResponse>,
657    /// `content` is populated when `type` is `file`, otherwise null
658    pub content: Option<String>,
659    #[serde(deserialize_with = "crate::none_if_blank_url")]
660    pub download_url: Option<url::Url>,
661    /// `encoding` is populated when `type` is `file`, otherwise null
662    pub encoding: Option<String>,
663    #[serde(deserialize_with = "crate::none_if_blank_url")]
664    pub git_url: Option<url::Url>,
665    #[serde(deserialize_with = "crate::none_if_blank_url")]
666    pub html_url: Option<url::Url>,
667    pub last_commit_sha: Option<String>,
668    #[serde(with = "time::serde::rfc3339::option")]
669    pub last_commit_when: Option<time::OffsetDateTime>,
670    pub name: Option<String>,
671    pub path: Option<String>,
672    pub sha: Option<String>,
673    pub size: Option<i64>,
674    #[serde(deserialize_with = "crate::none_if_blank_url")]
675    /// `submodule_git_url` is populated when `type` is `submodule`, otherwise null
676    pub submodule_git_url: Option<url::Url>,
677    /// `target` is populated when `type` is `symlink`, otherwise null
678    pub target: Option<String>,
679    /// `type` will be `file`, `dir`, `symlink`, or `submodule`
680    #[serde(rename = "type")]
681    pub r#type: Option<String>,
682    #[serde(deserialize_with = "crate::none_if_blank_url")]
683    pub url: Option<url::Url>,
684}
685
686impl_from_response!(ContentsResponse);
687
688/// CreateAccessTokenOption options when create access token
689#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
690pub struct CreateAccessTokenOption {
691    pub name: String,
692    pub scopes: Option<Vec<String>>,
693}
694
695/// CreateBranchProtectionOption options for creating a branch protection
696#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
697pub struct CreateBranchProtectionOption {
698    pub apply_to_admins: Option<bool>,
699    pub approvals_whitelist_teams: Option<Vec<String>>,
700    pub approvals_whitelist_username: Option<Vec<String>>,
701    pub block_on_official_review_requests: Option<bool>,
702    pub block_on_outdated_branch: Option<bool>,
703    pub block_on_rejected_reviews: Option<bool>,
704    /// Deprecated: true
705    pub branch_name: Option<String>,
706    pub dismiss_stale_approvals: Option<bool>,
707    pub enable_approvals_whitelist: Option<bool>,
708    pub enable_merge_whitelist: Option<bool>,
709    pub enable_push: Option<bool>,
710    pub enable_push_whitelist: Option<bool>,
711    pub enable_status_check: Option<bool>,
712    pub ignore_stale_approvals: Option<bool>,
713    pub merge_whitelist_teams: Option<Vec<String>>,
714    pub merge_whitelist_usernames: Option<Vec<String>>,
715    pub protected_file_patterns: Option<String>,
716    pub push_whitelist_deploy_keys: Option<bool>,
717    pub push_whitelist_teams: Option<Vec<String>>,
718    pub push_whitelist_usernames: Option<Vec<String>>,
719    pub require_signed_commits: Option<bool>,
720    pub required_approvals: Option<i64>,
721    pub rule_name: Option<String>,
722    pub status_check_contexts: Option<Vec<String>>,
723    pub unprotected_file_patterns: Option<String>,
724}
725
726/// CreateBranchRepoOption options when creating a branch in a repository
727#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
728pub struct CreateBranchRepoOption {
729    /// Name of the branch to create
730    pub new_branch_name: String,
731    /// Deprecated: true
732    ///
733    /// Name of the old branch to create from
734    pub old_branch_name: Option<String>,
735    /// Name of the old branch/tag/commit to create from
736    pub old_ref_name: Option<String>,
737}
738
739/// CreateEmailOption options when creating email addresses
740#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
741pub struct CreateEmailOption {
742    /// email addresses to add
743    pub emails: Option<Vec<String>>,
744}
745
746/// CreateFileOptions options for creating files
747///
748/// 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)
749#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
750pub struct CreateFileOptions {
751    pub author: Option<Identity>,
752    /// branch (optional) to base this file from. if not given, the default branch is used
753    pub branch: Option<String>,
754    pub committer: Option<Identity>,
755    /// content must be base64 encoded
756    pub content: String,
757    pub dates: Option<CommitDateOptions>,
758    /// message (optional) for the commit of this file. if not supplied, a default message will be used
759    pub message: Option<String>,
760    /// new_branch (optional) will make a new branch from `branch` before creating the file
761    pub new_branch: Option<String>,
762    /// Add a Signed-off-by trailer by the committer at the end of the commit log message.
763    pub signoff: Option<bool>,
764}
765
766/// CreateForkOption options for creating a fork
767#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
768pub struct CreateForkOption {
769    /// name of the forked repository
770    pub name: Option<String>,
771    /// organization name, if forking into an organization
772    pub organization: Option<String>,
773}
774
775/// CreateGPGKeyOption options create user GPG key
776#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
777pub struct CreateGPGKeyOption {
778    /// An armored GPG key to add
779    pub armored_public_key: String,
780    pub armored_signature: Option<String>,
781}
782
783/// CreateHookOption options when create a hook
784#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
785pub struct CreateHookOption {
786    pub active: Option<bool>,
787    pub authorization_header: Option<String>,
788    pub branch_filter: Option<String>,
789    pub config: CreateHookOptionConfig,
790    pub events: Option<Vec<String>>,
791    #[serde(rename = "type")]
792    pub r#type: CreateHookOptionType,
793}
794
795#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
796pub enum CreateHookOptionType {
797    #[serde(rename = "forgejo")]
798    Forgejo,
799    #[serde(rename = "dingtalk")]
800    Dingtalk,
801    #[serde(rename = "discord")]
802    Discord,
803    #[serde(rename = "gitea")]
804    Gitea,
805    #[serde(rename = "gogs")]
806    Gogs,
807    #[serde(rename = "msteams")]
808    Msteams,
809    #[serde(rename = "slack")]
810    Slack,
811    #[serde(rename = "telegram")]
812    Telegram,
813    #[serde(rename = "feishu")]
814    Feishu,
815    #[serde(rename = "wechatwork")]
816    Wechatwork,
817    #[serde(rename = "packagist")]
818    Packagist,
819}
820/// CreateHookOptionConfig has all config options in it
821///
822/// required are "content_type" and "url" Required
823#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
824pub struct CreateHookOptionConfig {
825    pub content_type: String,
826    pub url: url::Url,
827    #[serde(flatten)]
828    pub additional: BTreeMap<String, String>,
829}
830
831/// CreateIssueCommentOption options for creating a comment on an issue
832#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
833pub struct CreateIssueCommentOption {
834    pub body: String,
835    #[serde(with = "time::serde::rfc3339::option")]
836    pub updated_at: Option<time::OffsetDateTime>,
837}
838
839/// CreateIssueOption options to create one issue
840#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
841pub struct CreateIssueOption {
842    /// deprecated
843    pub assignee: Option<String>,
844    pub assignees: Option<Vec<String>>,
845    pub body: Option<String>,
846    pub closed: Option<bool>,
847    #[serde(with = "time::serde::rfc3339::option")]
848    pub due_date: Option<time::OffsetDateTime>,
849    /// list of label ids
850    pub labels: Option<Vec<i64>>,
851    /// milestone id
852    pub milestone: Option<i64>,
853    #[serde(rename = "ref")]
854    pub r#ref: Option<String>,
855    pub title: String,
856}
857
858/// CreateKeyOption options when creating a key
859#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
860pub struct CreateKeyOption {
861    /// An armored SSH key to add
862    pub key: String,
863    /// Describe if the key has only read access or read/write
864    pub read_only: Option<bool>,
865    /// Title of the key to add
866    pub title: String,
867}
868
869/// CreateLabelOption options for creating a label
870#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
871pub struct CreateLabelOption {
872    pub color: String,
873    pub description: Option<String>,
874    pub exclusive: Option<bool>,
875    pub is_archived: Option<bool>,
876    pub name: String,
877}
878
879/// CreateMilestoneOption options for creating a milestone
880#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
881pub struct CreateMilestoneOption {
882    pub description: Option<String>,
883    #[serde(with = "time::serde::rfc3339::option")]
884    pub due_on: Option<time::OffsetDateTime>,
885    pub state: Option<CreateMilestoneOptionState>,
886    pub title: Option<String>,
887}
888
889#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
890pub enum CreateMilestoneOptionState {
891    #[serde(rename = "open")]
892    Open,
893    #[serde(rename = "closed")]
894    Closed,
895}
896/// CreateOAuth2ApplicationOptions holds options to create an oauth2 application
897#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
898pub struct CreateOAuth2ApplicationOptions {
899    pub confidential_client: Option<bool>,
900    pub name: Option<String>,
901    pub redirect_uris: Option<Vec<String>>,
902}
903
904/// CreateOrUpdateSecretOption options when creating or updating secret
905#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
906pub struct CreateOrUpdateSecretOption {
907    /// Data of the secret to update
908    pub data: String,
909}
910
911/// CreateOrgOption options for creating an organization
912#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
913pub struct CreateOrgOption {
914    pub description: Option<String>,
915    pub email: Option<String>,
916    pub full_name: Option<String>,
917    pub location: Option<String>,
918    pub repo_admin_change_team_access: Option<bool>,
919    pub username: String,
920    /// possible values are `public` (default), `limited` or `private`
921    pub visibility: Option<CreateOrgOptionVisibility>,
922    pub website: Option<String>,
923}
924
925/// possible values are `public` (default), `limited` or `private`
926
927#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
928pub enum CreateOrgOptionVisibility {
929    #[serde(rename = "public")]
930    Public,
931    #[serde(rename = "limited")]
932    Limited,
933    #[serde(rename = "private")]
934    Private,
935}
936/// CreatePullRequestOption options when creating a pull request
937#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
938pub struct CreatePullRequestOption {
939    pub assignee: Option<String>,
940    pub assignees: Option<Vec<String>>,
941    pub base: Option<String>,
942    pub body: Option<String>,
943    #[serde(with = "time::serde::rfc3339::option")]
944    pub due_date: Option<time::OffsetDateTime>,
945    pub head: Option<String>,
946    pub labels: Option<Vec<i64>>,
947    pub milestone: Option<i64>,
948    pub title: Option<String>,
949}
950
951/// CreatePullReviewComment represent a review comment for creation api
952#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
953pub struct CreatePullReviewComment {
954    pub body: Option<String>,
955    /// if comment to new file line or 0
956    pub new_position: Option<i64>,
957    /// if comment to old file line or 0
958    pub old_position: Option<i64>,
959    /// the tree path
960    pub path: Option<String>,
961}
962
963/// CreatePullReviewOptions are options to create a pull review
964#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
965pub struct CreatePullReviewOptions {
966    pub body: Option<String>,
967    pub comments: Option<Vec<CreatePullReviewComment>>,
968    pub commit_id: Option<String>,
969    pub event: Option<String>,
970}
971
972#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
973pub struct CreatePushMirrorOption {
974    pub branch_filter: Option<String>,
975    pub interval: Option<String>,
976    pub remote_address: Option<String>,
977    pub remote_password: Option<String>,
978    pub remote_username: Option<String>,
979    pub sync_on_commit: Option<bool>,
980    pub use_ssh: Option<bool>,
981}
982
983/// CreateQutaGroupOptions represents the options for creating a quota group
984#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
985pub struct CreateQuotaGroupOptions {
986    /// Name of the quota group to create
987    pub name: Option<String>,
988    /// Rules to add to the newly created group.
989    ///
990    /// If a rule does not exist, it will be created.
991    pub rules: Option<Vec<CreateQuotaRuleOptions>>,
992}
993
994/// CreateQuotaRuleOptions represents the options for creating a quota rule
995#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
996pub struct CreateQuotaRuleOptions {
997    /// The limit set by the rule
998    pub limit: Option<i64>,
999    /// Name of the rule to create
1000    pub name: Option<String>,
1001    /// The subjects affected by the rule
1002    pub subjects: Option<Vec<CreateQuotaRuleOptionsSubjects>>,
1003}
1004
1005#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
1006pub enum CreateQuotaRuleOptionsSubjects {
1007    #[serde(rename = "none")]
1008    None,
1009    #[serde(rename = "size:all")]
1010    SizeAll,
1011    #[serde(rename = "size:repos:all")]
1012    SizeReposAll,
1013    #[serde(rename = "size:repos:public")]
1014    SizeReposPublic,
1015    #[serde(rename = "size:repos:private")]
1016    SizeReposPrivate,
1017    #[serde(rename = "size:git:all")]
1018    SizeGitAll,
1019    #[serde(rename = "size:git:lfs")]
1020    SizeGitLfs,
1021    #[serde(rename = "size:assets:all")]
1022    SizeAssetsAll,
1023    #[serde(rename = "size:assets:attachments:all")]
1024    SizeAssetsAttachmentsAll,
1025    #[serde(rename = "size:assets:attachments:issues")]
1026    SizeAssetsAttachmentsIssues,
1027    #[serde(rename = "size:assets:attachments:releases")]
1028    SizeAssetsAttachmentsReleases,
1029    #[serde(rename = "size:assets:artifacts")]
1030    SizeAssetsArtifacts,
1031    #[serde(rename = "size:assets:packages:all")]
1032    SizeAssetsPackagesAll,
1033    #[serde(rename = "size:assets:wiki")]
1034    SizeAssetsWiki,
1035}
1036/// CreateReleaseOption options when creating a release
1037#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1038pub struct CreateReleaseOption {
1039    pub body: Option<String>,
1040    pub draft: Option<bool>,
1041    pub hide_archive_links: Option<bool>,
1042    pub name: Option<String>,
1043    pub prerelease: Option<bool>,
1044    pub tag_name: String,
1045    pub target_commitish: Option<String>,
1046}
1047
1048/// CreateRepoOption options when creating repository
1049#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1050pub struct CreateRepoOption {
1051    /// Whether the repository should be auto-initialized?
1052    pub auto_init: Option<bool>,
1053    /// DefaultBranch of the repository (used when initializes and in template)
1054    pub default_branch: Option<String>,
1055    /// Description of the repository to create
1056    pub description: Option<String>,
1057    /// Gitignores to use
1058    pub gitignores: Option<String>,
1059    /// Label-Set to use
1060    pub issue_labels: Option<String>,
1061    /// License to use
1062    pub license: Option<String>,
1063    /// Name of the repository to create
1064    pub name: String,
1065    pub object_format_name: Option<ObjectFormatName>,
1066    /// Whether the repository is private
1067    pub private: Option<bool>,
1068    /// Readme of the repository to create
1069    pub readme: Option<String>,
1070    /// Whether the repository is template
1071    pub template: Option<bool>,
1072    /// TrustModel of the repository
1073    pub trust_model: Option<CreateRepoOptionTrustModel>,
1074}
1075
1076/// TrustModel of the repository
1077
1078#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
1079pub enum CreateRepoOptionTrustModel {
1080    #[serde(rename = "default")]
1081    Default,
1082    #[serde(rename = "collaborator")]
1083    Collaborator,
1084    #[serde(rename = "committer")]
1085    Committer,
1086    #[serde(rename = "collaboratorcommitter")]
1087    Collaboratorcommitter,
1088}
1089/// CreateStatusOption holds the information needed to create a new CommitStatus for a Commit
1090#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1091pub struct CreateStatusOption {
1092    pub context: Option<String>,
1093    pub description: Option<String>,
1094    pub state: Option<CommitStatusState>,
1095    #[serde(deserialize_with = "crate::none_if_blank_url")]
1096    pub target_url: Option<url::Url>,
1097}
1098
1099/// CreateTagOption options when creating a tag
1100#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1101pub struct CreateTagOption {
1102    pub message: Option<String>,
1103    pub tag_name: String,
1104    pub target: Option<String>,
1105}
1106
1107/// CreateTagProtectionOption options for creating a tag protection
1108#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1109pub struct CreateTagProtectionOption {
1110    pub name_pattern: Option<String>,
1111    pub whitelist_teams: Option<Vec<String>>,
1112    pub whitelist_usernames: Option<Vec<String>>,
1113}
1114
1115/// CreateTeamOption options for creating a team
1116#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1117pub struct CreateTeamOption {
1118    pub can_create_org_repo: Option<bool>,
1119    pub description: Option<String>,
1120    pub includes_all_repositories: Option<bool>,
1121    pub name: String,
1122    pub permission: Option<CreateTeamOptionPermission>,
1123    pub units: Option<Vec<String>>,
1124    pub units_map: Option<BTreeMap<String, String>>,
1125}
1126
1127#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
1128pub enum CreateTeamOptionPermission {
1129    #[serde(rename = "read")]
1130    Read,
1131    #[serde(rename = "write")]
1132    Write,
1133    #[serde(rename = "admin")]
1134    Admin,
1135}
1136/// CreateUserOption create user options
1137#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1138pub struct CreateUserOption {
1139    #[serde(with = "time::serde::rfc3339::option")]
1140    /// For explicitly setting the user creation timestamp. Useful when users are
1141    ///
1142    /// migrated from other systems. When omitted, the user's creation timestamp
1143    ///
1144    /// will be set to "now".
1145    pub created_at: Option<time::OffsetDateTime>,
1146    pub email: String,
1147    pub full_name: Option<String>,
1148    pub login_name: Option<String>,
1149    pub must_change_password: Option<bool>,
1150    pub password: Option<String>,
1151    pub restricted: Option<bool>,
1152    pub send_notify: Option<bool>,
1153    pub source_id: Option<i64>,
1154    pub username: String,
1155    pub visibility: Option<String>,
1156}
1157
1158/// CreateVariableOption the option when creating variable
1159#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1160pub struct CreateVariableOption {
1161    /// Value of the variable to create
1162    pub value: String,
1163}
1164
1165/// CreateWikiPageOptions form for creating wiki
1166#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1167pub struct CreateWikiPageOptions {
1168    /// content must be base64 encoded
1169    pub content_base64: Option<String>,
1170    /// optional commit message summarizing the change
1171    pub message: Option<String>,
1172    /// page title. leave empty to keep unchanged
1173    pub title: Option<String>,
1174}
1175
1176/// Cron represents a Cron task
1177#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1178pub struct Cron {
1179    pub exec_times: Option<i64>,
1180    pub name: Option<String>,
1181    #[serde(with = "time::serde::rfc3339::option")]
1182    pub next: Option<time::OffsetDateTime>,
1183    #[serde(with = "time::serde::rfc3339::option")]
1184    pub prev: Option<time::OffsetDateTime>,
1185    pub schedule: Option<String>,
1186}
1187
1188impl_from_response!(Cron);
1189
1190#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
1191pub enum DefaultMergeStyle {
1192    #[serde(rename = "merge")]
1193    Merge,
1194    #[serde(rename = "rebase")]
1195    Rebase,
1196    #[serde(rename = "rebase-merge")]
1197    RebaseMerge,
1198    #[serde(rename = "squash")]
1199    Squash,
1200    #[serde(rename = "fast-forward-only")]
1201    FastForwardOnly,
1202}
1203/// DeleteEmailOption options when deleting email addresses
1204#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1205pub struct DeleteEmailOption {
1206    /// email addresses to delete
1207    pub emails: Option<Vec<String>>,
1208}
1209
1210/// DeleteFileOptions options for deleting files (used for other File structs below)
1211///
1212/// 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)
1213#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1214pub struct DeleteFileOptions {
1215    pub author: Option<Identity>,
1216    /// branch (optional) to base this file from. if not given, the default branch is used
1217    pub branch: Option<String>,
1218    pub committer: Option<Identity>,
1219    pub dates: Option<CommitDateOptions>,
1220    /// message (optional) for the commit of this file. if not supplied, a default message will be used
1221    pub message: Option<String>,
1222    /// new_branch (optional) will make a new branch from `branch` before creating the file
1223    pub new_branch: Option<String>,
1224    /// sha is the SHA for the file that already exists
1225    pub sha: String,
1226    /// Add a Signed-off-by trailer by the committer at the end of the commit log message.
1227    pub signoff: Option<bool>,
1228}
1229
1230/// DeleteLabelOption options for deleting a label
1231#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1232pub struct DeleteLabelsOption {
1233    #[serde(with = "time::serde::rfc3339::option")]
1234    pub updated_at: Option<time::OffsetDateTime>,
1235}
1236
1237/// DeployKey a deploy key
1238#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1239pub struct DeployKey {
1240    #[serde(with = "time::serde::rfc3339::option")]
1241    pub created_at: Option<time::OffsetDateTime>,
1242    pub fingerprint: Option<String>,
1243    pub id: Option<i64>,
1244    pub key: Option<String>,
1245    pub key_id: Option<i64>,
1246    pub read_only: Option<bool>,
1247    pub repository: Option<Repository>,
1248    pub title: Option<String>,
1249    #[serde(deserialize_with = "crate::none_if_blank_url")]
1250    pub url: Option<url::Url>,
1251}
1252
1253impl_from_response!(DeployKey);
1254
1255/// DismissPullReviewOptions are options to dismiss a pull review
1256#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1257pub struct DismissPullReviewOptions {
1258    pub message: Option<String>,
1259    pub priors: Option<bool>,
1260}
1261
1262/// DispatchWorkflowOption options when dispatching a workflow
1263#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1264pub struct DispatchWorkflowOption {
1265    /// Input keys and values configured in the workflow file.
1266    pub inputs: Option<BTreeMap<String, String>>,
1267    /// Git reference for the workflow
1268    #[serde(rename = "ref")]
1269    pub r#ref: String,
1270    /// Flag to return the run info
1271    pub return_run_info: Option<bool>,
1272}
1273
1274/// DispatchWorkflowRun represents a workflow run
1275#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1276pub struct DispatchWorkflowRun {
1277    /// the workflow run id
1278    pub id: Option<i64>,
1279    /// the jobs name
1280    pub jobs: Option<Vec<String>>,
1281    /// a unique number for each run of a repository
1282    pub run_number: Option<i64>,
1283}
1284
1285impl_from_response!(DispatchWorkflowRun);
1286
1287/// EditAttachmentOptions options for editing attachments
1288#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1289pub struct EditAttachmentOptions {
1290    #[serde(deserialize_with = "crate::none_if_blank_url")]
1291    /// (Can only be set if existing attachment is of external type)
1292    pub browser_download_url: Option<url::Url>,
1293    pub name: Option<String>,
1294}
1295
1296/// EditBranchProtectionOption options for editing a branch protection
1297#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1298pub struct EditBranchProtectionOption {
1299    pub apply_to_admins: Option<bool>,
1300    pub approvals_whitelist_teams: Option<Vec<String>>,
1301    pub approvals_whitelist_username: Option<Vec<String>>,
1302    pub block_on_official_review_requests: Option<bool>,
1303    pub block_on_outdated_branch: Option<bool>,
1304    pub block_on_rejected_reviews: Option<bool>,
1305    pub dismiss_stale_approvals: Option<bool>,
1306    pub enable_approvals_whitelist: Option<bool>,
1307    pub enable_merge_whitelist: Option<bool>,
1308    pub enable_push: Option<bool>,
1309    pub enable_push_whitelist: Option<bool>,
1310    pub enable_status_check: Option<bool>,
1311    pub ignore_stale_approvals: Option<bool>,
1312    pub merge_whitelist_teams: Option<Vec<String>>,
1313    pub merge_whitelist_usernames: Option<Vec<String>>,
1314    pub protected_file_patterns: Option<String>,
1315    pub push_whitelist_deploy_keys: Option<bool>,
1316    pub push_whitelist_teams: Option<Vec<String>>,
1317    pub push_whitelist_usernames: Option<Vec<String>>,
1318    pub require_signed_commits: Option<bool>,
1319    pub required_approvals: Option<i64>,
1320    pub status_check_contexts: Option<Vec<String>>,
1321    pub unprotected_file_patterns: Option<String>,
1322}
1323
1324/// EditDeadlineOption options for creating a deadline
1325#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1326pub struct EditDeadlineOption {
1327    #[serde(with = "time::serde::rfc3339")]
1328    pub due_date: time::OffsetDateTime,
1329}
1330
1331/// EditGitHookOption options when modifying one Git hook
1332#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1333pub struct EditGitHookOption {
1334    pub content: Option<String>,
1335}
1336
1337/// EditHookOption options when modify one hook
1338#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1339pub struct EditHookOption {
1340    pub active: Option<bool>,
1341    pub authorization_header: Option<String>,
1342    pub branch_filter: Option<String>,
1343    pub config: Option<BTreeMap<String, String>>,
1344    pub events: Option<Vec<String>>,
1345}
1346
1347/// EditIssueCommentOption options for editing a comment
1348#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1349pub struct EditIssueCommentOption {
1350    pub body: String,
1351    #[serde(with = "time::serde::rfc3339::option")]
1352    pub updated_at: Option<time::OffsetDateTime>,
1353}
1354
1355/// EditIssueOption options for editing an issue
1356#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1357pub struct EditIssueOption {
1358    /// deprecated
1359    pub assignee: Option<String>,
1360    pub assignees: Option<Vec<String>>,
1361    pub body: Option<String>,
1362    #[serde(with = "time::serde::rfc3339::option")]
1363    pub due_date: Option<time::OffsetDateTime>,
1364    pub milestone: Option<i64>,
1365    #[serde(rename = "ref")]
1366    pub r#ref: Option<String>,
1367    pub state: Option<String>,
1368    pub title: Option<String>,
1369    pub unset_due_date: Option<bool>,
1370    #[serde(with = "time::serde::rfc3339::option")]
1371    pub updated_at: Option<time::OffsetDateTime>,
1372}
1373
1374/// EditLabelOption options for editing a label
1375#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1376pub struct EditLabelOption {
1377    pub color: Option<String>,
1378    pub description: Option<String>,
1379    pub exclusive: Option<bool>,
1380    pub is_archived: Option<bool>,
1381    pub name: Option<String>,
1382}
1383
1384/// EditMilestoneOption options for editing a milestone
1385#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1386pub struct EditMilestoneOption {
1387    pub description: Option<String>,
1388    #[serde(with = "time::serde::rfc3339::option")]
1389    pub due_on: Option<time::OffsetDateTime>,
1390    pub state: Option<String>,
1391    pub title: Option<String>,
1392}
1393
1394/// EditOrgOption options for editing an organization
1395#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1396pub struct EditOrgOption {
1397    pub description: Option<String>,
1398    pub email: Option<String>,
1399    pub full_name: Option<String>,
1400    pub location: Option<String>,
1401    pub repo_admin_change_team_access: Option<bool>,
1402    /// possible values are `public`, `limited` or `private`
1403    pub visibility: Option<EditOrgOptionVisibility>,
1404    pub website: Option<String>,
1405}
1406
1407/// possible values are `public`, `limited` or `private`
1408
1409#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
1410pub enum EditOrgOptionVisibility {
1411    #[serde(rename = "public")]
1412    Public,
1413    #[serde(rename = "limited")]
1414    Limited,
1415    #[serde(rename = "private")]
1416    Private,
1417}
1418/// EditPullRequestOption options when modify pull request
1419#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1420pub struct EditPullRequestOption {
1421    pub allow_maintainer_edit: Option<bool>,
1422    pub assignee: Option<String>,
1423    pub assignees: Option<Vec<String>>,
1424    pub base: Option<String>,
1425    pub body: Option<String>,
1426    #[serde(with = "time::serde::rfc3339::option")]
1427    pub due_date: Option<time::OffsetDateTime>,
1428    pub labels: Option<Vec<i64>>,
1429    pub milestone: Option<i64>,
1430    pub state: Option<String>,
1431    pub title: Option<String>,
1432    pub unset_due_date: Option<bool>,
1433}
1434
1435/// EditQuotaRuleOptions represents the options for editing a quota rule
1436#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1437pub struct EditQuotaRuleOptions {
1438    /// The limit set by the rule
1439    pub limit: Option<i64>,
1440    /// The subjects affected by the rule
1441    pub subjects: Option<Vec<String>>,
1442}
1443
1444/// EditReactionOption contain the reaction type
1445#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1446pub struct EditReactionOption {
1447    pub content: Option<String>,
1448}
1449
1450/// EditReleaseOption options when editing a release
1451#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1452pub struct EditReleaseOption {
1453    pub body: Option<String>,
1454    pub draft: Option<bool>,
1455    pub hide_archive_links: Option<bool>,
1456    pub name: Option<String>,
1457    pub prerelease: Option<bool>,
1458    pub tag_name: Option<String>,
1459    pub target_commitish: Option<String>,
1460}
1461
1462/// EditRepoOption options when editing a repository's properties
1463#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1464pub struct EditRepoOption {
1465    /// either `true` to allow fast-forward-only merging pull requests, or `false` to prevent fast-forward-only merging.
1466    pub allow_fast_forward_only_merge: Option<bool>,
1467    /// either `true` to allow mark pr as merged manually, or `false` to prevent it.
1468    pub allow_manual_merge: Option<bool>,
1469    /// either `true` to allow merging pull requests with a merge commit, or `false` to prevent merging pull requests with merge commits.
1470    pub allow_merge_commits: Option<bool>,
1471    /// either `true` to allow rebase-merging pull requests, or `false` to prevent rebase-merging.
1472    pub allow_rebase: Option<bool>,
1473    /// either `true` to allow rebase with explicit merge commits (--no-ff), or `false` to prevent rebase with explicit merge commits.
1474    pub allow_rebase_explicit: Option<bool>,
1475    /// either `true` to allow updating pull request branch by rebase, or `false` to prevent it.
1476    pub allow_rebase_update: Option<bool>,
1477    /// either `true` to allow squash-merging pull requests, or `false` to prevent squash-merging.
1478    pub allow_squash_merge: Option<bool>,
1479    /// set to `true` to archive this repository.
1480    pub archived: Option<bool>,
1481    /// either `true` to enable AutodetectManualMerge, or `false` to prevent it. Note: In some special cases, misjudgments can occur.
1482    pub autodetect_manual_merge: Option<bool>,
1483    /// set to `true` to allow edits from maintainers by default
1484    pub default_allow_maintainer_edit: Option<bool>,
1485    /// sets the default branch for this repository.
1486    pub default_branch: Option<String>,
1487    /// set to `true` to delete pr branch after merge by default
1488    pub default_delete_branch_after_merge: Option<bool>,
1489    pub default_merge_style: Option<DefaultMergeStyle>,
1490    /// set to a update style to be used by this repository: "rebase" or "merge"
1491    pub default_update_style: Option<String>,
1492    /// a short description of the repository.
1493    pub description: Option<String>,
1494    /// enable prune - remove obsolete remote-tracking references when mirroring
1495    pub enable_prune: Option<bool>,
1496    pub external_tracker: Option<ExternalTracker>,
1497    pub external_wiki: Option<ExternalWiki>,
1498    /// set the globally editable state of the wiki
1499    pub globally_editable_wiki: Option<bool>,
1500    /// either `true` to enable actions unit, or `false` to disable them.
1501    pub has_actions: Option<bool>,
1502    /// either `true` to enable issues for this repository or `false` to disable them.
1503    pub has_issues: Option<bool>,
1504    /// either `true` to enable packages unit, or `false` to disable them.
1505    pub has_packages: Option<bool>,
1506    /// either `true` to enable project unit, or `false` to disable them.
1507    pub has_projects: Option<bool>,
1508    /// either `true` to allow pull requests, or `false` to prevent pull request.
1509    pub has_pull_requests: Option<bool>,
1510    /// either `true` to enable releases unit, or `false` to disable them.
1511    pub has_releases: Option<bool>,
1512    /// either `true` to enable the wiki for this repository or `false` to disable it.
1513    pub has_wiki: Option<bool>,
1514    /// either `true` to ignore whitespace for conflicts, or `false` to not ignore whitespace.
1515    pub ignore_whitespace_conflicts: Option<bool>,
1516    pub internal_tracker: Option<InternalTracker>,
1517    /// set to a string like `8h30m0s` to set the mirror interval time
1518    pub mirror_interval: Option<String>,
1519    /// name of the repository
1520    pub name: Option<String>,
1521    /// either `true` to make the repository private or `false` to make it public.
1522    ///
1523    /// Note: you will get a 422 error if the organization restricts changing repository visibility to organization
1524    ///
1525    /// owners and a non-owner tries to change the value of private.
1526    pub private: Option<bool>,
1527    /// either `true` to make this repository a template or `false` to make it a normal repository
1528    pub template: Option<bool>,
1529    /// a URL with more information about the repository.
1530    pub website: Option<String>,
1531    /// sets the branch used for this repository's wiki.
1532    pub wiki_branch: Option<String>,
1533}
1534
1535/// EditTagProtectionOption options for editing a tag protection
1536#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1537pub struct EditTagProtectionOption {
1538    pub name_pattern: Option<String>,
1539    pub whitelist_teams: Option<Vec<String>>,
1540    pub whitelist_usernames: Option<Vec<String>>,
1541}
1542
1543/// EditTeamOption options for editing a team
1544#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1545pub struct EditTeamOption {
1546    pub can_create_org_repo: Option<bool>,
1547    pub description: Option<String>,
1548    pub includes_all_repositories: Option<bool>,
1549    pub name: String,
1550    pub permission: Option<EditTeamOptionPermission>,
1551    pub units: Option<Vec<String>>,
1552    pub units_map: Option<BTreeMap<String, String>>,
1553}
1554
1555#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
1556pub enum EditTeamOptionPermission {
1557    #[serde(rename = "read")]
1558    Read,
1559    #[serde(rename = "write")]
1560    Write,
1561    #[serde(rename = "admin")]
1562    Admin,
1563}
1564/// EditUserOption edit user options
1565#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1566pub struct EditUserOption {
1567    pub active: Option<bool>,
1568    pub admin: Option<bool>,
1569    pub allow_create_organization: Option<bool>,
1570    pub allow_git_hook: Option<bool>,
1571    pub allow_import_local: Option<bool>,
1572    pub description: Option<String>,
1573    pub email: Option<String>,
1574    pub full_name: Option<String>,
1575    pub hide_email: Option<bool>,
1576    pub location: Option<String>,
1577    pub login_name: Option<String>,
1578    pub max_repo_creation: Option<i64>,
1579    pub must_change_password: Option<bool>,
1580    pub password: Option<String>,
1581    pub prohibit_login: Option<bool>,
1582    pub pronouns: Option<String>,
1583    pub restricted: Option<bool>,
1584    pub source_id: Option<i64>,
1585    pub visibility: Option<String>,
1586    pub website: Option<String>,
1587}
1588
1589/// Email an email address belonging to a user
1590#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1591pub struct Email {
1592    pub email: Option<String>,
1593    pub primary: Option<bool>,
1594    pub user_id: Option<i64>,
1595    pub username: Option<String>,
1596    pub verified: Option<bool>,
1597}
1598
1599impl_from_response!(Email);
1600
1601/// ExternalTracker represents settings for external tracker
1602#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1603pub struct ExternalTracker {
1604    /// External Issue Tracker URL Format. Use the placeholders {user}, {repo} and {index} for the username, repository name and issue index.
1605    pub external_tracker_format: Option<String>,
1606    /// External Issue Tracker issue regular expression
1607    pub external_tracker_regexp_pattern: Option<String>,
1608    /// External Issue Tracker Number Format, either `numeric`, `alphanumeric`, or `regexp`
1609    pub external_tracker_style: Option<String>,
1610    #[serde(deserialize_with = "crate::none_if_blank_url")]
1611    /// URL of external issue tracker.
1612    pub external_tracker_url: Option<url::Url>,
1613}
1614
1615/// ExternalWiki represents setting for external wiki
1616#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1617pub struct ExternalWiki {
1618    #[serde(deserialize_with = "crate::none_if_blank_url")]
1619    /// URL of external wiki.
1620    pub external_wiki_url: Option<url::Url>,
1621}
1622
1623#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1624pub struct FileCommitResponse {
1625    pub author: Option<CommitUser>,
1626    pub committer: Option<CommitUser>,
1627    #[serde(with = "time::serde::rfc3339::option")]
1628    pub created: Option<time::OffsetDateTime>,
1629    #[serde(deserialize_with = "crate::none_if_blank_url")]
1630    pub html_url: Option<url::Url>,
1631    pub message: Option<String>,
1632    pub parents: Option<Vec<CommitMeta>>,
1633    pub sha: Option<String>,
1634    pub tree: Option<CommitMeta>,
1635    #[serde(deserialize_with = "crate::none_if_blank_url")]
1636    pub url: Option<url::Url>,
1637}
1638
1639/// FileDeleteResponse contains information about a repo's file that was deleted
1640#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1641pub struct FileDeleteResponse {
1642    pub commit: Option<FileCommitResponse>,
1643    pub content: Option<serde_json::Value>,
1644    pub verification: Option<PayloadCommitVerification>,
1645}
1646
1647impl_from_response!(FileDeleteResponse);
1648
1649/// FileLinksResponse contains the links for a repo's file
1650#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1651pub struct FileLinksResponse {
1652    pub git: Option<String>,
1653    pub html: Option<String>,
1654    #[serde(rename = "self")]
1655    pub this: Option<String>,
1656}
1657
1658/// FileResponse contains information about a repo's file
1659#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1660pub struct FileResponse {
1661    pub commit: Option<FileCommitResponse>,
1662    pub content: Option<ContentsResponse>,
1663    pub verification: Option<PayloadCommitVerification>,
1664}
1665
1666impl_from_response!(FileResponse);
1667
1668/// FilesResponse contains information about multiple files from a repo
1669#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1670pub struct FilesResponse {
1671    pub commit: Option<FileCommitResponse>,
1672    pub files: Option<Vec<ContentsResponse>>,
1673    pub verification: Option<PayloadCommitVerification>,
1674}
1675
1676impl_from_response!(FilesResponse);
1677
1678/// ForgeLike activity data type
1679#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1680pub struct ForgeLike {}
1681
1682/// ActivityStream OrderedCollection of activities
1683#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
1684pub struct ForgeOutbox {}
1685
1686impl_from_response!(ForgeOutbox);
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_total_count: Option<i64>,
3633}
3634
3635impl TryFrom<&reqwest::header::HeaderMap> for ChangedFileListHeaders {
3636    type Error = StructureError;
3637
3638    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3639        let x_total_count = map
3640            .get("x-total-count")
3641            .map(|s| -> Result<_, _> {
3642                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3643                s.parse::<i64>()
3644                    .map_err(|_| StructureError::HeaderParseFailed)
3645            })
3646            .transpose()?;
3647        Ok(Self { x_total_count })
3648    }
3649}
3650
3651impl crate::sealed::Sealed for ChangedFileListHeaders {}
3652impl crate::CountHeader for ChangedFileListHeaders {
3653    fn count(&self) -> Option<usize> {
3654        self.x_total_count.map(|x| x as usize)
3655    }
3656}
3657
3658pub struct ChangedFileListWithPaginationHeaders {
3659    pub x_has_more: Option<bool>,
3660    pub x_page: Option<i64>,
3661    pub x_page_count: Option<i64>,
3662    pub x_per_page: Option<i64>,
3663    pub x_total_count: Option<i64>,
3664}
3665
3666impl TryFrom<&reqwest::header::HeaderMap> for ChangedFileListWithPaginationHeaders {
3667    type Error = StructureError;
3668
3669    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3670        let x_has_more = map
3671            .get("x-hasmore")
3672            .map(|s| -> Result<_, _> {
3673                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3674                s.parse::<bool>()
3675                    .map_err(|_| StructureError::HeaderParseFailed)
3676            })
3677            .transpose()?;
3678        let x_page = map
3679            .get("x-page")
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        let x_page_count = map
3687            .get("x-pagecount")
3688            .map(|s| -> Result<_, _> {
3689                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3690                s.parse::<i64>()
3691                    .map_err(|_| StructureError::HeaderParseFailed)
3692            })
3693            .transpose()?;
3694        let x_per_page = map
3695            .get("x-perpage")
3696            .map(|s| -> Result<_, _> {
3697                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3698                s.parse::<i64>()
3699                    .map_err(|_| StructureError::HeaderParseFailed)
3700            })
3701            .transpose()?;
3702        let x_total_count = map
3703            .get("x-total-count")
3704            .map(|s| -> Result<_, _> {
3705                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3706                s.parse::<i64>()
3707                    .map_err(|_| StructureError::HeaderParseFailed)
3708            })
3709            .transpose()?;
3710        Ok(Self {
3711            x_has_more,
3712            x_page,
3713            x_page_count,
3714            x_per_page,
3715            x_total_count,
3716        })
3717    }
3718}
3719
3720impl crate::sealed::Sealed for ChangedFileListWithPaginationHeaders {}
3721impl crate::CountHeader for ChangedFileListWithPaginationHeaders {
3722    fn count(&self) -> Option<usize> {
3723        self.x_total_count.map(|x| x as usize)
3724    }
3725}
3726
3727pub struct CombinedStatusHeaders {
3728    pub x_total_count: Option<i64>,
3729}
3730
3731impl TryFrom<&reqwest::header::HeaderMap> for CombinedStatusHeaders {
3732    type Error = StructureError;
3733
3734    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3735        let x_total_count = map
3736            .get("x-total-count")
3737            .map(|s| -> Result<_, _> {
3738                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3739                s.parse::<i64>()
3740                    .map_err(|_| StructureError::HeaderParseFailed)
3741            })
3742            .transpose()?;
3743        Ok(Self { x_total_count })
3744    }
3745}
3746
3747impl crate::sealed::Sealed for CombinedStatusHeaders {}
3748impl crate::CountHeader for CombinedStatusHeaders {
3749    fn count(&self) -> Option<usize> {
3750        self.x_total_count.map(|x| x as usize)
3751    }
3752}
3753
3754pub struct CommentListHeaders {
3755    pub x_total_count: Option<i64>,
3756}
3757
3758impl TryFrom<&reqwest::header::HeaderMap> for CommentListHeaders {
3759    type Error = StructureError;
3760
3761    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3762        let x_total_count = map
3763            .get("x-total-count")
3764            .map(|s| -> Result<_, _> {
3765                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3766                s.parse::<i64>()
3767                    .map_err(|_| StructureError::HeaderParseFailed)
3768            })
3769            .transpose()?;
3770        Ok(Self { x_total_count })
3771    }
3772}
3773
3774impl crate::sealed::Sealed for CommentListHeaders {}
3775impl crate::CountHeader for CommentListHeaders {
3776    fn count(&self) -> Option<usize> {
3777        self.x_total_count.map(|x| x as usize)
3778    }
3779}
3780
3781pub struct CommitListHeaders {
3782    pub x_has_more: Option<bool>,
3783    pub x_total_count: Option<i64>,
3784}
3785
3786impl TryFrom<&reqwest::header::HeaderMap> for CommitListHeaders {
3787    type Error = StructureError;
3788
3789    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3790        let x_has_more = map
3791            .get("x-hasmore")
3792            .map(|s| -> Result<_, _> {
3793                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3794                s.parse::<bool>()
3795                    .map_err(|_| StructureError::HeaderParseFailed)
3796            })
3797            .transpose()?;
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 {
3807            x_has_more,
3808            x_total_count,
3809        })
3810    }
3811}
3812
3813impl crate::sealed::Sealed for CommitListHeaders {}
3814impl crate::CountHeader for CommitListHeaders {
3815    fn count(&self) -> Option<usize> {
3816        self.x_total_count.map(|x| x as usize)
3817    }
3818}
3819
3820pub struct CommitStatusListHeaders {
3821    pub x_total_count: Option<i64>,
3822}
3823
3824impl TryFrom<&reqwest::header::HeaderMap> for CommitStatusListHeaders {
3825    type Error = StructureError;
3826
3827    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3828        let x_total_count = map
3829            .get("x-total-count")
3830            .map(|s| -> Result<_, _> {
3831                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3832                s.parse::<i64>()
3833                    .map_err(|_| StructureError::HeaderParseFailed)
3834            })
3835            .transpose()?;
3836        Ok(Self { x_total_count })
3837    }
3838}
3839
3840impl crate::sealed::Sealed for CommitStatusListHeaders {}
3841impl crate::CountHeader for CommitStatusListHeaders {
3842    fn count(&self) -> Option<usize> {
3843        self.x_total_count.map(|x| x as usize)
3844    }
3845}
3846
3847pub struct CronListHeaders {
3848    pub x_total_count: Option<i64>,
3849}
3850
3851impl TryFrom<&reqwest::header::HeaderMap> for CronListHeaders {
3852    type Error = StructureError;
3853
3854    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3855        let x_total_count = map
3856            .get("x-total-count")
3857            .map(|s| -> Result<_, _> {
3858                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3859                s.parse::<i64>()
3860                    .map_err(|_| StructureError::HeaderParseFailed)
3861            })
3862            .transpose()?;
3863        Ok(Self { x_total_count })
3864    }
3865}
3866
3867impl crate::sealed::Sealed for CronListHeaders {}
3868impl crate::CountHeader for CronListHeaders {
3869    fn count(&self) -> Option<usize> {
3870        self.x_total_count.map(|x| x as usize)
3871    }
3872}
3873
3874pub struct DeployKeyListHeaders {
3875    pub x_total_count: Option<i64>,
3876}
3877
3878impl TryFrom<&reqwest::header::HeaderMap> for DeployKeyListHeaders {
3879    type Error = StructureError;
3880
3881    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3882        let x_total_count = map
3883            .get("x-total-count")
3884            .map(|s| -> Result<_, _> {
3885                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3886                s.parse::<i64>()
3887                    .map_err(|_| StructureError::HeaderParseFailed)
3888            })
3889            .transpose()?;
3890        Ok(Self { x_total_count })
3891    }
3892}
3893
3894impl crate::sealed::Sealed for DeployKeyListHeaders {}
3895impl crate::CountHeader for DeployKeyListHeaders {
3896    fn count(&self) -> Option<usize> {
3897        self.x_total_count.map(|x| x as usize)
3898    }
3899}
3900
3901pub struct GpgKeyListHeaders {
3902    pub x_total_count: Option<i64>,
3903}
3904
3905impl TryFrom<&reqwest::header::HeaderMap> for GpgKeyListHeaders {
3906    type Error = StructureError;
3907
3908    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3909        let x_total_count = map
3910            .get("x-total-count")
3911            .map(|s| -> Result<_, _> {
3912                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3913                s.parse::<i64>()
3914                    .map_err(|_| StructureError::HeaderParseFailed)
3915            })
3916            .transpose()?;
3917        Ok(Self { x_total_count })
3918    }
3919}
3920
3921impl crate::sealed::Sealed for GpgKeyListHeaders {}
3922impl crate::CountHeader for GpgKeyListHeaders {
3923    fn count(&self) -> Option<usize> {
3924        self.x_total_count.map(|x| x as usize)
3925    }
3926}
3927
3928pub struct HookListHeaders {
3929    pub x_total_count: Option<i64>,
3930}
3931
3932impl TryFrom<&reqwest::header::HeaderMap> for HookListHeaders {
3933    type Error = StructureError;
3934
3935    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3936        let x_total_count = map
3937            .get("x-total-count")
3938            .map(|s| -> Result<_, _> {
3939                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3940                s.parse::<i64>()
3941                    .map_err(|_| StructureError::HeaderParseFailed)
3942            })
3943            .transpose()?;
3944        Ok(Self { x_total_count })
3945    }
3946}
3947
3948impl crate::sealed::Sealed for HookListHeaders {}
3949impl crate::CountHeader for HookListHeaders {
3950    fn count(&self) -> Option<usize> {
3951        self.x_total_count.map(|x| x as usize)
3952    }
3953}
3954
3955pub struct IssueListHeaders {
3956    pub x_total_count: Option<i64>,
3957}
3958
3959impl TryFrom<&reqwest::header::HeaderMap> for IssueListHeaders {
3960    type Error = StructureError;
3961
3962    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3963        let x_total_count = map
3964            .get("x-total-count")
3965            .map(|s| -> Result<_, _> {
3966                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3967                s.parse::<i64>()
3968                    .map_err(|_| StructureError::HeaderParseFailed)
3969            })
3970            .transpose()?;
3971        Ok(Self { x_total_count })
3972    }
3973}
3974
3975impl crate::sealed::Sealed for IssueListHeaders {}
3976impl crate::CountHeader for IssueListHeaders {
3977    fn count(&self) -> Option<usize> {
3978        self.x_total_count.map(|x| x as usize)
3979    }
3980}
3981
3982pub struct LabelListHeaders {
3983    pub x_total_count: Option<i64>,
3984}
3985
3986impl TryFrom<&reqwest::header::HeaderMap> for LabelListHeaders {
3987    type Error = StructureError;
3988
3989    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
3990        let x_total_count = map
3991            .get("x-total-count")
3992            .map(|s| -> Result<_, _> {
3993                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
3994                s.parse::<i64>()
3995                    .map_err(|_| StructureError::HeaderParseFailed)
3996            })
3997            .transpose()?;
3998        Ok(Self { x_total_count })
3999    }
4000}
4001
4002impl crate::sealed::Sealed for LabelListHeaders {}
4003impl crate::CountHeader for LabelListHeaders {
4004    fn count(&self) -> Option<usize> {
4005        self.x_total_count.map(|x| x as usize)
4006    }
4007}
4008
4009pub struct MilestoneListHeaders {
4010    pub x_total_count: Option<i64>,
4011}
4012
4013impl TryFrom<&reqwest::header::HeaderMap> for MilestoneListHeaders {
4014    type Error = StructureError;
4015
4016    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4017        let x_total_count = map
4018            .get("x-total-count")
4019            .map(|s| -> Result<_, _> {
4020                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4021                s.parse::<i64>()
4022                    .map_err(|_| StructureError::HeaderParseFailed)
4023            })
4024            .transpose()?;
4025        Ok(Self { x_total_count })
4026    }
4027}
4028
4029impl crate::sealed::Sealed for MilestoneListHeaders {}
4030impl crate::CountHeader for MilestoneListHeaders {
4031    fn count(&self) -> Option<usize> {
4032        self.x_total_count.map(|x| x as usize)
4033    }
4034}
4035
4036pub struct NotificationThreadListHeaders {
4037    pub x_total_count: Option<i64>,
4038}
4039
4040impl TryFrom<&reqwest::header::HeaderMap> for NotificationThreadListHeaders {
4041    type Error = StructureError;
4042
4043    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4044        let x_total_count = map
4045            .get("x-total-count")
4046            .map(|s| -> Result<_, _> {
4047                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4048                s.parse::<i64>()
4049                    .map_err(|_| StructureError::HeaderParseFailed)
4050            })
4051            .transpose()?;
4052        Ok(Self { x_total_count })
4053    }
4054}
4055
4056impl crate::sealed::Sealed for NotificationThreadListHeaders {}
4057impl crate::CountHeader for NotificationThreadListHeaders {
4058    fn count(&self) -> Option<usize> {
4059        self.x_total_count.map(|x| x as usize)
4060    }
4061}
4062
4063pub struct OAuth2ApplicationListHeaders {
4064    pub x_total_count: Option<i64>,
4065}
4066
4067impl TryFrom<&reqwest::header::HeaderMap> for OAuth2ApplicationListHeaders {
4068    type Error = StructureError;
4069
4070    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4071        let x_total_count = map
4072            .get("x-total-count")
4073            .map(|s| -> Result<_, _> {
4074                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4075                s.parse::<i64>()
4076                    .map_err(|_| StructureError::HeaderParseFailed)
4077            })
4078            .transpose()?;
4079        Ok(Self { x_total_count })
4080    }
4081}
4082
4083impl crate::sealed::Sealed for OAuth2ApplicationListHeaders {}
4084impl crate::CountHeader for OAuth2ApplicationListHeaders {
4085    fn count(&self) -> Option<usize> {
4086        self.x_total_count.map(|x| x as usize)
4087    }
4088}
4089
4090pub struct OrganizationListHeaders {
4091    pub x_total_count: Option<i64>,
4092}
4093
4094impl TryFrom<&reqwest::header::HeaderMap> for OrganizationListHeaders {
4095    type Error = StructureError;
4096
4097    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4098        let x_total_count = map
4099            .get("x-total-count")
4100            .map(|s| -> Result<_, _> {
4101                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4102                s.parse::<i64>()
4103                    .map_err(|_| StructureError::HeaderParseFailed)
4104            })
4105            .transpose()?;
4106        Ok(Self { x_total_count })
4107    }
4108}
4109
4110impl crate::sealed::Sealed for OrganizationListHeaders {}
4111impl crate::CountHeader for OrganizationListHeaders {
4112    fn count(&self) -> Option<usize> {
4113        self.x_total_count.map(|x| x as usize)
4114    }
4115}
4116
4117pub struct PackageListHeaders {
4118    pub x_total_count: Option<i64>,
4119}
4120
4121impl TryFrom<&reqwest::header::HeaderMap> for PackageListHeaders {
4122    type Error = StructureError;
4123
4124    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4125        let x_total_count = map
4126            .get("x-total-count")
4127            .map(|s| -> Result<_, _> {
4128                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4129                s.parse::<i64>()
4130                    .map_err(|_| StructureError::HeaderParseFailed)
4131            })
4132            .transpose()?;
4133        Ok(Self { x_total_count })
4134    }
4135}
4136
4137impl crate::sealed::Sealed for PackageListHeaders {}
4138impl crate::CountHeader for PackageListHeaders {
4139    fn count(&self) -> Option<usize> {
4140        self.x_total_count.map(|x| x as usize)
4141    }
4142}
4143
4144pub struct PublicKeyListHeaders {
4145    pub x_total_count: Option<i64>,
4146}
4147
4148impl TryFrom<&reqwest::header::HeaderMap> for PublicKeyListHeaders {
4149    type Error = StructureError;
4150
4151    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4152        let x_total_count = map
4153            .get("x-total-count")
4154            .map(|s| -> Result<_, _> {
4155                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4156                s.parse::<i64>()
4157                    .map_err(|_| StructureError::HeaderParseFailed)
4158            })
4159            .transpose()?;
4160        Ok(Self { x_total_count })
4161    }
4162}
4163
4164impl crate::sealed::Sealed for PublicKeyListHeaders {}
4165impl crate::CountHeader for PublicKeyListHeaders {
4166    fn count(&self) -> Option<usize> {
4167        self.x_total_count.map(|x| x as usize)
4168    }
4169}
4170
4171pub struct PullRequestListHeaders {
4172    pub x_total_count: Option<i64>,
4173}
4174
4175impl TryFrom<&reqwest::header::HeaderMap> for PullRequestListHeaders {
4176    type Error = StructureError;
4177
4178    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4179        let x_total_count = map
4180            .get("x-total-count")
4181            .map(|s| -> Result<_, _> {
4182                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4183                s.parse::<i64>()
4184                    .map_err(|_| StructureError::HeaderParseFailed)
4185            })
4186            .transpose()?;
4187        Ok(Self { x_total_count })
4188    }
4189}
4190
4191impl crate::sealed::Sealed for PullRequestListHeaders {}
4192impl crate::CountHeader for PullRequestListHeaders {
4193    fn count(&self) -> Option<usize> {
4194        self.x_total_count.map(|x| x as usize)
4195    }
4196}
4197
4198pub struct PullReviewListHeaders {
4199    pub x_total_count: Option<i64>,
4200}
4201
4202impl TryFrom<&reqwest::header::HeaderMap> for PullReviewListHeaders {
4203    type Error = StructureError;
4204
4205    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4206        let x_total_count = map
4207            .get("x-total-count")
4208            .map(|s| -> Result<_, _> {
4209                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4210                s.parse::<i64>()
4211                    .map_err(|_| StructureError::HeaderParseFailed)
4212            })
4213            .transpose()?;
4214        Ok(Self { x_total_count })
4215    }
4216}
4217
4218impl crate::sealed::Sealed for PullReviewListHeaders {}
4219impl crate::CountHeader for PullReviewListHeaders {
4220    fn count(&self) -> Option<usize> {
4221        self.x_total_count.map(|x| x as usize)
4222    }
4223}
4224
4225pub struct PushMirrorListHeaders {
4226    pub x_total_count: Option<i64>,
4227}
4228
4229impl TryFrom<&reqwest::header::HeaderMap> for PushMirrorListHeaders {
4230    type Error = StructureError;
4231
4232    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4233        let x_total_count = map
4234            .get("x-total-count")
4235            .map(|s| -> Result<_, _> {
4236                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4237                s.parse::<i64>()
4238                    .map_err(|_| StructureError::HeaderParseFailed)
4239            })
4240            .transpose()?;
4241        Ok(Self { x_total_count })
4242    }
4243}
4244
4245impl crate::sealed::Sealed for PushMirrorListHeaders {}
4246impl crate::CountHeader for PushMirrorListHeaders {
4247    fn count(&self) -> Option<usize> {
4248        self.x_total_count.map(|x| x as usize)
4249    }
4250}
4251
4252pub struct QuotaUsedArtifactListHeaders {
4253    pub x_total_count: Option<i64>,
4254}
4255
4256impl TryFrom<&reqwest::header::HeaderMap> for QuotaUsedArtifactListHeaders {
4257    type Error = StructureError;
4258
4259    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4260        let x_total_count = map
4261            .get("x-total-count")
4262            .map(|s| -> Result<_, _> {
4263                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4264                s.parse::<i64>()
4265                    .map_err(|_| StructureError::HeaderParseFailed)
4266            })
4267            .transpose()?;
4268        Ok(Self { x_total_count })
4269    }
4270}
4271
4272impl crate::sealed::Sealed for QuotaUsedArtifactListHeaders {}
4273impl crate::CountHeader for QuotaUsedArtifactListHeaders {
4274    fn count(&self) -> Option<usize> {
4275        self.x_total_count.map(|x| x as usize)
4276    }
4277}
4278
4279pub struct QuotaUsedAttachmentListHeaders {
4280    pub x_total_count: Option<i64>,
4281}
4282
4283impl TryFrom<&reqwest::header::HeaderMap> for QuotaUsedAttachmentListHeaders {
4284    type Error = StructureError;
4285
4286    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4287        let x_total_count = map
4288            .get("x-total-count")
4289            .map(|s| -> Result<_, _> {
4290                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4291                s.parse::<i64>()
4292                    .map_err(|_| StructureError::HeaderParseFailed)
4293            })
4294            .transpose()?;
4295        Ok(Self { x_total_count })
4296    }
4297}
4298
4299impl crate::sealed::Sealed for QuotaUsedAttachmentListHeaders {}
4300impl crate::CountHeader for QuotaUsedAttachmentListHeaders {
4301    fn count(&self) -> Option<usize> {
4302        self.x_total_count.map(|x| x as usize)
4303    }
4304}
4305
4306pub struct QuotaUsedPackageListHeaders {
4307    pub x_total_count: Option<i64>,
4308}
4309
4310impl TryFrom<&reqwest::header::HeaderMap> for QuotaUsedPackageListHeaders {
4311    type Error = StructureError;
4312
4313    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4314        let x_total_count = map
4315            .get("x-total-count")
4316            .map(|s| -> Result<_, _> {
4317                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4318                s.parse::<i64>()
4319                    .map_err(|_| StructureError::HeaderParseFailed)
4320            })
4321            .transpose()?;
4322        Ok(Self { x_total_count })
4323    }
4324}
4325
4326impl crate::sealed::Sealed for QuotaUsedPackageListHeaders {}
4327impl crate::CountHeader for QuotaUsedPackageListHeaders {
4328    fn count(&self) -> Option<usize> {
4329        self.x_total_count.map(|x| x as usize)
4330    }
4331}
4332
4333pub struct ReactionListHeaders {
4334    pub x_total_count: Option<i64>,
4335}
4336
4337impl TryFrom<&reqwest::header::HeaderMap> for ReactionListHeaders {
4338    type Error = StructureError;
4339
4340    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4341        let x_total_count = map
4342            .get("x-total-count")
4343            .map(|s| -> Result<_, _> {
4344                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4345                s.parse::<i64>()
4346                    .map_err(|_| StructureError::HeaderParseFailed)
4347            })
4348            .transpose()?;
4349        Ok(Self { x_total_count })
4350    }
4351}
4352
4353impl crate::sealed::Sealed for ReactionListHeaders {}
4354impl crate::CountHeader for ReactionListHeaders {
4355    fn count(&self) -> Option<usize> {
4356        self.x_total_count.map(|x| x as usize)
4357    }
4358}
4359
4360pub struct ReleaseListHeaders {
4361    pub x_total_count: Option<i64>,
4362}
4363
4364impl TryFrom<&reqwest::header::HeaderMap> for ReleaseListHeaders {
4365    type Error = StructureError;
4366
4367    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4368        let x_total_count = map
4369            .get("x-total-count")
4370            .map(|s| -> Result<_, _> {
4371                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4372                s.parse::<i64>()
4373                    .map_err(|_| StructureError::HeaderParseFailed)
4374            })
4375            .transpose()?;
4376        Ok(Self { x_total_count })
4377    }
4378}
4379
4380impl crate::sealed::Sealed for ReleaseListHeaders {}
4381impl crate::CountHeader for ReleaseListHeaders {
4382    fn count(&self) -> Option<usize> {
4383        self.x_total_count.map(|x| x as usize)
4384    }
4385}
4386
4387pub struct RepositoryListHeaders {
4388    pub x_total_count: Option<i64>,
4389}
4390
4391impl TryFrom<&reqwest::header::HeaderMap> for RepositoryListHeaders {
4392    type Error = StructureError;
4393
4394    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4395        let x_total_count = map
4396            .get("x-total-count")
4397            .map(|s| -> Result<_, _> {
4398                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4399                s.parse::<i64>()
4400                    .map_err(|_| StructureError::HeaderParseFailed)
4401            })
4402            .transpose()?;
4403        Ok(Self { x_total_count })
4404    }
4405}
4406
4407impl crate::sealed::Sealed for RepositoryListHeaders {}
4408impl crate::CountHeader for RepositoryListHeaders {
4409    fn count(&self) -> Option<usize> {
4410        self.x_total_count.map(|x| x as usize)
4411    }
4412}
4413
4414pub struct SecretListHeaders {
4415    pub x_total_count: Option<i64>,
4416}
4417
4418impl TryFrom<&reqwest::header::HeaderMap> for SecretListHeaders {
4419    type Error = StructureError;
4420
4421    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4422        let x_total_count = map
4423            .get("x-total-count")
4424            .map(|s| -> Result<_, _> {
4425                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4426                s.parse::<i64>()
4427                    .map_err(|_| StructureError::HeaderParseFailed)
4428            })
4429            .transpose()?;
4430        Ok(Self { x_total_count })
4431    }
4432}
4433
4434impl crate::sealed::Sealed for SecretListHeaders {}
4435impl crate::CountHeader for SecretListHeaders {
4436    fn count(&self) -> Option<usize> {
4437        self.x_total_count.map(|x| x as usize)
4438    }
4439}
4440
4441pub struct StopWatchListHeaders {
4442    pub x_total_count: Option<i64>,
4443}
4444
4445impl TryFrom<&reqwest::header::HeaderMap> for StopWatchListHeaders {
4446    type Error = StructureError;
4447
4448    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4449        let x_total_count = map
4450            .get("x-total-count")
4451            .map(|s| -> Result<_, _> {
4452                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4453                s.parse::<i64>()
4454                    .map_err(|_| StructureError::HeaderParseFailed)
4455            })
4456            .transpose()?;
4457        Ok(Self { x_total_count })
4458    }
4459}
4460
4461impl crate::sealed::Sealed for StopWatchListHeaders {}
4462impl crate::CountHeader for StopWatchListHeaders {
4463    fn count(&self) -> Option<usize> {
4464        self.x_total_count.map(|x| x as usize)
4465    }
4466}
4467
4468pub struct TagListHeaders {
4469    pub x_total_count: Option<i64>,
4470}
4471
4472impl TryFrom<&reqwest::header::HeaderMap> for TagListHeaders {
4473    type Error = StructureError;
4474
4475    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4476        let x_total_count = map
4477            .get("x-total-count")
4478            .map(|s| -> Result<_, _> {
4479                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4480                s.parse::<i64>()
4481                    .map_err(|_| StructureError::HeaderParseFailed)
4482            })
4483            .transpose()?;
4484        Ok(Self { x_total_count })
4485    }
4486}
4487
4488impl crate::sealed::Sealed for TagListHeaders {}
4489impl crate::CountHeader for TagListHeaders {
4490    fn count(&self) -> Option<usize> {
4491        self.x_total_count.map(|x| x as usize)
4492    }
4493}
4494
4495pub struct TeamListHeaders {
4496    pub x_total_count: Option<i64>,
4497}
4498
4499impl TryFrom<&reqwest::header::HeaderMap> for TeamListHeaders {
4500    type Error = StructureError;
4501
4502    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4503        let x_total_count = map
4504            .get("x-total-count")
4505            .map(|s| -> Result<_, _> {
4506                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4507                s.parse::<i64>()
4508                    .map_err(|_| StructureError::HeaderParseFailed)
4509            })
4510            .transpose()?;
4511        Ok(Self { x_total_count })
4512    }
4513}
4514
4515impl crate::sealed::Sealed for TeamListHeaders {}
4516impl crate::CountHeader for TeamListHeaders {
4517    fn count(&self) -> Option<usize> {
4518        self.x_total_count.map(|x| x as usize)
4519    }
4520}
4521
4522pub struct TimelineListHeaders {
4523    pub x_total_count: Option<i64>,
4524}
4525
4526impl TryFrom<&reqwest::header::HeaderMap> for TimelineListHeaders {
4527    type Error = StructureError;
4528
4529    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4530        let x_total_count = map
4531            .get("x-total-count")
4532            .map(|s| -> Result<_, _> {
4533                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4534                s.parse::<i64>()
4535                    .map_err(|_| StructureError::HeaderParseFailed)
4536            })
4537            .transpose()?;
4538        Ok(Self { x_total_count })
4539    }
4540}
4541
4542impl crate::sealed::Sealed for TimelineListHeaders {}
4543impl crate::CountHeader for TimelineListHeaders {
4544    fn count(&self) -> Option<usize> {
4545        self.x_total_count.map(|x| x as usize)
4546    }
4547}
4548
4549pub struct TrackedTimeListHeaders {
4550    pub x_total_count: Option<i64>,
4551}
4552
4553impl TryFrom<&reqwest::header::HeaderMap> for TrackedTimeListHeaders {
4554    type Error = StructureError;
4555
4556    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4557        let x_total_count = map
4558            .get("x-total-count")
4559            .map(|s| -> Result<_, _> {
4560                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4561                s.parse::<i64>()
4562                    .map_err(|_| StructureError::HeaderParseFailed)
4563            })
4564            .transpose()?;
4565        Ok(Self { x_total_count })
4566    }
4567}
4568
4569impl crate::sealed::Sealed for TrackedTimeListHeaders {}
4570impl crate::CountHeader for TrackedTimeListHeaders {
4571    fn count(&self) -> Option<usize> {
4572        self.x_total_count.map(|x| x as usize)
4573    }
4574}
4575
4576pub struct UserListHeaders {
4577    pub x_total_count: Option<i64>,
4578}
4579
4580impl TryFrom<&reqwest::header::HeaderMap> for UserListHeaders {
4581    type Error = StructureError;
4582
4583    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4584        let x_total_count = map
4585            .get("x-total-count")
4586            .map(|s| -> Result<_, _> {
4587                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4588                s.parse::<i64>()
4589                    .map_err(|_| StructureError::HeaderParseFailed)
4590            })
4591            .transpose()?;
4592        Ok(Self { x_total_count })
4593    }
4594}
4595
4596impl crate::sealed::Sealed for UserListHeaders {}
4597impl crate::CountHeader for UserListHeaders {
4598    fn count(&self) -> Option<usize> {
4599        self.x_total_count.map(|x| x as usize)
4600    }
4601}
4602
4603pub struct VariableListHeaders {
4604    pub x_total_count: Option<i64>,
4605}
4606
4607impl TryFrom<&reqwest::header::HeaderMap> for VariableListHeaders {
4608    type Error = StructureError;
4609
4610    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4611        let x_total_count = map
4612            .get("x-total-count")
4613            .map(|s| -> Result<_, _> {
4614                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4615                s.parse::<i64>()
4616                    .map_err(|_| StructureError::HeaderParseFailed)
4617            })
4618            .transpose()?;
4619        Ok(Self { x_total_count })
4620    }
4621}
4622
4623impl crate::sealed::Sealed for VariableListHeaders {}
4624impl crate::CountHeader for VariableListHeaders {
4625    fn count(&self) -> Option<usize> {
4626        self.x_total_count.map(|x| x as usize)
4627    }
4628}
4629
4630pub struct WikiCommitListHeaders {
4631    pub x_total_count: Option<i64>,
4632}
4633
4634impl TryFrom<&reqwest::header::HeaderMap> for WikiCommitListHeaders {
4635    type Error = StructureError;
4636
4637    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4638        let x_total_count = map
4639            .get("x-total-count")
4640            .map(|s| -> Result<_, _> {
4641                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4642                s.parse::<i64>()
4643                    .map_err(|_| StructureError::HeaderParseFailed)
4644            })
4645            .transpose()?;
4646        Ok(Self { x_total_count })
4647    }
4648}
4649
4650impl crate::sealed::Sealed for WikiCommitListHeaders {}
4651impl crate::CountHeader for WikiCommitListHeaders {
4652    fn count(&self) -> Option<usize> {
4653        self.x_total_count.map(|x| x as usize)
4654    }
4655}
4656
4657pub struct WikiPageListHeaders {
4658    pub x_total_count: Option<i64>,
4659}
4660
4661impl TryFrom<&reqwest::header::HeaderMap> for WikiPageListHeaders {
4662    type Error = StructureError;
4663
4664    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4665        let x_total_count = map
4666            .get("x-total-count")
4667            .map(|s| -> Result<_, _> {
4668                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4669                s.parse::<i64>()
4670                    .map_err(|_| StructureError::HeaderParseFailed)
4671            })
4672            .transpose()?;
4673        Ok(Self { x_total_count })
4674    }
4675}
4676
4677impl crate::sealed::Sealed for WikiPageListHeaders {}
4678impl crate::CountHeader for WikiPageListHeaders {
4679    fn count(&self) -> Option<usize> {
4680        self.x_total_count.map(|x| x as usize)
4681    }
4682}
4683
4684pub struct QuotaExceededHeaders {
4685    pub message: Option<String>,
4686    pub user_id: Option<i64>,
4687    pub username: Option<String>,
4688}
4689
4690impl TryFrom<&reqwest::header::HeaderMap> for QuotaExceededHeaders {
4691    type Error = StructureError;
4692
4693    fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
4694        let message = map
4695            .get("message")
4696            .map(|s| -> Result<_, _> {
4697                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4698                Ok::<_, StructureError>(s.to_string())
4699            })
4700            .transpose()?;
4701        let user_id = map
4702            .get("user_id")
4703            .map(|s| -> Result<_, _> {
4704                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4705                s.parse::<i64>()
4706                    .map_err(|_| StructureError::HeaderParseFailed)
4707            })
4708            .transpose()?;
4709        let username = map
4710            .get("username")
4711            .map(|s| -> Result<_, _> {
4712                let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
4713                Ok::<_, StructureError>(s.to_string())
4714            })
4715            .transpose()?;
4716        Ok(Self {
4717            message,
4718            user_id,
4719            username,
4720        })
4721    }
4722}
4723
4724#[derive(Debug, Clone, PartialEq, Default)]
4725pub struct AdminSearchEmailsQuery {
4726    /// keyword
4727    pub q: Option<String>,
4728}
4729
4730impl AdminSearchEmailsQuery {
4731    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
4732        let mut list = Vec::new();
4733        if let Some(q) = self.q {
4734            list.push(("q", q));
4735        }
4736
4737        list
4738    }
4739}
4740
4741#[derive(Debug, Clone, PartialEq, Default)]
4742pub struct AdminSearchRunJobsQuery {
4743    /// a comma separated list of run job labels to search for
4744    pub labels: Option<String>,
4745}
4746
4747impl AdminSearchRunJobsQuery {
4748    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
4749        let mut list = Vec::new();
4750        if let Some(labels) = self.labels {
4751            list.push(("labels", labels));
4752        }
4753
4754        list
4755    }
4756}
4757
4758#[derive(Debug, Clone, PartialEq, Default)]
4759pub struct AdminUnadoptedListQuery {
4760    /// pattern of repositories to search for
4761    pub pattern: Option<String>,
4762}
4763
4764impl AdminUnadoptedListQuery {
4765    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
4766        let mut list = Vec::new();
4767        if let Some(pattern) = self.pattern {
4768            list.push(("pattern", pattern));
4769        }
4770
4771        list
4772    }
4773}
4774
4775#[derive(Debug, Clone, PartialEq, Default)]
4776pub struct AdminSearchUsersQuery {
4777    /// ID of the user's login source to search for
4778    pub source_id: Option<i64>,
4779    /// user's login name to search for
4780    pub login_name: Option<String>,
4781    /// sort order of results
4782    pub sort: Option<AdminSearchUsersQuerySort>,
4783}
4784
4785impl AdminSearchUsersQuery {
4786    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
4787        let mut list = Vec::new();
4788        if let Some(source_id) = self.source_id {
4789            list.push(("source_id", source_id.to_string()));
4790        }
4791        if let Some(login_name) = self.login_name {
4792            list.push(("login_name", login_name));
4793        }
4794        if let Some(sort) = self.sort {
4795            list.push(("sort", sort.as_str().to_string()));
4796        }
4797
4798        list
4799    }
4800}
4801
4802#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
4803pub enum AdminSearchUsersQuerySort {
4804    #[serde(rename = "oldest")]
4805    Oldest,
4806    #[serde(rename = "newest")]
4807    Newest,
4808    #[serde(rename = "alphabetically")]
4809    Alphabetically,
4810    #[serde(rename = "reversealphabetically")]
4811    Reversealphabetically,
4812    #[serde(rename = "recentupdate")]
4813    Recentupdate,
4814    #[serde(rename = "leastupdate")]
4815    Leastupdate,
4816}
4817
4818impl AdminSearchUsersQuerySort {
4819    fn as_str(&self) -> &'static str {
4820        match self {
4821            AdminSearchUsersQuerySort::Oldest => "oldest",
4822            AdminSearchUsersQuerySort::Newest => "newest",
4823            AdminSearchUsersQuerySort::Alphabetically => "alphabetically",
4824            AdminSearchUsersQuerySort::Reversealphabetically => "reversealphabetically",
4825            AdminSearchUsersQuerySort::Recentupdate => "recentupdate",
4826            AdminSearchUsersQuerySort::Leastupdate => "leastupdate",
4827        }
4828    }
4829}
4830#[derive(Debug, Clone, PartialEq, Default)]
4831pub struct AdminDeleteUserQuery {
4832    /// purge the user from the system completely
4833    pub purge: Option<bool>,
4834}
4835
4836impl AdminDeleteUserQuery {
4837    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
4838        let mut list = Vec::new();
4839        if let Some(purge) = self.purge {
4840            list.push(("purge", purge.to_string()));
4841        }
4842
4843        list
4844    }
4845}
4846
4847#[derive(Debug, Clone, PartialEq, Default)]
4848pub struct NotifyGetListQuery {
4849    /// If true, show notifications marked as read. Default value is false
4850    pub all: Option<bool>,
4851    /// Show notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread & pinned.
4852    pub status_types: Option<Vec<String>>,
4853    /// filter notifications by subject type
4854    pub subject_type: Option<Vec<NotifyGetListQuerySubjectType>>,
4855    /// Only show notifications updated after the given time. This is a timestamp in RFC 3339 format
4856    pub since: Option<time::OffsetDateTime>,
4857    /// Only show notifications updated before the given time. This is a timestamp in RFC 3339 format
4858    pub before: Option<time::OffsetDateTime>,
4859}
4860
4861impl NotifyGetListQuery {
4862    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
4863        let mut list = Vec::new();
4864        if let Some(all) = self.all {
4865            list.push(("all", all.to_string()));
4866        }
4867        if let Some(status_types) = self.status_types {
4868            if !status_types.is_empty() {
4869                for item in status_types {
4870                    list.push(("status-types", item.to_string()));
4871                }
4872            }
4873        }
4874        if let Some(subject_type) = self.subject_type {
4875            if !subject_type.is_empty() {
4876                for item in subject_type {
4877                    list.push(("subject-type", item.as_str().to_string()));
4878                }
4879            }
4880        }
4881        if let Some(since) = self.since {
4882            list.push((
4883                "since",
4884                since
4885                    .format(&time::format_description::well_known::Rfc3339)
4886                    .unwrap(),
4887            ));
4888        }
4889        if let Some(before) = self.before {
4890            list.push((
4891                "before",
4892                before
4893                    .format(&time::format_description::well_known::Rfc3339)
4894                    .unwrap(),
4895            ));
4896        }
4897
4898        list
4899    }
4900}
4901
4902#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
4903pub enum NotifyGetListQuerySubjectType {
4904    #[serde(rename = "issue")]
4905    Issue,
4906    #[serde(rename = "pull")]
4907    Pull,
4908    #[serde(rename = "repository")]
4909    Repository,
4910}
4911
4912impl NotifyGetListQuerySubjectType {
4913    fn as_str(&self) -> &'static str {
4914        match self {
4915            NotifyGetListQuerySubjectType::Issue => "issue",
4916            NotifyGetListQuerySubjectType::Pull => "pull",
4917            NotifyGetListQuerySubjectType::Repository => "repository",
4918        }
4919    }
4920}
4921#[derive(Debug, Clone, PartialEq, Default)]
4922pub struct NotifyReadListQuery {
4923    /// Describes the last point that notifications were checked. Anything updated since this time will not be updated.
4924    pub last_read_at: Option<time::OffsetDateTime>,
4925    /// If true, mark all notifications on this repo. Default value is false
4926    pub all: Option<bool>,
4927    /// Mark notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread.
4928    pub status_types: Option<Vec<String>>,
4929    /// Status to mark notifications as, Defaults to read.
4930    pub to_status: Option<String>,
4931}
4932
4933impl NotifyReadListQuery {
4934    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
4935        let mut list = Vec::new();
4936        if let Some(last_read_at) = self.last_read_at {
4937            list.push((
4938                "last_read_at",
4939                last_read_at
4940                    .format(&time::format_description::well_known::Rfc3339)
4941                    .unwrap(),
4942            ));
4943        }
4944        if let Some(all) = self.all {
4945            list.push(("all", all.to_string()));
4946        }
4947        if let Some(status_types) = self.status_types {
4948            if !status_types.is_empty() {
4949                for item in status_types {
4950                    list.push(("status-types", item.to_string()));
4951                }
4952            }
4953        }
4954        if let Some(to_status) = self.to_status {
4955            list.push(("to-status", to_status));
4956        }
4957
4958        list
4959    }
4960}
4961
4962#[derive(Debug, Clone, PartialEq, Default)]
4963pub struct NotifyReadThreadQuery {
4964    /// Status to mark notifications as
4965    pub to_status: Option<String>,
4966}
4967
4968impl NotifyReadThreadQuery {
4969    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
4970        let mut list = Vec::new();
4971        if let Some(to_status) = self.to_status {
4972            list.push(("to-status", to_status));
4973        }
4974
4975        list
4976    }
4977}
4978
4979#[derive(Debug, Clone, PartialEq, Default)]
4980pub struct OrgSearchRunJobsQuery {
4981    /// a comma separated list of run job labels to search for
4982    pub labels: Option<String>,
4983}
4984
4985impl OrgSearchRunJobsQuery {
4986    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
4987        let mut list = Vec::new();
4988        if let Some(labels) = self.labels {
4989            list.push(("labels", labels));
4990        }
4991
4992        list
4993    }
4994}
4995
4996#[derive(Debug, Clone, PartialEq, Default)]
4997pub struct OrgListActivityFeedsQuery {
4998    /// the date of the activities to be found
4999    pub date: Option<time::Date>,
5000}
5001
5002impl OrgListActivityFeedsQuery {
5003    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5004        let mut list = Vec::new();
5005        if let Some(date) = self.date {
5006            list.push(("date", date.to_string()));
5007        }
5008
5009        list
5010    }
5011}
5012
5013#[derive(Debug, Clone, PartialEq, Default)]
5014pub struct OrgListLabelsQuery {
5015    /// Specifies the sorting method: mostissues, leastissues, or reversealphabetically.
5016    pub sort: Option<OrgListLabelsQuerySort>,
5017}
5018
5019impl OrgListLabelsQuery {
5020    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5021        let mut list = Vec::new();
5022        if let Some(sort) = self.sort {
5023            list.push(("sort", sort.as_str().to_string()));
5024        }
5025
5026        list
5027    }
5028}
5029
5030#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5031pub enum OrgListLabelsQuerySort {
5032    #[serde(rename = "mostissues")]
5033    Mostissues,
5034    #[serde(rename = "leastissues")]
5035    Leastissues,
5036    #[serde(rename = "reversealphabetically")]
5037    Reversealphabetically,
5038}
5039
5040impl OrgListLabelsQuerySort {
5041    fn as_str(&self) -> &'static str {
5042        match self {
5043            OrgListLabelsQuerySort::Mostissues => "mostissues",
5044            OrgListLabelsQuerySort::Leastissues => "leastissues",
5045            OrgListLabelsQuerySort::Reversealphabetically => "reversealphabetically",
5046        }
5047    }
5048}
5049#[derive(Debug, Clone, PartialEq)]
5050pub struct OrgCheckQuotaQuery {
5051    /// subject of the quota
5052    pub subject: String,
5053}
5054
5055impl OrgCheckQuotaQuery {
5056    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5057        let mut list = Vec::new();
5058        let subject = self.subject;
5059        list.push(("subject", subject));
5060
5061        list
5062    }
5063}
5064
5065#[derive(Debug, Clone, PartialEq, Default)]
5066pub struct TeamSearchQuery {
5067    /// keywords to search
5068    pub q: Option<String>,
5069    /// include search within team description (defaults to true)
5070    pub include_desc: Option<bool>,
5071}
5072
5073impl TeamSearchQuery {
5074    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5075        let mut list = Vec::new();
5076        if let Some(q) = self.q {
5077            list.push(("q", q));
5078        }
5079        if let Some(include_desc) = self.include_desc {
5080            list.push(("include_desc", include_desc.to_string()));
5081        }
5082
5083        list
5084    }
5085}
5086#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
5087pub struct TeamSearchResults {
5088    pub data: Option<Vec<Team>>,
5089    pub ok: Option<bool>,
5090}
5091
5092impl_from_response!(TeamSearchResults);
5093
5094#[derive(Debug, Clone, PartialEq, Default)]
5095pub struct ListPackagesQuery {
5096    /// package type filter
5097    pub r#type: Option<ListPackagesQueryType>,
5098    /// name filter
5099    pub q: Option<String>,
5100}
5101
5102impl ListPackagesQuery {
5103    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5104        let mut list = Vec::new();
5105        if let Some(r#type) = self.r#type {
5106            list.push(("type", r#type.as_str().to_string()));
5107        }
5108        if let Some(q) = self.q {
5109            list.push(("q", q));
5110        }
5111
5112        list
5113    }
5114}
5115
5116#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5117pub enum ListPackagesQueryType {
5118    #[serde(rename = "alpine")]
5119    Alpine,
5120    #[serde(rename = "cargo")]
5121    Cargo,
5122    #[serde(rename = "chef")]
5123    Chef,
5124    #[serde(rename = "composer")]
5125    Composer,
5126    #[serde(rename = "conan")]
5127    Conan,
5128    #[serde(rename = "conda")]
5129    Conda,
5130    #[serde(rename = "container")]
5131    Container,
5132    #[serde(rename = "cran")]
5133    Cran,
5134    #[serde(rename = "debian")]
5135    Debian,
5136    #[serde(rename = "generic")]
5137    Generic,
5138    #[serde(rename = "go")]
5139    Go,
5140    #[serde(rename = "helm")]
5141    Helm,
5142    #[serde(rename = "maven")]
5143    Maven,
5144    #[serde(rename = "npm")]
5145    Npm,
5146    #[serde(rename = "nuget")]
5147    Nuget,
5148    #[serde(rename = "pub")]
5149    Pub,
5150    #[serde(rename = "pypi")]
5151    Pypi,
5152    #[serde(rename = "rpm")]
5153    Rpm,
5154    #[serde(rename = "rubygems")]
5155    Rubygems,
5156    #[serde(rename = "swift")]
5157    Swift,
5158    #[serde(rename = "vagrant")]
5159    Vagrant,
5160}
5161
5162impl ListPackagesQueryType {
5163    fn as_str(&self) -> &'static str {
5164        match self {
5165            ListPackagesQueryType::Alpine => "alpine",
5166            ListPackagesQueryType::Cargo => "cargo",
5167            ListPackagesQueryType::Chef => "chef",
5168            ListPackagesQueryType::Composer => "composer",
5169            ListPackagesQueryType::Conan => "conan",
5170            ListPackagesQueryType::Conda => "conda",
5171            ListPackagesQueryType::Container => "container",
5172            ListPackagesQueryType::Cran => "cran",
5173            ListPackagesQueryType::Debian => "debian",
5174            ListPackagesQueryType::Generic => "generic",
5175            ListPackagesQueryType::Go => "go",
5176            ListPackagesQueryType::Helm => "helm",
5177            ListPackagesQueryType::Maven => "maven",
5178            ListPackagesQueryType::Npm => "npm",
5179            ListPackagesQueryType::Nuget => "nuget",
5180            ListPackagesQueryType::Pub => "pub",
5181            ListPackagesQueryType::Pypi => "pypi",
5182            ListPackagesQueryType::Rpm => "rpm",
5183            ListPackagesQueryType::Rubygems => "rubygems",
5184            ListPackagesQueryType::Swift => "swift",
5185            ListPackagesQueryType::Vagrant => "vagrant",
5186        }
5187    }
5188}
5189#[derive(Debug, Clone, PartialEq, Default)]
5190pub struct IssueSearchIssuesQuery {
5191    /// State of the issue
5192    pub state: Option<IssueSearchIssuesQueryState>,
5193    /// Comma-separated list of label names. Fetch only issues that have any of these labels. Non existent labels are discarded.
5194    pub labels: Option<String>,
5195    /// Comma-separated list of milestone names. Fetch only issues that have any of these milestones. Non existent milestones are discarded.
5196    pub milestones: Option<String>,
5197    /// Search string
5198    pub q: Option<String>,
5199    /// Repository ID to prioritize in the results
5200    pub priority_repo_id: Option<i64>,
5201    /// Filter by issue type
5202    pub r#type: Option<IssueSearchIssuesQueryType>,
5203    /// Only show issues updated after the given time (RFC 3339 format)
5204    pub since: Option<time::OffsetDateTime>,
5205    /// Only show issues updated before the given time (RFC 3339 format)
5206    pub before: Option<time::OffsetDateTime>,
5207    /// Filter issues or pulls assigned to the authenticated user
5208    pub assigned: Option<bool>,
5209    /// Filter issues or pulls created by the authenticated user
5210    pub created: Option<bool>,
5211    /// Filter issues or pulls mentioning the authenticated user
5212    pub mentioned: Option<bool>,
5213    /// Filter pull requests where the authenticated user's review was requested
5214    pub review_requested: Option<bool>,
5215    /// Filter pull requests reviewed by the authenticated user
5216    pub reviewed: Option<bool>,
5217    /// Filter by repository owner
5218    pub owner: Option<String>,
5219    /// Filter by team (requires organization owner parameter)
5220    pub team: Option<String>,
5221    /// Type of sort
5222    pub sort: Option<IssueSearchIssuesQuerySort>,
5223}
5224
5225impl IssueSearchIssuesQuery {
5226    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5227        let mut list = Vec::new();
5228        if let Some(state) = self.state {
5229            list.push(("state", state.as_str().to_string()));
5230        }
5231        if let Some(labels) = self.labels {
5232            list.push(("labels", labels));
5233        }
5234        if let Some(milestones) = self.milestones {
5235            list.push(("milestones", milestones));
5236        }
5237        if let Some(q) = self.q {
5238            list.push(("q", q));
5239        }
5240        if let Some(priority_repo_id) = self.priority_repo_id {
5241            list.push(("priority_repo_id", priority_repo_id.to_string()));
5242        }
5243        if let Some(r#type) = self.r#type {
5244            list.push(("type", r#type.as_str().to_string()));
5245        }
5246        if let Some(since) = self.since {
5247            list.push((
5248                "since",
5249                since
5250                    .format(&time::format_description::well_known::Rfc3339)
5251                    .unwrap(),
5252            ));
5253        }
5254        if let Some(before) = self.before {
5255            list.push((
5256                "before",
5257                before
5258                    .format(&time::format_description::well_known::Rfc3339)
5259                    .unwrap(),
5260            ));
5261        }
5262        if let Some(assigned) = self.assigned {
5263            list.push(("assigned", assigned.to_string()));
5264        }
5265        if let Some(created) = self.created {
5266            list.push(("created", created.to_string()));
5267        }
5268        if let Some(mentioned) = self.mentioned {
5269            list.push(("mentioned", mentioned.to_string()));
5270        }
5271        if let Some(review_requested) = self.review_requested {
5272            list.push(("review_requested", review_requested.to_string()));
5273        }
5274        if let Some(reviewed) = self.reviewed {
5275            list.push(("reviewed", reviewed.to_string()));
5276        }
5277        if let Some(owner) = self.owner {
5278            list.push(("owner", owner));
5279        }
5280        if let Some(team) = self.team {
5281            list.push(("team", team));
5282        }
5283        if let Some(sort) = self.sort {
5284            list.push(("sort", sort.as_str().to_string()));
5285        }
5286
5287        list
5288    }
5289}
5290
5291#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5292pub enum IssueSearchIssuesQueryState {
5293    #[serde(rename = "open")]
5294    Open,
5295    #[serde(rename = "closed")]
5296    Closed,
5297    #[serde(rename = "all")]
5298    All,
5299}
5300
5301impl IssueSearchIssuesQueryState {
5302    fn as_str(&self) -> &'static str {
5303        match self {
5304            IssueSearchIssuesQueryState::Open => "open",
5305            IssueSearchIssuesQueryState::Closed => "closed",
5306            IssueSearchIssuesQueryState::All => "all",
5307        }
5308    }
5309}
5310
5311#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5312pub enum IssueSearchIssuesQueryType {
5313    #[serde(rename = "issues")]
5314    Issues,
5315    #[serde(rename = "pulls")]
5316    Pulls,
5317}
5318
5319impl IssueSearchIssuesQueryType {
5320    fn as_str(&self) -> &'static str {
5321        match self {
5322            IssueSearchIssuesQueryType::Issues => "issues",
5323            IssueSearchIssuesQueryType::Pulls => "pulls",
5324        }
5325    }
5326}
5327
5328#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5329pub enum IssueSearchIssuesQuerySort {
5330    #[serde(rename = "relevance")]
5331    Relevance,
5332    #[serde(rename = "latest")]
5333    Latest,
5334    #[serde(rename = "oldest")]
5335    Oldest,
5336    #[serde(rename = "recentupdate")]
5337    Recentupdate,
5338    #[serde(rename = "leastupdate")]
5339    Leastupdate,
5340    #[serde(rename = "mostcomment")]
5341    Mostcomment,
5342    #[serde(rename = "leastcomment")]
5343    Leastcomment,
5344    #[serde(rename = "nearduedate")]
5345    Nearduedate,
5346    #[serde(rename = "farduedate")]
5347    Farduedate,
5348}
5349
5350impl IssueSearchIssuesQuerySort {
5351    fn as_str(&self) -> &'static str {
5352        match self {
5353            IssueSearchIssuesQuerySort::Relevance => "relevance",
5354            IssueSearchIssuesQuerySort::Latest => "latest",
5355            IssueSearchIssuesQuerySort::Oldest => "oldest",
5356            IssueSearchIssuesQuerySort::Recentupdate => "recentupdate",
5357            IssueSearchIssuesQuerySort::Leastupdate => "leastupdate",
5358            IssueSearchIssuesQuerySort::Mostcomment => "mostcomment",
5359            IssueSearchIssuesQuerySort::Leastcomment => "leastcomment",
5360            IssueSearchIssuesQuerySort::Nearduedate => "nearduedate",
5361            IssueSearchIssuesQuerySort::Farduedate => "farduedate",
5362        }
5363    }
5364}
5365#[derive(Debug, Clone, PartialEq, Default)]
5366pub struct RepoSearchQuery {
5367    /// keyword
5368    pub q: Option<String>,
5369    /// Limit search to repositories with keyword as topic
5370    pub topic: Option<bool>,
5371    /// include search of keyword within repository description
5372    pub include_desc: Option<bool>,
5373    /// search only for repos that the user with the given id owns or contributes to
5374    pub uid: Option<i64>,
5375    /// repo owner to prioritize in the results
5376    pub priority_owner_id: Option<i64>,
5377    /// search only for repos that belong to the given team id
5378    pub team_id: Option<i64>,
5379    /// search only for repos that the user with the given id has starred
5380    pub starred_by: Option<i64>,
5381    /// include private repositories this user has access to (defaults to true)
5382    pub private: Option<bool>,
5383    /// show only public, private or all repositories (defaults to all)
5384    pub is_private: Option<bool>,
5385    /// include template repositories this user has access to (defaults to true)
5386    pub template: Option<bool>,
5387    /// show only archived, non-archived or all repositories (defaults to all)
5388    pub archived: Option<bool>,
5389    /// type of repository to search for. Supported values are "fork", "source", "mirror" and "collaborative"
5390    pub mode: Option<String>,
5391    /// if `uid` is given, search only for repos that the user owns
5392    pub exclusive: Option<bool>,
5393    /// sort repos by attribute. Supported values are "alpha", "created", "updated", "size", "git_size", "lfs_size", "stars", "forks" and "id". Default is "alpha"
5394    pub sort: Option<RepoSearchQuerySort>,
5395    /// sort order, either "asc" (ascending) or "desc" (descending). Default is "asc", ignored if "sort" is not specified.
5396    pub order: Option<RepoSearchQueryOrder>,
5397}
5398
5399impl RepoSearchQuery {
5400    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5401        let mut list = Vec::new();
5402        if let Some(q) = self.q {
5403            list.push(("q", q));
5404        }
5405        if let Some(topic) = self.topic {
5406            list.push(("topic", topic.to_string()));
5407        }
5408        if let Some(include_desc) = self.include_desc {
5409            list.push(("includeDesc", include_desc.to_string()));
5410        }
5411        if let Some(uid) = self.uid {
5412            list.push(("uid", uid.to_string()));
5413        }
5414        if let Some(priority_owner_id) = self.priority_owner_id {
5415            list.push(("priority_owner_id", priority_owner_id.to_string()));
5416        }
5417        if let Some(team_id) = self.team_id {
5418            list.push(("team_id", team_id.to_string()));
5419        }
5420        if let Some(starred_by) = self.starred_by {
5421            list.push(("starredBy", starred_by.to_string()));
5422        }
5423        if let Some(private) = self.private {
5424            list.push(("private", private.to_string()));
5425        }
5426        if let Some(is_private) = self.is_private {
5427            list.push(("is_private", is_private.to_string()));
5428        }
5429        if let Some(template) = self.template {
5430            list.push(("template", template.to_string()));
5431        }
5432        if let Some(archived) = self.archived {
5433            list.push(("archived", archived.to_string()));
5434        }
5435        if let Some(mode) = self.mode {
5436            list.push(("mode", mode));
5437        }
5438        if let Some(exclusive) = self.exclusive {
5439            list.push(("exclusive", exclusive.to_string()));
5440        }
5441        if let Some(sort) = self.sort {
5442            list.push(("sort", sort.as_str().to_string()));
5443        }
5444        if let Some(order) = self.order {
5445            list.push(("order", order.as_str().to_string()));
5446        }
5447
5448        list
5449    }
5450}
5451
5452#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5453pub enum RepoSearchQuerySort {
5454    #[serde(rename = "alpha")]
5455    Alpha,
5456    #[serde(rename = "created")]
5457    Created,
5458    #[serde(rename = "updated")]
5459    Updated,
5460    #[serde(rename = "size")]
5461    Size,
5462    #[serde(rename = "git_size")]
5463    GitSize,
5464    #[serde(rename = "lfs_size")]
5465    LfsSize,
5466    #[serde(rename = "id")]
5467    Id,
5468    #[serde(rename = "stars")]
5469    Stars,
5470    #[serde(rename = "forks")]
5471    Forks,
5472}
5473
5474impl RepoSearchQuerySort {
5475    fn as_str(&self) -> &'static str {
5476        match self {
5477            RepoSearchQuerySort::Alpha => "alpha",
5478            RepoSearchQuerySort::Created => "created",
5479            RepoSearchQuerySort::Updated => "updated",
5480            RepoSearchQuerySort::Size => "size",
5481            RepoSearchQuerySort::GitSize => "git_size",
5482            RepoSearchQuerySort::LfsSize => "lfs_size",
5483            RepoSearchQuerySort::Id => "id",
5484            RepoSearchQuerySort::Stars => "stars",
5485            RepoSearchQuerySort::Forks => "forks",
5486        }
5487    }
5488}
5489
5490#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5491pub enum RepoSearchQueryOrder {
5492    #[serde(rename = "asc")]
5493    Asc,
5494    #[serde(rename = "desc")]
5495    Desc,
5496}
5497
5498impl RepoSearchQueryOrder {
5499    fn as_str(&self) -> &'static str {
5500        match self {
5501            RepoSearchQueryOrder::Asc => "asc",
5502            RepoSearchQueryOrder::Desc => "desc",
5503        }
5504    }
5505}
5506#[derive(Debug, Clone, PartialEq, Default)]
5507pub struct RepoSearchRunJobsQuery {
5508    /// a comma separated list of run job labels to search for
5509    pub labels: Option<String>,
5510}
5511
5512impl RepoSearchRunJobsQuery {
5513    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5514        let mut list = Vec::new();
5515        if let Some(labels) = self.labels {
5516            list.push(("labels", labels));
5517        }
5518
5519        list
5520    }
5521}
5522
5523#[derive(Debug, Clone, PartialEq, Default)]
5524pub struct ListActionRunsQuery {
5525    /// Returns workflow run triggered by the specified events. For example, `push`, `pull_request` or `workflow_dispatch`.
5526    pub event: Option<Vec<String>>,
5527    /// 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.
5528    pub status: Option<Vec<ListActionRunsQueryStatus>>,
5529    /// Returns the workflow run associated with the run number.
5530    pub run_number: Option<i64>,
5531    /// Only returns workflow runs that are associated with the specified head_sha.
5532    pub head_sha: Option<String>,
5533}
5534
5535impl ListActionRunsQuery {
5536    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5537        let mut list = Vec::new();
5538        if let Some(event) = self.event {
5539            if !event.is_empty() {
5540                let mut s = String::new();
5541                for (i, item) in event.iter().enumerate() {
5542                    s.push_str(item);
5543                    if i < event.len() - 1 {
5544                        s.push(',')
5545                    }
5546                }
5547                list.push(("event", s));
5548            }
5549        }
5550        if let Some(status) = self.status {
5551            if !status.is_empty() {
5552                let mut s = String::new();
5553                for (i, item) in status.iter().enumerate() {
5554                    s.push_str(item.as_str());
5555                    if i < status.len() - 1 {
5556                        s.push(',')
5557                    }
5558                }
5559                list.push(("status", s));
5560            }
5561        }
5562        if let Some(run_number) = self.run_number {
5563            list.push(("run_number", run_number.to_string()));
5564        }
5565        if let Some(head_sha) = self.head_sha {
5566            list.push(("head_sha", head_sha));
5567        }
5568
5569        list
5570    }
5571}
5572
5573#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5574pub enum ListActionRunsQueryStatus {
5575    #[serde(rename = "unknown")]
5576    Unknown,
5577    #[serde(rename = "waiting")]
5578    Waiting,
5579    #[serde(rename = "running")]
5580    Running,
5581    #[serde(rename = "success")]
5582    Success,
5583    #[serde(rename = "failure")]
5584    Failure,
5585    #[serde(rename = "cancelled")]
5586    Cancelled,
5587    #[serde(rename = "skipped")]
5588    Skipped,
5589    #[serde(rename = "blocked")]
5590    Blocked,
5591}
5592
5593impl ListActionRunsQueryStatus {
5594    fn as_str(&self) -> &'static str {
5595        match self {
5596            ListActionRunsQueryStatus::Unknown => "unknown",
5597            ListActionRunsQueryStatus::Waiting => "waiting",
5598            ListActionRunsQueryStatus::Running => "running",
5599            ListActionRunsQueryStatus::Success => "success",
5600            ListActionRunsQueryStatus::Failure => "failure",
5601            ListActionRunsQueryStatus::Cancelled => "cancelled",
5602            ListActionRunsQueryStatus::Skipped => "skipped",
5603            ListActionRunsQueryStatus::Blocked => "blocked",
5604        }
5605    }
5606}
5607#[derive(Debug, Clone, PartialEq, Default)]
5608pub struct RepoListActivityFeedsQuery {
5609    /// the date of the activities to be found
5610    pub date: Option<time::Date>,
5611}
5612
5613impl RepoListActivityFeedsQuery {
5614    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5615        let mut list = Vec::new();
5616        if let Some(date) = self.date {
5617            list.push(("date", date.to_string()));
5618        }
5619
5620        list
5621    }
5622}
5623
5624#[derive(Debug, Clone, PartialEq, Default)]
5625pub struct RepoGetAllCommitsQuery {
5626    /// SHA or branch to start listing commits from (usually 'master')
5627    pub sha: Option<String>,
5628    /// filepath of a file/dir
5629    pub path: Option<String>,
5630    /// include diff stats for every commit (disable for speedup, default 'true')
5631    pub stat: Option<bool>,
5632    /// include verification for every commit (disable for speedup, default 'true')
5633    pub verification: Option<bool>,
5634    /// include a list of affected files for every commit (disable for speedup, default 'true')
5635    pub files: Option<bool>,
5636    /// commits that match the given specifier will not be listed.
5637    pub not: Option<String>,
5638}
5639
5640impl RepoGetAllCommitsQuery {
5641    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5642        let mut list = Vec::new();
5643        if let Some(sha) = self.sha {
5644            list.push(("sha", sha));
5645        }
5646        if let Some(path) = self.path {
5647            list.push(("path", path));
5648        }
5649        if let Some(stat) = self.stat {
5650            list.push(("stat", stat.to_string()));
5651        }
5652        if let Some(verification) = self.verification {
5653            list.push(("verification", verification.to_string()));
5654        }
5655        if let Some(files) = self.files {
5656            list.push(("files", files.to_string()));
5657        }
5658        if let Some(not) = self.not {
5659            list.push(("not", not));
5660        }
5661
5662        list
5663    }
5664}
5665
5666#[derive(Debug, Clone, PartialEq, Default)]
5667pub struct RepoListStatusesByRefQuery {
5668    /// type of sort
5669    pub sort: Option<RepoListStatusesByRefQuerySort>,
5670    /// type of state
5671    pub state: Option<RepoListStatusesByRefQueryState>,
5672}
5673
5674impl RepoListStatusesByRefQuery {
5675    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5676        let mut list = Vec::new();
5677        if let Some(sort) = self.sort {
5678            list.push(("sort", sort.as_str().to_string()));
5679        }
5680        if let Some(state) = self.state {
5681            list.push(("state", state.as_str().to_string()));
5682        }
5683
5684        list
5685    }
5686}
5687
5688#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5689pub enum RepoListStatusesByRefQuerySort {
5690    #[serde(rename = "oldest")]
5691    Oldest,
5692    #[serde(rename = "recentupdate")]
5693    Recentupdate,
5694    #[serde(rename = "leastupdate")]
5695    Leastupdate,
5696    #[serde(rename = "leastindex")]
5697    Leastindex,
5698    #[serde(rename = "highestindex")]
5699    Highestindex,
5700}
5701
5702impl RepoListStatusesByRefQuerySort {
5703    fn as_str(&self) -> &'static str {
5704        match self {
5705            RepoListStatusesByRefQuerySort::Oldest => "oldest",
5706            RepoListStatusesByRefQuerySort::Recentupdate => "recentupdate",
5707            RepoListStatusesByRefQuerySort::Leastupdate => "leastupdate",
5708            RepoListStatusesByRefQuerySort::Leastindex => "leastindex",
5709            RepoListStatusesByRefQuerySort::Highestindex => "highestindex",
5710        }
5711    }
5712}
5713
5714#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5715pub enum RepoListStatusesByRefQueryState {
5716    #[serde(rename = "pending")]
5717    Pending,
5718    #[serde(rename = "success")]
5719    Success,
5720    #[serde(rename = "error")]
5721    Error,
5722    #[serde(rename = "failure")]
5723    Failure,
5724    #[serde(rename = "warning")]
5725    Warning,
5726}
5727
5728impl RepoListStatusesByRefQueryState {
5729    fn as_str(&self) -> &'static str {
5730        match self {
5731            RepoListStatusesByRefQueryState::Pending => "pending",
5732            RepoListStatusesByRefQueryState::Success => "success",
5733            RepoListStatusesByRefQueryState::Error => "error",
5734            RepoListStatusesByRefQueryState::Failure => "failure",
5735            RepoListStatusesByRefQueryState::Warning => "warning",
5736        }
5737    }
5738}
5739#[derive(Debug, Clone, PartialEq, Default)]
5740pub struct RepoGetContentsListQuery {
5741    /// The name of the commit/branch/tag. Default the repository’s default branch (usually master)
5742    pub r#ref: Option<String>,
5743}
5744
5745impl RepoGetContentsListQuery {
5746    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5747        let mut list = Vec::new();
5748        if let Some(r#ref) = self.r#ref {
5749            list.push(("ref", r#ref));
5750        }
5751
5752        list
5753    }
5754}
5755
5756#[derive(Debug, Clone, PartialEq, Default)]
5757pub struct RepoGetContentsQuery {
5758    /// The name of the commit/branch/tag. Default the repository’s default branch (usually master)
5759    pub r#ref: Option<String>,
5760}
5761
5762impl RepoGetContentsQuery {
5763    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5764        let mut list = Vec::new();
5765        if let Some(r#ref) = self.r#ref {
5766            list.push(("ref", r#ref));
5767        }
5768
5769        list
5770    }
5771}
5772
5773#[derive(Debug, Clone, PartialEq, Default)]
5774pub struct RepoGetEditorConfigQuery {
5775    /// The name of the commit/branch/tag. Default the repository’s default branch (usually master)
5776    pub r#ref: Option<String>,
5777}
5778
5779impl RepoGetEditorConfigQuery {
5780    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5781        let mut list = Vec::new();
5782        if let Some(r#ref) = self.r#ref {
5783            list.push(("ref", r#ref));
5784        }
5785
5786        list
5787    }
5788}
5789
5790#[derive(Debug, Clone, PartialEq)]
5791pub struct GetBlobsQuery {
5792    /// a comma separated list of blob-sha (mind the overall URL-length limit of ~2,083 chars)
5793    pub shas: String,
5794}
5795
5796impl GetBlobsQuery {
5797    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5798        let mut list = Vec::new();
5799        let shas = self.shas;
5800        list.push(("shas", shas));
5801
5802        list
5803    }
5804}
5805
5806#[derive(Debug, Clone, PartialEq, Default)]
5807pub struct RepoGetSingleCommitQuery {
5808    /// include diff stats for every commit (disable for speedup, default 'true')
5809    pub stat: Option<bool>,
5810    /// include verification for every commit (disable for speedup, default 'true')
5811    pub verification: Option<bool>,
5812    /// include a list of affected files for every commit (disable for speedup, default 'true')
5813    pub files: Option<bool>,
5814}
5815
5816impl RepoGetSingleCommitQuery {
5817    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5818        let mut list = Vec::new();
5819        if let Some(stat) = self.stat {
5820            list.push(("stat", stat.to_string()));
5821        }
5822        if let Some(verification) = self.verification {
5823            list.push(("verification", verification.to_string()));
5824        }
5825        if let Some(files) = self.files {
5826            list.push(("files", files.to_string()));
5827        }
5828
5829        list
5830    }
5831}
5832
5833#[derive(Debug, Clone, PartialEq, Default)]
5834pub struct RepoGetNoteQuery {
5835    /// include verification for every commit (disable for speedup, default 'true')
5836    pub verification: Option<bool>,
5837    /// include a list of affected files for every commit (disable for speedup, default 'true')
5838    pub files: Option<bool>,
5839}
5840
5841impl RepoGetNoteQuery {
5842    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5843        let mut list = Vec::new();
5844        if let Some(verification) = self.verification {
5845            list.push(("verification", verification.to_string()));
5846        }
5847        if let Some(files) = self.files {
5848            list.push(("files", files.to_string()));
5849        }
5850
5851        list
5852    }
5853}
5854
5855#[derive(Debug, Clone, PartialEq, Default)]
5856pub struct GetTreeQuery {
5857    /// show all directories and files
5858    pub recursive: Option<bool>,
5859    /// number of items per page
5860    pub per_page: Option<u32>,
5861}
5862
5863impl GetTreeQuery {
5864    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5865        let mut list = Vec::new();
5866        if let Some(recursive) = self.recursive {
5867            list.push(("recursive", recursive.to_string()));
5868        }
5869        if let Some(per_page) = self.per_page {
5870            list.push(("per_page", per_page.to_string()));
5871        }
5872
5873        list
5874    }
5875}
5876
5877#[derive(Debug, Clone, PartialEq, Default)]
5878pub struct RepoTestHookQuery {
5879    /// The name of the commit/branch/tag, indicates which commit will be loaded to the webhook payload.
5880    pub r#ref: Option<String>,
5881}
5882
5883impl RepoTestHookQuery {
5884    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5885        let mut list = Vec::new();
5886        if let Some(r#ref) = self.r#ref {
5887            list.push(("ref", r#ref));
5888        }
5889
5890        list
5891    }
5892}
5893
5894#[derive(Debug, Clone, PartialEq, Default)]
5895pub struct IssueListIssuesQuery {
5896    /// whether issue is open or closed
5897    pub state: Option<IssueListIssuesQueryState>,
5898    /// comma separated list of labels. Fetch only issues that have any of this labels. Non existent labels are discarded
5899    pub labels: Option<String>,
5900    /// search string
5901    pub q: Option<String>,
5902    /// filter by type (issues / pulls) if set
5903    pub r#type: Option<IssueListIssuesQueryType>,
5904    /// 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
5905    pub milestones: Option<String>,
5906    /// Only show items updated after the given time. This is a timestamp in RFC 3339 format
5907    pub since: Option<time::OffsetDateTime>,
5908    /// Only show items updated before the given time. This is a timestamp in RFC 3339 format
5909    pub before: Option<time::OffsetDateTime>,
5910    /// Only show items which were created by the given user
5911    pub created_by: Option<String>,
5912    /// Only show items for which the given user is assigned
5913    pub assigned_by: Option<String>,
5914    /// Only show items in which the given user was mentioned
5915    pub mentioned_by: Option<String>,
5916    /// Type of sort
5917    pub sort: Option<IssueListIssuesQuerySort>,
5918}
5919
5920impl IssueListIssuesQuery {
5921    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5922        let mut list = Vec::new();
5923        if let Some(state) = self.state {
5924            list.push(("state", state.as_str().to_string()));
5925        }
5926        if let Some(labels) = self.labels {
5927            list.push(("labels", labels));
5928        }
5929        if let Some(q) = self.q {
5930            list.push(("q", q));
5931        }
5932        if let Some(r#type) = self.r#type {
5933            list.push(("type", r#type.as_str().to_string()));
5934        }
5935        if let Some(milestones) = self.milestones {
5936            list.push(("milestones", milestones));
5937        }
5938        if let Some(since) = self.since {
5939            list.push((
5940                "since",
5941                since
5942                    .format(&time::format_description::well_known::Rfc3339)
5943                    .unwrap(),
5944            ));
5945        }
5946        if let Some(before) = self.before {
5947            list.push((
5948                "before",
5949                before
5950                    .format(&time::format_description::well_known::Rfc3339)
5951                    .unwrap(),
5952            ));
5953        }
5954        if let Some(created_by) = self.created_by {
5955            list.push(("created_by", created_by));
5956        }
5957        if let Some(assigned_by) = self.assigned_by {
5958            list.push(("assigned_by", assigned_by));
5959        }
5960        if let Some(mentioned_by) = self.mentioned_by {
5961            list.push(("mentioned_by", mentioned_by));
5962        }
5963        if let Some(sort) = self.sort {
5964            list.push(("sort", sort.as_str().to_string()));
5965        }
5966
5967        list
5968    }
5969}
5970
5971#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5972pub enum IssueListIssuesQueryState {
5973    #[serde(rename = "closed")]
5974    Closed,
5975    #[serde(rename = "open")]
5976    Open,
5977    #[serde(rename = "all")]
5978    All,
5979}
5980
5981impl IssueListIssuesQueryState {
5982    fn as_str(&self) -> &'static str {
5983        match self {
5984            IssueListIssuesQueryState::Closed => "closed",
5985            IssueListIssuesQueryState::Open => "open",
5986            IssueListIssuesQueryState::All => "all",
5987        }
5988    }
5989}
5990
5991#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5992pub enum IssueListIssuesQueryType {
5993    #[serde(rename = "issues")]
5994    Issues,
5995    #[serde(rename = "pulls")]
5996    Pulls,
5997}
5998
5999impl IssueListIssuesQueryType {
6000    fn as_str(&self) -> &'static str {
6001        match self {
6002            IssueListIssuesQueryType::Issues => "issues",
6003            IssueListIssuesQueryType::Pulls => "pulls",
6004        }
6005    }
6006}
6007
6008#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6009pub enum IssueListIssuesQuerySort {
6010    #[serde(rename = "relevance")]
6011    Relevance,
6012    #[serde(rename = "latest")]
6013    Latest,
6014    #[serde(rename = "oldest")]
6015    Oldest,
6016    #[serde(rename = "recentupdate")]
6017    Recentupdate,
6018    #[serde(rename = "leastupdate")]
6019    Leastupdate,
6020    #[serde(rename = "mostcomment")]
6021    Mostcomment,
6022    #[serde(rename = "leastcomment")]
6023    Leastcomment,
6024    #[serde(rename = "nearduedate")]
6025    Nearduedate,
6026    #[serde(rename = "farduedate")]
6027    Farduedate,
6028}
6029
6030impl IssueListIssuesQuerySort {
6031    fn as_str(&self) -> &'static str {
6032        match self {
6033            IssueListIssuesQuerySort::Relevance => "relevance",
6034            IssueListIssuesQuerySort::Latest => "latest",
6035            IssueListIssuesQuerySort::Oldest => "oldest",
6036            IssueListIssuesQuerySort::Recentupdate => "recentupdate",
6037            IssueListIssuesQuerySort::Leastupdate => "leastupdate",
6038            IssueListIssuesQuerySort::Mostcomment => "mostcomment",
6039            IssueListIssuesQuerySort::Leastcomment => "leastcomment",
6040            IssueListIssuesQuerySort::Nearduedate => "nearduedate",
6041            IssueListIssuesQuerySort::Farduedate => "farduedate",
6042        }
6043    }
6044}
6045#[derive(Debug, Clone, PartialEq, Default)]
6046pub struct IssueGetRepoCommentsQuery {
6047    /// if provided, only comments updated since the provided time are returned.
6048    pub since: Option<time::OffsetDateTime>,
6049    /// if provided, only comments updated before the provided time are returned.
6050    pub before: Option<time::OffsetDateTime>,
6051}
6052
6053impl IssueGetRepoCommentsQuery {
6054    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6055        let mut list = Vec::new();
6056        if let Some(since) = self.since {
6057            list.push((
6058                "since",
6059                since
6060                    .format(&time::format_description::well_known::Rfc3339)
6061                    .unwrap(),
6062            ));
6063        }
6064        if let Some(before) = self.before {
6065            list.push((
6066                "before",
6067                before
6068                    .format(&time::format_description::well_known::Rfc3339)
6069                    .unwrap(),
6070            ));
6071        }
6072
6073        list
6074    }
6075}
6076
6077#[derive(Debug, Clone, PartialEq, Default)]
6078pub struct IssueCreateIssueCommentAttachmentQuery {
6079    /// name of the attachment
6080    pub name: Option<String>,
6081    /// time of the attachment's creation. This is a timestamp in RFC 3339 format
6082    pub updated_at: Option<time::OffsetDateTime>,
6083}
6084
6085impl IssueCreateIssueCommentAttachmentQuery {
6086    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6087        let mut list = Vec::new();
6088        if let Some(name) = self.name {
6089            list.push(("name", name));
6090        }
6091        if let Some(updated_at) = self.updated_at {
6092            list.push((
6093                "updated_at",
6094                updated_at
6095                    .format(&time::format_description::well_known::Rfc3339)
6096                    .unwrap(),
6097            ));
6098        }
6099
6100        list
6101    }
6102}
6103
6104#[derive(Debug, Clone, PartialEq, Default)]
6105pub struct IssueCreateIssueAttachmentQuery {
6106    /// name of the attachment
6107    pub name: Option<String>,
6108    /// time of the attachment's creation. This is a timestamp in RFC 3339 format
6109    pub updated_at: Option<time::OffsetDateTime>,
6110}
6111
6112impl IssueCreateIssueAttachmentQuery {
6113    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6114        let mut list = Vec::new();
6115        if let Some(name) = self.name {
6116            list.push(("name", name));
6117        }
6118        if let Some(updated_at) = self.updated_at {
6119            list.push((
6120                "updated_at",
6121                updated_at
6122                    .format(&time::format_description::well_known::Rfc3339)
6123                    .unwrap(),
6124            ));
6125        }
6126
6127        list
6128    }
6129}
6130
6131#[derive(Debug, Clone, PartialEq, Default)]
6132pub struct IssueGetCommentsQuery {
6133    /// if provided, only comments updated since the specified time are returned.
6134    pub since: Option<time::OffsetDateTime>,
6135    /// if provided, only comments updated before the provided time are returned.
6136    pub before: Option<time::OffsetDateTime>,
6137}
6138
6139impl IssueGetCommentsQuery {
6140    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6141        let mut list = Vec::new();
6142        if let Some(since) = self.since {
6143            list.push((
6144                "since",
6145                since
6146                    .format(&time::format_description::well_known::Rfc3339)
6147                    .unwrap(),
6148            ));
6149        }
6150        if let Some(before) = self.before {
6151            list.push((
6152                "before",
6153                before
6154                    .format(&time::format_description::well_known::Rfc3339)
6155                    .unwrap(),
6156            ));
6157        }
6158
6159        list
6160    }
6161}
6162
6163#[derive(Debug, Clone, PartialEq, Default)]
6164pub struct IssueGetCommentsAndTimelineQuery {
6165    /// if provided, only comments updated since the specified time are returned.
6166    pub since: Option<time::OffsetDateTime>,
6167    /// if provided, only comments updated before the provided time are returned.
6168    pub before: Option<time::OffsetDateTime>,
6169}
6170
6171impl IssueGetCommentsAndTimelineQuery {
6172    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6173        let mut list = Vec::new();
6174        if let Some(since) = self.since {
6175            list.push((
6176                "since",
6177                since
6178                    .format(&time::format_description::well_known::Rfc3339)
6179                    .unwrap(),
6180            ));
6181        }
6182        if let Some(before) = self.before {
6183            list.push((
6184                "before",
6185                before
6186                    .format(&time::format_description::well_known::Rfc3339)
6187                    .unwrap(),
6188            ));
6189        }
6190
6191        list
6192    }
6193}
6194
6195#[derive(Debug, Clone, PartialEq, Default)]
6196pub struct IssueTrackedTimesQuery {
6197    /// optional filter by user (available for issue managers)
6198    pub user: Option<String>,
6199    /// Only show times updated after the given time. This is a timestamp in RFC 3339 format
6200    pub since: Option<time::OffsetDateTime>,
6201    /// Only show times updated before the given time. This is a timestamp in RFC 3339 format
6202    pub before: Option<time::OffsetDateTime>,
6203}
6204
6205impl IssueTrackedTimesQuery {
6206    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6207        let mut list = Vec::new();
6208        if let Some(user) = self.user {
6209            list.push(("user", user));
6210        }
6211        if let Some(since) = self.since {
6212            list.push((
6213                "since",
6214                since
6215                    .format(&time::format_description::well_known::Rfc3339)
6216                    .unwrap(),
6217            ));
6218        }
6219        if let Some(before) = self.before {
6220            list.push((
6221                "before",
6222                before
6223                    .format(&time::format_description::well_known::Rfc3339)
6224                    .unwrap(),
6225            ));
6226        }
6227
6228        list
6229    }
6230}
6231
6232#[derive(Debug, Clone, PartialEq, Default)]
6233pub struct RepoListKeysQuery {
6234    /// the key_id to search for
6235    pub key_id: Option<u32>,
6236    /// fingerprint of the key
6237    pub fingerprint: Option<String>,
6238}
6239
6240impl RepoListKeysQuery {
6241    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6242        let mut list = Vec::new();
6243        if let Some(key_id) = self.key_id {
6244            list.push(("key_id", key_id.to_string()));
6245        }
6246        if let Some(fingerprint) = self.fingerprint {
6247            list.push(("fingerprint", fingerprint));
6248        }
6249
6250        list
6251    }
6252}
6253
6254#[derive(Debug, Clone, PartialEq, Default)]
6255pub struct IssueListLabelsQuery {
6256    /// Specifies the sorting method: mostissues, leastissues, or reversealphabetically.
6257    pub sort: Option<IssueListLabelsQuerySort>,
6258}
6259
6260impl IssueListLabelsQuery {
6261    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6262        let mut list = Vec::new();
6263        if let Some(sort) = self.sort {
6264            list.push(("sort", sort.as_str().to_string()));
6265        }
6266
6267        list
6268    }
6269}
6270
6271#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6272pub enum IssueListLabelsQuerySort {
6273    #[serde(rename = "mostissues")]
6274    Mostissues,
6275    #[serde(rename = "leastissues")]
6276    Leastissues,
6277    #[serde(rename = "reversealphabetically")]
6278    Reversealphabetically,
6279}
6280
6281impl IssueListLabelsQuerySort {
6282    fn as_str(&self) -> &'static str {
6283        match self {
6284            IssueListLabelsQuerySort::Mostissues => "mostissues",
6285            IssueListLabelsQuerySort::Leastissues => "leastissues",
6286            IssueListLabelsQuerySort::Reversealphabetically => "reversealphabetically",
6287        }
6288    }
6289}
6290#[derive(Debug, Clone, PartialEq, Default)]
6291pub struct RepoGetRawFileOrLfsQuery {
6292    /// The name of the commit/branch/tag. Default the repository’s default branch (usually master)
6293    pub r#ref: Option<String>,
6294}
6295
6296impl RepoGetRawFileOrLfsQuery {
6297    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6298        let mut list = Vec::new();
6299        if let Some(r#ref) = self.r#ref {
6300            list.push(("ref", r#ref));
6301        }
6302
6303        list
6304    }
6305}
6306
6307#[derive(Debug, Clone, PartialEq, Default)]
6308pub struct IssueGetMilestonesListQuery {
6309    /// Milestone state, Recognized values are open, closed and all. Defaults to "open"
6310    pub state: Option<String>,
6311    /// filter by milestone name
6312    pub name: Option<String>,
6313}
6314
6315impl IssueGetMilestonesListQuery {
6316    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6317        let mut list = Vec::new();
6318        if let Some(state) = self.state {
6319            list.push(("state", state));
6320        }
6321        if let Some(name) = self.name {
6322            list.push(("name", name));
6323        }
6324
6325        list
6326    }
6327}
6328
6329#[derive(Debug, Clone, PartialEq, Default)]
6330pub struct NotifyGetRepoListQuery {
6331    /// If true, show notifications marked as read. Default value is false
6332    pub all: Option<bool>,
6333    /// Show notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread & pinned
6334    pub status_types: Option<Vec<String>>,
6335    /// filter notifications by subject type
6336    pub subject_type: Option<Vec<NotifyGetRepoListQuerySubjectType>>,
6337    /// Only show notifications updated after the given time. This is a timestamp in RFC 3339 format
6338    pub since: Option<time::OffsetDateTime>,
6339    /// Only show notifications updated before the given time. This is a timestamp in RFC 3339 format
6340    pub before: Option<time::OffsetDateTime>,
6341}
6342
6343impl NotifyGetRepoListQuery {
6344    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6345        let mut list = Vec::new();
6346        if let Some(all) = self.all {
6347            list.push(("all", all.to_string()));
6348        }
6349        if let Some(status_types) = self.status_types {
6350            if !status_types.is_empty() {
6351                for item in status_types {
6352                    list.push(("status-types", item.to_string()));
6353                }
6354            }
6355        }
6356        if let Some(subject_type) = self.subject_type {
6357            if !subject_type.is_empty() {
6358                for item in subject_type {
6359                    list.push(("subject-type", item.as_str().to_string()));
6360                }
6361            }
6362        }
6363        if let Some(since) = self.since {
6364            list.push((
6365                "since",
6366                since
6367                    .format(&time::format_description::well_known::Rfc3339)
6368                    .unwrap(),
6369            ));
6370        }
6371        if let Some(before) = self.before {
6372            list.push((
6373                "before",
6374                before
6375                    .format(&time::format_description::well_known::Rfc3339)
6376                    .unwrap(),
6377            ));
6378        }
6379
6380        list
6381    }
6382}
6383
6384#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6385pub enum NotifyGetRepoListQuerySubjectType {
6386    #[serde(rename = "issue")]
6387    Issue,
6388    #[serde(rename = "pull")]
6389    Pull,
6390    #[serde(rename = "repository")]
6391    Repository,
6392}
6393
6394impl NotifyGetRepoListQuerySubjectType {
6395    fn as_str(&self) -> &'static str {
6396        match self {
6397            NotifyGetRepoListQuerySubjectType::Issue => "issue",
6398            NotifyGetRepoListQuerySubjectType::Pull => "pull",
6399            NotifyGetRepoListQuerySubjectType::Repository => "repository",
6400        }
6401    }
6402}
6403#[derive(Debug, Clone, PartialEq, Default)]
6404pub struct NotifyReadRepoListQuery {
6405    /// If true, mark all notifications on this repo. Default value is false
6406    pub all: Option<bool>,
6407    /// Mark notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread.
6408    pub status_types: Option<Vec<String>>,
6409    /// Status to mark notifications as. Defaults to read.
6410    pub to_status: Option<String>,
6411    /// Describes the last point that notifications were checked. Anything updated since this time will not be updated.
6412    pub last_read_at: Option<time::OffsetDateTime>,
6413}
6414
6415impl NotifyReadRepoListQuery {
6416    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6417        let mut list = Vec::new();
6418        if let Some(all) = self.all {
6419            list.push(("all", all.to_string()));
6420        }
6421        if let Some(status_types) = self.status_types {
6422            if !status_types.is_empty() {
6423                for item in status_types {
6424                    list.push(("status-types", item.to_string()));
6425                }
6426            }
6427        }
6428        if let Some(to_status) = self.to_status {
6429            list.push(("to-status", to_status));
6430        }
6431        if let Some(last_read_at) = self.last_read_at {
6432            list.push((
6433                "last_read_at",
6434                last_read_at
6435                    .format(&time::format_description::well_known::Rfc3339)
6436                    .unwrap(),
6437            ));
6438        }
6439
6440        list
6441    }
6442}
6443
6444#[derive(Debug, Clone, PartialEq, Default)]
6445pub struct RepoListPullRequestsQuery {
6446    /// State of pull request
6447    pub state: Option<RepoListPullRequestsQueryState>,
6448    /// Type of sort
6449    pub sort: Option<RepoListPullRequestsQuerySort>,
6450    /// ID of the milestone
6451    pub milestone: Option<i64>,
6452    /// Label IDs
6453    pub labels: Option<Vec<i64>>,
6454    /// Filter by pull request author
6455    pub poster: Option<String>,
6456}
6457
6458impl RepoListPullRequestsQuery {
6459    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6460        let mut list = Vec::new();
6461        if let Some(state) = self.state {
6462            list.push(("state", state.as_str().to_string()));
6463        }
6464        if let Some(sort) = self.sort {
6465            list.push(("sort", sort.as_str().to_string()));
6466        }
6467        if let Some(milestone) = self.milestone {
6468            list.push(("milestone", milestone.to_string()));
6469        }
6470        if let Some(labels) = self.labels {
6471            if !labels.is_empty() {
6472                for item in labels {
6473                    list.push(("labels", format!("{item}")));
6474                }
6475            }
6476        }
6477        if let Some(poster) = self.poster {
6478            list.push(("poster", poster));
6479        }
6480
6481        list
6482    }
6483}
6484
6485#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6486pub enum RepoListPullRequestsQueryState {
6487    #[serde(rename = "open")]
6488    Open,
6489    #[serde(rename = "closed")]
6490    Closed,
6491    #[serde(rename = "all")]
6492    All,
6493}
6494
6495impl RepoListPullRequestsQueryState {
6496    fn as_str(&self) -> &'static str {
6497        match self {
6498            RepoListPullRequestsQueryState::Open => "open",
6499            RepoListPullRequestsQueryState::Closed => "closed",
6500            RepoListPullRequestsQueryState::All => "all",
6501        }
6502    }
6503}
6504
6505#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6506pub enum RepoListPullRequestsQuerySort {
6507    #[serde(rename = "oldest")]
6508    Oldest,
6509    #[serde(rename = "recentupdate")]
6510    Recentupdate,
6511    #[serde(rename = "recentclose")]
6512    Recentclose,
6513    #[serde(rename = "leastupdate")]
6514    Leastupdate,
6515    #[serde(rename = "mostcomment")]
6516    Mostcomment,
6517    #[serde(rename = "leastcomment")]
6518    Leastcomment,
6519    #[serde(rename = "priority")]
6520    Priority,
6521}
6522
6523impl RepoListPullRequestsQuerySort {
6524    fn as_str(&self) -> &'static str {
6525        match self {
6526            RepoListPullRequestsQuerySort::Oldest => "oldest",
6527            RepoListPullRequestsQuerySort::Recentupdate => "recentupdate",
6528            RepoListPullRequestsQuerySort::Recentclose => "recentclose",
6529            RepoListPullRequestsQuerySort::Leastupdate => "leastupdate",
6530            RepoListPullRequestsQuerySort::Mostcomment => "mostcomment",
6531            RepoListPullRequestsQuerySort::Leastcomment => "leastcomment",
6532            RepoListPullRequestsQuerySort::Priority => "priority",
6533        }
6534    }
6535}
6536#[derive(Debug, Clone, PartialEq, Default)]
6537pub struct RepoDownloadPullDiffOrPatchQuery {
6538    /// whether to include binary file changes. if true, the diff is applicable with `git apply`
6539    pub binary: Option<bool>,
6540}
6541
6542impl RepoDownloadPullDiffOrPatchQuery {
6543    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6544        let mut list = Vec::new();
6545        if let Some(binary) = self.binary {
6546            list.push(("binary", binary.to_string()));
6547        }
6548
6549        list
6550    }
6551}
6552
6553#[derive(Debug, Clone, PartialEq, Default)]
6554pub struct RepoGetPullRequestCommitsQuery {
6555    /// include verification for every commit (disable for speedup, default 'true')
6556    pub verification: Option<bool>,
6557    /// include a list of affected files for every commit (disable for speedup, default 'true')
6558    pub files: Option<bool>,
6559}
6560
6561impl RepoGetPullRequestCommitsQuery {
6562    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6563        let mut list = Vec::new();
6564        if let Some(verification) = self.verification {
6565            list.push(("verification", verification.to_string()));
6566        }
6567        if let Some(files) = self.files {
6568            list.push(("files", files.to_string()));
6569        }
6570
6571        list
6572    }
6573}
6574
6575#[derive(Debug, Clone, PartialEq, Default)]
6576pub struct RepoGetPullRequestFilesQuery {
6577    /// skip to given file
6578    pub skip_to: Option<String>,
6579    /// whitespace behavior
6580    pub whitespace: Option<RepoGetPullRequestFilesQueryWhitespace>,
6581}
6582
6583impl RepoGetPullRequestFilesQuery {
6584    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6585        let mut list = Vec::new();
6586        if let Some(skip_to) = self.skip_to {
6587            list.push(("skip-to", skip_to));
6588        }
6589        if let Some(whitespace) = self.whitespace {
6590            list.push(("whitespace", whitespace.as_str().to_string()));
6591        }
6592
6593        list
6594    }
6595}
6596
6597#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6598pub enum RepoGetPullRequestFilesQueryWhitespace {
6599    #[serde(rename = "ignore-all")]
6600    IgnoreAll,
6601    #[serde(rename = "ignore-change")]
6602    IgnoreChange,
6603    #[serde(rename = "ignore-eol")]
6604    IgnoreEol,
6605    #[serde(rename = "show-all")]
6606    ShowAll,
6607}
6608
6609impl RepoGetPullRequestFilesQueryWhitespace {
6610    fn as_str(&self) -> &'static str {
6611        match self {
6612            RepoGetPullRequestFilesQueryWhitespace::IgnoreAll => "ignore-all",
6613            RepoGetPullRequestFilesQueryWhitespace::IgnoreChange => "ignore-change",
6614            RepoGetPullRequestFilesQueryWhitespace::IgnoreEol => "ignore-eol",
6615            RepoGetPullRequestFilesQueryWhitespace::ShowAll => "show-all",
6616        }
6617    }
6618}
6619#[derive(Debug, Clone, PartialEq, Default)]
6620pub struct RepoUpdatePullRequestQuery {
6621    /// how to update pull request
6622    pub style: Option<RepoUpdatePullRequestQueryStyle>,
6623}
6624
6625impl RepoUpdatePullRequestQuery {
6626    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6627        let mut list = Vec::new();
6628        if let Some(style) = self.style {
6629            list.push(("style", style.as_str().to_string()));
6630        }
6631
6632        list
6633    }
6634}
6635
6636#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6637pub enum RepoUpdatePullRequestQueryStyle {
6638    #[serde(rename = "merge")]
6639    Merge,
6640    #[serde(rename = "rebase")]
6641    Rebase,
6642}
6643
6644impl RepoUpdatePullRequestQueryStyle {
6645    fn as_str(&self) -> &'static str {
6646        match self {
6647            RepoUpdatePullRequestQueryStyle::Merge => "merge",
6648            RepoUpdatePullRequestQueryStyle::Rebase => "rebase",
6649        }
6650    }
6651}
6652#[derive(Debug, Clone, PartialEq, Default)]
6653pub struct RepoGetRawFileQuery {
6654    /// The name of the commit/branch/tag. Default the repository’s default branch (usually master)
6655    pub r#ref: Option<String>,
6656}
6657
6658impl RepoGetRawFileQuery {
6659    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6660        let mut list = Vec::new();
6661        if let Some(r#ref) = self.r#ref {
6662            list.push(("ref", r#ref));
6663        }
6664
6665        list
6666    }
6667}
6668
6669#[derive(Debug, Clone, PartialEq, Default)]
6670pub struct RepoListReleasesQuery {
6671    /// filter (exclude / include) drafts, if you dont have repo write access none will show
6672    pub draft: Option<bool>,
6673    /// filter (exclude / include) pre-releases
6674    pub pre_release: Option<bool>,
6675    /// Search string
6676    pub q: Option<String>,
6677}
6678
6679impl RepoListReleasesQuery {
6680    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6681        let mut list = Vec::new();
6682        if let Some(draft) = self.draft {
6683            list.push(("draft", draft.to_string()));
6684        }
6685        if let Some(pre_release) = self.pre_release {
6686            list.push(("pre-release", pre_release.to_string()));
6687        }
6688        if let Some(q) = self.q {
6689            list.push(("q", q));
6690        }
6691
6692        list
6693    }
6694}
6695
6696#[derive(Debug, Clone, PartialEq, Default)]
6697pub struct RepoCreateReleaseAttachmentQuery {
6698    /// name of the attachment
6699    pub name: Option<String>,
6700}
6701
6702impl RepoCreateReleaseAttachmentQuery {
6703    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6704        let mut list = Vec::new();
6705        if let Some(name) = self.name {
6706            list.push(("name", name));
6707        }
6708
6709        list
6710    }
6711}
6712
6713#[derive(Debug, Clone, PartialEq, Default)]
6714pub struct RepoListStatusesQuery {
6715    /// type of sort
6716    pub sort: Option<RepoListStatusesQuerySort>,
6717    /// type of state
6718    pub state: Option<RepoListStatusesQueryState>,
6719}
6720
6721impl RepoListStatusesQuery {
6722    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6723        let mut list = Vec::new();
6724        if let Some(sort) = self.sort {
6725            list.push(("sort", sort.as_str().to_string()));
6726        }
6727        if let Some(state) = self.state {
6728            list.push(("state", state.as_str().to_string()));
6729        }
6730
6731        list
6732    }
6733}
6734
6735#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6736pub enum RepoListStatusesQuerySort {
6737    #[serde(rename = "oldest")]
6738    Oldest,
6739    #[serde(rename = "recentupdate")]
6740    Recentupdate,
6741    #[serde(rename = "leastupdate")]
6742    Leastupdate,
6743    #[serde(rename = "leastindex")]
6744    Leastindex,
6745    #[serde(rename = "highestindex")]
6746    Highestindex,
6747}
6748
6749impl RepoListStatusesQuerySort {
6750    fn as_str(&self) -> &'static str {
6751        match self {
6752            RepoListStatusesQuerySort::Oldest => "oldest",
6753            RepoListStatusesQuerySort::Recentupdate => "recentupdate",
6754            RepoListStatusesQuerySort::Leastupdate => "leastupdate",
6755            RepoListStatusesQuerySort::Leastindex => "leastindex",
6756            RepoListStatusesQuerySort::Highestindex => "highestindex",
6757        }
6758    }
6759}
6760
6761#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6762pub enum RepoListStatusesQueryState {
6763    #[serde(rename = "pending")]
6764    Pending,
6765    #[serde(rename = "success")]
6766    Success,
6767    #[serde(rename = "error")]
6768    Error,
6769    #[serde(rename = "failure")]
6770    Failure,
6771    #[serde(rename = "warning")]
6772    Warning,
6773}
6774
6775impl RepoListStatusesQueryState {
6776    fn as_str(&self) -> &'static str {
6777        match self {
6778            RepoListStatusesQueryState::Pending => "pending",
6779            RepoListStatusesQueryState::Success => "success",
6780            RepoListStatusesQueryState::Error => "error",
6781            RepoListStatusesQueryState::Failure => "failure",
6782            RepoListStatusesQueryState::Warning => "warning",
6783        }
6784    }
6785}
6786#[derive(Debug, Clone, PartialEq, Default)]
6787pub struct RepoTrackedTimesQuery {
6788    /// optional filter by user (available for issue managers)
6789    pub user: Option<String>,
6790    /// Only show times updated after the given time. This is a timestamp in RFC 3339 format
6791    pub since: Option<time::OffsetDateTime>,
6792    /// Only show times updated before the given time. This is a timestamp in RFC 3339 format
6793    pub before: Option<time::OffsetDateTime>,
6794}
6795
6796impl RepoTrackedTimesQuery {
6797    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6798        let mut list = Vec::new();
6799        if let Some(user) = self.user {
6800            list.push(("user", user));
6801        }
6802        if let Some(since) = self.since {
6803            list.push((
6804                "since",
6805                since
6806                    .format(&time::format_description::well_known::Rfc3339)
6807                    .unwrap(),
6808            ));
6809        }
6810        if let Some(before) = self.before {
6811            list.push((
6812                "before",
6813                before
6814                    .format(&time::format_description::well_known::Rfc3339)
6815                    .unwrap(),
6816            ));
6817        }
6818
6819        list
6820    }
6821}
6822
6823#[derive(Debug, Clone, PartialEq, Default)]
6824pub struct OrgListTeamActivityFeedsQuery {
6825    /// the date of the activities to be found
6826    pub date: Option<time::Date>,
6827}
6828
6829impl OrgListTeamActivityFeedsQuery {
6830    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6831        let mut list = Vec::new();
6832        if let Some(date) = self.date {
6833            list.push(("date", date.to_string()));
6834        }
6835
6836        list
6837    }
6838}
6839
6840#[derive(Debug, Clone, PartialEq)]
6841pub struct TopicSearchQuery {
6842    /// keyword to search for
6843    pub q: String,
6844}
6845
6846impl TopicSearchQuery {
6847    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6848        let mut list = Vec::new();
6849        let q = self.q;
6850        list.push(("q", q));
6851
6852        list
6853    }
6854}
6855#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
6856pub struct TopicSearchResults {
6857    pub topics: Option<Vec<TopicResponse>>,
6858}
6859
6860impl_from_response!(TopicSearchResults);
6861
6862#[derive(Debug, Clone, PartialEq, Default)]
6863pub struct UserSearchRunJobsQuery {
6864    /// a comma separated list of run job labels to search for
6865    pub labels: Option<String>,
6866}
6867
6868impl UserSearchRunJobsQuery {
6869    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6870        let mut list = Vec::new();
6871        if let Some(labels) = self.labels {
6872            list.push(("labels", labels));
6873        }
6874
6875        list
6876    }
6877}
6878
6879#[derive(Debug, Clone, PartialEq, Default)]
6880pub struct UserCurrentListKeysQuery {
6881    /// fingerprint of the key
6882    pub fingerprint: Option<String>,
6883}
6884
6885impl UserCurrentListKeysQuery {
6886    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6887        let mut list = Vec::new();
6888        if let Some(fingerprint) = self.fingerprint {
6889            list.push(("fingerprint", fingerprint));
6890        }
6891
6892        list
6893    }
6894}
6895
6896#[derive(Debug, Clone, PartialEq)]
6897pub struct UserCheckQuotaQuery {
6898    /// subject of the quota
6899    pub subject: String,
6900}
6901
6902impl UserCheckQuotaQuery {
6903    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6904        let mut list = Vec::new();
6905        let subject = self.subject;
6906        list.push(("subject", subject));
6907
6908        list
6909    }
6910}
6911
6912#[derive(Debug, Clone, PartialEq, Default)]
6913pub struct UserCurrentListReposQuery {
6914    /// order the repositories
6915    pub order_by: Option<UserCurrentListReposQueryOrderBy>,
6916}
6917
6918impl UserCurrentListReposQuery {
6919    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6920        let mut list = Vec::new();
6921        if let Some(order_by) = self.order_by {
6922            list.push(("order_by", order_by.as_str().to_string()));
6923        }
6924
6925        list
6926    }
6927}
6928
6929#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6930pub enum UserCurrentListReposQueryOrderBy {
6931    #[serde(rename = "name")]
6932    Name,
6933    #[serde(rename = "id")]
6934    Id,
6935    #[serde(rename = "newest")]
6936    Newest,
6937    #[serde(rename = "oldest")]
6938    Oldest,
6939    #[serde(rename = "recentupdate")]
6940    Recentupdate,
6941    #[serde(rename = "leastupdate")]
6942    Leastupdate,
6943    #[serde(rename = "reversealphabetically")]
6944    Reversealphabetically,
6945    #[serde(rename = "alphabetically")]
6946    Alphabetically,
6947    #[serde(rename = "reversesize")]
6948    Reversesize,
6949    #[serde(rename = "size")]
6950    Size,
6951    #[serde(rename = "reversegitsize")]
6952    Reversegitsize,
6953    #[serde(rename = "gitsize")]
6954    Gitsize,
6955    #[serde(rename = "reverselfssize")]
6956    Reverselfssize,
6957    #[serde(rename = "lfssize")]
6958    Lfssize,
6959    #[serde(rename = "moststars")]
6960    Moststars,
6961    #[serde(rename = "feweststars")]
6962    Feweststars,
6963    #[serde(rename = "mostforks")]
6964    Mostforks,
6965    #[serde(rename = "fewestforks")]
6966    Fewestforks,
6967}
6968
6969impl UserCurrentListReposQueryOrderBy {
6970    fn as_str(&self) -> &'static str {
6971        match self {
6972            UserCurrentListReposQueryOrderBy::Name => "name",
6973            UserCurrentListReposQueryOrderBy::Id => "id",
6974            UserCurrentListReposQueryOrderBy::Newest => "newest",
6975            UserCurrentListReposQueryOrderBy::Oldest => "oldest",
6976            UserCurrentListReposQueryOrderBy::Recentupdate => "recentupdate",
6977            UserCurrentListReposQueryOrderBy::Leastupdate => "leastupdate",
6978            UserCurrentListReposQueryOrderBy::Reversealphabetically => "reversealphabetically",
6979            UserCurrentListReposQueryOrderBy::Alphabetically => "alphabetically",
6980            UserCurrentListReposQueryOrderBy::Reversesize => "reversesize",
6981            UserCurrentListReposQueryOrderBy::Size => "size",
6982            UserCurrentListReposQueryOrderBy::Reversegitsize => "reversegitsize",
6983            UserCurrentListReposQueryOrderBy::Gitsize => "gitsize",
6984            UserCurrentListReposQueryOrderBy::Reverselfssize => "reverselfssize",
6985            UserCurrentListReposQueryOrderBy::Lfssize => "lfssize",
6986            UserCurrentListReposQueryOrderBy::Moststars => "moststars",
6987            UserCurrentListReposQueryOrderBy::Feweststars => "feweststars",
6988            UserCurrentListReposQueryOrderBy::Mostforks => "mostforks",
6989            UserCurrentListReposQueryOrderBy::Fewestforks => "fewestforks",
6990        }
6991    }
6992}
6993#[derive(Debug, Clone, PartialEq, Default)]
6994pub struct UserCurrentTrackedTimesQuery {
6995    /// Only show times updated after the given time. This is a timestamp in RFC 3339 format
6996    pub since: Option<time::OffsetDateTime>,
6997    /// Only show times updated before the given time. This is a timestamp in RFC 3339 format
6998    pub before: Option<time::OffsetDateTime>,
6999}
7000
7001impl UserCurrentTrackedTimesQuery {
7002    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
7003        let mut list = Vec::new();
7004        if let Some(since) = self.since {
7005            list.push((
7006                "since",
7007                since
7008                    .format(&time::format_description::well_known::Rfc3339)
7009                    .unwrap(),
7010            ));
7011        }
7012        if let Some(before) = self.before {
7013            list.push((
7014                "before",
7015                before
7016                    .format(&time::format_description::well_known::Rfc3339)
7017                    .unwrap(),
7018            ));
7019        }
7020
7021        list
7022    }
7023}
7024
7025#[derive(Debug, Clone, PartialEq, Default)]
7026pub struct UserSearchQuery {
7027    /// keyword
7028    pub q: Option<String>,
7029    /// ID of the user to search for
7030    pub uid: Option<i64>,
7031    /// sort order of results
7032    pub sort: Option<UserSearchQuerySort>,
7033}
7034
7035impl UserSearchQuery {
7036    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
7037        let mut list = Vec::new();
7038        if let Some(q) = self.q {
7039            list.push(("q", q));
7040        }
7041        if let Some(uid) = self.uid {
7042            list.push(("uid", uid.to_string()));
7043        }
7044        if let Some(sort) = self.sort {
7045            list.push(("sort", sort.as_str().to_string()));
7046        }
7047
7048        list
7049    }
7050}
7051
7052#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
7053pub enum UserSearchQuerySort {
7054    #[serde(rename = "oldest")]
7055    Oldest,
7056    #[serde(rename = "newest")]
7057    Newest,
7058    #[serde(rename = "alphabetically")]
7059    Alphabetically,
7060    #[serde(rename = "reversealphabetically")]
7061    Reversealphabetically,
7062    #[serde(rename = "recentupdate")]
7063    Recentupdate,
7064    #[serde(rename = "leastupdate")]
7065    Leastupdate,
7066}
7067
7068impl UserSearchQuerySort {
7069    fn as_str(&self) -> &'static str {
7070        match self {
7071            UserSearchQuerySort::Oldest => "oldest",
7072            UserSearchQuerySort::Newest => "newest",
7073            UserSearchQuerySort::Alphabetically => "alphabetically",
7074            UserSearchQuerySort::Reversealphabetically => "reversealphabetically",
7075            UserSearchQuerySort::Recentupdate => "recentupdate",
7076            UserSearchQuerySort::Leastupdate => "leastupdate",
7077        }
7078    }
7079}
7080#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
7081pub struct UserSearchResults {
7082    pub data: Option<Vec<User>>,
7083    pub ok: Option<bool>,
7084}
7085
7086impl_from_response!(UserSearchResults);
7087
7088#[derive(Debug, Clone, PartialEq, Default)]
7089pub struct UserListActivityFeedsQuery {
7090    /// if true, only show actions performed by the requested user
7091    pub only_performed_by: Option<bool>,
7092    /// the date of the activities to be found
7093    pub date: Option<time::Date>,
7094}
7095
7096impl UserListActivityFeedsQuery {
7097    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
7098        let mut list = Vec::new();
7099        if let Some(only_performed_by) = self.only_performed_by {
7100            list.push(("only-performed-by", only_performed_by.to_string()));
7101        }
7102        if let Some(date) = self.date {
7103            list.push(("date", date.to_string()));
7104        }
7105
7106        list
7107    }
7108}
7109
7110#[derive(Debug, Clone, PartialEq, Default)]
7111pub struct UserListKeysQuery {
7112    /// fingerprint of the key
7113    pub fingerprint: Option<String>,
7114}
7115
7116impl UserListKeysQuery {
7117    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
7118        let mut list = Vec::new();
7119        if let Some(fingerprint) = self.fingerprint {
7120            list.push(("fingerprint", fingerprint));
7121        }
7122
7123        list
7124    }
7125}