// // MetadataOptions.cs // // Author: Jeffrey Stedfast // // Copyright (c) 2013-2020 .NET Foundation and Contributors // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // using System; namespace MailKit { /// /// A set of options to use when requesting metadata. /// /// /// A set of options to use when requesting metadata. /// public class MetadataOptions { int depth; /// /// Initializes a new instance of the class. /// /// /// Creates a new set of options to use when requesting metadata. /// public MetadataOptions () { } /// /// Get or set the depth. /// /// /// When the option is specified, it extends the list of metadata tag /// values returned by the GetMetadata() call. For each specified in the /// the GetMetadata() call, the method returns the value of the specified metadata tag (if it exists), /// plus all metadata tags below the specified entry up to the specified depth. /// Three values are allowed for : /// 0 - no entries below the specified metadata tag are returned. /// 1 - only entries immediately below the specified metadata tag are returned. /// - all entries below the specified metadata tag are returned. /// Thus, a depth of 1 for a tag entry of "/a" will match "/a" as well as its children /// entries (e.g., "/a/b"), but will not match grandchildren entries (e.g., "/a/b/c"). /// If the Depth option is not specified, this is the same as specifying 0. /// /// The depth. /// /// is out of range. /// public int Depth { get { return depth; } set { if (!(value == 0 || value == 1 || value == int.MaxValue)) throw new ArgumentOutOfRangeException (nameof (value)); depth = value; } } /// /// Get or set the max size of the metadata tags to request. /// /// /// When specified, the property is used to filter the metadata tags /// returned by the GetMetadata() call to only those with a value shorter than the max size /// specified. /// /// The size of the max. public uint? MaxSize { get; set; } /// /// Get the length of the longest metadata value. /// /// /// If the property is specified, once the GetMetadata() call returns, /// the property will be set to the length of the longest metadata /// value that exceeded the limit, otherwise a value of 0 will /// be set. /// /// The length of the longest metadata value that exceeded the max size. public uint LongEntries { get; set; } } }