/// <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="memberPolicy">Who can be a member of this shared folder. Only
        /// applicable if the current user is on a team.</param>
        /// <param name="aclUpdatePolicy">Who can add and remove members of this shared
        /// folder.</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="forceAsync">Whether to force the share to happen
        /// asynchronously.</param>
        /// <param name="actions">This is a list indicating whether each returned folder data
        /// entry will include a boolean field <see
        /// cref="Dropbox.Api.Sharing.FolderPermission.Allow" /> that describes whether the
        /// current user can perform the `FolderAction` on the folder.</param>
        /// <param name="linkSettings">Settings on the link for this folder.</param>
        /// <param name="viewerInfoPolicy">Who can enable/disable viewer info for this shared
        /// folder.</param>
        public ShareFolderArg(string path,
                              MemberPolicy memberPolicy         = null,
                              AclUpdatePolicy aclUpdatePolicy   = null,
                              SharedLinkPolicy sharedLinkPolicy = null,
                              bool forceAsync = false,
                              col.IEnumerable <FolderAction> actions = null,
                              LinkSettings linkSettings         = null,
                              ViewerInfoPolicy viewerInfoPolicy = 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'");
            }

            var actionsList = enc.Util.ToList(actions);

            this.Path             = path;
            this.MemberPolicy     = memberPolicy;
            this.AclUpdatePolicy  = aclUpdatePolicy;
            this.SharedLinkPolicy = sharedLinkPolicy;
            this.ForceAsync       = forceAsync;
            this.Actions          = actionsList;
            this.LinkSettings     = linkSettings;
            this.ViewerInfoPolicy = viewerInfoPolicy;
        }
Exemple #2
0
        /// <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="memberPolicy">Who can be a member of this shared folder. Only
        /// applicable if the current user is on a team.</param>
        /// <param name="aclUpdatePolicy">Who can add and remove members of this shared
        /// folder.</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="forceAsync">Whether to force the share to happen
        /// asynchronously.</param>
        public ShareFolderArg(string path,
                              MemberPolicy memberPolicy         = null,
                              AclUpdatePolicy aclUpdatePolicy   = null,
                              SharedLinkPolicy sharedLinkPolicy = null,
                              bool forceAsync = false)
        {
            if (path == null)
            {
                throw new sys.ArgumentNullException("path");
            }
            if (!re.Regex.IsMatch(path, @"\A(?:/(.|[\r\n])*)\z"))
            {
                throw new sys.ArgumentOutOfRangeException("path", @"Value should match pattern '\A(?:/(.|[\r\n])*)\z'");
            }

            if (memberPolicy == null)
            {
                memberPolicy = Dropbox.Api.Sharing.MemberPolicy.Anyone.Instance;
            }
            if (aclUpdatePolicy == null)
            {
                aclUpdatePolicy = Dropbox.Api.Sharing.AclUpdatePolicy.Owner.Instance;
            }
            if (sharedLinkPolicy == null)
            {
                sharedLinkPolicy = Dropbox.Api.Sharing.SharedLinkPolicy.Anyone.Instance;
            }
            this.Path             = path;
            this.MemberPolicy     = memberPolicy;
            this.AclUpdatePolicy  = aclUpdatePolicy;
            this.SharedLinkPolicy = sharedLinkPolicy;
            this.ForceAsync       = forceAsync;
        }
        /// <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 #4
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="UpdateFolderPolicyArg" />
        /// class.</para>
        /// </summary>
        /// <param name="sharedFolderId">The ID for the shared folder.</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="aclUpdatePolicy">Who can add and remove members of this shared
        /// folder.</param>
        /// <param name="viewerInfoPolicy">Who can enable/disable viewer info for this shared
        /// folder.</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="linkSettings">Settings on the link for this 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>
        public UpdateFolderPolicyArg(string sharedFolderId,
                                     MemberPolicy memberPolicy              = null,
                                     AclUpdatePolicy aclUpdatePolicy        = null,
                                     ViewerInfoPolicy viewerInfoPolicy      = null,
                                     SharedLinkPolicy sharedLinkPolicy      = null,
                                     LinkSettings linkSettings              = null,
                                     col.IEnumerable <FolderAction> actions = 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'");
            }

            var actionsList = enc.Util.ToList(actions);

            this.SharedFolderId   = sharedFolderId;
            this.MemberPolicy     = memberPolicy;
            this.AclUpdatePolicy  = aclUpdatePolicy;
            this.ViewerInfoPolicy = viewerInfoPolicy;
            this.SharedLinkPolicy = sharedLinkPolicy;
            this.LinkSettings     = linkSettings;
            this.Actions          = actionsList;
        }
        /// <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="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,
                              col.IEnumerable <FolderAction> actions = null,
                              LinkSettings linkSettings              = null)
            : base(path, aclUpdatePolicy, forceAsync, memberPolicy, sharedLinkPolicy, viewerInfoPolicy)
        {
            var actionsList = enc.Util.ToList(actions);

            this.Actions      = actionsList;
            this.LinkSettings = linkSettings;
        }
Exemple #6
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="FolderPolicy" /> class.</para>
        /// </summary>
        /// <param name="aclUpdatePolicy">Who can add and remove members from this shared
        /// folder.</param>
        /// <param name="sharedLinkPolicy">Who links can be shared with.</param>
        /// <param name="memberPolicy">Who can be a member of this shared folder. Only set if
        /// the user is a member of a team.</param>
        public FolderPolicy(AclUpdatePolicy aclUpdatePolicy,
                            SharedLinkPolicy sharedLinkPolicy,
                            MemberPolicy memberPolicy = null)
        {
            if (aclUpdatePolicy == null)
            {
                throw new sys.ArgumentNullException("aclUpdatePolicy");
            }

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

            this.AclUpdatePolicy  = aclUpdatePolicy;
            this.SharedLinkPolicy = sharedLinkPolicy;
            this.MemberPolicy     = memberPolicy;
        }
Exemple #7
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="UpdateFolderPolicyArg" />
        /// class.</para>
        /// </summary>
        /// <param name="sharedFolderId">The ID for the shared folder.</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="aclUpdatePolicy">Who can add and remove members of this shared
        /// folder.</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>
        public UpdateFolderPolicyArg(string sharedFolderId,
                                     MemberPolicy memberPolicy         = null,
                                     AclUpdatePolicy aclUpdatePolicy   = null,
                                     SharedLinkPolicy sharedLinkPolicy = 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'");
            }

            this.SharedFolderId   = sharedFolderId;
            this.MemberPolicy     = memberPolicy;
            this.AclUpdatePolicy  = aclUpdatePolicy;
            this.SharedLinkPolicy = sharedLinkPolicy;
        }
Exemple #8
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="UpdateFolderPolicyArg" />
        /// class.</para>
        /// </summary>
        /// <param name="sharedFolderId">The ID for the shared folder.</param>
        /// <param name="memberPolicy">Who can be a member of this shared folder. Only set this
        /// if the current user is on a team.</param>
        /// <param name="aclUpdatePolicy">Who can add and remove members of this shared
        /// folder.</param>
        /// <param name="sharedLinkPolicy">The policy to apply to shared links created for
        /// content inside this shared folder.</param>
        public UpdateFolderPolicyArg(string sharedFolderId,
                                     MemberPolicy memberPolicy         = null,
                                     AclUpdatePolicy aclUpdatePolicy   = null,
                                     SharedLinkPolicy sharedLinkPolicy = null)
        {
            if (sharedFolderId == null)
            {
                throw new sys.ArgumentNullException("sharedFolderId");
            }
            else if (!re.Regex.IsMatch(sharedFolderId, @"[-_0-9a-zA-Z]+"))
            {
                throw new sys.ArgumentOutOfRangeException("sharedFolderId");
            }

            this.SharedFolderId   = sharedFolderId;
            this.MemberPolicy     = memberPolicy;
            this.AclUpdatePolicy  = aclUpdatePolicy;
            this.SharedLinkPolicy = sharedLinkPolicy;
        }
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="FolderPolicy" /> class.</para>
        /// </summary>
        /// <param name="aclUpdatePolicy">Who can add and remove members from this shared
        /// folder.</param>
        /// <param name="sharedLinkPolicy">Who links can be shared with.</param>
        /// <param name="memberPolicy">Who can be a member of this shared folder, as set on the
        /// folder itself. The effective policy may differ from this value if the team-wide
        /// policy is more restrictive. Present only if the folder is owned by a team.</param>
        /// <param name="resolvedMemberPolicy">Who can be a member of this shared folder,
        /// taking into account both the folder and the team-wide policy. This value may differ
        /// from that of member_policy if the team-wide policy is more restrictive than the
        /// folder policy. Present only if the folder is owned by a team.</param>
        /// <param name="viewerInfoPolicy">Who can enable/disable viewer info for this shared
        /// folder.</param>
        public FolderPolicy(AclUpdatePolicy aclUpdatePolicy,
                            SharedLinkPolicy sharedLinkPolicy,
                            MemberPolicy memberPolicy         = null,
                            MemberPolicy resolvedMemberPolicy = null,
                            ViewerInfoPolicy viewerInfoPolicy = null)
        {
            if (aclUpdatePolicy == null)
            {
                throw new sys.ArgumentNullException("aclUpdatePolicy");
            }

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

            this.AclUpdatePolicy      = aclUpdatePolicy;
            this.SharedLinkPolicy     = sharedLinkPolicy;
            this.MemberPolicy         = memberPolicy;
            this.ResolvedMemberPolicy = resolvedMemberPolicy;
            this.ViewerInfoPolicy     = viewerInfoPolicy;
        }
        /// <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="memberPolicy">Who can be a member of this shared folder.</param>
        /// <param name="aclUpdatePolicy">Who can add and remove members of this shared
        /// folder.</param>
        /// <param name="sharedLinkPolicy">The policy to apply to shared links created for
        /// content inside this shared folder.</param>
        /// <param name="forceAsync">Whether to force the share to happen
        /// asynchronously.</param>
        public ShareFolderArg(string path,
                              MemberPolicy memberPolicy         = null,
                              AclUpdatePolicy aclUpdatePolicy   = null,
                              SharedLinkPolicy sharedLinkPolicy = null,
                              bool forceAsync = false)
        {
            if (path == null)
            {
                throw new sys.ArgumentNullException("path");
            }
            else if (!re.Regex.IsMatch(path, @"\A(?:/.*)\z"))
            {
                throw new sys.ArgumentOutOfRangeException("path");
            }

            if (memberPolicy == null)
            {
                memberPolicy = MemberPolicy.Anyone.Instance;
            }

            if (aclUpdatePolicy == null)
            {
                aclUpdatePolicy = AclUpdatePolicy.Owner.Instance;
            }

            if (sharedLinkPolicy == null)
            {
                sharedLinkPolicy = SharedLinkPolicy.Anyone.Instance;
            }

            this.Path             = path;
            this.MemberPolicy     = memberPolicy;
            this.AclUpdatePolicy  = aclUpdatePolicy;
            this.SharedLinkPolicy = sharedLinkPolicy;
            this.ForceAsync       = forceAsync;
        }