Example #1
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="CreateFileRequestArgs" />
        /// class.</para>
        /// </summary>
        /// <param name="title">The title of the file request. Must not be empty.</param>
        /// <param name="destination">The path of the folder in the Dropbox where uploaded
        /// files will be sent. For apps with the app folder permission, this will be relative
        /// to the app folder.</param>
        /// <param name="deadline">The deadline for the file request. Deadlines can only be set
        /// by Professional and Business accounts.</param>
        /// <param name="open">Whether or not the file request should be open. If the file
        /// request is closed, it will not accept any file submissions, but it can be opened
        /// later.</param>
        /// <param name="description">A description of the file request.</param>
        public CreateFileRequestArgs(string title,
                                     string destination,
                                     FileRequestDeadline deadline = null,
                                     bool open          = true,
                                     string description = null)
        {
            if (title == null)
            {
                throw new sys.ArgumentNullException("title");
            }
            if (title.Length < 1)
            {
                throw new sys.ArgumentOutOfRangeException("title", "Length should be at least 1");
            }

            if (destination == null)
            {
                throw new sys.ArgumentNullException("destination");
            }
            if (!re.Regex.IsMatch(destination, @"\A(?:/(.|[\r\n])*)\z"))
            {
                throw new sys.ArgumentOutOfRangeException("destination", @"Value should match pattern '\A(?:/(.|[\r\n])*)\z'");
            }

            this.Title       = title;
            this.Destination = destination;
            this.Deadline    = deadline;
            this.Open        = open;
            this.Description = description;
        }
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="FileRequest" /> class.</para>
        /// </summary>
        /// <param name="id">The ID of the file request.</param>
        /// <param name="url">The URL of the file request.</param>
        /// <param name="title">The title of the file request.</param>
        /// <param name="created">When this file request was created.</param>
        /// <param name="isOpen">Whether or not the file request is open. If the file request
        /// is closed, it will not accept any more file submissions.</param>
        /// <param name="fileCount">The number of files this file request has received.</param>
        /// <param name="destination">The path of the folder in the Dropbox where uploaded
        /// files will be sent. This can be <c>null</c> if the destination was removed. For
        /// apps with the app folder permission, this will be relative to the app
        /// folder.</param>
        /// <param name="deadline">The deadline for this file request. Only set if the request
        /// has a deadline.</param>
        /// <param name="description">A description of the file request.</param>
        public FileRequest(string id,
                           string url,
                           string title,
                           sys.DateTime created,
                           bool isOpen,
                           long fileCount,
                           string destination           = null,
                           FileRequestDeadline deadline = null,
                           string description           = null)
        {
            if (id == null)
            {
                throw new sys.ArgumentNullException("id");
            }
            if (id.Length < 1)
            {
                throw new sys.ArgumentOutOfRangeException("id", "Length should be at least 1");
            }
            if (!re.Regex.IsMatch(id, @"\A(?:[-_0-9a-zA-Z]+)\z"))
            {
                throw new sys.ArgumentOutOfRangeException("id", @"Value should match pattern '\A(?:[-_0-9a-zA-Z]+)\z'");
            }

            if (url == null)
            {
                throw new sys.ArgumentNullException("url");
            }
            if (url.Length < 1)
            {
                throw new sys.ArgumentOutOfRangeException("url", "Length should be at least 1");
            }

            if (title == null)
            {
                throw new sys.ArgumentNullException("title");
            }
            if (title.Length < 1)
            {
                throw new sys.ArgumentOutOfRangeException("title", "Length should be at least 1");
            }

            if (destination != null)
            {
                if (!re.Regex.IsMatch(destination, @"\A(?:/(.|[\r\n])*)\z"))
                {
                    throw new sys.ArgumentOutOfRangeException("destination", @"Value should match pattern '\A(?:/(.|[\r\n])*)\z'");
                }
            }

            this.Id          = id;
            this.Url         = url;
            this.Title       = title;
            this.Created     = created;
            this.IsOpen      = isOpen;
            this.FileCount   = fileCount;
            this.Destination = destination;
            this.Deadline    = deadline;
            this.Description = description;
        }
Example #3
0
 /// <summary>
 /// <para>Initializes a new instance of the <see cref="Update" /> class.</para>
 /// </summary>
 /// <param name="value">The value</param>
 public Update(FileRequestDeadline value)
 {
     this.Value = value;
 }