Beispiel #1
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="SharedContentLinkMetadataBase"
        /// /> class.</para>
        /// </summary>
        /// <param name="audienceOptions">The audience options that are available for the
        /// content. Some audience options may be unavailable. For example, team_only may be
        /// unavailable if the content is not owned by a user on a team. The 'default' audience
        /// option is always available if the user can modify link settings.</param>
        /// <param name="currentAudience">The current audience of the link.</param>
        /// <param name="linkPermissions">A list of permissions for actions you can perform on
        /// the link.</param>
        /// <param name="passwordProtected">Whether the link is protected by a
        /// password.</param>
        /// <param name="expiry">Whether the link has an expiry set on it. A link with an
        /// expiry will have its  audience changed to members when the expiry is
        /// reached.</param>
        public SharedContentLinkMetadataBase(col.IEnumerable <LinkAudience> audienceOptions,
                                             LinkAudience currentAudience,
                                             col.IEnumerable <LinkPermission> linkPermissions,
                                             bool passwordProtected,
                                             sys.DateTime?expiry = null)
        {
            var audienceOptionsList = enc.Util.ToList(audienceOptions);

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

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

            var linkPermissionsList = enc.Util.ToList(linkPermissions);

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

            this.AudienceOptions   = audienceOptionsList;
            this.CurrentAudience   = currentAudience;
            this.LinkPermissions   = linkPermissionsList;
            this.PasswordProtected = passwordProtected;
            this.Expiry            = expiry;
        }
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="AudienceRestrictingSharedFolder"
        /// /> class.</para>
        /// </summary>
        /// <param name="sharedFolderId">The ID of the shared folder.</param>
        /// <param name="name">The name of the shared folder.</param>
        /// <param name="audience">The link audience of the shared folder.</param>
        public AudienceRestrictingSharedFolder(string sharedFolderId,
                                               string name,
                                               LinkAudience audience)
        {
            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 (name == null)
            {
                throw new sys.ArgumentNullException("name");
            }

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

            this.SharedFolderId = sharedFolderId;
            this.Name           = name;
            this.Audience       = audience;
        }
Beispiel #3
0
 /// <summary>
 /// <para>Initializes a new instance of the <see cref="LinkSettings" /> class.</para>
 /// </summary>
 /// <param name="audience">The type of audience on the link for this file.</param>
 /// <param name="expiry">An expiry timestamp to set on a link.</param>
 /// <param name="password">The password for the link.</param>
 public LinkSettings(LinkAudience audience = null,
                     LinkExpiry expiry     = null,
                     LinkPassword password = null)
 {
     this.Audience = audience;
     this.Expiry   = expiry;
     this.Password = password;
 }
 /// <summary>
 /// <para>Initializes a new instance of the <see
 /// cref="ExpectedSharedContentLinkMetadata" /> class.</para>
 /// </summary>
 /// <param name="audienceOptions">The audience options that are available for the
 /// content. Some audience options may be unavailable. For example, team_only may be
 /// unavailable if the content is not owned by a user on a team. The 'default' audience
 /// option is always available if the user can modify link settings.</param>
 /// <param name="currentAudience">The current audience of the link.</param>
 /// <param name="linkPermissions">A list of permissions for actions you can perform on
 /// the link.</param>
 /// <param name="passwordProtected">Whether the link is protected by a
 /// password.</param>
 /// <param name="accessLevel">The access level on the link for this file.</param>
 /// <param name="audienceRestrictingSharedFolder">The shared folder that prevents the
 /// link audience for this link from being more restrictive.</param>
 /// <param name="expiry">Whether the link has an expiry set on it. A link with an
 /// expiry will have its  audience changed to members when the expiry is
 /// reached.</param>
 public ExpectedSharedContentLinkMetadata(col.IEnumerable <LinkAudience> audienceOptions,
                                          LinkAudience currentAudience,
                                          col.IEnumerable <LinkPermission> linkPermissions,
                                          bool passwordProtected,
                                          AccessLevel accessLevel = null,
                                          AudienceRestrictingSharedFolder audienceRestrictingSharedFolder = null,
                                          sys.DateTime?expiry = null)
     : base(audienceOptions, currentAudience, linkPermissions, passwordProtected, accessLevel, audienceRestrictingSharedFolder, expiry)
 {
 }
Beispiel #5
0
 /// <summary>
 /// <para>Initializes a new instance of the <see cref="LinkSettings" /> class.</para>
 /// </summary>
 /// <param name="accessLevel">The access level on the link for this file. Currently, it
 /// only accepts 'viewer' and 'viewer_no_comment'.</param>
 /// <param name="audience">The type of audience on the link for this file.</param>
 /// <param name="expiry">An expiry timestamp to set on a link.</param>
 /// <param name="password">The password for the link.</param>
 public LinkSettings(AccessLevel accessLevel = null,
                     LinkAudience audience   = null,
                     LinkExpiry expiry       = null,
                     LinkPassword password   = null)
 {
     this.AccessLevel = accessLevel;
     this.Audience    = audience;
     this.Expiry      = expiry;
     this.Password    = password;
 }
Beispiel #6
0
 /// <summary>
 /// <para>Initializes a new instance of the <see cref="SharedLinkSettings" />
 /// class.</para>
 /// </summary>
 /// <param name="requestedVisibility">The requested access for this shared
 /// link.</param>
 /// <param name="linkPassword">If <paramref name="requestedVisibility" /> is <see
 /// cref="Dropbox.Api.Sharing.RequestedVisibility.Password" /> this is needed to
 /// specify the password to access the link.</param>
 /// <param name="expires">Expiration time of the shared link. By default the link won't
 /// expire.</param>
 /// <param name="audience">The new audience who can benefit from the access level
 /// specified by the link's access level specified in the `link_access_level` field of
 /// `LinkPermissions`. This is used in conjunction with team policies and shared folder
 /// policies to determine the final effective audience type in the `effective_audience`
 /// field of `LinkPermissions.</param>
 /// <param name="access">Requested access level you want the audience to gain from this
 /// link. Note, modifying access level for an existing link is not supported.</param>
 public SharedLinkSettings(RequestedVisibility requestedVisibility = null,
                           string linkPassword             = null,
                           sys.DateTime?expires            = null,
                           LinkAudience audience           = null,
                           RequestedLinkAccessLevel access = null)
 {
     this.RequestedVisibility = requestedVisibility;
     this.LinkPassword        = linkPassword;
     this.Expires             = expires;
     this.Audience            = audience;
     this.Access = access;
 }
 /// <summary>
 /// <para>Initializes a new instance of the <see cref="LinkPermissions" />
 /// class.</para>
 /// </summary>
 /// <param name="canRevoke">Whether the caller can revoke the shared link.</param>
 /// <param name="resolvedVisibility">The current visibility of the link after
 /// considering the shared links policies of the the team (in case the link's owner is
 /// part of a team) and the shared folder (in case the linked file is part of a shared
 /// folder). This field is shown only if the caller has access to this info (the link's
 /// owner always has access to this data). For some links, an effective_audience value
 /// is returned instead.</param>
 /// <param name="requestedVisibility">The shared link's requested visibility. This can
 /// be overridden by the team and shared folder policies. The final visibility, after
 /// considering these policies, can be found in <paramref name="resolvedVisibility" />.
 /// This is shown only if the caller is the link's owner and resolved_visibility is
 /// returned instead of effective_audience.</param>
 /// <param name="revokeFailureReason">The failure reason for revoking the link. This
 /// field will only be present if the <paramref name="canRevoke" /> is
 /// <c>false</c>.</param>
 /// <param name="effectiveAudience">The type of audience who can benefit from the
 /// access level specified by the `link_access_level` field.</param>
 /// <param name="linkAccessLevel">The access level that the link will grant to its
 /// users. A link can grant additional rights to a user beyond their current access
 /// level. For example, if a user was invited as a viewer to a file, and then opens a
 /// link with `link_access_level` set to `editor`, then they will gain editor
 /// privileges. The `link_access_level` is a property of the link, and does not depend
 /// on who is calling this API. In particular, `link_access_level` does not take into
 /// account the API caller's current permissions to the content.</param>
 public LinkPermissions(bool canRevoke,
                        ResolvedVisibility resolvedVisibility             = null,
                        RequestedVisibility requestedVisibility           = null,
                        SharedLinkAccessFailureReason revokeFailureReason = null,
                        LinkAudience effectiveAudience  = null,
                        LinkAccessLevel linkAccessLevel = null)
 {
     this.CanRevoke           = canRevoke;
     this.ResolvedVisibility  = resolvedVisibility;
     this.RequestedVisibility = requestedVisibility;
     this.RevokeFailureReason = revokeFailureReason;
     this.EffectiveAudience   = effectiveAudience;
     this.LinkAccessLevel     = linkAccessLevel;
 }
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="SharedContentLinkMetadata" />
        /// class.</para>
        /// </summary>
        /// <param name="audienceOptions">The audience options that are available for the
        /// content. Some audience options may be unavailable. For example, team_only may be
        /// unavailable if the content is not owned by a user on a team. The 'default' audience
        /// option is always available if the user can modify link settings.</param>
        /// <param name="currentAudience">The current audience of the link.</param>
        /// <param name="linkPermissions">A list of permissions for actions you can perform on
        /// the link.</param>
        /// <param name="passwordProtected">Whether the link is protected by a
        /// password.</param>
        /// <param name="url">The URL of the link.</param>
        /// <param name="expiry">Whether the link has an expiry set on it. A link with an
        /// expiry will have its  audience changed to members when the expiry is
        /// reached.</param>
        public SharedContentLinkMetadata(col.IEnumerable <LinkAudience> audienceOptions,
                                         LinkAudience currentAudience,
                                         col.IEnumerable <LinkPermission> linkPermissions,
                                         bool passwordProtected,
                                         string url,
                                         sys.DateTime?expiry = null)
            : base(audienceOptions, currentAudience, linkPermissions, passwordProtected, expiry)
        {
            if (url == null)
            {
                throw new sys.ArgumentNullException("url");
            }

            this.Url = url;
        }
Beispiel #9
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="SharedContentLinkMetadata" />
        /// class.</para>
        /// </summary>
        /// <param name="audienceOptions">The audience options that are available for the
        /// content. Some audience options may be unavailable. For example, team_only may be
        /// unavailable if the content is not owned by a user on a team. The 'default' audience
        /// option is always available if the user can modify link settings.</param>
        /// <param name="currentAudience">The current audience of the link.</param>
        /// <param name="linkPermissions">A list of permissions for actions you can perform on
        /// the link.</param>
        /// <param name="passwordProtected">Whether the link is protected by a
        /// password.</param>
        /// <param name="url">The URL of the link.</param>
        /// <param name="accessLevel">The access level on the link for this file.</param>
        /// <param name="audienceRestrictingSharedFolder">The shared folder that prevents the
        /// link audience for this link from being more restrictive.</param>
        /// <param name="expiry">Whether the link has an expiry set on it. A link with an
        /// expiry will have its  audience changed to members when the expiry is
        /// reached.</param>
        /// <param name="audienceExceptions">The content inside this folder with link audience
        /// different than this folder's. This is only returned when an endpoint that returns
        /// metadata for a single shared folder is called, e.g. /get_folder_metadata.</param>
        public SharedContentLinkMetadata(col.IEnumerable <LinkAudience> audienceOptions,
                                         LinkAudience currentAudience,
                                         col.IEnumerable <LinkPermission> linkPermissions,
                                         bool passwordProtected,
                                         string url,
                                         AccessLevel accessLevel = null,
                                         AudienceRestrictingSharedFolder audienceRestrictingSharedFolder = null,
                                         sys.DateTime?expiry = null,
                                         AudienceExceptions audienceExceptions = null)
            : base(audienceOptions, currentAudience, linkPermissions, passwordProtected, accessLevel, audienceRestrictingSharedFolder, expiry)
        {
            if (url == null)
            {
                throw new sys.ArgumentNullException("url");
            }

            this.Url = url;
            this.AudienceExceptions = audienceExceptions;
        }