Skip to main content

forgejo_api/generated/
structs.rs

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