diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index a6e9b751..49bf7528 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -13,6 +13,10 @@ == Unreleased changes (release date TBD) +* Handle arbitrary containment cycles (#300) +* More permissive of valid (if useless) schema constructions (#306, #320) +* Much better handling of `allOf` constructions by merging schemas (#405) + https://github.com/oxidecomputer/typify/compare/v0.0.13\...HEAD[Full list of commits] == 0.0.13 (released 2023-05-14) diff --git a/Cargo.lock b/Cargo.lock index 6b07838b..077bdf90 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -157,6 +157,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" + [[package]] name = "bstr" version = "1.3.0" @@ -182,6 +188,7 @@ dependencies = [ "assert_cmd", "clap", "color-eyre", + "env_logger", "expectorate", "newline-converter", "rustfmt-wrapper", @@ -340,6 +347,40 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +[[package]] +name = "env_logger" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "errno" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "example-build" version = "0.0.0" @@ -424,6 +465,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "hermit-abi" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" + [[package]] name = "home" version = "0.5.3" @@ -433,6 +480,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "iana-time-zone" version = "0.1.56" @@ -481,6 +534,17 @@ dependencies = [ "serde", ] +[[package]] +name = "is-terminal" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +dependencies = [ + "hermit-abi", + "rustix", + "windows-sys 0.48.0", +] + [[package]] name = "itertools" version = "0.10.5" @@ -513,9 +577,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.140" +version = "0.2.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" +checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" + +[[package]] +name = "linux-raw-sys" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128" [[package]] name = "log" @@ -697,7 +767,7 @@ version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -761,6 +831,19 @@ dependencies = [ "toolchain_find", ] +[[package]] +name = "rustix" +version = "0.38.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "747c788e9ce8e92b12cd485c49ddf90723550b654b32508f979b71a7b1ecda4f" +dependencies = [ + "bitflags 2.4.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.48.0", +] + [[package]] name = "ryu" version = "1.0.9" diff --git a/README.md b/README.md index db1fb9f2..ca066a8c 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ Typify compiles JSON Schema documents into Rust types. It can be used in one of several ways: +- using the [`cargo typify`](./cargo-typify/README.md) command + - via the macro `import_types!("types.json")` to generate Rust types directly in your program @@ -11,11 +13,10 @@ several ways: - via the builder functions to generate persistent files e.g. when building API bindings -- using the [`cargo typify`](./cargo-typify/README.md) command - -**If generation fails or is lousy**: Please file an issue and include the JSON -Schema and Rust output (if there is any). Use `cargo typify` command to -generate code from the command-line. +**If generation fails, doesn't compile or is generally lousy**: Please file an +issue and include the JSON Schema and Rust output (if there is any). Use `cargo +typify` command to generate code from the command-line. It's even more helpful +if you can articulate the output you'd ideally like to see. ## JSON Schema → Rust types @@ -56,21 +57,31 @@ simply get the `#[serde(default)]` attribute (so you won't see e.g. ### OneOf -The `OneOf` construct maps to a Rust enum. Typify maps this to the various +The `oneOf` construct maps to a Rust enum. Typify maps this to the various [serde enum types](https://serde.rs/enum-representations.html). -### AnyOf / AllOf +### AllOf -The `anyOf` and `allOf` constructs are a little trickier to handle, but (in -general) Typify models these as structs where each member is decorated with the -`#[serde(flatten)]` attribute (with `Option` wrappers in the case of `anyOf`). +The 'allOf' construct is handled by merging schemas. While most of the time, +typify tries to preserve and share type names, it can't always do this when +merging schemas. You may end up with fields replicated across type; optimizing +this generation is an area of active work. + +### AnyOf + +The `anyOf` construct is much trickier. If can be close to an `enum` (`oneOf`), +but where no particular variant might be canonical or unique for particular +data. While today we (imprecisely) model these as structs with optional, +flattened members, this is one of the weaker areas of code generation. + +Issues describing example schemas and desired output are welcome and helpful. ## Formatting -By default Typify's generated code is not formatted. If formatted code is -preferred, crates like [rustfmt-wrapper](https://docs.rs/rustfmt-wrapper) and -[prettyplease](https://docs.rs/prettyplease) can be used to format the generated -code before writing it to a file. +You can format generated code using crates such as +[rustfmt-wrapper](https://docs.rs/rustfmt-wrapper) and +[prettyplease](https://docs.rs/prettyplease). This can be particularly useful +when checking in code or emitting code from a `build.rs`. The examples below show different ways to convert a `TypeSpace` to a string (`typespace` is a `typify::TypeSpace`). @@ -113,6 +124,12 @@ generated type isn't what you expect, please file an issue. There are some known areas where we'd like to improve: +### Complex JSON Schema types + +JSON schema can express a wide variety of types. Some of them are easy to model +in Rust; others aren't. There's a lot of work to be done to handle esoteric +types. Examples from users are very helpful in this regard. + ### Bounded numbers Bounded numbers aren't very well handled. Consider, for example, the schema: @@ -133,16 +150,4 @@ A string schema with `format` set to `uuid` will result in the `uuid::Uuid` type; similarly, a `format` of `date` translates to `chrono::Date`. For users that don't want dependencies on `uuid` or `chrono` it would be useful for Typify to optionally represent those -as `String` (or as some other, consumer-specified type). - -### Cyclic types - -Typify has special-case handling for self-referential types. For example: - -```rust -struct A { - a: Box, -} -``` - -.. but it does not support more complex cycles such as A -> B -> A. +as `String` (or as some other, consumer-specified type). \ No newline at end of file diff --git a/cargo-typify/Cargo.toml b/cargo-typify/Cargo.toml index b24d2355..a13edf6f 100644 --- a/cargo-typify/Cargo.toml +++ b/cargo-typify/Cargo.toml @@ -16,9 +16,10 @@ typify = { version = "0.0.13", path = "../typify" } clap = { version = "4.4.2", features = ["derive"] } color-eyre = "0.6" +env_logger = "0.10" +rustfmt-wrapper = "0.2.0" serde_json = "1.0.107" schemars = "0.8.13" -rustfmt-wrapper = "0.2.0" [dev-dependencies] assert_cmd = "2.0.12" diff --git a/cargo-typify/src/main.rs b/cargo-typify/src/main.rs index e2ecac7e..85f482a0 100644 --- a/cargo-typify/src/main.rs +++ b/cargo-typify/src/main.rs @@ -1,3 +1,5 @@ +// Copyright 2023 Oxide Computer Company + use cargo_typify::{convert, CliArgs}; use clap::Parser; @@ -11,6 +13,7 @@ enum CargoCli { } fn main() -> Result<()> { + env_logger::init(); color_eyre::install()?; let cli = CargoCli::parse(); diff --git a/typify-impl/src/convert.rs b/typify-impl/src/convert.rs index ca1598ac..df48ed40 100644 --- a/typify-impl/src/convert.rs +++ b/typify-impl/src/convert.rs @@ -2,6 +2,7 @@ use std::collections::BTreeSet; +use crate::merge::{merge_all, merge_with_subschemas}; use crate::type_entry::{ EnumTagType, TypeEntry, TypeEntryDetails, TypeEntryEnum, TypeEntryNewtype, TypeEntryStruct, Variant, VariantDetails, @@ -23,6 +24,11 @@ impl TypeSpace { type_name: Name, schema: &'a Schema, ) -> Result<(TypeEntry, &'a Option>)> { + info!( + "convert_schema {:?} {}", + type_name, + serde_json::to_string_pretty(schema).unwrap() + ); match schema { Schema::Object(obj) => { if let Some(type_entry) = self.cache.lookup(obj) { @@ -327,7 +333,7 @@ impl TypeSpace { SchemaObject { metadata, instance_type: Some(SingleOrVec::Single(single)), - format: None, + format: _, enum_values: None, const_value: None, subschemas: None, @@ -359,6 +365,9 @@ impl TypeSpace { // TODO this could be generalized to validate any redundant // validation here or could be used to compute a new, more // constrained type. + // TODO the strictest interpretation might be to ignore any fields + // that appear alongside "$ref" per + // https://json-schema.org/understanding-json-schema/structuring.html#ref SchemaObject { metadata, instance_type, @@ -461,6 +470,24 @@ impl TypeSpace { _ => todo!("{:#?}", subschemas), }, + // Subschemas with other stuff. + SchemaObject { + subschemas: Some(_), + .. + } => { + let without_subschemas = SchemaObject { + subschemas: None, + ..schema.clone() + }; + let merged_schema = merge_with_subschemas( + without_subschemas, + schema.subschemas.as_deref(), + &self.definitions, + ); + let (type_entry, _) = self.convert_schema(type_name, &merged_schema.into())?; + Ok((type_entry, &None)) + } + // TODO let's not bother with const values at the moment. In the // future we could create types that have a single value with a // newtype wrapper, but it's too much of a mess for too little @@ -633,7 +660,10 @@ impl TypeSpace { } // Unknown - SchemaObject { .. } => todo!("invalid (or unexpected) schema:\n{:#?}", schema), + SchemaObject { .. } => todo!( + "invalid (or unexpected) schema:\n{}", + serde_json::to_string_pretty(schema).unwrap() + ), } } @@ -696,7 +726,6 @@ impl TypeSpace { metadata, )) } - Some("date-time") => { self.uses_chrono = true; Ok(( @@ -729,6 +758,7 @@ impl TypeSpace { ), metadata, )), + Some(unhandled) => { info!("treating a string format '{}' as a String", unhandled); Ok((TypeEntryDetails::String.into(), metadata)) @@ -999,13 +1029,17 @@ impl TypeSpace { && additional_properties.as_ref().map(AsRef::as_ref) != Some(&Schema::Bool(false)) => { - self.make_map( + let type_entry = self.make_map( type_name.into_option(), property_names, additional_properties, - ) + )?; + Ok((type_entry, metadata)) + } + None => { + let type_entry = self.make_map(type_name.into_option(), &None, &None)?; + Ok((type_entry, metadata)) } - None => self.make_map(type_name.into_option(), &None, &None), // The typical case Some(validation) => { @@ -1056,31 +1090,58 @@ impl TypeSpace { return Ok((ty, metadata)); } - if let Some(ty) = self.maybe_all_of_constraints(type_name.clone(), subschemas) { - return Ok((ty, metadata)); - } - - if let Some(ty) = self.maybe_all_of_subclass(type_name.clone(), metadata, subschemas) { - return Ok((ty, metadata)); - } - - // TODO JSON schema is annoying. In particular, "allOf" means that all - // schemas must validate. So for us to construct the schema below, each - // type must actually be "open" i.e. it must permit arbitrary - // properties. If it does not, the schemas would not validate i.e. a - // value (object) could not satisfy both Schema1 and Schema2. To do - // this as accurately as possible, we would need to validate that each - // subschema was "open", pull out the "extra" item from each one, etc. - - // We'll want to build a struct that looks like this: - // struct Name { - // #[serde(flatten)] - // schema1: Schema1Type, - // #[serde(flatten)] - // schema2: Schema2Type, - // ... - // } - self.flattened_union_struct(type_name, metadata, subschemas, false) + // In the general case, we merge all schemas in the array. The merged + // schema will reflect all definitions and constraints. For example, it + // will have the union of all properties for an object, recursively + // merging properties defined in multiple schemas; it will have the + // union of all required object properties; and it will enforce the + // greater of all numeric constraints (e.g. the greater of all + // specified minimum values). + // + // Sometimes merging types will produce a result for which no data is + // valid, the schema is unsatisfiable. Consider this trivial case: + // + // "allOf": [ + // { "type": "integer", "minimum": 5 }, + // { "type": "integer", "maximum": 3 } + // ] + // + // No number is >= 5 *and* <= 3! Good luck with that schema! + // + // Note that we will effectively "embed" any referenced types. Consider + // a construction like this: + // + // "allOf": [ + // { "$ref": "#/definitions/SuperClass" }, + // { "type": "object", "properties": { "another_prop: {} }} + // ] + // + // The resulting merged schema will include all properties of + // "SuperClass" as well as "another_prop" (which we assume to not have + // been present in the original). This is suboptimal in that we would + // like the generated types to reflect some association with the + // original sub-type. + // + // TODO + // In cases where we have a named type, we would like to provide + // conversion methods to extract the named type from the merged type. + // In the "SuperClass" example above, we would provide an + // Into implementation to discard the additional properties + // and produce an instance of "SuperClass". + // + // We can do something similar for types that become additionally + // constrained: a field that becomes required can be converted to an + // optional field; a number whose value is limited can be converted to + // the more expansive numeric type. + + let merged_schema = merge_all(subschemas, &self.definitions); + assert_ne!(merged_schema, Schema::Bool(false)); + let mut merged_schema = merged_schema.into_object(); + assert!(merged_schema.metadata.is_none()); + merged_schema.metadata = metadata.clone(); + + let (type_entry, _) = self.convert_schema(type_name, &merged_schema.into())?; + Ok((type_entry, &None)) } fn convert_any_of<'a>( diff --git a/typify-impl/src/lib.rs b/typify-impl/src/lib.rs index beaa4869..0d09578f 100644 --- a/typify-impl/src/lib.rs +++ b/typify-impl/src/lib.rs @@ -24,10 +24,12 @@ mod convert; mod cycles; mod defaults; mod enums; +mod merge; mod output; mod structs; mod type_entry; mod util; +mod validate; mod value; #[derive(Error, Debug)] @@ -506,6 +508,12 @@ impl TypeSpace { // For types that don't have names, this is effectively a type // alias which we treat as a newtype. _ => { + info!( + "type alias {:?} {}\n{:?}", + type_name, + serde_json::to_string_pretty(&schema).unwrap(), + metadata + ); let subtype_id = self.assign_type(type_entry); TypeEntryNewtype::from_metadata(self, type_name, metadata, subtype_id) } diff --git a/typify-impl/src/merge.rs b/typify-impl/src/merge.rs new file mode 100644 index 00000000..ed86d034 --- /dev/null +++ b/typify-impl/src/merge.rs @@ -0,0 +1,1062 @@ +// Copyright 2023 Oxide Computer Company + +use std::{ + collections::{BTreeMap, BTreeSet}, + iter::repeat, +}; + +use schemars::schema::{ + ArrayValidation, InstanceType, NumberValidation, ObjectValidation, Schema, SchemaObject, + SingleOrVec, StringValidation, SubschemaValidation, +}; + +use crate::{util::ref_key, validate::schema_value_validate, RefKey}; + +/// Merge all schemas in array of schemas. If the result is unsatisfiable, this +/// returns `Schema::Bool(false)`. +pub(crate) fn merge_all(schemas: &[Schema], defs: &BTreeMap) -> Schema { + let mut ss = schemas.iter(); + let (Some(a), Some(b)) = (ss.next(), ss.next()) else { + panic!("merge_all requires at least two schemas") + }; + + let start = merge_schema(a, b, defs); + + ss.fold(start, |schema, other| merge_schema(&schema, other, defs)) +} + +/// Merge two schemas returning the resulting schema. If the two schemas are +/// incompatible (i.e. if there is no data that can satisfy them both +/// simultaneously) then this returns `Schema::Bool(false)`. +fn merge_schema(a: &Schema, b: &Schema, defs: &BTreeMap) -> Schema { + match try_merge_schema(a, b, defs) { + Ok(schema) => schema, + // An error indicates that there is no value that satisfies both + // schemas. + Err(()) => Schema::Bool(false), + } +} + +fn merge_maybe_schema( + a: Option<&Schema>, + b: Option<&Schema>, + defs: &BTreeMap, +) -> Option { + match (a, b) { + (None, other) | (other, None) => other.cloned(), + (Some(aa), Some(bb)) => Some(merge_schema(aa, bb, defs)), + } +} + +fn try_merge_schema(a: &Schema, b: &Schema, defs: &BTreeMap) -> Result { + match (a, b) { + (Schema::Bool(false), _) | (_, Schema::Bool(false)) => Ok(Schema::Bool(false)), + (Schema::Bool(true), other) | (other, Schema::Bool(true)) => Ok(other.clone()), + + // Resolve references here before we start to merge the objects. + // + // TODO: need to mitigate circular references so we don't go into a + // spin loop. We can do this by wrapping defs in a structure that + // remembers what we've already looked up; if we hit a cycle we can + // consider the proper handling, but it might be to ignore it--a + // circular allOf chain is a bit hard to reason about. + // + // TODO if we merge a referenced schema with another schema **and** + // the resulting schema is identical to the referenced schema (i.e. + // the other schema is strictly more permissive) then we should just + // return the reference schema. + ( + Schema::Object(SchemaObject { + reference: Some(ref_name), + .. + }), + other, + ) + | ( + other, + Schema::Object(SchemaObject { + reference: Some(ref_name), + .. + }), + ) => { + let key = ref_key(ref_name); + let resolved = defs.get(&key).unwrap(); + try_merge_schema(resolved, other, defs) + } + + (Schema::Object(aa), Schema::Object(bb)) => merge_schema_object(aa, bb, defs), + } +} + +fn merge_schema_object( + a: &SchemaObject, + b: &SchemaObject, + defs: &BTreeMap, +) -> Result { + assert!(a.reference.is_none()); + assert!(b.reference.is_none()); + + let instance_type = merge_so_instance_type(a.instance_type.as_ref(), b.instance_type.as_ref())?; + let format = merge_so_format(a.format.as_ref(), b.format.as_ref())?; + + let number = merge_so_number(a.number.as_deref(), b.number.as_deref())?; + let string = merge_so_string(a.string.as_deref(), b.string.as_deref())?; + let array = merge_so_array(a.array.as_deref(), b.array.as_deref(), defs)?; + let object = merge_so_object(a.object.as_deref(), b.object.as_deref(), defs)?; + + // We could clean up this schema to eliminate data irrelevant to the + // instance type, but logic in the conversion path should already handle + // that. + let merged_schema = SchemaObject { + metadata: None, + instance_type, + format, + enum_values: None, + const_value: None, + subschemas: None, + number, + string, + array, + object, + reference: None, + extensions: Default::default(), + }; + + // If we have subschemas for either schema then we merge the body of the + // two schemas and then do the appropriate merge with subschemas (i.e. + // potentially twice). This is effectively an `allOf` between the merged + // "body" schema and the component subschemas. + let merged_schema = try_merge_with_subschemas(merged_schema, a.subschemas.as_deref(), defs)?; + let merged_schema = try_merge_with_subschemas(merged_schema, b.subschemas.as_deref(), defs)?; + + assert_ne!(merged_schema, Schema::Bool(false).into_object()); + + let enum_values = merge_so_enum_values( + a.enum_values.as_ref(), + a.const_value.as_ref(), + b.enum_values.as_ref(), + b.const_value.as_ref(), + )?; + + match enum_values { + None => Ok(merged_schema.into()), + Some(enum_values) => { + let enum_values = enum_values + .into_iter() + .filter(|value| { + schema_value_validate(&Schema::Object(merged_schema.clone()), value, defs) + .is_ok() + }) + .collect::>(); + if enum_values.is_empty() { + Err(()) + } else { + Ok(SchemaObject { + enum_values: Some(enum_values), + ..merged_schema + } + .into()) + } + } + } +} + +fn merge_so_enum_values( + a_enum: Option<&Vec>, + a_const: Option<&serde_json::Value>, + b_enum: Option<&Vec>, + b_const: Option<&serde_json::Value>, +) -> Result>, ()> { + let aa = match (a_enum, a_const) { + (None, None) => None, + (Some(enum_values), None) => Some(enum_values.clone()), + (None, Some(value)) => Some(vec![value.clone()]), + (Some(_), Some(_)) => unimplemented!(), + }; + let bb = match (b_enum, b_const) { + (None, None) => None, + (Some(enum_values), None) => Some(enum_values.clone()), + (None, Some(value)) => Some(vec![value.clone()]), + (Some(_), Some(_)) => unimplemented!(), + }; + + match (aa, bb) { + (None, None) => Ok(None), + (None, Some(values)) | (Some(values), None) => Ok(Some(values)), + (Some(aa), Some(bb)) => { + let values = aa + .into_iter() + .filter(|value| bb.contains(value)) + .collect::>(); + + if values.is_empty() { + Err(()) + } else { + Ok(Some(values)) + } + } + } +} + +pub(crate) fn merge_with_subschemas( + schema_object: SchemaObject, + maybe_subschemas: Option<&SubschemaValidation>, + defs: &BTreeMap, +) -> SchemaObject { + try_merge_with_subschemas(schema_object, maybe_subschemas, defs).unwrap() +} + +fn try_merge_with_subschemas( + schema_object: SchemaObject, + maybe_subschemas: Option<&SubschemaValidation>, + defs: &BTreeMap, +) -> Result { + match maybe_subschemas { + Some(SubschemaValidation { + all_of: Some(all_of), + any_of: None, + one_of: None, + not: None, + if_schema: None, + then_schema: None, + else_schema: None, + }) => { + let merged_schema = all_of + .iter() + .try_fold(schema_object.into(), |schema, other| { + try_merge_schema(&schema, other, defs) + })?; + assert_ne!(merged_schema, Schema::Bool(false)); + Ok(merged_schema.into_object()) + } + + Some(SubschemaValidation { + all_of: None, + any_of: Some(subschemas), + one_of: None, + not: None, + if_schema: None, + then_schema: None, + else_schema: None, + }) + | Some(SubschemaValidation { + all_of: None, + any_of: None, + one_of: Some(subschemas), + not: None, + if_schema: None, + then_schema: None, + else_schema: None, + }) => { + // First we do a pairwise merge the schemas; if the result is + // invalid / unresolvable / never / whatever, we exclude it + // from the list. If it is valid, *then* we do the join to preserve + // information (though we probably only need to *that* if at least + // one schema contains a ref). This could probably be an + // opportunity for memoization, but this is an infrequent + // construction so... whatever. + let joined_schemas = Some( + subschemas + .iter() + .filter_map(|other| { + // Skip if the merged schema is unsatisfiable. + let _ = + try_merge_schema(&schema_object.clone().into(), other, defs).ok()?; + Some(join_schema(&schema_object, other)) + }) + .collect(), + ); + + // TODO we'd want to do something special here? maybe return an + // error? + assert!(!subschemas.is_empty()); + + let subschemas = match maybe_subschemas { + Some(SubschemaValidation { + any_of: Some(_), .. + }) => SubschemaValidation { + any_of: joined_schemas, + ..Default::default() + }, + Some(SubschemaValidation { + one_of: Some(_), .. + }) => SubschemaValidation { + one_of: joined_schemas, + ..Default::default() + }, + _ => unreachable!(), + }; + Ok(SchemaObject { + metadata: schema_object.metadata, + subschemas: Some(Box::new(subschemas)), + ..Default::default() + }) + } + + // If it's any of the subschemas we don't know how to handle here, + // we'll try to leave them in place... probably to encounter an error + // later when we try to convert them... + Some(SubschemaValidation { + all_of: None, + any_of: None, + one_of: None, + not, + if_schema, + then_schema, + else_schema, + }) if not.is_some() + || if_schema.is_some() + || then_schema.is_some() + || else_schema.is_some() => + { + if let Some(ss) = &schema_object.subschemas { + assert!(ss.not.is_none()); + assert!(ss.if_schema.is_none()); + assert!(ss.then_schema.is_none()); + assert!(ss.else_schema.is_none()); + } + Ok(SchemaObject { + subschemas: maybe_subschemas.cloned().map(Box::new), + ..schema_object + }) + } + + Some(unknown) => { + todo!("{}", serde_json::to_string_pretty(unknown).unwrap()); + } + None => Ok(schema_object), + } +} + +fn join_schema(a: &SchemaObject, b: &Schema) -> Schema { + SchemaObject { + subschemas: Some(Box::new(SubschemaValidation { + all_of: Some(vec![Schema::Object(a.clone()), b.clone()]), + ..Default::default() + })), + ..Default::default() + } + .into() +} + +/// Merge instance types which could be None (meaning type is valid), a +/// singleton type, or an array of types. An error result indicates that the +/// types were non-overlappin and therefore incompatible. +fn merge_so_instance_type( + a: Option<&SingleOrVec>, + b: Option<&SingleOrVec>, +) -> Result>, ()> { + match (a, b) { + (None, None) => Ok(None), + (None, other @ Some(_)) | (other @ Some(_), None) => Ok(other.map(Clone::clone)), + + // If each has a single type, it must match. + (Some(SingleOrVec::Single(aa)), Some(SingleOrVec::Single(bb))) => { + if aa == bb { + Ok(Some(SingleOrVec::Single(aa.clone()))) + } else { + Err(()) + } + } + + // If one has a single type and the other is an array, the type must + // appear in the array (and that's the resulting type). + (Some(SingleOrVec::Vec(types)), Some(SingleOrVec::Single(it))) + | (Some(SingleOrVec::Single(it)), Some(SingleOrVec::Vec(types))) => { + if types.contains(it) { + Ok(Some(SingleOrVec::Single(it.clone()))) + } else { + Err(()) + } + } + + // If both are arrays, we take the intersection; if the intersection is + // empty, we return an error. + (Some(SingleOrVec::Vec(aa)), Some(SingleOrVec::Vec(bb))) => { + let types = aa + .iter() + .collect::>() + .intersection(&bb.iter().collect::>()) + .cloned() + .cloned() + .collect::>(); + + match types.len() { + // No intersection + 0 => Err(()), + 1 => Ok(Some(types.into_iter().next().unwrap().into())), + _ => Ok(Some(types.into())), + } + } + } +} + +/// By and large, formats are pretty free-form and aren't really compatible +/// with each other. That is to say, if you have two formats at the same time +/// that's probably unsatisfiable. There are a few notable exceptions to this: +/// +/// o integer widths -- take the narrowest +/// o "ip" vs. "ipv4" / "ipv6" -- take the more specific ip flavor +/// +/// TODO incorporate the instance type / types here to limit what formats we +/// consider. +/// TODO We might need to handle this in a very type-specific way in order to +/// properly handle cases such as +/// "int8" and "uint8" -> { min: 0, max: 127, format: None } +fn merge_so_format(a: Option<&String>, b: Option<&String>) -> Result, ()> { + match (a.map(String::as_str), b.map(String::as_str)) { + (None, other) | (other, None) => Ok(other.map(String::from)), + + (Some("ip"), result @ Some("ipv4")) + | (Some("ip"), result @ Some("ipv6")) + | (result @ Some("ipv4"), Some("ip")) + | (result @ Some("ipv6"), Some("ip")) => Ok(result.map(String::from)), + + // Fine if they're both the same + (Some(aa), Some(bb)) if aa == bb => Ok(Some(aa.into())), + // ... they're not the same... + (Some(_), Some(_)) => Err(()), + } +} + +fn merge_so_number( + a: Option<&NumberValidation>, + b: Option<&NumberValidation>, +) -> Result>, ()> { + match (a, b) { + (None, other) | (other, None) => Ok(other.cloned().map(Box::new)), + (Some(_), Some(_)) => { + unimplemented!("this is fairly fussy and I don't want to do it") + } + } +} + +fn merge_so_string( + a: Option<&StringValidation>, + b: Option<&StringValidation>, +) -> Result>, ()> { + match (a, b) { + (None, other) | (other, None) => Ok(other.cloned().map(Box::new)), + (Some(_), Some(_)) => { + unimplemented!("this is fairly fussy and I don't want to do it") + } + } +} + +fn merge_so_array( + a: Option<&ArrayValidation>, + b: Option<&ArrayValidation>, + defs: &BTreeMap, +) -> Result>, ()> { + match (a, b) { + (None, other) | (other, None) => Ok(other.cloned().map(Box::new)), + (Some(aa), Some(bb)) => { + let max_items = choose_value(aa.max_items, bb.max_items, Ord::min); + let min_items = choose_value(aa.min_items, bb.min_items, Ord::max); + let unique_items = + choose_value(aa.unique_items, bb.unique_items, std::ops::BitOr::bitor); + + // We can only contain one thing; we can't resolve the need to + // contain two different things. + let contains = match (aa.contains.as_deref(), bb.contains.as_deref()) { + (None, other) | (other, None) => other.cloned().map(Box::new), + + // We could probably do a more complex "equivalency" check e.g. + // that would follow references. + (Some(aa_contains), Some(bb_contains)) if aa_contains == bb_contains => { + Some(Box::new(aa_contains.clone())) + } + + (Some(_), Some(_)) => return Err(()), + }; + + // If min > max the schema is unsatisfiable. + if let (Some(min), Some(max)) = (min_items, max_items) { + if min > max { + return Err(()); + } + } + + // The items and additional_items fields need to be considered + // together. + // + // - If items is a singleton, additional_items is ignored and all + // items in the array must obey the items schema. + // + // - If items is an array of size N, the Ith < N item must conform + // to the Ith schema. Subsequent items must conform to + // additional_items (so can be whatever if it is None = + // Schema::Bool(true)) + // + // - If items is None (i.e. absent) additional_items is ignored and + // any value is permitted in any position of the array. + // + // Note that if there is a maximum array length specified and the + // items schema array is at least that long, additional_items is + // irrelevant so we omit it. This case appears several times below. + + let (items, additional_items) = match ( + (&aa.items, &aa.additional_items), + (&bb.items, &bb.additional_items), + ) { + // Both items are none; items and additional_items are None. + ((None, _), (None, _)) => (None, None), + + // A None and a single-item; we can use the single item and + // additional_items are irrelevant. + ((None, _), (Some(SingleOrVec::Single(item)), _)) + | ((Some(SingleOrVec::Single(item)), _), (None, _)) => { + (Some(SingleOrVec::Single(item.clone())), None) + } + + // A None and a array of schemas; we can take the array, + // modifying it only in consideration of the maximum length (if + // it is specified). + ((None, _), (Some(SingleOrVec::Vec(items)), additional_items)) + | ((Some(SingleOrVec::Vec(items)), additional_items), (None, _)) => { + match (max_items, items.len()) { + (Some(max), len) if len >= max as usize => ( + Some(SingleOrVec::Vec( + items.iter().take(max as usize).cloned().collect(), + )), + None, + ), + _ => ( + Some(SingleOrVec::Vec(items.clone())), + additional_items.clone(), + ), + } + } + + // Two single schemas, just merge them; additional_items would + // be irrelevant. + ( + (Some(SingleOrVec::Single(aa_single)), _), + (Some(SingleOrVec::Single(bb_single)), _), + ) => ( + Some(SingleOrVec::Single(Box::new(merge_schema( + aa_single, bb_single, defs, + )))), + None, + ), + + // A single item and an array of schemas. We merge the + // singleton with the array and additional_items as needed. + ( + (Some(SingleOrVec::Single(single)), _), + (Some(SingleOrVec::Vec(items)), additional_items), + ) + | ( + (Some(SingleOrVec::Vec(items)), additional_items), + (Some(SingleOrVec::Single(single)), _), + ) => match (max_items, items.len()) { + (Some(max), len) if len >= max as usize => ( + Some(SingleOrVec::Vec( + items + .iter() + .take(max as usize) + .map(|item_schema| merge_schema(item_schema, single, defs)) + .collect(), + )), + None, + ), + _ => { + let items = items + .iter() + .map(|item_schema| merge_schema(item_schema, single, defs)) + .collect(); + let additional_items = additional_items.as_deref().map_or_else( + || single.as_ref().clone(), + |additional_schema| merge_schema(additional_schema, single, defs), + ); + ( + Some(SingleOrVec::Vec(items)), + Some(Box::new(additional_items)), + ) + } + }, + + // We need to pairwise merge schemas--as many as the longer + // of the two items arrays, limited by the max size of the + // array if one is specified. To do this we create + // iterators over the items followed by a repetition of the + // additional_items schema. We zip these together, merge, and + // limit them as appropriate. + ( + (Some(SingleOrVec::Vec(aa_items)), aa_additional_items), + (Some(SingleOrVec::Vec(bb_items)), bb_additional_items), + ) => { + let items_len = aa_items.len().max(bb_items.len()); + + // Note that one of these .chain(repeat(..)) statements is + // always irrelevant because we will always .take(..) a + // quantity less than or equal to the longest of the two + // schema arrays; we just do them both and don't sweat it. + let aa_items_iter = aa_items + .iter() + .map(Some) + .chain(repeat(aa_additional_items.as_deref())); + let bb_items_iter = bb_items + .iter() + .map(Some) + .chain(repeat(bb_additional_items.as_deref())); + let items_iter = + aa_items_iter + .zip(bb_items_iter) + .map(|schemas| match schemas { + (None, None) => unreachable!(), + (None, Some(item)) => item.clone(), + (Some(item), None) => item.clone(), + (Some(aa_item), Some(bb_item)) => { + merge_schema(aa_item, bb_item, defs) + } + }); + + match max_items { + Some(max) if items_len <= max as usize => { + let items = items_iter.take(max as usize).collect(); + (Some(SingleOrVec::Vec(items)), None) + } + + _ => { + let items = items_iter.take(items_len).collect(); + let additional_items = merge_maybe_schema( + aa_additional_items.as_deref(), + bb_additional_items.as_deref(), + defs, + ) + .map(Box::new); + + (Some(SingleOrVec::Vec(items)), additional_items) + } + } + } + }; + + Ok(Some(Box::new(ArrayValidation { + items, + additional_items, + max_items, + min_items, + unique_items, + contains, + }))) + } + } +} + +/// Prefer Some over None and the result of `prefer` if both are Some. +fn choose_value(a: Option, b: Option, prefer: F) -> Option +where + F: FnOnce(T, T) -> T, +{ + match (a, b) { + (None, other) | (other, None) => other, + (Some(aa), Some(bb)) => Some(prefer(aa, bb)), + } +} + +fn merge_so_object( + a: Option<&ObjectValidation>, + b: Option<&ObjectValidation>, + defs: &BTreeMap, +) -> Result>, ()> { + match (a, b) { + (None, other) | (other, None) => Ok(other.cloned().map(Box::new)), + (Some(aa), Some(bb)) => { + let a_props = aa.properties.iter().filter_map(|(name, a_schema)| { + let resolved_schema = if let Some(b_schema) = bb.properties.get(name) { + try_merge_schema(a_schema, b_schema, defs) + } else { + filter_prop(name, a_schema, bb) + }; + + // TODO I'm going to copy/paste this so move it to a + // subroutine. + match resolved_schema { + // If a required field is incompatible with the + // other schema, this object is unsatisfiable. + Err(()) if aa.required.contains(name) => Some(Err(())), + + // We can ignore incompatible, non-required fields. + Err(()) => None, + + // Compatible schema; proceed. + Ok(schema) => Some(Ok((name.clone(), schema))), + } + }); + + let b_props = bb.properties.iter().filter_map(|(name, b_schema)| { + if aa.properties.contains_key(name) { + // We handled the intersection above. + None + } else { + // TODO I'm going to copy/paste this so move it to a + // subroutine. + match filter_prop(name, b_schema, aa) { + // If a required field is incompatible with the + // other schema, this object is unsatisfiable. + Err(()) if bb.required.contains(name) => Some(Err(())), + + // We can ignore incompatible, non-required fields. + Err(()) => None, + + // Compatible schema; proceed. + Ok(schema) => Some(Ok((name.clone(), schema))), + } + } + }); + + let properties = a_props.chain(b_props).collect::>()?; + + let required = aa.required.union(&bb.required).cloned().collect(); + let additional_properties = merge_additional_properties( + aa.additional_properties.as_deref(), + bb.additional_properties.as_deref(), + ); + + let object_validation = ObjectValidation { + required, + properties, + additional_properties, + ..Default::default() + }; + Ok(Some(object_validation.into())) + } + } +} + +// TODO this is starting to feel redundant... +fn merge_additional_properties(a: Option<&Schema>, b: Option<&Schema>) -> Option> { + match (a, b) { + (Some(Schema::Bool(true)), other) + | (None, other) + | (other, Some(Schema::Bool(true))) + | (other, None) => other.cloned().map(Box::new), + + (Some(Schema::Bool(false)), _) | (_, Some(Schema::Bool(false))) => None, + + (Some(aa @ Schema::Object(_)), Some(bb @ Schema::Object(_))) => Some(Box::new( + SchemaObject { + subschemas: Some(Box::new(SubschemaValidation { + // TODO it would be a good idea to merge these now rather than + // deferring that since the schemas might be unresolvable i.e. + // they might have no intersection. However, a non-true/false/ + // absent additionalProperties within an allOf is an uncommon + // pattern so this is likely good enough for the moment. + all_of: Some(vec![aa.clone(), bb.clone()]), + ..Default::default() + })), + ..Default::default() + } + .into(), + )), + } +} + +fn filter_prop( + name: &str, + prop_schema: &Schema, + object_schema: &ObjectValidation, +) -> Result { + // We're only considering properties we *know* do not appear in the other + // object's schema. + assert!(!object_schema.properties.contains_key(name)); + + // TODO We should do a simple check here to validating the name against + // propertyNames if that schema is specified. + assert!(object_schema.property_names.is_none()); + + // TODO We should first check patternProperties, but that's such a pain in + // the neck and so weird that I can't be bothered right now (until we hit + // some examples in the wild). A match here would exempt the property from + // the check below against additionalProperties. + assert!(object_schema.pattern_properties.is_empty()); + + merge_additional(object_schema.additional_properties.as_deref(), prop_schema) +} + +fn merge_additional(additional: Option<&Schema>, prop_schema: &Schema) -> Result { + match additional { + // Anything is fine. + Some(Schema::Bool(true)) | None => Ok(prop_schema.clone()), + // Nothing is fine. + Some(Schema::Bool(false)) => Err(()), + + // Some things might be fine. + Some(additional_schema) => Ok(SchemaObject { + subschemas: Some(Box::new(SubschemaValidation { + // TODO it would be a good idea to merge these now rather than + // deferring that since the schemas might be unresolvable i.e. + // they might have no intersection. However, a non-true/false/ + // absent additionalProperties within an allOf is an uncommon + // pattern so this is likely good enough for the moment. + all_of: Some(vec![additional_schema.clone(), prop_schema.clone()]), + ..Default::default() + })), + ..Default::default() + } + .into()), + } +} + +#[cfg(test)] +mod tests { + use std::collections::BTreeMap; + + use schemars::schema::InstanceType; + use serde_json::json; + + use crate::merge::merge_so_instance_type; + + use super::try_merge_schema; + #[test] + fn test_simple_merge() { + let a = json!({ + "type": "object", + "properties": { + "result": { + "type": "string" + } + } + }); + let b = json!({ + "required": ["result", "msg"], + "properties": { + "result": { + "enum": ["success"] + }, + "msg": { + "type": "string" + } + } + }); + let ab = json!({ + "type": "object", + "required": ["result", "msg"], + "properties": { + "result": { + "type": "string", + "enum": ["success"] + }, + "msg": { + "type": "string" + } + } + }); + + let a = serde_json::from_value(a).unwrap(); + let b = serde_json::from_value(b).unwrap(); + let ab = serde_json::from_value(ab).unwrap(); + + let merged = try_merge_schema(&a, &b, &BTreeMap::default()).unwrap(); + + println!("{}", serde_json::to_string_pretty(&merged).unwrap()); + + assert_eq!(merged, ab); + } + + #[test] + fn test_nop_merge() { + let a = json!({ + "type": "object", + "required": [ + "avatar_url", + "events_url", + "followers_url", + "following_url", + "gists_url", + "gravatar_id", + "html_url", + "id", + "login", + "node_id", + "organizations_url", + "received_events_url", + "repos_url", + "site_admin", + "starred_url", + "subscriptions_url", + "type", + "url" + ], + "properties": { + "avatar_url": { + "type": "string", + "format": "uri" + }, + "email": { + "type": [ + "string", + "null" + ] + }, + "events_url": { + "type": "string", + "format": "uri-template" + }, + "followers_url": { + "type": "string", + "format": "uri" + }, + "following_url": { + "type": "string", + "format": "uri-template" + }, + "gists_url": { + "type": "string", + "format": "uri-template" + }, + "gravatar_id": { + "type": "string" + }, + "html_url": { + "type": "string", + "format": "uri" + }, + "id": { + "type": "integer" + }, + "login": { + "type": "string" + }, + "name": { + "type": "string" + }, + "node_id": { + "type": "string" + }, + "organizations_url": { + "type": "string", + "format": "uri" + }, + "received_events_url": { + "type": "string", + "format": "uri" + }, + "repos_url": { + "type": "string", + "format": "uri" + }, + "site_admin": { + "type": "boolean" + }, + "starred_url": { + "type": "string", + "format": "uri-template" + }, + "subscriptions_url": { + "type": "string", + "format": "uri" + }, + "type": { + "type": "string", + "enum": [ + "Bot", + "User", + "Organization" + ] + }, + "url": { + "type": "string", + "format": "uri" + } + }, + "additionalProperties": false + } + + ); + let b = json!({}); + + let a = serde_json::from_value(a).unwrap(); + let b = serde_json::from_value(b).unwrap(); + + let merged = try_merge_schema(&a, &b, &BTreeMap::default()).unwrap(); + + println!("{}", serde_json::to_string_pretty(&merged).unwrap()); + + assert_eq!(merged, a); + } + + #[test] + fn test_merge_instance_types() { + // Simple cases + assert_eq!(merge_so_instance_type(None, None), Ok(None)); + + assert_eq!( + merge_so_instance_type(None, Some(&InstanceType::Integer.into())), + Ok(Some(InstanceType::Integer.into())), + ); + assert_eq!( + merge_so_instance_type(Some(&InstanceType::Null.into()), None), + Ok(Some(InstanceType::Null.into())), + ); + + // Containment + assert_eq!( + merge_so_instance_type( + Some(&vec![InstanceType::Integer, InstanceType::Number].into()), + Some(&InstanceType::Integer.into()) + ), + Ok(Some(InstanceType::Integer.into())), + ); + assert_eq!( + merge_so_instance_type( + Some(&vec![InstanceType::Integer, InstanceType::Number].into()), + Some(&InstanceType::Null.into()) + ), + Err(()), + ); + assert_eq!( + merge_so_instance_type( + Some(&vec![InstanceType::Integer, InstanceType::Number].into()), + Some(&vec![InstanceType::Integer, InstanceType::Null].into()), + ), + Ok(Some(InstanceType::Integer.into())), + ); + assert_eq!( + merge_so_instance_type( + Some( + &vec![ + InstanceType::Object, + InstanceType::Integer, + InstanceType::Number + ] + .into() + ), + Some( + &vec![ + InstanceType::Object, + InstanceType::Integer, + InstanceType::Null + ] + .into() + ), + ), + Ok(Some( + vec![InstanceType::Object, InstanceType::Integer,].into() + )), + ); + assert_eq!( + merge_so_instance_type( + Some( + &vec![ + InstanceType::Object, + InstanceType::Integer, + InstanceType::Number + ] + .into() + ), + Some( + &vec![ + InstanceType::Array, + InstanceType::Boolean, + InstanceType::Null + ] + .into() + ), + ), + Err(()), + ); + } +} diff --git a/typify-impl/src/structs.rs b/typify-impl/src/structs.rs index 4de1065c..b5314d01 100644 --- a/typify-impl/src/structs.rs +++ b/typify-impl/src/structs.rs @@ -3,9 +3,7 @@ use heck::ToSnakeCase; use proc_macro2::TokenStream; use quote::quote; -use schemars::schema::{ - InstanceType, Metadata, ObjectValidation, Schema, SchemaObject, SingleOrVec, -}; +use schemars::schema::{InstanceType, Metadata, ObjectValidation, Schema, SchemaObject}; use crate::{ output::{OutputSpace, OutputSpaceMod}, @@ -13,7 +11,7 @@ use crate::{ StructProperty, StructPropertyRename, StructPropertyState, TypeEntry, TypeEntryStruct, WrappedValue, }, - util::{get_object_ref, get_type_name, metadata_description, recase, schema_is_named, Case}, + util::{get_type_name, metadata_description, recase, Case}, Name, Result, TypeEntryDetails, TypeId, TypeSpace, }; @@ -78,6 +76,7 @@ impl TypeSpace { { false } + None => false, // Only particular additional properties are allowed. Note that @@ -86,7 +85,7 @@ impl TypeSpace { // quite right. additional_properties @ Some(_) => { let sub_type_name = type_name.as_ref().map(|base| format!("{}_extra", base)); - let (map_type, _) = self.make_map( + let map_type = self.make_map( sub_type_name, &validation.property_names, additional_properties, @@ -171,12 +170,12 @@ impl TypeSpace { }) } - pub(crate) fn make_map<'a>( + pub(crate) fn make_map( &mut self, type_name: Option, property_names: &Option>, additional_properties: &Option>, - ) -> Result<(TypeEntry, &'a Option>)> { + ) -> Result { let key_id = match property_names.as_deref() { Some(Schema::Bool(true)) | None => self.assign_type(TypeEntryDetails::String.into()), @@ -205,7 +204,7 @@ impl TypeSpace { None => self.id_for_schema(Name::Unknown, &Schema::Bool(true))?, }; - Ok((TypeEntryDetails::Map(key_id, value_id).into(), &None)) + Ok(TypeEntryDetails::Map(key_id, value_id).into()) } /// Perform a schema conversion for a type that must be string-like. @@ -298,194 +297,6 @@ impl TypeSpace { metadata, )) } - - /// This handles the case where an allOf is used to effect inheritance: the - /// subschemas consist of one or more "super classes" that have names with - /// a final, anonymous object. - /// - /// ```text - /// "allOf": [ - /// { "$ref": "#/definitions/SuperClass" }, - /// { "type": "object", "properties": { "prop_a": .., "prop_b": .. }} - /// ] - /// ``` - /// - /// This turns into a struct of this form: - /// ```compile_fail - /// struct MyType { - /// #[serde(flatten)] - /// super_class: SuperClass, - /// prop_a: (), - /// prop_b: (), - /// } - /// ``` - /// - /// Note that the super class member names are derived from the type and - /// are flattened into the struct; the subclass properties are simply - /// included alongside. - pub(crate) fn maybe_all_of_subclass( - &mut self, - type_name: Name, - metadata: &Option>, - subschemas: &[Schema], - ) -> Option { - assert!(subschemas.len() > 1); - - // Split the subschemas into named (superclass) and unnamed (subclass) - // schemas. - let mut named = Vec::new(); - let mut unnamed = Vec::new(); - for schema in subschemas { - match schema_is_named(schema) { - Some(name) => named.push((schema, name)), - None => unnamed.push(schema), - } - } - - // We required exactly one unnamed subschema for this special case. - // Note that zero unnamed subschemas would be trivial to handle, but - // the generic case already does so albeit slightly differently. - if unnamed.len() != 1 { - return None; - } - - // Get the object validation (or fail to match this special case). - let unnamed_schema = unnamed.first()?; - let validation = match unnamed_schema { - Schema::Object(SchemaObject { - metadata: _, - instance_type: Some(SingleOrVec::Single(single)), - format: None, - enum_values: None, - const_value: None, - subschemas: None, - number: None, - string: None, - array: None, - object: Some(validation), - reference: None, - extensions: _, - }) if single.as_ref() == &InstanceType::Object => Some(validation), - _ => None, - }?; - let tmp_type_name = get_type_name(&type_name, metadata); - let (unnamed_properties, _) = self.struct_members(tmp_type_name, validation).ok()?; - - let named_properties = named - .iter() - .map(|(schema, property_name)| { - let (type_id, metadata) = self.id_for_schema(type_name.clone(), schema)?; - let (name, _) = recase(property_name, Case::Snake); - let name = if validation.properties.contains_key(&name) { - format!("{}__", name) - } else { - name - }; - Ok(StructProperty { - name, - rename: StructPropertyRename::Flatten, - state: StructPropertyState::Required, - description: metadata_description(metadata), - type_id, - }) - }) - .collect::>>() - .ok()?; - - Some(TypeEntryStruct::from_metadata( - self, - type_name, - metadata, - named_properties - .into_iter() - .chain(unnamed_properties.into_iter()) - .collect(), - // Note that #[serde(deny_unknown_fields)] is incompatible with - // #[serde(flatten)] which we use for the superclass(es). - false, - )) - } - - /// This handles the case where an allOf is used to denote constraints. - /// Currently we just look for a referenced type, which may be "closed" - /// (i.e. no unknown fields permitted) and an explicit type. The latter - /// must be a subset of the former and compatible from the perspective of - /// JSON Schema validation (that is to say, it must be "open" or must fully - /// cover the named type). - /// - /// ```text - /// "allOf": [ - /// { "$ref": "#/definitions/SomeType" }, - /// { "type": "object", "properties": { "prop_a": .., "prop_b": .. }} - /// ] - /// ``` - /// - /// Types such as these should be treated as the named type along with - /// constraints. What do we do to enforce these constraints or communicate - /// them to the consumer? Nothing! - /// - /// What could we do? We could add a custom `serialize_with` / - /// `deserialize_with` functions to validate the constrains in and out. - /// Or we could introduce a newtype wrapper to enforce those constraints. - pub(crate) fn maybe_all_of_constraints( - &mut self, - type_name: Name, - subschemas: &[Schema], - ) -> Option { - assert!(subschemas.len() > 1); - - // Split the subschemas into named (superclass) and unnamed (subclass) - // schemas. - let mut named = Vec::new(); - let mut unnamed = Vec::new(); - for schema in subschemas { - // TODO this might not be quite right since this will be true for - // schemas that have a title; we may want to look only for types - // with a mandatory name. Types with a title (optional name) are - // reasonable to inline generally. - match schema_is_named(schema) { - Some(name) => named.push((schema, name)), - None => unnamed.push(schema), - } - } - - // We required exactly one named subschema and at least one unnamed - // subschema. - if named.len() != 1 || unnamed.is_empty() { - return None; - } - - let (named_schema, _) = named.first()?; - let validation = get_object_ref(named_schema, &self.definitions)?; - - // We need all unnamed schemas to be a subset of the named schema. - if !unnamed - .into_iter() - .all(|constraint_schema| is_obj_subset(validation, constraint_schema)) - { - return None; - } - - let (type_entry, _) = self.convert_schema(type_name, named_schema).ok()?; - Some(type_entry) - } -} - -fn is_obj_subset(validation: &ObjectValidation, constraint_schema: &Schema) -> bool { - if let Schema::Object(SchemaObject { - object: Some(obj), .. - }) = constraint_schema - { - // TODO there's a lot more we could do to determine whether this is a - // subset including inspection of the property types and confirming - // that either all properties are covered or that the constraint object - // is "open". - obj.properties - .keys() - .all(|key| validation.properties.contains_key(key)) - } else { - false - } } pub(crate) enum DefaultFunction { diff --git a/typify-impl/src/util.rs b/typify-impl/src/util.rs index a306c44b..b7d0f7ec 100644 --- a/typify-impl/src/util.rs +++ b/typify-impl/src/util.rs @@ -1,6 +1,6 @@ -// Copyright 2022 Oxide Computer Company +// Copyright 2023 Oxide Computer Company -use std::collections::{BTreeMap, BTreeSet, HashSet}; +use std::collections::{BTreeSet, HashSet}; use schemars::schema::{ ArrayValidation, InstanceType, Metadata, ObjectValidation, Schema, SchemaObject, SingleOrVec, @@ -324,6 +324,11 @@ fn object_schemas_mutually_exclusive( .. } = b_validation; + // No properties? Too permissive / insufficiently exclusive. + if a_properties.is_empty() || b_properties.is_empty() { + return false; + } + // Either set of required properties must not be a subset of the other's // properties i.e. if there's a property that *must* be in one of the two // objects, and *cannot* be in the other, a property whose presence or @@ -340,7 +345,10 @@ fn object_schemas_mutually_exclusive( // the value of the tag property will be unique. // Compute the set that consists of fixed-value properties--a - // tuple of the property name and the value. + // tuple of the property name and the fixed value. Note that we may + // encounter objects that specify that a field is required, but do + // *not* specify the field. That's ok, but we can't assure mutual + // exclusivity. let aa = a_required .iter() .filter_map(|name| { @@ -641,78 +649,6 @@ pub(crate) fn get_object(schema: &Schema) -> Option<(&Option>, &Ob } } -/// Return the object data or None if it's not an object (or doesn't conform to -/// the objects we know how to handle). Follow references if we find them. -pub(crate) fn get_object_ref<'a>( - schema: &'a Schema, - definitions: &'a BTreeMap, -) -> Option<&'a ObjectValidation> { - match schema { - // Objects - Schema::Object(SchemaObject { - metadata: _, - instance_type: Some(SingleOrVec::Single(single)), - format: None, - enum_values: None, - const_value: None, - subschemas: None, - number: None, - string: None, - array: None, - object: Some(validation), - reference: None, - extensions: _, - }) if single.as_ref() == &InstanceType::Object - && schema_none_or_false(&validation.additional_properties) - && validation.max_properties.is_none() - && validation.min_properties.is_none() - && validation.pattern_properties.is_empty() - && validation.property_names.is_none() => - { - Some(validation.as_ref()) - } - - // References - Schema::Object(SchemaObject { - metadata: None, - instance_type: None, - format: None, - enum_values: None, - const_value: None, - subschemas: None, - number: None, - string: None, - array: None, - object: None, - reference: Some(ref_name), - extensions: _, - }) => { - let ref_key = ref_key(ref_name); - get_object_ref(definitions.get(&ref_key).unwrap(), definitions) - } - - // Trivial (n == 1) subschemas - Schema::Object(SchemaObject { - metadata: _, - instance_type: _, - format: None, - enum_values: None, - const_value: None, - subschemas: Some(subschemas), - number: None, - string: None, - array: None, - object: None, - reference: None, - extensions: _, - }) => singleton_subschema(subschemas) - .and_then(|sub_schema| get_object_ref(sub_schema, definitions)), - - // None if the schema doesn't match the shape we expect. - _ => None, - } -} - // We infer from a Some(Schema::Bool(false)) or None value that either nothing // or nothing of importance is in the additional properties. fn schema_none_or_false(additional_properties: &Option>) -> bool { @@ -977,27 +913,6 @@ mod tests { assert!(schemas_mutually_exclusive(&b, &a)); } - #[test] - fn test_exclusive_one_empty_struct() { - #![allow(dead_code)] - - #[derive(JsonSchema)] - struct A {} - - #[derive(JsonSchema)] - struct B { - a: (), - b: Option<()>, - bb: (), - } - - let a = schema_for!(A).schema.into(); - let b = schema_for!(B).schema.into(); - - assert!(schemas_mutually_exclusive(&a, &b)); - assert!(schemas_mutually_exclusive(&b, &a)); - } - #[test] fn test_exclusive_simple_arrays() { let a = schema_for!(Vec).schema.into(); diff --git a/typify-impl/src/validate.rs b/typify-impl/src/validate.rs new file mode 100644 index 00000000..9d513651 --- /dev/null +++ b/typify-impl/src/validate.rs @@ -0,0 +1,82 @@ +// Copyright 2023 Oxide Computer Company + +use std::collections::BTreeMap; + +use schemars::schema::{InstanceType, Schema, SchemaObject, SingleOrVec}; +use serde_json::Value; + +use crate::RefKey; + +pub(crate) fn schema_value_validate( + schema: &Schema, + value: &Value, + defs: &BTreeMap, +) -> Result<(), String> { + match schema { + Schema::Bool(false) => Err("never schema".to_string()), + Schema::Bool(true) => Ok(()), + Schema::Object(object) => schema_object_value_validate(object, value, defs), + } +} + +fn schema_object_value_validate( + object: &SchemaObject, + value: &Value, + _defs: &BTreeMap, +) -> Result<(), String> { + assert!(object.enum_values.is_none()); + assert!(object.const_value.is_none()); + + let SchemaObject { instance_type, .. } = object; + + schema_object_value_validate_instance_type(instance_type.as_ref(), value)?; + + Ok(()) +} + +fn schema_object_value_validate_instance_type( + instance_type: Option<&SingleOrVec>, + value: &Value, +) -> Result<(), String> { + match instance_type { + None => Ok(()), + Some(SingleOrVec::Single(it)) => check_instance(it, value), + Some(SingleOrVec::Vec(its)) => its + .iter() + .any(|it| check_instance(it, value).is_ok()) + .then_some(()) + .ok_or_else(|| "no valid instance type".to_string()), + } +} + +fn check_instance(it: &InstanceType, value: &Value) -> Result<(), String> { + match it { + InstanceType::Null => value + .is_null() + .then_some(()) + .ok_or_else(|| "not null".to_string()), + InstanceType::Boolean => value + .is_boolean() + .then_some(()) + .ok_or_else(|| "not boolean".to_string()), + InstanceType::Object => value + .is_object() + .then_some(()) + .ok_or_else(|| "not object".to_string()), + InstanceType::Array => value + .is_array() + .then_some(()) + .ok_or_else(|| "not array".to_string()), + InstanceType::Number => value + .is_number() + .then_some(()) + .ok_or_else(|| "not number".to_string()), + InstanceType::String => value + .is_string() + .then_some(()) + .ok_or_else(|| "not string".to_string()), + InstanceType::Integer => (value.is_i64() || value.is_u64()) + .then_some(()) + .ok_or_else(|| "not integer".to_string()), + } +} diff --git a/typify-impl/tests/github.out b/typify-impl/tests/github.out index 5a5c1e93..cab7c19c 100644 --- a/typify-impl/tests/github.out +++ b/typify-impl/tests/github.out @@ -5670,7 +5670,7 @@ pub struct CodeScanningAlertClosedByUserAlert { pub dismissed_reason: Option, #[doc = "The GitHub URL of the alert resource."] pub html_url: String, - pub instances: Vec, + pub instances: Vec, #[serde(default, skip_serializing_if = "Option::is_none")] pub most_recent_instance: Option, #[doc = "The code scanning alert number."] @@ -5743,6 +5743,113 @@ impl std::convert::TryFrom for CodeScanningAlertClosedByUserAlertDismiss } #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] +pub struct CodeScanningAlertClosedByUserAlertInstancesItem { + #[doc = "Identifies the configuration under which the analysis was executed. For example, in GitHub Actions this includes the workflow filename and job name."] + pub analysis_key: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub classifications: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub commit_sha: Option, + #[doc = "Identifies the variable values associated with the environment in which the analysis that generated this alert instance was performed, such as the language that was analyzed."] + pub environment: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The full Git reference, formatted as `refs/heads/`."] + #[serde(rename = "ref")] + pub ref_: String, + pub state: CodeScanningAlertClosedByUserAlertInstancesItemState, +} +impl From<&CodeScanningAlertClosedByUserAlertInstancesItem> + for CodeScanningAlertClosedByUserAlertInstancesItem +{ + fn from(value: &CodeScanningAlertClosedByUserAlertInstancesItem) -> Self { + value.clone() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct CodeScanningAlertClosedByUserAlertInstancesItemLocation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub end_column: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub end_line: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub start_column: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub start_line: Option, +} +impl From<&CodeScanningAlertClosedByUserAlertInstancesItemLocation> + for CodeScanningAlertClosedByUserAlertInstancesItemLocation +{ + fn from(value: &CodeScanningAlertClosedByUserAlertInstancesItemLocation) -> Self { + value.clone() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct CodeScanningAlertClosedByUserAlertInstancesItemMessage { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub text: Option, +} +impl From<&CodeScanningAlertClosedByUserAlertInstancesItemMessage> + for CodeScanningAlertClosedByUserAlertInstancesItemMessage +{ + fn from(value: &CodeScanningAlertClosedByUserAlertInstancesItemMessage) -> Self { + value.clone() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum CodeScanningAlertClosedByUserAlertInstancesItemState { + #[serde(rename = "dismissed")] + Dismissed, +} +impl From<&CodeScanningAlertClosedByUserAlertInstancesItemState> + for CodeScanningAlertClosedByUserAlertInstancesItemState +{ + fn from(value: &CodeScanningAlertClosedByUserAlertInstancesItemState) -> Self { + value.clone() + } +} +impl ToString for CodeScanningAlertClosedByUserAlertInstancesItemState { + fn to_string(&self) -> String { + match *self { + Self::Dismissed => "dismissed".to_string(), + } + } +} +impl std::str::FromStr for CodeScanningAlertClosedByUserAlertInstancesItemState { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "dismissed" => Ok(Self::Dismissed), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for CodeScanningAlertClosedByUserAlertInstancesItemState { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for CodeScanningAlertClosedByUserAlertInstancesItemState { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for CodeScanningAlertClosedByUserAlertInstancesItemState { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] pub struct CodeScanningAlertClosedByUserAlertRule { #[doc = "A short description of the rule used to detect the alert."] pub description: String, @@ -5962,7 +6069,7 @@ pub struct CodeScanningAlertCreatedAlert { pub dismissed_reason: (), #[doc = "The GitHub URL of the alert resource."] pub html_url: String, - pub instances: Vec, + pub instances: Vec, #[serde(default, skip_serializing_if = "Option::is_none")] pub most_recent_instance: Option, #[doc = "The code scanning alert number."] @@ -5980,6 +6087,117 @@ impl From<&CodeScanningAlertCreatedAlert> for CodeScanningAlertCreatedAlert { } #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] +pub struct CodeScanningAlertCreatedAlertInstancesItem { + #[doc = "Identifies the configuration under which the analysis was executed. For example, in GitHub Actions this includes the workflow filename and job name."] + pub analysis_key: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub classifications: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub commit_sha: Option, + #[doc = "Identifies the variable values associated with the environment in which the analysis that generated this alert instance was performed, such as the language that was analyzed."] + pub environment: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The full Git reference, formatted as `refs/heads/`."] + #[serde(rename = "ref")] + pub ref_: String, + pub state: CodeScanningAlertCreatedAlertInstancesItemState, +} +impl From<&CodeScanningAlertCreatedAlertInstancesItem> + for CodeScanningAlertCreatedAlertInstancesItem +{ + fn from(value: &CodeScanningAlertCreatedAlertInstancesItem) -> Self { + value.clone() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct CodeScanningAlertCreatedAlertInstancesItemLocation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub end_column: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub end_line: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub start_column: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub start_line: Option, +} +impl From<&CodeScanningAlertCreatedAlertInstancesItemLocation> + for CodeScanningAlertCreatedAlertInstancesItemLocation +{ + fn from(value: &CodeScanningAlertCreatedAlertInstancesItemLocation) -> Self { + value.clone() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct CodeScanningAlertCreatedAlertInstancesItemMessage { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub text: Option, +} +impl From<&CodeScanningAlertCreatedAlertInstancesItemMessage> + for CodeScanningAlertCreatedAlertInstancesItemMessage +{ + fn from(value: &CodeScanningAlertCreatedAlertInstancesItemMessage) -> Self { + value.clone() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum CodeScanningAlertCreatedAlertInstancesItemState { + #[serde(rename = "open")] + Open, + #[serde(rename = "dismissed")] + Dismissed, +} +impl From<&CodeScanningAlertCreatedAlertInstancesItemState> + for CodeScanningAlertCreatedAlertInstancesItemState +{ + fn from(value: &CodeScanningAlertCreatedAlertInstancesItemState) -> Self { + value.clone() + } +} +impl ToString for CodeScanningAlertCreatedAlertInstancesItemState { + fn to_string(&self) -> String { + match *self { + Self::Open => "open".to_string(), + Self::Dismissed => "dismissed".to_string(), + } + } +} +impl std::str::FromStr for CodeScanningAlertCreatedAlertInstancesItemState { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "open" => Ok(Self::Open), + "dismissed" => Ok(Self::Dismissed), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for CodeScanningAlertCreatedAlertInstancesItemState { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for CodeScanningAlertCreatedAlertInstancesItemState { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for CodeScanningAlertCreatedAlertInstancesItemState { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] pub struct CodeScanningAlertCreatedAlertRule { #[doc = "A short description of the rule used to detect the alert."] pub description: String, @@ -6248,7 +6466,7 @@ pub struct CodeScanningAlertFixedAlert { pub dismissed_reason: Option, #[doc = "The GitHub URL of the alert resource."] pub html_url: String, - pub instances: Vec, + pub instances: Vec, #[serde(default, skip_serializing_if = "Option::is_none")] pub instances_url: Option, #[serde(default, skip_serializing_if = "Option::is_none")] @@ -6323,6 +6541,111 @@ impl std::convert::TryFrom for CodeScanningAlertFixedAlertDismissedReaso } #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] +pub struct CodeScanningAlertFixedAlertInstancesItem { + #[doc = "Identifies the configuration under which the analysis was executed. For example, in GitHub Actions this includes the workflow filename and job name."] + pub analysis_key: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub classifications: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub commit_sha: Option, + #[doc = "Identifies the variable values associated with the environment in which the analysis that generated this alert instance was performed, such as the language that was analyzed."] + pub environment: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The full Git reference, formatted as `refs/heads/`."] + #[serde(rename = "ref")] + pub ref_: String, + pub state: CodeScanningAlertFixedAlertInstancesItemState, +} +impl From<&CodeScanningAlertFixedAlertInstancesItem> for CodeScanningAlertFixedAlertInstancesItem { + fn from(value: &CodeScanningAlertFixedAlertInstancesItem) -> Self { + value.clone() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct CodeScanningAlertFixedAlertInstancesItemLocation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub end_column: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub end_line: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub start_column: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub start_line: Option, +} +impl From<&CodeScanningAlertFixedAlertInstancesItemLocation> + for CodeScanningAlertFixedAlertInstancesItemLocation +{ + fn from(value: &CodeScanningAlertFixedAlertInstancesItemLocation) -> Self { + value.clone() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct CodeScanningAlertFixedAlertInstancesItemMessage { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub text: Option, +} +impl From<&CodeScanningAlertFixedAlertInstancesItemMessage> + for CodeScanningAlertFixedAlertInstancesItemMessage +{ + fn from(value: &CodeScanningAlertFixedAlertInstancesItemMessage) -> Self { + value.clone() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum CodeScanningAlertFixedAlertInstancesItemState { + #[serde(rename = "fixed")] + Fixed, +} +impl From<&CodeScanningAlertFixedAlertInstancesItemState> + for CodeScanningAlertFixedAlertInstancesItemState +{ + fn from(value: &CodeScanningAlertFixedAlertInstancesItemState) -> Self { + value.clone() + } +} +impl ToString for CodeScanningAlertFixedAlertInstancesItemState { + fn to_string(&self) -> String { + match *self { + Self::Fixed => "fixed".to_string(), + } + } +} +impl std::str::FromStr for CodeScanningAlertFixedAlertInstancesItemState { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "fixed" => Ok(Self::Fixed), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for CodeScanningAlertFixedAlertInstancesItemState { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for CodeScanningAlertFixedAlertInstancesItemState { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for CodeScanningAlertFixedAlertInstancesItemState { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] pub struct CodeScanningAlertFixedAlertRule { #[doc = "A short description of the rule used to detect the alert."] pub description: String, @@ -6540,7 +6863,7 @@ pub struct CodeScanningAlertReopenedAlert { pub dismissed_reason: (), #[doc = "The GitHub URL of the alert resource."] pub html_url: String, - pub instances: Vec, + pub instances: Vec, #[serde(default, skip_serializing_if = "Option::is_none")] pub most_recent_instance: Option, #[doc = "The code scanning alert number."] @@ -6558,6 +6881,113 @@ impl From<&CodeScanningAlertReopenedAlert> for CodeScanningAlertReopenedAlert { } #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] +pub struct CodeScanningAlertReopenedAlertInstancesItem { + #[doc = "Identifies the configuration under which the analysis was executed. For example, in GitHub Actions this includes the workflow filename and job name."] + pub analysis_key: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub classifications: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub commit_sha: Option, + #[doc = "Identifies the variable values associated with the environment in which the analysis that generated this alert instance was performed, such as the language that was analyzed."] + pub environment: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The full Git reference, formatted as `refs/heads/`."] + #[serde(rename = "ref")] + pub ref_: String, + pub state: CodeScanningAlertReopenedAlertInstancesItemState, +} +impl From<&CodeScanningAlertReopenedAlertInstancesItem> + for CodeScanningAlertReopenedAlertInstancesItem +{ + fn from(value: &CodeScanningAlertReopenedAlertInstancesItem) -> Self { + value.clone() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct CodeScanningAlertReopenedAlertInstancesItemLocation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub end_column: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub end_line: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub start_column: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub start_line: Option, +} +impl From<&CodeScanningAlertReopenedAlertInstancesItemLocation> + for CodeScanningAlertReopenedAlertInstancesItemLocation +{ + fn from(value: &CodeScanningAlertReopenedAlertInstancesItemLocation) -> Self { + value.clone() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct CodeScanningAlertReopenedAlertInstancesItemMessage { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub text: Option, +} +impl From<&CodeScanningAlertReopenedAlertInstancesItemMessage> + for CodeScanningAlertReopenedAlertInstancesItemMessage +{ + fn from(value: &CodeScanningAlertReopenedAlertInstancesItemMessage) -> Self { + value.clone() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum CodeScanningAlertReopenedAlertInstancesItemState { + #[serde(rename = "open")] + Open, +} +impl From<&CodeScanningAlertReopenedAlertInstancesItemState> + for CodeScanningAlertReopenedAlertInstancesItemState +{ + fn from(value: &CodeScanningAlertReopenedAlertInstancesItemState) -> Self { + value.clone() + } +} +impl ToString for CodeScanningAlertReopenedAlertInstancesItemState { + fn to_string(&self) -> String { + match *self { + Self::Open => "open".to_string(), + } + } +} +impl std::str::FromStr for CodeScanningAlertReopenedAlertInstancesItemState { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "open" => Ok(Self::Open), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for CodeScanningAlertReopenedAlertInstancesItemState { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for CodeScanningAlertReopenedAlertInstancesItemState { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for CodeScanningAlertReopenedAlertInstancesItemState { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] pub struct CodeScanningAlertReopenedAlertRule { #[doc = "A short description of the rule used to detect the alert."] pub description: String, @@ -6785,7 +7215,7 @@ pub struct CodeScanningAlertReopenedByUserAlert { pub dismissed_reason: (), #[doc = "The GitHub URL of the alert resource."] pub html_url: String, - pub instances: Vec, + pub instances: Vec, #[serde(default, skip_serializing_if = "Option::is_none")] pub most_recent_instance: Option, #[doc = "The code scanning alert number."] @@ -6803,6 +7233,113 @@ impl From<&CodeScanningAlertReopenedByUserAlert> for CodeScanningAlertReopenedBy } #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] +pub struct CodeScanningAlertReopenedByUserAlertInstancesItem { + #[doc = "Identifies the configuration under which the analysis was executed. For example, in GitHub Actions this includes the workflow filename and job name."] + pub analysis_key: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub classifications: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub commit_sha: Option, + #[doc = "Identifies the variable values associated with the environment in which the analysis that generated this alert instance was performed, such as the language that was analyzed."] + pub environment: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[doc = "The full Git reference, formatted as `refs/heads/`."] + #[serde(rename = "ref")] + pub ref_: String, + pub state: CodeScanningAlertReopenedByUserAlertInstancesItemState, +} +impl From<&CodeScanningAlertReopenedByUserAlertInstancesItem> + for CodeScanningAlertReopenedByUserAlertInstancesItem +{ + fn from(value: &CodeScanningAlertReopenedByUserAlertInstancesItem) -> Self { + value.clone() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct CodeScanningAlertReopenedByUserAlertInstancesItemLocation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub end_column: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub end_line: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub start_column: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub start_line: Option, +} +impl From<&CodeScanningAlertReopenedByUserAlertInstancesItemLocation> + for CodeScanningAlertReopenedByUserAlertInstancesItemLocation +{ + fn from(value: &CodeScanningAlertReopenedByUserAlertInstancesItemLocation) -> Self { + value.clone() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct CodeScanningAlertReopenedByUserAlertInstancesItemMessage { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub text: Option, +} +impl From<&CodeScanningAlertReopenedByUserAlertInstancesItemMessage> + for CodeScanningAlertReopenedByUserAlertInstancesItemMessage +{ + fn from(value: &CodeScanningAlertReopenedByUserAlertInstancesItemMessage) -> Self { + value.clone() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum CodeScanningAlertReopenedByUserAlertInstancesItemState { + #[serde(rename = "open")] + Open, +} +impl From<&CodeScanningAlertReopenedByUserAlertInstancesItemState> + for CodeScanningAlertReopenedByUserAlertInstancesItemState +{ + fn from(value: &CodeScanningAlertReopenedByUserAlertInstancesItemState) -> Self { + value.clone() + } +} +impl ToString for CodeScanningAlertReopenedByUserAlertInstancesItemState { + fn to_string(&self) -> String { + match *self { + Self::Open => "open".to_string(), + } + } +} +impl std::str::FromStr for CodeScanningAlertReopenedByUserAlertInstancesItemState { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "open" => Ok(Self::Open), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for CodeScanningAlertReopenedByUserAlertInstancesItemState { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for CodeScanningAlertReopenedByUserAlertInstancesItemState { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for CodeScanningAlertReopenedByUserAlertInstancesItemState { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] pub struct CodeScanningAlertReopenedByUserAlertRule { #[doc = "A short description of the rule used to detect the alert."] pub description: String, @@ -7834,7 +8371,7 @@ impl From<&Discussion> for Discussion { pub struct DiscussionAnswered { pub action: DiscussionAnsweredAction, pub answer: DiscussionAnsweredAnswer, - pub discussion: Discussion, + pub discussion: DiscussionAnsweredDiscussion, #[serde(default, skip_serializing_if = "Option::is_none")] pub installation: Option, #[serde(default, skip_serializing_if = "Option::is_none")] @@ -7914,79 +8451,111 @@ impl From<&DiscussionAnsweredAnswer> for DiscussionAnsweredAnswer { } #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] -pub struct DiscussionCategory { +pub struct DiscussionAnsweredDiscussion { + pub active_lock_reason: Option, + pub answer_chosen_at: chrono::DateTime, + pub answer_chosen_by: DiscussionAnsweredDiscussionAnswerChosenBy, + pub answer_html_url: String, + pub author_association: AuthorAssociation, + pub body: String, + pub category: DiscussionAnsweredDiscussionCategory, + pub comments: i64, pub created_at: chrono::DateTime, - pub description: String, - pub emoji: String, + pub html_url: String, pub id: i64, - pub is_answerable: bool, - pub name: String, - pub repository_id: i64, - pub slug: String, - pub updated_at: String, + pub locked: bool, + pub node_id: String, + pub number: i64, + pub repository_url: String, + pub state: DiscussionAnsweredDiscussionState, + pub title: String, + pub updated_at: chrono::DateTime, + pub user: User, } -impl From<&DiscussionCategory> for DiscussionCategory { - fn from(value: &DiscussionCategory) -> Self { +impl From<&DiscussionAnsweredDiscussion> for DiscussionAnsweredDiscussion { + fn from(value: &DiscussionAnsweredDiscussion) -> Self { value.clone() } } #[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(deny_unknown_fields)] -pub struct DiscussionCategoryChanged { - pub action: DiscussionCategoryChangedAction, - pub changes: DiscussionCategoryChangedChanges, - pub discussion: Discussion, +pub struct DiscussionAnsweredDiscussionAnswerChosenBy { + pub avatar_url: String, #[serde(default, skip_serializing_if = "Option::is_none")] - pub installation: Option, + pub email: Option, + pub events_url: String, + pub followers_url: String, + pub following_url: String, + pub gists_url: String, + pub gravatar_id: String, + pub html_url: String, + pub id: i64, + pub login: String, #[serde(default, skip_serializing_if = "Option::is_none")] - pub organization: Option, - pub repository: Repository, - pub sender: User, + pub name: Option, + pub node_id: String, + pub organizations_url: String, + pub received_events_url: String, + pub repos_url: String, + pub site_admin: bool, + pub starred_url: String, + pub subscriptions_url: String, + #[serde(rename = "type")] + pub type_: DiscussionAnsweredDiscussionAnswerChosenByType, + pub url: String, } -impl From<&DiscussionCategoryChanged> for DiscussionCategoryChanged { - fn from(value: &DiscussionCategoryChanged) -> Self { +impl From<&DiscussionAnsweredDiscussionAnswerChosenBy> + for DiscussionAnsweredDiscussionAnswerChosenBy +{ + fn from(value: &DiscussionAnsweredDiscussionAnswerChosenBy) -> Self { value.clone() } } #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum DiscussionCategoryChangedAction { - #[serde(rename = "category_changed")] - CategoryChanged, +pub enum DiscussionAnsweredDiscussionAnswerChosenByType { + Bot, + User, + Organization, } -impl From<&DiscussionCategoryChangedAction> for DiscussionCategoryChangedAction { - fn from(value: &DiscussionCategoryChangedAction) -> Self { +impl From<&DiscussionAnsweredDiscussionAnswerChosenByType> + for DiscussionAnsweredDiscussionAnswerChosenByType +{ + fn from(value: &DiscussionAnsweredDiscussionAnswerChosenByType) -> Self { value.clone() } } -impl ToString for DiscussionCategoryChangedAction { +impl ToString for DiscussionAnsweredDiscussionAnswerChosenByType { fn to_string(&self) -> String { match *self { - Self::CategoryChanged => "category_changed".to_string(), + Self::Bot => "Bot".to_string(), + Self::User => "User".to_string(), + Self::Organization => "Organization".to_string(), } } } -impl std::str::FromStr for DiscussionCategoryChangedAction { +impl std::str::FromStr for DiscussionAnsweredDiscussionAnswerChosenByType { type Err = &'static str; fn from_str(value: &str) -> Result { match value { - "category_changed" => Ok(Self::CategoryChanged), + "Bot" => Ok(Self::Bot), + "User" => Ok(Self::User), + "Organization" => Ok(Self::Organization), _ => Err("invalid value"), } } } -impl std::convert::TryFrom<&str> for DiscussionCategoryChangedAction { +impl std::convert::TryFrom<&str> for DiscussionAnsweredDiscussionAnswerChosenByType { type Error = &'static str; fn try_from(value: &str) -> Result { value.parse() } } -impl std::convert::TryFrom<&String> for DiscussionCategoryChangedAction { +impl std::convert::TryFrom<&String> for DiscussionAnsweredDiscussionAnswerChosenByType { type Error = &'static str; fn try_from(value: &String) -> Result { value.parse() } } -impl std::convert::TryFrom for DiscussionCategoryChangedAction { +impl std::convert::TryFrom for DiscussionAnsweredDiscussionAnswerChosenByType { type Error = &'static str; fn try_from(value: String) -> Result { value.parse() @@ -7994,10 +8563,160 @@ impl std::convert::TryFrom for DiscussionCategoryChangedAction { } #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] -pub struct DiscussionCategoryChangedChanges { - pub category: DiscussionCategoryChangedChangesCategory, +pub struct DiscussionAnsweredDiscussionCategory { + pub created_at: chrono::DateTime, + pub description: String, + pub emoji: String, + pub id: i64, + pub is_answerable: bool, + pub name: String, + pub repository_id: i64, + pub slug: String, + pub updated_at: String, } -impl From<&DiscussionCategoryChangedChanges> for DiscussionCategoryChangedChanges { +impl From<&DiscussionAnsweredDiscussionCategory> for DiscussionAnsweredDiscussionCategory { + fn from(value: &DiscussionAnsweredDiscussionCategory) -> Self { + value.clone() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum DiscussionAnsweredDiscussionState { + #[serde(rename = "open")] + Open, + #[serde(rename = "locked")] + Locked, + #[serde(rename = "converting")] + Converting, +} +impl From<&DiscussionAnsweredDiscussionState> for DiscussionAnsweredDiscussionState { + fn from(value: &DiscussionAnsweredDiscussionState) -> Self { + value.clone() + } +} +impl ToString for DiscussionAnsweredDiscussionState { + fn to_string(&self) -> String { + match *self { + Self::Open => "open".to_string(), + Self::Locked => "locked".to_string(), + Self::Converting => "converting".to_string(), + } + } +} +impl std::str::FromStr for DiscussionAnsweredDiscussionState { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "open" => Ok(Self::Open), + "locked" => Ok(Self::Locked), + "converting" => Ok(Self::Converting), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for DiscussionAnsweredDiscussionState { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for DiscussionAnsweredDiscussionState { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for DiscussionAnsweredDiscussionState { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct DiscussionCategory { + pub created_at: chrono::DateTime, + pub description: String, + pub emoji: String, + pub id: i64, + pub is_answerable: bool, + pub name: String, + pub repository_id: i64, + pub slug: String, + pub updated_at: String, +} +impl From<&DiscussionCategory> for DiscussionCategory { + fn from(value: &DiscussionCategory) -> Self { + value.clone() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct DiscussionCategoryChanged { + pub action: DiscussionCategoryChangedAction, + pub changes: DiscussionCategoryChangedChanges, + pub discussion: Discussion, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub installation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub organization: Option, + pub repository: Repository, + pub sender: User, +} +impl From<&DiscussionCategoryChanged> for DiscussionCategoryChanged { + fn from(value: &DiscussionCategoryChanged) -> Self { + value.clone() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum DiscussionCategoryChangedAction { + #[serde(rename = "category_changed")] + CategoryChanged, +} +impl From<&DiscussionCategoryChangedAction> for DiscussionCategoryChangedAction { + fn from(value: &DiscussionCategoryChangedAction) -> Self { + value.clone() + } +} +impl ToString for DiscussionCategoryChangedAction { + fn to_string(&self) -> String { + match *self { + Self::CategoryChanged => "category_changed".to_string(), + } + } +} +impl std::str::FromStr for DiscussionCategoryChangedAction { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "category_changed" => Ok(Self::CategoryChanged), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for DiscussionCategoryChangedAction { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for DiscussionCategoryChangedAction { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for DiscussionCategoryChangedAction { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct DiscussionCategoryChangedChanges { + pub category: DiscussionCategoryChangedChangesCategory, +} +impl From<&DiscussionCategoryChangedChanges> for DiscussionCategoryChangedChanges { fn from(value: &DiscussionCategoryChangedChanges) -> Self { value.clone() } @@ -8330,7 +9049,7 @@ impl From for DiscussionCommentEvent { #[serde(deny_unknown_fields)] pub struct DiscussionCreated { pub action: DiscussionCreatedAction, - pub discussion: Discussion, + pub discussion: DiscussionCreatedDiscussion, #[serde(default, skip_serializing_if = "Option::is_none")] pub installation: Option, #[serde(default, skip_serializing_if = "Option::is_none")] @@ -8389,6 +9108,100 @@ impl std::convert::TryFrom for DiscussionCreatedAction { } #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] +pub struct DiscussionCreatedDiscussion { + pub active_lock_reason: Option, + pub answer_chosen_at: (), + pub answer_chosen_by: (), + pub answer_html_url: (), + pub author_association: AuthorAssociation, + pub body: String, + pub category: DiscussionCreatedDiscussionCategory, + pub comments: i64, + pub created_at: chrono::DateTime, + pub html_url: String, + pub id: i64, + pub locked: bool, + pub node_id: String, + pub number: i64, + pub repository_url: String, + pub state: DiscussionCreatedDiscussionState, + pub title: String, + pub updated_at: chrono::DateTime, + pub user: User, +} +impl From<&DiscussionCreatedDiscussion> for DiscussionCreatedDiscussion { + fn from(value: &DiscussionCreatedDiscussion) -> Self { + value.clone() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct DiscussionCreatedDiscussionCategory { + pub created_at: chrono::DateTime, + pub description: String, + pub emoji: String, + pub id: i64, + pub is_answerable: bool, + pub name: String, + pub repository_id: i64, + pub slug: String, + pub updated_at: String, +} +impl From<&DiscussionCreatedDiscussionCategory> for DiscussionCreatedDiscussionCategory { + fn from(value: &DiscussionCreatedDiscussionCategory) -> Self { + value.clone() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum DiscussionCreatedDiscussionState { + #[serde(rename = "open")] + Open, + #[serde(rename = "converting")] + Converting, +} +impl From<&DiscussionCreatedDiscussionState> for DiscussionCreatedDiscussionState { + fn from(value: &DiscussionCreatedDiscussionState) -> Self { + value.clone() + } +} +impl ToString for DiscussionCreatedDiscussionState { + fn to_string(&self) -> String { + match *self { + Self::Open => "open".to_string(), + Self::Converting => "converting".to_string(), + } + } +} +impl std::str::FromStr for DiscussionCreatedDiscussionState { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "open" => Ok(Self::Open), + "converting" => Ok(Self::Converting), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for DiscussionCreatedDiscussionState { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for DiscussionCreatedDiscussionState { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for DiscussionCreatedDiscussionState { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] pub struct DiscussionDeleted { pub action: DiscussionDeletedAction, pub discussion: Discussion, @@ -8697,7 +9510,7 @@ impl std::convert::TryFrom for DiscussionLabeledAction { #[serde(deny_unknown_fields)] pub struct DiscussionLocked { pub action: DiscussionLockedAction, - pub discussion: Discussion, + pub discussion: DiscussionLockedDiscussion, #[serde(default, skip_serializing_if = "Option::is_none")] pub installation: Option, #[serde(default, skip_serializing_if = "Option::is_none")] @@ -8756,32 +9569,122 @@ impl std::convert::TryFrom for DiscussionLockedAction { } #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] -pub struct DiscussionPinned { - pub action: DiscussionPinnedAction, - pub discussion: Discussion, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub installation: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub organization: Option, - pub repository: Repository, - pub sender: User, +pub struct DiscussionLockedDiscussion { + pub active_lock_reason: Option, + pub answer_chosen_at: Option, + pub answer_chosen_by: Option, + pub answer_html_url: Option, + pub author_association: AuthorAssociation, + pub body: String, + pub category: DiscussionLockedDiscussionCategory, + pub comments: i64, + pub created_at: chrono::DateTime, + pub html_url: String, + pub id: i64, + pub locked: bool, + pub node_id: String, + pub number: i64, + pub repository_url: String, + pub state: DiscussionLockedDiscussionState, + pub title: String, + pub updated_at: chrono::DateTime, + pub user: User, } -impl From<&DiscussionPinned> for DiscussionPinned { - fn from(value: &DiscussionPinned) -> Self { +impl From<&DiscussionLockedDiscussion> for DiscussionLockedDiscussion { + fn from(value: &DiscussionLockedDiscussion) -> Self { value.clone() } } -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum DiscussionPinnedAction { - #[serde(rename = "pinned")] - Pinned, +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct DiscussionLockedDiscussionCategory { + pub created_at: chrono::DateTime, + pub description: String, + pub emoji: String, + pub id: i64, + pub is_answerable: bool, + pub name: String, + pub repository_id: i64, + pub slug: String, + pub updated_at: String, } -impl From<&DiscussionPinnedAction> for DiscussionPinnedAction { - fn from(value: &DiscussionPinnedAction) -> Self { +impl From<&DiscussionLockedDiscussionCategory> for DiscussionLockedDiscussionCategory { + fn from(value: &DiscussionLockedDiscussionCategory) -> Self { value.clone() } } -impl ToString for DiscussionPinnedAction { +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum DiscussionLockedDiscussionState { + #[serde(rename = "locked")] + Locked, +} +impl From<&DiscussionLockedDiscussionState> for DiscussionLockedDiscussionState { + fn from(value: &DiscussionLockedDiscussionState) -> Self { + value.clone() + } +} +impl ToString for DiscussionLockedDiscussionState { + fn to_string(&self) -> String { + match *self { + Self::Locked => "locked".to_string(), + } + } +} +impl std::str::FromStr for DiscussionLockedDiscussionState { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "locked" => Ok(Self::Locked), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for DiscussionLockedDiscussionState { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for DiscussionLockedDiscussionState { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for DiscussionLockedDiscussionState { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct DiscussionPinned { + pub action: DiscussionPinnedAction, + pub discussion: Discussion, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub installation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub organization: Option, + pub repository: Repository, + pub sender: User, +} +impl From<&DiscussionPinned> for DiscussionPinned { + fn from(value: &DiscussionPinned) -> Self { + value.clone() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum DiscussionPinnedAction { + #[serde(rename = "pinned")] + Pinned, +} +impl From<&DiscussionPinnedAction> for DiscussionPinnedAction { + fn from(value: &DiscussionPinnedAction) -> Self { + value.clone() + } +} +impl ToString for DiscussionPinnedAction { fn to_string(&self) -> String { match *self { Self::Pinned => "pinned".to_string(), @@ -8944,7 +9847,7 @@ impl From<&DiscussionTransferredChanges> for DiscussionTransferredChanges { #[serde(deny_unknown_fields)] pub struct DiscussionUnanswered { pub action: DiscussionUnansweredAction, - pub discussion: Discussion, + pub discussion: DiscussionUnansweredDiscussion, #[serde(default, skip_serializing_if = "Option::is_none")] pub installation: Option, pub old_answer: DiscussionUnansweredOldAnswer, @@ -9004,6 +9907,104 @@ impl std::convert::TryFrom for DiscussionUnansweredAction { } #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] +pub struct DiscussionUnansweredDiscussion { + pub active_lock_reason: Option, + pub answer_chosen_at: (), + pub answer_chosen_by: (), + pub answer_html_url: (), + pub author_association: AuthorAssociation, + pub body: String, + pub category: DiscussionUnansweredDiscussionCategory, + pub comments: i64, + pub created_at: chrono::DateTime, + pub html_url: String, + pub id: i64, + pub locked: bool, + pub node_id: String, + pub number: i64, + pub repository_url: String, + pub state: DiscussionUnansweredDiscussionState, + pub title: String, + pub updated_at: chrono::DateTime, + pub user: User, +} +impl From<&DiscussionUnansweredDiscussion> for DiscussionUnansweredDiscussion { + fn from(value: &DiscussionUnansweredDiscussion) -> Self { + value.clone() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct DiscussionUnansweredDiscussionCategory { + pub created_at: chrono::DateTime, + pub description: String, + pub emoji: String, + pub id: i64, + pub is_answerable: bool, + pub name: String, + pub repository_id: i64, + pub slug: String, + pub updated_at: String, +} +impl From<&DiscussionUnansweredDiscussionCategory> for DiscussionUnansweredDiscussionCategory { + fn from(value: &DiscussionUnansweredDiscussionCategory) -> Self { + value.clone() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum DiscussionUnansweredDiscussionState { + #[serde(rename = "open")] + Open, + #[serde(rename = "locked")] + Locked, + #[serde(rename = "converting")] + Converting, +} +impl From<&DiscussionUnansweredDiscussionState> for DiscussionUnansweredDiscussionState { + fn from(value: &DiscussionUnansweredDiscussionState) -> Self { + value.clone() + } +} +impl ToString for DiscussionUnansweredDiscussionState { + fn to_string(&self) -> String { + match *self { + Self::Open => "open".to_string(), + Self::Locked => "locked".to_string(), + Self::Converting => "converting".to_string(), + } + } +} +impl std::str::FromStr for DiscussionUnansweredDiscussionState { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "open" => Ok(Self::Open), + "locked" => Ok(Self::Locked), + "converting" => Ok(Self::Converting), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for DiscussionUnansweredDiscussionState { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for DiscussionUnansweredDiscussionState { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for DiscussionUnansweredDiscussionState { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] pub struct DiscussionUnansweredOldAnswer { pub author_association: AuthorAssociation, pub body: String, @@ -9089,7 +10090,7 @@ impl std::convert::TryFrom for DiscussionUnlabeledAction { #[serde(deny_unknown_fields)] pub struct DiscussionUnlocked { pub action: DiscussionUnlockedAction, - pub discussion: Discussion, + pub discussion: DiscussionUnlockedDiscussion, #[serde(default, skip_serializing_if = "Option::is_none")] pub installation: Option, #[serde(default, skip_serializing_if = "Option::is_none")] @@ -9148,6 +10149,96 @@ impl std::convert::TryFrom for DiscussionUnlockedAction { } #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] +pub struct DiscussionUnlockedDiscussion { + pub active_lock_reason: Option, + pub answer_chosen_at: Option, + pub answer_chosen_by: Option, + pub answer_html_url: Option, + pub author_association: AuthorAssociation, + pub body: String, + pub category: DiscussionUnlockedDiscussionCategory, + pub comments: i64, + pub created_at: chrono::DateTime, + pub html_url: String, + pub id: i64, + pub locked: bool, + pub node_id: String, + pub number: i64, + pub repository_url: String, + pub state: DiscussionUnlockedDiscussionState, + pub title: String, + pub updated_at: chrono::DateTime, + pub user: User, +} +impl From<&DiscussionUnlockedDiscussion> for DiscussionUnlockedDiscussion { + fn from(value: &DiscussionUnlockedDiscussion) -> Self { + value.clone() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct DiscussionUnlockedDiscussionCategory { + pub created_at: chrono::DateTime, + pub description: String, + pub emoji: String, + pub id: i64, + pub is_answerable: bool, + pub name: String, + pub repository_id: i64, + pub slug: String, + pub updated_at: String, +} +impl From<&DiscussionUnlockedDiscussionCategory> for DiscussionUnlockedDiscussionCategory { + fn from(value: &DiscussionUnlockedDiscussionCategory) -> Self { + value.clone() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum DiscussionUnlockedDiscussionState { + #[serde(rename = "open")] + Open, +} +impl From<&DiscussionUnlockedDiscussionState> for DiscussionUnlockedDiscussionState { + fn from(value: &DiscussionUnlockedDiscussionState) -> Self { + value.clone() + } +} +impl ToString for DiscussionUnlockedDiscussionState { + fn to_string(&self) -> String { + match *self { + Self::Open => "open".to_string(), + } + } +} +impl std::str::FromStr for DiscussionUnlockedDiscussionState { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "open" => Ok(Self::Open), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for DiscussionUnlockedDiscussionState { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for DiscussionUnlockedDiscussionState { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for DiscussionUnlockedDiscussionState { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] pub struct DiscussionUnpinned { pub action: DiscussionUnpinnedAction, pub discussion: Discussion, @@ -9550,8 +10641,7 @@ impl From for Everything { #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] pub struct ForkEvent { - #[doc = "The created [`repository`](https://docs.github.com/en/rest/reference/repos#get-a-repository) resource."] - pub forkee: Repository, + pub forkee: ForkEventForkee, #[serde(default, skip_serializing_if = "Option::is_none")] pub installation: Option, #[serde(default, skip_serializing_if = "Option::is_none")] @@ -9564,45 +10654,264 @@ impl From<&ForkEvent> for ForkEvent { value.clone() } } -#[derive(Clone, Debug, Deserialize, Serialize)] -pub struct GithubAppAuthorizationEvent(pub GithubAppAuthorizationRevoked); -impl std::ops::Deref for GithubAppAuthorizationEvent { - type Target = GithubAppAuthorizationRevoked; - fn deref(&self) -> &GithubAppAuthorizationRevoked { - &self.0 - } -} -impl From for GithubAppAuthorizationRevoked { - fn from(value: GithubAppAuthorizationEvent) -> Self { - value.0 - } -} -impl From<&GithubAppAuthorizationEvent> for GithubAppAuthorizationEvent { - fn from(value: &GithubAppAuthorizationEvent) -> Self { - value.clone() - } -} -impl From for GithubAppAuthorizationEvent { - fn from(value: GithubAppAuthorizationRevoked) -> Self { - Self(value) - } -} +#[doc = "The created [`repository`](https://docs.github.com/en/rest/reference/repos#get-a-repository) resource."] #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] -pub struct GithubAppAuthorizationRevoked { - pub action: GithubAppAuthorizationRevokedAction, - pub sender: User, -} -impl From<&GithubAppAuthorizationRevoked> for GithubAppAuthorizationRevoked { - fn from(value: &GithubAppAuthorizationRevoked) -> Self { - value.clone() - } -} -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum GithubAppAuthorizationRevokedAction { - #[serde(rename = "revoked")] - Revoked, -} +pub struct ForkEventForkee { + #[doc = "Whether to allow auto-merge for pull requests."] + #[serde(default)] + pub allow_auto_merge: bool, + #[doc = "Whether to allow private forks"] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub allow_forking: Option, + #[doc = "Whether to allow merge commits for pull requests."] + #[serde(default = "defaults::default_bool::")] + pub allow_merge_commit: bool, + #[doc = "Whether to allow rebase merges for pull requests."] + #[serde(default = "defaults::default_bool::")] + pub allow_rebase_merge: bool, + #[doc = "Whether to allow squash merges for pull requests."] + #[serde(default = "defaults::default_bool::")] + pub allow_squash_merge: bool, + pub archive_url: String, + #[doc = "Whether the repository is archived."] + pub archived: bool, + pub assignees_url: String, + pub blobs_url: String, + pub branches_url: String, + pub clone_url: String, + pub collaborators_url: String, + pub comments_url: String, + pub commits_url: String, + pub compare_url: String, + pub contents_url: String, + pub contributors_url: String, + pub created_at: ForkEventForkeeCreatedAt, + #[doc = "The default branch of the repository."] + pub default_branch: String, + #[doc = "Whether to delete head branches when pull requests are merged"] + #[serde(default)] + pub delete_branch_on_merge: bool, + pub deployments_url: String, + pub description: Option, + #[doc = "Returns whether or not this repository is disabled."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub disabled: Option, + pub downloads_url: String, + pub events_url: String, + pub fork: bool, + pub forks: i64, + pub forks_count: i64, + pub forks_url: String, + pub full_name: String, + pub git_commits_url: String, + pub git_refs_url: String, + pub git_tags_url: String, + pub git_url: String, + #[doc = "Whether downloads are enabled."] + pub has_downloads: bool, + #[doc = "Whether issues are enabled."] + pub has_issues: bool, + pub has_pages: bool, + #[doc = "Whether projects are enabled."] + pub has_projects: bool, + #[doc = "Whether the wiki is enabled."] + pub has_wiki: bool, + pub homepage: Option, + pub hooks_url: String, + pub html_url: String, + #[doc = "Unique identifier of the repository"] + pub id: i64, + pub issue_comment_url: String, + pub issue_events_url: String, + pub issues_url: String, + pub keys_url: String, + pub labels_url: String, + pub language: Option, + pub languages_url: String, + pub license: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub master_branch: Option, + pub merges_url: String, + pub milestones_url: String, + pub mirror_url: Option, + #[doc = "The name of the repository."] + pub name: String, + pub node_id: String, + pub notifications_url: String, + pub open_issues: i64, + pub open_issues_count: i64, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub organization: Option, + pub owner: User, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub permissions: Option, + #[doc = "Whether the repository is private or public."] + pub private: bool, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub public: Option, + pub pulls_url: String, + pub pushed_at: ForkEventForkeePushedAt, + pub releases_url: String, + pub size: i64, + pub ssh_url: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub stargazers: Option, + pub stargazers_count: i64, + pub stargazers_url: String, + pub statuses_url: String, + pub subscribers_url: String, + pub subscription_url: String, + pub svn_url: String, + pub tags_url: String, + pub teams_url: String, + pub trees_url: String, + pub updated_at: chrono::DateTime, + pub url: String, + pub watchers: i64, + pub watchers_count: i64, +} +impl From<&ForkEventForkee> for ForkEventForkee { + fn from(value: &ForkEventForkee) -> Self { + value.clone() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(untagged)] +pub enum ForkEventForkeeCreatedAt { + Variant0(i64), + Variant1(chrono::DateTime), +} +impl From<&ForkEventForkeeCreatedAt> for ForkEventForkeeCreatedAt { + fn from(value: &ForkEventForkeeCreatedAt) -> Self { + value.clone() + } +} +impl std::str::FromStr for ForkEventForkeeCreatedAt { + type Err = &'static str; + fn from_str(value: &str) -> Result { + if let Ok(v) = value.parse() { + Ok(Self::Variant0(v)) + } else if let Ok(v) = value.parse() { + Ok(Self::Variant1(v)) + } else { + Err("string conversion failed for all variants") + } + } +} +impl std::convert::TryFrom<&str> for ForkEventForkeeCreatedAt { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for ForkEventForkeeCreatedAt { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for ForkEventForkeeCreatedAt { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +impl ToString for ForkEventForkeeCreatedAt { + fn to_string(&self) -> String { + match self { + Self::Variant0(x) => x.to_string(), + Self::Variant1(x) => x.to_string(), + } + } +} +impl From for ForkEventForkeeCreatedAt { + fn from(value: i64) -> Self { + Self::Variant0(value) + } +} +impl From> for ForkEventForkeeCreatedAt { + fn from(value: chrono::DateTime) -> Self { + Self::Variant1(value) + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct ForkEventForkeePermissions { + pub admin: bool, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub maintain: Option, + pub pull: bool, + pub push: bool, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub triage: Option, +} +impl From<&ForkEventForkeePermissions> for ForkEventForkeePermissions { + fn from(value: &ForkEventForkeePermissions) -> Self { + value.clone() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(untagged)] +pub enum ForkEventForkeePushedAt { + Variant0(i64), + Variant1(chrono::DateTime), + Variant2, +} +impl From<&ForkEventForkeePushedAt> for ForkEventForkeePushedAt { + fn from(value: &ForkEventForkeePushedAt) -> Self { + value.clone() + } +} +impl From for ForkEventForkeePushedAt { + fn from(value: i64) -> Self { + Self::Variant0(value) + } +} +impl From> for ForkEventForkeePushedAt { + fn from(value: chrono::DateTime) -> Self { + Self::Variant1(value) + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct GithubAppAuthorizationEvent(pub GithubAppAuthorizationRevoked); +impl std::ops::Deref for GithubAppAuthorizationEvent { + type Target = GithubAppAuthorizationRevoked; + fn deref(&self) -> &GithubAppAuthorizationRevoked { + &self.0 + } +} +impl From for GithubAppAuthorizationRevoked { + fn from(value: GithubAppAuthorizationEvent) -> Self { + value.0 + } +} +impl From<&GithubAppAuthorizationEvent> for GithubAppAuthorizationEvent { + fn from(value: &GithubAppAuthorizationEvent) -> Self { + value.clone() + } +} +impl From for GithubAppAuthorizationEvent { + fn from(value: GithubAppAuthorizationRevoked) -> Self { + Self(value) + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct GithubAppAuthorizationRevoked { + pub action: GithubAppAuthorizationRevokedAction, + pub sender: User, +} +impl From<&GithubAppAuthorizationRevoked> for GithubAppAuthorizationRevoked { + fn from(value: &GithubAppAuthorizationRevoked) -> Self { + value.clone() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum GithubAppAuthorizationRevokedAction { + #[serde(rename = "revoked")] + Revoked, +} impl From<&GithubAppAuthorizationRevokedAction> for GithubAppAuthorizationRevokedAction { fn from(value: &GithubAppAuthorizationRevokedAction) -> Self { value.clone() @@ -12528,7 +13837,7 @@ impl std::convert::TryFrom for InstallationRepositorySelection { #[serde(deny_unknown_fields)] pub struct InstallationSuspend { pub action: InstallationSuspendAction, - pub installation: Installation, + pub installation: InstallationSuspendInstallation, #[doc = "An array of repository objects that the installation can access."] #[serde(default, skip_serializing_if = "Vec::is_empty")] pub repositories: Vec, @@ -12587,15 +13896,2474 @@ impl std::convert::TryFrom for InstallationSuspendAction { } #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] -pub struct InstallationSuspendRepositoriesItem { - pub full_name: String, - #[doc = "Unique identifier of the repository"] +pub struct InstallationSuspendInstallation { + pub access_tokens_url: String, + pub account: User, + pub app_id: i64, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub app_slug: Option, + pub created_at: InstallationSuspendInstallationCreatedAt, + pub events: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub has_multiple_single_files: Option, + pub html_url: String, + #[doc = "The ID of the installation."] pub id: i64, - #[doc = "The name of the repository."] - pub name: String, - pub node_id: String, - #[doc = "Whether the repository is private or public."] - pub private: bool, + pub permissions: InstallationSuspendInstallationPermissions, + pub repositories_url: String, + #[doc = "Describe whether all repositories have been selected or there's a selection involved"] + pub repository_selection: InstallationSuspendInstallationRepositorySelection, + pub single_file_name: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub single_file_paths: Vec, + pub suspended_at: chrono::DateTime, + pub suspended_by: InstallationSuspendInstallationSuspendedBy, + #[doc = "The ID of the user or organization this token is being scoped to."] + pub target_id: i64, + pub target_type: InstallationSuspendInstallationTargetType, + pub updated_at: InstallationSuspendInstallationUpdatedAt, +} +impl From<&InstallationSuspendInstallation> for InstallationSuspendInstallation { + fn from(value: &InstallationSuspendInstallation) -> Self { + value.clone() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(untagged)] +pub enum InstallationSuspendInstallationCreatedAt { + Variant0(chrono::DateTime), + Variant1(i64), +} +impl From<&InstallationSuspendInstallationCreatedAt> for InstallationSuspendInstallationCreatedAt { + fn from(value: &InstallationSuspendInstallationCreatedAt) -> Self { + value.clone() + } +} +impl std::str::FromStr for InstallationSuspendInstallationCreatedAt { + type Err = &'static str; + fn from_str(value: &str) -> Result { + if let Ok(v) = value.parse() { + Ok(Self::Variant0(v)) + } else if let Ok(v) = value.parse() { + Ok(Self::Variant1(v)) + } else { + Err("string conversion failed for all variants") + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationCreatedAt { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationCreatedAt { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationCreatedAt { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +impl ToString for InstallationSuspendInstallationCreatedAt { + fn to_string(&self) -> String { + match self { + Self::Variant0(x) => x.to_string(), + Self::Variant1(x) => x.to_string(), + } + } +} +impl From> for InstallationSuspendInstallationCreatedAt { + fn from(value: chrono::DateTime) -> Self { + Self::Variant0(value) + } +} +impl From for InstallationSuspendInstallationCreatedAt { + fn from(value: i64) -> Self { + Self::Variant1(value) + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationEventsItem { + #[serde(rename = "check_run")] + CheckRun, + #[serde(rename = "check_suite")] + CheckSuite, + #[serde(rename = "code_scanning_alert")] + CodeScanningAlert, + #[serde(rename = "commit_comment")] + CommitComment, + #[serde(rename = "content_reference")] + ContentReference, + #[serde(rename = "create")] + Create, + #[serde(rename = "delete")] + Delete, + #[serde(rename = "deployment")] + Deployment, + #[serde(rename = "deployment_review")] + DeploymentReview, + #[serde(rename = "deployment_status")] + DeploymentStatus, + #[serde(rename = "deploy_key")] + DeployKey, + #[serde(rename = "discussion")] + Discussion, + #[serde(rename = "discussion_comment")] + DiscussionComment, + #[serde(rename = "fork")] + Fork, + #[serde(rename = "gollum")] + Gollum, + #[serde(rename = "issues")] + Issues, + #[serde(rename = "issue_comment")] + IssueComment, + #[serde(rename = "label")] + Label, + #[serde(rename = "member")] + Member, + #[serde(rename = "membership")] + Membership, + #[serde(rename = "merge_queue_entry")] + MergeQueueEntry, + #[serde(rename = "milestone")] + Milestone, + #[serde(rename = "organization")] + Organization, + #[serde(rename = "org_block")] + OrgBlock, + #[serde(rename = "page_build")] + PageBuild, + #[serde(rename = "project")] + Project, + #[serde(rename = "project_card")] + ProjectCard, + #[serde(rename = "project_column")] + ProjectColumn, + #[serde(rename = "public")] + Public, + #[serde(rename = "pull_request")] + PullRequest, + #[serde(rename = "pull_request_review")] + PullRequestReview, + #[serde(rename = "pull_request_review_comment")] + PullRequestReviewComment, + #[serde(rename = "push")] + Push, + #[serde(rename = "registry_package")] + RegistryPackage, + #[serde(rename = "release")] + Release, + #[serde(rename = "repository")] + Repository, + #[serde(rename = "repository_dispatch")] + RepositoryDispatch, + #[serde(rename = "secret_scanning_alert")] + SecretScanningAlert, + #[serde(rename = "star")] + Star, + #[serde(rename = "status")] + Status, + #[serde(rename = "team")] + Team, + #[serde(rename = "team_add")] + TeamAdd, + #[serde(rename = "watch")] + Watch, + #[serde(rename = "workflow_dispatch")] + WorkflowDispatch, + #[serde(rename = "workflow_run")] + WorkflowRun, +} +impl From<&InstallationSuspendInstallationEventsItem> + for InstallationSuspendInstallationEventsItem +{ + fn from(value: &InstallationSuspendInstallationEventsItem) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationEventsItem { + fn to_string(&self) -> String { + match *self { + Self::CheckRun => "check_run".to_string(), + Self::CheckSuite => "check_suite".to_string(), + Self::CodeScanningAlert => "code_scanning_alert".to_string(), + Self::CommitComment => "commit_comment".to_string(), + Self::ContentReference => "content_reference".to_string(), + Self::Create => "create".to_string(), + Self::Delete => "delete".to_string(), + Self::Deployment => "deployment".to_string(), + Self::DeploymentReview => "deployment_review".to_string(), + Self::DeploymentStatus => "deployment_status".to_string(), + Self::DeployKey => "deploy_key".to_string(), + Self::Discussion => "discussion".to_string(), + Self::DiscussionComment => "discussion_comment".to_string(), + Self::Fork => "fork".to_string(), + Self::Gollum => "gollum".to_string(), + Self::Issues => "issues".to_string(), + Self::IssueComment => "issue_comment".to_string(), + Self::Label => "label".to_string(), + Self::Member => "member".to_string(), + Self::Membership => "membership".to_string(), + Self::MergeQueueEntry => "merge_queue_entry".to_string(), + Self::Milestone => "milestone".to_string(), + Self::Organization => "organization".to_string(), + Self::OrgBlock => "org_block".to_string(), + Self::PageBuild => "page_build".to_string(), + Self::Project => "project".to_string(), + Self::ProjectCard => "project_card".to_string(), + Self::ProjectColumn => "project_column".to_string(), + Self::Public => "public".to_string(), + Self::PullRequest => "pull_request".to_string(), + Self::PullRequestReview => "pull_request_review".to_string(), + Self::PullRequestReviewComment => "pull_request_review_comment".to_string(), + Self::Push => "push".to_string(), + Self::RegistryPackage => "registry_package".to_string(), + Self::Release => "release".to_string(), + Self::Repository => "repository".to_string(), + Self::RepositoryDispatch => "repository_dispatch".to_string(), + Self::SecretScanningAlert => "secret_scanning_alert".to_string(), + Self::Star => "star".to_string(), + Self::Status => "status".to_string(), + Self::Team => "team".to_string(), + Self::TeamAdd => "team_add".to_string(), + Self::Watch => "watch".to_string(), + Self::WorkflowDispatch => "workflow_dispatch".to_string(), + Self::WorkflowRun => "workflow_run".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationEventsItem { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "check_run" => Ok(Self::CheckRun), + "check_suite" => Ok(Self::CheckSuite), + "code_scanning_alert" => Ok(Self::CodeScanningAlert), + "commit_comment" => Ok(Self::CommitComment), + "content_reference" => Ok(Self::ContentReference), + "create" => Ok(Self::Create), + "delete" => Ok(Self::Delete), + "deployment" => Ok(Self::Deployment), + "deployment_review" => Ok(Self::DeploymentReview), + "deployment_status" => Ok(Self::DeploymentStatus), + "deploy_key" => Ok(Self::DeployKey), + "discussion" => Ok(Self::Discussion), + "discussion_comment" => Ok(Self::DiscussionComment), + "fork" => Ok(Self::Fork), + "gollum" => Ok(Self::Gollum), + "issues" => Ok(Self::Issues), + "issue_comment" => Ok(Self::IssueComment), + "label" => Ok(Self::Label), + "member" => Ok(Self::Member), + "membership" => Ok(Self::Membership), + "merge_queue_entry" => Ok(Self::MergeQueueEntry), + "milestone" => Ok(Self::Milestone), + "organization" => Ok(Self::Organization), + "org_block" => Ok(Self::OrgBlock), + "page_build" => Ok(Self::PageBuild), + "project" => Ok(Self::Project), + "project_card" => Ok(Self::ProjectCard), + "project_column" => Ok(Self::ProjectColumn), + "public" => Ok(Self::Public), + "pull_request" => Ok(Self::PullRequest), + "pull_request_review" => Ok(Self::PullRequestReview), + "pull_request_review_comment" => Ok(Self::PullRequestReviewComment), + "push" => Ok(Self::Push), + "registry_package" => Ok(Self::RegistryPackage), + "release" => Ok(Self::Release), + "repository" => Ok(Self::Repository), + "repository_dispatch" => Ok(Self::RepositoryDispatch), + "secret_scanning_alert" => Ok(Self::SecretScanningAlert), + "star" => Ok(Self::Star), + "status" => Ok(Self::Status), + "team" => Ok(Self::Team), + "team_add" => Ok(Self::TeamAdd), + "watch" => Ok(Self::Watch), + "workflow_dispatch" => Ok(Self::WorkflowDispatch), + "workflow_run" => Ok(Self::WorkflowRun), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationEventsItem { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationEventsItem { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationEventsItem { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct InstallationSuspendInstallationPermissions { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub actions: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub administration: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub checks: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub content_references: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub contents: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub deployments: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub discussions: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub emails: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub environments: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub issues: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub members: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub metadata: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub organization_administration: + Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub organization_events: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub organization_hooks: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub organization_packages: + Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub organization_plan: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub organization_projects: + Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub organization_secrets: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub organization_self_hosted_runners: + Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub organization_user_blocking: + Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub packages: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub pages: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub pull_requests: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub repository_hooks: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub repository_projects: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub secret_scanning_alerts: + Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub secrets: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub security_events: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub security_scanning_alert: + Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub single_file: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub statuses: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub team_discussions: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub vulnerability_alerts: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub workflows: Option, +} +impl From<&InstallationSuspendInstallationPermissions> + for InstallationSuspendInstallationPermissions +{ + fn from(value: &InstallationSuspendInstallationPermissions) -> Self { + value.clone() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsActions { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsActions> + for InstallationSuspendInstallationPermissionsActions +{ + fn from(value: &InstallationSuspendInstallationPermissionsActions) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsActions { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsActions { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsActions { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationPermissionsActions { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsActions { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsAdministration { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsAdministration> + for InstallationSuspendInstallationPermissionsAdministration +{ + fn from(value: &InstallationSuspendInstallationPermissionsAdministration) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsAdministration { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsAdministration { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsAdministration { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationPermissionsAdministration { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsAdministration { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsChecks { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsChecks> + for InstallationSuspendInstallationPermissionsChecks +{ + fn from(value: &InstallationSuspendInstallationPermissionsChecks) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsChecks { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsChecks { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsChecks { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationPermissionsChecks { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsChecks { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsContentReferences { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsContentReferences> + for InstallationSuspendInstallationPermissionsContentReferences +{ + fn from(value: &InstallationSuspendInstallationPermissionsContentReferences) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsContentReferences { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsContentReferences { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsContentReferences { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationSuspendInstallationPermissionsContentReferences +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsContentReferences { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsContents { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsContents> + for InstallationSuspendInstallationPermissionsContents +{ + fn from(value: &InstallationSuspendInstallationPermissionsContents) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsContents { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsContents { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsContents { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationPermissionsContents { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsContents { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsDeployments { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsDeployments> + for InstallationSuspendInstallationPermissionsDeployments +{ + fn from(value: &InstallationSuspendInstallationPermissionsDeployments) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsDeployments { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsDeployments { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsDeployments { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationPermissionsDeployments { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsDeployments { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsDiscussions { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsDiscussions> + for InstallationSuspendInstallationPermissionsDiscussions +{ + fn from(value: &InstallationSuspendInstallationPermissionsDiscussions) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsDiscussions { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsDiscussions { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsDiscussions { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationPermissionsDiscussions { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsDiscussions { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsEmails { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsEmails> + for InstallationSuspendInstallationPermissionsEmails +{ + fn from(value: &InstallationSuspendInstallationPermissionsEmails) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsEmails { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsEmails { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsEmails { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationPermissionsEmails { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsEmails { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsEnvironments { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsEnvironments> + for InstallationSuspendInstallationPermissionsEnvironments +{ + fn from(value: &InstallationSuspendInstallationPermissionsEnvironments) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsEnvironments { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsEnvironments { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsEnvironments { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationPermissionsEnvironments { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsEnvironments { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsIssues { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsIssues> + for InstallationSuspendInstallationPermissionsIssues +{ + fn from(value: &InstallationSuspendInstallationPermissionsIssues) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsIssues { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsIssues { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsIssues { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationPermissionsIssues { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsIssues { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsMembers { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsMembers> + for InstallationSuspendInstallationPermissionsMembers +{ + fn from(value: &InstallationSuspendInstallationPermissionsMembers) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsMembers { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsMembers { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsMembers { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationPermissionsMembers { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsMembers { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsMetadata { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsMetadata> + for InstallationSuspendInstallationPermissionsMetadata +{ + fn from(value: &InstallationSuspendInstallationPermissionsMetadata) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsMetadata { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsMetadata { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsMetadata { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationPermissionsMetadata { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsMetadata { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsOrganizationAdministration { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsOrganizationAdministration> + for InstallationSuspendInstallationPermissionsOrganizationAdministration +{ + fn from(value: &InstallationSuspendInstallationPermissionsOrganizationAdministration) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsOrganizationAdministration { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsOrganizationAdministration { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> + for InstallationSuspendInstallationPermissionsOrganizationAdministration +{ + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationSuspendInstallationPermissionsOrganizationAdministration +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationSuspendInstallationPermissionsOrganizationAdministration +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsOrganizationEvents { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsOrganizationEvents> + for InstallationSuspendInstallationPermissionsOrganizationEvents +{ + fn from(value: &InstallationSuspendInstallationPermissionsOrganizationEvents) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsOrganizationEvents { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsOrganizationEvents { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsOrganizationEvents { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationSuspendInstallationPermissionsOrganizationEvents +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationSuspendInstallationPermissionsOrganizationEvents +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsOrganizationHooks { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsOrganizationHooks> + for InstallationSuspendInstallationPermissionsOrganizationHooks +{ + fn from(value: &InstallationSuspendInstallationPermissionsOrganizationHooks) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsOrganizationHooks { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsOrganizationHooks { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsOrganizationHooks { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationSuspendInstallationPermissionsOrganizationHooks +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsOrganizationHooks { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsOrganizationPackages { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsOrganizationPackages> + for InstallationSuspendInstallationPermissionsOrganizationPackages +{ + fn from(value: &InstallationSuspendInstallationPermissionsOrganizationPackages) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsOrganizationPackages { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsOrganizationPackages { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> + for InstallationSuspendInstallationPermissionsOrganizationPackages +{ + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationSuspendInstallationPermissionsOrganizationPackages +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationSuspendInstallationPermissionsOrganizationPackages +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsOrganizationPlan { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsOrganizationPlan> + for InstallationSuspendInstallationPermissionsOrganizationPlan +{ + fn from(value: &InstallationSuspendInstallationPermissionsOrganizationPlan) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsOrganizationPlan { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsOrganizationPlan { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsOrganizationPlan { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationPermissionsOrganizationPlan { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsOrganizationPlan { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsOrganizationProjects { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsOrganizationProjects> + for InstallationSuspendInstallationPermissionsOrganizationProjects +{ + fn from(value: &InstallationSuspendInstallationPermissionsOrganizationProjects) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsOrganizationProjects { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsOrganizationProjects { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> + for InstallationSuspendInstallationPermissionsOrganizationProjects +{ + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationSuspendInstallationPermissionsOrganizationProjects +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationSuspendInstallationPermissionsOrganizationProjects +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsOrganizationSecrets { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsOrganizationSecrets> + for InstallationSuspendInstallationPermissionsOrganizationSecrets +{ + fn from(value: &InstallationSuspendInstallationPermissionsOrganizationSecrets) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsOrganizationSecrets { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsOrganizationSecrets { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsOrganizationSecrets { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationSuspendInstallationPermissionsOrganizationSecrets +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationSuspendInstallationPermissionsOrganizationSecrets +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsOrganizationSelfHostedRunners { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsOrganizationSelfHostedRunners> + for InstallationSuspendInstallationPermissionsOrganizationSelfHostedRunners +{ + fn from( + value: &InstallationSuspendInstallationPermissionsOrganizationSelfHostedRunners, + ) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsOrganizationSelfHostedRunners { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsOrganizationSelfHostedRunners { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> + for InstallationSuspendInstallationPermissionsOrganizationSelfHostedRunners +{ + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationSuspendInstallationPermissionsOrganizationSelfHostedRunners +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationSuspendInstallationPermissionsOrganizationSelfHostedRunners +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsOrganizationUserBlocking { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsOrganizationUserBlocking> + for InstallationSuspendInstallationPermissionsOrganizationUserBlocking +{ + fn from(value: &InstallationSuspendInstallationPermissionsOrganizationUserBlocking) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsOrganizationUserBlocking { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsOrganizationUserBlocking { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> + for InstallationSuspendInstallationPermissionsOrganizationUserBlocking +{ + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationSuspendInstallationPermissionsOrganizationUserBlocking +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationSuspendInstallationPermissionsOrganizationUserBlocking +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsPackages { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsPackages> + for InstallationSuspendInstallationPermissionsPackages +{ + fn from(value: &InstallationSuspendInstallationPermissionsPackages) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsPackages { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsPackages { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsPackages { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationPermissionsPackages { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsPackages { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsPages { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsPages> + for InstallationSuspendInstallationPermissionsPages +{ + fn from(value: &InstallationSuspendInstallationPermissionsPages) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsPages { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsPages { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsPages { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationPermissionsPages { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsPages { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsPullRequests { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsPullRequests> + for InstallationSuspendInstallationPermissionsPullRequests +{ + fn from(value: &InstallationSuspendInstallationPermissionsPullRequests) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsPullRequests { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsPullRequests { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsPullRequests { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationPermissionsPullRequests { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsPullRequests { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsRepositoryHooks { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsRepositoryHooks> + for InstallationSuspendInstallationPermissionsRepositoryHooks +{ + fn from(value: &InstallationSuspendInstallationPermissionsRepositoryHooks) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsRepositoryHooks { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsRepositoryHooks { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsRepositoryHooks { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationPermissionsRepositoryHooks { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsRepositoryHooks { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsRepositoryProjects { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsRepositoryProjects> + for InstallationSuspendInstallationPermissionsRepositoryProjects +{ + fn from(value: &InstallationSuspendInstallationPermissionsRepositoryProjects) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsRepositoryProjects { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsRepositoryProjects { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsRepositoryProjects { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationSuspendInstallationPermissionsRepositoryProjects +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationSuspendInstallationPermissionsRepositoryProjects +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsSecretScanningAlerts { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsSecretScanningAlerts> + for InstallationSuspendInstallationPermissionsSecretScanningAlerts +{ + fn from(value: &InstallationSuspendInstallationPermissionsSecretScanningAlerts) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsSecretScanningAlerts { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsSecretScanningAlerts { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> + for InstallationSuspendInstallationPermissionsSecretScanningAlerts +{ + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationSuspendInstallationPermissionsSecretScanningAlerts +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationSuspendInstallationPermissionsSecretScanningAlerts +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsSecrets { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsSecrets> + for InstallationSuspendInstallationPermissionsSecrets +{ + fn from(value: &InstallationSuspendInstallationPermissionsSecrets) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsSecrets { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsSecrets { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsSecrets { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationPermissionsSecrets { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsSecrets { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsSecurityEvents { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsSecurityEvents> + for InstallationSuspendInstallationPermissionsSecurityEvents +{ + fn from(value: &InstallationSuspendInstallationPermissionsSecurityEvents) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsSecurityEvents { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsSecurityEvents { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsSecurityEvents { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationPermissionsSecurityEvents { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsSecurityEvents { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsSecurityScanningAlert { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsSecurityScanningAlert> + for InstallationSuspendInstallationPermissionsSecurityScanningAlert +{ + fn from(value: &InstallationSuspendInstallationPermissionsSecurityScanningAlert) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsSecurityScanningAlert { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsSecurityScanningAlert { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> + for InstallationSuspendInstallationPermissionsSecurityScanningAlert +{ + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationSuspendInstallationPermissionsSecurityScanningAlert +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationSuspendInstallationPermissionsSecurityScanningAlert +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsSingleFile { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsSingleFile> + for InstallationSuspendInstallationPermissionsSingleFile +{ + fn from(value: &InstallationSuspendInstallationPermissionsSingleFile) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsSingleFile { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsSingleFile { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsSingleFile { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationPermissionsSingleFile { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsSingleFile { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsStatuses { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsStatuses> + for InstallationSuspendInstallationPermissionsStatuses +{ + fn from(value: &InstallationSuspendInstallationPermissionsStatuses) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsStatuses { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsStatuses { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsStatuses { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationPermissionsStatuses { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsStatuses { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsTeamDiscussions { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsTeamDiscussions> + for InstallationSuspendInstallationPermissionsTeamDiscussions +{ + fn from(value: &InstallationSuspendInstallationPermissionsTeamDiscussions) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsTeamDiscussions { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsTeamDiscussions { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsTeamDiscussions { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationPermissionsTeamDiscussions { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsTeamDiscussions { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsVulnerabilityAlerts { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsVulnerabilityAlerts> + for InstallationSuspendInstallationPermissionsVulnerabilityAlerts +{ + fn from(value: &InstallationSuspendInstallationPermissionsVulnerabilityAlerts) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsVulnerabilityAlerts { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsVulnerabilityAlerts { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsVulnerabilityAlerts { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationSuspendInstallationPermissionsVulnerabilityAlerts +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationSuspendInstallationPermissionsVulnerabilityAlerts +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationPermissionsWorkflows { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationSuspendInstallationPermissionsWorkflows> + for InstallationSuspendInstallationPermissionsWorkflows +{ + fn from(value: &InstallationSuspendInstallationPermissionsWorkflows) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationPermissionsWorkflows { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationPermissionsWorkflows { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationPermissionsWorkflows { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationPermissionsWorkflows { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationPermissionsWorkflows { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[doc = "Describe whether all repositories have been selected or there's a selection involved"] +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationRepositorySelection { + #[serde(rename = "all")] + All, + #[serde(rename = "selected")] + Selected, +} +impl From<&InstallationSuspendInstallationRepositorySelection> + for InstallationSuspendInstallationRepositorySelection +{ + fn from(value: &InstallationSuspendInstallationRepositorySelection) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationRepositorySelection { + fn to_string(&self) -> String { + match *self { + Self::All => "all".to_string(), + Self::Selected => "selected".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationRepositorySelection { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "all" => Ok(Self::All), + "selected" => Ok(Self::Selected), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationRepositorySelection { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationRepositorySelection { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationRepositorySelection { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct InstallationSuspendInstallationSuspendedBy { + pub avatar_url: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub email: Option, + pub events_url: String, + pub followers_url: String, + pub following_url: String, + pub gists_url: String, + pub gravatar_id: String, + pub html_url: String, + pub id: i64, + pub login: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + pub node_id: String, + pub organizations_url: String, + pub received_events_url: String, + pub repos_url: String, + pub site_admin: bool, + pub starred_url: String, + pub subscriptions_url: String, + #[serde(rename = "type")] + pub type_: InstallationSuspendInstallationSuspendedByType, + pub url: String, +} +impl From<&InstallationSuspendInstallationSuspendedBy> + for InstallationSuspendInstallationSuspendedBy +{ + fn from(value: &InstallationSuspendInstallationSuspendedBy) -> Self { + value.clone() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationSuspendedByType { + Bot, + User, + Organization, +} +impl From<&InstallationSuspendInstallationSuspendedByType> + for InstallationSuspendInstallationSuspendedByType +{ + fn from(value: &InstallationSuspendInstallationSuspendedByType) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationSuspendedByType { + fn to_string(&self) -> String { + match *self { + Self::Bot => "Bot".to_string(), + Self::User => "User".to_string(), + Self::Organization => "Organization".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationSuspendedByType { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "Bot" => Ok(Self::Bot), + "User" => Ok(Self::User), + "Organization" => Ok(Self::Organization), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationSuspendedByType { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationSuspendedByType { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationSuspendedByType { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationSuspendInstallationTargetType { + User, + Organization, +} +impl From<&InstallationSuspendInstallationTargetType> + for InstallationSuspendInstallationTargetType +{ + fn from(value: &InstallationSuspendInstallationTargetType) -> Self { + value.clone() + } +} +impl ToString for InstallationSuspendInstallationTargetType { + fn to_string(&self) -> String { + match *self { + Self::User => "User".to_string(), + Self::Organization => "Organization".to_string(), + } + } +} +impl std::str::FromStr for InstallationSuspendInstallationTargetType { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "User" => Ok(Self::User), + "Organization" => Ok(Self::Organization), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationTargetType { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationTargetType { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationTargetType { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(untagged)] +pub enum InstallationSuspendInstallationUpdatedAt { + Variant0(chrono::DateTime), + Variant1(i64), +} +impl From<&InstallationSuspendInstallationUpdatedAt> for InstallationSuspendInstallationUpdatedAt { + fn from(value: &InstallationSuspendInstallationUpdatedAt) -> Self { + value.clone() + } +} +impl std::str::FromStr for InstallationSuspendInstallationUpdatedAt { + type Err = &'static str; + fn from_str(value: &str) -> Result { + if let Ok(v) = value.parse() { + Ok(Self::Variant0(v)) + } else if let Ok(v) = value.parse() { + Ok(Self::Variant1(v)) + } else { + Err("string conversion failed for all variants") + } + } +} +impl std::convert::TryFrom<&str> for InstallationSuspendInstallationUpdatedAt { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationSuspendInstallationUpdatedAt { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationSuspendInstallationUpdatedAt { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +impl ToString for InstallationSuspendInstallationUpdatedAt { + fn to_string(&self) -> String { + match self { + Self::Variant0(x) => x.to_string(), + Self::Variant1(x) => x.to_string(), + } + } +} +impl From> for InstallationSuspendInstallationUpdatedAt { + fn from(value: chrono::DateTime) -> Self { + Self::Variant0(value) + } +} +impl From for InstallationSuspendInstallationUpdatedAt { + fn from(value: i64) -> Self { + Self::Variant1(value) + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct InstallationSuspendRepositoriesItem { + pub full_name: String, + #[doc = "Unique identifier of the repository"] + pub id: i64, + #[doc = "The name of the repository."] + pub name: String, + pub node_id: String, + #[doc = "Whether the repository is private or public."] + pub private: bool, } impl From<&InstallationSuspendRepositoriesItem> for InstallationSuspendRepositoriesItem { fn from(value: &InstallationSuspendRepositoriesItem) -> Self { @@ -12603,46 +16371,5424 @@ impl From<&InstallationSuspendRepositoriesItem> for InstallationSuspendRepositor } } #[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] -pub enum InstallationTargetType { - User, - Organization, +pub enum InstallationTargetType { + User, + Organization, +} +impl From<&InstallationTargetType> for InstallationTargetType { + fn from(value: &InstallationTargetType) -> Self { + value.clone() + } +} +impl ToString for InstallationTargetType { + fn to_string(&self) -> String { + match *self { + Self::User => "User".to_string(), + Self::Organization => "Organization".to_string(), + } + } +} +impl std::str::FromStr for InstallationTargetType { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "User" => Ok(Self::User), + "Organization" => Ok(Self::Organization), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationTargetType { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationTargetType { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationTargetType { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct InstallationUnsuspend { + pub action: InstallationUnsuspendAction, + pub installation: InstallationUnsuspendInstallation, + #[doc = "An array of repository objects that the installation can access."] + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub repositories: Vec, + #[serde(default)] + pub requester: (), + pub sender: User, +} +impl From<&InstallationUnsuspend> for InstallationUnsuspend { + fn from(value: &InstallationUnsuspend) -> Self { + value.clone() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendAction { + #[serde(rename = "unsuspend")] + Unsuspend, +} +impl From<&InstallationUnsuspendAction> for InstallationUnsuspendAction { + fn from(value: &InstallationUnsuspendAction) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendAction { + fn to_string(&self) -> String { + match *self { + Self::Unsuspend => "unsuspend".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendAction { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "unsuspend" => Ok(Self::Unsuspend), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendAction { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendAction { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendAction { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct InstallationUnsuspendInstallation { + pub access_tokens_url: String, + pub account: User, + pub app_id: i64, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub app_slug: Option, + pub created_at: InstallationUnsuspendInstallationCreatedAt, + pub events: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub has_multiple_single_files: Option, + pub html_url: String, + #[doc = "The ID of the installation."] + pub id: i64, + pub permissions: InstallationUnsuspendInstallationPermissions, + pub repositories_url: String, + #[doc = "Describe whether all repositories have been selected or there's a selection involved"] + pub repository_selection: InstallationUnsuspendInstallationRepositorySelection, + pub single_file_name: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub single_file_paths: Vec, + pub suspended_at: (), + pub suspended_by: (), + #[doc = "The ID of the user or organization this token is being scoped to."] + pub target_id: i64, + pub target_type: InstallationUnsuspendInstallationTargetType, + pub updated_at: InstallationUnsuspendInstallationUpdatedAt, +} +impl From<&InstallationUnsuspendInstallation> for InstallationUnsuspendInstallation { + fn from(value: &InstallationUnsuspendInstallation) -> Self { + value.clone() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(untagged)] +pub enum InstallationUnsuspendInstallationCreatedAt { + Variant0(chrono::DateTime), + Variant1(i64), +} +impl From<&InstallationUnsuspendInstallationCreatedAt> + for InstallationUnsuspendInstallationCreatedAt +{ + fn from(value: &InstallationUnsuspendInstallationCreatedAt) -> Self { + value.clone() + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationCreatedAt { + type Err = &'static str; + fn from_str(value: &str) -> Result { + if let Ok(v) = value.parse() { + Ok(Self::Variant0(v)) + } else if let Ok(v) = value.parse() { + Ok(Self::Variant1(v)) + } else { + Err("string conversion failed for all variants") + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationCreatedAt { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationCreatedAt { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationCreatedAt { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +impl ToString for InstallationUnsuspendInstallationCreatedAt { + fn to_string(&self) -> String { + match self { + Self::Variant0(x) => x.to_string(), + Self::Variant1(x) => x.to_string(), + } + } +} +impl From> for InstallationUnsuspendInstallationCreatedAt { + fn from(value: chrono::DateTime) -> Self { + Self::Variant0(value) + } +} +impl From for InstallationUnsuspendInstallationCreatedAt { + fn from(value: i64) -> Self { + Self::Variant1(value) + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationEventsItem { + #[serde(rename = "check_run")] + CheckRun, + #[serde(rename = "check_suite")] + CheckSuite, + #[serde(rename = "code_scanning_alert")] + CodeScanningAlert, + #[serde(rename = "commit_comment")] + CommitComment, + #[serde(rename = "content_reference")] + ContentReference, + #[serde(rename = "create")] + Create, + #[serde(rename = "delete")] + Delete, + #[serde(rename = "deployment")] + Deployment, + #[serde(rename = "deployment_review")] + DeploymentReview, + #[serde(rename = "deployment_status")] + DeploymentStatus, + #[serde(rename = "deploy_key")] + DeployKey, + #[serde(rename = "discussion")] + Discussion, + #[serde(rename = "discussion_comment")] + DiscussionComment, + #[serde(rename = "fork")] + Fork, + #[serde(rename = "gollum")] + Gollum, + #[serde(rename = "issues")] + Issues, + #[serde(rename = "issue_comment")] + IssueComment, + #[serde(rename = "label")] + Label, + #[serde(rename = "member")] + Member, + #[serde(rename = "membership")] + Membership, + #[serde(rename = "merge_queue_entry")] + MergeQueueEntry, + #[serde(rename = "milestone")] + Milestone, + #[serde(rename = "organization")] + Organization, + #[serde(rename = "org_block")] + OrgBlock, + #[serde(rename = "page_build")] + PageBuild, + #[serde(rename = "project")] + Project, + #[serde(rename = "project_card")] + ProjectCard, + #[serde(rename = "project_column")] + ProjectColumn, + #[serde(rename = "public")] + Public, + #[serde(rename = "pull_request")] + PullRequest, + #[serde(rename = "pull_request_review")] + PullRequestReview, + #[serde(rename = "pull_request_review_comment")] + PullRequestReviewComment, + #[serde(rename = "push")] + Push, + #[serde(rename = "registry_package")] + RegistryPackage, + #[serde(rename = "release")] + Release, + #[serde(rename = "repository")] + Repository, + #[serde(rename = "repository_dispatch")] + RepositoryDispatch, + #[serde(rename = "secret_scanning_alert")] + SecretScanningAlert, + #[serde(rename = "star")] + Star, + #[serde(rename = "status")] + Status, + #[serde(rename = "team")] + Team, + #[serde(rename = "team_add")] + TeamAdd, + #[serde(rename = "watch")] + Watch, + #[serde(rename = "workflow_dispatch")] + WorkflowDispatch, + #[serde(rename = "workflow_run")] + WorkflowRun, +} +impl From<&InstallationUnsuspendInstallationEventsItem> + for InstallationUnsuspendInstallationEventsItem +{ + fn from(value: &InstallationUnsuspendInstallationEventsItem) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationEventsItem { + fn to_string(&self) -> String { + match *self { + Self::CheckRun => "check_run".to_string(), + Self::CheckSuite => "check_suite".to_string(), + Self::CodeScanningAlert => "code_scanning_alert".to_string(), + Self::CommitComment => "commit_comment".to_string(), + Self::ContentReference => "content_reference".to_string(), + Self::Create => "create".to_string(), + Self::Delete => "delete".to_string(), + Self::Deployment => "deployment".to_string(), + Self::DeploymentReview => "deployment_review".to_string(), + Self::DeploymentStatus => "deployment_status".to_string(), + Self::DeployKey => "deploy_key".to_string(), + Self::Discussion => "discussion".to_string(), + Self::DiscussionComment => "discussion_comment".to_string(), + Self::Fork => "fork".to_string(), + Self::Gollum => "gollum".to_string(), + Self::Issues => "issues".to_string(), + Self::IssueComment => "issue_comment".to_string(), + Self::Label => "label".to_string(), + Self::Member => "member".to_string(), + Self::Membership => "membership".to_string(), + Self::MergeQueueEntry => "merge_queue_entry".to_string(), + Self::Milestone => "milestone".to_string(), + Self::Organization => "organization".to_string(), + Self::OrgBlock => "org_block".to_string(), + Self::PageBuild => "page_build".to_string(), + Self::Project => "project".to_string(), + Self::ProjectCard => "project_card".to_string(), + Self::ProjectColumn => "project_column".to_string(), + Self::Public => "public".to_string(), + Self::PullRequest => "pull_request".to_string(), + Self::PullRequestReview => "pull_request_review".to_string(), + Self::PullRequestReviewComment => "pull_request_review_comment".to_string(), + Self::Push => "push".to_string(), + Self::RegistryPackage => "registry_package".to_string(), + Self::Release => "release".to_string(), + Self::Repository => "repository".to_string(), + Self::RepositoryDispatch => "repository_dispatch".to_string(), + Self::SecretScanningAlert => "secret_scanning_alert".to_string(), + Self::Star => "star".to_string(), + Self::Status => "status".to_string(), + Self::Team => "team".to_string(), + Self::TeamAdd => "team_add".to_string(), + Self::Watch => "watch".to_string(), + Self::WorkflowDispatch => "workflow_dispatch".to_string(), + Self::WorkflowRun => "workflow_run".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationEventsItem { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "check_run" => Ok(Self::CheckRun), + "check_suite" => Ok(Self::CheckSuite), + "code_scanning_alert" => Ok(Self::CodeScanningAlert), + "commit_comment" => Ok(Self::CommitComment), + "content_reference" => Ok(Self::ContentReference), + "create" => Ok(Self::Create), + "delete" => Ok(Self::Delete), + "deployment" => Ok(Self::Deployment), + "deployment_review" => Ok(Self::DeploymentReview), + "deployment_status" => Ok(Self::DeploymentStatus), + "deploy_key" => Ok(Self::DeployKey), + "discussion" => Ok(Self::Discussion), + "discussion_comment" => Ok(Self::DiscussionComment), + "fork" => Ok(Self::Fork), + "gollum" => Ok(Self::Gollum), + "issues" => Ok(Self::Issues), + "issue_comment" => Ok(Self::IssueComment), + "label" => Ok(Self::Label), + "member" => Ok(Self::Member), + "membership" => Ok(Self::Membership), + "merge_queue_entry" => Ok(Self::MergeQueueEntry), + "milestone" => Ok(Self::Milestone), + "organization" => Ok(Self::Organization), + "org_block" => Ok(Self::OrgBlock), + "page_build" => Ok(Self::PageBuild), + "project" => Ok(Self::Project), + "project_card" => Ok(Self::ProjectCard), + "project_column" => Ok(Self::ProjectColumn), + "public" => Ok(Self::Public), + "pull_request" => Ok(Self::PullRequest), + "pull_request_review" => Ok(Self::PullRequestReview), + "pull_request_review_comment" => Ok(Self::PullRequestReviewComment), + "push" => Ok(Self::Push), + "registry_package" => Ok(Self::RegistryPackage), + "release" => Ok(Self::Release), + "repository" => Ok(Self::Repository), + "repository_dispatch" => Ok(Self::RepositoryDispatch), + "secret_scanning_alert" => Ok(Self::SecretScanningAlert), + "star" => Ok(Self::Star), + "status" => Ok(Self::Status), + "team" => Ok(Self::Team), + "team_add" => Ok(Self::TeamAdd), + "watch" => Ok(Self::Watch), + "workflow_dispatch" => Ok(Self::WorkflowDispatch), + "workflow_run" => Ok(Self::WorkflowRun), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationEventsItem { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationEventsItem { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationEventsItem { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct InstallationUnsuspendInstallationPermissions { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub actions: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub administration: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub checks: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub content_references: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub contents: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub deployments: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub discussions: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub emails: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub environments: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub issues: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub members: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub metadata: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub organization_administration: + Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub organization_events: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub organization_hooks: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub organization_packages: + Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub organization_plan: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub organization_projects: + Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub organization_secrets: + Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub organization_self_hosted_runners: + Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub organization_user_blocking: + Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub packages: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub pages: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub pull_requests: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub repository_hooks: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub repository_projects: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub secret_scanning_alerts: + Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub secrets: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub security_events: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub security_scanning_alert: + Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub single_file: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub statuses: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub team_discussions: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub vulnerability_alerts: + Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub workflows: Option, +} +impl From<&InstallationUnsuspendInstallationPermissions> + for InstallationUnsuspendInstallationPermissions +{ + fn from(value: &InstallationUnsuspendInstallationPermissions) -> Self { + value.clone() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsActions { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsActions> + for InstallationUnsuspendInstallationPermissionsActions +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsActions) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsActions { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsActions { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsActions { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationPermissionsActions { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationPermissionsActions { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsAdministration { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsAdministration> + for InstallationUnsuspendInstallationPermissionsAdministration +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsAdministration) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsAdministration { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsAdministration { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsAdministration { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationPermissionsAdministration { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationPermissionsAdministration { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsChecks { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsChecks> + for InstallationUnsuspendInstallationPermissionsChecks +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsChecks) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsChecks { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsChecks { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsChecks { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationPermissionsChecks { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationPermissionsChecks { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsContentReferences { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsContentReferences> + for InstallationUnsuspendInstallationPermissionsContentReferences +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsContentReferences) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsContentReferences { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsContentReferences { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsContentReferences { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationUnsuspendInstallationPermissionsContentReferences +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationUnsuspendInstallationPermissionsContentReferences +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsContents { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsContents> + for InstallationUnsuspendInstallationPermissionsContents +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsContents) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsContents { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsContents { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsContents { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationPermissionsContents { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationPermissionsContents { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsDeployments { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsDeployments> + for InstallationUnsuspendInstallationPermissionsDeployments +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsDeployments) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsDeployments { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsDeployments { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsDeployments { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationPermissionsDeployments { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationPermissionsDeployments { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsDiscussions { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsDiscussions> + for InstallationUnsuspendInstallationPermissionsDiscussions +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsDiscussions) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsDiscussions { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsDiscussions { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsDiscussions { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationPermissionsDiscussions { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationPermissionsDiscussions { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsEmails { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsEmails> + for InstallationUnsuspendInstallationPermissionsEmails +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsEmails) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsEmails { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsEmails { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsEmails { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationPermissionsEmails { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationPermissionsEmails { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsEnvironments { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsEnvironments> + for InstallationUnsuspendInstallationPermissionsEnvironments +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsEnvironments) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsEnvironments { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsEnvironments { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsEnvironments { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationPermissionsEnvironments { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationPermissionsEnvironments { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsIssues { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsIssues> + for InstallationUnsuspendInstallationPermissionsIssues +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsIssues) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsIssues { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsIssues { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsIssues { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationPermissionsIssues { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationPermissionsIssues { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsMembers { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsMembers> + for InstallationUnsuspendInstallationPermissionsMembers +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsMembers) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsMembers { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsMembers { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsMembers { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationPermissionsMembers { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationPermissionsMembers { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsMetadata { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsMetadata> + for InstallationUnsuspendInstallationPermissionsMetadata +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsMetadata) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsMetadata { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsMetadata { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsMetadata { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationPermissionsMetadata { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationPermissionsMetadata { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsOrganizationAdministration { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsOrganizationAdministration> + for InstallationUnsuspendInstallationPermissionsOrganizationAdministration +{ + fn from( + value: &InstallationUnsuspendInstallationPermissionsOrganizationAdministration, + ) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsOrganizationAdministration { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsOrganizationAdministration { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> + for InstallationUnsuspendInstallationPermissionsOrganizationAdministration +{ + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationUnsuspendInstallationPermissionsOrganizationAdministration +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationUnsuspendInstallationPermissionsOrganizationAdministration +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsOrganizationEvents { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsOrganizationEvents> + for InstallationUnsuspendInstallationPermissionsOrganizationEvents +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsOrganizationEvents) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsOrganizationEvents { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsOrganizationEvents { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> + for InstallationUnsuspendInstallationPermissionsOrganizationEvents +{ + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationUnsuspendInstallationPermissionsOrganizationEvents +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationUnsuspendInstallationPermissionsOrganizationEvents +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsOrganizationHooks { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsOrganizationHooks> + for InstallationUnsuspendInstallationPermissionsOrganizationHooks +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsOrganizationHooks) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsOrganizationHooks { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsOrganizationHooks { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsOrganizationHooks { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationUnsuspendInstallationPermissionsOrganizationHooks +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationUnsuspendInstallationPermissionsOrganizationHooks +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsOrganizationPackages { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsOrganizationPackages> + for InstallationUnsuspendInstallationPermissionsOrganizationPackages +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsOrganizationPackages) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsOrganizationPackages { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsOrganizationPackages { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> + for InstallationUnsuspendInstallationPermissionsOrganizationPackages +{ + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationUnsuspendInstallationPermissionsOrganizationPackages +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationUnsuspendInstallationPermissionsOrganizationPackages +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsOrganizationPlan { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsOrganizationPlan> + for InstallationUnsuspendInstallationPermissionsOrganizationPlan +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsOrganizationPlan) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsOrganizationPlan { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsOrganizationPlan { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsOrganizationPlan { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationUnsuspendInstallationPermissionsOrganizationPlan +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationUnsuspendInstallationPermissionsOrganizationPlan +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsOrganizationProjects { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsOrganizationProjects> + for InstallationUnsuspendInstallationPermissionsOrganizationProjects +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsOrganizationProjects) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsOrganizationProjects { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsOrganizationProjects { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> + for InstallationUnsuspendInstallationPermissionsOrganizationProjects +{ + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationUnsuspendInstallationPermissionsOrganizationProjects +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationUnsuspendInstallationPermissionsOrganizationProjects +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsOrganizationSecrets { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsOrganizationSecrets> + for InstallationUnsuspendInstallationPermissionsOrganizationSecrets +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsOrganizationSecrets) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsOrganizationSecrets { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsOrganizationSecrets { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> + for InstallationUnsuspendInstallationPermissionsOrganizationSecrets +{ + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationUnsuspendInstallationPermissionsOrganizationSecrets +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationUnsuspendInstallationPermissionsOrganizationSecrets +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsOrganizationSelfHostedRunners { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsOrganizationSelfHostedRunners> + for InstallationUnsuspendInstallationPermissionsOrganizationSelfHostedRunners +{ + fn from( + value: &InstallationUnsuspendInstallationPermissionsOrganizationSelfHostedRunners, + ) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsOrganizationSelfHostedRunners { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr + for InstallationUnsuspendInstallationPermissionsOrganizationSelfHostedRunners +{ + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> + for InstallationUnsuspendInstallationPermissionsOrganizationSelfHostedRunners +{ + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationUnsuspendInstallationPermissionsOrganizationSelfHostedRunners +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationUnsuspendInstallationPermissionsOrganizationSelfHostedRunners +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsOrganizationUserBlocking { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsOrganizationUserBlocking> + for InstallationUnsuspendInstallationPermissionsOrganizationUserBlocking +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsOrganizationUserBlocking) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsOrganizationUserBlocking { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsOrganizationUserBlocking { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> + for InstallationUnsuspendInstallationPermissionsOrganizationUserBlocking +{ + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationUnsuspendInstallationPermissionsOrganizationUserBlocking +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationUnsuspendInstallationPermissionsOrganizationUserBlocking +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsPackages { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsPackages> + for InstallationUnsuspendInstallationPermissionsPackages +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsPackages) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsPackages { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsPackages { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsPackages { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationPermissionsPackages { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationPermissionsPackages { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsPages { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsPages> + for InstallationUnsuspendInstallationPermissionsPages +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsPages) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsPages { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsPages { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsPages { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationPermissionsPages { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationPermissionsPages { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsPullRequests { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsPullRequests> + for InstallationUnsuspendInstallationPermissionsPullRequests +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsPullRequests) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsPullRequests { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsPullRequests { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsPullRequests { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationPermissionsPullRequests { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationPermissionsPullRequests { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsRepositoryHooks { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsRepositoryHooks> + for InstallationUnsuspendInstallationPermissionsRepositoryHooks +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsRepositoryHooks) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsRepositoryHooks { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsRepositoryHooks { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsRepositoryHooks { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationUnsuspendInstallationPermissionsRepositoryHooks +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationPermissionsRepositoryHooks { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsRepositoryProjects { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsRepositoryProjects> + for InstallationUnsuspendInstallationPermissionsRepositoryProjects +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsRepositoryProjects) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsRepositoryProjects { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsRepositoryProjects { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> + for InstallationUnsuspendInstallationPermissionsRepositoryProjects +{ + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationUnsuspendInstallationPermissionsRepositoryProjects +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationUnsuspendInstallationPermissionsRepositoryProjects +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsSecretScanningAlerts { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsSecretScanningAlerts> + for InstallationUnsuspendInstallationPermissionsSecretScanningAlerts +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsSecretScanningAlerts) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsSecretScanningAlerts { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsSecretScanningAlerts { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> + for InstallationUnsuspendInstallationPermissionsSecretScanningAlerts +{ + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationUnsuspendInstallationPermissionsSecretScanningAlerts +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationUnsuspendInstallationPermissionsSecretScanningAlerts +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsSecrets { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsSecrets> + for InstallationUnsuspendInstallationPermissionsSecrets +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsSecrets) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsSecrets { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsSecrets { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsSecrets { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationPermissionsSecrets { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationPermissionsSecrets { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsSecurityEvents { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsSecurityEvents> + for InstallationUnsuspendInstallationPermissionsSecurityEvents +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsSecurityEvents) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsSecurityEvents { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsSecurityEvents { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsSecurityEvents { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationPermissionsSecurityEvents { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationPermissionsSecurityEvents { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsSecurityScanningAlert { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsSecurityScanningAlert> + for InstallationUnsuspendInstallationPermissionsSecurityScanningAlert +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsSecurityScanningAlert) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsSecurityScanningAlert { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsSecurityScanningAlert { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> + for InstallationUnsuspendInstallationPermissionsSecurityScanningAlert +{ + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationUnsuspendInstallationPermissionsSecurityScanningAlert +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationUnsuspendInstallationPermissionsSecurityScanningAlert +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsSingleFile { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsSingleFile> + for InstallationUnsuspendInstallationPermissionsSingleFile +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsSingleFile) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsSingleFile { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsSingleFile { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsSingleFile { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationPermissionsSingleFile { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationPermissionsSingleFile { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsStatuses { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsStatuses> + for InstallationUnsuspendInstallationPermissionsStatuses +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsStatuses) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsStatuses { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsStatuses { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsStatuses { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationPermissionsStatuses { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationPermissionsStatuses { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsTeamDiscussions { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsTeamDiscussions> + for InstallationUnsuspendInstallationPermissionsTeamDiscussions +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsTeamDiscussions) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsTeamDiscussions { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsTeamDiscussions { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsTeamDiscussions { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationUnsuspendInstallationPermissionsTeamDiscussions +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationPermissionsTeamDiscussions { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsVulnerabilityAlerts { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsVulnerabilityAlerts> + for InstallationUnsuspendInstallationPermissionsVulnerabilityAlerts +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsVulnerabilityAlerts) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsVulnerabilityAlerts { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsVulnerabilityAlerts { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> + for InstallationUnsuspendInstallationPermissionsVulnerabilityAlerts +{ + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> + for InstallationUnsuspendInstallationPermissionsVulnerabilityAlerts +{ + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom + for InstallationUnsuspendInstallationPermissionsVulnerabilityAlerts +{ + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationPermissionsWorkflows { + #[serde(rename = "read")] + Read, + #[serde(rename = "write")] + Write, +} +impl From<&InstallationUnsuspendInstallationPermissionsWorkflows> + for InstallationUnsuspendInstallationPermissionsWorkflows +{ + fn from(value: &InstallationUnsuspendInstallationPermissionsWorkflows) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationPermissionsWorkflows { + fn to_string(&self) -> String { + match *self { + Self::Read => "read".to_string(), + Self::Write => "write".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationPermissionsWorkflows { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "read" => Ok(Self::Read), + "write" => Ok(Self::Write), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationPermissionsWorkflows { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationPermissionsWorkflows { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationPermissionsWorkflows { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[doc = "Describe whether all repositories have been selected or there's a selection involved"] +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationRepositorySelection { + #[serde(rename = "all")] + All, + #[serde(rename = "selected")] + Selected, +} +impl From<&InstallationUnsuspendInstallationRepositorySelection> + for InstallationUnsuspendInstallationRepositorySelection +{ + fn from(value: &InstallationUnsuspendInstallationRepositorySelection) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationRepositorySelection { + fn to_string(&self) -> String { + match *self { + Self::All => "all".to_string(), + Self::Selected => "selected".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationRepositorySelection { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "all" => Ok(Self::All), + "selected" => Ok(Self::Selected), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationRepositorySelection { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationRepositorySelection { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationRepositorySelection { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +pub enum InstallationUnsuspendInstallationTargetType { + User, + Organization, +} +impl From<&InstallationUnsuspendInstallationTargetType> + for InstallationUnsuspendInstallationTargetType +{ + fn from(value: &InstallationUnsuspendInstallationTargetType) -> Self { + value.clone() + } +} +impl ToString for InstallationUnsuspendInstallationTargetType { + fn to_string(&self) -> String { + match *self { + Self::User => "User".to_string(), + Self::Organization => "Organization".to_string(), + } + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationTargetType { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "User" => Ok(Self::User), + "Organization" => Ok(Self::Organization), + _ => Err("invalid value"), + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationTargetType { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationTargetType { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationTargetType { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(untagged)] +pub enum InstallationUnsuspendInstallationUpdatedAt { + Variant0(chrono::DateTime), + Variant1(i64), +} +impl From<&InstallationUnsuspendInstallationUpdatedAt> + for InstallationUnsuspendInstallationUpdatedAt +{ + fn from(value: &InstallationUnsuspendInstallationUpdatedAt) -> Self { + value.clone() + } +} +impl std::str::FromStr for InstallationUnsuspendInstallationUpdatedAt { + type Err = &'static str; + fn from_str(value: &str) -> Result { + if let Ok(v) = value.parse() { + Ok(Self::Variant0(v)) + } else if let Ok(v) = value.parse() { + Ok(Self::Variant1(v)) + } else { + Err("string conversion failed for all variants") + } + } +} +impl std::convert::TryFrom<&str> for InstallationUnsuspendInstallationUpdatedAt { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUnsuspendInstallationUpdatedAt { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUnsuspendInstallationUpdatedAt { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +impl ToString for InstallationUnsuspendInstallationUpdatedAt { + fn to_string(&self) -> String { + match self { + Self::Variant0(x) => x.to_string(), + Self::Variant1(x) => x.to_string(), + } + } +} +impl From> for InstallationUnsuspendInstallationUpdatedAt { + fn from(value: chrono::DateTime) -> Self { + Self::Variant0(value) + } +} +impl From for InstallationUnsuspendInstallationUpdatedAt { + fn from(value: i64) -> Self { + Self::Variant1(value) + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct InstallationUnsuspendRepositoriesItem { + pub full_name: String, + #[doc = "Unique identifier of the repository"] + pub id: i64, + #[doc = "The name of the repository."] + pub name: String, + pub node_id: String, + #[doc = "Whether the repository is private or public."] + pub private: bool, +} +impl From<&InstallationUnsuspendRepositoriesItem> for InstallationUnsuspendRepositoriesItem { + fn from(value: &InstallationUnsuspendRepositoriesItem) -> Self { + value.clone() + } +} +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(untagged)] +pub enum InstallationUpdatedAt { + Variant0(chrono::DateTime), + Variant1(i64), +} +impl From<&InstallationUpdatedAt> for InstallationUpdatedAt { + fn from(value: &InstallationUpdatedAt) -> Self { + value.clone() + } +} +impl std::str::FromStr for InstallationUpdatedAt { + type Err = &'static str; + fn from_str(value: &str) -> Result { + if let Ok(v) = value.parse() { + Ok(Self::Variant0(v)) + } else if let Ok(v) = value.parse() { + Ok(Self::Variant1(v)) + } else { + Err("string conversion failed for all variants") + } + } +} +impl std::convert::TryFrom<&str> for InstallationUpdatedAt { + type Error = &'static str; + fn try_from(value: &str) -> Result { + value.parse() + } +} +impl std::convert::TryFrom<&String> for InstallationUpdatedAt { + type Error = &'static str; + fn try_from(value: &String) -> Result { + value.parse() + } +} +impl std::convert::TryFrom for InstallationUpdatedAt { + type Error = &'static str; + fn try_from(value: String) -> Result { + value.parse() + } +} +impl ToString for InstallationUpdatedAt { + fn to_string(&self) -> String { + match self { + Self::Variant0(x) => x.to_string(), + Self::Variant1(x) => x.to_string(), + } + } +} +impl From> for InstallationUpdatedAt { + fn from(value: chrono::DateTime) -> Self { + Self::Variant0(value) + } +} +impl From for InstallationUpdatedAt { + fn from(value: i64) -> Self { + Self::Variant1(value) + } +} +#[doc = "The [issue](https://docs.github.com/en/rest/reference/issues) itself."] +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct Issue { + pub active_lock_reason: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub assignee: Option, + pub assignees: Vec, + pub author_association: AuthorAssociation, + #[doc = "Contents of the issue"] + pub body: Option, + pub closed_at: Option>, + pub comments: i64, + pub comments_url: String, + pub created_at: chrono::DateTime, + pub events_url: String, + pub html_url: String, + pub id: i64, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub labels: Vec