Exemplo n.º 1
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="SharedFolderMetadata" />
        /// class.</para>
        /// </summary>
        /// <param name="accessType">The current user's access level for this shared
        /// folder.</param>
        /// <param name="isTeamFolder">Whether this folder is a <a
        /// href="https://www.dropbox.com/en/help/986">team folder</a>.</param>
        /// <param name="policy">Policies governing this shared folder.</param>
        /// <param name="name">The name of the this shared folder.</param>
        /// <param name="sharedFolderId">The ID of the shared folder.</param>
        /// <param name="permissions">Actions the current user may perform on the folder and
        /// its contents. The set of permissions corresponds to the FolderActions in the
        /// request.</param>
        /// <param name="ownerTeam">The team that owns the folder. This field is not present if
        /// the folder is not owned by a team.</param>
        /// <param name="parentSharedFolderId">The ID of the parent shared folder. This field
        /// is present only if the folder is contained within another shared folder.</param>
        /// <param name="pathLower">The lower-cased full path of this shared folder. Absent for
        /// unmounted folders.</param>
        public SharedFolderMetadata(AccessLevel accessType,
                                    bool isTeamFolder,
                                    FolderPolicy policy,
                                    string name,
                                    string sharedFolderId,
                                    col.IEnumerable <FolderPermission> permissions = null,
                                    Dropbox.Api.Users.Team ownerTeam = null,
                                    string parentSharedFolderId      = null,
                                    string pathLower = null)
            : base(accessType, isTeamFolder, policy, permissions, ownerTeam, parentSharedFolderId)
        {
            if (name == null)
            {
                throw new sys.ArgumentNullException("name");
            }

            if (sharedFolderId == null)
            {
                throw new sys.ArgumentNullException("sharedFolderId");
            }
            if (!re.Regex.IsMatch(sharedFolderId, @"\A(?:[-_0-9a-zA-Z:]+)\z"))
            {
                throw new sys.ArgumentOutOfRangeException("sharedFolderId", @"Value should match pattern '\A(?:[-_0-9a-zA-Z:]+)\z'");
            }

            this.Name           = name;
            this.SharedFolderId = sharedFolderId;
            this.PathLower      = pathLower;
        }
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="SharedFolderMetadata" />
        /// class.</para>
        /// </summary>
        /// <param name="accessType">The current user's access level for this shared
        /// folder.</param>
        /// <param name="isInsideTeamFolder">Whether this folder is inside of a team
        /// folder.</param>
        /// <param name="isTeamFolder">Whether this folder is a <a
        /// href="https://www.dropbox.com/en/help/986">team folder</a>.</param>
        /// <param name="name">The name of the this shared folder.</param>
        /// <param name="policy">Policies governing this shared folder.</param>
        /// <param name="previewUrl">URL for displaying a web preview of the shared
        /// folder.</param>
        /// <param name="sharedFolderId">The ID of the shared folder.</param>
        /// <param name="timeInvited">Timestamp indicating when the current user was invited to
        /// this shared folder.</param>
        /// <param name="ownerTeam">The team that owns the folder. This field is not present if
        /// the folder is not owned by a team.</param>
        /// <param name="parentSharedFolderId">The ID of the parent shared folder. This field
        /// is present only if the folder is contained within another shared folder.</param>
        /// <param name="pathLower">The lower-cased full path of this shared folder. Absent for
        /// unmounted folders.</param>
        /// <param name="linkMetadata">The metadata of the shared content link to this shared
        /// folder. Absent if there is no link on the folder.</param>
        /// <param name="permissions">Actions the current user may perform on the folder and
        /// its contents. The set of permissions corresponds to the FolderActions in the
        /// request.</param>
        public SharedFolderMetadata(AccessLevel accessType,
                                    bool isInsideTeamFolder,
                                    bool isTeamFolder,
                                    string name,
                                    FolderPolicy policy,
                                    string previewUrl,
                                    string sharedFolderId,
                                    sys.DateTime timeInvited,
                                    Dropbox.Api.Users.Team ownerTeam = null,
                                    string parentSharedFolderId      = null,
                                    string pathLower = null,
                                    SharedContentLinkMetadata linkMetadata         = null,
                                    col.IEnumerable <FolderPermission> permissions = null)
            : base(accessType, isInsideTeamFolder, isTeamFolder, ownerTeam, parentSharedFolderId, pathLower)
        {
            if (name == null)
            {
                throw new sys.ArgumentNullException("name");
            }

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

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

            if (sharedFolderId == null)
            {
                throw new sys.ArgumentNullException("sharedFolderId");
            }
            if (!re.Regex.IsMatch(sharedFolderId, @"\A(?:[-_0-9a-zA-Z:]+)\z"))
            {
                throw new sys.ArgumentOutOfRangeException("sharedFolderId", @"Value should match pattern '\A(?:[-_0-9a-zA-Z:]+)\z'");
            }

            var permissionsList = enc.Util.ToList(permissions);

            this.Name           = name;
            this.Policy         = policy;
            this.PreviewUrl     = previewUrl;
            this.SharedFolderId = sharedFolderId;
            this.TimeInvited    = timeInvited;
            this.LinkMetadata   = linkMetadata;
            this.Permissions    = permissionsList;
        }