private static void UnmarshallResult(XmlUnmarshallerContext context, ListVerifiedEmailAddressesResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.ReadAtDepth(originalDepth)) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("VerifiedEmailAddresses/member", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.VerifiedEmailAddresses.Add(item); continue; } } } return; }
private static void UnmarshallResult(XmlUnmarshallerContext context, ListVerifiedEmailAddressesResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("VerifiedEmailAddresses/member", targetDepth)) { response.VerifiedEmailAddresses.Add(StringUnmarshaller.GetInstance().Unmarshall(context)); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } return; }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { ListVerifiedEmailAddressesResponse response = new ListVerifiedEmailAddressesResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.IsStartElement) { if (context.TestExpression("ListVerifiedEmailAddressesResult", 2)) { UnmarshallResult(context, response); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context); } } } return(response); }
/// <summary> /// <para>Returns a list containing all of the email addresses that have /// been verified.</para> /// </summary> /// /// <param name="listVerifiedEmailAddressesRequest">Container for the /// necessary parameters to execute the ListVerifiedEmailAddresses service /// method on AmazonSimpleEmailService.</param> /// /// <returns>The response from the ListVerifiedEmailAddresses service /// method, as returned by AmazonSimpleEmailService.</returns> /// public ListVerifiedEmailAddressesResponse ListVerifiedEmailAddresses(ListVerifiedEmailAddressesRequest listVerifiedEmailAddressesRequest) { IRequest <ListVerifiedEmailAddressesRequest> request = new ListVerifiedEmailAddressesRequestMarshaller().Marshall(listVerifiedEmailAddressesRequest); ListVerifiedEmailAddressesResponse response = Invoke <ListVerifiedEmailAddressesRequest, ListVerifiedEmailAddressesResponse> (request, this.signer, ListVerifiedEmailAddressesResponseUnmarshaller.GetInstance()); return(response); }
/// <summary> /// Checks if the email is validated on the mailing list /// </summary> /// <param name="email">Email address to check</param> /// <exception cref="InvalidOperationException">Invalid email addresses</exception> /// <returns>Email is checked in the mailing list</returns> public static bool IsVerifiedEmail(string email) { if (!Util.IsValidEmail(email)) { throw new InvalidOperationException("Invalid email address"); } using (AmazonSimpleEmailServiceClient client = GetSimpleEmailClientInstance()) { ListVerifiedEmailAddressesRequest request = new ListVerifiedEmailAddressesRequest(); ListVerifiedEmailAddressesResponse response = client.ListVerifiedEmailAddresses(request); List <string> verifiedAddresses = response.VerifiedEmailAddresses; return(verifiedAddresses.Contains(email)); } }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonSimpleEmailServiceConfig config = new AmazonSimpleEmailServiceConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonSimpleEmailServiceClient client = new AmazonSimpleEmailServiceClient(creds, config); ListVerifiedEmailAddressesResponse resp = new ListVerifiedEmailAddressesResponse(); ListVerifiedEmailAddressesRequest req = new ListVerifiedEmailAddressesRequest { }; resp = client.ListVerifiedEmailAddresses(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.VerifiedEmailAddresses) { AddObject(obj); } }
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { ListVerifiedEmailAddressesResponse response = new ListVerifiedEmailAddressesResponse(); while (context.Read()) { if (context.IsStartElement) { if (context.TestExpression("ListVerifiedEmailAddressesResult", 2)) { response.ListVerifiedEmailAddressesResult = ListVerifiedEmailAddressesResultUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.GetInstance().Unmarshall(context); } } } return(response); }