/// <summary>
        /// <para>Initializes a new instance of the <see cref="FileLinkMetadata" />
        /// class.</para>
        /// </summary>
        /// <param name="url">URL of the shared link.</param>
        /// <param name="name">The linked file name (including extension). This never contains
        /// a slash.</param>
        /// <param name="linkPermissions">The link's access permissions.</param>
        /// <param name="clientModified">The modification time set by the desktop client when
        /// the file was added to Dropbox. Since this time is not verified (the Dropbox server
        /// stores whatever the desktop client sends up), this should only be used for display
        /// purposes (such as sorting) and not, for example, to determine if a file has changed
        /// or not.</param>
        /// <param name="serverModified">The last time the file was modified on
        /// Dropbox.</param>
        /// <param name="rev">A unique identifier for the current revision of a file. This
        /// field is the same rev as elsewhere in the API and can be used to detect changes and
        /// avoid conflicts.</param>
        /// <param name="size">The file size in bytes.</param>
        /// <param name="id">A unique identifier for the linked file.</param>
        /// <param name="expires">Expiration time, if set. By default the link won't
        /// expire.</param>
        /// <param name="pathLower">The lowercased full path in the user's Dropbox. This always
        /// starts with a slash. This field will only be present only if the linked file is in
        /// the authenticated user's  dropbox.</param>
        /// <param name="teamMemberInfo">The team membership information of the link's owner.
        /// This field will only be present  if the link's owner is a team member.</param>
        /// <param name="contentOwnerTeamInfo">The team information of the content's owner.
        /// This field will only be present if the content's owner is a team member and the
        /// content's owner team is different from the link's owner team.</param>
        public FileLinkMetadata(string url,
                                string name,
                                LinkPermissions linkPermissions,
                                sys.DateTime clientModified,
                                sys.DateTime serverModified,
                                string rev,
                                ulong size,
                                string id                     = null,
                                sys.DateTime?expires          = null,
                                string pathLower              = null,
                                TeamMemberInfo teamMemberInfo = null,
                                Dropbox.Api.Users.Team contentOwnerTeamInfo = null)
            : base(url, name, linkPermissions, id, expires, pathLower, teamMemberInfo, contentOwnerTeamInfo)
        {
            if (rev == null)
            {
                throw new sys.ArgumentNullException("rev");
            }
            if (rev.Length < 9)
            {
                throw new sys.ArgumentOutOfRangeException("rev", "Length should be at least 9");
            }
            if (!re.Regex.IsMatch(rev, @"\A(?:[0-9a-f]+)\z"))
            {
                throw new sys.ArgumentOutOfRangeException("rev", @"Value should match pattern '\A(?:[0-9a-f]+)\z'");
            }

            this.ClientModified = clientModified;
            this.ServerModified = serverModified;
            this.Rev            = rev;
            this.Size           = size;
        }
Пример #2
0
 /// <summary>
 /// <para>Initializes a new instance of the <see cref="FolderLinkMetadata" />
 /// class.</para>
 /// </summary>
 /// <param name="url">URL of the shared link.</param>
 /// <param name="name">The linked file name (including extension). This never contains
 /// a slash.</param>
 /// <param name="linkPermissions">The link's access permissions.</param>
 /// <param name="id">A unique identifier for the linked file.</param>
 /// <param name="expires">Expiration time, if set. By default the link won't
 /// expire.</param>
 /// <param name="pathLower">The lowercased full path in the user's Dropbox. This always
 /// starts with a slash. This field will only be present only if the linked file is in
 /// the authenticated user's  dropbox.</param>
 /// <param name="teamMemberInfo">The team membership information of the link's owner.
 /// This field will only be present  if the link's owner is a team member.</param>
 /// <param name="contentOwnerTeamInfo">The team information of the content's owner.
 /// This field will only be present if the content's owner is a team member and the
 /// content's owner team is different from the link's owner team.</param>
 public FolderLinkMetadata(string url,
                           string name,
                           LinkPermissions linkPermissions,
                           string id                     = null,
                           sys.DateTime?expires          = null,
                           string pathLower              = null,
                           TeamMemberInfo teamMemberInfo = null,
                           Dropbox.Api.Users.Team contentOwnerTeamInfo = null)
     : base(url, name, linkPermissions, id, expires, pathLower, teamMemberInfo, contentOwnerTeamInfo)
 {
 }
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="SharedLinkMetadata" />
        /// class.</para>
        /// </summary>
        /// <param name="url">URL of the shared link.</param>
        /// <param name="name">The linked file name (including extension). This never contains
        /// a slash.</param>
        /// <param name="linkPermissions">The link's access permissions.</param>
        /// <param name="id">A unique identifier for the linked file.</param>
        /// <param name="expires">Expiration time, if set. By default the link won't
        /// expire.</param>
        /// <param name="pathLower">The lowercased full path in the user's Dropbox. This always
        /// starts with a slash. This field will only be present only if the linked file is in
        /// the authenticated user's  dropbox.</param>
        /// <param name="teamMemberInfo">The team membership information of the link's owner.
        /// This field will only be present  if the link's owner is a team member.</param>
        /// <param name="contentOwnerTeamInfo">The team information of the content's owner.
        /// This field will only be present if the content's owner is a team member and the
        /// content's owner team is different from the link's owner team.</param>
        protected SharedLinkMetadata(string url,
                                     string name,
                                     LinkPermissions linkPermissions,
                                     string id                     = null,
                                     sys.DateTime?expires          = null,
                                     string pathLower              = null,
                                     TeamMemberInfo teamMemberInfo = null,
                                     Dropbox.Api.Users.Team contentOwnerTeamInfo = null)
        {
            if (url == null)
            {
                throw new sys.ArgumentNullException("url");
            }

            if (name == null)
            {
                throw new sys.ArgumentNullException("name");
            }

            if (linkPermissions == null)
            {
                throw new sys.ArgumentNullException("linkPermissions");
            }

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

            this.Url             = url;
            this.Name            = name;
            this.LinkPermissions = linkPermissions;
            this.Id                   = id;
            this.Expires              = expires;
            this.PathLower            = pathLower;
            this.TeamMemberInfo       = teamMemberInfo;
            this.ContentOwnerTeamInfo = contentOwnerTeamInfo;
        }