/// <summary>
        ///     Updat the collaborator's role and status in an existing collaboration
        /// </summary>
        /// <param name="collaborationId">The ID of the collaboration to update</param>
        /// <param name="role">The collaborator's new role</param>
        /// <param name="status">The collaborator's new status</param>
        /// <param name="fields">The properties that should be set on the returned Collaboration object.  Type and Id are always set.  If left null, all properties will be set, which can increase response time.</param>
        /// <returns>The updated collaboration</returns>
        public Collaboration UpdateCollaboration(string collaborationId, CollaborationRole role, Status status, IEnumerable <CollaborationField> fields = null)
        {
            GuardFromNull(collaborationId, "collaborationId");
            var request = _requestHelper.UpdateCollaboration(collaborationId, role, status, fields);

            return(_restClient.ExecuteAndDeserialize <Collaboration>(request));
        }
예제 #2
0
        public IRestRequest UpdateCollaboration(string collaborationId, CollaborationRole role, Status status, IEnumerable <CollaborationField> fields)
        {
            IRestRequest request = JsonRequest(ResourceType.Collaboration, "{id}", Method.PUT, fields);

            request.AddUrlSegment("id", collaborationId.Trim());
            request.AddBody(new { role = role.Description(), status = status.Description() });
            return(request);
        }
 /// <summary>
 ///     Add a collaboration for a single user to a folder.
 /// </summary>
 /// <param name="onSuccess">Action to perform with the new collaboration</param>
 /// <param name="onFailure">Action to perform after a failed Collaboration operation </param>
 /// <param name="folderId">The ID of the folder in which to collaborate</param>
 /// <param name="userId">The ID of the collaborating user</param>
 /// <param name="role">The role of the collaborating user</param>
 /// <param name="fields">The properties that should be set on the returned Collaboration object.  Type and Id are always set.  If left null, all properties will be set, which can increase response time.</param>
 public void CreateCollaboration(Action<Collaboration> onSuccess, Action<Error> onFailure, string folderId, string userId, CollaborationRole role, IEnumerable<CollaborationField> fields = null)
 {
     GuardFromNull(folderId, "folderId");
     GuardFromNull(userId, "userId");
     GuardFromNull(role, "role");
     var request = _requestHelper.CreateCollaboration(folderId, userId, role.Description(), fields);
     _restClient.ExecuteAsync(request, onSuccess, onFailure);
 }
 /// <summary>
 ///     Add a collaboration for a single user to a folder.
 /// </summary>
 /// <param name="folderId">The ID of the folder in which to collaborate</param>
 /// <param name="userId">The ID of the collaborating user</param>
 /// <param name="role">The role of the collaborating user</param>
 /// <param name="fields">The properties that should be set on the returned Collaboration object.  Type and Id are always set.  If left null, all properties will be set, which can increase response time.</param>
 /// <returns>The new collaboration</returns>
 public Collaboration CreateCollaboration(string folderId, string userId, CollaborationRole role, IEnumerable<CollaborationField> fields = null)
 {
     GuardFromNull(folderId, "folderId");
     GuardFromNull(userId, "userId");
     GuardFromNull(role, "role");
     var request = _requestHelper.CreateCollaboration(folderId, userId, role.Description(), fields);
     return _restClient.ExecuteAndDeserialize<Collaboration>(request);
 }
        /// <summary>
        ///     Add a collaboration for a single user to a folder.
        /// </summary>
        /// <param name="folderId">The ID of the folder in which to collaborate</param>
        /// <param name="userId">The ID of the collaborating user</param>
        /// <param name="role">The role of the collaborating user</param>
        /// <param name="fields">The properties that should be set on the returned Collaboration object.  Type and Id are always set.  If left null, all properties will be set, which can increase response time.</param>
        /// <returns>The new collaboration</returns>
        public Collaboration CreateCollaboration(string folderId, string userId, CollaborationRole role, IEnumerable <CollaborationField> fields = null)
        {
            GuardFromNull(folderId, "folderId");
            GuardFromNull(userId, "userId");
            GuardFromNull(role, "role");
            var request = _requestHelper.CreateCollaboration(folderId, userId, role.Description(), fields);

            return(_restClient.ExecuteAndDeserialize <Collaboration>(request));
        }
 public void CreateById(CollaborationRole role)
 {
     var folder = Client.CreateFolder(Folder.Root, TestItemName(), null);
     try
     {
         var collaboration = Client.CreateCollaboration(folder, CollaboratingUser, role);
         Assert.That(collaboration, Is.Not.Null);
         Assert.That(collaboration.Item.Id, Is.EqualTo(folder.Id));
         Assert.That(collaboration.AccessibleBy.Id, Is.EqualTo(CollaboratingUser));
         Assert.That(collaboration.AccessibleBy.Login, Is.EqualTo(CollaboratingUserEmail));
         Assert.That(collaboration.RoleValue, Is.EqualTo(role));
     }
     finally
     {
         Client.Delete(folder);
     }
 }
        public void CreateByEmail(CollaborationRole role)
        {
            var folder = Client.CreateFolder(Folder.Root, TestItemName(), null);

            try
            {
                var collaboration = Client.CreateCollaborationByEmail(folder, CollaboratingUserEmail, role);
                Assert.That(collaboration, Is.Not.Null);
                Assert.That(collaboration.Item.Id, Is.EqualTo(folder.Id));
                Assert.That(collaboration.AccessibleBy.Id, Is.EqualTo(CollaboratingUser));
                Assert.That(collaboration.AccessibleBy.Login, Is.EqualTo(CollaboratingUserEmail));
                Assert.That(collaboration.RoleValue, Is.EqualTo(role));
            }
            finally
            {
                Client.Delete(folder);
            }
        }
 /// <summary>
 ///     Update the collaborator's role and status in an existing collaboration
 /// </summary>
 /// <param name="onSuccess">Action to perform with the updated collaboration</param>
 /// <param name="onFailure">Action to perform following a failed Collaboration operation</param>
 /// <param name="collaboration">The collaboration to update</param>
 /// <param name="role">The collaborator's new role</param>
 /// <param name="status">The collaborator's new status</param>
 /// <param name="fields">The properties that should be set on the returned Collaboration object.  Type and Id are always set.  If left null, all properties will be set, which can increase response time.</param>
 public void Update(Action<Collaboration> onSuccess, Action<Error> onFailure, Collaboration collaboration, CollaborationRole role, Status status, IEnumerable<CollaborationField> fields = null)
 {
     GuardFromNull(collaboration, "collaboration");
     UpdateCollaboration(onSuccess, onFailure, collaboration.Id, role, status, fields);
 }
 /// <summary>
 ///     Update the collaborator's role and status in an existing collaboration
 /// </summary>
 /// <param name="collaboration">The collaboration to update</param>
 /// <param name="role">The collaborator's new role</param>
 /// <param name="status">The collaborator's new status</param>
 /// <param name="fields">The properties that should be set on the returned Collaboration object.  Type and Id are always set.  If left null, all properties will be set, which can increase response time.</param>
 /// <returns>The updated collaboration</returns>
 public Collaboration Update(Collaboration collaboration, CollaborationRole role, Status status, IEnumerable<CollaborationField> fields = null)
 {
     GuardFromNull(collaboration, "collaboration");
     return UpdateCollaboration(collaboration.Id, role, status, fields);
 }
 /// <summary>
 ///     Add a collaboration for a single user to a folder.
 /// </summary>
 /// <param name="folder">The folder in which to collaborate</param>
 /// <param name="userId">The ID of the collaborating user</param>
 /// <param name="role">The role of the collaborating user</param>
 /// <param name="fields">The properties that should be set on the returned Collaboration object.  Type and Id are always set.  If left null, all properties will be set, which can increase response time.</param>
 /// <returns>The new collaboration</returns>
 public Collaboration CreateCollaboration(Folder folder, string userId, CollaborationRole role, IEnumerable<CollaborationField> fields = null)
 {
     GuardFromNull(folder, "folder");
     return CreateCollaboration(folder.Id, userId, role, fields);
 }
 /// <summary>
 ///     Update the collaborator's role and status in an existing collaboration
 /// </summary>
 /// <param name="onSuccess">Action to perform with the updated collaboration</param>
 /// <param name="onFailure">Action to perform following a failed Collaboration operation</param>
 /// <param name="collaborationId">The ID of the collaboration to update</param>
 /// <param name="role">The collaborator's new role</param>
 /// <param name="status">The collaborator's new status</param>
 /// <param name="fields">The properties that should be set on the returned Collaboration object.  Type and Id are always set.  If left null, all properties will be set, which can increase response time.</param>
 public void UpdateCollaboration(Action<Collaboration> onSuccess, Action<Error> onFailure, string collaborationId, CollaborationRole role, Status status, IEnumerable<CollaborationField> fields = null)
 {
     GuardFromNull(collaborationId, "collaborationId");
     var request = _requestHelper.UpdateCollaboration(collaborationId, role, status, fields);
     _restClient.ExecuteAsync(request, onSuccess, onFailure);
 }
        /// <summary>
        ///     Update the collaborator's role and status in an existing collaboration
        /// </summary>
        /// <param name="onSuccess">Action to perform with the updated collaboration</param>
        /// <param name="onFailure">Action to perform following a failed Collaboration operation</param>
        /// <param name="collaborationId">The ID of the collaboration to update</param>
        /// <param name="role">The collaborator's new role</param>
        /// <param name="status">The collaborator's new status</param>
        /// <param name="fields">The properties that should be set on the returned Collaboration object.  Type and Id are always set.  If left null, all properties will be set, which can increase response time.</param>
        public void UpdateCollaboration(Action <Collaboration> onSuccess, Action <Error> onFailure, string collaborationId, CollaborationRole role, Status status, IEnumerable <CollaborationField> fields = null)
        {
            GuardFromNull(collaborationId, "collaborationId");
            var request = _requestHelper.UpdateCollaboration(collaborationId, role, status, fields);

            _restClient.ExecuteAsync(request, onSuccess, onFailure);
        }
 /// <summary>
 ///     Update the collaborator's role and status in an existing collaboration
 /// </summary>
 /// <param name="onSuccess">Action to perform with the updated collaboration</param>
 /// <param name="onFailure">Action to perform following a failed Collaboration operation</param>
 /// <param name="collaboration">The collaboration to update</param>
 /// <param name="role">The collaborator's new role</param>
 /// <param name="status">The collaborator's new status</param>
 /// <param name="fields">The properties that should be set on the returned Collaboration object.  Type and Id are always set.  If left null, all properties will be set, which can increase response time.</param>
 public void Update(Action <Collaboration> onSuccess, Action <Error> onFailure, Collaboration collaboration, CollaborationRole role, Status status, IEnumerable <CollaborationField> fields = null)
 {
     GuardFromNull(collaboration, "collaboration");
     UpdateCollaboration(onSuccess, onFailure, collaboration.Id, role, status, fields);
 }
 /// <summary>
 ///     Update the collaborator's role and status in an existing collaboration
 /// </summary>
 /// <param name="collaboration">The collaboration to update</param>
 /// <param name="role">The collaborator's new role</param>
 /// <param name="status">The collaborator's new status</param>
 /// <param name="fields">The properties that should be set on the returned Collaboration object.  Type and Id are always set.  If left null, all properties will be set, which can increase response time.</param>
 /// <returns>The updated collaboration</returns>
 public Collaboration Update(Collaboration collaboration, CollaborationRole role, Status status, IEnumerable <CollaborationField> fields = null)
 {
     GuardFromNull(collaboration, "collaboration");
     return(UpdateCollaboration(collaboration.Id, role, status, fields));
 }
 /// <summary>
 ///     Add a collaboration for a single user to a folder.
 /// </summary>
 /// <param name="folder">The folder in which to collaborate</param>
 /// <param name="userId">The ID of the collaborating user</param>
 /// <param name="role">The role of the collaborating user</param>
 /// <param name="fields">The properties that should be set on the returned Collaboration object.  Type and Id are always set.  If left null, all properties will be set, which can increase response time.</param>
 /// <returns>The new collaboration</returns>
 public Collaboration CreateCollaboration(Folder folder, string userId, CollaborationRole role, IEnumerable <CollaborationField> fields = null)
 {
     GuardFromNull(folder, "folder");
     return(CreateCollaboration(folder.Id, userId, role, fields));
 }
 /// <summary>
 ///     Updat the collaborator's role and status in an existing collaboration
 /// </summary>
 /// <param name="collaborationId">The ID of the collaboration to update</param>
 /// <param name="role">The collaborator's new role</param>
 /// <param name="status">The collaborator's new status</param>
 /// <param name="fields">The properties that should be set on the returned Collaboration object.  Type and Id are always set.  If left null, all properties will be set, which can increase response time.</param>
 /// <returns>The updated collaboration</returns>
 public Collaboration UpdateCollaboration(string collaborationId, CollaborationRole role, Status status, IEnumerable<CollaborationField> fields = null)
 {
     GuardFromNull(collaborationId, "collaborationId");
     var request = _requestHelper.UpdateCollaboration(collaborationId, role, status, fields);
     return _restClient.ExecuteAndDeserialize<Collaboration>(request);
 }
 /// <summary>
 ///     Add a collaboration for a single user to a folder.
 /// </summary>
 /// <param name="folder">The folder in which to collaborate</param>
 /// <param name="emailAddress">The email address of the collaborator (does not need to be a Box user)</param>
 /// <param name="role">The role of the collaborating user</param>
 /// <param name="fields">The properties that should be set on the returned Collaboration object.  Type and Id are always set.  If left null, all properties will be set, which can increase response time.</param>
 /// <returns>The new collaboration</returns>
 public Collaboration CreateCollaborationByEmail(Folder folder, string emailAddress, CollaborationRole role, IEnumerable <CollaborationField> fields = null)
 {
     GuardFromNull(folder, "folder");
     return(CreateCollaborationByEmail(folder.Id, emailAddress, role, fields));
 }
 /// <summary>
 ///     Add a collaboration for a single user to a folder.
 /// </summary>
 /// <param name="onSuccess">Action to perform with the new collaboration</param>
 /// <param name="onFailure">Action to perform after a failed Collaboration operation </param>
 /// <param name="folder">The folder in which to collaborate</param>
 /// <param name="userId">The ID of the collaborating user</param>
 /// <param name="role">The role of the collaborating user</param>
 /// <param name="fields">The properties that should be set on the returned Collaboration object.  Type and Id are always set.  If left null, all properties will be set, which can increase response time.</param>
 public void CreateCollaboration(Action<Collaboration> onSuccess, Action<Error> onFailure, Folder folder, string userId, CollaborationRole role, IEnumerable<CollaborationField> fields = null)
 {
     GuardFromNull(folder, "folder");
     CreateCollaboration(onSuccess, onFailure, folder.Id, userId, role, fields);
 }
 /// <summary>
 ///     Add a collaboration for a single user to a folder.
 /// </summary>
 /// <param name="onSuccess">Action to perform with the new collaboration</param>
 /// <param name="onFailure">Action to perform after a failed Collaboration operation </param>
 /// <param name="folder">The folder in which to collaborate</param>
 /// <param name="userId">The ID of the collaborating user</param>
 /// <param name="role">The role of the collaborating user</param>
 /// <param name="fields">The properties that should be set on the returned Collaboration object.  Type and Id are always set.  If left null, all properties will be set, which can increase response time.</param>
 public void CreateCollaboration(Action <Collaboration> onSuccess, Action <Error> onFailure, Folder folder, string userId, CollaborationRole role, IEnumerable <CollaborationField> fields = null)
 {
     GuardFromNull(folder, "folder");
     CreateCollaboration(onSuccess, onFailure, folder.Id, userId, role, fields);
 }
 /// <summary>
 ///     Add a collaboration for a single user to a folder.
 /// </summary>
 /// <param name="folder">The folder in which to collaborate</param>
 /// <param name="emailAddress">The email address of the collaborator (does not need to be a Box user)</param>
 /// <param name="role">The role of the collaborating user</param>
 /// <param name="fields">The properties that should be set on the returned Collaboration object.  Type and Id are always set.  If left null, all properties will be set, which can increase response time.</param>
 /// <returns>The new collaboration</returns>
 public Collaboration CreateCollaborationByEmail(Folder folder, string emailAddress, CollaborationRole role, IEnumerable<CollaborationField> fields = null)
 {
     GuardFromNull(folder, "folder");
     return CreateCollaborationByEmail(folder.Id, emailAddress, role, fields);
 }
        /// <summary>
        ///     Add a collaboration for a single user to a folder.
        /// </summary>
        /// <param name="onSuccess">Action to perform with the new collaboration</param>
        /// <param name="onFailure">Action to perform after a failed Collaboration operation </param>
        /// <param name="folderId">The ID of the folder in which to collaborate</param>
        /// <param name="userId">The ID of the collaborating user</param>
        /// <param name="role">The role of the collaborating user</param>
        /// <param name="fields">The properties that should be set on the returned Collaboration object.  Type and Id are always set.  If left null, all properties will be set, which can increase response time.</param>
        public void CreateCollaboration(Action <Collaboration> onSuccess, Action <Error> onFailure, string folderId, string userId, CollaborationRole role, IEnumerable <CollaborationField> fields = null)
        {
            GuardFromNull(folderId, "folderId");
            GuardFromNull(userId, "userId");
            GuardFromNull(role, "role");
            var request = _requestHelper.CreateCollaboration(folderId, userId, role.Description(), fields);

            _restClient.ExecuteAsync(request, onSuccess, onFailure);
        }