public LibraryResource(LibraryResourceProperties properties)
        {
            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            Properties = properties;
        }
Esempio n. 2
0
        internal static LibraryResource DeserializeLibraryResource(JsonElement element)
        {
            LibraryResourceProperties properties = default;
            Optional <string>         etag       = default;
            Optional <string>         id         = default;
            Optional <string>         name       = default;
            Optional <string>         type       = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("properties"))
                {
                    properties = LibraryResourceProperties.DeserializeLibraryResourceProperties(property.Value);
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
            }
            return(new LibraryResource(id.Value, name.Value, type.Value, etag.Value, properties));
        }
 internal LibraryResource(string id, string name, string type, string etag, LibraryResourceProperties properties) : base(id, name, type, etag)
 {
     Properties = properties;
 }