//
// EmailAPI.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//

import Foundation
import Alamofire



open class EmailAPI {
    /**
     Partially check whether an email address is valid
     
     - parameter email: (body) Email address to validate, e.g. \&quot;support@cloudmersive.com\&quot;.    The input is a string so be sure to enclose it in double-quotes. 
     - parameter completion: completion handler to receive the data and the error objects
     */
    open class func emailAddressGetServers(email: String, completion: @escaping ((_ data: AddressGetServersResponse?,_ error: Error?) -> Void)) {
        emailAddressGetServersWithRequestBuilder(email: email).execute { (response, error) -> Void in
            completion(response?.body, error)
        }
    }


    /**
     Partially check whether an email address is valid
     - POST /validate/email/address/servers
     - Validate an email address by identifying whether its parent domain has email servers defined.  This call is less limited than syntaxOnly but not as comprehensive as address/full.
     - API Key:
       - type: apiKey Apikey 
       - name: Apikey
     - examples: [{contentType=application/json, example={
  "Servers" : [ "Servers", "Servers" ],
  "Success" : true
}}, {contentType=application/xml, example=<null>
  <Success>true</Success>
  <Servers>aeiou</Servers>
</null>}]
     - examples: [{contentType=application/json, example={
  "Servers" : [ "Servers", "Servers" ],
  "Success" : true
}}, {contentType=application/xml, example=<null>
  <Success>true</Success>
  <Servers>aeiou</Servers>
</null>}]
     
     - parameter email: (body) Email address to validate, e.g. \&quot;support@cloudmersive.com\&quot;.    The input is a string so be sure to enclose it in double-quotes. 

     - returns: RequestBuilder<AddressGetServersResponse> 
     */
    open class func emailAddressGetServersWithRequestBuilder(email: String) -> RequestBuilder<AddressGetServersResponse> {
        let path = "/validate/email/address/servers"
        let URLString = SwaggerClientAPI.basePath + path
        let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: email)

        let url = URLComponents(string: URLString)

        let requestBuilder: RequestBuilder<AddressGetServersResponse>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder()

        return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true)
    }

    /**
     Fully validate an email address
     
     - parameter email: (body) Email address to validate, e.g. \&quot;support@cloudmersive.com\&quot;.    The input is a string so be sure to enclose it in double-quotes. 
     - parameter completion: completion handler to receive the data and the error objects
     */
    open class func emailFullValidation(email: String, completion: @escaping ((_ data: FullEmailValidationResponse?,_ error: Error?) -> Void)) {
        emailFullValidationWithRequestBuilder(email: email).execute { (response, error) -> Void in
            completion(response?.body, error)
        }
    }


    /**
     Fully validate an email address
     - POST /validate/email/address/full
     - Performs a full validation of the email address.  Checks for syntactic correctness, identifies the mail server in question if any, and then contacts the email server to validate the existence of the account - without sending any emails.
     - API Key:
       - type: apiKey Apikey 
       - name: Apikey
     - examples: [{contentType=application/json, example={
  "ValidAddress" : true,
  "MailServerUsedForValidation" : "MailServerUsedForValidation",
  "Valid_Syntax" : true,
  "IsCatchallDomain" : true,
  "Valid_SMTP" : true,
  "Valid_Domain" : true,
  "Domain" : "Domain"
}}, {contentType=application/xml, example=<null>
  <ValidAddress>true</ValidAddress>
  <MailServerUsedForValidation>aeiou</MailServerUsedForValidation>
  <Valid_Syntax>true</Valid_Syntax>
  <Valid_Domain>true</Valid_Domain>
  <Valid_SMTP>true</Valid_SMTP>
  <IsCatchallDomain>true</IsCatchallDomain>
  <Domain>aeiou</Domain>
</null>}]
     - examples: [{contentType=application/json, example={
  "ValidAddress" : true,
  "MailServerUsedForValidation" : "MailServerUsedForValidation",
  "Valid_Syntax" : true,
  "IsCatchallDomain" : true,
  "Valid_SMTP" : true,
  "Valid_Domain" : true,
  "Domain" : "Domain"
}}, {contentType=application/xml, example=<null>
  <ValidAddress>true</ValidAddress>
  <MailServerUsedForValidation>aeiou</MailServerUsedForValidation>
  <Valid_Syntax>true</Valid_Syntax>
  <Valid_Domain>true</Valid_Domain>
  <Valid_SMTP>true</Valid_SMTP>
  <IsCatchallDomain>true</IsCatchallDomain>
  <Domain>aeiou</Domain>
</null>}]
     
     - parameter email: (body) Email address to validate, e.g. \&quot;support@cloudmersive.com\&quot;.    The input is a string so be sure to enclose it in double-quotes. 

     - returns: RequestBuilder<FullEmailValidationResponse> 
     */
    open class func emailFullValidationWithRequestBuilder(email: String) -> RequestBuilder<FullEmailValidationResponse> {
        let path = "/validate/email/address/full"
        let URLString = SwaggerClientAPI.basePath + path
        let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: email)

        let url = URLComponents(string: URLString)

        let requestBuilder: RequestBuilder<FullEmailValidationResponse>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder()

        return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true)
    }

    /**
     Validate email adddress for syntactic correctness only
     
     - parameter value: (body) Email address to validate, e.g. \&quot;support@cloudmersive.com\&quot;.    The input is a string so be sure to enclose it in double-quotes. 
     - parameter completion: completion handler to receive the data and the error objects
     */
    open class func emailPost(value: String, completion: @escaping ((_ data: AddressVerifySyntaxOnlyResponse?,_ error: Error?) -> Void)) {
        emailPostWithRequestBuilder(value: value).execute { (response, error) -> Void in
            completion(response?.body, error)
        }
    }


    /**
     Validate email adddress for syntactic correctness only
     - POST /validate/email/address/syntaxOnly
     - Validate whether a given email address is syntactically correct via a limited local-only check.  Use the address/full API to do a full validation.
     - API Key:
       - type: apiKey Apikey 
       - name: Apikey
     - examples: [{contentType=application/json, example={
  "ValidAddress" : true
}}, {contentType=application/xml, example=<null>
  <ValidAddress>true</ValidAddress>
</null>}]
     - examples: [{contentType=application/json, example={
  "ValidAddress" : true
}}, {contentType=application/xml, example=<null>
  <ValidAddress>true</ValidAddress>
</null>}]
     
     - parameter value: (body) Email address to validate, e.g. \&quot;support@cloudmersive.com\&quot;.    The input is a string so be sure to enclose it in double-quotes. 

     - returns: RequestBuilder<AddressVerifySyntaxOnlyResponse> 
     */
    open class func emailPostWithRequestBuilder(value: String) -> RequestBuilder<AddressVerifySyntaxOnlyResponse> {
        let path = "/validate/email/address/syntaxOnly"
        let URLString = SwaggerClientAPI.basePath + path
        let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: value)

        let url = URLComponents(string: URLString)

        let requestBuilder: RequestBuilder<AddressVerifySyntaxOnlyResponse>.Type = SwaggerClientAPI.requestBuilderFactory.getBuilder()

        return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true)
    }

}
