Ejemplo n.º 1
0
        internal static GitHub DeserializeGitHub(JsonElement element)
        {
            Optional <bool> enabled = default;
            Optional <ClientRegistration> registration = default;
            Optional <LoginScopes>        login        = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("enabled"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    enabled = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("registration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    registration = ClientRegistration.DeserializeClientRegistration(property.Value);
                    continue;
                }
                if (property.NameEquals("login"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    login = LoginScopes.DeserializeLoginScopes(property.Value);
                    continue;
                }
            }
            return(new GitHub(Optional.ToNullable(enabled), registration.Value, login.Value));
        }
Ejemplo n.º 2
0
 internal GitHub(bool?enabled, ClientRegistration registration, LoginScopes login)
 {
     Enabled      = enabled;
     Registration = registration;
     Login        = login;
 }