Exemplo n.º 1
0
        /// <summary>
        /// Deletes the attributes specified in the attributeNamesToDelete list using
        /// an asynchronous call
        /// </summary>
        /// <param name="attributeNamesToDelete">List of attributes to delete</param>
        public virtual async Task DeleteAttributesAsync(IList <string> attributeNamesToDelete)
        {
            DeleteUserAttributesRequest deleteUserAttributesRequest =
                CreateDeleteUserAttributesRequest(attributeNamesToDelete);

            await Provider.DeleteUserAttributesAsync(deleteUserAttributesRequest).ConfigureAwait(false);

            //Update the local Attributes property
            foreach (string attribute in attributeNamesToDelete)
            {
                if (Attributes.ContainsKey(attribute))
                {
                    Attributes.Remove(attribute);
                }
            }
        }
Exemplo n.º 2
0
        private DeleteUserAttributesRequest CreateDeleteUserAttributesRequest(IList <string> attributeNamesToDelete)
        {
            if (attributeNamesToDelete == null || attributeNamesToDelete.Count < 1)
            {
                throw new ArgumentNullException("attributeNamesToDelete cannot be null or empty.", "attributeNamesToDelete");
            }

            EnsureUserAuthenticated();

            DeleteUserAttributesRequest deleteUserAttributesRequest = new DeleteUserAttributesRequest()
            {
                AccessToken        = SessionTokens.AccessToken,
                UserAttributeNames = new List <string>(attributeNamesToDelete)
            };

            return(deleteUserAttributesRequest);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Deletes the attributes specified in the attributeNamesToDelete list using
        /// an asynchronous call
        /// </summary>
        /// <param name="attributeNamesToDelete">List of attributes to delete</param>
        public void DeleteAttributesAsync(IList <string> attributeNamesToDelete, AsyncCallback callback = null)
        {
            DeleteUserAttributesRequest deleteUserAttributesRequest =
                CreateDeleteUserAttributesRequest(attributeNamesToDelete);

            Provider.DeleteUserAttributesAsync(deleteUserAttributesRequest, r =>
            {
                if (r.Exception == null)
                {
                    //Update the local Attributes property
                    foreach (string attribute in attributeNamesToDelete)
                    {
                        if (Attributes.ContainsKey(attribute))
                        {
                            Attributes.Remove(attribute);
                        }
                    }
                }

                callback?.Invoke(new AsyncResult(r.Exception));
            });
        }
 public void DeleteUserAttributesAsync(DeleteUserAttributesRequest request, AmazonServiceCallback <DeleteUserAttributesRequest, DeleteUserAttributesResponse> callback, AsyncOptions options = null)
 {
     throw new System.NotImplementedException();
 }