add enum types in query structs
This commit is contained in:
parent
945647baf1
commit
43f853dad3
|
@ -41,7 +41,7 @@ pub fn create_struct_for_definition(
|
||||||
|
|
||||||
if schema._type == Some(SchemaType::One(Primitive::String)) {
|
if schema._type == Some(SchemaType::One(Primitive::String)) {
|
||||||
if let Some(_enum) = &schema._enum {
|
if let Some(_enum) = &schema._enum {
|
||||||
return create_enum(name, schema);
|
return create_enum(name, schema.description.as_deref(), _enum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,31 +121,52 @@ pub fn create_struct_for_definition(
|
||||||
Ok(out)
|
Ok(out)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_enum(name: &str, schema: &Schema) -> eyre::Result<String> {
|
fn create_enum(
|
||||||
let _enum = schema
|
name: &str,
|
||||||
._enum
|
desc: Option<&str>,
|
||||||
.as_deref()
|
_enum: &[serde_json::Value],
|
||||||
.ok_or_else(|| eyre::eyre!("cannot create enum from non-enum schema"))?;
|
) -> eyre::Result<String> {
|
||||||
let mut variants = String::new();
|
let mut variants = String::new();
|
||||||
|
let mut imp = String::new();
|
||||||
let docs = create_struct_docs(schema)?;
|
imp.push_str("match self {");
|
||||||
|
let docs = create_struct_docs_str(desc)?;
|
||||||
for variant in _enum {
|
for variant in _enum {
|
||||||
match variant {
|
match variant {
|
||||||
serde_json::Value::String(s) => {
|
serde_json::Value::String(s) => {
|
||||||
let variant_name = s.to_pascal_case();
|
let variant_name = s.to_pascal_case();
|
||||||
variants.push_str(&variant_name);
|
variants.push_str(&variant_name);
|
||||||
variants.push_str(",\n");
|
variants.push_str(",\n");
|
||||||
|
|
||||||
|
writeln!(&mut imp, "{name}::{variant_name} => \"{s}\",")?;
|
||||||
}
|
}
|
||||||
x => eyre::bail!("cannot create enum variant. expected string, got {x:?}"),
|
x => eyre::bail!("cannot create enum variant. expected string, got {x:?}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
imp.push_str("}");
|
||||||
|
|
||||||
let out = format!("{docs}#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]\npub enum {name} {{\n{variants}}}\n\n");
|
let out = format!(
|
||||||
|
"
|
||||||
|
{docs}
|
||||||
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
|
pub enum {name} {{
|
||||||
|
{variants}
|
||||||
|
}}
|
||||||
|
|
||||||
|
impl {name} {{
|
||||||
|
fn as_str(&self) -> &'static str {{
|
||||||
|
{imp}
|
||||||
|
}}
|
||||||
|
}}"
|
||||||
|
);
|
||||||
Ok(out)
|
Ok(out)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_struct_docs(schema: &Schema) -> eyre::Result<String> {
|
fn create_struct_docs(schema: &Schema) -> eyre::Result<String> {
|
||||||
let doc = match &schema.description {
|
create_struct_docs_str(schema.description.as_deref())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn create_struct_docs_str(description: Option<&str>) -> eyre::Result<String> {
|
||||||
|
let doc = match description {
|
||||||
Some(desc) => {
|
Some(desc) => {
|
||||||
let mut out = String::new();
|
let mut out = String::new();
|
||||||
for line in desc.lines() {
|
for line in desc.lines() {
|
||||||
|
@ -203,6 +224,8 @@ fn create_query_struct(op: &Operation) -> eyre::Result<String> {
|
||||||
None => return Ok(String::new()),
|
None => return Ok(String::new()),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let op_name = query_struct_name(op)?;
|
||||||
|
let mut enums = Vec::new();
|
||||||
let mut fields = String::new();
|
let mut fields = String::new();
|
||||||
let mut imp = String::new();
|
let mut imp = String::new();
|
||||||
for param in params {
|
for param in params {
|
||||||
|
@ -211,8 +234,35 @@ fn create_query_struct(op: &Operation) -> eyre::Result<String> {
|
||||||
MaybeRef::Ref { _ref } => eyre::bail!("todo: add deref parameters"),
|
MaybeRef::Ref { _ref } => eyre::bail!("todo: add deref parameters"),
|
||||||
};
|
};
|
||||||
if let ParameterIn::Query { param: query_param } = ¶m._in {
|
if let ParameterIn::Query { param: query_param } = ¶m._in {
|
||||||
let ty = crate::methods::param_type(query_param, true)?;
|
|
||||||
let field_name = crate::sanitize_ident(¶m.name);
|
let field_name = crate::sanitize_ident(¶m.name);
|
||||||
|
let ty = match &query_param {
|
||||||
|
NonBodyParameter {
|
||||||
|
_type: ParameterType::String,
|
||||||
|
_enum: Some(_enum),
|
||||||
|
..
|
||||||
|
} => {
|
||||||
|
let name = format!("{op_name}{}", param.name.to_pascal_case());
|
||||||
|
let enum_def = create_enum(&name, None, _enum)?;
|
||||||
|
enums.push(enum_def);
|
||||||
|
name
|
||||||
|
}
|
||||||
|
NonBodyParameter {
|
||||||
|
_type: ParameterType::Array,
|
||||||
|
items:
|
||||||
|
Some(Items {
|
||||||
|
_type: ParameterType::String,
|
||||||
|
_enum: Some(_enum),
|
||||||
|
..
|
||||||
|
}),
|
||||||
|
..
|
||||||
|
} => {
|
||||||
|
let name = format!("{op_name}{}", param.name.to_pascal_case());
|
||||||
|
let enum_def = create_enum(&name, None, _enum)?;
|
||||||
|
enums.push(enum_def);
|
||||||
|
format!("Vec<{name}>")
|
||||||
|
}
|
||||||
|
_ => crate::methods::param_type(query_param, true)?,
|
||||||
|
};
|
||||||
if let Some(desc) = ¶m.description {
|
if let Some(desc) = ¶m.description {
|
||||||
for line in desc.lines() {
|
for line in desc.lines() {
|
||||||
fields.push_str("/// ");
|
fields.push_str("/// ");
|
||||||
|
@ -242,22 +292,32 @@ fn create_query_struct(op: &Operation) -> eyre::Result<String> {
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
match &query_param._type {
|
match &query_param._type {
|
||||||
ParameterType::String => match query_param.format.as_deref() {
|
ParameterType::String => {
|
||||||
Some("date-time" | "date") => {
|
if let Some(_enum) = &query_param._enum {
|
||||||
writeln!(
|
writeln!(
|
||||||
&mut handler,
|
&mut handler,
|
||||||
"write!(f, \"{}={{field_name}}&\", field_name = {field_name}.format(&time::format_description::well_known::Rfc3339).unwrap())?;",
|
"write!(f, \"{}={{}}&\", {}.as_str())?;",
|
||||||
param.name)?;
|
param.name, field_name,
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
writeln!(
|
|
||||||
&mut handler,
|
|
||||||
"write!(f, \"{}={{{}}}&\")?;",
|
|
||||||
param.name,
|
|
||||||
field_name.strip_prefix("r#").unwrap_or(&field_name)
|
|
||||||
)?;
|
)?;
|
||||||
|
} else {
|
||||||
|
match query_param.format.as_deref() {
|
||||||
|
Some("date-time" | "date") => {
|
||||||
|
writeln!(
|
||||||
|
&mut handler,
|
||||||
|
"write!(f, \"{}={{field_name}}&\", field_name = {field_name}.format(&time::format_description::well_known::Rfc3339).unwrap())?;",
|
||||||
|
param.name)?;
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
writeln!(
|
||||||
|
&mut handler,
|
||||||
|
"write!(f, \"{}={{{}}}&\")?;",
|
||||||
|
param.name,
|
||||||
|
field_name.strip_prefix("r#").unwrap_or(&field_name)
|
||||||
|
)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
ParameterType::Number | ParameterType::Integer | ParameterType::Boolean => {
|
ParameterType::Number | ParameterType::Integer | ParameterType::Boolean => {
|
||||||
writeln!(
|
writeln!(
|
||||||
&mut handler,
|
&mut handler,
|
||||||
|
@ -276,23 +336,25 @@ fn create_query_struct(op: &Operation) -> eyre::Result<String> {
|
||||||
.ok_or_else(|| eyre::eyre!("array must have item type defined"))?;
|
.ok_or_else(|| eyre::eyre!("array must have item type defined"))?;
|
||||||
let item_pusher = match item._type {
|
let item_pusher = match item._type {
|
||||||
ParameterType::String => {
|
ParameterType::String => {
|
||||||
match query_param.format.as_deref() {
|
if let Some(_enum) = &item._enum {
|
||||||
Some("date-time" | "date") => {
|
"write!(f, \"{}\", item.as_str())?;"
|
||||||
"write!(f, \"{{date}}\", item.format(&time::format_description::well_known::Rfc3339).unwrap())?;"
|
} else {
|
||||||
},
|
match query_param.format.as_deref() {
|
||||||
_ => {
|
Some("date-time" | "date") => {
|
||||||
"write!(f, \"{item}\")?;"
|
"write!(f, \"{{date}}\", item.format(&time::format_description::well_known::Rfc3339).unwrap())?;"
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
"write!(f, \"{item}\")?;"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
ParameterType::Number |
|
ParameterType::Number | ParameterType::Integer | ParameterType::Boolean => {
|
||||||
ParameterType::Integer |
|
"write!(f, \"{item}\")?;"
|
||||||
ParameterType::Boolean => {
|
}
|
||||||
"write!(f, \"{item}\")?;"
|
|
||||||
},
|
|
||||||
ParameterType::Array => {
|
ParameterType::Array => {
|
||||||
eyre::bail!("nested arrays not supported in query");
|
eyre::bail!("nested arrays not supported in query");
|
||||||
},
|
}
|
||||||
ParameterType::File => eyre::bail!("cannot send file in query"),
|
ParameterType::File => eyre::bail!("cannot send file in query"),
|
||||||
};
|
};
|
||||||
match format {
|
match format {
|
||||||
|
@ -353,8 +415,7 @@ fn create_query_struct(op: &Operation) -> eyre::Result<String> {
|
||||||
let result = if fields.is_empty() {
|
let result = if fields.is_empty() {
|
||||||
String::new()
|
String::new()
|
||||||
} else {
|
} else {
|
||||||
let op_name = query_struct_name(op)?;
|
let mut out = format!(
|
||||||
format!(
|
|
||||||
"
|
"
|
||||||
pub struct {op_name} {{
|
pub struct {op_name} {{
|
||||||
{fields}
|
{fields}
|
||||||
|
@ -367,7 +428,13 @@ impl std::fmt::Display for {op_name} {{
|
||||||
}}
|
}}
|
||||||
}}
|
}}
|
||||||
"
|
"
|
||||||
)
|
);
|
||||||
|
|
||||||
|
for _enum in enums {
|
||||||
|
out.push_str(&_enum);
|
||||||
|
}
|
||||||
|
|
||||||
|
out
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(result)
|
Ok(result)
|
||||||
|
|
444
src/generated.rs
444
src/generated.rs
|
@ -7409,6 +7409,7 @@ pub mod structs {
|
||||||
|
|
||||||
/// indicates what to do with the file
|
/// indicates what to do with the file
|
||||||
///
|
///
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
pub enum ChangeFileOperationOperation {
|
pub enum ChangeFileOperationOperation {
|
||||||
Create,
|
Create,
|
||||||
|
@ -7416,6 +7417,15 @@ pub mod structs {
|
||||||
Delete,
|
Delete,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ChangeFileOperationOperation {
|
||||||
|
fn as_str(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
ChangeFileOperationOperation::Create => "create",
|
||||||
|
ChangeFileOperationOperation::Update => "update",
|
||||||
|
ChangeFileOperationOperation::Delete => "delete",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/// ChangeFilesOptions options for creating, updating or deleting multiple files
|
/// ChangeFilesOptions options for creating, updating or deleting multiple 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)
|
/// 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)
|
||||||
|
@ -7762,6 +7772,23 @@ pub mod structs {
|
||||||
Packagist,
|
Packagist,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl CreateHookOptionType {
|
||||||
|
fn as_str(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
CreateHookOptionType::Forgejo => "forgejo",
|
||||||
|
CreateHookOptionType::Dingtalk => "dingtalk",
|
||||||
|
CreateHookOptionType::Discord => "discord",
|
||||||
|
CreateHookOptionType::Gitea => "gitea",
|
||||||
|
CreateHookOptionType::Gogs => "gogs",
|
||||||
|
CreateHookOptionType::Msteams => "msteams",
|
||||||
|
CreateHookOptionType::Slack => "slack",
|
||||||
|
CreateHookOptionType::Telegram => "telegram",
|
||||||
|
CreateHookOptionType::Feishu => "feishu",
|
||||||
|
CreateHookOptionType::Wechatwork => "wechatwork",
|
||||||
|
CreateHookOptionType::Packagist => "packagist",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/// CreateHookOptionConfig has all config options in it
|
/// CreateHookOptionConfig has all config options in it
|
||||||
///
|
///
|
||||||
/// required are "content_type" and "url" Required
|
/// required are "content_type" and "url" Required
|
||||||
|
@ -7847,6 +7874,14 @@ pub mod structs {
|
||||||
Closed,
|
Closed,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl CreateMilestoneOptionState {
|
||||||
|
fn as_str(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
CreateMilestoneOptionState::Open => "open",
|
||||||
|
CreateMilestoneOptionState::Closed => "closed",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/// CreateOAuth2ApplicationOptions holds options to create an oauth2 application
|
/// CreateOAuth2ApplicationOptions holds options to create an oauth2 application
|
||||||
///
|
///
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
|
@ -7883,6 +7918,7 @@ pub mod structs {
|
||||||
|
|
||||||
/// possible values are `public` (default), `limited` or `private`
|
/// possible values are `public` (default), `limited` or `private`
|
||||||
///
|
///
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
pub enum CreateOrgOptionVisibility {
|
pub enum CreateOrgOptionVisibility {
|
||||||
Public,
|
Public,
|
||||||
|
@ -7890,6 +7926,15 @@ pub mod structs {
|
||||||
Private,
|
Private,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl CreateOrgOptionVisibility {
|
||||||
|
fn as_str(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
CreateOrgOptionVisibility::Public => "public",
|
||||||
|
CreateOrgOptionVisibility::Limited => "limited",
|
||||||
|
CreateOrgOptionVisibility::Private => "private",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/// CreatePullRequestOption options when creating a pull request
|
/// CreatePullRequestOption options when creating a pull request
|
||||||
///
|
///
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
|
@ -7994,6 +8039,7 @@ pub mod structs {
|
||||||
|
|
||||||
/// TrustModel of the repository
|
/// TrustModel of the repository
|
||||||
///
|
///
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
pub enum CreateRepoOptionTrustModel {
|
pub enum CreateRepoOptionTrustModel {
|
||||||
Default,
|
Default,
|
||||||
|
@ -8002,6 +8048,16 @@ pub mod structs {
|
||||||
Collaboratorcommitter,
|
Collaboratorcommitter,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl CreateRepoOptionTrustModel {
|
||||||
|
fn as_str(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
CreateRepoOptionTrustModel::Default => "default",
|
||||||
|
CreateRepoOptionTrustModel::Collaborator => "collaborator",
|
||||||
|
CreateRepoOptionTrustModel::Committer => "committer",
|
||||||
|
CreateRepoOptionTrustModel::Collaboratorcommitter => "collaboratorcommitter",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/// CreateStatusOption holds the information needed to create a new CommitStatus for a Commit
|
/// CreateStatusOption holds the information needed to create a new CommitStatus for a Commit
|
||||||
///
|
///
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
|
@ -8042,6 +8098,15 @@ pub mod structs {
|
||||||
Admin,
|
Admin,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl CreateTeamOptionPermission {
|
||||||
|
fn as_str(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
CreateTeamOptionPermission::Read => "read",
|
||||||
|
CreateTeamOptionPermission::Write => "write",
|
||||||
|
CreateTeamOptionPermission::Admin => "admin",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
pub struct CreateTeamOptionUnitsMap {
|
pub struct CreateTeamOptionUnitsMap {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
|
@ -8303,6 +8368,7 @@ pub mod structs {
|
||||||
|
|
||||||
/// possible values are `public`, `limited` or `private`
|
/// possible values are `public`, `limited` or `private`
|
||||||
///
|
///
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
pub enum EditOrgOptionVisibility {
|
pub enum EditOrgOptionVisibility {
|
||||||
Public,
|
Public,
|
||||||
|
@ -8310,6 +8376,15 @@ pub mod structs {
|
||||||
Private,
|
Private,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl EditOrgOptionVisibility {
|
||||||
|
fn as_str(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
EditOrgOptionVisibility::Public => "public",
|
||||||
|
EditOrgOptionVisibility::Limited => "limited",
|
||||||
|
EditOrgOptionVisibility::Private => "private",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/// EditPullRequestOption options when modify pull request
|
/// EditPullRequestOption options when modify pull request
|
||||||
///
|
///
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
|
@ -8461,6 +8536,15 @@ pub mod structs {
|
||||||
Admin,
|
Admin,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl EditTeamOptionPermission {
|
||||||
|
fn as_str(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
EditTeamOptionPermission::Read => "read",
|
||||||
|
EditTeamOptionPermission::Write => "write",
|
||||||
|
EditTeamOptionPermission::Admin => "admin",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
pub struct EditTeamOptionUnitsMap {
|
pub struct EditTeamOptionUnitsMap {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
|
@ -9092,6 +9176,17 @@ pub mod structs {
|
||||||
ManuallyMerged,
|
ManuallyMerged,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl MergePullRequestOptionDo {
|
||||||
|
fn as_str(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
MergePullRequestOptionDo::Merge => "merge",
|
||||||
|
MergePullRequestOptionDo::Rebase => "rebase",
|
||||||
|
MergePullRequestOptionDo::RebaseMerge => "rebase-merge",
|
||||||
|
MergePullRequestOptionDo::Squash => "squash",
|
||||||
|
MergePullRequestOptionDo::ManuallyMerged => "manually-merged",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/// MigrateRepoOptions options for migrating repository's
|
/// MigrateRepoOptions options for migrating repository's
|
||||||
///
|
///
|
||||||
/// this is used to interact with api v1
|
/// this is used to interact with api v1
|
||||||
|
@ -9136,6 +9231,20 @@ pub mod structs {
|
||||||
Codebase,
|
Codebase,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl MigrateRepoOptionsService {
|
||||||
|
fn as_str(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
MigrateRepoOptionsService::Git => "git",
|
||||||
|
MigrateRepoOptionsService::Github => "github",
|
||||||
|
MigrateRepoOptionsService::Gitea => "gitea",
|
||||||
|
MigrateRepoOptionsService::Gitlab => "gitlab",
|
||||||
|
MigrateRepoOptionsService::Gogs => "gogs",
|
||||||
|
MigrateRepoOptionsService::Onedev => "onedev",
|
||||||
|
MigrateRepoOptionsService::Gitbucket => "gitbucket",
|
||||||
|
MigrateRepoOptionsService::Codebase => "codebase",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/// Milestone milestone is a collection of issues on one repository
|
/// Milestone milestone is a collection of issues on one repository
|
||||||
///
|
///
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
|
@ -9829,6 +9938,17 @@ pub mod structs {
|
||||||
Owner,
|
Owner,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl TeamPermission {
|
||||||
|
fn as_str(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
TeamPermission::None => "none",
|
||||||
|
TeamPermission::Read => "read",
|
||||||
|
TeamPermission::Write => "write",
|
||||||
|
TeamPermission::Admin => "admin",
|
||||||
|
TeamPermission::Owner => "owner",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
pub struct TeamUnitsMap {
|
pub struct TeamUnitsMap {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
|
@ -10587,7 +10707,7 @@ pub mod structs {
|
||||||
pub status_types: Option<Vec<String>>,
|
pub status_types: Option<Vec<String>>,
|
||||||
/// filter notifications by subject type
|
/// filter notifications by subject type
|
||||||
///
|
///
|
||||||
pub subject_type: Option<Vec<String>>,
|
pub subject_type: Option<Vec<NotifyGetListQuerySubjectType>>,
|
||||||
/// Only show notifications updated after the given time. This is a timestamp in RFC 3339 format
|
/// Only show notifications updated after the given time. This is a timestamp in RFC 3339 format
|
||||||
///
|
///
|
||||||
pub since: Option<time::OffsetDateTime>,
|
pub since: Option<time::OffsetDateTime>,
|
||||||
|
@ -10620,7 +10740,7 @@ pub mod structs {
|
||||||
if !subject_type.is_empty() {
|
if !subject_type.is_empty() {
|
||||||
for item in subject_type {
|
for item in subject_type {
|
||||||
write!(f, "subject-type=")?;
|
write!(f, "subject-type=")?;
|
||||||
write!(f, "{item}")?;
|
write!(f, "{}", item.as_str())?;
|
||||||
write!(f, "&")?;
|
write!(f, "&")?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10654,6 +10774,24 @@ pub mod structs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
|
pub enum NotifyGetListQuerySubjectType {
|
||||||
|
Issue,
|
||||||
|
Pull,
|
||||||
|
Commit,
|
||||||
|
Repository,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl NotifyGetListQuerySubjectType {
|
||||||
|
fn as_str(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
NotifyGetListQuerySubjectType::Issue => "issue",
|
||||||
|
NotifyGetListQuerySubjectType::Pull => "pull",
|
||||||
|
NotifyGetListQuerySubjectType::Commit => "commit",
|
||||||
|
NotifyGetListQuerySubjectType::Repository => "repository",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
pub struct NotifyReadListQuery {
|
pub struct NotifyReadListQuery {
|
||||||
/// Describes the last point that notifications were checked. Anything updated since this time will not be updated.
|
/// Describes the last point that notifications were checked. Anything updated since this time will not be updated.
|
||||||
///
|
///
|
||||||
|
@ -10991,7 +11129,7 @@ pub mod structs {
|
||||||
pub limit: Option<u32>,
|
pub limit: Option<u32>,
|
||||||
/// package type filter
|
/// package type filter
|
||||||
///
|
///
|
||||||
pub r#type: Option<String>,
|
pub r#type: Option<ListPackagesQueryRType>,
|
||||||
/// name filter
|
/// name filter
|
||||||
///
|
///
|
||||||
pub q: Option<String>,
|
pub q: Option<String>,
|
||||||
|
@ -11006,7 +11144,7 @@ pub mod structs {
|
||||||
write!(f, "limit={limit}&")?;
|
write!(f, "limit={limit}&")?;
|
||||||
}
|
}
|
||||||
if let Some(r#type) = &self.r#type {
|
if let Some(r#type) = &self.r#type {
|
||||||
write!(f, "type={type}&")?;
|
write!(f, "type={}&", r#type.as_str())?;
|
||||||
}
|
}
|
||||||
if let Some(q) = &self.q {
|
if let Some(q) = &self.q {
|
||||||
write!(f, "q={q}&")?;
|
write!(f, "q={q}&")?;
|
||||||
|
@ -11016,6 +11154,58 @@ pub mod structs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
|
pub enum ListPackagesQueryRType {
|
||||||
|
Alpine,
|
||||||
|
Cargo,
|
||||||
|
Chef,
|
||||||
|
Composer,
|
||||||
|
Conan,
|
||||||
|
Conda,
|
||||||
|
Container,
|
||||||
|
Cran,
|
||||||
|
Debian,
|
||||||
|
Generic,
|
||||||
|
Go,
|
||||||
|
Helm,
|
||||||
|
Maven,
|
||||||
|
Npm,
|
||||||
|
Nuget,
|
||||||
|
Pub,
|
||||||
|
Pypi,
|
||||||
|
Rpm,
|
||||||
|
Rubygems,
|
||||||
|
Swift,
|
||||||
|
Vagrant,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ListPackagesQueryRType {
|
||||||
|
fn as_str(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
ListPackagesQueryRType::Alpine => "alpine",
|
||||||
|
ListPackagesQueryRType::Cargo => "cargo",
|
||||||
|
ListPackagesQueryRType::Chef => "chef",
|
||||||
|
ListPackagesQueryRType::Composer => "composer",
|
||||||
|
ListPackagesQueryRType::Conan => "conan",
|
||||||
|
ListPackagesQueryRType::Conda => "conda",
|
||||||
|
ListPackagesQueryRType::Container => "container",
|
||||||
|
ListPackagesQueryRType::Cran => "cran",
|
||||||
|
ListPackagesQueryRType::Debian => "debian",
|
||||||
|
ListPackagesQueryRType::Generic => "generic",
|
||||||
|
ListPackagesQueryRType::Go => "go",
|
||||||
|
ListPackagesQueryRType::Helm => "helm",
|
||||||
|
ListPackagesQueryRType::Maven => "maven",
|
||||||
|
ListPackagesQueryRType::Npm => "npm",
|
||||||
|
ListPackagesQueryRType::Nuget => "nuget",
|
||||||
|
ListPackagesQueryRType::Pub => "pub",
|
||||||
|
ListPackagesQueryRType::Pypi => "pypi",
|
||||||
|
ListPackagesQueryRType::Rpm => "rpm",
|
||||||
|
ListPackagesQueryRType::Rubygems => "rubygems",
|
||||||
|
ListPackagesQueryRType::Swift => "swift",
|
||||||
|
ListPackagesQueryRType::Vagrant => "vagrant",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
pub struct IssueSearchIssuesQuery {
|
pub struct IssueSearchIssuesQuery {
|
||||||
/// whether issue is open or closed
|
/// whether issue is open or closed
|
||||||
///
|
///
|
||||||
|
@ -11413,10 +11603,10 @@ pub mod structs {
|
||||||
pub struct RepoListStatusesByRefQuery {
|
pub struct RepoListStatusesByRefQuery {
|
||||||
/// type of sort
|
/// type of sort
|
||||||
///
|
///
|
||||||
pub sort: Option<String>,
|
pub sort: Option<RepoListStatusesByRefQuerySort>,
|
||||||
/// type of state
|
/// type of state
|
||||||
///
|
///
|
||||||
pub state: Option<String>,
|
pub state: Option<RepoListStatusesByRefQueryState>,
|
||||||
/// page number of results to return (1-based)
|
/// page number of results to return (1-based)
|
||||||
///
|
///
|
||||||
pub page: Option<u32>,
|
pub page: Option<u32>,
|
||||||
|
@ -11428,10 +11618,10 @@ pub mod structs {
|
||||||
impl std::fmt::Display for RepoListStatusesByRefQuery {
|
impl std::fmt::Display for RepoListStatusesByRefQuery {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
if let Some(sort) = &self.sort {
|
if let Some(sort) = &self.sort {
|
||||||
write!(f, "sort={sort}&")?;
|
write!(f, "sort={}&", sort.as_str())?;
|
||||||
}
|
}
|
||||||
if let Some(state) = &self.state {
|
if let Some(state) = &self.state {
|
||||||
write!(f, "state={state}&")?;
|
write!(f, "state={}&", state.as_str())?;
|
||||||
}
|
}
|
||||||
if let Some(page) = &self.page {
|
if let Some(page) = &self.page {
|
||||||
write!(f, "page={page}&")?;
|
write!(f, "page={page}&")?;
|
||||||
|
@ -11444,6 +11634,47 @@ pub mod structs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
|
pub enum RepoListStatusesByRefQuerySort {
|
||||||
|
Oldest,
|
||||||
|
Recentupdate,
|
||||||
|
Leastupdate,
|
||||||
|
Leastindex,
|
||||||
|
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, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
|
pub enum RepoListStatusesByRefQueryState {
|
||||||
|
Pending,
|
||||||
|
Success,
|
||||||
|
Error,
|
||||||
|
Failure,
|
||||||
|
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",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
pub struct RepoGetContentsListQuery {
|
pub struct RepoGetContentsListQuery {
|
||||||
/// The name of the commit/branch/tag. Default the repository’s default branch (usually master)
|
/// The name of the commit/branch/tag. Default the repository’s default branch (usually master)
|
||||||
///
|
///
|
||||||
|
@ -11633,7 +11864,7 @@ pub mod structs {
|
||||||
pub struct IssueListIssuesQuery {
|
pub struct IssueListIssuesQuery {
|
||||||
/// whether issue is open or closed
|
/// whether issue is open or closed
|
||||||
///
|
///
|
||||||
pub state: Option<String>,
|
pub state: Option<IssueListIssuesQueryState>,
|
||||||
/// comma separated list of labels. Fetch only issues that have any of this labels. Non existent labels are discarded
|
/// comma separated list of labels. Fetch only issues that have any of this labels. Non existent labels are discarded
|
||||||
///
|
///
|
||||||
pub labels: Option<String>,
|
pub labels: Option<String>,
|
||||||
|
@ -11642,7 +11873,7 @@ pub mod structs {
|
||||||
pub q: Option<String>,
|
pub q: Option<String>,
|
||||||
/// filter by type (issues / pulls) if set
|
/// filter by type (issues / pulls) if set
|
||||||
///
|
///
|
||||||
pub r#type: Option<String>,
|
pub r#type: Option<IssueListIssuesQueryRType>,
|
||||||
/// comma separated list of milestone names or ids. It uses names and fall back to ids. Fetch only issues that have any of this milestones. Non existent milestones are discarded
|
/// comma separated list of milestone names or ids. It uses names and fall back to ids. Fetch only issues that have any of this milestones. Non existent milestones are discarded
|
||||||
///
|
///
|
||||||
pub milestones: Option<String>,
|
pub milestones: Option<String>,
|
||||||
|
@ -11672,7 +11903,7 @@ pub mod structs {
|
||||||
impl std::fmt::Display for IssueListIssuesQuery {
|
impl std::fmt::Display for IssueListIssuesQuery {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
if let Some(state) = &self.state {
|
if let Some(state) = &self.state {
|
||||||
write!(f, "state={state}&")?;
|
write!(f, "state={}&", state.as_str())?;
|
||||||
}
|
}
|
||||||
if let Some(labels) = &self.labels {
|
if let Some(labels) = &self.labels {
|
||||||
write!(f, "labels={labels}&")?;
|
write!(f, "labels={labels}&")?;
|
||||||
|
@ -11681,7 +11912,7 @@ pub mod structs {
|
||||||
write!(f, "q={q}&")?;
|
write!(f, "q={q}&")?;
|
||||||
}
|
}
|
||||||
if let Some(r#type) = &self.r#type {
|
if let Some(r#type) = &self.r#type {
|
||||||
write!(f, "type={type}&")?;
|
write!(f, "type={}&", r#type.as_str())?;
|
||||||
}
|
}
|
||||||
if let Some(milestones) = &self.milestones {
|
if let Some(milestones) = &self.milestones {
|
||||||
write!(f, "milestones={milestones}&")?;
|
write!(f, "milestones={milestones}&")?;
|
||||||
|
@ -11724,6 +11955,37 @@ pub mod structs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
|
pub enum IssueListIssuesQueryState {
|
||||||
|
Closed,
|
||||||
|
Open,
|
||||||
|
All,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl IssueListIssuesQueryState {
|
||||||
|
fn as_str(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
IssueListIssuesQueryState::Closed => "closed",
|
||||||
|
IssueListIssuesQueryState::Open => "open",
|
||||||
|
IssueListIssuesQueryState::All => "all",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
|
pub enum IssueListIssuesQueryRType {
|
||||||
|
Issues,
|
||||||
|
Pulls,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl IssueListIssuesQueryRType {
|
||||||
|
fn as_str(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
IssueListIssuesQueryRType::Issues => "issues",
|
||||||
|
IssueListIssuesQueryRType::Pulls => "pulls",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
pub struct IssueGetRepoCommentsQuery {
|
pub struct IssueGetRepoCommentsQuery {
|
||||||
/// if provided, only comments updated since the provided time are returned.
|
/// if provided, only comments updated since the provided time are returned.
|
||||||
///
|
///
|
||||||
|
@ -12161,7 +12423,7 @@ pub mod structs {
|
||||||
pub status_types: Option<Vec<String>>,
|
pub status_types: Option<Vec<String>>,
|
||||||
/// filter notifications by subject type
|
/// filter notifications by subject type
|
||||||
///
|
///
|
||||||
pub subject_type: Option<Vec<String>>,
|
pub subject_type: Option<Vec<NotifyGetRepoListQuerySubjectType>>,
|
||||||
/// Only show notifications updated after the given time. This is a timestamp in RFC 3339 format
|
/// Only show notifications updated after the given time. This is a timestamp in RFC 3339 format
|
||||||
///
|
///
|
||||||
pub since: Option<time::OffsetDateTime>,
|
pub since: Option<time::OffsetDateTime>,
|
||||||
|
@ -12194,7 +12456,7 @@ pub mod structs {
|
||||||
if !subject_type.is_empty() {
|
if !subject_type.is_empty() {
|
||||||
for item in subject_type {
|
for item in subject_type {
|
||||||
write!(f, "subject-type=")?;
|
write!(f, "subject-type=")?;
|
||||||
write!(f, "{item}")?;
|
write!(f, "{}", item.as_str())?;
|
||||||
write!(f, "&")?;
|
write!(f, "&")?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12228,6 +12490,24 @@ pub mod structs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
|
pub enum NotifyGetRepoListQuerySubjectType {
|
||||||
|
Issue,
|
||||||
|
Pull,
|
||||||
|
Commit,
|
||||||
|
Repository,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl NotifyGetRepoListQuerySubjectType {
|
||||||
|
fn as_str(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
NotifyGetRepoListQuerySubjectType::Issue => "issue",
|
||||||
|
NotifyGetRepoListQuerySubjectType::Pull => "pull",
|
||||||
|
NotifyGetRepoListQuerySubjectType::Commit => "commit",
|
||||||
|
NotifyGetRepoListQuerySubjectType::Repository => "repository",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
pub struct NotifyReadRepoListQuery {
|
pub struct NotifyReadRepoListQuery {
|
||||||
/// If true, mark all notifications on this repo. Default value is false
|
/// If true, mark all notifications on this repo. Default value is false
|
||||||
///
|
///
|
||||||
|
@ -12277,10 +12557,10 @@ pub mod structs {
|
||||||
pub struct RepoListPullRequestsQuery {
|
pub struct RepoListPullRequestsQuery {
|
||||||
/// State of pull request: open or closed (optional)
|
/// State of pull request: open or closed (optional)
|
||||||
///
|
///
|
||||||
pub state: Option<String>,
|
pub state: Option<RepoListPullRequestsQueryState>,
|
||||||
/// Type of sort
|
/// Type of sort
|
||||||
///
|
///
|
||||||
pub sort: Option<String>,
|
pub sort: Option<RepoListPullRequestsQuerySort>,
|
||||||
/// ID of the milestone
|
/// ID of the milestone
|
||||||
///
|
///
|
||||||
pub milestone: Option<u64>,
|
pub milestone: Option<u64>,
|
||||||
|
@ -12298,10 +12578,10 @@ pub mod structs {
|
||||||
impl std::fmt::Display for RepoListPullRequestsQuery {
|
impl std::fmt::Display for RepoListPullRequestsQuery {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
if let Some(state) = &self.state {
|
if let Some(state) = &self.state {
|
||||||
write!(f, "state={state}&")?;
|
write!(f, "state={}&", state.as_str())?;
|
||||||
}
|
}
|
||||||
if let Some(sort) = &self.sort {
|
if let Some(sort) = &self.sort {
|
||||||
write!(f, "sort={sort}&")?;
|
write!(f, "sort={}&", sort.as_str())?;
|
||||||
}
|
}
|
||||||
if let Some(milestone) = &self.milestone {
|
if let Some(milestone) = &self.milestone {
|
||||||
write!(f, "milestone={milestone}&")?;
|
write!(f, "milestone={milestone}&")?;
|
||||||
|
@ -12326,6 +12606,45 @@ pub mod structs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
|
pub enum RepoListPullRequestsQueryState {
|
||||||
|
Closed,
|
||||||
|
Open,
|
||||||
|
All,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl RepoListPullRequestsQueryState {
|
||||||
|
fn as_str(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
RepoListPullRequestsQueryState::Closed => "closed",
|
||||||
|
RepoListPullRequestsQueryState::Open => "open",
|
||||||
|
RepoListPullRequestsQueryState::All => "all",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
|
pub enum RepoListPullRequestsQuerySort {
|
||||||
|
Oldest,
|
||||||
|
Recentupdate,
|
||||||
|
Leastupdate,
|
||||||
|
Mostcomment,
|
||||||
|
Leastcomment,
|
||||||
|
Priority,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl RepoListPullRequestsQuerySort {
|
||||||
|
fn as_str(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
RepoListPullRequestsQuerySort::Oldest => "oldest",
|
||||||
|
RepoListPullRequestsQuerySort::Recentupdate => "recentupdate",
|
||||||
|
RepoListPullRequestsQuerySort::Leastupdate => "leastupdate",
|
||||||
|
RepoListPullRequestsQuerySort::Mostcomment => "mostcomment",
|
||||||
|
RepoListPullRequestsQuerySort::Leastcomment => "leastcomment",
|
||||||
|
RepoListPullRequestsQuerySort::Priority => "priority",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
pub struct RepoDownloadPullDiffOrPatchQuery {
|
pub struct RepoDownloadPullDiffOrPatchQuery {
|
||||||
/// whether to include binary file changes. if true, the diff is applicable with `git apply`
|
/// whether to include binary file changes. if true, the diff is applicable with `git apply`
|
||||||
///
|
///
|
||||||
|
@ -12382,7 +12701,7 @@ pub mod structs {
|
||||||
pub skip_to: Option<String>,
|
pub skip_to: Option<String>,
|
||||||
/// whitespace behavior
|
/// whitespace behavior
|
||||||
///
|
///
|
||||||
pub whitespace: Option<String>,
|
pub whitespace: Option<RepoGetPullRequestFilesQueryWhitespace>,
|
||||||
/// page number of results to return (1-based)
|
/// page number of results to return (1-based)
|
||||||
///
|
///
|
||||||
pub page: Option<u32>,
|
pub page: Option<u32>,
|
||||||
|
@ -12397,7 +12716,7 @@ pub mod structs {
|
||||||
write!(f, "skip-to={skip_to}&")?;
|
write!(f, "skip-to={skip_to}&")?;
|
||||||
}
|
}
|
||||||
if let Some(whitespace) = &self.whitespace {
|
if let Some(whitespace) = &self.whitespace {
|
||||||
write!(f, "whitespace={whitespace}&")?;
|
write!(f, "whitespace={}&", whitespace.as_str())?;
|
||||||
}
|
}
|
||||||
if let Some(page) = &self.page {
|
if let Some(page) = &self.page {
|
||||||
write!(f, "page={page}&")?;
|
write!(f, "page={page}&")?;
|
||||||
|
@ -12410,6 +12729,24 @@ pub mod structs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
|
pub enum RepoGetPullRequestFilesQueryWhitespace {
|
||||||
|
IgnoreAll,
|
||||||
|
IgnoreChange,
|
||||||
|
IgnoreEol,
|
||||||
|
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",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
pub struct RepoListPullReviewsQuery {
|
pub struct RepoListPullReviewsQuery {
|
||||||
/// page number of results to return (1-based)
|
/// page number of results to return (1-based)
|
||||||
///
|
///
|
||||||
|
@ -12435,19 +12772,33 @@ pub mod structs {
|
||||||
pub struct RepoUpdatePullRequestQuery {
|
pub struct RepoUpdatePullRequestQuery {
|
||||||
/// how to update pull request
|
/// how to update pull request
|
||||||
///
|
///
|
||||||
pub style: Option<String>,
|
pub style: Option<RepoUpdatePullRequestQueryStyle>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Display for RepoUpdatePullRequestQuery {
|
impl std::fmt::Display for RepoUpdatePullRequestQuery {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
if let Some(style) = &self.style {
|
if let Some(style) = &self.style {
|
||||||
write!(f, "style={style}&")?;
|
write!(f, "style={}&", style.as_str())?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
|
pub enum RepoUpdatePullRequestQueryStyle {
|
||||||
|
Merge,
|
||||||
|
Rebase,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl RepoUpdatePullRequestQueryStyle {
|
||||||
|
fn as_str(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
RepoUpdatePullRequestQueryStyle::Merge => "merge",
|
||||||
|
RepoUpdatePullRequestQueryStyle::Rebase => "rebase",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
pub struct RepoListPushMirrorsQuery {
|
pub struct RepoListPushMirrorsQuery {
|
||||||
/// page number of results to return (1-based)
|
/// page number of results to return (1-based)
|
||||||
///
|
///
|
||||||
|
@ -12567,10 +12918,10 @@ pub mod structs {
|
||||||
pub struct RepoListStatusesQuery {
|
pub struct RepoListStatusesQuery {
|
||||||
/// type of sort
|
/// type of sort
|
||||||
///
|
///
|
||||||
pub sort: Option<String>,
|
pub sort: Option<RepoListStatusesQuerySort>,
|
||||||
/// type of state
|
/// type of state
|
||||||
///
|
///
|
||||||
pub state: Option<String>,
|
pub state: Option<RepoListStatusesQueryState>,
|
||||||
/// page number of results to return (1-based)
|
/// page number of results to return (1-based)
|
||||||
///
|
///
|
||||||
pub page: Option<u32>,
|
pub page: Option<u32>,
|
||||||
|
@ -12582,10 +12933,10 @@ pub mod structs {
|
||||||
impl std::fmt::Display for RepoListStatusesQuery {
|
impl std::fmt::Display for RepoListStatusesQuery {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
if let Some(sort) = &self.sort {
|
if let Some(sort) = &self.sort {
|
||||||
write!(f, "sort={sort}&")?;
|
write!(f, "sort={}&", sort.as_str())?;
|
||||||
}
|
}
|
||||||
if let Some(state) = &self.state {
|
if let Some(state) = &self.state {
|
||||||
write!(f, "state={state}&")?;
|
write!(f, "state={}&", state.as_str())?;
|
||||||
}
|
}
|
||||||
if let Some(page) = &self.page {
|
if let Some(page) = &self.page {
|
||||||
write!(f, "page={page}&")?;
|
write!(f, "page={page}&")?;
|
||||||
|
@ -12598,6 +12949,47 @@ pub mod structs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
|
pub enum RepoListStatusesQuerySort {
|
||||||
|
Oldest,
|
||||||
|
Recentupdate,
|
||||||
|
Leastupdate,
|
||||||
|
Leastindex,
|
||||||
|
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, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
|
pub enum RepoListStatusesQueryState {
|
||||||
|
Pending,
|
||||||
|
Success,
|
||||||
|
Error,
|
||||||
|
Failure,
|
||||||
|
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",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
pub struct RepoListSubscribersQuery {
|
pub struct RepoListSubscribersQuery {
|
||||||
/// page number of results to return (1-based)
|
/// page number of results to return (1-based)
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in a new issue