/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { PurgeQueueResponse response = new PurgeQueueResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.IsStartElement) { if(context.TestExpression("PurgeQueueResult", 2)) { UnmarshallResult(context, response); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context); } } } return response; }
// snippet-start:[sqs.dotnetv3.SQSSendMessagesExample.DeleteAllMessages] /// <summary> /// Method to delete all messages from the queue. /// </summary> /// <param name="sqsClient">The SQS client, created in Main.</param> /// <param name="qUrl">The URL of the queue, given as a command line argument.</param> private static async Task DeleteAllMessages(IAmazonSQS sqsClient, string qUrl) { Console.WriteLine($"\nPurging messages from queue\n {qUrl}..."); PurgeQueueResponse responsePurge = await sqsClient.PurgeQueueAsync(qUrl); Console.WriteLine($"HttpStatusCode: {responsePurge.HttpStatusCode}"); }
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { PurgeQueueResponse response = new PurgeQueueResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.IsStartElement) { if (context.TestExpression("PurgeQueueResult", 2)) { UnmarshallResult(context, response); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context); } } } return(response); }
public override T Unmarshall <T>(IResponseContext context) { try { var response = new PurgeQueueResponse(); ResultUnmarshall(context, response); var xmlRootNode = GetXmlElement(context.ContentStream); response.ResponseMetadata.RequestId = xmlRootNode.SelectSingleNode("ResponseMetadata/RequestId")?.InnerText; return(response as T); } catch (Exception ex) { throw ErrorUnmarshall(ex.Message, ex, context.StatusCode); } }
private static void UnmarshallResult(XmlUnmarshallerContext context, PurgeQueueResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) targetDepth += 2; while (context.ReadAtDepth(originalDepth)) { if (context.IsStartElement || context.IsAttribute) { } } return; }
private static void UnmarshallResult(XmlUnmarshallerContext context, PurgeQueueResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.ReadAtDepth(originalDepth)) { if (context.IsStartElement || context.IsAttribute) { } } return; }