Syncano.Net.Api.UserSyncanoClient.Delete C# (CSharp) Method

Delete() public method

Deletes (permanently) specified user and all associated data objects. The user_id/user_name parameter means that one can use either one of them - user_id or user_name. User API key usage permitted. In this case, it can only be used to update currently associated user. User_id is automatically filled with current user's id.
public Delete ( string userId = null, string userName = null ) : Task
userId string User id defining user to delete. User_id is automatically filled when used with User API key.
userName string User name defining user to delete.
return Task
        public Task<bool> Delete(string userId = null, string userName = null)
        {
            if(userId == null && userName == null)
                throw new ArgumentNullException();

            return _syncanoClient.GetAsync("user.delete", new {user_id = userId, user_name = userName});
        }
    }

Usage Example

        public async Task Update_DeleteAvatar_UpdatesUserObject(UserSyncanoClient client)
        {
            //given
            string name = "newUserName" + Guid.NewGuid().GetHashCode();
            const string password = "******";
            var user = await client.New(name, password, avatar: TestData.ImageToBase64("smallSampleImage.png"));

            //when
            var updatedUser = await client.Update(user.Id, avatar: "", currentPassword: password);

            //then
            updatedUser.ShouldNotBeNull();
            updatedUser.Id.ShouldEqual(user.Id);
            updatedUser.Avatar.ShouldBeNull();

            //cleanup
            await client.Delete(user.Id);
        }
All Usage Examples Of Syncano.Net.Api.UserSyncanoClient::Delete