feat: progress and visualize progress
This commit is contained in:
parent
01696c7e0e
commit
8cc41b7dc6
173 changed files with 3006 additions and 585 deletions
|
@ -1 +1,3 @@
|
|||
![Progress](./progress.png)
|
||||
|
||||
docs: https://codeberg.org/api/swagger#/organization/orgCreateHook
|
||||
|
|
8
calc_stats.sh
Normal file
8
calc_stats.sh
Normal file
|
@ -0,0 +1,8 @@
|
|||
ENUMERATOR=$(rg "to-todo" -c -I | paste -sd+ | bc)
|
||||
DENOMINATOR=$(rg "pub mod" ./src/types/api/ -c -I | paste -sd+ | bc)
|
||||
|
||||
echo "$ENUMERATOR.0/$DENOMINATOR.0"
|
||||
UNDONE=$(echo "scale=2; ($ENUMERATOR * 100)/$DENOMINATOR" | bc )
|
||||
DONE=$(echo "scale=2; 100 - $UNDONE" | bc)
|
||||
echo done: $DONE %
|
||||
echo undone: $UNDONE %
|
BIN
progress.png
Normal file
BIN
progress.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
|
@ -1 +1,2 @@
|
|||
pub mod macros;
|
||||
pub mod types;
|
||||
|
|
113
src/macros.rs
Normal file
113
src/macros.rs
Normal file
|
@ -0,0 +1,113 @@
|
|||
// Define the macro that generates the implementation for the enum
|
||||
#[macro_export]
|
||||
macro_rules! implement_boolean_enum {
|
||||
($module_name:ident, $enum_name:ident) => {
|
||||
implement_boolean_enum!($module_name, $enum_name { Yes, No });
|
||||
};
|
||||
($module_name:ident, $enum_name:ident { $yes_variant:ident, $no_variant:ident }) => {
|
||||
pub mod $module_name {
|
||||
use clap::ValueEnum;
|
||||
use strum::{Display, EnumIs, EnumIter, EnumString};
|
||||
|
||||
#[derive(
|
||||
Debug, Clone, Copy, PartialEq, Eq, ValueEnum, Display, EnumIter, EnumString, EnumIs,
|
||||
)]
|
||||
pub enum $enum_name {
|
||||
$yes_variant,
|
||||
$no_variant,
|
||||
}
|
||||
|
||||
mod serde {
|
||||
use serde::de::Visitor;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::$enum_name;
|
||||
|
||||
impl Serialize for $enum_name {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
serializer.serialize_bool(matches!(*self, $enum_name::$yes_variant))
|
||||
}
|
||||
}
|
||||
|
||||
struct PrivateVisitor;
|
||||
|
||||
impl<'de> Visitor<'de> for PrivateVisitor {
|
||||
type Value = $enum_name;
|
||||
|
||||
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
formatter.write_str("a boolean value (true/false)")
|
||||
}
|
||||
|
||||
fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
|
||||
where
|
||||
E: serde::de::Error,
|
||||
{
|
||||
if v {
|
||||
Ok($enum_name::$yes_variant)
|
||||
} else {
|
||||
Ok($enum_name::$no_variant)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for $enum_name {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: serde::Deserializer<'de>,
|
||||
{
|
||||
deserializer.deserialize_bool(PrivateVisitor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mod from {
|
||||
use super::$enum_name;
|
||||
|
||||
impl Into<bool> for $enum_name {
|
||||
fn into(self) -> bool {
|
||||
match self {
|
||||
$enum_name::$yes_variant => true,
|
||||
$enum_name::$no_variant => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::$enum_name;
|
||||
|
||||
#[test]
|
||||
fn deserialize_true() {
|
||||
let input = "true";
|
||||
let val: $enum_name = serde_json::from_str(input).unwrap();
|
||||
assert_eq!($enum_name::$yes_variant, val);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn deserialize_false() {
|
||||
let input = "false";
|
||||
let val: $enum_name = serde_json::from_str(input).unwrap();
|
||||
assert_eq!($enum_name::$no_variant, val);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn serialize_true() {
|
||||
let input = $enum_name::$yes_variant;
|
||||
let val = serde_json::to_string(&input).unwrap();
|
||||
assert_eq!(val.as_str(), "true");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn serialize_false() {
|
||||
let input = $enum_name::$no_variant;
|
||||
let val = serde_json::to_string(&input).unwrap();
|
||||
assert_eq!(val.as_str(), "false");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
9
src/types/api/access_token.rs
Normal file
9
src/types/api/access_token.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
// [AccessToken represents an API access token.{
|
||||
// id integer($int64)
|
||||
// name string
|
||||
// scopes [
|
||||
// x-go-name: Scopes
|
||||
// string]
|
||||
// sha1 string
|
||||
// token_last_eight string
|
||||
// }]
|
6
src/types/api/add/collaborator.rs
Normal file
6
src/types/api/add/collaborator.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
// AddCollaboratorOption{
|
||||
// description:
|
||||
// AddCollaboratorOption options when adding a user as a collaborator of a repository
|
||||
//
|
||||
// permission string
|
||||
// }
|
10
src/types/api/add/label.rs
Normal file
10
src/types/api/add/label.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
// IssueLabelsOption{
|
||||
// description:
|
||||
// IssueLabelsOption a collection of labels
|
||||
//
|
||||
// labels [
|
||||
// x-go-name: Labels
|
||||
// list of label IDs
|
||||
//
|
||||
// integer($int64)]
|
||||
// }
|
5
src/types/api/add/mod.rs
Normal file
5
src/types/api/add/mod.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
/* to-todo */
|
||||
pub mod collaborator;
|
||||
/* to-todo */ pub mod label;
|
||||
/* to-todo */ pub mod time;
|
||||
/* to-todo */ pub mod topic;
|
12
src/types/api/add/time.rs
Normal file
12
src/types/api/add/time.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
// AddTimeOption{
|
||||
// description:
|
||||
// AddTimeOption options for adding time to an issue
|
||||
//
|
||||
// created string($date-time)
|
||||
// time* integer($int64)
|
||||
// time in seconds
|
||||
//
|
||||
// user_name string
|
||||
// User who spent the time (optional)
|
||||
//
|
||||
// }
|
10
src/types/api/add/topic.rs
Normal file
10
src/types/api/add/topic.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
// RepoTopicOptions{
|
||||
// description:
|
||||
// RepoTopicOptions a collection of repo topic names
|
||||
//
|
||||
// topics [
|
||||
// x-go-name: Topics
|
||||
// list of topic names
|
||||
//
|
||||
// string]
|
||||
// }
|
12
src/types/api/annotated_tag.rs
Normal file
12
src/types/api/annotated_tag.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
// AnnotatedTag{
|
||||
// description:
|
||||
// AnnotatedTag represents an annotated tag
|
||||
//
|
||||
// message string
|
||||
// object AnnotatedTagObject{...}
|
||||
// sha string
|
||||
// tag string
|
||||
// tagger CommitUser contains information of a user in the context of a commit.{...}
|
||||
// url string
|
||||
// verification PayloadCommitVerification{...}
|
||||
// }
|
8
src/types/api/annotated_tag_object.rs
Normal file
8
src/types/api/annotated_tag_object.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
// AnnotatedTagObject{
|
||||
// description:
|
||||
// AnnotatedTagObject contains meta information of the tag object
|
||||
//
|
||||
// sha string
|
||||
// type string
|
||||
// url string
|
||||
// }
|
9
src/types/api/api_settings.rs
Normal file
9
src/types/api/api_settings.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
// GeneralAPISettings{
|
||||
// description:
|
||||
// GeneralAPISettings contains global api settings exposed by it
|
||||
//
|
||||
// default_git_trees_per_page integer($int64)
|
||||
// default_max_blob_size integer($int64)
|
||||
// default_paging_num integer($int64)
|
||||
// max_response_items integer($int64)
|
||||
// }
|
14
src/types/api/attachment.rs
Normal file
14
src/types/api/attachment.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
// [
|
||||
// x-go-name: Attachments
|
||||
// Attachment{
|
||||
// description:
|
||||
// Attachment a generic attachment
|
||||
//
|
||||
// browser_download_url string
|
||||
// created_at string($date-time)
|
||||
// download_count integer($int64)
|
||||
// id integer($int64)
|
||||
// name string
|
||||
// size integer($int64)
|
||||
// uuid string
|
||||
// }]
|
9
src/types/api/attachment_settings.rs
Normal file
9
src/types/api/attachment_settings.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
// GeneralAttachmentSettings{
|
||||
// description:
|
||||
// GeneralAttachmentSettings contains global Attachment settings exposed by API
|
||||
//
|
||||
// allowed_types string
|
||||
// enabled boolean
|
||||
// max_files integer($int64)
|
||||
// max_size integer($int64)
|
||||
// }
|
16
src/types/api/branch.rs
Normal file
16
src/types/api/branch.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
// [Branch{
|
||||
// description:
|
||||
// Branch represents a repository branch
|
||||
//
|
||||
// commit PayloadCommit{...}
|
||||
// effective_branch_protection_name string
|
||||
// enable_status_check boolean
|
||||
// name string
|
||||
// protected boolean
|
||||
// required_approvals integer($int64)
|
||||
// status_check_contexts [
|
||||
// x-go-name: StatusCheckContexts
|
||||
// string]
|
||||
// user_can_merge boolean
|
||||
// user_can_push boolean
|
||||
// }]
|
46
src/types/api/branch_protection.rs
Normal file
46
src/types/api/branch_protection.rs
Normal file
|
@ -0,0 +1,46 @@
|
|||
// [BranchProtection{
|
||||
// description:
|
||||
// BranchProtection represents a branch protection for a repository
|
||||
//
|
||||
// approvals_whitelist_teams [
|
||||
// x-go-name: ApprovalsWhitelistTeams
|
||||
// string]
|
||||
// approvals_whitelist_username [
|
||||
// x-go-name: ApprovalsWhitelistUsernames
|
||||
// string]
|
||||
// block_on_official_review_requests boolean
|
||||
// block_on_outdated_branch boolean
|
||||
// block_on_rejected_reviews boolean
|
||||
// branch_name string
|
||||
// Deprecated: true
|
||||
//
|
||||
// created_at string($date-time)
|
||||
// dismiss_stale_approvals boolean
|
||||
// enable_approvals_whitelist boolean
|
||||
// enable_merge_whitelist boolean
|
||||
// enable_push boolean
|
||||
// enable_push_whitelist boolean
|
||||
// enable_status_check boolean
|
||||
// merge_whitelist_teams [
|
||||
// x-go-name: MergeWhitelistTeams
|
||||
// string]
|
||||
// merge_whitelist_usernames [
|
||||
// x-go-name: MergeWhitelistUsernames
|
||||
// string]
|
||||
// protected_file_patterns string
|
||||
// push_whitelist_deploy_keys boolean
|
||||
// push_whitelist_teams [
|
||||
// x-go-name: PushWhitelistTeams
|
||||
// string]
|
||||
// push_whitelist_usernames [
|
||||
// x-go-name: PushWhitelistUsernames
|
||||
// string]
|
||||
// require_signed_commits boolean
|
||||
// required_approvals integer($int64)
|
||||
// rule_name string
|
||||
// status_check_contexts [
|
||||
// x-go-name: StatusCheckContexts
|
||||
// string]
|
||||
// unprotected_file_patterns string
|
||||
// updated_at string($date-time)
|
||||
// }]
|
14
src/types/api/changed_file.rs
Normal file
14
src/types/api/changed_file.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
// [ChangedFile{
|
||||
// description:
|
||||
// ChangedFile store information about files affected by the pull request
|
||||
//
|
||||
// additions integer($int64)
|
||||
// changes integer($int64)
|
||||
// contents_url string
|
||||
// deletions integer($int64)
|
||||
// filename string
|
||||
// html_url string
|
||||
// previous_filename string
|
||||
// raw_url string
|
||||
// status string
|
||||
// }]
|
14
src/types/api/combined_status.rs
Normal file
14
src/types/api/combined_status.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
// CombinedStatus{
|
||||
// description:
|
||||
// CombinedStatus holds the combined state of several statuses for a single commit
|
||||
//
|
||||
// commit_url string
|
||||
// repository Repository{...}
|
||||
// sha string
|
||||
// state CommitStatusState[...]
|
||||
// statuses [
|
||||
// x-go-name: Statuses
|
||||
// CommitStatus{...}]
|
||||
// total_count integer($int64)
|
||||
// url string
|
||||
// }
|
18
src/types/api/comment.rs
Normal file
18
src/types/api/comment.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
// Comment{
|
||||
// description:
|
||||
// Comment represents a comment on a commit or issue
|
||||
//
|
||||
// assets [
|
||||
// x-go-name: Attachments
|
||||
// Attachment{...}]
|
||||
// body string
|
||||
// created_at string($date-time)
|
||||
// html_url string
|
||||
// id integer($int64)
|
||||
// issue_url string
|
||||
// original_author string
|
||||
// original_author_id integer($int64)
|
||||
// pull_request_url string
|
||||
// updated_at string($date-time)
|
||||
// user User{...}
|
||||
// }]
|
16
src/types/api/commit.rs
Normal file
16
src/types/api/commit.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
// [Commit contains information generated from a Git commit.{
|
||||
// author User{...}
|
||||
// commit RepoCommit contains information of a commit in the context of a repository.{...}
|
||||
// committer User{...}
|
||||
// created string($date-time)
|
||||
// files [
|
||||
// x-go-name: Files
|
||||
// CommitAffectedFiles{...}]
|
||||
// html_url string
|
||||
// parents [
|
||||
// x-go-name: Parents
|
||||
// CommitMeta contains meta information of a commit in terms of API.{...}]
|
||||
// sha string
|
||||
// stats CommitStats{...}
|
||||
// url string
|
||||
// }]
|
6
src/types/api/commit_affected_files.rs
Normal file
6
src/types/api/commit_affected_files.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
// CommitAffectedFiles{
|
||||
// description:
|
||||
// CommitAffectedFiles store information about files affected by the commit
|
||||
//
|
||||
// filename string
|
||||
// }]
|
7
src/types/api/commit_date_options.rs
Normal file
7
src/types/api/commit_date_options.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
// CommitDateOptions{
|
||||
// description:
|
||||
// CommitDateOptions store dates for GIT_AUTHOR_DATE and GIT_COMMITTER_DATE
|
||||
//
|
||||
// author string($date-time)
|
||||
// committer string($date-time)
|
||||
// }
|
5
src/types/api/commit_meta.rs
Normal file
5
src/types/api/commit_meta.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
// CommitMeta contains meta information of a commit in terms of API.{
|
||||
// created string($date-time)
|
||||
// sha string
|
||||
// url string
|
||||
// }
|
8
src/types/api/commit_stats.rs
Normal file
8
src/types/api/commit_stats.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
// CommitStats{
|
||||
// description:
|
||||
// CommitStats is statistics for a RepoCommit
|
||||
//
|
||||
// additions integer($int64)
|
||||
// deletions integer($int64)
|
||||
// total integer($int64)
|
||||
// }
|
14
src/types/api/commit_status.rs
Normal file
14
src/types/api/commit_status.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
// CommitStatus{
|
||||
// description:
|
||||
// CommitStatus holds a single status of a single Commit
|
||||
//
|
||||
// context string
|
||||
// created_at string($date-time)
|
||||
// creator User{...}
|
||||
// description string
|
||||
// id integer($int64)
|
||||
// status CommitStatusState[...]
|
||||
// target_url string
|
||||
// updated_at string($date-time)
|
||||
// url string
|
||||
// }]
|
3
src/types/api/commit_status_state.rs
Normal file
3
src/types/api/commit_status_state.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
// CommitStatusStatestring
|
||||
// CommitStatusState holds the state of a CommitStatus
|
||||
// It can be "pending", "success", "error", "failure", and "warning"
|
5
src/types/api/commit_user.rs
Normal file
5
src/types/api/commit_user.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
// CommitUser contains information of a user in the context of a commit.{
|
||||
// date string
|
||||
// email string($email)
|
||||
// name string
|
||||
// }
|
30
src/types/api/content_response.rs
Normal file
30
src/types/api/content_response.rs
Normal file
|
@ -0,0 +1,30 @@
|
|||
// [ContentsResponse{
|
||||
// description:
|
||||
// ContentsResponse contains information about a repo's entry's (dir, file, symlink, submodule) metadata and content
|
||||
//
|
||||
// _links FileLinksResponse{...}
|
||||
// content string
|
||||
// content is populated when type is file, otherwise null
|
||||
//
|
||||
// download_url string
|
||||
// encoding string
|
||||
// encoding is populated when type is file, otherwise null
|
||||
//
|
||||
// git_url string
|
||||
// html_url string
|
||||
// last_commit_sha string
|
||||
// name string
|
||||
// path string
|
||||
// sha string
|
||||
// size integer($int64)
|
||||
// submodule_git_url string
|
||||
// submodule_git_url is populated when type is submodule, otherwise null
|
||||
//
|
||||
// target string
|
||||
// target is populated when type is symlink, otherwise null
|
||||
//
|
||||
// type string
|
||||
// type will be file, dir, symlink, or submodule
|
||||
//
|
||||
// url string
|
||||
// }]
|
7
src/types/api/create_hook_option_config.rs
Normal file
7
src/types/api/create_hook_option_config.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
// CreateHookOptionConfig{
|
||||
// description:
|
||||
// CreateHookOptionConfig has all config options in it
|
||||
// required are "content_type" and "url" Required
|
||||
//
|
||||
// < * >: string
|
||||
// }
|
9
src/types/api/creation/access_token.rs
Normal file
9
src/types/api/creation/access_token.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
// CreateAccessTokenOption{
|
||||
// description:
|
||||
// CreateAccessTokenOption options when create access token
|
||||
//
|
||||
// name* string
|
||||
// scopes [
|
||||
// x-go-name: Scopes
|
||||
// string]
|
||||
// }
|
13
src/types/api/creation/branch.rs
Normal file
13
src/types/api/creation/branch.rs
Normal file
|
@ -0,0 +1,13 @@
|
|||
// CreateBranchRepoOption{
|
||||
// description:
|
||||
// CreateBranchRepoOption options when creating a branch in a repository
|
||||
//
|
||||
// new_branch_name* string
|
||||
// uniqueItems: true
|
||||
// Name of the branch to create
|
||||
//
|
||||
// old_branch_name string
|
||||
// uniqueItems: true
|
||||
// Name of the old branch to create from
|
||||
//
|
||||
// }
|
44
src/types/api/creation/branch_protection.rs
Normal file
44
src/types/api/creation/branch_protection.rs
Normal file
|
@ -0,0 +1,44 @@
|
|||
// CreateBranchProtectionOption{
|
||||
// description:
|
||||
// CreateBranchProtectionOption options for creating a branch protection
|
||||
//
|
||||
// approvals_whitelist_teams [
|
||||
// x-go-name: ApprovalsWhitelistTeams
|
||||
// string]
|
||||
// approvals_whitelist_username [
|
||||
// x-go-name: ApprovalsWhitelistUsernames
|
||||
// string]
|
||||
// block_on_official_review_requests boolean
|
||||
// block_on_outdated_branch boolean
|
||||
// block_on_rejected_reviews boolean
|
||||
// branch_name string
|
||||
// Deprecated: true
|
||||
//
|
||||
// dismiss_stale_approvals boolean
|
||||
// enable_approvals_whitelist boolean
|
||||
// enable_merge_whitelist boolean
|
||||
// enable_push boolean
|
||||
// enable_push_whitelist boolean
|
||||
// enable_status_check boolean
|
||||
// merge_whitelist_teams [
|
||||
// x-go-name: MergeWhitelistTeams
|
||||
// string]
|
||||
// merge_whitelist_usernames [
|
||||
// x-go-name: MergeWhitelistUsernames
|
||||
// string]
|
||||
// protected_file_patterns string
|
||||
// push_whitelist_deploy_keys boolean
|
||||
// push_whitelist_teams [
|
||||
// x-go-name: PushWhitelistTeams
|
||||
// string]
|
||||
// push_whitelist_usernames [
|
||||
// x-go-name: PushWhitelistUsernames
|
||||
// string]
|
||||
// require_signed_commits boolean
|
||||
// required_approvals integer($int64)
|
||||
// rule_name string
|
||||
// status_check_contexts [
|
||||
// x-go-name: StatusCheckContexts
|
||||
// string]
|
||||
// unprotected_file_patterns string
|
||||
// }
|
6
src/types/api/creation/comment.rs
Normal file
6
src/types/api/creation/comment.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
// CreateIssueCommentOption{
|
||||
// description:
|
||||
// CreateIssueCommentOption options for creating a comment on an issue
|
||||
//
|
||||
// body* string
|
||||
// }
|
9
src/types/api/creation/commit_status.rs
Normal file
9
src/types/api/creation/commit_status.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
// CreateStatusOption{
|
||||
// description:
|
||||
// CreateStatusOption holds the information needed to create a new CommitStatus for a Commit
|
||||
//
|
||||
// context string
|
||||
// description string
|
||||
// state CommitStatusState[...]
|
||||
// target_url string
|
||||
// }
|
10
src/types/api/creation/email.rs
Normal file
10
src/types/api/creation/email.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
// CreateEmailOption{
|
||||
// description:
|
||||
// CreateEmailOption options when creating email addresses
|
||||
//
|
||||
// emails [
|
||||
// x-go-name: Emails
|
||||
// email addresses to add
|
||||
//
|
||||
// string]
|
||||
// }
|
24
src/types/api/creation/file_options.rs
Normal file
24
src/types/api/creation/file_options.rs
Normal file
|
@ -0,0 +1,24 @@
|
|||
// CreateFileOptions{
|
||||
// description:
|
||||
// CreateFileOptions options for creating files
|
||||
// Note: author and committer are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
|
||||
//
|
||||
// author Identity{...}
|
||||
// branch string
|
||||
// branch (optional) to base this file from. if not given, the default branch is used
|
||||
//
|
||||
// committer Identity{...}
|
||||
// content* string
|
||||
// content must be base64 encoded
|
||||
//
|
||||
// dates CommitDateOptions{...}
|
||||
// message string
|
||||
// message (optional) for the commit of this file. if not supplied, a default message will be used
|
||||
//
|
||||
// new_branch string
|
||||
// new_branch (optional) will make a new branch from branch before creating the file
|
||||
//
|
||||
// signoff boolean
|
||||
// Add a Signed-off-by trailer by the committer at the end of the commit log message.
|
||||
//
|
||||
// }
|
10
src/types/api/creation/gpg_key.rs
Normal file
10
src/types/api/creation/gpg_key.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
// CreateGPGKeyOption{
|
||||
// description:
|
||||
// CreateGPGKeyOption options create user GPG key
|
||||
//
|
||||
// armored_public_key* string
|
||||
// uniqueItems: true
|
||||
// An armored GPG key to add
|
||||
//
|
||||
// armored_signature string
|
||||
// }
|
16
src/types/api/creation/hook.rs
Normal file
16
src/types/api/creation/hook.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
// CreateHookOption{
|
||||
// description:
|
||||
// CreateHookOption options when create a hook
|
||||
//
|
||||
// active boolean
|
||||
// default: false
|
||||
// authorization_header string
|
||||
// branch_filter string
|
||||
// config* CreateHookOptionConfig{...}
|
||||
// events [
|
||||
// x-go-name: Events
|
||||
// string]
|
||||
// type* string
|
||||
// Enum:
|
||||
// [ forgejo, dingtalk, discord, gitea, gogs, msteams, slack, telegram, feishu, wechatwork, packagist ]
|
||||
// }
|
24
src/types/api/creation/issue.rs
Normal file
24
src/types/api/creation/issue.rs
Normal file
|
@ -0,0 +1,24 @@
|
|||
// CreateIssueOption{
|
||||
// description:
|
||||
// CreateIssueOption options to create one issue
|
||||
//
|
||||
// assignee string
|
||||
// deprecated
|
||||
//
|
||||
// assignees [
|
||||
// x-go-name: Assignees
|
||||
// string]
|
||||
// body string
|
||||
// closed [...]
|
||||
// due_date string($date-time)
|
||||
// labels [
|
||||
// x-go-name: Labels
|
||||
// list of label ids
|
||||
//
|
||||
// integer($int64)]
|
||||
// milestone integer($int64)
|
||||
// milestone id
|
||||
//
|
||||
// ref string
|
||||
// title* string
|
||||
// }
|
16
src/types/api/creation/key.rs
Normal file
16
src/types/api/creation/key.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
// CreateKeyOption{
|
||||
// description:
|
||||
// CreateKeyOption options when creating a key
|
||||
//
|
||||
// key* string
|
||||
// uniqueItems: true
|
||||
// An armored SSH key to add
|
||||
//
|
||||
// read_only boolean
|
||||
// Describe if the key has only read access or read/write
|
||||
//
|
||||
// title* string
|
||||
// uniqueItems: true
|
||||
// Title of the key to add
|
||||
//
|
||||
// }
|
|
@ -2,8 +2,8 @@ use std::fmt::Display;
|
|||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::types::misc::boolean_enums::is::exclusive::Exclusive;
|
||||
use crate::types::misc::color::Color;
|
||||
use crate::types::misc::exclusive::Exclusive;
|
||||
|
||||
/// CreateLabelOption represents options for creating a label.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
|
@ -29,8 +29,8 @@ mod tests {
|
|||
use palette::rgb::Rgb;
|
||||
|
||||
use crate::types::api::creation::label::CreateLabelOption;
|
||||
use crate::types::misc::boolean_enums::is::exclusive::Exclusive;
|
||||
use crate::types::misc::color::Color;
|
||||
use crate::types::misc::exclusive::Exclusive;
|
||||
|
||||
#[test]
|
||||
fn deserialize_create_label_option() {
|
||||
|
|
11
src/types/api/creation/milestone.rs
Normal file
11
src/types/api/creation/milestone.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
// CreateMilestoneOption{
|
||||
// description:
|
||||
// CreateMilestoneOption options for creating a milestone
|
||||
//
|
||||
// description string
|
||||
// due_on string($date-time)
|
||||
// state string
|
||||
// Enum:
|
||||
// [ open, closed ]
|
||||
// title string
|
||||
// }
|
|
@ -1,2 +1,27 @@
|
|||
pub mod label;
|
||||
pub mod organization;
|
||||
|
||||
/* to-todo */
|
||||
pub mod access_token;
|
||||
/* to-todo */ pub mod branch;
|
||||
/* to-todo */ pub mod branch_protection;
|
||||
/* to-todo */ pub mod comment;
|
||||
/* to-todo */ pub mod commit_status;
|
||||
/* to-todo */ pub mod email;
|
||||
/* to-todo */ pub mod file_options;
|
||||
/* to-todo */ pub mod gpg_key;
|
||||
/* to-todo */ pub mod hook;
|
||||
/* to-todo */ pub mod issue;
|
||||
/* to-todo */ pub mod key;
|
||||
/* to-todo */ pub mod milestone;
|
||||
/* to-todo */ pub mod oath_application;
|
||||
/* to-todo */ pub mod pull_request;
|
||||
/* to-todo */ pub mod pull_review;
|
||||
/* to-todo */ pub mod pull_review_comment;
|
||||
/* to-todo */ pub mod push_mirror;
|
||||
/* to-todo */ pub mod release;
|
||||
/* to-todo */ pub mod repository;
|
||||
/* to-todo */ pub mod request_review;
|
||||
/* to-todo */ pub mod tag;
|
||||
/* to-todo */ pub mod template_repository;
|
||||
/* to-todo */ pub mod wiki_page;
|
||||
|
|
10
src/types/api/creation/oath_application.rs
Normal file
10
src/types/api/creation/oath_application.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
// CreateOAuth2ApplicationOptions{
|
||||
// description:
|
||||
// CreateOAuth2ApplicationOptions holds options to create an oauth2 application
|
||||
//
|
||||
// confidential_client boolean
|
||||
// name string
|
||||
// redirect_uris [
|
||||
// x-go-name: RedirectURIs
|
||||
// string]
|
||||
// }
|
|
@ -1,8 +1,8 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt::Display;
|
||||
|
||||
use crate::types::misc::team_access::RepoAdminCanChangeTeamAccess;
|
||||
use crate::types::misc::url::OptionalUrl;
|
||||
use crate::types::misc::boolean_enums::can::repo_admin_change_team_access::CanRepoAdminChangeTeamAccess;
|
||||
use crate::types::misc::optional_url::OptionalUrl;
|
||||
use crate::types::misc::visibility::Visibility;
|
||||
|
||||
/// CreateOrgOption represents options for creating an organization
|
||||
|
@ -15,7 +15,7 @@ pub struct CreateOrgOption {
|
|||
/// Location of the organization as a string
|
||||
pub location: String,
|
||||
/// Boolean flag indicating if repo admin can change team access
|
||||
pub repo_admin_change_team_access: RepoAdminCanChangeTeamAccess,
|
||||
pub repo_admin_change_team_access: CanRepoAdminChangeTeamAccess,
|
||||
/// The organization's username
|
||||
pub username: String,
|
||||
/// Visibility of the organization
|
||||
|
@ -38,8 +38,8 @@ mod tests {
|
|||
use url::Url;
|
||||
|
||||
use crate::types::api::creation::organization::CreateOrgOption;
|
||||
use crate::types::misc::team_access::RepoAdminCanChangeTeamAccess;
|
||||
use crate::types::misc::url::OptionalUrl;
|
||||
use crate::types::misc::boolean_enums::can::repo_admin_change_team_access::CanRepoAdminChangeTeamAccess;
|
||||
use crate::types::misc::optional_url::OptionalUrl;
|
||||
use crate::types::misc::visibility::Visibility;
|
||||
|
||||
#[test]
|
||||
|
@ -50,7 +50,7 @@ mod tests {
|
|||
description: String::from("Sample organization"),
|
||||
full_name: String::from("SampleOrg"),
|
||||
location: String::from("Sample City, Country"),
|
||||
repo_admin_change_team_access: RepoAdminCanChangeTeamAccess::Yes,
|
||||
repo_admin_change_team_access: CanRepoAdminChangeTeamAccess::Yes,
|
||||
username: String::from("sample_org"),
|
||||
visibility: Visibility::Public,
|
||||
website: OptionalUrl::Some(Url::from_str("https://sample.org").unwrap()),
|
||||
|
|
18
src/types/api/creation/pull_request.rs
Normal file
18
src/types/api/creation/pull_request.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
// CreatePullRequestOption{
|
||||
// description:
|
||||
// CreatePullRequestOption options when creating a pull request
|
||||
//
|
||||
// assignee string
|
||||
// assignees [
|
||||
// x-go-name: Assignees
|
||||
// string]
|
||||
// base string
|
||||
// body string
|
||||
// due_date string($date-time)
|
||||
// head string
|
||||
// labels [
|
||||
// x-go-name: Labels
|
||||
// integer($int64)]
|
||||
// milestone integer($int64)
|
||||
// title string
|
||||
// }
|
11
src/types/api/creation/pull_review.rs
Normal file
11
src/types/api/creation/pull_review.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
// CreatePullReviewOptions{
|
||||
// description:
|
||||
// CreatePullReviewOptions are options to create a pull review
|
||||
//
|
||||
// body string
|
||||
// comments [
|
||||
// x-go-name: Comments
|
||||
// CreatePullReviewComment{...}]
|
||||
// commit_id string
|
||||
// event ReviewStateType[...]
|
||||
// }
|
15
src/types/api/creation/pull_review_comment.rs
Normal file
15
src/types/api/creation/pull_review_comment.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
// CreatePullReviewComment{
|
||||
// description:
|
||||
// CreatePullReviewComment represent a review comment for creation api
|
||||
//
|
||||
// body string
|
||||
// new_position integer($int64)
|
||||
// if comment to new file line or 0
|
||||
//
|
||||
// old_position integer($int64)
|
||||
// if comment to old file line or 0
|
||||
//
|
||||
// path string
|
||||
// the tree path
|
||||
//
|
||||
// }]
|
7
src/types/api/creation/push_mirror.rs
Normal file
7
src/types/api/creation/push_mirror.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
// CreatePushMirrorOption represents need information to create a push mirror of a repository.{
|
||||
// interval string
|
||||
// remote_address string
|
||||
// remote_password string
|
||||
// remote_username string
|
||||
// sync_on_commit boolean
|
||||
// }
|
11
src/types/api/creation/release.rs
Normal file
11
src/types/api/creation/release.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
// CreateReleaseOption{
|
||||
// description:
|
||||
// CreateReleaseOption options when creating a release
|
||||
//
|
||||
// body string
|
||||
// draft boolean
|
||||
// name string
|
||||
// prerelease boolean
|
||||
// tag_name* string
|
||||
// target_commitish string
|
||||
// }
|
39
src/types/api/creation/repository.rs
Normal file
39
src/types/api/creation/repository.rs
Normal file
|
@ -0,0 +1,39 @@
|
|||
//CreateRepoOption{
|
||||
//description:
|
||||
//CreateRepoOption options when creating repository
|
||||
//
|
||||
//auto_init boolean
|
||||
//Whether the repository should be auto-initialized?
|
||||
//
|
||||
//default_branch string
|
||||
//DefaultBranch of the repository (used when initializes and in template)
|
||||
//
|
||||
//description string
|
||||
//Description of the repository to create
|
||||
//
|
||||
//gitignores string
|
||||
//Gitignores to use
|
||||
//
|
||||
//issue_labels string
|
||||
//Label-Set to use
|
||||
//
|
||||
//license string
|
||||
//License to use
|
||||
//
|
||||
//name* string
|
||||
//uniqueItems: true
|
||||
//Name of the repository to create
|
||||
//
|
||||
//private boolean
|
||||
//Whether the repository is private
|
||||
//
|
||||
//readme [...]
|
||||
//template boolean
|
||||
//Whether the repository is template
|
||||
//
|
||||
//trust_model string
|
||||
//TrustModel of the repository
|
||||
//
|
||||
//Enum:
|
||||
//[ default, collaborator, committer, collaboratorcommitter ]
|
||||
//}
|
11
src/types/api/creation/request_review.rs
Normal file
11
src/types/api/creation/request_review.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
// PullReviewRequestOptions{
|
||||
// description:
|
||||
// PullReviewRequestOptions are options to add or remove pull review requests
|
||||
//
|
||||
// reviewers [
|
||||
// x-go-name: Reviewers
|
||||
// string]
|
||||
// team_reviewers [
|
||||
// x-go-name: TeamReviewers
|
||||
// string]
|
||||
// }
|
8
src/types/api/creation/tag.rs
Normal file
8
src/types/api/creation/tag.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
// CreateTagOption{
|
||||
// description:
|
||||
// CreateTagOption options when creating a tag
|
||||
//
|
||||
// message string
|
||||
// tag_name* string
|
||||
// target string
|
||||
// }
|
39
src/types/api/creation/template_repository.rs
Normal file
39
src/types/api/creation/template_repository.rs
Normal file
|
@ -0,0 +1,39 @@
|
|||
// GenerateRepoOption{
|
||||
// description:
|
||||
// GenerateRepoOption options when creating repository using a template
|
||||
//
|
||||
// avatar boolean
|
||||
// include avatar of the template repo
|
||||
//
|
||||
// default_branch string
|
||||
// Default branch of the new repository
|
||||
//
|
||||
// description string
|
||||
// Description of the repository to create
|
||||
//
|
||||
// git_content boolean
|
||||
// include git content of default branch in template repo
|
||||
//
|
||||
// git_hooks boolean
|
||||
// include git hooks in template repo
|
||||
//
|
||||
// labels boolean
|
||||
// include labels in template repo
|
||||
//
|
||||
// name* string
|
||||
// uniqueItems: true
|
||||
// Name of the repository to create
|
||||
//
|
||||
// owner* string
|
||||
// The organization or person who will own the new repository
|
||||
//
|
||||
// private boolean
|
||||
// Whether the repository is private
|
||||
//
|
||||
// topics boolean
|
||||
// include topics in template repo
|
||||
//
|
||||
// webhooks boolean
|
||||
// include webhooks in template repo
|
||||
//
|
||||
// }
|
14
src/types/api/creation/wiki_page.rs
Normal file
14
src/types/api/creation/wiki_page.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
// CreateWikiPageOptions{
|
||||
// description:
|
||||
// CreateWikiPageOptions form for creating wiki
|
||||
//
|
||||
// content_base64 string
|
||||
// content must be base64 encoded
|
||||
//
|
||||
// message string
|
||||
// optional commit message summarizing the change
|
||||
//
|
||||
// title string
|
||||
// page title. leave empty to keep unchanged
|
||||
//
|
||||
// }
|
14
src/types/api/deploy_key.rs
Normal file
14
src/types/api/deploy_key.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
// [DeployKey{
|
||||
// description:
|
||||
// DeployKey a deploy key
|
||||
//
|
||||
// created_at string($date-time)
|
||||
// fingerprint string
|
||||
// id integer($int64)
|
||||
// key string
|
||||
// key_id integer($int64)
|
||||
// read_only boolean
|
||||
// repository Repository{...}
|
||||
// title string
|
||||
// url string
|
||||
// }]
|
7
src/types/api/dismiss_pull_review.rs
Normal file
7
src/types/api/dismiss_pull_review.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
// DismissPullReviewOptions{
|
||||
// description:
|
||||
// DismissPullReviewOptions are options to dismiss a pull review
|
||||
//
|
||||
// message string
|
||||
// priors boolean
|
||||
// }
|
6
src/types/api/edit/attachment.rs
Normal file
6
src/types/api/edit/attachment.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
// EditAttachmentOptions{
|
||||
// description:
|
||||
// EditAttachmentOptions options for editing attachments
|
||||
//
|
||||
// name string
|
||||
// }
|
40
src/types/api/edit/branch_protection.rs
Normal file
40
src/types/api/edit/branch_protection.rs
Normal file
|
@ -0,0 +1,40 @@
|
|||
// EditBranchProtectionOption{
|
||||
// description:
|
||||
// EditBranchProtectionOption options for editing a branch protection
|
||||
//
|
||||
// approvals_whitelist_teams [
|
||||
// x-go-name: ApprovalsWhitelistTeams
|
||||
// string]
|
||||
// approvals_whitelist_username [
|
||||
// x-go-name: ApprovalsWhitelistUsernames
|
||||
// string]
|
||||
// block_on_official_review_requests boolean
|
||||
// block_on_outdated_branch boolean
|
||||
// block_on_rejected_reviews boolean
|
||||
// dismiss_stale_approvals boolean
|
||||
// enable_approvals_whitelist boolean
|
||||
// enable_merge_whitelist boolean
|
||||
// enable_push boolean
|
||||
// enable_push_whitelist boolean
|
||||
// enable_status_check boolean
|
||||
// merge_whitelist_teams [
|
||||
// x-go-name: MergeWhitelistTeams
|
||||
// string]
|
||||
// merge_whitelist_usernames [
|
||||
// x-go-name: MergeWhitelistUsernames
|
||||
// string]
|
||||
// protected_file_patterns string
|
||||
// push_whitelist_deploy_keys boolean
|
||||
// push_whitelist_teams [
|
||||
// x-go-name: PushWhitelistTeams
|
||||
// string]
|
||||
// push_whitelist_usernames [
|
||||
// x-go-name: PushWhitelistUsernames
|
||||
// string]
|
||||
// require_signed_commits boolean
|
||||
// required_approvals integer($int64)
|
||||
// status_check_contexts [
|
||||
// x-go-name: StatusCheckContexts
|
||||
// string]
|
||||
// unprotected_file_patterns string
|
||||
// }
|
6
src/types/api/edit/comment.rs
Normal file
6
src/types/api/edit/comment.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
// EditIssueCommentOption{
|
||||
// description:
|
||||
// EditIssueCommentOption options for editing a comment
|
||||
//
|
||||
// body* string
|
||||
// }
|
6
src/types/api/edit/deadline.rs
Normal file
6
src/types/api/edit/deadline.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
// EditDeadlineOption{
|
||||
// description:
|
||||
// EditDeadlineOption options for creating a deadline
|
||||
//
|
||||
// due_date* string($date-time)
|
||||
// }
|
36
src/types/api/edit/file_options.rs
Normal file
36
src/types/api/edit/file_options.rs
Normal file
|
@ -0,0 +1,36 @@
|
|||
// UpdateFileOptions{
|
||||
// description:
|
||||
// UpdateFileOptions options for updating files
|
||||
// Note: author and committer are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
|
||||
//
|
||||
// author Identity{
|
||||
// description:
|
||||
// Identity for a person's identity like an author or committer
|
||||
//
|
||||
// email string($email)
|
||||
// name string
|
||||
// }
|
||||
// branch string
|
||||
// branch (optional) to base this file from. if not given, the default branch is used
|
||||
//
|
||||
// committer Identity{...}
|
||||
// content* string
|
||||
// content must be base64 encoded
|
||||
//
|
||||
// dates CommitDateOptions{...}
|
||||
// from_path string
|
||||
// from_path (optional) is the path of the original file which will be moved/renamed to the path in the URL
|
||||
//
|
||||
// message string
|
||||
// message (optional) for the commit of this file. if not supplied, a default message will be used
|
||||
//
|
||||
// new_branch string
|
||||
// new_branch (optional) will make a new branch from branch before creating the file
|
||||
//
|
||||
// sha* string
|
||||
// sha is the SHA for the file that already exists
|
||||
//
|
||||
// signoff boolean
|
||||
// Add a Signed-off-by trailer by the committer at the end of the commit log message.
|
||||
//
|
||||
// }
|
6
src/types/api/edit/git_hook.rs
Normal file
6
src/types/api/edit/git_hook.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
// EditGitHookOption{
|
||||
// description:
|
||||
// EditGitHookOption options when modifying one Git hook
|
||||
//
|
||||
// content string
|
||||
// }
|
|
@ -1,7 +1,7 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::types::misc::active::ActiveStatus;
|
||||
use crate::types::misc::boolean_enums::is::active::IsActive;
|
||||
use crate::types::misc::header::Header;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
@ -9,7 +9,7 @@ pub struct EditHookOption {
|
|||
/// Description of the options when modifying a hook
|
||||
description: String,
|
||||
/// Boolean flag indicating if the hook is active
|
||||
active: ActiveStatus,
|
||||
active: IsActive,
|
||||
/// Authorization header for the hook (if required)
|
||||
authorization_header: Header,
|
||||
/// Branch filter for the hook
|
||||
|
@ -27,7 +27,7 @@ mod tests {
|
|||
use hyper::http::{HeaderName, HeaderValue};
|
||||
|
||||
use crate::types::api::edit::hook::EditHookOption;
|
||||
use crate::types::misc::active::ActiveStatus;
|
||||
use crate::types::misc::boolean_enums::is::active::IsActive;
|
||||
use crate::types::misc::header::Header;
|
||||
|
||||
#[test]
|
||||
|
@ -38,7 +38,7 @@ mod tests {
|
|||
// Example usage:
|
||||
let expected = EditHookOption {
|
||||
description: "Options when modifying a hook".to_string(),
|
||||
active: ActiveStatus::Active,
|
||||
active: IsActive::Yes,
|
||||
authorization_header: Header(hyper::HeaderMap::from_iter(std::iter::once((
|
||||
HeaderName::from_static("bearer"),
|
||||
HeaderValue::from_static("TOKEN"),
|
||||
|
|
18
src/types/api/edit/issue.rs
Normal file
18
src/types/api/edit/issue.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
// EditIssueOption{
|
||||
// description:
|
||||
// EditIssueOption options for editing an issue
|
||||
//
|
||||
// assignee string
|
||||
// deprecated
|
||||
//
|
||||
// assignees [
|
||||
// x-go-name: Assignees
|
||||
// string]
|
||||
// body string
|
||||
// due_date string($date-time)
|
||||
// milestone integer($int64)
|
||||
// ref string
|
||||
// state string
|
||||
// title string
|
||||
// unset_due_date boolean
|
||||
// }
|
|
@ -2,8 +2,8 @@ use std::fmt::Display;
|
|||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::types::misc::boolean_enums::is::exclusive::Exclusive;
|
||||
use crate::types::misc::color::Color;
|
||||
use crate::types::misc::exclusive::Exclusive;
|
||||
|
||||
/// CreateLabelOption represents options for creating a label.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
|
@ -29,8 +29,8 @@ mod tests {
|
|||
use palette::rgb::Rgb;
|
||||
|
||||
use crate::types::api::creation::label::CreateLabelOption;
|
||||
use crate::types::misc::boolean_enums::is::exclusive::Exclusive;
|
||||
use crate::types::misc::color::Color;
|
||||
use crate::types::misc::exclusive::Exclusive;
|
||||
|
||||
#[test]
|
||||
fn deserialize_edit_label_option() {
|
||||
|
|
9
src/types/api/edit/milestone.rs
Normal file
9
src/types/api/edit/milestone.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
// EditMilestoneOption{
|
||||
// description:
|
||||
// EditMilestoneOption options for editing a milestone
|
||||
//
|
||||
// description string
|
||||
// due_on string($date-time)
|
||||
// state string
|
||||
// title string
|
||||
// }
|
|
@ -1,3 +1,18 @@
|
|||
pub mod hook;
|
||||
pub mod label;
|
||||
pub mod organization;
|
||||
|
||||
/* to-todo */
|
||||
pub mod attachment;
|
||||
/* to-todo */ pub mod branch_protection;
|
||||
/* to-todo */ pub mod comment;
|
||||
/* to-todo */ pub mod deadline;
|
||||
/* to-todo */ pub mod file_options;
|
||||
/* to-todo */ pub mod git_hook;
|
||||
/* to-todo */ pub mod issue;
|
||||
/* to-todo */ pub mod milestone;
|
||||
/* to-todo */ pub mod pull_request;
|
||||
/* to-todo */ pub mod reaction;
|
||||
/* to-todo */ pub mod release;
|
||||
/* to-todo */ pub mod repository;
|
||||
/* to-todo */ pub mod user_setting;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt::Display;
|
||||
|
||||
use crate::types::misc::team_access::RepoAdminCanChangeTeamAccess;
|
||||
use crate::types::misc::url::OptionalUrl;
|
||||
use crate::types::misc::boolean_enums::can::repo_admin_change_team_access::CanRepoAdminChangeTeamAccess;
|
||||
use crate::types::misc::optional_url::OptionalUrl;
|
||||
use crate::types::misc::visibility::Visibility;
|
||||
|
||||
/// EditOrgOption represents options for editing an organization
|
||||
|
@ -15,7 +15,7 @@ pub struct EditOrgOption {
|
|||
/// Location of the organization as a string
|
||||
pub location: String,
|
||||
/// Boolean flag indicating if repo admin can change team access
|
||||
pub repo_admin_change_team_access: RepoAdminCanChangeTeamAccess,
|
||||
pub repo_admin_change_team_access: CanRepoAdminChangeTeamAccess,
|
||||
/// Visibility of the organization
|
||||
pub visibility: Visibility,
|
||||
/// The organization's website URL (optional)
|
||||
|
@ -35,8 +35,8 @@ mod tests {
|
|||
use url::Url;
|
||||
|
||||
use crate::types::api::edit::organization::EditOrgOption;
|
||||
use crate::types::misc::team_access::RepoAdminCanChangeTeamAccess;
|
||||
use crate::types::misc::url::OptionalUrl;
|
||||
use crate::types::misc::boolean_enums::can::repo_admin_change_team_access::CanRepoAdminChangeTeamAccess;
|
||||
use crate::types::misc::optional_url::OptionalUrl;
|
||||
use crate::types::misc::visibility::Visibility;
|
||||
|
||||
#[test]
|
||||
|
@ -48,7 +48,7 @@ mod tests {
|
|||
description: String::from("Updated organization"),
|
||||
full_name: String::from("UpdatedOrg"),
|
||||
location: String::from("Updated City, Country"),
|
||||
repo_admin_change_team_access: RepoAdminCanChangeTeamAccess::No,
|
||||
repo_admin_change_team_access: CanRepoAdminChangeTeamAccess::No,
|
||||
visibility: Visibility::Private,
|
||||
website: OptionalUrl::Some(Url::from_str("https://updated.org").unwrap()),
|
||||
};
|
||||
|
|
20
src/types/api/edit/pull_request.rs
Normal file
20
src/types/api/edit/pull_request.rs
Normal file
|
@ -0,0 +1,20 @@
|
|||
// EditPullRequestOption{
|
||||
// description:
|
||||
// EditPullRequestOption options when modify pull request
|
||||
//
|
||||
// allow_maintainer_edit boolean
|
||||
// assignee string
|
||||
// assignees [
|
||||
// x-go-name: Assignees
|
||||
// string]
|
||||
// base string
|
||||
// body string
|
||||
// due_date string($date-time)
|
||||
// labels [
|
||||
// x-go-name: Labels
|
||||
// integer($int64)]
|
||||
// milestone integer($int64)
|
||||
// state string
|
||||
// title string
|
||||
// unset_due_date boolean
|
||||
// }
|
6
src/types/api/edit/reaction.rs
Normal file
6
src/types/api/edit/reaction.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
// EditReactionOption{
|
||||
// description:
|
||||
// EditReactionOption contain the reaction type
|
||||
//
|
||||
// content string
|
||||
// }
|
11
src/types/api/edit/release.rs
Normal file
11
src/types/api/edit/release.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
// EditReleaseOption{
|
||||
// description:
|
||||
// EditReleaseOption options when editing a release
|
||||
//
|
||||
// body string
|
||||
// draft boolean
|
||||
// name string
|
||||
// prerelease boolean
|
||||
// tag_name string
|
||||
// target_commitish string
|
||||
// }
|
81
src/types/api/edit/repository.rs
Normal file
81
src/types/api/edit/repository.rs
Normal file
|
@ -0,0 +1,81 @@
|
|||
// EditRepoOption{
|
||||
// description:
|
||||
// EditRepoOption options when editing a repository's properties
|
||||
//
|
||||
// allow_manual_merge boolean
|
||||
// either true to allow mark pr as merged manually, or false to prevent it.
|
||||
//
|
||||
// allow_merge_commits boolean
|
||||
// either true to allow merging pull requests with a merge commit, or false to prevent merging pull requests with merge commits.
|
||||
//
|
||||
// allow_rebase boolean
|
||||
// either true to allow rebase-merging pull requests, or false to prevent rebase-merging.
|
||||
//
|
||||
// allow_rebase_explicit boolean
|
||||
// either true to allow rebase with explicit merge commits (--no-ff), or false to prevent rebase with explicit merge commits.
|
||||
//
|
||||
// allow_rebase_update [...]
|
||||
// allow_squash_merge boolean
|
||||
// either true to allow squash-merging pull requests, or false to prevent squash-merging.
|
||||
//
|
||||
// archived boolean
|
||||
// set to true to archive this repository.
|
||||
//
|
||||
// autodetect_manual_merge boolean
|
||||
// either true to enable AutodetectManualMerge, or false to prevent it. Note: In some special cases, misjudgments can occur.
|
||||
//
|
||||
// default_allow_maintainer_edit boolean
|
||||
// set to true to allow edits from maintainers by default
|
||||
//
|
||||
// default_branch string
|
||||
// sets the default branch for this repository.
|
||||
//
|
||||
// default_delete_branch_after_merge boolean
|
||||
// set to true to delete pr branch after merge by default
|
||||
//
|
||||
// default_merge_style string
|
||||
// set to a merge style to be used by this repository: "merge", "rebase", "rebase-merge", or "squash".
|
||||
//
|
||||
// description string
|
||||
// a short description of the repository.
|
||||
//
|
||||
// enable_prune boolean
|
||||
// enable prune - remove obsolete remote-tracking references
|
||||
//
|
||||
// external_tracker ExternalTracker{...}
|
||||
// external_wiki ExternalWiki{...}
|
||||
// has_issues boolean
|
||||
// either true to enable issues for this repository or false to disable them.
|
||||
//
|
||||
// has_projects boolean
|
||||
// either true to enable project unit, or false to disable them.
|
||||
//
|
||||
// has_pull_requests boolean
|
||||
// either true to allow pull requests, or false to prevent pull request.
|
||||
//
|
||||
// has_wiki boolean
|
||||
// either true to enable the wiki for this repository or false to disable it.
|
||||
//
|
||||
// ignore_whitespace_conflicts boolean
|
||||
// either true to ignore whitespace for conflicts, or false to not ignore whitespace.
|
||||
//
|
||||
// internal_tracker InternalTracker{...}
|
||||
// mirror_interval string
|
||||
// set to a string like 8h30m0s to set the mirror interval time
|
||||
//
|
||||
// name string
|
||||
// uniqueItems: true
|
||||
// name of the repository
|
||||
//
|
||||
// private boolean
|
||||
// either true to make the repository private or false to make it public.
|
||||
// Note: you will get a 422 error if the organization restricts changing repository visibility to organization
|
||||
// owners and a non-owner tries to change the value of private.
|
||||
//
|
||||
// template boolean
|
||||
// either true to make this repository a template or false to make it a normal repository
|
||||
//
|
||||
// website string
|
||||
// a URL with more information about the repository.
|
||||
//
|
||||
// }
|
16
src/types/api/edit/user_setting.rs
Normal file
16
src/types/api/edit/user_setting.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
// UserSettingsOptions{
|
||||
// description:
|
||||
// UserSettingsOptions represents options to change user settings
|
||||
//
|
||||
// description string
|
||||
// diff_view_style string
|
||||
// full_name string
|
||||
// hide_activity boolean
|
||||
// hide_email boolean
|
||||
// Privacy
|
||||
//
|
||||
// language string
|
||||
// location string
|
||||
// theme string
|
||||
// website string
|
||||
// }
|
2
src/types/api/external/mod.rs
vendored
Normal file
2
src/types/api/external/mod.rs
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
pub mod tracker;
|
||||
pub mod wiki;
|
66
src/types/api/external/tracker.rs
vendored
Normal file
66
src/types/api/external/tracker.rs
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
use url::Url;
|
||||
|
||||
use crate::types::misc::external_issue_format::ExternalIssueFormat;
|
||||
|
||||
// 🚧🚧 TODO 🚧🚧 : custom serde
|
||||
// 1. Do some validation format and url have to match some parts
|
||||
// 2. merge regex pattern and style fields (pattern only set when style = regexp)
|
||||
/// ExternalTracker represents settings for an external tracker.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub struct ExternalTracker {
|
||||
/// External Issue Tracker URL Format. Use the placeholders {user}, {repo} and {index}
|
||||
/// for the username, repository name, and issue index.
|
||||
pub external_tracker_format: String,
|
||||
/// External Issue Tracker issue regular expression.
|
||||
pub external_tracker_regexp_pattern: String,
|
||||
/// External Issue Tracker Number Format, either numeric, alphanumeric, or regexp.
|
||||
pub external_tracker_style: ExternalIssueFormat,
|
||||
/// URL of the external issue tracker.
|
||||
pub external_tracker_url: Url,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tracker {
|
||||
use std::str::FromStr;
|
||||
|
||||
use url::Url;
|
||||
|
||||
use crate::types::api::external::tracker::ExternalTracker;
|
||||
use crate::types::misc::external_issue_format::ExternalIssueFormat;
|
||||
|
||||
#[test]
|
||||
fn external_tracker_deserialize() {
|
||||
let data = include_str!("../../../../test_data/example_external_trackers.json");
|
||||
let trackers: Vec<ExternalTracker> = serde_json::from_str(data).unwrap();
|
||||
|
||||
let expected = vec![
|
||||
ExternalTracker {
|
||||
external_tracker_format: String::from(
|
||||
"https://example-issues.com/{user}/{repo}/{index}",
|
||||
),
|
||||
external_tracker_regexp_pattern: String::default(),
|
||||
external_tracker_style: ExternalIssueFormat::Numeric,
|
||||
external_tracker_url: Url::from_str("https://example-issues.com").unwrap(),
|
||||
},
|
||||
ExternalTracker {
|
||||
external_tracker_format: String::from(
|
||||
"https://example-bugs.com/{user}/{repo}-{index}",
|
||||
),
|
||||
external_tracker_regexp_pattern: String::default(),
|
||||
external_tracker_style: ExternalIssueFormat::Alphanumeric,
|
||||
external_tracker_url: Url::from_str("https://example-bugs.com").unwrap(),
|
||||
},
|
||||
ExternalTracker {
|
||||
external_tracker_format: String::from(
|
||||
"https://custom-tracker.com/issue-{user}-{repo}-{index}",
|
||||
),
|
||||
external_tracker_regexp_pattern: String::from("issue-(\\w+)-(\\w+)-(\\d+)"),
|
||||
external_tracker_style: ExternalIssueFormat::Regexp,
|
||||
external_tracker_url: Url::from_str("https://custom-tracker.com").unwrap(),
|
||||
},
|
||||
];
|
||||
|
||||
assert_eq!(trackers, expected)
|
||||
}
|
||||
}
|
30
src/types/api/external/wiki.rs
vendored
Normal file
30
src/types/api/external/wiki.rs
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
use url::Url;
|
||||
|
||||
/// ExternalWiki represents settings for an external wiki.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub struct ExternalWiki {
|
||||
/// URL of the external wiki.
|
||||
pub external_wiki_url: Url,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod wiki {
|
||||
use std::str::FromStr;
|
||||
|
||||
use url::Url;
|
||||
|
||||
use crate::types::api::external::wiki::ExternalWiki;
|
||||
|
||||
#[test]
|
||||
fn deserialize_works() {
|
||||
let data = include_str!("../../../../test_data/example_external_wiki.json");
|
||||
let wiki: ExternalWiki = serde_json::from_str(data).unwrap();
|
||||
|
||||
let expected = ExternalWiki {
|
||||
external_wiki_url: Url::from_str("https://example-wiki.com").unwrap(),
|
||||
};
|
||||
|
||||
assert_eq!(wiki, expected);
|
||||
}
|
||||
}
|
8
src/types/api/file_link_response.rs
Normal file
8
src/types/api/file_link_response.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
// FileLinksResponse{
|
||||
// description:
|
||||
// FileLinksResponse contains the links for a repo's file
|
||||
//
|
||||
// git string
|
||||
// html string
|
||||
// self string
|
||||
// }
|
10
src/types/api/git_blob.rs
Normal file
10
src/types/api/git_blob.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
// GitBlobResponse{
|
||||
// description:
|
||||
// GitBlobResponse represents a git blob
|
||||
//
|
||||
// content string
|
||||
// encoding string
|
||||
// sha string
|
||||
// size integer($int64)
|
||||
// url string
|
||||
// }
|
11
src/types/api/git_entry.rs
Normal file
11
src/types/api/git_entry.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
// GitEntry{
|
||||
// description:
|
||||
// GitEntry represents a git tree
|
||||
//
|
||||
// mode string
|
||||
// path string
|
||||
// sha string
|
||||
// size integer($int64)
|
||||
// type string
|
||||
// url string
|
||||
// }]
|
8
src/types/api/git_hook.rs
Normal file
8
src/types/api/git_hook.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
// [GitHook{
|
||||
// description:
|
||||
// GitHook represents a Git repository hook
|
||||
//
|
||||
// content string
|
||||
// is_active boolean
|
||||
// name string
|
||||
// }]
|
5
src/types/api/git_object.rs
Normal file
5
src/types/api/git_object.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
// GitObject represents a Git object.{
|
||||
// sha string
|
||||
// type string
|
||||
// url string
|
||||
// }
|
5
src/types/api/git_ref.rs
Normal file
5
src/types/api/git_ref.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
// [Reference represents a Git reference.{
|
||||
// object GitObject represents a Git object.{...}
|
||||
// ref string
|
||||
// url string
|
||||
// }]
|
13
src/types/api/git_tree.rs
Normal file
13
src/types/api/git_tree.rs
Normal file
|
@ -0,0 +1,13 @@
|
|||
// GitTreeResponse{
|
||||
// description:
|
||||
// GitTreeResponse returns a git tree
|
||||
//
|
||||
// page integer($int64)
|
||||
// sha string
|
||||
// total_count integer($int64)
|
||||
// tree [
|
||||
// x-go-name: Entries
|
||||
// GitEntry{...}]
|
||||
// truncated boolean
|
||||
// url string
|
||||
// }
|
23
src/types/api/gpg_key.rs
Normal file
23
src/types/api/gpg_key.rs
Normal file
|
@ -0,0 +1,23 @@
|
|||
// GPGKey{
|
||||
// description:
|
||||
// GPGKey a user GPG key to sign commit and tag in repository
|
||||
//
|
||||
// can_certify boolean
|
||||
// can_encrypt_comms boolean
|
||||
// can_encrypt_storage boolean
|
||||
// can_sign boolean
|
||||
// created_at string($date-time)
|
||||
// emails [
|
||||
// x-go-name: Emails
|
||||
// GPGKeyEmail{...}]
|
||||
// expires_at string($date-time)
|
||||
// id integer($int64)
|
||||
// key_id string
|
||||
// primary_key_id string
|
||||
// public_key string
|
||||
// subkeys [
|
||||
// x-go-name: SubsKey
|
||||
// {
|
||||
// }]
|
||||
// verified boolean
|
||||
// }
|
7
src/types/api/gpg_key_email.rs
Normal file
7
src/types/api/gpg_key_email.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
// GPGKeyEmail{
|
||||
// description:
|
||||
// GPGKeyEmail an email attached to a GPGKey
|
||||
//
|
||||
// email string
|
||||
// verified boolean
|
||||
// }]
|
9
src/types/api/heat_map.rs
Normal file
9
src/types/api/heat_map.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
// [UserHeatmapData{
|
||||
// description:
|
||||
// UserHeatmapData represents the data needed to create a heatmap
|
||||
//
|
||||
// contributions integer($int64)
|
||||
// timestamp TimeStampinteger($int64)
|
||||
// TimeStamp defines a timestamp
|
||||
//
|
||||
// }]
|
|
@ -3,14 +3,14 @@ use serde::{Deserialize, Serialize};
|
|||
use std::collections::HashMap;
|
||||
use std::fmt::Display;
|
||||
|
||||
use crate::types::misc::active::ActiveStatus;
|
||||
use crate::types::misc::boolean_enums::is::active::IsActive;
|
||||
use crate::types::misc::header::Header;
|
||||
|
||||
/// Hook represents a web hook when one repository is changed
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub struct Hook {
|
||||
/// Boolean flag indicating if the hook is active
|
||||
pub active: ActiveStatus,
|
||||
pub active: IsActive,
|
||||
/// Authorization header for the Hook
|
||||
///
|
||||
/// This deviates a bit from the swagger docs and I'm not sure how it's even used correctly or
|
||||
|
@ -46,7 +46,7 @@ mod tests {
|
|||
use hyper::http::{HeaderName, HeaderValue};
|
||||
|
||||
use crate::types::api::hook::Hook;
|
||||
use crate::types::misc::active::ActiveStatus;
|
||||
use crate::types::misc::boolean_enums::is::active::IsActive;
|
||||
use crate::types::misc::header::Header;
|
||||
|
||||
#[test]
|
||||
|
@ -55,7 +55,7 @@ mod tests {
|
|||
|
||||
let hook: Hook = serde_json::from_str(data).unwrap();
|
||||
let expected = Hook {
|
||||
active: ActiveStatus::Active,
|
||||
active: IsActive::Yes,
|
||||
authorization_header: Header(hyper::HeaderMap::from_iter(std::iter::once((
|
||||
HeaderName::from_static("bearer"),
|
||||
HeaderValue::from_static("TOKEN"),
|
||||
|
|
7
src/types/api/identity.rs
Normal file
7
src/types/api/identity.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
// Identity{
|
||||
// description:
|
||||
// Identity for a person's identity like an author or committer
|
||||
//
|
||||
// email string($email)
|
||||
// name string
|
||||
// }
|
44
src/types/api/internal_tracker.rs
Normal file
44
src/types/api/internal_tracker.rs
Normal file
|
@ -0,0 +1,44 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::types::misc::boolean_enums::allow::only_contributors_track_time::AllowOnlyContributorsToTrackTime;
|
||||
use crate::types::misc::boolean_enums::enable::issue_dependencies::IssueDependencies;
|
||||
use crate::types::misc::boolean_enums::enable::time_tracker::TimeTracker;
|
||||
|
||||
/// InternalTracker represents settings for an internal tracker.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub struct InternalTracker {
|
||||
/// Let only contributors track time (Built-in issue tracker).
|
||||
pub allow_only_contributors_to_track_time: AllowOnlyContributorsToTrackTime,
|
||||
/// Enable dependencies for issues and pull requests (Built-in issue tracker).
|
||||
pub enable_issue_dependencies: IssueDependencies,
|
||||
/// Enable time tracking (Built-in issue tracker).
|
||||
pub enable_time_tracker: TimeTracker,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use serde_json;
|
||||
|
||||
use crate::types::api::internal_tracker::InternalTracker;
|
||||
use crate::types::misc::boolean_enums::allow::only_contributors_track_time::AllowOnlyContributorsToTrackTime;
|
||||
use crate::types::misc::boolean_enums::enable::issue_dependencies::IssueDependencies;
|
||||
use crate::types::misc::boolean_enums::enable::time_tracker::TimeTracker;
|
||||
|
||||
#[test]
|
||||
fn serialize_and_deserialize_internal_tracker() {
|
||||
// Define the expected JSON representation
|
||||
let data = include_str!("../../../test_data/example_internal_tracker.json");
|
||||
|
||||
// Deserialize the JSON string back to InternalTracker struct
|
||||
let internal_tracker: InternalTracker = serde_json::from_str(data).unwrap();
|
||||
|
||||
let expected = InternalTracker {
|
||||
allow_only_contributors_to_track_time: AllowOnlyContributorsToTrackTime::Yes,
|
||||
enable_issue_dependencies: IssueDependencies::Off,
|
||||
enable_time_tracker: TimeTracker::On,
|
||||
};
|
||||
|
||||
// Ensure the deserialized InternalTracker matches the original one
|
||||
assert_eq!(internal_tracker, expected);
|
||||
}
|
||||
}
|
35
src/types/api/issue.rs
Normal file
35
src/types/api/issue.rs
Normal file
|
@ -0,0 +1,35 @@
|
|||
// [Issue{
|
||||
// description:
|
||||
// Issue represents an issue in a repository
|
||||
//
|
||||
// assets [
|
||||
// x-go-name: Attachments
|
||||
// Attachment{...}]
|
||||
// assignee User{...}
|
||||
// assignees [
|
||||
// x-go-name: Assignees
|
||||
// User{...}]
|
||||
// body string
|
||||
// closed_at string($date-time)
|
||||
// comments integer($int64)
|
||||
// created_at string($date-time)
|
||||
// due_date string($date-time)
|
||||
// html_url string
|
||||
// id integer($int64)
|
||||
// is_locked boolean
|
||||
// labels [
|
||||
// x-go-name: Labels
|
||||
// Label{...}]
|
||||
// milestone Milestone{...}
|
||||
// number integer($int64)
|
||||
// original_author string
|
||||
// original_author_id integer($int64)
|
||||
// pull_request PullRequestMeta{...}
|
||||
// ref string
|
||||
// repository RepositoryMeta{...}
|
||||
// state StateType[...]
|
||||
// title string
|
||||
// updated_at string($date-time)
|
||||
// url string
|
||||
// user User{...}
|
||||
// }]
|
11
src/types/api/issue_form_field.rs
Normal file
11
src/types/api/issue_form_field.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
// IssueFormField{
|
||||
// description:
|
||||
// IssueFormField represents a form field
|
||||
//
|
||||
// attributes {
|
||||
// }
|
||||
// id string
|
||||
// type IssueFormFieldType defines issue form field type, can be "markdown", "textarea", "input", "dropdown" or "checkboxes"[...]
|
||||
// validations {
|
||||
// }
|
||||
// }]
|
2
src/types/api/issue_form_field_type.rs
Normal file
2
src/types/api/issue_form_field_type.rs
Normal file
|
@ -0,0 +1,2 @@
|
|||
// IssueFormFieldType defines issue form field type, can be "markdown", "textarea", "input", "dropdown" or "checkboxes"string
|
||||
// title: IssueFormFieldType defines issue form field type, can be "markdown", "textarea", "input", "dropdown" or "checkboxes"
|
17
src/types/api/issue_template.rs
Normal file
17
src/types/api/issue_template.rs
Normal file
|
@ -0,0 +1,17 @@
|
|||
// [IssueTemplate{
|
||||
// description:
|
||||
// IssueTemplate represents an issue template for a repository
|
||||
//
|
||||
// about string
|
||||
// body [
|
||||
// x-go-name: Fields
|
||||
// IssueFormField{...}]
|
||||
// content string
|
||||
// file_name string
|
||||
// labels IssueTemplateLabels[
|
||||
// x-go-package: code.gitea.io/gitea/modules/structs
|
||||
// string]
|
||||
// name string
|
||||
// ref string
|
||||
// title string
|
||||
// }]
|
3
src/types/api/issue_template_labels.rs
Normal file
3
src/types/api/issue_template_labels.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
// IssueTemplateLabels[
|
||||
// x-go-package: code.gitea.io/gitea/modules/structs
|
||||
// string]
|
|
@ -3,8 +3,8 @@ use std::fmt::Display;
|
|||
use serde::{Deserialize, Serialize};
|
||||
use url::Url;
|
||||
|
||||
use crate::types::misc::boolean_enums::is::exclusive::Exclusive;
|
||||
use crate::types::misc::color::Color;
|
||||
use crate::types::misc::exclusive::Exclusive;
|
||||
|
||||
/// Label represents a label attached to an issue or a PR.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
|
@ -37,8 +37,8 @@ mod tests {
|
|||
use url::Url;
|
||||
|
||||
use crate::types::api::label::Label;
|
||||
use crate::types::misc::boolean_enums::is::exclusive::Exclusive;
|
||||
use crate::types::misc::color::Color;
|
||||
use crate::types::misc::exclusive::Exclusive;
|
||||
|
||||
#[test]
|
||||
fn deserialize_label() {
|
||||
|
|
15
src/types/api/merge.rs
Normal file
15
src/types/api/merge.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
// MergePullRequestOption{
|
||||
// description:
|
||||
// MergePullRequestForm form for merging Pull Request
|
||||
//
|
||||
// Do* string
|
||||
// Enum:
|
||||
// [ merge, rebase, rebase-merge, squash, manually-merged ]
|
||||
// MergeCommitID string
|
||||
// MergeMessageField string
|
||||
// MergeTitleField string
|
||||
// delete_branch_after_merge boolean
|
||||
// force_merge boolean
|
||||
// head_commit_id string
|
||||
// merge_when_checks_succeed boolean
|
||||
// }
|
32
src/types/api/migration.rs
Normal file
32
src/types/api/migration.rs
Normal file
|
@ -0,0 +1,32 @@
|
|||
// MigrateRepoOptions{
|
||||
// description:
|
||||
// MigrateRepoOptions options for migrating repository's
|
||||
// this is used to interact with api v1
|
||||
//
|
||||
// auth_password string
|
||||
// auth_token string
|
||||
// auth_username string
|
||||
// clone_addr* string
|
||||
// description string
|
||||
// issues boolean
|
||||
// labels boolean
|
||||
// lfs boolean
|
||||
// lfs_endpoint string
|
||||
// milestones boolean
|
||||
// mirror boolean
|
||||
// mirror_interval string
|
||||
// private boolean
|
||||
// pull_requests boolean
|
||||
// releases boolean
|
||||
// repo_name* string
|
||||
// repo_owner string
|
||||
// Name of User or Organisation who will own Repo after migration
|
||||
//
|
||||
// service string
|
||||
// Enum:
|
||||
// [ git, github, gitea, gitlab ]
|
||||
// uid integer($int64)
|
||||
// deprecated (only for backwards compatibility)
|
||||
//
|
||||
// wiki boolean
|
||||
// }
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue