Ejemplo n.º 1
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="FullSharedFolderMetadata" />
        /// class.</para>
        /// </summary>
        /// <param name="name">The name of the this shared folder.</param>
        /// <param name="id">The ID of the shared folder.</param>
        /// <param name="accessType">Who can access this shared folder.</param>
        /// <param name="sharedLinkPolicy">Who links can be shared with.</param>
        /// <param name="membership">The list of user members of the shared folder.</param>
        /// <param name="groups">The list of group members of the shared folder.</param>
        /// <param name="pathLower">The lower-cased full path of this shared folder. Absent for
        /// unmounted folders.</param>
        public FullSharedFolderMetadata(string name,
                                        string id,
                                        AccessType accessType,
                                        SharedLinkPolicy sharedLinkPolicy,
                                        col.IEnumerable <UserMembershipInfo> membership,
                                        col.IEnumerable <GroupMembershipInfo> groups,
                                        string pathLower = null)
            : base(name, id, accessType, sharedLinkPolicy, pathLower)
        {
            var membershipList = new col.List <UserMembershipInfo>(membership ?? new UserMembershipInfo[0]);

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

            var groupsList = new col.List <GroupMembershipInfo>(groups ?? new GroupMembershipInfo[0]);

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

            this.Membership = membershipList;
            this.Groups     = groupsList;
        }
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="AddFolderMemberArg" />
        /// class.</para>
        /// </summary>
        /// <param name="sharedFolderId">The ID for the shared folder.</param>
        /// <param name="members">The intended list of members to add.  Added members will
        /// receive invites to join the shared folder.</param>
        /// <param name="quiet">Whether added members should be notified via email and device
        /// notifications of their invite.</param>
        /// <param name="customMessage">Optional message to display to added members in their
        /// invitation.</param>
        public AddFolderMemberArg(string sharedFolderId,
                                  col.IEnumerable <AddMember> members,
                                  bool quiet           = false,
                                  string customMessage = null)
        {
            if (sharedFolderId == null)
            {
                throw new sys.ArgumentNullException("sharedFolderId");
            }
            else if (!re.Regex.IsMatch(sharedFolderId, @"\A(?:[-_0-9a-zA-Z:]+)\z"))
            {
                throw new sys.ArgumentOutOfRangeException("sharedFolderId");
            }

            var membersList = new col.List <AddMember>(members ?? new AddMember[0]);

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

            if (customMessage != null && (customMessage.Length < 1))
            {
                throw new sys.ArgumentOutOfRangeException("customMessage");
            }

            this.SharedFolderId = sharedFolderId;
            this.Members        = membersList;
            this.Quiet          = quiet;
            this.CustomMessage  = customMessage;
        }
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="SharedFolderMembers" />
        /// class.</para>
        /// </summary>
        /// <param name="users">The list of user members of the shared folder.</param>
        /// <param name="groups">The list of group members of the shared folder.</param>
        /// <param name="invitees">The list of invited members of the shared folder. This list
        /// will not include invitees that have already accepted or declined to join the shared
        /// folder.</param>
        /// <param name="cursor">Present if there are additional shared folder members that
        /// have not been returned yet. Pass the cursor into <see
        /// cref="Dropbox.Api.Sharing.Routes.SharingRoutes.ListFolderMembersContinueAsync" />
        /// to list additional members.</param>
        public SharedFolderMembers(col.IEnumerable <UserMembershipInfo> users,
                                   col.IEnumerable <GroupMembershipInfo> groups,
                                   col.IEnumerable <InviteeMembershipInfo> invitees,
                                   string cursor = null)
        {
            var usersList = new col.List <UserMembershipInfo>(users ?? new UserMembershipInfo[0]);

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

            var groupsList = new col.List <GroupMembershipInfo>(groups ?? new GroupMembershipInfo[0]);

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

            var inviteesList = new col.List <InviteeMembershipInfo>(invitees ?? new InviteeMembershipInfo[0]);

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

            this.Users    = usersList;
            this.Groups   = groupsList;
            this.Invitees = inviteesList;
            this.Cursor   = cursor;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="ListFoldersResult" />
        /// class.</para>
        /// </summary>
        /// <param name="entries">List of all shared folders the authenticated user has access
        /// to.</param>
        public ListFoldersResult(col.IEnumerable <SharedFolderMetadata> entries)
        {
            var entriesList = new col.List <SharedFolderMetadata>(entries ?? new SharedFolderMetadata[0]);

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

            this.Entries = entriesList;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="GetSharedLinksResult" />
        /// class.</para>
        /// </summary>
        /// <param name="links">Shared links applicable to the path argument.</param>
        public GetSharedLinksResult(col.IEnumerable <LinkMetadata> links)
        {
            var linksList = new col.List <LinkMetadata>(links ?? new LinkMetadata[0]);

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

            this.Links = linksList;
        }
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="ListRevisionsResult" />
        /// class.</para>
        /// </summary>
        /// <param name="isDeleted">If the file is deleted.</param>
        /// <param name="entries">The revisions for the file. Only non-delete revisions will
        /// show up here.</param>
        public ListRevisionsResult(bool isDeleted,
                                   col.IEnumerable <FileMetadata> entries)
        {
            var entriesList = new col.List <FileMetadata>(entries ?? new FileMetadata[0]);

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

            this.IsDeleted = isDeleted;
            this.Entries   = entriesList;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="SearchResult" /> class.</para>
        /// </summary>
        /// <param name="matches">A list (possibly empty) of matches for the query.</param>
        /// <param name="more">Used for paging. If true, indicates there is another page of
        /// results available that can be fetched by calling <see
        /// cref="Dropbox.Api.Files.Routes.FilesRoutes.SearchAsync" /> again.</param>
        /// <param name="start">Used for paging. Value to set the start argument to when
        /// calling <see cref="Dropbox.Api.Files.Routes.FilesRoutes.SearchAsync" /> to fetch
        /// the next page of results.</param>
        public SearchResult(col.IEnumerable <SearchMatch> matches,
                            bool more,
                            ulong start)
        {
            var matchesList = new col.List <SearchMatch>(matches ?? new SearchMatch[0]);

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

            this.Matches = matchesList;
            this.More    = more;
            this.Start   = start;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="GetAccountBatchArg" />
        /// class.</para>
        /// </summary>
        /// <param name="accountIds">List of user account identifiers.  Should not contain any
        /// duplicate account IDs.</param>
        public GetAccountBatchArg(col.IEnumerable <string> accountIds)
        {
            var accountIdsList = new col.List <string>(accountIds ?? new string[0]);

            if (accountIds == null)
            {
                throw new sys.ArgumentNullException("accountIds");
            }
            else if (accountIdsList.Count < 1)
            {
                throw new sys.ArgumentOutOfRangeException("accountIds");
            }

            this.AccountIds = accountIdsList;
        }
Ejemplo n.º 9
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="ListFolderResult" />
        /// class.</para>
        /// </summary>
        /// <param name="entries">The files and (direct) subfolders in the folder.</param>
        /// <param name="cursor">Pass the cursor into <see
        /// cref="Dropbox.Api.Files.Routes.FilesRoutes.ListFolderContinueAsync" /> to see
        /// what's changed in the folder since your previous query.</param>
        /// <param name="hasMore">If true, then there are more entries available. Pass the
        /// cursor to <see cref="Dropbox.Api.Files.Routes.FilesRoutes.ListFolderContinueAsync"
        /// /> to retrieve the rest.</param>
        public ListFolderResult(col.IEnumerable <Metadata> entries,
                                string cursor,
                                bool hasMore)
        {
            var entriesList = new col.List <Metadata>(entries ?? new Metadata[0]);

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

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

            this.Entries = entriesList;
            this.Cursor  = cursor;
            this.HasMore = hasMore;
        }
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="FullSharedFolderMetadata" />
        /// class.</para>
        /// </summary>
        /// <param name="name">The name of the this shared folder.</param>
        /// <param name="id">The ID of the shared folder.</param>
        /// <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="membership">The list of user members of the shared folder.</param>
        /// <param name="groups">The list of group members of the shared folder.</param>
        /// <param name="invitees">The list of non-Dropbox users invited to join the shared
        /// folder.</param>
        /// <param name="pathLower">The lower-cased full path of this shared folder. Absent for
        /// unmounted folders.</param>
        public FullSharedFolderMetadata(string name,
                                        string id,
                                        AccessLevel accessType,
                                        bool isTeamFolder,
                                        FolderPolicy policy,
                                        col.IEnumerable <UserMembershipInfo> membership,
                                        col.IEnumerable <GroupMembershipInfo> groups,
                                        col.IEnumerable <InviteeMembershipInfo> invitees,
                                        string pathLower = null)
            : base(name, id, accessType, isTeamFolder, policy, pathLower)
        {
            var membershipList = new col.List <UserMembershipInfo>(membership ?? new UserMembershipInfo[0]);

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

            var groupsList = new col.List <GroupMembershipInfo>(groups ?? new GroupMembershipInfo[0]);

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

            var inviteesList = new col.List <InviteeMembershipInfo>(invitees ?? new InviteeMembershipInfo[0]);

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

            this.Membership = membershipList;
            this.Groups     = groupsList;
            this.Invitees   = inviteesList;
        }