/// <summary>
        /// <para>Initializes a new instance of the <see cref="ShareFolderArgBase" />
        /// class.</para>
        /// </summary>
        /// <param name="path">The path to the folder to share. If it does not exist, then a
        /// new one is created.</param>
        /// <param name="aclUpdatePolicy">Who can add and remove members of this shared
        /// folder.</param>
        /// <param name="forceAsync">Whether to force the share to happen
        /// asynchronously.</param>
        /// <param name="memberPolicy">Who can be a member of this shared folder. Only
        /// applicable if the current user is on a team.</param>
        /// <param name="sharedLinkPolicy">The policy to apply to shared links created for
        /// content inside this shared folder.  The current user must be on a team to set this
        /// policy to <see cref="Dropbox.Api.Sharing.SharedLinkPolicy.Members" />.</param>
        /// <param name="viewerInfoPolicy">Who can enable/disable viewer info for this shared
        /// folder.</param>
        /// <param name="accessInheritance">The access inheritance settings for the
        /// folder.</param>
        public ShareFolderArgBase(string path,
                                  AclUpdatePolicy aclUpdatePolicy = null,
                                  bool forceAsync                     = false,
                                  MemberPolicy memberPolicy           = null,
                                  SharedLinkPolicy sharedLinkPolicy   = null,
                                  ViewerInfoPolicy viewerInfoPolicy   = null,
                                  AccessInheritance accessInheritance = null)
        {
            if (path == null)
            {
                throw new sys.ArgumentNullException("path");
            }
            if (!re.Regex.IsMatch(path, @"\A(?:(/(.|[\r\n])*)|(ns:[0-9]+(/.*)?))\z"))
            {
                throw new sys.ArgumentOutOfRangeException("path", @"Value should match pattern '\A(?:(/(.|[\r\n])*)|(ns:[0-9]+(/.*)?))\z'");
            }

            if (accessInheritance == null)
            {
                accessInheritance = global::Dropbox.Api.Sharing.AccessInheritance.Inherit.Instance;
            }
            this.Path              = path;
            this.AclUpdatePolicy   = aclUpdatePolicy;
            this.ForceAsync        = forceAsync;
            this.MemberPolicy      = memberPolicy;
            this.SharedLinkPolicy  = sharedLinkPolicy;
            this.ViewerInfoPolicy  = viewerInfoPolicy;
            this.AccessInheritance = accessInheritance;
        }
Exemple #2
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;
        }
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="ShareFolderArg" /> class.</para>
        /// </summary>
        /// <param name="path">The path to the folder to share. If it does not exist, then a
        /// new one is created.</param>
        /// <param name="aclUpdatePolicy">Who can add and remove members of this shared
        /// folder.</param>
        /// <param name="forceAsync">Whether to force the share to happen
        /// asynchronously.</param>
        /// <param name="memberPolicy">Who can be a member of this shared folder. Only
        /// applicable if the current user is on a team.</param>
        /// <param name="sharedLinkPolicy">The policy to apply to shared links created for
        /// content inside this shared folder.  The current user must be on a team to set this
        /// policy to <see cref="Dropbox.Api.Sharing.SharedLinkPolicy.Members" />.</param>
        /// <param name="viewerInfoPolicy">Who can enable/disable viewer info for this shared
        /// folder.</param>
        /// <param name="accessInheritance">The access inheritance settings for the
        /// folder.</param>
        /// <param name="actions">A list of `FolderAction`s corresponding to
        /// `FolderPermission`s that should appear in the  response's <see
        /// cref="Dropbox.Api.Sharing.SharedFolderMetadata.Permissions" /> field describing the
        /// actions the  authenticated user can perform on the folder.</param>
        /// <param name="linkSettings">Settings on the link for this folder.</param>
        public ShareFolderArg(string path,
                              AclUpdatePolicy aclUpdatePolicy = null,
                              bool forceAsync                        = false,
                              MemberPolicy memberPolicy              = null,
                              SharedLinkPolicy sharedLinkPolicy      = null,
                              ViewerInfoPolicy viewerInfoPolicy      = null,
                              AccessInheritance accessInheritance    = null,
                              col.IEnumerable <FolderAction> actions = null,
                              LinkSettings linkSettings              = null)
            : base(path, aclUpdatePolicy, forceAsync, memberPolicy, sharedLinkPolicy, viewerInfoPolicy, accessInheritance)
        {
            var actionsList = enc.Util.ToList(actions);

            this.Actions      = actionsList;
            this.LinkSettings = linkSettings;
        }
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="SetAccessInheritanceArg" />
        /// class.</para>
        /// </summary>
        /// <param name="sharedFolderId">The ID for the shared folder.</param>
        /// <param name="accessInheritance">The access inheritance settings for the
        /// folder.</param>
        public SetAccessInheritanceArg(string sharedFolderId,
                                       AccessInheritance accessInheritance = null)
        {
            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'");
            }

            if (accessInheritance == null)
            {
                accessInheritance = global::Dropbox.Api.Sharing.AccessInheritance.Inherit.Instance;
            }
            this.SharedFolderId    = sharedFolderId;
            this.AccessInheritance = accessInheritance;
        }