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((
5006                "date",
5007                date.format(&time::format_description::well_known::Rfc3339)
5008                    .unwrap(),
5009            ));
5010        }
5011
5012        list
5013    }
5014}
5015
5016#[derive(Debug, Clone, PartialEq, Default)]
5017pub struct OrgListLabelsQuery {
5018    /// Specifies the sorting method: mostissues, leastissues, or reversealphabetically.
5019    pub sort: Option<OrgListLabelsQuerySort>,
5020}
5021
5022impl OrgListLabelsQuery {
5023    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5024        let mut list = Vec::new();
5025        if let Some(sort) = self.sort {
5026            list.push(("sort", sort.as_str().to_string()));
5027        }
5028
5029        list
5030    }
5031}
5032
5033#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5034pub enum OrgListLabelsQuerySort {
5035    #[serde(rename = "mostissues")]
5036    Mostissues,
5037    #[serde(rename = "leastissues")]
5038    Leastissues,
5039    #[serde(rename = "reversealphabetically")]
5040    Reversealphabetically,
5041}
5042
5043impl OrgListLabelsQuerySort {
5044    fn as_str(&self) -> &'static str {
5045        match self {
5046            OrgListLabelsQuerySort::Mostissues => "mostissues",
5047            OrgListLabelsQuerySort::Leastissues => "leastissues",
5048            OrgListLabelsQuerySort::Reversealphabetically => "reversealphabetically",
5049        }
5050    }
5051}
5052#[derive(Debug, Clone, PartialEq)]
5053pub struct OrgCheckQuotaQuery {
5054    /// subject of the quota
5055    pub subject: String,
5056}
5057
5058impl OrgCheckQuotaQuery {
5059    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5060        let mut list = Vec::new();
5061        let subject = self.subject;
5062        list.push(("subject", subject));
5063
5064        list
5065    }
5066}
5067
5068#[derive(Debug, Clone, PartialEq, Default)]
5069pub struct TeamSearchQuery {
5070    /// keywords to search
5071    pub q: Option<String>,
5072    /// include search within team description (defaults to true)
5073    pub include_desc: Option<bool>,
5074}
5075
5076impl TeamSearchQuery {
5077    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5078        let mut list = Vec::new();
5079        if let Some(q) = self.q {
5080            list.push(("q", q));
5081        }
5082        if let Some(include_desc) = self.include_desc {
5083            list.push(("include_desc", include_desc.to_string()));
5084        }
5085
5086        list
5087    }
5088}
5089#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
5090pub struct TeamSearchResults {
5091    pub data: Option<Vec<Team>>,
5092    pub ok: Option<bool>,
5093}
5094
5095impl_from_response!(TeamSearchResults);
5096
5097#[derive(Debug, Clone, PartialEq, Default)]
5098pub struct ListPackagesQuery {
5099    /// package type filter
5100    pub r#type: Option<ListPackagesQueryType>,
5101    /// name filter
5102    pub q: Option<String>,
5103}
5104
5105impl ListPackagesQuery {
5106    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5107        let mut list = Vec::new();
5108        if let Some(r#type) = self.r#type {
5109            list.push(("type", r#type.as_str().to_string()));
5110        }
5111        if let Some(q) = self.q {
5112            list.push(("q", q));
5113        }
5114
5115        list
5116    }
5117}
5118
5119#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5120pub enum ListPackagesQueryType {
5121    #[serde(rename = "alpine")]
5122    Alpine,
5123    #[serde(rename = "cargo")]
5124    Cargo,
5125    #[serde(rename = "chef")]
5126    Chef,
5127    #[serde(rename = "composer")]
5128    Composer,
5129    #[serde(rename = "conan")]
5130    Conan,
5131    #[serde(rename = "conda")]
5132    Conda,
5133    #[serde(rename = "container")]
5134    Container,
5135    #[serde(rename = "cran")]
5136    Cran,
5137    #[serde(rename = "debian")]
5138    Debian,
5139    #[serde(rename = "generic")]
5140    Generic,
5141    #[serde(rename = "go")]
5142    Go,
5143    #[serde(rename = "helm")]
5144    Helm,
5145    #[serde(rename = "maven")]
5146    Maven,
5147    #[serde(rename = "npm")]
5148    Npm,
5149    #[serde(rename = "nuget")]
5150    Nuget,
5151    #[serde(rename = "pub")]
5152    Pub,
5153    #[serde(rename = "pypi")]
5154    Pypi,
5155    #[serde(rename = "rpm")]
5156    Rpm,
5157    #[serde(rename = "rubygems")]
5158    Rubygems,
5159    #[serde(rename = "swift")]
5160    Swift,
5161    #[serde(rename = "vagrant")]
5162    Vagrant,
5163}
5164
5165impl ListPackagesQueryType {
5166    fn as_str(&self) -> &'static str {
5167        match self {
5168            ListPackagesQueryType::Alpine => "alpine",
5169            ListPackagesQueryType::Cargo => "cargo",
5170            ListPackagesQueryType::Chef => "chef",
5171            ListPackagesQueryType::Composer => "composer",
5172            ListPackagesQueryType::Conan => "conan",
5173            ListPackagesQueryType::Conda => "conda",
5174            ListPackagesQueryType::Container => "container",
5175            ListPackagesQueryType::Cran => "cran",
5176            ListPackagesQueryType::Debian => "debian",
5177            ListPackagesQueryType::Generic => "generic",
5178            ListPackagesQueryType::Go => "go",
5179            ListPackagesQueryType::Helm => "helm",
5180            ListPackagesQueryType::Maven => "maven",
5181            ListPackagesQueryType::Npm => "npm",
5182            ListPackagesQueryType::Nuget => "nuget",
5183            ListPackagesQueryType::Pub => "pub",
5184            ListPackagesQueryType::Pypi => "pypi",
5185            ListPackagesQueryType::Rpm => "rpm",
5186            ListPackagesQueryType::Rubygems => "rubygems",
5187            ListPackagesQueryType::Swift => "swift",
5188            ListPackagesQueryType::Vagrant => "vagrant",
5189        }
5190    }
5191}
5192#[derive(Debug, Clone, PartialEq, Default)]
5193pub struct IssueSearchIssuesQuery {
5194    /// State of the issue
5195    pub state: Option<IssueSearchIssuesQueryState>,
5196    /// Comma-separated list of label names. Fetch only issues that have any of these labels. Non existent labels are discarded.
5197    pub labels: Option<String>,
5198    /// Comma-separated list of milestone names. Fetch only issues that have any of these milestones. Non existent milestones are discarded.
5199    pub milestones: Option<String>,
5200    /// Search string
5201    pub q: Option<String>,
5202    /// Repository ID to prioritize in the results
5203    pub priority_repo_id: Option<i64>,
5204    /// Filter by issue type
5205    pub r#type: Option<IssueSearchIssuesQueryType>,
5206    /// Only show issues updated after the given time (RFC 3339 format)
5207    pub since: Option<time::OffsetDateTime>,
5208    /// Only show issues updated before the given time (RFC 3339 format)
5209    pub before: Option<time::OffsetDateTime>,
5210    /// Filter issues or pulls assigned to the authenticated user
5211    pub assigned: Option<bool>,
5212    /// Filter issues or pulls created by the authenticated user
5213    pub created: Option<bool>,
5214    /// Filter issues or pulls mentioning the authenticated user
5215    pub mentioned: Option<bool>,
5216    /// Filter pull requests where the authenticated user's review was requested
5217    pub review_requested: Option<bool>,
5218    /// Filter pull requests reviewed by the authenticated user
5219    pub reviewed: Option<bool>,
5220    /// Filter by repository owner
5221    pub owner: Option<String>,
5222    /// Filter by team (requires organization owner parameter)
5223    pub team: Option<String>,
5224    /// Type of sort
5225    pub sort: Option<IssueSearchIssuesQuerySort>,
5226}
5227
5228impl IssueSearchIssuesQuery {
5229    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5230        let mut list = Vec::new();
5231        if let Some(state) = self.state {
5232            list.push(("state", state.as_str().to_string()));
5233        }
5234        if let Some(labels) = self.labels {
5235            list.push(("labels", labels));
5236        }
5237        if let Some(milestones) = self.milestones {
5238            list.push(("milestones", milestones));
5239        }
5240        if let Some(q) = self.q {
5241            list.push(("q", q));
5242        }
5243        if let Some(priority_repo_id) = self.priority_repo_id {
5244            list.push(("priority_repo_id", priority_repo_id.to_string()));
5245        }
5246        if let Some(r#type) = self.r#type {
5247            list.push(("type", r#type.as_str().to_string()));
5248        }
5249        if let Some(since) = self.since {
5250            list.push((
5251                "since",
5252                since
5253                    .format(&time::format_description::well_known::Rfc3339)
5254                    .unwrap(),
5255            ));
5256        }
5257        if let Some(before) = self.before {
5258            list.push((
5259                "before",
5260                before
5261                    .format(&time::format_description::well_known::Rfc3339)
5262                    .unwrap(),
5263            ));
5264        }
5265        if let Some(assigned) = self.assigned {
5266            list.push(("assigned", assigned.to_string()));
5267        }
5268        if let Some(created) = self.created {
5269            list.push(("created", created.to_string()));
5270        }
5271        if let Some(mentioned) = self.mentioned {
5272            list.push(("mentioned", mentioned.to_string()));
5273        }
5274        if let Some(review_requested) = self.review_requested {
5275            list.push(("review_requested", review_requested.to_string()));
5276        }
5277        if let Some(reviewed) = self.reviewed {
5278            list.push(("reviewed", reviewed.to_string()));
5279        }
5280        if let Some(owner) = self.owner {
5281            list.push(("owner", owner));
5282        }
5283        if let Some(team) = self.team {
5284            list.push(("team", team));
5285        }
5286        if let Some(sort) = self.sort {
5287            list.push(("sort", sort.as_str().to_string()));
5288        }
5289
5290        list
5291    }
5292}
5293
5294#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5295pub enum IssueSearchIssuesQueryState {
5296    #[serde(rename = "open")]
5297    Open,
5298    #[serde(rename = "closed")]
5299    Closed,
5300    #[serde(rename = "all")]
5301    All,
5302}
5303
5304impl IssueSearchIssuesQueryState {
5305    fn as_str(&self) -> &'static str {
5306        match self {
5307            IssueSearchIssuesQueryState::Open => "open",
5308            IssueSearchIssuesQueryState::Closed => "closed",
5309            IssueSearchIssuesQueryState::All => "all",
5310        }
5311    }
5312}
5313
5314#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5315pub enum IssueSearchIssuesQueryType {
5316    #[serde(rename = "issues")]
5317    Issues,
5318    #[serde(rename = "pulls")]
5319    Pulls,
5320}
5321
5322impl IssueSearchIssuesQueryType {
5323    fn as_str(&self) -> &'static str {
5324        match self {
5325            IssueSearchIssuesQueryType::Issues => "issues",
5326            IssueSearchIssuesQueryType::Pulls => "pulls",
5327        }
5328    }
5329}
5330
5331#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5332pub enum IssueSearchIssuesQuerySort {
5333    #[serde(rename = "relevance")]
5334    Relevance,
5335    #[serde(rename = "latest")]
5336    Latest,
5337    #[serde(rename = "oldest")]
5338    Oldest,
5339    #[serde(rename = "recentupdate")]
5340    Recentupdate,
5341    #[serde(rename = "leastupdate")]
5342    Leastupdate,
5343    #[serde(rename = "mostcomment")]
5344    Mostcomment,
5345    #[serde(rename = "leastcomment")]
5346    Leastcomment,
5347    #[serde(rename = "nearduedate")]
5348    Nearduedate,
5349    #[serde(rename = "farduedate")]
5350    Farduedate,
5351}
5352
5353impl IssueSearchIssuesQuerySort {
5354    fn as_str(&self) -> &'static str {
5355        match self {
5356            IssueSearchIssuesQuerySort::Relevance => "relevance",
5357            IssueSearchIssuesQuerySort::Latest => "latest",
5358            IssueSearchIssuesQuerySort::Oldest => "oldest",
5359            IssueSearchIssuesQuerySort::Recentupdate => "recentupdate",
5360            IssueSearchIssuesQuerySort::Leastupdate => "leastupdate",
5361            IssueSearchIssuesQuerySort::Mostcomment => "mostcomment",
5362            IssueSearchIssuesQuerySort::Leastcomment => "leastcomment",
5363            IssueSearchIssuesQuerySort::Nearduedate => "nearduedate",
5364            IssueSearchIssuesQuerySort::Farduedate => "farduedate",
5365        }
5366    }
5367}
5368#[derive(Debug, Clone, PartialEq, Default)]
5369pub struct RepoSearchQuery {
5370    /// keyword
5371    pub q: Option<String>,
5372    /// Limit search to repositories with keyword as topic
5373    pub topic: Option<bool>,
5374    /// include search of keyword within repository description
5375    pub include_desc: Option<bool>,
5376    /// search only for repos that the user with the given id owns or contributes to
5377    pub uid: Option<i64>,
5378    /// repo owner to prioritize in the results
5379    pub priority_owner_id: Option<i64>,
5380    /// search only for repos that belong to the given team id
5381    pub team_id: Option<i64>,
5382    /// search only for repos that the user with the given id has starred
5383    pub starred_by: Option<i64>,
5384    /// include private repositories this user has access to (defaults to true)
5385    pub private: Option<bool>,
5386    /// show only public, private or all repositories (defaults to all)
5387    pub is_private: Option<bool>,
5388    /// include template repositories this user has access to (defaults to true)
5389    pub template: Option<bool>,
5390    /// show only archived, non-archived or all repositories (defaults to all)
5391    pub archived: Option<bool>,
5392    /// type of repository to search for. Supported values are "fork", "source", "mirror" and "collaborative"
5393    pub mode: Option<String>,
5394    /// if `uid` is given, search only for repos that the user owns
5395    pub exclusive: Option<bool>,
5396    /// sort repos by attribute. Supported values are "alpha", "created", "updated", "size", "git_size", "lfs_size", "stars", "forks" and "id". Default is "alpha"
5397    pub sort: Option<RepoSearchQuerySort>,
5398    /// sort order, either "asc" (ascending) or "desc" (descending). Default is "asc", ignored if "sort" is not specified.
5399    pub order: Option<RepoSearchQueryOrder>,
5400}
5401
5402impl RepoSearchQuery {
5403    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5404        let mut list = Vec::new();
5405        if let Some(q) = self.q {
5406            list.push(("q", q));
5407        }
5408        if let Some(topic) = self.topic {
5409            list.push(("topic", topic.to_string()));
5410        }
5411        if let Some(include_desc) = self.include_desc {
5412            list.push(("includeDesc", include_desc.to_string()));
5413        }
5414        if let Some(uid) = self.uid {
5415            list.push(("uid", uid.to_string()));
5416        }
5417        if let Some(priority_owner_id) = self.priority_owner_id {
5418            list.push(("priority_owner_id", priority_owner_id.to_string()));
5419        }
5420        if let Some(team_id) = self.team_id {
5421            list.push(("team_id", team_id.to_string()));
5422        }
5423        if let Some(starred_by) = self.starred_by {
5424            list.push(("starredBy", starred_by.to_string()));
5425        }
5426        if let Some(private) = self.private {
5427            list.push(("private", private.to_string()));
5428        }
5429        if let Some(is_private) = self.is_private {
5430            list.push(("is_private", is_private.to_string()));
5431        }
5432        if let Some(template) = self.template {
5433            list.push(("template", template.to_string()));
5434        }
5435        if let Some(archived) = self.archived {
5436            list.push(("archived", archived.to_string()));
5437        }
5438        if let Some(mode) = self.mode {
5439            list.push(("mode", mode));
5440        }
5441        if let Some(exclusive) = self.exclusive {
5442            list.push(("exclusive", exclusive.to_string()));
5443        }
5444        if let Some(sort) = self.sort {
5445            list.push(("sort", sort.as_str().to_string()));
5446        }
5447        if let Some(order) = self.order {
5448            list.push(("order", order.as_str().to_string()));
5449        }
5450
5451        list
5452    }
5453}
5454
5455#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5456pub enum RepoSearchQuerySort {
5457    #[serde(rename = "alpha")]
5458    Alpha,
5459    #[serde(rename = "created")]
5460    Created,
5461    #[serde(rename = "updated")]
5462    Updated,
5463    #[serde(rename = "size")]
5464    Size,
5465    #[serde(rename = "git_size")]
5466    GitSize,
5467    #[serde(rename = "lfs_size")]
5468    LfsSize,
5469    #[serde(rename = "id")]
5470    Id,
5471    #[serde(rename = "stars")]
5472    Stars,
5473    #[serde(rename = "forks")]
5474    Forks,
5475}
5476
5477impl RepoSearchQuerySort {
5478    fn as_str(&self) -> &'static str {
5479        match self {
5480            RepoSearchQuerySort::Alpha => "alpha",
5481            RepoSearchQuerySort::Created => "created",
5482            RepoSearchQuerySort::Updated => "updated",
5483            RepoSearchQuerySort::Size => "size",
5484            RepoSearchQuerySort::GitSize => "git_size",
5485            RepoSearchQuerySort::LfsSize => "lfs_size",
5486            RepoSearchQuerySort::Id => "id",
5487            RepoSearchQuerySort::Stars => "stars",
5488            RepoSearchQuerySort::Forks => "forks",
5489        }
5490    }
5491}
5492
5493#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5494pub enum RepoSearchQueryOrder {
5495    #[serde(rename = "asc")]
5496    Asc,
5497    #[serde(rename = "desc")]
5498    Desc,
5499}
5500
5501impl RepoSearchQueryOrder {
5502    fn as_str(&self) -> &'static str {
5503        match self {
5504            RepoSearchQueryOrder::Asc => "asc",
5505            RepoSearchQueryOrder::Desc => "desc",
5506        }
5507    }
5508}
5509#[derive(Debug, Clone, PartialEq, Default)]
5510pub struct RepoSearchRunJobsQuery {
5511    /// a comma separated list of run job labels to search for
5512    pub labels: Option<String>,
5513}
5514
5515impl RepoSearchRunJobsQuery {
5516    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5517        let mut list = Vec::new();
5518        if let Some(labels) = self.labels {
5519            list.push(("labels", labels));
5520        }
5521
5522        list
5523    }
5524}
5525
5526#[derive(Debug, Clone, PartialEq, Default)]
5527pub struct ListActionRunsQuery {
5528    /// Returns workflow run triggered by the specified events. For example, `push`, `pull_request` or `workflow_dispatch`.
5529    pub event: Option<Vec<String>>,
5530    /// 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.
5531    pub status: Option<Vec<ListActionRunsQueryStatus>>,
5532    /// Returns the workflow run associated with the run number.
5533    pub run_number: Option<i64>,
5534    /// Only returns workflow runs that are associated with the specified head_sha.
5535    pub head_sha: Option<String>,
5536}
5537
5538impl ListActionRunsQuery {
5539    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5540        let mut list = Vec::new();
5541        if let Some(event) = self.event {
5542            if !event.is_empty() {
5543                let mut s = String::new();
5544                for (i, item) in event.iter().enumerate() {
5545                    s.push_str(item);
5546                    if i < event.len() - 1 {
5547                        s.push(',')
5548                    }
5549                }
5550                list.push(("event", s));
5551            }
5552        }
5553        if let Some(status) = self.status {
5554            if !status.is_empty() {
5555                let mut s = String::new();
5556                for (i, item) in status.iter().enumerate() {
5557                    s.push_str(item.as_str());
5558                    if i < status.len() - 1 {
5559                        s.push(',')
5560                    }
5561                }
5562                list.push(("status", s));
5563            }
5564        }
5565        if let Some(run_number) = self.run_number {
5566            list.push(("run_number", run_number.to_string()));
5567        }
5568        if let Some(head_sha) = self.head_sha {
5569            list.push(("head_sha", head_sha));
5570        }
5571
5572        list
5573    }
5574}
5575
5576#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5577pub enum ListActionRunsQueryStatus {
5578    #[serde(rename = "unknown")]
5579    Unknown,
5580    #[serde(rename = "waiting")]
5581    Waiting,
5582    #[serde(rename = "running")]
5583    Running,
5584    #[serde(rename = "success")]
5585    Success,
5586    #[serde(rename = "failure")]
5587    Failure,
5588    #[serde(rename = "cancelled")]
5589    Cancelled,
5590    #[serde(rename = "skipped")]
5591    Skipped,
5592    #[serde(rename = "blocked")]
5593    Blocked,
5594}
5595
5596impl ListActionRunsQueryStatus {
5597    fn as_str(&self) -> &'static str {
5598        match self {
5599            ListActionRunsQueryStatus::Unknown => "unknown",
5600            ListActionRunsQueryStatus::Waiting => "waiting",
5601            ListActionRunsQueryStatus::Running => "running",
5602            ListActionRunsQueryStatus::Success => "success",
5603            ListActionRunsQueryStatus::Failure => "failure",
5604            ListActionRunsQueryStatus::Cancelled => "cancelled",
5605            ListActionRunsQueryStatus::Skipped => "skipped",
5606            ListActionRunsQueryStatus::Blocked => "blocked",
5607        }
5608    }
5609}
5610#[derive(Debug, Clone, PartialEq, Default)]
5611pub struct RepoListActivityFeedsQuery {
5612    /// the date of the activities to be found
5613    pub date: Option<time::Date>,
5614}
5615
5616impl RepoListActivityFeedsQuery {
5617    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5618        let mut list = Vec::new();
5619        if let Some(date) = self.date {
5620            list.push((
5621                "date",
5622                date.format(&time::format_description::well_known::Rfc3339)
5623                    .unwrap(),
5624            ));
5625        }
5626
5627        list
5628    }
5629}
5630
5631#[derive(Debug, Clone, PartialEq, Default)]
5632pub struct RepoGetAllCommitsQuery {
5633    /// SHA or branch to start listing commits from (usually 'master')
5634    pub sha: Option<String>,
5635    /// filepath of a file/dir
5636    pub path: Option<String>,
5637    /// include diff stats for every commit (disable for speedup, default 'true')
5638    pub stat: Option<bool>,
5639    /// include verification for every commit (disable for speedup, default 'true')
5640    pub verification: Option<bool>,
5641    /// include a list of affected files for every commit (disable for speedup, default 'true')
5642    pub files: Option<bool>,
5643    /// commits that match the given specifier will not be listed.
5644    pub not: Option<String>,
5645}
5646
5647impl RepoGetAllCommitsQuery {
5648    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5649        let mut list = Vec::new();
5650        if let Some(sha) = self.sha {
5651            list.push(("sha", sha));
5652        }
5653        if let Some(path) = self.path {
5654            list.push(("path", path));
5655        }
5656        if let Some(stat) = self.stat {
5657            list.push(("stat", stat.to_string()));
5658        }
5659        if let Some(verification) = self.verification {
5660            list.push(("verification", verification.to_string()));
5661        }
5662        if let Some(files) = self.files {
5663            list.push(("files", files.to_string()));
5664        }
5665        if let Some(not) = self.not {
5666            list.push(("not", not));
5667        }
5668
5669        list
5670    }
5671}
5672
5673#[derive(Debug, Clone, PartialEq, Default)]
5674pub struct RepoListStatusesByRefQuery {
5675    /// type of sort
5676    pub sort: Option<RepoListStatusesByRefQuerySort>,
5677    /// type of state
5678    pub state: Option<RepoListStatusesByRefQueryState>,
5679}
5680
5681impl RepoListStatusesByRefQuery {
5682    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5683        let mut list = Vec::new();
5684        if let Some(sort) = self.sort {
5685            list.push(("sort", sort.as_str().to_string()));
5686        }
5687        if let Some(state) = self.state {
5688            list.push(("state", state.as_str().to_string()));
5689        }
5690
5691        list
5692    }
5693}
5694
5695#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5696pub enum RepoListStatusesByRefQuerySort {
5697    #[serde(rename = "oldest")]
5698    Oldest,
5699    #[serde(rename = "recentupdate")]
5700    Recentupdate,
5701    #[serde(rename = "leastupdate")]
5702    Leastupdate,
5703    #[serde(rename = "leastindex")]
5704    Leastindex,
5705    #[serde(rename = "highestindex")]
5706    Highestindex,
5707}
5708
5709impl RepoListStatusesByRefQuerySort {
5710    fn as_str(&self) -> &'static str {
5711        match self {
5712            RepoListStatusesByRefQuerySort::Oldest => "oldest",
5713            RepoListStatusesByRefQuerySort::Recentupdate => "recentupdate",
5714            RepoListStatusesByRefQuerySort::Leastupdate => "leastupdate",
5715            RepoListStatusesByRefQuerySort::Leastindex => "leastindex",
5716            RepoListStatusesByRefQuerySort::Highestindex => "highestindex",
5717        }
5718    }
5719}
5720
5721#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5722pub enum RepoListStatusesByRefQueryState {
5723    #[serde(rename = "pending")]
5724    Pending,
5725    #[serde(rename = "success")]
5726    Success,
5727    #[serde(rename = "error")]
5728    Error,
5729    #[serde(rename = "failure")]
5730    Failure,
5731    #[serde(rename = "warning")]
5732    Warning,
5733}
5734
5735impl RepoListStatusesByRefQueryState {
5736    fn as_str(&self) -> &'static str {
5737        match self {
5738            RepoListStatusesByRefQueryState::Pending => "pending",
5739            RepoListStatusesByRefQueryState::Success => "success",
5740            RepoListStatusesByRefQueryState::Error => "error",
5741            RepoListStatusesByRefQueryState::Failure => "failure",
5742            RepoListStatusesByRefQueryState::Warning => "warning",
5743        }
5744    }
5745}
5746#[derive(Debug, Clone, PartialEq, Default)]
5747pub struct RepoGetContentsListQuery {
5748    /// The name of the commit/branch/tag. Default the repository’s default branch (usually master)
5749    pub r#ref: Option<String>,
5750}
5751
5752impl RepoGetContentsListQuery {
5753    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5754        let mut list = Vec::new();
5755        if let Some(r#ref) = self.r#ref {
5756            list.push(("ref", r#ref));
5757        }
5758
5759        list
5760    }
5761}
5762
5763#[derive(Debug, Clone, PartialEq, Default)]
5764pub struct RepoGetContentsQuery {
5765    /// The name of the commit/branch/tag. Default the repository’s default branch (usually master)
5766    pub r#ref: Option<String>,
5767}
5768
5769impl RepoGetContentsQuery {
5770    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5771        let mut list = Vec::new();
5772        if let Some(r#ref) = self.r#ref {
5773            list.push(("ref", r#ref));
5774        }
5775
5776        list
5777    }
5778}
5779
5780#[derive(Debug, Clone, PartialEq, Default)]
5781pub struct RepoGetEditorConfigQuery {
5782    /// The name of the commit/branch/tag. Default the repository’s default branch (usually master)
5783    pub r#ref: Option<String>,
5784}
5785
5786impl RepoGetEditorConfigQuery {
5787    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5788        let mut list = Vec::new();
5789        if let Some(r#ref) = self.r#ref {
5790            list.push(("ref", r#ref));
5791        }
5792
5793        list
5794    }
5795}
5796
5797#[derive(Debug, Clone, PartialEq)]
5798pub struct GetBlobsQuery {
5799    /// a comma separated list of blob-sha (mind the overall URL-length limit of ~2,083 chars)
5800    pub shas: String,
5801}
5802
5803impl GetBlobsQuery {
5804    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5805        let mut list = Vec::new();
5806        let shas = self.shas;
5807        list.push(("shas", shas));
5808
5809        list
5810    }
5811}
5812
5813#[derive(Debug, Clone, PartialEq, Default)]
5814pub struct RepoGetSingleCommitQuery {
5815    /// include diff stats for every commit (disable for speedup, default 'true')
5816    pub stat: Option<bool>,
5817    /// include verification for every commit (disable for speedup, default 'true')
5818    pub verification: Option<bool>,
5819    /// include a list of affected files for every commit (disable for speedup, default 'true')
5820    pub files: Option<bool>,
5821}
5822
5823impl RepoGetSingleCommitQuery {
5824    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5825        let mut list = Vec::new();
5826        if let Some(stat) = self.stat {
5827            list.push(("stat", stat.to_string()));
5828        }
5829        if let Some(verification) = self.verification {
5830            list.push(("verification", verification.to_string()));
5831        }
5832        if let Some(files) = self.files {
5833            list.push(("files", files.to_string()));
5834        }
5835
5836        list
5837    }
5838}
5839
5840#[derive(Debug, Clone, PartialEq, Default)]
5841pub struct RepoGetNoteQuery {
5842    /// include verification for every commit (disable for speedup, default 'true')
5843    pub verification: Option<bool>,
5844    /// include a list of affected files for every commit (disable for speedup, default 'true')
5845    pub files: Option<bool>,
5846}
5847
5848impl RepoGetNoteQuery {
5849    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5850        let mut list = Vec::new();
5851        if let Some(verification) = self.verification {
5852            list.push(("verification", verification.to_string()));
5853        }
5854        if let Some(files) = self.files {
5855            list.push(("files", files.to_string()));
5856        }
5857
5858        list
5859    }
5860}
5861
5862#[derive(Debug, Clone, PartialEq, Default)]
5863pub struct GetTreeQuery {
5864    /// show all directories and files
5865    pub recursive: Option<bool>,
5866    /// number of items per page
5867    pub per_page: Option<u32>,
5868}
5869
5870impl GetTreeQuery {
5871    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5872        let mut list = Vec::new();
5873        if let Some(recursive) = self.recursive {
5874            list.push(("recursive", recursive.to_string()));
5875        }
5876        if let Some(per_page) = self.per_page {
5877            list.push(("per_page", per_page.to_string()));
5878        }
5879
5880        list
5881    }
5882}
5883
5884#[derive(Debug, Clone, PartialEq, Default)]
5885pub struct RepoTestHookQuery {
5886    /// The name of the commit/branch/tag, indicates which commit will be loaded to the webhook payload.
5887    pub r#ref: Option<String>,
5888}
5889
5890impl RepoTestHookQuery {
5891    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5892        let mut list = Vec::new();
5893        if let Some(r#ref) = self.r#ref {
5894            list.push(("ref", r#ref));
5895        }
5896
5897        list
5898    }
5899}
5900
5901#[derive(Debug, Clone, PartialEq, Default)]
5902pub struct IssueListIssuesQuery {
5903    /// whether issue is open or closed
5904    pub state: Option<IssueListIssuesQueryState>,
5905    /// comma separated list of labels. Fetch only issues that have any of this labels. Non existent labels are discarded
5906    pub labels: Option<String>,
5907    /// search string
5908    pub q: Option<String>,
5909    /// filter by type (issues / pulls) if set
5910    pub r#type: Option<IssueListIssuesQueryType>,
5911    /// 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
5912    pub milestones: Option<String>,
5913    /// Only show items updated after the given time. This is a timestamp in RFC 3339 format
5914    pub since: Option<time::OffsetDateTime>,
5915    /// Only show items updated before the given time. This is a timestamp in RFC 3339 format
5916    pub before: Option<time::OffsetDateTime>,
5917    /// Only show items which were created by the given user
5918    pub created_by: Option<String>,
5919    /// Only show items for which the given user is assigned
5920    pub assigned_by: Option<String>,
5921    /// Only show items in which the given user was mentioned
5922    pub mentioned_by: Option<String>,
5923    /// Type of sort
5924    pub sort: Option<IssueListIssuesQuerySort>,
5925}
5926
5927impl IssueListIssuesQuery {
5928    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
5929        let mut list = Vec::new();
5930        if let Some(state) = self.state {
5931            list.push(("state", state.as_str().to_string()));
5932        }
5933        if let Some(labels) = self.labels {
5934            list.push(("labels", labels));
5935        }
5936        if let Some(q) = self.q {
5937            list.push(("q", q));
5938        }
5939        if let Some(r#type) = self.r#type {
5940            list.push(("type", r#type.as_str().to_string()));
5941        }
5942        if let Some(milestones) = self.milestones {
5943            list.push(("milestones", milestones));
5944        }
5945        if let Some(since) = self.since {
5946            list.push((
5947                "since",
5948                since
5949                    .format(&time::format_description::well_known::Rfc3339)
5950                    .unwrap(),
5951            ));
5952        }
5953        if let Some(before) = self.before {
5954            list.push((
5955                "before",
5956                before
5957                    .format(&time::format_description::well_known::Rfc3339)
5958                    .unwrap(),
5959            ));
5960        }
5961        if let Some(created_by) = self.created_by {
5962            list.push(("created_by", created_by));
5963        }
5964        if let Some(assigned_by) = self.assigned_by {
5965            list.push(("assigned_by", assigned_by));
5966        }
5967        if let Some(mentioned_by) = self.mentioned_by {
5968            list.push(("mentioned_by", mentioned_by));
5969        }
5970        if let Some(sort) = self.sort {
5971            list.push(("sort", sort.as_str().to_string()));
5972        }
5973
5974        list
5975    }
5976}
5977
5978#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5979pub enum IssueListIssuesQueryState {
5980    #[serde(rename = "closed")]
5981    Closed,
5982    #[serde(rename = "open")]
5983    Open,
5984    #[serde(rename = "all")]
5985    All,
5986}
5987
5988impl IssueListIssuesQueryState {
5989    fn as_str(&self) -> &'static str {
5990        match self {
5991            IssueListIssuesQueryState::Closed => "closed",
5992            IssueListIssuesQueryState::Open => "open",
5993            IssueListIssuesQueryState::All => "all",
5994        }
5995    }
5996}
5997
5998#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
5999pub enum IssueListIssuesQueryType {
6000    #[serde(rename = "issues")]
6001    Issues,
6002    #[serde(rename = "pulls")]
6003    Pulls,
6004}
6005
6006impl IssueListIssuesQueryType {
6007    fn as_str(&self) -> &'static str {
6008        match self {
6009            IssueListIssuesQueryType::Issues => "issues",
6010            IssueListIssuesQueryType::Pulls => "pulls",
6011        }
6012    }
6013}
6014
6015#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6016pub enum IssueListIssuesQuerySort {
6017    #[serde(rename = "relevance")]
6018    Relevance,
6019    #[serde(rename = "latest")]
6020    Latest,
6021    #[serde(rename = "oldest")]
6022    Oldest,
6023    #[serde(rename = "recentupdate")]
6024    Recentupdate,
6025    #[serde(rename = "leastupdate")]
6026    Leastupdate,
6027    #[serde(rename = "mostcomment")]
6028    Mostcomment,
6029    #[serde(rename = "leastcomment")]
6030    Leastcomment,
6031    #[serde(rename = "nearduedate")]
6032    Nearduedate,
6033    #[serde(rename = "farduedate")]
6034    Farduedate,
6035}
6036
6037impl IssueListIssuesQuerySort {
6038    fn as_str(&self) -> &'static str {
6039        match self {
6040            IssueListIssuesQuerySort::Relevance => "relevance",
6041            IssueListIssuesQuerySort::Latest => "latest",
6042            IssueListIssuesQuerySort::Oldest => "oldest",
6043            IssueListIssuesQuerySort::Recentupdate => "recentupdate",
6044            IssueListIssuesQuerySort::Leastupdate => "leastupdate",
6045            IssueListIssuesQuerySort::Mostcomment => "mostcomment",
6046            IssueListIssuesQuerySort::Leastcomment => "leastcomment",
6047            IssueListIssuesQuerySort::Nearduedate => "nearduedate",
6048            IssueListIssuesQuerySort::Farduedate => "farduedate",
6049        }
6050    }
6051}
6052#[derive(Debug, Clone, PartialEq, Default)]
6053pub struct IssueGetRepoCommentsQuery {
6054    /// if provided, only comments updated since the provided time are returned.
6055    pub since: Option<time::OffsetDateTime>,
6056    /// if provided, only comments updated before the provided time are returned.
6057    pub before: Option<time::OffsetDateTime>,
6058}
6059
6060impl IssueGetRepoCommentsQuery {
6061    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6062        let mut list = Vec::new();
6063        if let Some(since) = self.since {
6064            list.push((
6065                "since",
6066                since
6067                    .format(&time::format_description::well_known::Rfc3339)
6068                    .unwrap(),
6069            ));
6070        }
6071        if let Some(before) = self.before {
6072            list.push((
6073                "before",
6074                before
6075                    .format(&time::format_description::well_known::Rfc3339)
6076                    .unwrap(),
6077            ));
6078        }
6079
6080        list
6081    }
6082}
6083
6084#[derive(Debug, Clone, PartialEq, Default)]
6085pub struct IssueCreateIssueCommentAttachmentQuery {
6086    /// name of the attachment
6087    pub name: Option<String>,
6088    /// time of the attachment's creation. This is a timestamp in RFC 3339 format
6089    pub updated_at: Option<time::OffsetDateTime>,
6090}
6091
6092impl IssueCreateIssueCommentAttachmentQuery {
6093    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6094        let mut list = Vec::new();
6095        if let Some(name) = self.name {
6096            list.push(("name", name));
6097        }
6098        if let Some(updated_at) = self.updated_at {
6099            list.push((
6100                "updated_at",
6101                updated_at
6102                    .format(&time::format_description::well_known::Rfc3339)
6103                    .unwrap(),
6104            ));
6105        }
6106
6107        list
6108    }
6109}
6110
6111#[derive(Debug, Clone, PartialEq, Default)]
6112pub struct IssueCreateIssueAttachmentQuery {
6113    /// name of the attachment
6114    pub name: Option<String>,
6115    /// time of the attachment's creation. This is a timestamp in RFC 3339 format
6116    pub updated_at: Option<time::OffsetDateTime>,
6117}
6118
6119impl IssueCreateIssueAttachmentQuery {
6120    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6121        let mut list = Vec::new();
6122        if let Some(name) = self.name {
6123            list.push(("name", name));
6124        }
6125        if let Some(updated_at) = self.updated_at {
6126            list.push((
6127                "updated_at",
6128                updated_at
6129                    .format(&time::format_description::well_known::Rfc3339)
6130                    .unwrap(),
6131            ));
6132        }
6133
6134        list
6135    }
6136}
6137
6138#[derive(Debug, Clone, PartialEq, Default)]
6139pub struct IssueGetCommentsQuery {
6140    /// if provided, only comments updated since the specified time are returned.
6141    pub since: Option<time::OffsetDateTime>,
6142    /// if provided, only comments updated before the provided time are returned.
6143    pub before: Option<time::OffsetDateTime>,
6144}
6145
6146impl IssueGetCommentsQuery {
6147    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6148        let mut list = Vec::new();
6149        if let Some(since) = self.since {
6150            list.push((
6151                "since",
6152                since
6153                    .format(&time::format_description::well_known::Rfc3339)
6154                    .unwrap(),
6155            ));
6156        }
6157        if let Some(before) = self.before {
6158            list.push((
6159                "before",
6160                before
6161                    .format(&time::format_description::well_known::Rfc3339)
6162                    .unwrap(),
6163            ));
6164        }
6165
6166        list
6167    }
6168}
6169
6170#[derive(Debug, Clone, PartialEq, Default)]
6171pub struct IssueGetCommentsAndTimelineQuery {
6172    /// if provided, only comments updated since the specified time are returned.
6173    pub since: Option<time::OffsetDateTime>,
6174    /// if provided, only comments updated before the provided time are returned.
6175    pub before: Option<time::OffsetDateTime>,
6176}
6177
6178impl IssueGetCommentsAndTimelineQuery {
6179    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6180        let mut list = Vec::new();
6181        if let Some(since) = self.since {
6182            list.push((
6183                "since",
6184                since
6185                    .format(&time::format_description::well_known::Rfc3339)
6186                    .unwrap(),
6187            ));
6188        }
6189        if let Some(before) = self.before {
6190            list.push((
6191                "before",
6192                before
6193                    .format(&time::format_description::well_known::Rfc3339)
6194                    .unwrap(),
6195            ));
6196        }
6197
6198        list
6199    }
6200}
6201
6202#[derive(Debug, Clone, PartialEq, Default)]
6203pub struct IssueTrackedTimesQuery {
6204    /// optional filter by user (available for issue managers)
6205    pub user: Option<String>,
6206    /// Only show times updated after the given time. This is a timestamp in RFC 3339 format
6207    pub since: Option<time::OffsetDateTime>,
6208    /// Only show times updated before the given time. This is a timestamp in RFC 3339 format
6209    pub before: Option<time::OffsetDateTime>,
6210}
6211
6212impl IssueTrackedTimesQuery {
6213    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6214        let mut list = Vec::new();
6215        if let Some(user) = self.user {
6216            list.push(("user", user));
6217        }
6218        if let Some(since) = self.since {
6219            list.push((
6220                "since",
6221                since
6222                    .format(&time::format_description::well_known::Rfc3339)
6223                    .unwrap(),
6224            ));
6225        }
6226        if let Some(before) = self.before {
6227            list.push((
6228                "before",
6229                before
6230                    .format(&time::format_description::well_known::Rfc3339)
6231                    .unwrap(),
6232            ));
6233        }
6234
6235        list
6236    }
6237}
6238
6239#[derive(Debug, Clone, PartialEq, Default)]
6240pub struct RepoListKeysQuery {
6241    /// the key_id to search for
6242    pub key_id: Option<u32>,
6243    /// fingerprint of the key
6244    pub fingerprint: Option<String>,
6245}
6246
6247impl RepoListKeysQuery {
6248    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6249        let mut list = Vec::new();
6250        if let Some(key_id) = self.key_id {
6251            list.push(("key_id", key_id.to_string()));
6252        }
6253        if let Some(fingerprint) = self.fingerprint {
6254            list.push(("fingerprint", fingerprint));
6255        }
6256
6257        list
6258    }
6259}
6260
6261#[derive(Debug, Clone, PartialEq, Default)]
6262pub struct IssueListLabelsQuery {
6263    /// Specifies the sorting method: mostissues, leastissues, or reversealphabetically.
6264    pub sort: Option<IssueListLabelsQuerySort>,
6265}
6266
6267impl IssueListLabelsQuery {
6268    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6269        let mut list = Vec::new();
6270        if let Some(sort) = self.sort {
6271            list.push(("sort", sort.as_str().to_string()));
6272        }
6273
6274        list
6275    }
6276}
6277
6278#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6279pub enum IssueListLabelsQuerySort {
6280    #[serde(rename = "mostissues")]
6281    Mostissues,
6282    #[serde(rename = "leastissues")]
6283    Leastissues,
6284    #[serde(rename = "reversealphabetically")]
6285    Reversealphabetically,
6286}
6287
6288impl IssueListLabelsQuerySort {
6289    fn as_str(&self) -> &'static str {
6290        match self {
6291            IssueListLabelsQuerySort::Mostissues => "mostissues",
6292            IssueListLabelsQuerySort::Leastissues => "leastissues",
6293            IssueListLabelsQuerySort::Reversealphabetically => "reversealphabetically",
6294        }
6295    }
6296}
6297#[derive(Debug, Clone, PartialEq, Default)]
6298pub struct RepoGetRawFileOrLfsQuery {
6299    /// The name of the commit/branch/tag. Default the repository’s default branch (usually master)
6300    pub r#ref: Option<String>,
6301}
6302
6303impl RepoGetRawFileOrLfsQuery {
6304    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6305        let mut list = Vec::new();
6306        if let Some(r#ref) = self.r#ref {
6307            list.push(("ref", r#ref));
6308        }
6309
6310        list
6311    }
6312}
6313
6314#[derive(Debug, Clone, PartialEq, Default)]
6315pub struct IssueGetMilestonesListQuery {
6316    /// Milestone state, Recognized values are open, closed and all. Defaults to "open"
6317    pub state: Option<String>,
6318    /// filter by milestone name
6319    pub name: Option<String>,
6320}
6321
6322impl IssueGetMilestonesListQuery {
6323    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6324        let mut list = Vec::new();
6325        if let Some(state) = self.state {
6326            list.push(("state", state));
6327        }
6328        if let Some(name) = self.name {
6329            list.push(("name", name));
6330        }
6331
6332        list
6333    }
6334}
6335
6336#[derive(Debug, Clone, PartialEq, Default)]
6337pub struct NotifyGetRepoListQuery {
6338    /// If true, show notifications marked as read. Default value is false
6339    pub all: Option<bool>,
6340    /// Show notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread & pinned
6341    pub status_types: Option<Vec<String>>,
6342    /// filter notifications by subject type
6343    pub subject_type: Option<Vec<NotifyGetRepoListQuerySubjectType>>,
6344    /// Only show notifications updated after the given time. This is a timestamp in RFC 3339 format
6345    pub since: Option<time::OffsetDateTime>,
6346    /// Only show notifications updated before the given time. This is a timestamp in RFC 3339 format
6347    pub before: Option<time::OffsetDateTime>,
6348}
6349
6350impl NotifyGetRepoListQuery {
6351    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6352        let mut list = Vec::new();
6353        if let Some(all) = self.all {
6354            list.push(("all", all.to_string()));
6355        }
6356        if let Some(status_types) = self.status_types {
6357            if !status_types.is_empty() {
6358                for item in status_types {
6359                    list.push(("status-types", item.to_string()));
6360                }
6361            }
6362        }
6363        if let Some(subject_type) = self.subject_type {
6364            if !subject_type.is_empty() {
6365                for item in subject_type {
6366                    list.push(("subject-type", item.as_str().to_string()));
6367                }
6368            }
6369        }
6370        if let Some(since) = self.since {
6371            list.push((
6372                "since",
6373                since
6374                    .format(&time::format_description::well_known::Rfc3339)
6375                    .unwrap(),
6376            ));
6377        }
6378        if let Some(before) = self.before {
6379            list.push((
6380                "before",
6381                before
6382                    .format(&time::format_description::well_known::Rfc3339)
6383                    .unwrap(),
6384            ));
6385        }
6386
6387        list
6388    }
6389}
6390
6391#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6392pub enum NotifyGetRepoListQuerySubjectType {
6393    #[serde(rename = "issue")]
6394    Issue,
6395    #[serde(rename = "pull")]
6396    Pull,
6397    #[serde(rename = "repository")]
6398    Repository,
6399}
6400
6401impl NotifyGetRepoListQuerySubjectType {
6402    fn as_str(&self) -> &'static str {
6403        match self {
6404            NotifyGetRepoListQuerySubjectType::Issue => "issue",
6405            NotifyGetRepoListQuerySubjectType::Pull => "pull",
6406            NotifyGetRepoListQuerySubjectType::Repository => "repository",
6407        }
6408    }
6409}
6410#[derive(Debug, Clone, PartialEq, Default)]
6411pub struct NotifyReadRepoListQuery {
6412    /// If true, mark all notifications on this repo. Default value is false
6413    pub all: Option<bool>,
6414    /// Mark notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread.
6415    pub status_types: Option<Vec<String>>,
6416    /// Status to mark notifications as. Defaults to read.
6417    pub to_status: Option<String>,
6418    /// Describes the last point that notifications were checked. Anything updated since this time will not be updated.
6419    pub last_read_at: Option<time::OffsetDateTime>,
6420}
6421
6422impl NotifyReadRepoListQuery {
6423    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6424        let mut list = Vec::new();
6425        if let Some(all) = self.all {
6426            list.push(("all", all.to_string()));
6427        }
6428        if let Some(status_types) = self.status_types {
6429            if !status_types.is_empty() {
6430                for item in status_types {
6431                    list.push(("status-types", item.to_string()));
6432                }
6433            }
6434        }
6435        if let Some(to_status) = self.to_status {
6436            list.push(("to-status", to_status));
6437        }
6438        if let Some(last_read_at) = self.last_read_at {
6439            list.push((
6440                "last_read_at",
6441                last_read_at
6442                    .format(&time::format_description::well_known::Rfc3339)
6443                    .unwrap(),
6444            ));
6445        }
6446
6447        list
6448    }
6449}
6450
6451#[derive(Debug, Clone, PartialEq, Default)]
6452pub struct RepoListPullRequestsQuery {
6453    /// State of pull request
6454    pub state: Option<RepoListPullRequestsQueryState>,
6455    /// Type of sort
6456    pub sort: Option<RepoListPullRequestsQuerySort>,
6457    /// ID of the milestone
6458    pub milestone: Option<i64>,
6459    /// Label IDs
6460    pub labels: Option<Vec<i64>>,
6461    /// Filter by pull request author
6462    pub poster: Option<String>,
6463}
6464
6465impl RepoListPullRequestsQuery {
6466    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6467        let mut list = Vec::new();
6468        if let Some(state) = self.state {
6469            list.push(("state", state.as_str().to_string()));
6470        }
6471        if let Some(sort) = self.sort {
6472            list.push(("sort", sort.as_str().to_string()));
6473        }
6474        if let Some(milestone) = self.milestone {
6475            list.push(("milestone", milestone.to_string()));
6476        }
6477        if let Some(labels) = self.labels {
6478            if !labels.is_empty() {
6479                for item in labels {
6480                    list.push(("labels", format!("{item}")));
6481                }
6482            }
6483        }
6484        if let Some(poster) = self.poster {
6485            list.push(("poster", poster));
6486        }
6487
6488        list
6489    }
6490}
6491
6492#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6493pub enum RepoListPullRequestsQueryState {
6494    #[serde(rename = "open")]
6495    Open,
6496    #[serde(rename = "closed")]
6497    Closed,
6498    #[serde(rename = "all")]
6499    All,
6500}
6501
6502impl RepoListPullRequestsQueryState {
6503    fn as_str(&self) -> &'static str {
6504        match self {
6505            RepoListPullRequestsQueryState::Open => "open",
6506            RepoListPullRequestsQueryState::Closed => "closed",
6507            RepoListPullRequestsQueryState::All => "all",
6508        }
6509    }
6510}
6511
6512#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6513pub enum RepoListPullRequestsQuerySort {
6514    #[serde(rename = "oldest")]
6515    Oldest,
6516    #[serde(rename = "recentupdate")]
6517    Recentupdate,
6518    #[serde(rename = "recentclose")]
6519    Recentclose,
6520    #[serde(rename = "leastupdate")]
6521    Leastupdate,
6522    #[serde(rename = "mostcomment")]
6523    Mostcomment,
6524    #[serde(rename = "leastcomment")]
6525    Leastcomment,
6526    #[serde(rename = "priority")]
6527    Priority,
6528}
6529
6530impl RepoListPullRequestsQuerySort {
6531    fn as_str(&self) -> &'static str {
6532        match self {
6533            RepoListPullRequestsQuerySort::Oldest => "oldest",
6534            RepoListPullRequestsQuerySort::Recentupdate => "recentupdate",
6535            RepoListPullRequestsQuerySort::Recentclose => "recentclose",
6536            RepoListPullRequestsQuerySort::Leastupdate => "leastupdate",
6537            RepoListPullRequestsQuerySort::Mostcomment => "mostcomment",
6538            RepoListPullRequestsQuerySort::Leastcomment => "leastcomment",
6539            RepoListPullRequestsQuerySort::Priority => "priority",
6540        }
6541    }
6542}
6543#[derive(Debug, Clone, PartialEq, Default)]
6544pub struct RepoDownloadPullDiffOrPatchQuery {
6545    /// whether to include binary file changes. if true, the diff is applicable with `git apply`
6546    pub binary: Option<bool>,
6547}
6548
6549impl RepoDownloadPullDiffOrPatchQuery {
6550    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6551        let mut list = Vec::new();
6552        if let Some(binary) = self.binary {
6553            list.push(("binary", binary.to_string()));
6554        }
6555
6556        list
6557    }
6558}
6559
6560#[derive(Debug, Clone, PartialEq, Default)]
6561pub struct RepoGetPullRequestCommitsQuery {
6562    /// include verification for every commit (disable for speedup, default 'true')
6563    pub verification: Option<bool>,
6564    /// include a list of affected files for every commit (disable for speedup, default 'true')
6565    pub files: Option<bool>,
6566}
6567
6568impl RepoGetPullRequestCommitsQuery {
6569    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6570        let mut list = Vec::new();
6571        if let Some(verification) = self.verification {
6572            list.push(("verification", verification.to_string()));
6573        }
6574        if let Some(files) = self.files {
6575            list.push(("files", files.to_string()));
6576        }
6577
6578        list
6579    }
6580}
6581
6582#[derive(Debug, Clone, PartialEq, Default)]
6583pub struct RepoGetPullRequestFilesQuery {
6584    /// skip to given file
6585    pub skip_to: Option<String>,
6586    /// whitespace behavior
6587    pub whitespace: Option<RepoGetPullRequestFilesQueryWhitespace>,
6588}
6589
6590impl RepoGetPullRequestFilesQuery {
6591    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6592        let mut list = Vec::new();
6593        if let Some(skip_to) = self.skip_to {
6594            list.push(("skip-to", skip_to));
6595        }
6596        if let Some(whitespace) = self.whitespace {
6597            list.push(("whitespace", whitespace.as_str().to_string()));
6598        }
6599
6600        list
6601    }
6602}
6603
6604#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6605pub enum RepoGetPullRequestFilesQueryWhitespace {
6606    #[serde(rename = "ignore-all")]
6607    IgnoreAll,
6608    #[serde(rename = "ignore-change")]
6609    IgnoreChange,
6610    #[serde(rename = "ignore-eol")]
6611    IgnoreEol,
6612    #[serde(rename = "show-all")]
6613    ShowAll,
6614}
6615
6616impl RepoGetPullRequestFilesQueryWhitespace {
6617    fn as_str(&self) -> &'static str {
6618        match self {
6619            RepoGetPullRequestFilesQueryWhitespace::IgnoreAll => "ignore-all",
6620            RepoGetPullRequestFilesQueryWhitespace::IgnoreChange => "ignore-change",
6621            RepoGetPullRequestFilesQueryWhitespace::IgnoreEol => "ignore-eol",
6622            RepoGetPullRequestFilesQueryWhitespace::ShowAll => "show-all",
6623        }
6624    }
6625}
6626#[derive(Debug, Clone, PartialEq, Default)]
6627pub struct RepoUpdatePullRequestQuery {
6628    /// how to update pull request
6629    pub style: Option<RepoUpdatePullRequestQueryStyle>,
6630}
6631
6632impl RepoUpdatePullRequestQuery {
6633    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6634        let mut list = Vec::new();
6635        if let Some(style) = self.style {
6636            list.push(("style", style.as_str().to_string()));
6637        }
6638
6639        list
6640    }
6641}
6642
6643#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6644pub enum RepoUpdatePullRequestQueryStyle {
6645    #[serde(rename = "merge")]
6646    Merge,
6647    #[serde(rename = "rebase")]
6648    Rebase,
6649}
6650
6651impl RepoUpdatePullRequestQueryStyle {
6652    fn as_str(&self) -> &'static str {
6653        match self {
6654            RepoUpdatePullRequestQueryStyle::Merge => "merge",
6655            RepoUpdatePullRequestQueryStyle::Rebase => "rebase",
6656        }
6657    }
6658}
6659#[derive(Debug, Clone, PartialEq, Default)]
6660pub struct RepoGetRawFileQuery {
6661    /// The name of the commit/branch/tag. Default the repository’s default branch (usually master)
6662    pub r#ref: Option<String>,
6663}
6664
6665impl RepoGetRawFileQuery {
6666    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6667        let mut list = Vec::new();
6668        if let Some(r#ref) = self.r#ref {
6669            list.push(("ref", r#ref));
6670        }
6671
6672        list
6673    }
6674}
6675
6676#[derive(Debug, Clone, PartialEq, Default)]
6677pub struct RepoListReleasesQuery {
6678    /// filter (exclude / include) drafts, if you dont have repo write access none will show
6679    pub draft: Option<bool>,
6680    /// filter (exclude / include) pre-releases
6681    pub pre_release: Option<bool>,
6682    /// Search string
6683    pub q: Option<String>,
6684}
6685
6686impl RepoListReleasesQuery {
6687    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6688        let mut list = Vec::new();
6689        if let Some(draft) = self.draft {
6690            list.push(("draft", draft.to_string()));
6691        }
6692        if let Some(pre_release) = self.pre_release {
6693            list.push(("pre-release", pre_release.to_string()));
6694        }
6695        if let Some(q) = self.q {
6696            list.push(("q", q));
6697        }
6698
6699        list
6700    }
6701}
6702
6703#[derive(Debug, Clone, PartialEq, Default)]
6704pub struct RepoCreateReleaseAttachmentQuery {
6705    /// name of the attachment
6706    pub name: Option<String>,
6707}
6708
6709impl RepoCreateReleaseAttachmentQuery {
6710    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6711        let mut list = Vec::new();
6712        if let Some(name) = self.name {
6713            list.push(("name", name));
6714        }
6715
6716        list
6717    }
6718}
6719
6720#[derive(Debug, Clone, PartialEq, Default)]
6721pub struct RepoListStatusesQuery {
6722    /// type of sort
6723    pub sort: Option<RepoListStatusesQuerySort>,
6724    /// type of state
6725    pub state: Option<RepoListStatusesQueryState>,
6726}
6727
6728impl RepoListStatusesQuery {
6729    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6730        let mut list = Vec::new();
6731        if let Some(sort) = self.sort {
6732            list.push(("sort", sort.as_str().to_string()));
6733        }
6734        if let Some(state) = self.state {
6735            list.push(("state", state.as_str().to_string()));
6736        }
6737
6738        list
6739    }
6740}
6741
6742#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6743pub enum RepoListStatusesQuerySort {
6744    #[serde(rename = "oldest")]
6745    Oldest,
6746    #[serde(rename = "recentupdate")]
6747    Recentupdate,
6748    #[serde(rename = "leastupdate")]
6749    Leastupdate,
6750    #[serde(rename = "leastindex")]
6751    Leastindex,
6752    #[serde(rename = "highestindex")]
6753    Highestindex,
6754}
6755
6756impl RepoListStatusesQuerySort {
6757    fn as_str(&self) -> &'static str {
6758        match self {
6759            RepoListStatusesQuerySort::Oldest => "oldest",
6760            RepoListStatusesQuerySort::Recentupdate => "recentupdate",
6761            RepoListStatusesQuerySort::Leastupdate => "leastupdate",
6762            RepoListStatusesQuerySort::Leastindex => "leastindex",
6763            RepoListStatusesQuerySort::Highestindex => "highestindex",
6764        }
6765    }
6766}
6767
6768#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6769pub enum RepoListStatusesQueryState {
6770    #[serde(rename = "pending")]
6771    Pending,
6772    #[serde(rename = "success")]
6773    Success,
6774    #[serde(rename = "error")]
6775    Error,
6776    #[serde(rename = "failure")]
6777    Failure,
6778    #[serde(rename = "warning")]
6779    Warning,
6780}
6781
6782impl RepoListStatusesQueryState {
6783    fn as_str(&self) -> &'static str {
6784        match self {
6785            RepoListStatusesQueryState::Pending => "pending",
6786            RepoListStatusesQueryState::Success => "success",
6787            RepoListStatusesQueryState::Error => "error",
6788            RepoListStatusesQueryState::Failure => "failure",
6789            RepoListStatusesQueryState::Warning => "warning",
6790        }
6791    }
6792}
6793#[derive(Debug, Clone, PartialEq, Default)]
6794pub struct RepoTrackedTimesQuery {
6795    /// optional filter by user (available for issue managers)
6796    pub user: Option<String>,
6797    /// Only show times updated after the given time. This is a timestamp in RFC 3339 format
6798    pub since: Option<time::OffsetDateTime>,
6799    /// Only show times updated before the given time. This is a timestamp in RFC 3339 format
6800    pub before: Option<time::OffsetDateTime>,
6801}
6802
6803impl RepoTrackedTimesQuery {
6804    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6805        let mut list = Vec::new();
6806        if let Some(user) = self.user {
6807            list.push(("user", user));
6808        }
6809        if let Some(since) = self.since {
6810            list.push((
6811                "since",
6812                since
6813                    .format(&time::format_description::well_known::Rfc3339)
6814                    .unwrap(),
6815            ));
6816        }
6817        if let Some(before) = self.before {
6818            list.push((
6819                "before",
6820                before
6821                    .format(&time::format_description::well_known::Rfc3339)
6822                    .unwrap(),
6823            ));
6824        }
6825
6826        list
6827    }
6828}
6829
6830#[derive(Debug, Clone, PartialEq, Default)]
6831pub struct OrgListTeamActivityFeedsQuery {
6832    /// the date of the activities to be found
6833    pub date: Option<time::Date>,
6834}
6835
6836impl OrgListTeamActivityFeedsQuery {
6837    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6838        let mut list = Vec::new();
6839        if let Some(date) = self.date {
6840            list.push((
6841                "date",
6842                date.format(&time::format_description::well_known::Rfc3339)
6843                    .unwrap(),
6844            ));
6845        }
6846
6847        list
6848    }
6849}
6850
6851#[derive(Debug, Clone, PartialEq)]
6852pub struct TopicSearchQuery {
6853    /// keyword to search for
6854    pub q: String,
6855}
6856
6857impl TopicSearchQuery {
6858    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6859        let mut list = Vec::new();
6860        let q = self.q;
6861        list.push(("q", q));
6862
6863        list
6864    }
6865}
6866#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
6867pub struct TopicSearchResults {
6868    pub topics: Option<Vec<TopicResponse>>,
6869}
6870
6871impl_from_response!(TopicSearchResults);
6872
6873#[derive(Debug, Clone, PartialEq, Default)]
6874pub struct UserSearchRunJobsQuery {
6875    /// a comma separated list of run job labels to search for
6876    pub labels: Option<String>,
6877}
6878
6879impl UserSearchRunJobsQuery {
6880    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6881        let mut list = Vec::new();
6882        if let Some(labels) = self.labels {
6883            list.push(("labels", labels));
6884        }
6885
6886        list
6887    }
6888}
6889
6890#[derive(Debug, Clone, PartialEq, Default)]
6891pub struct UserCurrentListKeysQuery {
6892    /// fingerprint of the key
6893    pub fingerprint: Option<String>,
6894}
6895
6896impl UserCurrentListKeysQuery {
6897    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6898        let mut list = Vec::new();
6899        if let Some(fingerprint) = self.fingerprint {
6900            list.push(("fingerprint", fingerprint));
6901        }
6902
6903        list
6904    }
6905}
6906
6907#[derive(Debug, Clone, PartialEq)]
6908pub struct UserCheckQuotaQuery {
6909    /// subject of the quota
6910    pub subject: String,
6911}
6912
6913impl UserCheckQuotaQuery {
6914    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6915        let mut list = Vec::new();
6916        let subject = self.subject;
6917        list.push(("subject", subject));
6918
6919        list
6920    }
6921}
6922
6923#[derive(Debug, Clone, PartialEq, Default)]
6924pub struct UserCurrentListReposQuery {
6925    /// order the repositories
6926    pub order_by: Option<UserCurrentListReposQueryOrderBy>,
6927}
6928
6929impl UserCurrentListReposQuery {
6930    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
6931        let mut list = Vec::new();
6932        if let Some(order_by) = self.order_by {
6933            list.push(("order_by", order_by.as_str().to_string()));
6934        }
6935
6936        list
6937    }
6938}
6939
6940#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6941pub enum UserCurrentListReposQueryOrderBy {
6942    #[serde(rename = "name")]
6943    Name,
6944    #[serde(rename = "id")]
6945    Id,
6946    #[serde(rename = "newest")]
6947    Newest,
6948    #[serde(rename = "oldest")]
6949    Oldest,
6950    #[serde(rename = "recentupdate")]
6951    Recentupdate,
6952    #[serde(rename = "leastupdate")]
6953    Leastupdate,
6954    #[serde(rename = "reversealphabetically")]
6955    Reversealphabetically,
6956    #[serde(rename = "alphabetically")]
6957    Alphabetically,
6958    #[serde(rename = "reversesize")]
6959    Reversesize,
6960    #[serde(rename = "size")]
6961    Size,
6962    #[serde(rename = "reversegitsize")]
6963    Reversegitsize,
6964    #[serde(rename = "gitsize")]
6965    Gitsize,
6966    #[serde(rename = "reverselfssize")]
6967    Reverselfssize,
6968    #[serde(rename = "lfssize")]
6969    Lfssize,
6970    #[serde(rename = "moststars")]
6971    Moststars,
6972    #[serde(rename = "feweststars")]
6973    Feweststars,
6974    #[serde(rename = "mostforks")]
6975    Mostforks,
6976    #[serde(rename = "fewestforks")]
6977    Fewestforks,
6978}
6979
6980impl UserCurrentListReposQueryOrderBy {
6981    fn as_str(&self) -> &'static str {
6982        match self {
6983            UserCurrentListReposQueryOrderBy::Name => "name",
6984            UserCurrentListReposQueryOrderBy::Id => "id",
6985            UserCurrentListReposQueryOrderBy::Newest => "newest",
6986            UserCurrentListReposQueryOrderBy::Oldest => "oldest",
6987            UserCurrentListReposQueryOrderBy::Recentupdate => "recentupdate",
6988            UserCurrentListReposQueryOrderBy::Leastupdate => "leastupdate",
6989            UserCurrentListReposQueryOrderBy::Reversealphabetically => "reversealphabetically",
6990            UserCurrentListReposQueryOrderBy::Alphabetically => "alphabetically",
6991            UserCurrentListReposQueryOrderBy::Reversesize => "reversesize",
6992            UserCurrentListReposQueryOrderBy::Size => "size",
6993            UserCurrentListReposQueryOrderBy::Reversegitsize => "reversegitsize",
6994            UserCurrentListReposQueryOrderBy::Gitsize => "gitsize",
6995            UserCurrentListReposQueryOrderBy::Reverselfssize => "reverselfssize",
6996            UserCurrentListReposQueryOrderBy::Lfssize => "lfssize",
6997            UserCurrentListReposQueryOrderBy::Moststars => "moststars",
6998            UserCurrentListReposQueryOrderBy::Feweststars => "feweststars",
6999            UserCurrentListReposQueryOrderBy::Mostforks => "mostforks",
7000            UserCurrentListReposQueryOrderBy::Fewestforks => "fewestforks",
7001        }
7002    }
7003}
7004#[derive(Debug, Clone, PartialEq, Default)]
7005pub struct UserCurrentTrackedTimesQuery {
7006    /// Only show times updated after the given time. This is a timestamp in RFC 3339 format
7007    pub since: Option<time::OffsetDateTime>,
7008    /// Only show times updated before the given time. This is a timestamp in RFC 3339 format
7009    pub before: Option<time::OffsetDateTime>,
7010}
7011
7012impl UserCurrentTrackedTimesQuery {
7013    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
7014        let mut list = Vec::new();
7015        if let Some(since) = self.since {
7016            list.push((
7017                "since",
7018                since
7019                    .format(&time::format_description::well_known::Rfc3339)
7020                    .unwrap(),
7021            ));
7022        }
7023        if let Some(before) = self.before {
7024            list.push((
7025                "before",
7026                before
7027                    .format(&time::format_description::well_known::Rfc3339)
7028                    .unwrap(),
7029            ));
7030        }
7031
7032        list
7033    }
7034}
7035
7036#[derive(Debug, Clone, PartialEq, Default)]
7037pub struct UserSearchQuery {
7038    /// keyword
7039    pub q: Option<String>,
7040    /// ID of the user to search for
7041    pub uid: Option<i64>,
7042    /// sort order of results
7043    pub sort: Option<UserSearchQuerySort>,
7044}
7045
7046impl UserSearchQuery {
7047    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
7048        let mut list = Vec::new();
7049        if let Some(q) = self.q {
7050            list.push(("q", q));
7051        }
7052        if let Some(uid) = self.uid {
7053            list.push(("uid", uid.to_string()));
7054        }
7055        if let Some(sort) = self.sort {
7056            list.push(("sort", sort.as_str().to_string()));
7057        }
7058
7059        list
7060    }
7061}
7062
7063#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
7064pub enum UserSearchQuerySort {
7065    #[serde(rename = "oldest")]
7066    Oldest,
7067    #[serde(rename = "newest")]
7068    Newest,
7069    #[serde(rename = "alphabetically")]
7070    Alphabetically,
7071    #[serde(rename = "reversealphabetically")]
7072    Reversealphabetically,
7073    #[serde(rename = "recentupdate")]
7074    Recentupdate,
7075    #[serde(rename = "leastupdate")]
7076    Leastupdate,
7077}
7078
7079impl UserSearchQuerySort {
7080    fn as_str(&self) -> &'static str {
7081        match self {
7082            UserSearchQuerySort::Oldest => "oldest",
7083            UserSearchQuerySort::Newest => "newest",
7084            UserSearchQuerySort::Alphabetically => "alphabetically",
7085            UserSearchQuerySort::Reversealphabetically => "reversealphabetically",
7086            UserSearchQuerySort::Recentupdate => "recentupdate",
7087            UserSearchQuerySort::Leastupdate => "leastupdate",
7088        }
7089    }
7090}
7091#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
7092pub struct UserSearchResults {
7093    pub data: Option<Vec<User>>,
7094    pub ok: Option<bool>,
7095}
7096
7097impl_from_response!(UserSearchResults);
7098
7099#[derive(Debug, Clone, PartialEq, Default)]
7100pub struct UserListActivityFeedsQuery {
7101    /// if true, only show actions performed by the requested user
7102    pub only_performed_by: Option<bool>,
7103    /// the date of the activities to be found
7104    pub date: Option<time::Date>,
7105}
7106
7107impl UserListActivityFeedsQuery {
7108    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
7109        let mut list = Vec::new();
7110        if let Some(only_performed_by) = self.only_performed_by {
7111            list.push(("only-performed-by", only_performed_by.to_string()));
7112        }
7113        if let Some(date) = self.date {
7114            list.push((
7115                "date",
7116                date.format(&time::format_description::well_known::Rfc3339)
7117                    .unwrap(),
7118            ));
7119        }
7120
7121        list
7122    }
7123}
7124
7125#[derive(Debug, Clone, PartialEq, Default)]
7126pub struct UserListKeysQuery {
7127    /// fingerprint of the key
7128    pub fingerprint: Option<String>,
7129}
7130
7131impl UserListKeysQuery {
7132    pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
7133        let mut list = Vec::new();
7134        if let Some(fingerprint) = self.fingerprint {
7135            list.push(("fingerprint", fingerprint));
7136        }
7137
7138        list
7139    }
7140}