Skip to main content

forgejo_api/generated/
structs.rs

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