Skip to main content

forgejo_api/generated/
structs.rs

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