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