Exemplo n.º 1
0
        //Performs a DELETE request
        public Task <bool> Delete(string aMethod, IList <IRequestParameter> aParams, DeezerPermissions aRequiredPermission)
        {
            CheckAuthentication();
            CheckPermissions(aRequiredPermission);

            AddDefaultsToParamList(aParams);

            return(iExecutor.ExecuteDelete(aMethod, aParams)
                   .ContinueWith((aTask) => aTask.Result.IsSuccessStatusCode, CancellationToken, TaskContinuationOptions.NotOnCanceled, TaskScheduler.Default));
        }
Exemplo n.º 2
0
        private Task <TResult> Delete <TResult>(string resource,
                                                DeezerPermissions requiredPermissions,
                                                CancellationToken cancellationToken,
                                                Func <Stream, TResult> resultFactory)
        {
            AssertAuthenticated(requiredPermissions);

            string actualResource = AppendAccessTokenToResourceIfRequired(resource);

            return(executor.ExecuteDelete(actualResource, cancellationToken)
                   .ContinueWith(t =>
            {
                t.ThrowIfFaulted();

                return resultFactory(t.Result);
            }, cancellationToken, TaskContinuationOptions.NotOnCanceled | TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default));
        }