示例#1
0
 internal FacebookProvider(bool?enabled, AppRegistration registration, string graphApiVersion, LoginScopes login)
 {
     Enabled         = enabled;
     Registration    = registration;
     GraphApiVersion = graphApiVersion;
     Login           = login;
 }
        internal static FacebookProvider DeserializeFacebookProvider(JsonElement element)
        {
            Optional <bool>            enabled         = default;
            Optional <AppRegistration> registration    = default;
            Optional <string>          graphApiVersion = 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 = AppRegistration.DeserializeAppRegistration(property.Value);
                    continue;
                }
                if (property.NameEquals("graphApiVersion"))
                {
                    graphApiVersion = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("login"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    login = Models.LoginScopes.DeserializeLoginScopes(property.Value);
                    continue;
                }
            }
            return(new FacebookProvider(Optional.ToNullable(enabled), registration.Value, graphApiVersion.Value, login.Value));
        }