Delete() public method

Deletes specified API client. Only Admin permission role can delete API clients.
public Delete ( string apiClientId ) : Task
apiClientId string API client id defining API client to delete.
return Task
コード例 #1
0
 public async Task Delete_WithInvalidApiKey_ThrowsException(ApiKeySyncanoClient client)
 {
     try
     {
         //when
         await client.Delete("abcde123");
         throw new Exception("Delete should throw an exception");
     }
     catch (Exception e)
     {
         //then
         e.ShouldBeType<SyncanoException>();
     }
 }
コード例 #2
0
        public async Task New_UserType_CreatesNewApiKey(ApiKeySyncanoClient client)
        {
            //given
            var description = "apiKey description";

            //when
            var apiKey = await client.New(description, ApiKeyType.User);

            //then
            apiKey.ShouldNotBeNull();
            apiKey.Description.ShouldEqual(description);

            //cleanup
            await client.Delete(apiKey.Id);
        }
コード例 #3
0
 public async Task Delete_WithNullApiKey_ThrowsException(ApiKeySyncanoClient client)
 {
     try
     {
         //when
         await client.Delete(null);
         throw new Exception("Delete should throw an exception");
     }
     catch (Exception e)
     {
         //then
         e.ShouldBeType<ArgumentNullException>();
     }
 }
コード例 #4
0
        public async Task Delete_UserType_DeletesApiKey(ApiKeySyncanoClient client)
        {
            //given
            var description = "apiKey description";
            var apiKey = await client.New(description, ApiKeyType.User);

            //when
            var result = await client.Delete(apiKey.Id);

            //then
            result.ShouldBeTrue();
        }
コード例 #5
0
        public async Task Deauthorize_WithSubscribePermission(ApiKeySyncanoClient client)
        {
            //given
            var description = "apiKey description";
            var apiKey = await client.New(description, ApiKeyType.User);
            await client.Authorize(apiKey.Id, ApiKeyPermission.SendNotification);

            //when
            var result = await client.Deauthorize(apiKey.Id, ApiKeyPermission.SendNotification);

            //then
            result.ShouldBeTrue();

            //cleanup
            await client.Delete(apiKey.Id);
        }
コード例 #6
0
        public async Task Authorize_WithAccessSyncPermission(ApiKeySyncanoClient client)
        {
            //given
            var description = "apiKey description";
            var apiKey = await client.New(description, ApiKeyType.User);

            //when
            var result = await client.Authorize(apiKey.Id, ApiKeyPermission.AccessSync);

            //then
            result.ShouldBeTrue();

            //cleanup
            await client.Delete(apiKey.Id);
        }
コード例 #7
0
        public async Task Update_UpdatesApiKey(ApiKeySyncanoClient client)
        {
            //given
            var description = "apiKey description";
            var newDescription = "new apiKey description";
            var apiKey = await client.New(description, ApiKeyType.Backend, TestData.RoleId);

            //when
            apiKey = await client.UpdateDescription(newDescription, apiKey.Id);

            //then
            apiKey.ShouldNotBeNull();
            apiKey.Description.ShouldEqual(newDescription);

            //cleanup
            await client.Delete(apiKey.Id);
        }