Exemple #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="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="ownerDisplayNames">The display names of the users that own the folder.
        /// If the folder is part of a team folder, the display names of the team admins are
        /// also included. Absent if the owner display names cannot be fetched.</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="parentFolderName">Display name for the parent folder.</param>
        /// <param name="linkMetadata">The metadata of the shared content link to this shared
        /// folder. Absent if there is no link on the folder. This is for an unreleased feature
        /// so it may not be returned yet.</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="accessInheritance">Whether the folder inherits its members from its
        /// parent.</param>
        public SharedFolderMetadata(AccessLevel accessType,
                                    bool isInsideTeamFolder,
                                    bool isTeamFolder,
                                    string name,
                                    FolderPolicy policy,
                                    string previewUrl,
                                    string sharedFolderId,
                                    sys.DateTime timeInvited,
                                    col.IEnumerable <string> ownerDisplayNames = null,
                                    global::Dropbox.Api.Users.Team ownerTeam   = null,
                                    string parentSharedFolderId                    = null,
                                    string pathLower                               = null,
                                    string parentFolderName                        = null,
                                    SharedContentLinkMetadata linkMetadata         = null,
                                    col.IEnumerable <FolderPermission> permissions = null,
                                    AccessInheritance accessInheritance            = null)
            : base(accessType, isInsideTeamFolder, isTeamFolder, ownerDisplayNames, ownerTeam, parentSharedFolderId, pathLower, parentFolderName)
        {
            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);

            if (accessInheritance == null)
            {
                accessInheritance = global::Dropbox.Api.Sharing.AccessInheritance.Inherit.Instance;
            }
            this.Name              = name;
            this.Policy            = policy;
            this.PreviewUrl        = previewUrl;
            this.SharedFolderId    = sharedFolderId;
            this.TimeInvited       = timeInvited;
            this.LinkMetadata      = linkMetadata;
            this.Permissions       = permissionsList;
            this.AccessInheritance = accessInheritance;
        }
Exemple #2
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="SharedFileMetadata" />
        /// class.</para>
        /// </summary>
        /// <param name="policy">Policies governing this shared file.</param>
        /// <param name="previewUrl">URL for displaying a web preview of the shared
        /// file.</param>
        /// <param name="name">The name of this file.</param>
        /// <param name="id">The ID of the file.</param>
        /// <param name="linkMetadata">The metadata of the link associated for the
        /// file.</param>
        /// <param name="permissions">The sharing permissions that requesting user has on this
        /// file. This corresponds to the entries given in <see
        /// cref="Dropbox.Api.Sharing.GetFileMetadataBatchArg.Actions" /> or <see
        /// cref="Dropbox.Api.Sharing.GetFileMetadataArg.Actions" />.</param>
        /// <param name="ownerTeam">The team that owns the file. This field is not present if
        /// the file is not owned by a team.</param>
        /// <param name="parentSharedFolderId">The ID of the parent shared folder. This field
        /// is present only if the file is contained within a shared folder.</param>
        /// <param name="pathLower">The lower-case full path of this file. Absent for unmounted
        /// files.</param>
        /// <param name="pathDisplay">The cased path to be used for display purposes only. In
        /// rare instances the casing will not correctly match the user's filesystem, but this
        /// behavior will match the path provided in the Core API v1. Absent for unmounted
        /// files.</param>
        /// <param name="timeInvited">Timestamp indicating when the current user was invited to
        /// this shared file. If the user was not invited to the shared file, the timestamp
        /// will indicate when the user was invited to the parent shared folder. This value may
        /// be absent.</param>
        public SharedFileMetadata(FolderPolicy policy,
                                  string previewUrl,
                                  string name,
                                  string id,
                                  SharedContentLinkMetadata linkMetadata       = null,
                                  col.IEnumerable <FilePermission> permissions = null,
                                  Dropbox.Api.Users.Team ownerTeam             = null,
                                  string parentSharedFolderId = null,
                                  string pathLower            = null,
                                  string pathDisplay          = null,
                                  sys.DateTime?timeInvited    = null)
        {
            if (policy == null)
            {
                throw new sys.ArgumentNullException("policy");
            }

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

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

            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(?:id:.*)\z"))
            {
                throw new sys.ArgumentOutOfRangeException("id", @"Value should match pattern '\A(?:id:.*)\z'");
            }

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

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

            this.Policy               = policy;
            this.PreviewUrl           = previewUrl;
            this.Name                 = name;
            this.Id                   = id;
            this.LinkMetadata         = linkMetadata;
            this.Permissions          = permissionsList;
            this.OwnerTeam            = ownerTeam;
            this.ParentSharedFolderId = parentSharedFolderId;
            this.PathLower            = pathLower;
            this.PathDisplay          = pathDisplay;
            this.TimeInvited          = timeInvited;
        }