use crate::{impl_from_response, StructureError};
use std::collections::BTreeMap;
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct APIError {
pub message: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
}
impl_from_response!(APIError);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct APIForbiddenError {
pub message: Option<String>,
pub url: Option<String>,
}
impl_from_response!(APIForbiddenError);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct APIInternalServerError {
pub message: Option<String>,
pub url: Option<String>,
}
impl_from_response!(APIInternalServerError);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct APIInvalidTopicsError {
#[serde(rename = "invalidTopics")]
pub invalid_topics: Option<Vec<String>>,
pub message: Option<String>,
}
impl_from_response!(APIInvalidTopicsError);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct APINotFound {
pub errors: Option<Vec<String>>,
pub message: Option<String>,
pub url: Option<String>,
}
impl_from_response!(APINotFound);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct APIRepoArchivedError {
pub message: Option<String>,
pub url: Option<String>,
}
impl_from_response!(APIRepoArchivedError);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct APIUnauthorizedError {
pub message: Option<String>,
pub url: Option<String>,
}
impl_from_response!(APIUnauthorizedError);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct APIValidationError {
pub message: Option<String>,
pub url: Option<String>,
}
impl_from_response!(APIValidationError);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct AccessToken {
pub id: Option<i64>,
pub name: Option<String>,
pub scopes: Option<Vec<String>>,
pub sha1: Option<String>,
pub token_last_eight: Option<String>,
}
impl_from_response!(AccessToken);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct ActionRun {
#[serde(rename = "ScheduleID")]
pub schedule_id: Option<i64>,
pub approved_by: Option<i64>,
pub commit_sha: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub created: Option<time::OffsetDateTime>,
pub duration: Option<i64>,
pub event: Option<String>,
pub event_payload: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub html_url: Option<url::Url>,
pub id: Option<i64>,
pub index_in_repo: Option<i64>,
pub is_fork_pull_request: Option<bool>,
pub is_ref_deleted: Option<bool>,
pub need_approval: Option<bool>,
pub prettyref: Option<String>,
pub repository: Option<Repository>,
#[serde(with = "time::serde::rfc3339::option")]
pub started: Option<time::OffsetDateTime>,
pub status: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub stopped: Option<time::OffsetDateTime>,
pub title: Option<String>,
pub trigger_event: Option<String>,
pub trigger_user: Option<User>,
#[serde(with = "time::serde::rfc3339::option")]
pub updated: Option<time::OffsetDateTime>,
pub workflow_id: Option<String>,
}
impl_from_response!(ActionRun);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct ActionRunJob {
pub id: Option<i64>,
pub name: Option<String>,
pub needs: Option<Vec<String>>,
pub owner_id: Option<i64>,
pub repo_id: Option<i64>,
pub runs_on: Option<Vec<String>>,
pub status: Option<String>,
pub task_id: Option<i64>,
}
impl_from_response!(ActionRunJob);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct ActionTask {
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
pub display_title: Option<String>,
pub event: Option<String>,
pub head_branch: Option<String>,
pub head_sha: Option<String>,
pub id: Option<i64>,
pub name: Option<String>,
pub run_number: Option<i64>,
#[serde(with = "time::serde::rfc3339::option")]
pub run_started_at: Option<time::OffsetDateTime>,
pub status: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
pub workflow_id: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct ActionTaskResponse {
pub total_count: Option<i64>,
pub workflow_runs: Option<Vec<ActionTask>>,
}
impl_from_response!(ActionTaskResponse);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct ActionVariable {
pub data: Option<String>,
pub name: Option<String>,
pub owner_id: Option<i64>,
pub repo_id: Option<i64>,
}
impl_from_response!(ActionVariable);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Activity {
pub act_user: Option<User>,
pub act_user_id: Option<i64>,
pub comment: Option<Comment>,
pub comment_id: Option<i64>,
pub content: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub created: Option<time::OffsetDateTime>,
pub id: Option<i64>,
pub is_private: Option<bool>,
pub op_type: Option<ActivityOpType>,
pub ref_name: Option<String>,
pub repo: Option<Repository>,
pub repo_id: Option<i64>,
pub user_id: Option<i64>,
}
impl_from_response!(Activity);
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum ActivityOpType {
#[serde(rename = "create_repo")]
CreateRepo,
#[serde(rename = "rename_repo")]
RenameRepo,
#[serde(rename = "star_repo")]
StarRepo,
#[serde(rename = "watch_repo")]
WatchRepo,
#[serde(rename = "commit_repo")]
CommitRepo,
#[serde(rename = "create_issue")]
CreateIssue,
#[serde(rename = "create_pull_request")]
CreatePullRequest,
#[serde(rename = "transfer_repo")]
TransferRepo,
#[serde(rename = "push_tag")]
PushTag,
#[serde(rename = "comment_issue")]
CommentIssue,
#[serde(rename = "merge_pull_request")]
MergePullRequest,
#[serde(rename = "close_issue")]
CloseIssue,
#[serde(rename = "reopen_issue")]
ReopenIssue,
#[serde(rename = "close_pull_request")]
ClosePullRequest,
#[serde(rename = "reopen_pull_request")]
ReopenPullRequest,
#[serde(rename = "delete_tag")]
DeleteTag,
#[serde(rename = "delete_branch")]
DeleteBranch,
#[serde(rename = "mirror_sync_push")]
MirrorSyncPush,
#[serde(rename = "mirror_sync_create")]
MirrorSyncCreate,
#[serde(rename = "mirror_sync_delete")]
MirrorSyncDelete,
#[serde(rename = "approve_pull_request")]
ApprovePullRequest,
#[serde(rename = "reject_pull_request")]
RejectPullRequest,
#[serde(rename = "comment_pull")]
CommentPull,
#[serde(rename = "publish_release")]
PublishRelease,
#[serde(rename = "pull_review_dismissed")]
PullReviewDismissed,
#[serde(rename = "pull_request_ready_for_review")]
PullRequestReadyForReview,
#[serde(rename = "auto_merge_pull_request")]
AutoMergePullRequest,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct ActivityPub {
#[serde(rename = "@context")]
pub context: Option<String>,
}
impl_from_response!(ActivityPub);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct AddCollaboratorOption {
pub permission: Option<AddCollaboratorOptionPermission>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum AddCollaboratorOptionPermission {
#[serde(rename = "read")]
Read,
#[serde(rename = "write")]
Write,
#[serde(rename = "admin")]
Admin,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct AddTimeOption {
#[serde(with = "time::serde::rfc3339::option")]
pub created: Option<time::OffsetDateTime>,
pub time: i64,
pub user_name: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct AnnotatedTag {
pub archive_download_count: Option<TagArchiveDownloadCount>,
pub message: Option<String>,
pub object: Option<AnnotatedTagObject>,
pub sha: Option<String>,
pub tag: Option<String>,
pub tagger: Option<CommitUser>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
pub verification: Option<PayloadCommitVerification>,
}
impl_from_response!(AnnotatedTag);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct AnnotatedTagObject {
pub sha: Option<String>,
#[serde(rename = "type")]
pub r#type: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Attachment {
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub browser_download_url: Option<url::Url>,
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
pub download_count: Option<i64>,
pub id: Option<i64>,
pub name: Option<String>,
pub size: Option<i64>,
#[serde(rename = "type")]
pub r#type: Option<AttachmentType>,
pub uuid: Option<String>,
}
impl_from_response!(Attachment);
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum AttachmentType {
#[serde(rename = "attachment")]
Attachment,
#[serde(rename = "external")]
External,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct BlockedUser {
pub block_id: Option<i64>,
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
}
impl_from_response!(BlockedUser);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Branch {
pub commit: Option<PayloadCommit>,
pub effective_branch_protection_name: Option<String>,
pub enable_status_check: Option<bool>,
pub name: Option<String>,
pub protected: Option<bool>,
pub required_approvals: Option<i64>,
pub status_check_contexts: Option<Vec<String>>,
pub user_can_merge: Option<bool>,
pub user_can_push: Option<bool>,
}
impl_from_response!(Branch);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct BranchProtection {
pub apply_to_admins: Option<bool>,
pub approvals_whitelist_teams: Option<Vec<String>>,
pub approvals_whitelist_username: Option<Vec<String>>,
pub block_on_official_review_requests: Option<bool>,
pub block_on_outdated_branch: Option<bool>,
pub block_on_rejected_reviews: Option<bool>,
pub branch_name: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
pub dismiss_stale_approvals: Option<bool>,
pub enable_approvals_whitelist: Option<bool>,
pub enable_merge_whitelist: Option<bool>,
pub enable_push: Option<bool>,
pub enable_push_whitelist: Option<bool>,
pub enable_status_check: Option<bool>,
pub ignore_stale_approvals: Option<bool>,
pub merge_whitelist_teams: Option<Vec<String>>,
pub merge_whitelist_usernames: Option<Vec<String>>,
pub protected_file_patterns: Option<String>,
pub push_whitelist_deploy_keys: Option<bool>,
pub push_whitelist_teams: Option<Vec<String>>,
pub push_whitelist_usernames: Option<Vec<String>>,
pub require_signed_commits: Option<bool>,
pub required_approvals: Option<i64>,
pub rule_name: Option<String>,
pub status_check_contexts: Option<Vec<String>>,
pub unprotected_file_patterns: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>,
}
impl_from_response!(BranchProtection);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct ChangeFileOperation {
pub content: Option<String>,
pub from_path: Option<String>,
pub operation: ChangeFileOperationOperation,
pub path: String,
pub sha: Option<String>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum ChangeFileOperationOperation {
#[serde(rename = "create")]
Create,
#[serde(rename = "update")]
Update,
#[serde(rename = "delete")]
Delete,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct ChangeFilesOptions {
pub author: Option<Identity>,
pub branch: Option<String>,
pub committer: Option<Identity>,
pub dates: Option<CommitDateOptions>,
pub files: Vec<ChangeFileOperation>,
pub message: Option<String>,
pub new_branch: Option<String>,
pub signoff: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct ChangedFile {
pub additions: Option<i64>,
pub changes: Option<i64>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub contents_url: Option<url::Url>,
pub deletions: Option<i64>,
pub filename: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub html_url: Option<url::Url>,
pub previous_filename: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub raw_url: Option<url::Url>,
pub status: Option<String>,
}
impl_from_response!(ChangedFile);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CombinedStatus {
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub commit_url: Option<url::Url>,
pub repository: Option<Repository>,
pub sha: Option<String>,
pub state: Option<CommitStatusState>,
pub statuses: Option<Vec<CommitStatus>>,
pub total_count: Option<i64>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
}
impl_from_response!(CombinedStatus);
impl crate::sealed::Sealed for CombinedStatus {}
impl crate::PageSize for CombinedStatus {
fn page_size(&self) -> usize {
self.statuses.as_ref().map(|x| x.page_size()).unwrap_or(0)
}
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Comment {
pub assets: Option<Vec<Attachment>>,
pub body: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub html_url: Option<url::Url>,
pub id: Option<i64>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub issue_url: Option<url::Url>,
pub original_author: Option<String>,
pub original_author_id: Option<i64>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub pull_request_url: Option<url::Url>,
#[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>,
pub user: Option<User>,
}
impl_from_response!(Comment);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Commit {
pub author: Option<User>,
pub commit: Option<RepoCommit>,
pub committer: Option<User>,
#[serde(with = "time::serde::rfc3339::option")]
pub created: Option<time::OffsetDateTime>,
pub files: Option<Vec<CommitAffectedFiles>>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub html_url: Option<url::Url>,
pub parents: Option<Vec<CommitMeta>>,
pub sha: Option<String>,
pub stats: Option<CommitStats>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
}
impl_from_response!(Commit);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CommitAffectedFiles {
pub filename: Option<String>,
pub status: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CommitDateOptions {
#[serde(with = "time::serde::rfc3339::option")]
pub author: Option<time::OffsetDateTime>,
#[serde(with = "time::serde::rfc3339::option")]
pub committer: Option<time::OffsetDateTime>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CommitMeta {
#[serde(with = "time::serde::rfc3339::option")]
pub created: Option<time::OffsetDateTime>,
pub sha: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CommitStats {
pub additions: Option<i64>,
pub deletions: Option<i64>,
pub total: Option<i64>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CommitStatus {
pub context: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
pub creator: Option<User>,
pub description: Option<String>,
pub id: Option<i64>,
pub status: Option<CommitStatusState>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub target_url: Option<url::Url>,
#[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
}
impl_from_response!(CommitStatus);
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum CommitStatusState {
#[serde(rename = "pending")]
Pending,
#[serde(rename = "success")]
Success,
#[serde(rename = "error")]
Error,
#[serde(rename = "failure")]
Failure,
#[serde(rename = "warning")]
Warning,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CommitUser {
#[serde(with = "time::serde::rfc3339::option")]
pub date: Option<time::OffsetDateTime>,
pub email: Option<String>,
pub name: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Compare {
pub commits: Option<Vec<Commit>>,
pub files: Option<Vec<CommitAffectedFiles>>,
pub total_commits: Option<i64>,
}
impl_from_response!(Compare);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct ContentsResponse {
#[serde(rename = "_links")]
pub links: Option<FileLinksResponse>,
pub content: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub download_url: Option<url::Url>,
pub encoding: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub git_url: Option<url::Url>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub html_url: Option<url::Url>,
pub last_commit_sha: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub last_commit_when: Option<time::OffsetDateTime>,
pub name: Option<String>,
pub path: Option<String>,
pub sha: Option<String>,
pub size: Option<i64>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub submodule_git_url: Option<url::Url>,
pub target: Option<String>,
#[serde(rename = "type")]
pub r#type: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
}
impl_from_response!(ContentsResponse);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateAccessTokenOption {
pub name: String,
pub scopes: Option<Vec<String>>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateBranchProtectionOption {
pub apply_to_admins: Option<bool>,
pub approvals_whitelist_teams: Option<Vec<String>>,
pub approvals_whitelist_username: Option<Vec<String>>,
pub block_on_official_review_requests: Option<bool>,
pub block_on_outdated_branch: Option<bool>,
pub block_on_rejected_reviews: Option<bool>,
pub branch_name: Option<String>,
pub dismiss_stale_approvals: Option<bool>,
pub enable_approvals_whitelist: Option<bool>,
pub enable_merge_whitelist: Option<bool>,
pub enable_push: Option<bool>,
pub enable_push_whitelist: Option<bool>,
pub enable_status_check: Option<bool>,
pub ignore_stale_approvals: Option<bool>,
pub merge_whitelist_teams: Option<Vec<String>>,
pub merge_whitelist_usernames: Option<Vec<String>>,
pub protected_file_patterns: Option<String>,
pub push_whitelist_deploy_keys: Option<bool>,
pub push_whitelist_teams: Option<Vec<String>>,
pub push_whitelist_usernames: Option<Vec<String>>,
pub require_signed_commits: Option<bool>,
pub required_approvals: Option<i64>,
pub rule_name: Option<String>,
pub status_check_contexts: Option<Vec<String>>,
pub unprotected_file_patterns: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateBranchRepoOption {
pub new_branch_name: String,
pub old_branch_name: Option<String>,
pub old_ref_name: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateEmailOption {
pub emails: Option<Vec<String>>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateFileOptions {
pub author: Option<Identity>,
pub branch: Option<String>,
pub committer: Option<Identity>,
pub content: String,
pub dates: Option<CommitDateOptions>,
pub message: Option<String>,
pub new_branch: Option<String>,
pub signoff: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateForkOption {
pub name: Option<String>,
pub organization: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateGPGKeyOption {
pub armored_public_key: String,
pub armored_signature: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateHookOption {
pub active: Option<bool>,
pub authorization_header: Option<String>,
pub branch_filter: Option<String>,
pub config: CreateHookOptionConfig,
pub events: Option<Vec<String>>,
#[serde(rename = "type")]
pub r#type: CreateHookOptionType,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum CreateHookOptionType {
#[serde(rename = "forgejo")]
Forgejo,
#[serde(rename = "dingtalk")]
Dingtalk,
#[serde(rename = "discord")]
Discord,
#[serde(rename = "gitea")]
Gitea,
#[serde(rename = "gogs")]
Gogs,
#[serde(rename = "msteams")]
Msteams,
#[serde(rename = "slack")]
Slack,
#[serde(rename = "telegram")]
Telegram,
#[serde(rename = "feishu")]
Feishu,
#[serde(rename = "wechatwork")]
Wechatwork,
#[serde(rename = "packagist")]
Packagist,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateHookOptionConfig {
pub content_type: String,
pub url: url::Url,
#[serde(flatten)]
pub additional: BTreeMap<String, String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateIssueCommentOption {
pub body: String,
#[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateIssueOption {
pub assignee: Option<String>,
pub assignees: Option<Vec<String>>,
pub body: Option<String>,
pub closed: Option<bool>,
#[serde(with = "time::serde::rfc3339::option")]
pub due_date: Option<time::OffsetDateTime>,
pub labels: Option<Vec<i64>>,
pub milestone: Option<i64>,
#[serde(rename = "ref")]
pub r#ref: Option<String>,
pub title: String,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateKeyOption {
pub key: String,
pub read_only: Option<bool>,
pub title: String,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateLabelOption {
pub color: String,
pub description: Option<String>,
pub exclusive: Option<bool>,
pub is_archived: Option<bool>,
pub name: String,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateMilestoneOption {
pub description: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub due_on: Option<time::OffsetDateTime>,
pub state: Option<CreateMilestoneOptionState>,
pub title: Option<String>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum CreateMilestoneOptionState {
#[serde(rename = "open")]
Open,
#[serde(rename = "closed")]
Closed,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateOAuth2ApplicationOptions {
pub confidential_client: Option<bool>,
pub name: Option<String>,
pub redirect_uris: Option<Vec<String>>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateOrUpdateSecretOption {
pub data: String,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateOrgOption {
pub description: Option<String>,
pub email: Option<String>,
pub full_name: Option<String>,
pub location: Option<String>,
pub repo_admin_change_team_access: Option<bool>,
pub username: String,
pub visibility: Option<CreateOrgOptionVisibility>,
pub website: Option<String>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum CreateOrgOptionVisibility {
#[serde(rename = "public")]
Public,
#[serde(rename = "limited")]
Limited,
#[serde(rename = "private")]
Private,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreatePullRequestOption {
pub assignee: Option<String>,
pub assignees: Option<Vec<String>>,
pub base: Option<String>,
pub body: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub due_date: Option<time::OffsetDateTime>,
pub head: Option<String>,
pub labels: Option<Vec<i64>>,
pub milestone: Option<i64>,
pub title: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreatePullReviewComment {
pub body: Option<String>,
pub new_position: Option<i64>,
pub old_position: Option<i64>,
pub path: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreatePullReviewOptions {
pub body: Option<String>,
pub comments: Option<Vec<CreatePullReviewComment>>,
pub commit_id: Option<String>,
pub event: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreatePushMirrorOption {
pub branch_filter: Option<String>,
pub interval: Option<String>,
pub remote_address: Option<String>,
pub remote_password: Option<String>,
pub remote_username: Option<String>,
pub sync_on_commit: Option<bool>,
pub use_ssh: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateQuotaGroupOptions {
pub name: Option<String>,
pub rules: Option<Vec<CreateQuotaRuleOptions>>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateQuotaRuleOptions {
pub limit: Option<i64>,
pub name: Option<String>,
pub subjects: Option<Vec<CreateQuotaRuleOptionsSubjects>>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum CreateQuotaRuleOptionsSubjects {
#[serde(rename = "none")]
None,
#[serde(rename = "size:all")]
SizeAll,
#[serde(rename = "size:repos:all")]
SizeReposAll,
#[serde(rename = "size:repos:public")]
SizeReposPublic,
#[serde(rename = "size:repos:private")]
SizeReposPrivate,
#[serde(rename = "size:git:all")]
SizeGitAll,
#[serde(rename = "size:git:lfs")]
SizeGitLfs,
#[serde(rename = "size:assets:all")]
SizeAssetsAll,
#[serde(rename = "size:assets:attachments:all")]
SizeAssetsAttachmentsAll,
#[serde(rename = "size:assets:attachments:issues")]
SizeAssetsAttachmentsIssues,
#[serde(rename = "size:assets:attachments:releases")]
SizeAssetsAttachmentsReleases,
#[serde(rename = "size:assets:artifacts")]
SizeAssetsArtifacts,
#[serde(rename = "size:assets:packages:all")]
SizeAssetsPackagesAll,
#[serde(rename = "size:assets:wiki")]
SizeAssetsWiki,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateReleaseOption {
pub body: Option<String>,
pub draft: Option<bool>,
pub hide_archive_links: Option<bool>,
pub name: Option<String>,
pub prerelease: Option<bool>,
pub tag_name: String,
pub target_commitish: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateRepoOption {
pub auto_init: Option<bool>,
pub default_branch: Option<String>,
pub description: Option<String>,
pub gitignores: Option<String>,
pub issue_labels: Option<String>,
pub license: Option<String>,
pub name: String,
pub object_format_name: Option<ObjectFormatName>,
pub private: Option<bool>,
pub readme: Option<String>,
pub template: Option<bool>,
pub trust_model: Option<CreateRepoOptionTrustModel>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum CreateRepoOptionTrustModel {
#[serde(rename = "default")]
Default,
#[serde(rename = "collaborator")]
Collaborator,
#[serde(rename = "committer")]
Committer,
#[serde(rename = "collaboratorcommitter")]
Collaboratorcommitter,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateStatusOption {
pub context: Option<String>,
pub description: Option<String>,
pub state: Option<CommitStatusState>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub target_url: Option<url::Url>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateTagOption {
pub message: Option<String>,
pub tag_name: String,
pub target: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateTagProtectionOption {
pub name_pattern: Option<String>,
pub whitelist_teams: Option<Vec<String>>,
pub whitelist_usernames: Option<Vec<String>>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateTeamOption {
pub can_create_org_repo: Option<bool>,
pub description: Option<String>,
pub includes_all_repositories: Option<bool>,
pub name: String,
pub permission: Option<CreateTeamOptionPermission>,
pub units: Option<Vec<String>>,
pub units_map: Option<BTreeMap<String, String>>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum CreateTeamOptionPermission {
#[serde(rename = "read")]
Read,
#[serde(rename = "write")]
Write,
#[serde(rename = "admin")]
Admin,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateUserOption {
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
pub email: String,
pub full_name: Option<String>,
pub login_name: Option<String>,
pub must_change_password: Option<bool>,
pub password: Option<String>,
pub restricted: Option<bool>,
pub send_notify: Option<bool>,
pub source_id: Option<i64>,
pub username: String,
pub visibility: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateVariableOption {
pub value: String,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct CreateWikiPageOptions {
pub content_base64: Option<String>,
pub message: Option<String>,
pub title: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Cron {
pub exec_times: Option<i64>,
pub name: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub next: Option<time::OffsetDateTime>,
#[serde(with = "time::serde::rfc3339::option")]
pub prev: Option<time::OffsetDateTime>,
pub schedule: Option<String>,
}
impl_from_response!(Cron);
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum DefaultMergeStyle {
#[serde(rename = "merge")]
Merge,
#[serde(rename = "rebase")]
Rebase,
#[serde(rename = "rebase-merge")]
RebaseMerge,
#[serde(rename = "squash")]
Squash,
#[serde(rename = "fast-forward-only")]
FastForwardOnly,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct DeleteEmailOption {
pub emails: Option<Vec<String>>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct DeleteFileOptions {
pub author: Option<Identity>,
pub branch: Option<String>,
pub committer: Option<Identity>,
pub dates: Option<CommitDateOptions>,
pub message: Option<String>,
pub new_branch: Option<String>,
pub sha: String,
pub signoff: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct DeleteLabelsOption {
#[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct DeployKey {
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
pub fingerprint: Option<String>,
pub id: Option<i64>,
pub key: Option<String>,
pub key_id: Option<i64>,
pub read_only: Option<bool>,
pub repository: Option<Repository>,
pub title: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
}
impl_from_response!(DeployKey);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct DismissPullReviewOptions {
pub message: Option<String>,
pub priors: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct DispatchWorkflowOption {
pub inputs: Option<BTreeMap<String, String>>,
#[serde(rename = "ref")]
pub r#ref: String,
pub return_run_info: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct DispatchWorkflowRun {
pub id: Option<i64>,
pub jobs: Option<Vec<String>>,
pub run_number: Option<i64>,
}
impl_from_response!(DispatchWorkflowRun);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct EditAttachmentOptions {
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub browser_download_url: Option<url::Url>,
pub name: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct EditBranchProtectionOption {
pub apply_to_admins: Option<bool>,
pub approvals_whitelist_teams: Option<Vec<String>>,
pub approvals_whitelist_username: Option<Vec<String>>,
pub block_on_official_review_requests: Option<bool>,
pub block_on_outdated_branch: Option<bool>,
pub block_on_rejected_reviews: Option<bool>,
pub dismiss_stale_approvals: Option<bool>,
pub enable_approvals_whitelist: Option<bool>,
pub enable_merge_whitelist: Option<bool>,
pub enable_push: Option<bool>,
pub enable_push_whitelist: Option<bool>,
pub enable_status_check: Option<bool>,
pub ignore_stale_approvals: Option<bool>,
pub merge_whitelist_teams: Option<Vec<String>>,
pub merge_whitelist_usernames: Option<Vec<String>>,
pub protected_file_patterns: Option<String>,
pub push_whitelist_deploy_keys: Option<bool>,
pub push_whitelist_teams: Option<Vec<String>>,
pub push_whitelist_usernames: Option<Vec<String>>,
pub require_signed_commits: Option<bool>,
pub required_approvals: Option<i64>,
pub status_check_contexts: Option<Vec<String>>,
pub unprotected_file_patterns: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct EditDeadlineOption {
#[serde(with = "time::serde::rfc3339")]
pub due_date: time::OffsetDateTime,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct EditGitHookOption {
pub content: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct EditHookOption {
pub active: Option<bool>,
pub authorization_header: Option<String>,
pub branch_filter: Option<String>,
pub config: Option<BTreeMap<String, String>>,
pub events: Option<Vec<String>>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct EditIssueCommentOption {
pub body: String,
#[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct EditIssueOption {
pub assignee: Option<String>,
pub assignees: Option<Vec<String>>,
pub body: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub due_date: Option<time::OffsetDateTime>,
pub milestone: Option<i64>,
#[serde(rename = "ref")]
pub r#ref: Option<String>,
pub state: Option<String>,
pub title: Option<String>,
pub unset_due_date: Option<bool>,
#[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct EditLabelOption {
pub color: Option<String>,
pub description: Option<String>,
pub exclusive: Option<bool>,
pub is_archived: Option<bool>,
pub name: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct EditMilestoneOption {
pub description: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub due_on: Option<time::OffsetDateTime>,
pub state: Option<String>,
pub title: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct EditOrgOption {
pub description: Option<String>,
pub email: Option<String>,
pub full_name: Option<String>,
pub location: Option<String>,
pub repo_admin_change_team_access: Option<bool>,
pub visibility: Option<EditOrgOptionVisibility>,
pub website: Option<String>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum EditOrgOptionVisibility {
#[serde(rename = "public")]
Public,
#[serde(rename = "limited")]
Limited,
#[serde(rename = "private")]
Private,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct EditPullRequestOption {
pub allow_maintainer_edit: Option<bool>,
pub assignee: Option<String>,
pub assignees: Option<Vec<String>>,
pub base: Option<String>,
pub body: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub due_date: Option<time::OffsetDateTime>,
pub labels: Option<Vec<i64>>,
pub milestone: Option<i64>,
pub state: Option<String>,
pub title: Option<String>,
pub unset_due_date: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct EditQuotaRuleOptions {
pub limit: Option<i64>,
pub subjects: Option<Vec<String>>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct EditReactionOption {
pub content: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct EditReleaseOption {
pub body: Option<String>,
pub draft: Option<bool>,
pub hide_archive_links: Option<bool>,
pub name: Option<String>,
pub prerelease: Option<bool>,
pub tag_name: Option<String>,
pub target_commitish: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct EditRepoOption {
pub allow_fast_forward_only_merge: Option<bool>,
pub allow_manual_merge: Option<bool>,
pub allow_merge_commits: Option<bool>,
pub allow_rebase: Option<bool>,
pub allow_rebase_explicit: Option<bool>,
pub allow_rebase_update: Option<bool>,
pub allow_squash_merge: Option<bool>,
pub archived: Option<bool>,
pub autodetect_manual_merge: Option<bool>,
pub default_allow_maintainer_edit: Option<bool>,
pub default_branch: Option<String>,
pub default_delete_branch_after_merge: Option<bool>,
pub default_merge_style: Option<DefaultMergeStyle>,
pub default_update_style: Option<String>,
pub description: Option<String>,
pub enable_prune: Option<bool>,
pub external_tracker: Option<ExternalTracker>,
pub external_wiki: Option<ExternalWiki>,
pub globally_editable_wiki: Option<bool>,
pub has_actions: Option<bool>,
pub has_issues: Option<bool>,
pub has_packages: Option<bool>,
pub has_projects: Option<bool>,
pub has_pull_requests: Option<bool>,
pub has_releases: Option<bool>,
pub has_wiki: Option<bool>,
pub ignore_whitespace_conflicts: Option<bool>,
pub internal_tracker: Option<InternalTracker>,
pub mirror_interval: Option<String>,
pub name: Option<String>,
pub private: Option<bool>,
pub template: Option<bool>,
pub website: Option<String>,
pub wiki_branch: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct EditTagProtectionOption {
pub name_pattern: Option<String>,
pub whitelist_teams: Option<Vec<String>>,
pub whitelist_usernames: Option<Vec<String>>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct EditTeamOption {
pub can_create_org_repo: Option<bool>,
pub description: Option<String>,
pub includes_all_repositories: Option<bool>,
pub name: String,
pub permission: Option<EditTeamOptionPermission>,
pub units: Option<Vec<String>>,
pub units_map: Option<BTreeMap<String, String>>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum EditTeamOptionPermission {
#[serde(rename = "read")]
Read,
#[serde(rename = "write")]
Write,
#[serde(rename = "admin")]
Admin,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct EditUserOption {
pub active: Option<bool>,
pub admin: Option<bool>,
pub allow_create_organization: Option<bool>,
pub allow_git_hook: Option<bool>,
pub allow_import_local: Option<bool>,
pub description: Option<String>,
pub email: Option<String>,
pub full_name: Option<String>,
pub hide_email: Option<bool>,
pub location: Option<String>,
pub login_name: Option<String>,
pub max_repo_creation: Option<i64>,
pub must_change_password: Option<bool>,
pub password: Option<String>,
pub prohibit_login: Option<bool>,
pub pronouns: Option<String>,
pub restricted: Option<bool>,
pub source_id: Option<i64>,
pub visibility: Option<String>,
pub website: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Email {
pub email: Option<String>,
pub primary: Option<bool>,
pub user_id: Option<i64>,
pub username: Option<String>,
pub verified: Option<bool>,
}
impl_from_response!(Email);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct ExternalTracker {
pub external_tracker_format: Option<String>,
pub external_tracker_regexp_pattern: Option<String>,
pub external_tracker_style: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub external_tracker_url: Option<url::Url>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct ExternalWiki {
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub external_wiki_url: Option<url::Url>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct FileCommitResponse {
pub author: Option<CommitUser>,
pub committer: Option<CommitUser>,
#[serde(with = "time::serde::rfc3339::option")]
pub created: Option<time::OffsetDateTime>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub html_url: Option<url::Url>,
pub message: Option<String>,
pub parents: Option<Vec<CommitMeta>>,
pub sha: Option<String>,
pub tree: Option<CommitMeta>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct FileDeleteResponse {
pub commit: Option<FileCommitResponse>,
pub content: Option<serde_json::Value>,
pub verification: Option<PayloadCommitVerification>,
}
impl_from_response!(FileDeleteResponse);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct FileLinksResponse {
pub git: Option<String>,
pub html: Option<String>,
#[serde(rename = "self")]
pub this: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct FileResponse {
pub commit: Option<FileCommitResponse>,
pub content: Option<ContentsResponse>,
pub verification: Option<PayloadCommitVerification>,
}
impl_from_response!(FileResponse);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct FilesResponse {
pub commit: Option<FileCommitResponse>,
pub files: Option<Vec<ContentsResponse>>,
pub verification: Option<PayloadCommitVerification>,
}
impl_from_response!(FilesResponse);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct ForgeLike {}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct ForgeOutbox {}
impl_from_response!(ForgeOutbox);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct GPGKey {
pub can_certify: Option<bool>,
pub can_encrypt_comms: Option<bool>,
pub can_encrypt_storage: Option<bool>,
pub can_sign: Option<bool>,
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
pub emails: Option<Vec<GPGKeyEmail>>,
#[serde(with = "time::serde::rfc3339::option")]
pub expires_at: Option<time::OffsetDateTime>,
pub id: Option<i64>,
pub key_id: Option<String>,
pub primary_key_id: Option<String>,
pub public_key: Option<String>,
pub subkeys: Option<Vec<GPGKey>>,
pub verified: Option<bool>,
}
impl_from_response!(GPGKey);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct GPGKeyEmail {
pub email: Option<String>,
pub verified: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct GeneralAPISettings {
pub default_git_trees_per_page: Option<i64>,
pub default_max_blob_size: Option<i64>,
pub default_paging_num: Option<i64>,
pub max_response_items: Option<i64>,
}
impl_from_response!(GeneralAPISettings);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct GeneralAttachmentSettings {
pub allowed_types: Option<String>,
pub enabled: Option<bool>,
pub max_files: Option<i64>,
pub max_size: Option<i64>,
}
impl_from_response!(GeneralAttachmentSettings);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct GeneralRepoSettings {
pub forks_disabled: Option<bool>,
pub http_git_disabled: Option<bool>,
pub lfs_disabled: Option<bool>,
pub migrations_disabled: Option<bool>,
pub mirrors_disabled: Option<bool>,
pub stars_disabled: Option<bool>,
pub time_tracking_disabled: Option<bool>,
}
impl_from_response!(GeneralRepoSettings);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct GeneralUISettings {
pub allowed_reactions: Option<Vec<String>>,
pub custom_emojis: Option<Vec<String>>,
pub default_theme: Option<String>,
}
impl_from_response!(GeneralUISettings);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct GenerateRepoOption {
pub avatar: Option<bool>,
pub default_branch: Option<String>,
pub description: Option<String>,
pub git_content: Option<bool>,
pub git_hooks: Option<bool>,
pub labels: Option<bool>,
pub name: String,
pub owner: String,
pub private: Option<bool>,
pub protected_branch: Option<bool>,
pub topics: Option<bool>,
pub webhooks: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct GitBlob {
pub content: Option<String>,
pub encoding: Option<String>,
pub sha: Option<String>,
pub size: Option<i64>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
}
impl_from_response!(GitBlob);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct GitEntry {
pub mode: Option<String>,
pub path: Option<String>,
pub sha: Option<String>,
pub size: Option<i64>,
#[serde(rename = "type")]
pub r#type: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct GitHook {
pub content: Option<String>,
pub is_active: Option<bool>,
pub name: Option<String>,
}
impl_from_response!(GitHook);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct GitObject {
pub sha: Option<String>,
#[serde(rename = "type")]
pub r#type: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct GitTreeResponse {
pub page: Option<i64>,
pub sha: Option<String>,
pub total_count: Option<i64>,
pub tree: Option<Vec<GitEntry>>,
pub truncated: Option<bool>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
}
impl_from_response!(GitTreeResponse);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct GitignoreTemplateInfo {
pub name: Option<String>,
pub source: Option<String>,
}
impl_from_response!(GitignoreTemplateInfo);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Hook {
pub active: Option<bool>,
pub authorization_header: Option<String>,
pub branch_filter: Option<String>,
pub config: Option<BTreeMap<String, String>>,
pub content_type: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
pub events: Option<Vec<String>>,
pub id: Option<i64>,
pub metadata: Option<serde_json::Value>,
#[serde(rename = "type")]
pub r#type: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
}
impl_from_response!(Hook);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Identity {
pub email: Option<String>,
pub name: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct InternalTracker {
pub allow_only_contributors_to_track_time: Option<bool>,
pub enable_issue_dependencies: Option<bool>,
pub enable_time_tracker: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Issue {
pub assets: Option<Vec<Attachment>>,
pub assignee: Option<User>,
pub assignees: Option<Vec<User>>,
pub body: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub closed_at: Option<time::OffsetDateTime>,
pub comments: Option<i64>,
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
#[serde(with = "time::serde::rfc3339::option")]
pub due_date: Option<time::OffsetDateTime>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub html_url: Option<url::Url>,
pub id: Option<i64>,
pub is_locked: Option<bool>,
pub labels: Option<Vec<Label>>,
pub milestone: Option<Milestone>,
pub number: Option<i64>,
pub original_author: Option<String>,
pub original_author_id: Option<i64>,
pub pin_order: Option<i64>,
pub pull_request: Option<PullRequestMeta>,
#[serde(rename = "ref")]
pub r#ref: Option<String>,
pub repository: Option<RepositoryMeta>,
pub state: Option<StateType>,
pub title: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
pub user: Option<User>,
}
impl_from_response!(Issue);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct IssueConfig {
pub blank_issues_enabled: Option<bool>,
pub contact_links: Option<Vec<IssueConfigContactLink>>,
}
impl_from_response!(IssueConfig);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct IssueConfigContactLink {
pub about: Option<String>,
pub name: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct IssueConfigValidation {
pub message: Option<String>,
pub valid: Option<bool>,
}
impl_from_response!(IssueConfigValidation);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct IssueDeadline {
#[serde(with = "time::serde::rfc3339::option")]
pub due_date: Option<time::OffsetDateTime>,
}
impl_from_response!(IssueDeadline);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct IssueFormField {
pub attributes: Option<BTreeMap<String, serde_json::Value>>,
pub id: Option<String>,
#[serde(rename = "type")]
pub r#type: Option<IssueFormFieldType>,
pub validations: Option<BTreeMap<String, serde_json::Value>>,
pub visible: Option<Vec<String>>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum IssueFormFieldType {
#[serde(rename = "markdown")]
Markdown,
#[serde(rename = "textarea")]
Textarea,
#[serde(rename = "input")]
Input,
#[serde(rename = "dropdown")]
Dropdown,
#[serde(rename = "checkboxes")]
Checkboxes,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct IssueLabelsOption {
pub labels: Option<Vec<serde_json::Value>>,
#[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct IssueMeta {
pub index: Option<i64>,
pub owner: Option<String>,
pub repo: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct IssueTemplate {
pub about: Option<String>,
pub body: Option<Vec<IssueFormField>>,
pub content: Option<String>,
pub file_name: Option<String>,
pub labels: Option<Vec<String>>,
pub name: Option<String>,
#[serde(rename = "ref")]
pub r#ref: Option<String>,
pub title: Option<String>,
}
impl_from_response!(IssueTemplate);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Label {
pub color: Option<String>,
pub description: Option<String>,
pub exclusive: Option<bool>,
pub id: Option<i64>,
pub is_archived: Option<bool>,
pub name: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
}
impl_from_response!(Label);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct LabelTemplate {
pub color: Option<String>,
pub description: Option<String>,
pub exclusive: Option<bool>,
pub name: Option<String>,
}
impl_from_response!(LabelTemplate);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct LicenseTemplateInfo {
pub body: Option<String>,
pub implementation: Option<String>,
pub key: Option<String>,
pub name: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
}
impl_from_response!(LicenseTemplateInfo);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct LicensesTemplateListEntry {
pub key: Option<String>,
pub name: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
}
impl_from_response!(LicensesTemplateListEntry);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct ListActionRunResponse {
pub total_count: Option<i64>,
pub workflow_runs: Option<Vec<ActionRun>>,
}
impl_from_response!(ListActionRunResponse);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct MarkdownOption {
#[serde(rename = "Context")]
pub context: Option<String>,
#[serde(rename = "Mode")]
pub mode: Option<String>,
#[serde(rename = "Text")]
pub text: Option<String>,
#[serde(rename = "Wiki")]
pub wiki: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct MarkupOption {
#[serde(rename = "BranchPath")]
pub branch_path: Option<String>,
#[serde(rename = "Context")]
pub context: Option<String>,
#[serde(rename = "FilePath")]
pub file_path: Option<String>,
#[serde(rename = "Mode")]
pub mode: Option<String>,
#[serde(rename = "Text")]
pub text: Option<String>,
#[serde(rename = "Wiki")]
pub wiki: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct MergePullRequestOption {
#[serde(rename = "Do")]
pub r#do: MergePullRequestOptionDo,
#[serde(rename = "MergeCommitID")]
pub merge_commit_id: Option<String>,
#[serde(rename = "MergeMessageField")]
pub merge_message_field: Option<String>,
#[serde(rename = "MergeTitleField")]
pub merge_title_field: Option<String>,
pub delete_branch_after_merge: Option<bool>,
pub force_merge: Option<bool>,
pub head_commit_id: Option<String>,
pub merge_when_checks_succeed: Option<bool>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum MergePullRequestOptionDo {
#[serde(rename = "merge")]
Merge,
#[serde(rename = "rebase")]
Rebase,
#[serde(rename = "rebase-merge")]
RebaseMerge,
#[serde(rename = "squash")]
Squash,
#[serde(rename = "fast-forward-only")]
FastForwardOnly,
#[serde(rename = "manually-merged")]
ManuallyMerged,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct MigrateRepoOptions {
pub auth_password: Option<String>,
pub auth_token: Option<String>,
pub auth_username: Option<String>,
pub clone_addr: String,
pub description: Option<String>,
pub issues: Option<bool>,
pub labels: Option<bool>,
pub lfs: Option<bool>,
pub lfs_endpoint: Option<String>,
pub milestones: Option<bool>,
pub mirror: Option<bool>,
pub mirror_interval: Option<String>,
pub private: Option<bool>,
pub pull_requests: Option<bool>,
pub releases: Option<bool>,
pub repo_name: String,
pub repo_owner: Option<String>,
pub service: Option<MigrateRepoOptionsService>,
pub uid: Option<i64>,
pub wiki: Option<bool>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum MigrateRepoOptionsService {
#[serde(rename = "git")]
Git,
#[serde(rename = "github")]
Github,
#[serde(rename = "gitea")]
Gitea,
#[serde(rename = "gitlab")]
Gitlab,
#[serde(rename = "gogs")]
Gogs,
#[serde(rename = "onedev")]
Onedev,
#[serde(rename = "gitbucket")]
Gitbucket,
#[serde(rename = "codebase")]
Codebase,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Milestone {
#[serde(with = "time::serde::rfc3339::option")]
pub closed_at: Option<time::OffsetDateTime>,
pub closed_issues: Option<i64>,
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
pub description: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub due_on: Option<time::OffsetDateTime>,
pub id: Option<i64>,
pub open_issues: Option<i64>,
pub state: Option<StateType>,
pub title: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>,
}
impl_from_response!(Milestone);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct NewIssuePinsAllowed {
pub issues: Option<bool>,
pub pull_requests: Option<bool>,
}
impl_from_response!(NewIssuePinsAllowed);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct NodeInfo {
pub metadata: Option<BTreeMap<String, serde_json::Value>>,
#[serde(rename = "openRegistrations")]
pub open_registrations: Option<bool>,
pub protocols: Option<Vec<String>>,
pub services: Option<NodeInfoServices>,
pub software: Option<NodeInfoSoftware>,
pub usage: Option<NodeInfoUsage>,
pub version: Option<String>,
}
impl_from_response!(NodeInfo);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct NodeInfoServices {
pub inbound: Option<Vec<String>>,
pub outbound: Option<Vec<String>>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct NodeInfoSoftware {
pub homepage: Option<String>,
pub name: Option<String>,
pub repository: Option<String>,
pub version: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct NodeInfoUsage {
#[serde(rename = "localComments")]
pub local_comments: Option<i64>,
#[serde(rename = "localPosts")]
pub local_posts: Option<i64>,
pub users: Option<NodeInfoUsageUsers>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct NodeInfoUsageUsers {
#[serde(rename = "activeHalfyear")]
pub active_halfyear: Option<i64>,
#[serde(rename = "activeMonth")]
pub active_month: Option<i64>,
pub total: Option<i64>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Note {
pub commit: Option<Commit>,
pub message: Option<String>,
}
impl_from_response!(Note);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct NoteOptions {
pub message: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct NotificationCount {
pub new: Option<i64>,
}
impl_from_response!(NotificationCount);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct NotificationSubject {
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub html_url: Option<url::Url>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub latest_comment_html_url: Option<url::Url>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub latest_comment_url: Option<url::Url>,
pub state: Option<StateType>,
pub title: Option<String>,
#[serde(rename = "type")]
pub r#type: Option<NotifySubjectType>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct NotificationThread {
pub id: Option<i64>,
pub pinned: Option<bool>,
pub repository: Option<Repository>,
pub subject: Option<NotificationSubject>,
pub unread: Option<bool>,
#[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
}
impl_from_response!(NotificationThread);
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum NotifySubjectType {
#[serde(rename = "Issue")]
Issue,
#[serde(rename = "Pull")]
Pull,
#[serde(rename = "Commit")]
Commit,
#[serde(rename = "Repository")]
Repository,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct OAuth2Application {
pub client_id: Option<String>,
pub client_secret: Option<String>,
pub confidential_client: Option<bool>,
#[serde(with = "time::serde::rfc3339::option")]
pub created: Option<time::OffsetDateTime>,
pub id: Option<i64>,
pub name: Option<String>,
pub redirect_uris: Option<Vec<String>>,
}
impl_from_response!(OAuth2Application);
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum ObjectFormatName {
#[serde(rename = "sha1")]
Sha1,
#[serde(rename = "sha256")]
Sha256,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Organization {
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub avatar_url: Option<url::Url>,
pub description: Option<String>,
pub email: Option<String>,
pub full_name: Option<String>,
pub id: Option<i64>,
pub location: Option<String>,
pub name: Option<String>,
pub repo_admin_change_team_access: Option<bool>,
pub username: Option<String>,
pub visibility: Option<String>,
pub website: Option<String>,
}
impl_from_response!(Organization);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct OrganizationPermissions {
pub can_create_repository: Option<bool>,
pub can_read: Option<bool>,
pub can_write: Option<bool>,
pub is_admin: Option<bool>,
pub is_owner: Option<bool>,
}
impl_from_response!(OrganizationPermissions);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct PRBranchInfo {
pub label: Option<String>,
#[serde(rename = "ref")]
pub r#ref: Option<String>,
pub repo: Option<Repository>,
pub repo_id: Option<i64>,
pub sha: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Package {
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
pub creator: Option<User>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub html_url: Option<url::Url>,
pub id: Option<i64>,
pub name: Option<String>,
pub owner: Option<User>,
pub repository: Option<Repository>,
#[serde(rename = "type")]
pub r#type: Option<String>,
pub version: Option<String>,
}
impl_from_response!(Package);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct PackageFile {
#[serde(rename = "Size")]
pub size: Option<i64>,
pub id: Option<i64>,
pub md5: Option<String>,
pub name: Option<String>,
pub sha1: Option<String>,
pub sha256: Option<String>,
pub sha512: Option<String>,
}
impl_from_response!(PackageFile);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct PayloadCommit {
pub added: Option<Vec<String>>,
pub author: Option<PayloadUser>,
pub committer: Option<PayloadUser>,
pub id: Option<String>,
pub message: Option<String>,
pub modified: Option<Vec<String>>,
pub removed: Option<Vec<String>>,
#[serde(with = "time::serde::rfc3339::option")]
pub timestamp: Option<time::OffsetDateTime>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
pub verification: Option<PayloadCommitVerification>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct PayloadCommitVerification {
pub payload: Option<String>,
pub reason: Option<String>,
pub signature: Option<String>,
pub signer: Option<PayloadUser>,
pub verified: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct PayloadUser {
pub email: Option<String>,
pub name: Option<String>,
pub username: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Permission {
pub admin: Option<bool>,
pub pull: Option<bool>,
pub push: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct PublicKey {
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
pub fingerprint: Option<String>,
pub id: Option<i64>,
pub key: Option<String>,
pub key_type: Option<String>,
pub read_only: Option<bool>,
pub title: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
pub user: Option<User>,
}
impl_from_response!(PublicKey);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct PullRequest {
pub additions: Option<i64>,
pub allow_maintainer_edit: Option<bool>,
pub assignee: Option<User>,
pub assignees: Option<Vec<User>>,
pub base: Option<PRBranchInfo>,
pub body: Option<String>,
pub changed_files: Option<i64>,
#[serde(with = "time::serde::rfc3339::option")]
pub closed_at: Option<time::OffsetDateTime>,
pub comments: Option<i64>,
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
pub deletions: Option<i64>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub diff_url: Option<url::Url>,
pub draft: Option<bool>,
#[serde(with = "time::serde::rfc3339::option")]
pub due_date: Option<time::OffsetDateTime>,
pub flow: Option<i64>,
pub head: Option<PRBranchInfo>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub html_url: Option<url::Url>,
pub id: Option<i64>,
pub is_locked: Option<bool>,
pub labels: Option<Vec<Label>>,
pub merge_base: Option<String>,
pub merge_commit_sha: Option<String>,
pub mergeable: Option<bool>,
pub merged: Option<bool>,
#[serde(with = "time::serde::rfc3339::option")]
pub merged_at: Option<time::OffsetDateTime>,
pub merged_by: Option<User>,
pub milestone: Option<Milestone>,
pub number: Option<i64>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub patch_url: Option<url::Url>,
pub pin_order: Option<i64>,
#[serde(deserialize_with = "crate::requested_reviewers_ignore_null")]
pub requested_reviewers: Option<Vec<User>>,
pub requested_reviewers_teams: Option<Vec<Team>>,
pub review_comments: Option<i64>,
pub state: Option<StateType>,
pub title: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
pub user: Option<User>,
}
impl_from_response!(PullRequest);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct PullRequestMeta {
pub draft: Option<bool>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub html_url: Option<url::Url>,
pub merged: Option<bool>,
#[serde(with = "time::serde::rfc3339::option")]
pub merged_at: Option<time::OffsetDateTime>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct PullReview {
pub body: Option<String>,
pub comments_count: Option<i64>,
pub commit_id: Option<String>,
pub dismissed: Option<bool>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub html_url: Option<url::Url>,
pub id: Option<i64>,
pub official: Option<bool>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub pull_request_url: Option<url::Url>,
pub stale: Option<bool>,
pub state: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub submitted_at: Option<time::OffsetDateTime>,
pub team: Option<Team>,
#[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>,
pub user: Option<User>,
}
impl_from_response!(PullReview);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct PullReviewComment {
pub body: Option<String>,
pub commit_id: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
pub diff_hunk: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub html_url: Option<url::Url>,
pub id: Option<i64>,
pub original_commit_id: Option<String>,
pub original_position: Option<u64>,
pub path: Option<String>,
pub position: Option<u64>,
pub pull_request_review_id: Option<i64>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub pull_request_url: Option<url::Url>,
pub resolver: Option<User>,
#[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>,
pub user: Option<User>,
}
impl_from_response!(PullReviewComment);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct PullReviewRequestOptions {
pub reviewers: Option<Vec<String>>,
pub team_reviewers: Option<Vec<String>>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct PushMirror {
pub branch_filter: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub created: Option<time::OffsetDateTime>,
pub interval: Option<String>,
pub last_error: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub last_update: Option<time::OffsetDateTime>,
pub public_key: Option<String>,
pub remote_address: Option<String>,
pub remote_name: Option<String>,
pub repo_name: Option<String>,
pub sync_on_commit: Option<bool>,
}
impl_from_response!(PushMirror);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct QuotaGroup {
pub name: Option<String>,
pub rules: Option<Vec<QuotaRuleInfo>>,
}
impl_from_response!(QuotaGroup);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct QuotaInfo {
pub groups: Option<Vec<QuotaGroup>>,
pub used: Option<QuotaUsed>,
}
impl_from_response!(QuotaInfo);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct QuotaRuleInfo {
pub limit: Option<i64>,
pub name: Option<String>,
pub subjects: Option<Vec<String>>,
}
impl_from_response!(QuotaRuleInfo);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct QuotaUsed {
pub size: Option<QuotaUsedSize>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct QuotaUsedArtifact {
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub html_url: Option<url::Url>,
pub name: Option<String>,
pub size: Option<i64>,
}
impl_from_response!(QuotaUsedArtifact);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct QuotaUsedAttachment {
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub api_url: Option<url::Url>,
pub contained_in: Option<QuotaUsedAttachmentContainedIn>,
pub name: Option<String>,
pub size: Option<i64>,
}
impl_from_response!(QuotaUsedAttachment);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct QuotaUsedAttachmentContainedIn {
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub api_url: Option<url::Url>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub html_url: Option<url::Url>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct QuotaUsedPackage {
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub html_url: Option<url::Url>,
pub name: Option<String>,
pub size: Option<i64>,
#[serde(rename = "type")]
pub r#type: Option<String>,
pub version: Option<String>,
}
impl_from_response!(QuotaUsedPackage);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct QuotaUsedSize {
pub assets: Option<QuotaUsedSizeAssets>,
pub git: Option<QuotaUsedSizeGit>,
pub repos: Option<QuotaUsedSizeRepos>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct QuotaUsedSizeAssets {
pub artifacts: Option<i64>,
pub attachments: Option<QuotaUsedSizeAssetsAttachments>,
pub packages: Option<QuotaUsedSizeAssetsPackages>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct QuotaUsedSizeAssetsAttachments {
pub issues: Option<i64>,
pub releases: Option<i64>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct QuotaUsedSizeAssetsPackages {
pub all: Option<i64>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct QuotaUsedSizeGit {
#[serde(rename = "LFS")]
pub lfs: Option<i64>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct QuotaUsedSizeRepos {
pub private: Option<i64>,
pub public: Option<i64>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Reaction {
pub content: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
pub user: Option<User>,
}
impl_from_response!(Reaction);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Reference {
pub object: Option<GitObject>,
#[serde(rename = "ref")]
pub r#ref: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
}
impl_from_response!(Reference);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct RegistrationToken {
pub token: Option<String>,
}
impl_from_response!(RegistrationToken);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Release {
pub archive_download_count: Option<TagArchiveDownloadCount>,
pub assets: Option<Vec<Attachment>>,
pub author: Option<User>,
pub body: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
pub draft: Option<bool>,
pub hide_archive_links: Option<bool>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub html_url: Option<url::Url>,
pub id: Option<i64>,
pub name: Option<String>,
pub prerelease: Option<bool>,
#[serde(with = "time::serde::rfc3339::option")]
pub published_at: Option<time::OffsetDateTime>,
pub tag_name: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub tarball_url: Option<url::Url>,
pub target_commitish: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub upload_url: Option<url::Url>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub zipball_url: Option<url::Url>,
}
impl_from_response!(Release);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct RenameOrgOption {
pub new_name: String,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct RenameUserOption {
pub new_username: String,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct ReplaceFlagsOption {
pub flags: Option<Vec<String>>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct RepoCollaboratorPermission {
pub permission: Option<String>,
pub role_name: Option<String>,
pub user: Option<User>,
}
impl_from_response!(RepoCollaboratorPermission);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct RepoCommit {
pub author: Option<CommitUser>,
pub committer: Option<CommitUser>,
pub message: Option<String>,
pub tree: Option<CommitMeta>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
pub verification: Option<PayloadCommitVerification>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct RepoTopicOptions {
pub topics: Option<Vec<String>>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct RepoTransfer {
pub doer: Option<User>,
pub recipient: Option<User>,
pub teams: Option<Vec<Team>>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Repository {
pub allow_fast_forward_only_merge: Option<bool>,
pub allow_merge_commits: Option<bool>,
pub allow_rebase: Option<bool>,
pub allow_rebase_explicit: Option<bool>,
pub allow_rebase_update: Option<bool>,
pub allow_squash_merge: Option<bool>,
pub archived: Option<bool>,
#[serde(with = "time::serde::rfc3339::option")]
pub archived_at: Option<time::OffsetDateTime>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub avatar_url: Option<url::Url>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub clone_url: Option<url::Url>,
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
pub default_allow_maintainer_edit: Option<bool>,
pub default_branch: Option<String>,
pub default_delete_branch_after_merge: Option<bool>,
pub default_merge_style: Option<DefaultMergeStyle>,
pub default_update_style: Option<String>,
pub description: Option<String>,
pub empty: Option<bool>,
pub external_tracker: Option<ExternalTracker>,
pub external_wiki: Option<ExternalWiki>,
pub fork: Option<bool>,
pub forks_count: Option<i64>,
pub full_name: Option<String>,
pub globally_editable_wiki: Option<bool>,
pub has_actions: Option<bool>,
pub has_issues: Option<bool>,
pub has_packages: Option<bool>,
pub has_projects: Option<bool>,
pub has_pull_requests: Option<bool>,
pub has_releases: Option<bool>,
pub has_wiki: Option<bool>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub html_url: Option<url::Url>,
pub id: Option<i64>,
pub ignore_whitespace_conflicts: Option<bool>,
pub internal: Option<bool>,
pub internal_tracker: Option<InternalTracker>,
pub language: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub languages_url: Option<url::Url>,
pub link: Option<String>,
pub mirror: Option<bool>,
pub mirror_interval: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub mirror_updated: Option<time::OffsetDateTime>,
pub name: Option<String>,
pub object_format_name: Option<ObjectFormatName>,
pub open_issues_count: Option<i64>,
pub open_pr_counter: Option<i64>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub original_url: Option<url::Url>,
pub owner: Option<User>,
pub parent: Option<Box<Repository>>,
pub permissions: Option<Permission>,
pub private: Option<bool>,
pub release_counter: Option<i64>,
pub repo_transfer: Option<RepoTransfer>,
pub size: Option<i64>,
#[serde(deserialize_with = "crate::deserialize_optional_ssh_url")]
pub ssh_url: Option<url::Url>,
pub stars_count: Option<i64>,
pub template: Option<bool>,
pub topics: Option<Vec<String>>,
#[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
pub watchers_count: Option<i64>,
pub website: Option<String>,
pub wiki_branch: Option<String>,
}
impl_from_response!(Repository);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct RepositoryMeta {
pub full_name: Option<String>,
pub id: Option<i64>,
pub name: Option<String>,
pub owner: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct SearchResults {
pub data: Option<Vec<Repository>>,
pub ok: Option<bool>,
}
impl_from_response!(SearchResults);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Secret {
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
pub name: Option<String>,
}
impl_from_response!(Secret);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct ServerVersion {
pub version: Option<String>,
}
impl_from_response!(ServerVersion);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct SetUserQuotaGroupsOptions {
pub groups: Vec<String>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum StateType {
#[serde(rename = "open")]
Open,
#[serde(rename = "closed")]
Closed,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct StopWatch {
#[serde(with = "time::serde::rfc3339::option")]
pub created: Option<time::OffsetDateTime>,
pub duration: Option<String>,
pub issue_index: Option<i64>,
pub issue_title: Option<String>,
pub repo_name: Option<String>,
pub repo_owner_name: Option<String>,
pub seconds: Option<i64>,
}
impl_from_response!(StopWatch);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct SubmitPullReviewOptions {
pub body: Option<String>,
pub event: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct SyncForkInfo {
pub allowed: Option<bool>,
pub base_commit: Option<String>,
pub commits_behind: Option<i64>,
pub fork_commit: Option<String>,
}
impl_from_response!(SyncForkInfo);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Tag {
pub archive_download_count: Option<TagArchiveDownloadCount>,
pub commit: Option<CommitMeta>,
pub id: Option<String>,
pub message: Option<String>,
pub name: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub tarball_url: Option<url::Url>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub zipball_url: Option<url::Url>,
}
impl_from_response!(Tag);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct TagArchiveDownloadCount {
pub tar_gz: Option<i64>,
pub zip: Option<i64>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct TagProtection {
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
pub id: Option<i64>,
pub name_pattern: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>,
pub whitelist_teams: Option<Vec<String>>,
pub whitelist_usernames: Option<Vec<String>>,
}
impl_from_response!(TagProtection);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Team {
pub can_create_org_repo: Option<bool>,
pub description: Option<String>,
pub id: Option<i64>,
pub includes_all_repositories: Option<bool>,
pub name: Option<String>,
pub organization: Option<Organization>,
pub permission: Option<TeamPermission>,
pub units: Option<Vec<String>>,
pub units_map: Option<BTreeMap<String, String>>,
}
impl_from_response!(Team);
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum TeamPermission {
#[serde(rename = "none")]
None,
#[serde(rename = "read")]
Read,
#[serde(rename = "write")]
Write,
#[serde(rename = "admin")]
Admin,
#[serde(rename = "owner")]
Owner,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct TimelineComment {
pub assignee: Option<User>,
pub assignee_team: Option<Team>,
pub body: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
pub dependent_issue: Option<Issue>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub html_url: Option<url::Url>,
pub id: Option<i64>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub issue_url: Option<url::Url>,
pub label: Option<Label>,
pub milestone: Option<Milestone>,
pub new_ref: Option<String>,
pub new_title: Option<String>,
pub old_milestone: Option<Milestone>,
pub old_project_id: Option<i64>,
pub old_ref: Option<String>,
pub old_title: Option<String>,
pub project_id: Option<i64>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub pull_request_url: Option<url::Url>,
pub ref_action: Option<String>,
pub ref_comment: Option<Comment>,
pub ref_commit_sha: Option<String>,
pub ref_issue: Option<Issue>,
pub removed_assignee: Option<bool>,
pub resolve_doer: Option<User>,
pub review_id: Option<i64>,
pub tracked_time: Option<TrackedTime>,
#[serde(rename = "type")]
pub r#type: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub updated_at: Option<time::OffsetDateTime>,
pub user: Option<User>,
}
impl_from_response!(TimelineComment);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct TopicName {
pub topics: Option<Vec<String>>,
}
impl_from_response!(TopicName);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct TopicResponse {
#[serde(with = "time::serde::rfc3339::option")]
pub created: Option<time::OffsetDateTime>,
pub id: Option<i64>,
pub repo_count: Option<i64>,
pub topic_name: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub updated: Option<time::OffsetDateTime>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct TrackedTime {
#[serde(with = "time::serde::rfc3339::option")]
pub created: Option<time::OffsetDateTime>,
pub id: Option<i64>,
pub issue: Option<Issue>,
pub issue_id: Option<i64>,
pub time: Option<i64>,
pub user_id: Option<i64>,
pub user_name: Option<String>,
}
impl_from_response!(TrackedTime);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct TransferRepoOption {
pub new_owner: String,
pub team_ids: Option<Vec<i64>>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct UpdateBranchRepoOption {
pub name: String,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct UpdateFileOptions {
pub author: Option<Identity>,
pub branch: Option<String>,
pub committer: Option<Identity>,
pub content: String,
pub dates: Option<CommitDateOptions>,
pub from_path: Option<String>,
pub message: Option<String>,
pub new_branch: Option<String>,
pub sha: String,
pub signoff: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct UpdateRepoAvatarOption {
pub image: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct UpdateUserAvatarOption {
pub image: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct UpdateVariableOption {
pub name: Option<String>,
pub value: String,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct User {
pub active: Option<bool>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub avatar_url: Option<url::Url>,
#[serde(with = "time::serde::rfc3339::option")]
pub created: Option<time::OffsetDateTime>,
pub description: Option<String>,
pub email: Option<String>,
pub followers_count: Option<i64>,
pub following_count: Option<i64>,
pub full_name: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub html_url: Option<url::Url>,
pub id: Option<i64>,
pub is_admin: Option<bool>,
pub language: Option<String>,
#[serde(with = "time::serde::rfc3339::option")]
pub last_login: Option<time::OffsetDateTime>,
pub location: Option<String>,
pub login: Option<String>,
pub login_name: Option<String>,
pub prohibit_login: Option<bool>,
pub pronouns: Option<String>,
pub restricted: Option<bool>,
pub source_id: Option<i64>,
pub starred_repos_count: Option<i64>,
pub visibility: Option<String>,
pub website: Option<String>,
}
impl_from_response!(User);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct UserHeatmapData {
pub contributions: Option<i64>,
pub timestamp: Option<i64>,
}
impl_from_response!(UserHeatmapData);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct UserSettings {
pub description: Option<String>,
pub diff_view_style: Option<String>,
pub enable_repo_unit_hints: Option<bool>,
pub full_name: Option<String>,
pub hide_activity: Option<bool>,
pub hide_email: Option<bool>,
pub hide_pronouns: Option<bool>,
pub language: Option<String>,
pub location: Option<String>,
pub pronouns: Option<String>,
pub theme: Option<String>,
pub website: Option<String>,
}
impl_from_response!(UserSettings);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct UserSettingsOptions {
pub description: Option<String>,
pub diff_view_style: Option<String>,
pub enable_repo_unit_hints: Option<bool>,
pub full_name: Option<String>,
pub hide_activity: Option<bool>,
pub hide_email: Option<bool>,
pub hide_pronouns: Option<bool>,
pub language: Option<String>,
pub location: Option<String>,
pub pronouns: Option<String>,
pub theme: Option<String>,
pub website: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct VerifyGPGKeyOption {
pub armored_signature: Option<String>,
pub key_id: String,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct WatchInfo {
#[serde(with = "time::serde::rfc3339::option")]
pub created_at: Option<time::OffsetDateTime>,
pub ignored: Option<bool>,
pub reason: Option<serde_json::Value>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub repository_url: Option<url::Url>,
pub subscribed: Option<bool>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub url: Option<url::Url>,
}
impl_from_response!(WatchInfo);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct WikiCommit {
pub author: Option<CommitUser>,
pub commiter: Option<CommitUser>,
pub message: Option<String>,
pub sha: Option<String>,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct WikiCommitList {
pub commits: Option<Vec<WikiCommit>>,
pub count: Option<i64>,
}
impl_from_response!(WikiCommitList);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct WikiPage {
pub commit_count: Option<i64>,
pub content_base64: Option<String>,
pub footer: Option<String>,
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub html_url: Option<url::Url>,
pub last_commit: Option<WikiCommit>,
pub sidebar: Option<String>,
pub sub_url: Option<String>,
pub title: Option<String>,
}
impl_from_response!(WikiPage);
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct WikiPageMetaData {
#[serde(deserialize_with = "crate::none_if_blank_url")]
pub html_url: Option<url::Url>,
pub last_commit: Option<WikiCommit>,
pub sub_url: Option<String>,
pub title: Option<String>,
}
impl_from_response!(WikiPageMetaData);
pub struct AccessTokenListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for AccessTokenListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for AccessTokenListHeaders {}
impl crate::CountHeader for AccessTokenListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct ActivityFeedsListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for ActivityFeedsListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for ActivityFeedsListHeaders {}
impl crate::CountHeader for ActivityFeedsListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct BlockedUserListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for BlockedUserListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for BlockedUserListHeaders {}
impl crate::CountHeader for BlockedUserListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct BranchListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for BranchListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for BranchListHeaders {}
impl crate::CountHeader for BranchListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct ChangedFileListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for ChangedFileListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for ChangedFileListHeaders {}
impl crate::CountHeader for ChangedFileListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct ChangedFileListWithPaginationHeaders {
pub x_has_more: Option<bool>,
pub x_page: Option<i64>,
pub x_page_count: Option<i64>,
pub x_per_page: Option<i64>,
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for ChangedFileListWithPaginationHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_has_more = map
.get("x-hasmore")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<bool>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
let x_page = map
.get("x-page")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
let x_page_count = map
.get("x-pagecount")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
let x_per_page = map
.get("x-perpage")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self {
x_has_more,
x_page,
x_page_count,
x_per_page,
x_total_count,
})
}
}
impl crate::sealed::Sealed for ChangedFileListWithPaginationHeaders {}
impl crate::CountHeader for ChangedFileListWithPaginationHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct CombinedStatusHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for CombinedStatusHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for CombinedStatusHeaders {}
impl crate::CountHeader for CombinedStatusHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct CommentListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for CommentListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for CommentListHeaders {}
impl crate::CountHeader for CommentListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct CommitListHeaders {
pub x_has_more: Option<bool>,
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for CommitListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_has_more = map
.get("x-hasmore")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<bool>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self {
x_has_more,
x_total_count,
})
}
}
impl crate::sealed::Sealed for CommitListHeaders {}
impl crate::CountHeader for CommitListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct CommitStatusListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for CommitStatusListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for CommitStatusListHeaders {}
impl crate::CountHeader for CommitStatusListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct CronListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for CronListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for CronListHeaders {}
impl crate::CountHeader for CronListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct DeployKeyListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for DeployKeyListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for DeployKeyListHeaders {}
impl crate::CountHeader for DeployKeyListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct GpgKeyListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for GpgKeyListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for GpgKeyListHeaders {}
impl crate::CountHeader for GpgKeyListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct HookListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for HookListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for HookListHeaders {}
impl crate::CountHeader for HookListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct IssueListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for IssueListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for IssueListHeaders {}
impl crate::CountHeader for IssueListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct LabelListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for LabelListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for LabelListHeaders {}
impl crate::CountHeader for LabelListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct MilestoneListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for MilestoneListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for MilestoneListHeaders {}
impl crate::CountHeader for MilestoneListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct NotificationThreadListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for NotificationThreadListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for NotificationThreadListHeaders {}
impl crate::CountHeader for NotificationThreadListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct OAuth2ApplicationListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for OAuth2ApplicationListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for OAuth2ApplicationListHeaders {}
impl crate::CountHeader for OAuth2ApplicationListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct OrganizationListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for OrganizationListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for OrganizationListHeaders {}
impl crate::CountHeader for OrganizationListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct PackageListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for PackageListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for PackageListHeaders {}
impl crate::CountHeader for PackageListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct PublicKeyListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for PublicKeyListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for PublicKeyListHeaders {}
impl crate::CountHeader for PublicKeyListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct PullRequestListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for PullRequestListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for PullRequestListHeaders {}
impl crate::CountHeader for PullRequestListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct PullReviewListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for PullReviewListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for PullReviewListHeaders {}
impl crate::CountHeader for PullReviewListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct PushMirrorListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for PushMirrorListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for PushMirrorListHeaders {}
impl crate::CountHeader for PushMirrorListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct QuotaUsedArtifactListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for QuotaUsedArtifactListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for QuotaUsedArtifactListHeaders {}
impl crate::CountHeader for QuotaUsedArtifactListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct QuotaUsedAttachmentListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for QuotaUsedAttachmentListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for QuotaUsedAttachmentListHeaders {}
impl crate::CountHeader for QuotaUsedAttachmentListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct QuotaUsedPackageListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for QuotaUsedPackageListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for QuotaUsedPackageListHeaders {}
impl crate::CountHeader for QuotaUsedPackageListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct ReactionListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for ReactionListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for ReactionListHeaders {}
impl crate::CountHeader for ReactionListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct ReleaseListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for ReleaseListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for ReleaseListHeaders {}
impl crate::CountHeader for ReleaseListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct RepositoryListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for RepositoryListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for RepositoryListHeaders {}
impl crate::CountHeader for RepositoryListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct SecretListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for SecretListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for SecretListHeaders {}
impl crate::CountHeader for SecretListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct StopWatchListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for StopWatchListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for StopWatchListHeaders {}
impl crate::CountHeader for StopWatchListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct TagListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for TagListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for TagListHeaders {}
impl crate::CountHeader for TagListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct TeamListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for TeamListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for TeamListHeaders {}
impl crate::CountHeader for TeamListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct TimelineListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for TimelineListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for TimelineListHeaders {}
impl crate::CountHeader for TimelineListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct TrackedTimeListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for TrackedTimeListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for TrackedTimeListHeaders {}
impl crate::CountHeader for TrackedTimeListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct UserListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for UserListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for UserListHeaders {}
impl crate::CountHeader for UserListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct VariableListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for VariableListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for VariableListHeaders {}
impl crate::CountHeader for VariableListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct WikiCommitListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for WikiCommitListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for WikiCommitListHeaders {}
impl crate::CountHeader for WikiCommitListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct WikiPageListHeaders {
pub x_total_count: Option<i64>,
}
impl TryFrom<&reqwest::header::HeaderMap> for WikiPageListHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let x_total_count = map
.get("x-total-count")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
Ok(Self { x_total_count })
}
}
impl crate::sealed::Sealed for WikiPageListHeaders {}
impl crate::CountHeader for WikiPageListHeaders {
fn count(&self) -> Option<usize> {
self.x_total_count.map(|x| x as usize)
}
}
pub struct QuotaExceededHeaders {
pub message: Option<String>,
pub user_id: Option<i64>,
pub username: Option<String>,
}
impl TryFrom<&reqwest::header::HeaderMap> for QuotaExceededHeaders {
type Error = StructureError;
fn try_from(map: &reqwest::header::HeaderMap) -> Result<Self, Self::Error> {
let message = map
.get("message")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
Ok::<_, StructureError>(s.to_string())
})
.transpose()?;
let user_id = map
.get("user_id")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
s.parse::<i64>()
.map_err(|_| StructureError::HeaderParseFailed)
})
.transpose()?;
let username = map
.get("username")
.map(|s| -> Result<_, _> {
let s = s.to_str().map_err(|_| StructureError::HeaderNotAscii)?;
Ok::<_, StructureError>(s.to_string())
})
.transpose()?;
Ok(Self {
message,
user_id,
username,
})
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct AdminSearchEmailsQuery {
pub q: Option<String>,
}
impl AdminSearchEmailsQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(q) = self.q {
list.push(("q", q));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct AdminSearchRunJobsQuery {
pub labels: Option<String>,
}
impl AdminSearchRunJobsQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(labels) = self.labels {
list.push(("labels", labels));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct AdminUnadoptedListQuery {
pub pattern: Option<String>,
}
impl AdminUnadoptedListQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(pattern) = self.pattern {
list.push(("pattern", pattern));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct AdminSearchUsersQuery {
pub source_id: Option<i64>,
pub login_name: Option<String>,
pub sort: Option<AdminSearchUsersQuerySort>,
}
impl AdminSearchUsersQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(source_id) = self.source_id {
list.push(("source_id", source_id.to_string()));
}
if let Some(login_name) = self.login_name {
list.push(("login_name", login_name));
}
if let Some(sort) = self.sort {
list.push(("sort", sort.as_str().to_string()));
}
list
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum AdminSearchUsersQuerySort {
#[serde(rename = "oldest")]
Oldest,
#[serde(rename = "newest")]
Newest,
#[serde(rename = "alphabetically")]
Alphabetically,
#[serde(rename = "reversealphabetically")]
Reversealphabetically,
#[serde(rename = "recentupdate")]
Recentupdate,
#[serde(rename = "leastupdate")]
Leastupdate,
}
impl AdminSearchUsersQuerySort {
fn as_str(&self) -> &'static str {
match self {
AdminSearchUsersQuerySort::Oldest => "oldest",
AdminSearchUsersQuerySort::Newest => "newest",
AdminSearchUsersQuerySort::Alphabetically => "alphabetically",
AdminSearchUsersQuerySort::Reversealphabetically => "reversealphabetically",
AdminSearchUsersQuerySort::Recentupdate => "recentupdate",
AdminSearchUsersQuerySort::Leastupdate => "leastupdate",
}
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct AdminDeleteUserQuery {
pub purge: Option<bool>,
}
impl AdminDeleteUserQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(purge) = self.purge {
list.push(("purge", purge.to_string()));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct NotifyGetListQuery {
pub all: Option<bool>,
pub status_types: Option<Vec<String>>,
pub subject_type: Option<Vec<NotifyGetListQuerySubjectType>>,
pub since: Option<time::OffsetDateTime>,
pub before: Option<time::OffsetDateTime>,
}
impl NotifyGetListQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(all) = self.all {
list.push(("all", all.to_string()));
}
if let Some(status_types) = self.status_types {
if !status_types.is_empty() {
for item in status_types {
list.push(("status-types", item.to_string()));
}
}
}
if let Some(subject_type) = self.subject_type {
if !subject_type.is_empty() {
for item in subject_type {
list.push(("subject-type", item.as_str().to_string()));
}
}
}
if let Some(since) = self.since {
list.push((
"since",
since
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
if let Some(before) = self.before {
list.push((
"before",
before
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
list
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum NotifyGetListQuerySubjectType {
#[serde(rename = "issue")]
Issue,
#[serde(rename = "pull")]
Pull,
#[serde(rename = "repository")]
Repository,
}
impl NotifyGetListQuerySubjectType {
fn as_str(&self) -> &'static str {
match self {
NotifyGetListQuerySubjectType::Issue => "issue",
NotifyGetListQuerySubjectType::Pull => "pull",
NotifyGetListQuerySubjectType::Repository => "repository",
}
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct NotifyReadListQuery {
pub last_read_at: Option<time::OffsetDateTime>,
pub all: Option<bool>,
pub status_types: Option<Vec<String>>,
pub to_status: Option<String>,
}
impl NotifyReadListQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(last_read_at) = self.last_read_at {
list.push((
"last_read_at",
last_read_at
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
if let Some(all) = self.all {
list.push(("all", all.to_string()));
}
if let Some(status_types) = self.status_types {
if !status_types.is_empty() {
for item in status_types {
list.push(("status-types", item.to_string()));
}
}
}
if let Some(to_status) = self.to_status {
list.push(("to-status", to_status));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct NotifyReadThreadQuery {
pub to_status: Option<String>,
}
impl NotifyReadThreadQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(to_status) = self.to_status {
list.push(("to-status", to_status));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct OrgSearchRunJobsQuery {
pub labels: Option<String>,
}
impl OrgSearchRunJobsQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(labels) = self.labels {
list.push(("labels", labels));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct OrgListActivityFeedsQuery {
pub date: Option<time::Date>,
}
impl OrgListActivityFeedsQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(date) = self.date {
list.push(("date", date.to_string()));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct OrgListLabelsQuery {
pub sort: Option<OrgListLabelsQuerySort>,
}
impl OrgListLabelsQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(sort) = self.sort {
list.push(("sort", sort.as_str().to_string()));
}
list
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum OrgListLabelsQuerySort {
#[serde(rename = "mostissues")]
Mostissues,
#[serde(rename = "leastissues")]
Leastissues,
#[serde(rename = "reversealphabetically")]
Reversealphabetically,
}
impl OrgListLabelsQuerySort {
fn as_str(&self) -> &'static str {
match self {
OrgListLabelsQuerySort::Mostissues => "mostissues",
OrgListLabelsQuerySort::Leastissues => "leastissues",
OrgListLabelsQuerySort::Reversealphabetically => "reversealphabetically",
}
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct OrgCheckQuotaQuery {
pub subject: String,
}
impl OrgCheckQuotaQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
let subject = self.subject;
list.push(("subject", subject));
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct TeamSearchQuery {
pub q: Option<String>,
pub include_desc: Option<bool>,
}
impl TeamSearchQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(q) = self.q {
list.push(("q", q));
}
if let Some(include_desc) = self.include_desc {
list.push(("include_desc", include_desc.to_string()));
}
list
}
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct TeamSearchResults {
pub data: Option<Vec<Team>>,
pub ok: Option<bool>,
}
impl_from_response!(TeamSearchResults);
#[derive(Debug, Clone, PartialEq, Default)]
pub struct ListPackagesQuery {
pub r#type: Option<ListPackagesQueryType>,
pub q: Option<String>,
}
impl ListPackagesQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(r#type) = self.r#type {
list.push(("type", r#type.as_str().to_string()));
}
if let Some(q) = self.q {
list.push(("q", q));
}
list
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum ListPackagesQueryType {
#[serde(rename = "alpine")]
Alpine,
#[serde(rename = "cargo")]
Cargo,
#[serde(rename = "chef")]
Chef,
#[serde(rename = "composer")]
Composer,
#[serde(rename = "conan")]
Conan,
#[serde(rename = "conda")]
Conda,
#[serde(rename = "container")]
Container,
#[serde(rename = "cran")]
Cran,
#[serde(rename = "debian")]
Debian,
#[serde(rename = "generic")]
Generic,
#[serde(rename = "go")]
Go,
#[serde(rename = "helm")]
Helm,
#[serde(rename = "maven")]
Maven,
#[serde(rename = "npm")]
Npm,
#[serde(rename = "nuget")]
Nuget,
#[serde(rename = "pub")]
Pub,
#[serde(rename = "pypi")]
Pypi,
#[serde(rename = "rpm")]
Rpm,
#[serde(rename = "rubygems")]
Rubygems,
#[serde(rename = "swift")]
Swift,
#[serde(rename = "vagrant")]
Vagrant,
}
impl ListPackagesQueryType {
fn as_str(&self) -> &'static str {
match self {
ListPackagesQueryType::Alpine => "alpine",
ListPackagesQueryType::Cargo => "cargo",
ListPackagesQueryType::Chef => "chef",
ListPackagesQueryType::Composer => "composer",
ListPackagesQueryType::Conan => "conan",
ListPackagesQueryType::Conda => "conda",
ListPackagesQueryType::Container => "container",
ListPackagesQueryType::Cran => "cran",
ListPackagesQueryType::Debian => "debian",
ListPackagesQueryType::Generic => "generic",
ListPackagesQueryType::Go => "go",
ListPackagesQueryType::Helm => "helm",
ListPackagesQueryType::Maven => "maven",
ListPackagesQueryType::Npm => "npm",
ListPackagesQueryType::Nuget => "nuget",
ListPackagesQueryType::Pub => "pub",
ListPackagesQueryType::Pypi => "pypi",
ListPackagesQueryType::Rpm => "rpm",
ListPackagesQueryType::Rubygems => "rubygems",
ListPackagesQueryType::Swift => "swift",
ListPackagesQueryType::Vagrant => "vagrant",
}
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct IssueSearchIssuesQuery {
pub state: Option<IssueSearchIssuesQueryState>,
pub labels: Option<String>,
pub milestones: Option<String>,
pub q: Option<String>,
pub priority_repo_id: Option<i64>,
pub r#type: Option<IssueSearchIssuesQueryType>,
pub since: Option<time::OffsetDateTime>,
pub before: Option<time::OffsetDateTime>,
pub assigned: Option<bool>,
pub created: Option<bool>,
pub mentioned: Option<bool>,
pub review_requested: Option<bool>,
pub reviewed: Option<bool>,
pub owner: Option<String>,
pub team: Option<String>,
pub sort: Option<IssueSearchIssuesQuerySort>,
}
impl IssueSearchIssuesQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(state) = self.state {
list.push(("state", state.as_str().to_string()));
}
if let Some(labels) = self.labels {
list.push(("labels", labels));
}
if let Some(milestones) = self.milestones {
list.push(("milestones", milestones));
}
if let Some(q) = self.q {
list.push(("q", q));
}
if let Some(priority_repo_id) = self.priority_repo_id {
list.push(("priority_repo_id", priority_repo_id.to_string()));
}
if let Some(r#type) = self.r#type {
list.push(("type", r#type.as_str().to_string()));
}
if let Some(since) = self.since {
list.push((
"since",
since
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
if let Some(before) = self.before {
list.push((
"before",
before
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
if let Some(assigned) = self.assigned {
list.push(("assigned", assigned.to_string()));
}
if let Some(created) = self.created {
list.push(("created", created.to_string()));
}
if let Some(mentioned) = self.mentioned {
list.push(("mentioned", mentioned.to_string()));
}
if let Some(review_requested) = self.review_requested {
list.push(("review_requested", review_requested.to_string()));
}
if let Some(reviewed) = self.reviewed {
list.push(("reviewed", reviewed.to_string()));
}
if let Some(owner) = self.owner {
list.push(("owner", owner));
}
if let Some(team) = self.team {
list.push(("team", team));
}
if let Some(sort) = self.sort {
list.push(("sort", sort.as_str().to_string()));
}
list
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum IssueSearchIssuesQueryState {
#[serde(rename = "open")]
Open,
#[serde(rename = "closed")]
Closed,
#[serde(rename = "all")]
All,
}
impl IssueSearchIssuesQueryState {
fn as_str(&self) -> &'static str {
match self {
IssueSearchIssuesQueryState::Open => "open",
IssueSearchIssuesQueryState::Closed => "closed",
IssueSearchIssuesQueryState::All => "all",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum IssueSearchIssuesQueryType {
#[serde(rename = "issues")]
Issues,
#[serde(rename = "pulls")]
Pulls,
}
impl IssueSearchIssuesQueryType {
fn as_str(&self) -> &'static str {
match self {
IssueSearchIssuesQueryType::Issues => "issues",
IssueSearchIssuesQueryType::Pulls => "pulls",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum IssueSearchIssuesQuerySort {
#[serde(rename = "relevance")]
Relevance,
#[serde(rename = "latest")]
Latest,
#[serde(rename = "oldest")]
Oldest,
#[serde(rename = "recentupdate")]
Recentupdate,
#[serde(rename = "leastupdate")]
Leastupdate,
#[serde(rename = "mostcomment")]
Mostcomment,
#[serde(rename = "leastcomment")]
Leastcomment,
#[serde(rename = "nearduedate")]
Nearduedate,
#[serde(rename = "farduedate")]
Farduedate,
}
impl IssueSearchIssuesQuerySort {
fn as_str(&self) -> &'static str {
match self {
IssueSearchIssuesQuerySort::Relevance => "relevance",
IssueSearchIssuesQuerySort::Latest => "latest",
IssueSearchIssuesQuerySort::Oldest => "oldest",
IssueSearchIssuesQuerySort::Recentupdate => "recentupdate",
IssueSearchIssuesQuerySort::Leastupdate => "leastupdate",
IssueSearchIssuesQuerySort::Mostcomment => "mostcomment",
IssueSearchIssuesQuerySort::Leastcomment => "leastcomment",
IssueSearchIssuesQuerySort::Nearduedate => "nearduedate",
IssueSearchIssuesQuerySort::Farduedate => "farduedate",
}
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct RepoSearchQuery {
pub q: Option<String>,
pub topic: Option<bool>,
pub include_desc: Option<bool>,
pub uid: Option<i64>,
pub priority_owner_id: Option<i64>,
pub team_id: Option<i64>,
pub starred_by: Option<i64>,
pub private: Option<bool>,
pub is_private: Option<bool>,
pub template: Option<bool>,
pub archived: Option<bool>,
pub mode: Option<String>,
pub exclusive: Option<bool>,
pub sort: Option<RepoSearchQuerySort>,
pub order: Option<RepoSearchQueryOrder>,
}
impl RepoSearchQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(q) = self.q {
list.push(("q", q));
}
if let Some(topic) = self.topic {
list.push(("topic", topic.to_string()));
}
if let Some(include_desc) = self.include_desc {
list.push(("includeDesc", include_desc.to_string()));
}
if let Some(uid) = self.uid {
list.push(("uid", uid.to_string()));
}
if let Some(priority_owner_id) = self.priority_owner_id {
list.push(("priority_owner_id", priority_owner_id.to_string()));
}
if let Some(team_id) = self.team_id {
list.push(("team_id", team_id.to_string()));
}
if let Some(starred_by) = self.starred_by {
list.push(("starredBy", starred_by.to_string()));
}
if let Some(private) = self.private {
list.push(("private", private.to_string()));
}
if let Some(is_private) = self.is_private {
list.push(("is_private", is_private.to_string()));
}
if let Some(template) = self.template {
list.push(("template", template.to_string()));
}
if let Some(archived) = self.archived {
list.push(("archived", archived.to_string()));
}
if let Some(mode) = self.mode {
list.push(("mode", mode));
}
if let Some(exclusive) = self.exclusive {
list.push(("exclusive", exclusive.to_string()));
}
if let Some(sort) = self.sort {
list.push(("sort", sort.as_str().to_string()));
}
if let Some(order) = self.order {
list.push(("order", order.as_str().to_string()));
}
list
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum RepoSearchQuerySort {
#[serde(rename = "alpha")]
Alpha,
#[serde(rename = "created")]
Created,
#[serde(rename = "updated")]
Updated,
#[serde(rename = "size")]
Size,
#[serde(rename = "git_size")]
GitSize,
#[serde(rename = "lfs_size")]
LfsSize,
#[serde(rename = "id")]
Id,
#[serde(rename = "stars")]
Stars,
#[serde(rename = "forks")]
Forks,
}
impl RepoSearchQuerySort {
fn as_str(&self) -> &'static str {
match self {
RepoSearchQuerySort::Alpha => "alpha",
RepoSearchQuerySort::Created => "created",
RepoSearchQuerySort::Updated => "updated",
RepoSearchQuerySort::Size => "size",
RepoSearchQuerySort::GitSize => "git_size",
RepoSearchQuerySort::LfsSize => "lfs_size",
RepoSearchQuerySort::Id => "id",
RepoSearchQuerySort::Stars => "stars",
RepoSearchQuerySort::Forks => "forks",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum RepoSearchQueryOrder {
#[serde(rename = "asc")]
Asc,
#[serde(rename = "desc")]
Desc,
}
impl RepoSearchQueryOrder {
fn as_str(&self) -> &'static str {
match self {
RepoSearchQueryOrder::Asc => "asc",
RepoSearchQueryOrder::Desc => "desc",
}
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct RepoSearchRunJobsQuery {
pub labels: Option<String>,
}
impl RepoSearchRunJobsQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(labels) = self.labels {
list.push(("labels", labels));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct ListActionRunsQuery {
pub event: Option<Vec<String>>,
pub status: Option<Vec<ListActionRunsQueryStatus>>,
pub run_number: Option<i64>,
pub head_sha: Option<String>,
}
impl ListActionRunsQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(event) = self.event {
if !event.is_empty() {
let mut s = String::new();
for (i, item) in event.iter().enumerate() {
s.push_str(item);
if i < event.len() - 1 {
s.push(',')
}
}
list.push(("event", s));
}
}
if let Some(status) = self.status {
if !status.is_empty() {
let mut s = String::new();
for (i, item) in status.iter().enumerate() {
s.push_str(item.as_str());
if i < status.len() - 1 {
s.push(',')
}
}
list.push(("status", s));
}
}
if let Some(run_number) = self.run_number {
list.push(("run_number", run_number.to_string()));
}
if let Some(head_sha) = self.head_sha {
list.push(("head_sha", head_sha));
}
list
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum ListActionRunsQueryStatus {
#[serde(rename = "unknown")]
Unknown,
#[serde(rename = "waiting")]
Waiting,
#[serde(rename = "running")]
Running,
#[serde(rename = "success")]
Success,
#[serde(rename = "failure")]
Failure,
#[serde(rename = "cancelled")]
Cancelled,
#[serde(rename = "skipped")]
Skipped,
#[serde(rename = "blocked")]
Blocked,
}
impl ListActionRunsQueryStatus {
fn as_str(&self) -> &'static str {
match self {
ListActionRunsQueryStatus::Unknown => "unknown",
ListActionRunsQueryStatus::Waiting => "waiting",
ListActionRunsQueryStatus::Running => "running",
ListActionRunsQueryStatus::Success => "success",
ListActionRunsQueryStatus::Failure => "failure",
ListActionRunsQueryStatus::Cancelled => "cancelled",
ListActionRunsQueryStatus::Skipped => "skipped",
ListActionRunsQueryStatus::Blocked => "blocked",
}
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct RepoListActivityFeedsQuery {
pub date: Option<time::Date>,
}
impl RepoListActivityFeedsQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(date) = self.date {
list.push(("date", date.to_string()));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct RepoGetAllCommitsQuery {
pub sha: Option<String>,
pub path: Option<String>,
pub stat: Option<bool>,
pub verification: Option<bool>,
pub files: Option<bool>,
pub not: Option<String>,
}
impl RepoGetAllCommitsQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(sha) = self.sha {
list.push(("sha", sha));
}
if let Some(path) = self.path {
list.push(("path", path));
}
if let Some(stat) = self.stat {
list.push(("stat", stat.to_string()));
}
if let Some(verification) = self.verification {
list.push(("verification", verification.to_string()));
}
if let Some(files) = self.files {
list.push(("files", files.to_string()));
}
if let Some(not) = self.not {
list.push(("not", not));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct RepoListStatusesByRefQuery {
pub sort: Option<RepoListStatusesByRefQuerySort>,
pub state: Option<RepoListStatusesByRefQueryState>,
}
impl RepoListStatusesByRefQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(sort) = self.sort {
list.push(("sort", sort.as_str().to_string()));
}
if let Some(state) = self.state {
list.push(("state", state.as_str().to_string()));
}
list
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum RepoListStatusesByRefQuerySort {
#[serde(rename = "oldest")]
Oldest,
#[serde(rename = "recentupdate")]
Recentupdate,
#[serde(rename = "leastupdate")]
Leastupdate,
#[serde(rename = "leastindex")]
Leastindex,
#[serde(rename = "highestindex")]
Highestindex,
}
impl RepoListStatusesByRefQuerySort {
fn as_str(&self) -> &'static str {
match self {
RepoListStatusesByRefQuerySort::Oldest => "oldest",
RepoListStatusesByRefQuerySort::Recentupdate => "recentupdate",
RepoListStatusesByRefQuerySort::Leastupdate => "leastupdate",
RepoListStatusesByRefQuerySort::Leastindex => "leastindex",
RepoListStatusesByRefQuerySort::Highestindex => "highestindex",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum RepoListStatusesByRefQueryState {
#[serde(rename = "pending")]
Pending,
#[serde(rename = "success")]
Success,
#[serde(rename = "error")]
Error,
#[serde(rename = "failure")]
Failure,
#[serde(rename = "warning")]
Warning,
}
impl RepoListStatusesByRefQueryState {
fn as_str(&self) -> &'static str {
match self {
RepoListStatusesByRefQueryState::Pending => "pending",
RepoListStatusesByRefQueryState::Success => "success",
RepoListStatusesByRefQueryState::Error => "error",
RepoListStatusesByRefQueryState::Failure => "failure",
RepoListStatusesByRefQueryState::Warning => "warning",
}
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct RepoGetContentsListQuery {
pub r#ref: Option<String>,
}
impl RepoGetContentsListQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(r#ref) = self.r#ref {
list.push(("ref", r#ref));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct RepoGetContentsQuery {
pub r#ref: Option<String>,
}
impl RepoGetContentsQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(r#ref) = self.r#ref {
list.push(("ref", r#ref));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct RepoGetEditorConfigQuery {
pub r#ref: Option<String>,
}
impl RepoGetEditorConfigQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(r#ref) = self.r#ref {
list.push(("ref", r#ref));
}
list
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetBlobsQuery {
pub shas: String,
}
impl GetBlobsQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
let shas = self.shas;
list.push(("shas", shas));
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct RepoGetSingleCommitQuery {
pub stat: Option<bool>,
pub verification: Option<bool>,
pub files: Option<bool>,
}
impl RepoGetSingleCommitQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(stat) = self.stat {
list.push(("stat", stat.to_string()));
}
if let Some(verification) = self.verification {
list.push(("verification", verification.to_string()));
}
if let Some(files) = self.files {
list.push(("files", files.to_string()));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct RepoGetNoteQuery {
pub verification: Option<bool>,
pub files: Option<bool>,
}
impl RepoGetNoteQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(verification) = self.verification {
list.push(("verification", verification.to_string()));
}
if let Some(files) = self.files {
list.push(("files", files.to_string()));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct GetTreeQuery {
pub recursive: Option<bool>,
pub per_page: Option<u32>,
}
impl GetTreeQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(recursive) = self.recursive {
list.push(("recursive", recursive.to_string()));
}
if let Some(per_page) = self.per_page {
list.push(("per_page", per_page.to_string()));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct RepoTestHookQuery {
pub r#ref: Option<String>,
}
impl RepoTestHookQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(r#ref) = self.r#ref {
list.push(("ref", r#ref));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct IssueListIssuesQuery {
pub state: Option<IssueListIssuesQueryState>,
pub labels: Option<String>,
pub q: Option<String>,
pub r#type: Option<IssueListIssuesQueryType>,
pub milestones: Option<String>,
pub since: Option<time::OffsetDateTime>,
pub before: Option<time::OffsetDateTime>,
pub created_by: Option<String>,
pub assigned_by: Option<String>,
pub mentioned_by: Option<String>,
pub sort: Option<IssueListIssuesQuerySort>,
}
impl IssueListIssuesQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(state) = self.state {
list.push(("state", state.as_str().to_string()));
}
if let Some(labels) = self.labels {
list.push(("labels", labels));
}
if let Some(q) = self.q {
list.push(("q", q));
}
if let Some(r#type) = self.r#type {
list.push(("type", r#type.as_str().to_string()));
}
if let Some(milestones) = self.milestones {
list.push(("milestones", milestones));
}
if let Some(since) = self.since {
list.push((
"since",
since
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
if let Some(before) = self.before {
list.push((
"before",
before
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
if let Some(created_by) = self.created_by {
list.push(("created_by", created_by));
}
if let Some(assigned_by) = self.assigned_by {
list.push(("assigned_by", assigned_by));
}
if let Some(mentioned_by) = self.mentioned_by {
list.push(("mentioned_by", mentioned_by));
}
if let Some(sort) = self.sort {
list.push(("sort", sort.as_str().to_string()));
}
list
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum IssueListIssuesQueryState {
#[serde(rename = "closed")]
Closed,
#[serde(rename = "open")]
Open,
#[serde(rename = "all")]
All,
}
impl IssueListIssuesQueryState {
fn as_str(&self) -> &'static str {
match self {
IssueListIssuesQueryState::Closed => "closed",
IssueListIssuesQueryState::Open => "open",
IssueListIssuesQueryState::All => "all",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum IssueListIssuesQueryType {
#[serde(rename = "issues")]
Issues,
#[serde(rename = "pulls")]
Pulls,
}
impl IssueListIssuesQueryType {
fn as_str(&self) -> &'static str {
match self {
IssueListIssuesQueryType::Issues => "issues",
IssueListIssuesQueryType::Pulls => "pulls",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum IssueListIssuesQuerySort {
#[serde(rename = "relevance")]
Relevance,
#[serde(rename = "latest")]
Latest,
#[serde(rename = "oldest")]
Oldest,
#[serde(rename = "recentupdate")]
Recentupdate,
#[serde(rename = "leastupdate")]
Leastupdate,
#[serde(rename = "mostcomment")]
Mostcomment,
#[serde(rename = "leastcomment")]
Leastcomment,
#[serde(rename = "nearduedate")]
Nearduedate,
#[serde(rename = "farduedate")]
Farduedate,
}
impl IssueListIssuesQuerySort {
fn as_str(&self) -> &'static str {
match self {
IssueListIssuesQuerySort::Relevance => "relevance",
IssueListIssuesQuerySort::Latest => "latest",
IssueListIssuesQuerySort::Oldest => "oldest",
IssueListIssuesQuerySort::Recentupdate => "recentupdate",
IssueListIssuesQuerySort::Leastupdate => "leastupdate",
IssueListIssuesQuerySort::Mostcomment => "mostcomment",
IssueListIssuesQuerySort::Leastcomment => "leastcomment",
IssueListIssuesQuerySort::Nearduedate => "nearduedate",
IssueListIssuesQuerySort::Farduedate => "farduedate",
}
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct IssueGetRepoCommentsQuery {
pub since: Option<time::OffsetDateTime>,
pub before: Option<time::OffsetDateTime>,
}
impl IssueGetRepoCommentsQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(since) = self.since {
list.push((
"since",
since
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
if let Some(before) = self.before {
list.push((
"before",
before
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct IssueCreateIssueCommentAttachmentQuery {
pub name: Option<String>,
pub updated_at: Option<time::OffsetDateTime>,
}
impl IssueCreateIssueCommentAttachmentQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(name) = self.name {
list.push(("name", name));
}
if let Some(updated_at) = self.updated_at {
list.push((
"updated_at",
updated_at
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct IssueCreateIssueAttachmentQuery {
pub name: Option<String>,
pub updated_at: Option<time::OffsetDateTime>,
}
impl IssueCreateIssueAttachmentQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(name) = self.name {
list.push(("name", name));
}
if let Some(updated_at) = self.updated_at {
list.push((
"updated_at",
updated_at
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct IssueGetCommentsQuery {
pub since: Option<time::OffsetDateTime>,
pub before: Option<time::OffsetDateTime>,
}
impl IssueGetCommentsQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(since) = self.since {
list.push((
"since",
since
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
if let Some(before) = self.before {
list.push((
"before",
before
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct IssueGetCommentsAndTimelineQuery {
pub since: Option<time::OffsetDateTime>,
pub before: Option<time::OffsetDateTime>,
}
impl IssueGetCommentsAndTimelineQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(since) = self.since {
list.push((
"since",
since
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
if let Some(before) = self.before {
list.push((
"before",
before
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct IssueTrackedTimesQuery {
pub user: Option<String>,
pub since: Option<time::OffsetDateTime>,
pub before: Option<time::OffsetDateTime>,
}
impl IssueTrackedTimesQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(user) = self.user {
list.push(("user", user));
}
if let Some(since) = self.since {
list.push((
"since",
since
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
if let Some(before) = self.before {
list.push((
"before",
before
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct RepoListKeysQuery {
pub key_id: Option<u32>,
pub fingerprint: Option<String>,
}
impl RepoListKeysQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(key_id) = self.key_id {
list.push(("key_id", key_id.to_string()));
}
if let Some(fingerprint) = self.fingerprint {
list.push(("fingerprint", fingerprint));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct IssueListLabelsQuery {
pub sort: Option<IssueListLabelsQuerySort>,
}
impl IssueListLabelsQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(sort) = self.sort {
list.push(("sort", sort.as_str().to_string()));
}
list
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum IssueListLabelsQuerySort {
#[serde(rename = "mostissues")]
Mostissues,
#[serde(rename = "leastissues")]
Leastissues,
#[serde(rename = "reversealphabetically")]
Reversealphabetically,
}
impl IssueListLabelsQuerySort {
fn as_str(&self) -> &'static str {
match self {
IssueListLabelsQuerySort::Mostissues => "mostissues",
IssueListLabelsQuerySort::Leastissues => "leastissues",
IssueListLabelsQuerySort::Reversealphabetically => "reversealphabetically",
}
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct RepoGetRawFileOrLfsQuery {
pub r#ref: Option<String>,
}
impl RepoGetRawFileOrLfsQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(r#ref) = self.r#ref {
list.push(("ref", r#ref));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct IssueGetMilestonesListQuery {
pub state: Option<String>,
pub name: Option<String>,
}
impl IssueGetMilestonesListQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(state) = self.state {
list.push(("state", state));
}
if let Some(name) = self.name {
list.push(("name", name));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct NotifyGetRepoListQuery {
pub all: Option<bool>,
pub status_types: Option<Vec<String>>,
pub subject_type: Option<Vec<NotifyGetRepoListQuerySubjectType>>,
pub since: Option<time::OffsetDateTime>,
pub before: Option<time::OffsetDateTime>,
}
impl NotifyGetRepoListQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(all) = self.all {
list.push(("all", all.to_string()));
}
if let Some(status_types) = self.status_types {
if !status_types.is_empty() {
for item in status_types {
list.push(("status-types", item.to_string()));
}
}
}
if let Some(subject_type) = self.subject_type {
if !subject_type.is_empty() {
for item in subject_type {
list.push(("subject-type", item.as_str().to_string()));
}
}
}
if let Some(since) = self.since {
list.push((
"since",
since
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
if let Some(before) = self.before {
list.push((
"before",
before
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
list
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum NotifyGetRepoListQuerySubjectType {
#[serde(rename = "issue")]
Issue,
#[serde(rename = "pull")]
Pull,
#[serde(rename = "repository")]
Repository,
}
impl NotifyGetRepoListQuerySubjectType {
fn as_str(&self) -> &'static str {
match self {
NotifyGetRepoListQuerySubjectType::Issue => "issue",
NotifyGetRepoListQuerySubjectType::Pull => "pull",
NotifyGetRepoListQuerySubjectType::Repository => "repository",
}
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct NotifyReadRepoListQuery {
pub all: Option<bool>,
pub status_types: Option<Vec<String>>,
pub to_status: Option<String>,
pub last_read_at: Option<time::OffsetDateTime>,
}
impl NotifyReadRepoListQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(all) = self.all {
list.push(("all", all.to_string()));
}
if let Some(status_types) = self.status_types {
if !status_types.is_empty() {
for item in status_types {
list.push(("status-types", item.to_string()));
}
}
}
if let Some(to_status) = self.to_status {
list.push(("to-status", to_status));
}
if let Some(last_read_at) = self.last_read_at {
list.push((
"last_read_at",
last_read_at
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct RepoListPullRequestsQuery {
pub state: Option<RepoListPullRequestsQueryState>,
pub sort: Option<RepoListPullRequestsQuerySort>,
pub milestone: Option<i64>,
pub labels: Option<Vec<i64>>,
pub poster: Option<String>,
}
impl RepoListPullRequestsQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(state) = self.state {
list.push(("state", state.as_str().to_string()));
}
if let Some(sort) = self.sort {
list.push(("sort", sort.as_str().to_string()));
}
if let Some(milestone) = self.milestone {
list.push(("milestone", milestone.to_string()));
}
if let Some(labels) = self.labels {
if !labels.is_empty() {
for item in labels {
list.push(("labels", format!("{item}")));
}
}
}
if let Some(poster) = self.poster {
list.push(("poster", poster));
}
list
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum RepoListPullRequestsQueryState {
#[serde(rename = "open")]
Open,
#[serde(rename = "closed")]
Closed,
#[serde(rename = "all")]
All,
}
impl RepoListPullRequestsQueryState {
fn as_str(&self) -> &'static str {
match self {
RepoListPullRequestsQueryState::Open => "open",
RepoListPullRequestsQueryState::Closed => "closed",
RepoListPullRequestsQueryState::All => "all",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum RepoListPullRequestsQuerySort {
#[serde(rename = "oldest")]
Oldest,
#[serde(rename = "recentupdate")]
Recentupdate,
#[serde(rename = "recentclose")]
Recentclose,
#[serde(rename = "leastupdate")]
Leastupdate,
#[serde(rename = "mostcomment")]
Mostcomment,
#[serde(rename = "leastcomment")]
Leastcomment,
#[serde(rename = "priority")]
Priority,
}
impl RepoListPullRequestsQuerySort {
fn as_str(&self) -> &'static str {
match self {
RepoListPullRequestsQuerySort::Oldest => "oldest",
RepoListPullRequestsQuerySort::Recentupdate => "recentupdate",
RepoListPullRequestsQuerySort::Recentclose => "recentclose",
RepoListPullRequestsQuerySort::Leastupdate => "leastupdate",
RepoListPullRequestsQuerySort::Mostcomment => "mostcomment",
RepoListPullRequestsQuerySort::Leastcomment => "leastcomment",
RepoListPullRequestsQuerySort::Priority => "priority",
}
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct RepoDownloadPullDiffOrPatchQuery {
pub binary: Option<bool>,
}
impl RepoDownloadPullDiffOrPatchQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(binary) = self.binary {
list.push(("binary", binary.to_string()));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct RepoGetPullRequestCommitsQuery {
pub verification: Option<bool>,
pub files: Option<bool>,
}
impl RepoGetPullRequestCommitsQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(verification) = self.verification {
list.push(("verification", verification.to_string()));
}
if let Some(files) = self.files {
list.push(("files", files.to_string()));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct RepoGetPullRequestFilesQuery {
pub skip_to: Option<String>,
pub whitespace: Option<RepoGetPullRequestFilesQueryWhitespace>,
}
impl RepoGetPullRequestFilesQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(skip_to) = self.skip_to {
list.push(("skip-to", skip_to));
}
if let Some(whitespace) = self.whitespace {
list.push(("whitespace", whitespace.as_str().to_string()));
}
list
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum RepoGetPullRequestFilesQueryWhitespace {
#[serde(rename = "ignore-all")]
IgnoreAll,
#[serde(rename = "ignore-change")]
IgnoreChange,
#[serde(rename = "ignore-eol")]
IgnoreEol,
#[serde(rename = "show-all")]
ShowAll,
}
impl RepoGetPullRequestFilesQueryWhitespace {
fn as_str(&self) -> &'static str {
match self {
RepoGetPullRequestFilesQueryWhitespace::IgnoreAll => "ignore-all",
RepoGetPullRequestFilesQueryWhitespace::IgnoreChange => "ignore-change",
RepoGetPullRequestFilesQueryWhitespace::IgnoreEol => "ignore-eol",
RepoGetPullRequestFilesQueryWhitespace::ShowAll => "show-all",
}
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct RepoUpdatePullRequestQuery {
pub style: Option<RepoUpdatePullRequestQueryStyle>,
}
impl RepoUpdatePullRequestQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(style) = self.style {
list.push(("style", style.as_str().to_string()));
}
list
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum RepoUpdatePullRequestQueryStyle {
#[serde(rename = "merge")]
Merge,
#[serde(rename = "rebase")]
Rebase,
}
impl RepoUpdatePullRequestQueryStyle {
fn as_str(&self) -> &'static str {
match self {
RepoUpdatePullRequestQueryStyle::Merge => "merge",
RepoUpdatePullRequestQueryStyle::Rebase => "rebase",
}
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct RepoGetRawFileQuery {
pub r#ref: Option<String>,
}
impl RepoGetRawFileQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(r#ref) = self.r#ref {
list.push(("ref", r#ref));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct RepoListReleasesQuery {
pub draft: Option<bool>,
pub pre_release: Option<bool>,
pub q: Option<String>,
}
impl RepoListReleasesQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(draft) = self.draft {
list.push(("draft", draft.to_string()));
}
if let Some(pre_release) = self.pre_release {
list.push(("pre-release", pre_release.to_string()));
}
if let Some(q) = self.q {
list.push(("q", q));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct RepoCreateReleaseAttachmentQuery {
pub name: Option<String>,
}
impl RepoCreateReleaseAttachmentQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(name) = self.name {
list.push(("name", name));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct RepoListStatusesQuery {
pub sort: Option<RepoListStatusesQuerySort>,
pub state: Option<RepoListStatusesQueryState>,
}
impl RepoListStatusesQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(sort) = self.sort {
list.push(("sort", sort.as_str().to_string()));
}
if let Some(state) = self.state {
list.push(("state", state.as_str().to_string()));
}
list
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum RepoListStatusesQuerySort {
#[serde(rename = "oldest")]
Oldest,
#[serde(rename = "recentupdate")]
Recentupdate,
#[serde(rename = "leastupdate")]
Leastupdate,
#[serde(rename = "leastindex")]
Leastindex,
#[serde(rename = "highestindex")]
Highestindex,
}
impl RepoListStatusesQuerySort {
fn as_str(&self) -> &'static str {
match self {
RepoListStatusesQuerySort::Oldest => "oldest",
RepoListStatusesQuerySort::Recentupdate => "recentupdate",
RepoListStatusesQuerySort::Leastupdate => "leastupdate",
RepoListStatusesQuerySort::Leastindex => "leastindex",
RepoListStatusesQuerySort::Highestindex => "highestindex",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum RepoListStatusesQueryState {
#[serde(rename = "pending")]
Pending,
#[serde(rename = "success")]
Success,
#[serde(rename = "error")]
Error,
#[serde(rename = "failure")]
Failure,
#[serde(rename = "warning")]
Warning,
}
impl RepoListStatusesQueryState {
fn as_str(&self) -> &'static str {
match self {
RepoListStatusesQueryState::Pending => "pending",
RepoListStatusesQueryState::Success => "success",
RepoListStatusesQueryState::Error => "error",
RepoListStatusesQueryState::Failure => "failure",
RepoListStatusesQueryState::Warning => "warning",
}
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct RepoTrackedTimesQuery {
pub user: Option<String>,
pub since: Option<time::OffsetDateTime>,
pub before: Option<time::OffsetDateTime>,
}
impl RepoTrackedTimesQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(user) = self.user {
list.push(("user", user));
}
if let Some(since) = self.since {
list.push((
"since",
since
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
if let Some(before) = self.before {
list.push((
"before",
before
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct OrgListTeamActivityFeedsQuery {
pub date: Option<time::Date>,
}
impl OrgListTeamActivityFeedsQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(date) = self.date {
list.push(("date", date.to_string()));
}
list
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct TopicSearchQuery {
pub q: String,
}
impl TopicSearchQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
let q = self.q;
list.push(("q", q));
list
}
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct TopicSearchResults {
pub topics: Option<Vec<TopicResponse>>,
}
impl_from_response!(TopicSearchResults);
#[derive(Debug, Clone, PartialEq, Default)]
pub struct UserSearchRunJobsQuery {
pub labels: Option<String>,
}
impl UserSearchRunJobsQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(labels) = self.labels {
list.push(("labels", labels));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct UserCurrentListKeysQuery {
pub fingerprint: Option<String>,
}
impl UserCurrentListKeysQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(fingerprint) = self.fingerprint {
list.push(("fingerprint", fingerprint));
}
list
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct UserCheckQuotaQuery {
pub subject: String,
}
impl UserCheckQuotaQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
let subject = self.subject;
list.push(("subject", subject));
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct UserCurrentListReposQuery {
pub order_by: Option<UserCurrentListReposQueryOrderBy>,
}
impl UserCurrentListReposQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(order_by) = self.order_by {
list.push(("order_by", order_by.as_str().to_string()));
}
list
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum UserCurrentListReposQueryOrderBy {
#[serde(rename = "name")]
Name,
#[serde(rename = "id")]
Id,
#[serde(rename = "newest")]
Newest,
#[serde(rename = "oldest")]
Oldest,
#[serde(rename = "recentupdate")]
Recentupdate,
#[serde(rename = "leastupdate")]
Leastupdate,
#[serde(rename = "reversealphabetically")]
Reversealphabetically,
#[serde(rename = "alphabetically")]
Alphabetically,
#[serde(rename = "reversesize")]
Reversesize,
#[serde(rename = "size")]
Size,
#[serde(rename = "reversegitsize")]
Reversegitsize,
#[serde(rename = "gitsize")]
Gitsize,
#[serde(rename = "reverselfssize")]
Reverselfssize,
#[serde(rename = "lfssize")]
Lfssize,
#[serde(rename = "moststars")]
Moststars,
#[serde(rename = "feweststars")]
Feweststars,
#[serde(rename = "mostforks")]
Mostforks,
#[serde(rename = "fewestforks")]
Fewestforks,
}
impl UserCurrentListReposQueryOrderBy {
fn as_str(&self) -> &'static str {
match self {
UserCurrentListReposQueryOrderBy::Name => "name",
UserCurrentListReposQueryOrderBy::Id => "id",
UserCurrentListReposQueryOrderBy::Newest => "newest",
UserCurrentListReposQueryOrderBy::Oldest => "oldest",
UserCurrentListReposQueryOrderBy::Recentupdate => "recentupdate",
UserCurrentListReposQueryOrderBy::Leastupdate => "leastupdate",
UserCurrentListReposQueryOrderBy::Reversealphabetically => "reversealphabetically",
UserCurrentListReposQueryOrderBy::Alphabetically => "alphabetically",
UserCurrentListReposQueryOrderBy::Reversesize => "reversesize",
UserCurrentListReposQueryOrderBy::Size => "size",
UserCurrentListReposQueryOrderBy::Reversegitsize => "reversegitsize",
UserCurrentListReposQueryOrderBy::Gitsize => "gitsize",
UserCurrentListReposQueryOrderBy::Reverselfssize => "reverselfssize",
UserCurrentListReposQueryOrderBy::Lfssize => "lfssize",
UserCurrentListReposQueryOrderBy::Moststars => "moststars",
UserCurrentListReposQueryOrderBy::Feweststars => "feweststars",
UserCurrentListReposQueryOrderBy::Mostforks => "mostforks",
UserCurrentListReposQueryOrderBy::Fewestforks => "fewestforks",
}
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct UserCurrentTrackedTimesQuery {
pub since: Option<time::OffsetDateTime>,
pub before: Option<time::OffsetDateTime>,
}
impl UserCurrentTrackedTimesQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(since) = self.since {
list.push((
"since",
since
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
if let Some(before) = self.before {
list.push((
"before",
before
.format(&time::format_description::well_known::Rfc3339)
.unwrap(),
));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct UserSearchQuery {
pub q: Option<String>,
pub uid: Option<i64>,
pub sort: Option<UserSearchQuerySort>,
}
impl UserSearchQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(q) = self.q {
list.push(("q", q));
}
if let Some(uid) = self.uid {
list.push(("uid", uid.to_string()));
}
if let Some(sort) = self.sort {
list.push(("sort", sort.as_str().to_string()));
}
list
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum UserSearchQuerySort {
#[serde(rename = "oldest")]
Oldest,
#[serde(rename = "newest")]
Newest,
#[serde(rename = "alphabetically")]
Alphabetically,
#[serde(rename = "reversealphabetically")]
Reversealphabetically,
#[serde(rename = "recentupdate")]
Recentupdate,
#[serde(rename = "leastupdate")]
Leastupdate,
}
impl UserSearchQuerySort {
fn as_str(&self) -> &'static str {
match self {
UserSearchQuerySort::Oldest => "oldest",
UserSearchQuerySort::Newest => "newest",
UserSearchQuerySort::Alphabetically => "alphabetically",
UserSearchQuerySort::Reversealphabetically => "reversealphabetically",
UserSearchQuerySort::Recentupdate => "recentupdate",
UserSearchQuerySort::Leastupdate => "leastupdate",
}
}
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct UserSearchResults {
pub data: Option<Vec<User>>,
pub ok: Option<bool>,
}
impl_from_response!(UserSearchResults);
#[derive(Debug, Clone, PartialEq, Default)]
pub struct UserListActivityFeedsQuery {
pub only_performed_by: Option<bool>,
pub date: Option<time::Date>,
}
impl UserListActivityFeedsQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(only_performed_by) = self.only_performed_by {
list.push(("only-performed-by", only_performed_by.to_string()));
}
if let Some(date) = self.date {
list.push(("date", date.to_string()));
}
list
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct UserListKeysQuery {
pub fingerprint: Option<String>,
}
impl UserListKeysQuery {
pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
let mut list = Vec::new();
if let Some(fingerprint) = self.fingerprint {
list.push(("fingerprint", fingerprint));
}
list
}
}