/// <summary>
        /// <para>Initializes a new instance of the <see cref="FileLinkMetadata" />
        /// class.</para>
        /// </summary>
        /// <param name="url">URL of the shared link.</param>
        /// <param name="name">The linked file name (including extension). This never contains
        /// a slash.</param>
        /// <param name="linkPermissions">The link's access permissions.</param>
        /// <param name="clientModified">The modification time set by the desktop client when
        /// the file was added to Dropbox. Since this time is not verified (the Dropbox server
        /// stores whatever the desktop client sends up), this should only be used for display
        /// purposes (such as sorting) and not, for example, to determine if a file has changed
        /// or not.</param>
        /// <param name="serverModified">The last time the file was modified on
        /// Dropbox.</param>
        /// <param name="rev">A unique identifier for the current revision of a file. This
        /// field is the same rev as elsewhere in the API and can be used to detect changes and
        /// avoid conflicts.</param>
        /// <param name="size">The file size in bytes.</param>
        /// <param name="id">A unique identifier for the linked file.</param>
        /// <param name="expires">Expiration time, if set. By default the link won't
        /// expire.</param>
        /// <param name="pathLower">The lowercased full path in the user's Dropbox. This always
        /// starts with a slash. This field will only be present only if the linked file is in
        /// the authenticated user's  dropbox.</param>
        /// <param name="teamMemberInfo">The team membership information of the link's owner.
        /// This field will only be present  if the link's owner is a team member.</param>
        /// <param name="contentOwnerTeamInfo">The team information of the content's owner.
        /// This field will only be present if the content's owner is a team member and the
        /// content's owner team is different from the link's owner team.</param>
        public FileLinkMetadata(string url,
                                string name,
                                LinkPermissions linkPermissions,
                                sys.DateTime clientModified,
                                sys.DateTime serverModified,
                                string rev,
                                ulong size,
                                string id                     = null,
                                sys.DateTime?expires          = null,
                                string pathLower              = null,
                                TeamMemberInfo teamMemberInfo = null,
                                global::Dropbox.Api.Users.Team contentOwnerTeamInfo = null)
            : base(url, name, linkPermissions, id, expires, pathLower, teamMemberInfo, contentOwnerTeamInfo)
        {
            if (rev == null)
            {
                throw new sys.ArgumentNullException("rev");
            }
            if (rev.Length < 9)
            {
                throw new sys.ArgumentOutOfRangeException("rev", "Length should be at least 9");
            }
            if (!re.Regex.IsMatch(rev, @"\A(?:[0-9a-f]+)\z"))
            {
                throw new sys.ArgumentOutOfRangeException("rev", @"Value should match pattern '\A(?:[0-9a-f]+)\z'");
            }

            this.ClientModified = clientModified;
            this.ServerModified = serverModified;
            this.Rev            = rev;
            this.Size           = size;
        }
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="SharedFolderMetadataBase" />
        /// 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="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>
        public SharedFolderMetadataBase(AccessLevel accessType,
                                        bool isInsideTeamFolder,
                                        bool isTeamFolder,
                                        col.IEnumerable <string> ownerDisplayNames = null,
                                        global::Dropbox.Api.Users.Team ownerTeam   = null,
                                        string parentSharedFolderId = null,
                                        string pathLower            = null)
        {
            if (accessType == null)
            {
                throw new sys.ArgumentNullException("accessType");
            }

            var ownerDisplayNamesList = enc.Util.ToList(ownerDisplayNames);

            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.AccessType           = accessType;
            this.IsInsideTeamFolder   = isInsideTeamFolder;
            this.IsTeamFolder         = isTeamFolder;
            this.OwnerDisplayNames    = ownerDisplayNamesList;
            this.OwnerTeam            = ownerTeam;
            this.ParentSharedFolderId = parentSharedFolderId;
            this.PathLower            = pathLower;
        }
Example #3
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="FolderLinkMetadata" />
 /// class.</para>
 /// </summary>
 /// <param name="url">URL of the shared link.</param>
 /// <param name="name">The linked file name (including extension). This never contains
 /// a slash.</param>
 /// <param name="linkPermissions">The link's access permissions.</param>
 /// <param name="id">A unique identifier for the linked file.</param>
 /// <param name="expires">Expiration time, if set. By default the link won't
 /// expire.</param>
 /// <param name="pathLower">The lowercased full path in the user's Dropbox. This always
 /// starts with a slash. This field will only be present only if the linked file is in
 /// the authenticated user's  dropbox.</param>
 /// <param name="teamMemberInfo">The team membership information of the link's owner.
 /// This field will only be present  if the link's owner is a team member.</param>
 /// <param name="contentOwnerTeamInfo">The team information of the content's owner.
 /// This field will only be present if the content's owner is a team member and the
 /// content's owner team is different from the link's owner team.</param>
 public FolderLinkMetadata(string url,
                           string name,
                           LinkPermissions linkPermissions,
                           string id                     = null,
                           sys.DateTime?expires          = null,
                           string pathLower              = null,
                           TeamMemberInfo teamMemberInfo = null,
                           global::Dropbox.Api.Users.Team contentOwnerTeamInfo = null)
     : base(url, name, linkPermissions, id, expires, pathLower, teamMemberInfo, contentOwnerTeamInfo)
 {
 }
Example #5
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="TeamMemberInfo" /> class.</para>
        /// </summary>
        /// <param name="teamInfo">Information about the member's team.</param>
        /// <param name="displayName">The display name of the user.</param>
        /// <param name="memberId">ID of user as a member of a team. This field will only be
        /// present if the member is in the same team as current user.</param>
        public TeamMemberInfo(global::Dropbox.Api.Users.Team teamInfo,
                              string displayName,
                              string memberId = null)
        {
            if (teamInfo == null)
            {
                throw new sys.ArgumentNullException("teamInfo");
            }

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

            this.TeamInfo    = teamInfo;
            this.DisplayName = displayName;
            this.MemberId    = memberId;
        }
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="SharedLinkMetadata" />
        /// class.</para>
        /// </summary>
        /// <param name="url">URL of the shared link.</param>
        /// <param name="name">The linked file name (including extension). This never contains
        /// a slash.</param>
        /// <param name="linkPermissions">The link's access permissions.</param>
        /// <param name="id">A unique identifier for the linked file.</param>
        /// <param name="expires">Expiration time, if set. By default the link won't
        /// expire.</param>
        /// <param name="pathLower">The lowercased full path in the user's Dropbox. This always
        /// starts with a slash. This field will only be present only if the linked file is in
        /// the authenticated user's  dropbox.</param>
        /// <param name="teamMemberInfo">The team membership information of the link's owner.
        /// This field will only be present  if the link's owner is a team member.</param>
        /// <param name="contentOwnerTeamInfo">The team information of the content's owner.
        /// This field will only be present if the content's owner is a team member and the
        /// content's owner team is different from the link's owner team.</param>
        protected SharedLinkMetadata(string url,
                                     string name,
                                     LinkPermissions linkPermissions,
                                     string id                     = null,
                                     sys.DateTime?expires          = null,
                                     string pathLower              = null,
                                     TeamMemberInfo teamMemberInfo = null,
                                     global::Dropbox.Api.Users.Team contentOwnerTeamInfo = null)
        {
            if (url == null)
            {
                throw new sys.ArgumentNullException("url");
            }

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

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

            if (id != null)
            {
                if (id.Length < 1)
                {
                    throw new sys.ArgumentOutOfRangeException("id", "Length should be at least 1");
                }
            }

            this.Url             = url;
            this.Name            = name;
            this.LinkPermissions = linkPermissions;
            this.Id                   = id;
            this.Expires              = expires;
            this.PathLower            = pathLower;
            this.TeamMemberInfo       = teamMemberInfo;
            this.ContentOwnerTeamInfo = contentOwnerTeamInfo;
        }
        /// <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,
                                  global::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;
        }