/**
 * This Endpoint sends emails with the credentials passed.
 * @param    *string                      apiKey      parameter: Optional
 * @param    *models_pkg.EmailBody        body        parameter: Optional
 * @return	Returns the *models_pkg.SendEmailResponse response from the API call
 */
This Endpoint sends emails with the credentials passed.
@param    *string                      apiKey      parameter: Optional
@param    *models_pkg.EmailBody        body        parameter: Optional
@return	Returns the *models_pkg.SendEmailResponse response from the API call
/ ** * This Endpoint sends emails with the credentials passed . * @param * string apiKey parameter : Optional * @param * models_pkg . EmailBody body parameter : Optional * @return Returns the * models_pkg . SendEmailResponse response from the API call * /
func (me *EMAIL_IMPL) CreateSendEmail(
	apiKey *string,
	body *models_pkg.EmailBody) (*models_pkg.SendEmailResponse, error) {
	_queryBuilder := configuration_pkg.BASEURI
	_queryBuilder = _queryBuilder + "/v4/sendEmail"
	var err error = nil
	_queryBuilder, err = apihelper_pkg.CleanUrl(_queryBuilder)
	if err != nil {
		return nil, err
	}
	headers := map[string]interface{}{
		"user-agent":   "pepi-sdk-go v2",
		"accept":       "application/json",
		"content-type": "application/json; charset=utf-8",
		"api_key":      apihelper_pkg.ToString(apiKey, ""),
	}
	_request := unirest.Post(_queryBuilder, headers, body)
	_response, err := unirest.AsString(_request,false)
	if err != nil {
		return nil, err
	}
	if _response.Code == 405 {
		err = apihelper_pkg.NewAPIError("Method not allowed", _response.Code, _response.RawBody)
	}
	if err != nil {
		return nil, err
	}
	var retVal *models_pkg.SendEmailResponse = &models_pkg.SendEmailResponse{}
	err = json.Unmarshal(_response.RawBody, &retVal)
	if err != nil {
		return nil, err
	}
	return retVal, nil
}
func ( me * EMAIL_IMPL ) CreateSendEmail ( apiKey * string , body * models_pkg . EmailBody ) ( * models_pkg . SendEmailResponse , error ) { _queryBuilder := configuration_pkg . BASEURI _queryBuilder = _queryBuilder + " " var err error = nil _queryBuilder , err = apihelper_pkg . CleanUrl ( _queryBuilder ) if err != nil { return nil , err } headers := map [ string ] interface { } { " " : " " , " " : " " , " " : " " , " " : apihelper_pkg . ToString ( apiKey , " " ) , } _request := unirest . Post ( _queryBuilder , headers , body ) _response , err := unirest . AsString ( _request , false ) if err != nil { return nil , err } if _response . Code == 405 { err = apihelper_pkg . NewAPIError ( " " , _response . Code , _response . RawBody ) } if err != nil { return nil , err } var retVal * models_pkg . SendEmailResponse = & models_pkg . SendEmailResponse { } err = json . Unmarshal ( _response . RawBody , & retVal ) if err != nil { return nil , err } return retVal , nil }
This Endpoint sends emails with the credentials passed.
This Endpoint sends emails with the credentials passed .
//the base uri for api requests //prepare query string for API call //	_queryBuilder = _queryBuilder + "/v2/sendEmail" //variable to hold errors //validate and preprocess url //error in url validation or cleaning //prepare headers for the outgoing request //prepare API request //and invoke the API call request to fetch the response //error in API invocation //error handling using HTTP status codes //error detected in status code validation //returning the response //error in parsing