Beispiel #1
0
        /// <summary>
        /// Send Transactional Email Send transactional emails (recipients will be known to each other). Required Access Level: SendHttp
        /// </summary>
        /// <exception cref="ElasticEmail.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="emailTransactionalMessageData">Email data</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of EmailSend</returns>
        public async System.Threading.Tasks.Task <EmailSend> EmailsTransactionalPostAsync(EmailTransactionalMessageData emailTransactionalMessageData, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            ElasticEmail.Client.ApiResponse <EmailSend> localVarResponse = await EmailsTransactionalPostWithHttpInfoAsync(emailTransactionalMessageData, cancellationToken).ConfigureAwait(false);

            return(localVarResponse.Data);
        }
Beispiel #2
0
        /// <summary>
        /// Send Transactional Email Send transactional emails (recipients will be known to each other). Required Access Level: SendHttp
        /// </summary>
        /// <exception cref="ElasticEmail.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="emailTransactionalMessageData">Email data</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (EmailSend)</returns>
        public async System.Threading.Tasks.Task <ElasticEmail.Client.ApiResponse <EmailSend> > EmailsTransactionalPostWithHttpInfoAsync(EmailTransactionalMessageData emailTransactionalMessageData, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            // verify the required parameter 'emailTransactionalMessageData' is set
            if (emailTransactionalMessageData == null)
            {
                throw new ElasticEmail.Client.ApiException(400, "Missing required parameter 'emailTransactionalMessageData' when calling EmailsApi->EmailsTransactionalPost");
            }


            ElasticEmail.Client.RequestOptions localVarRequestOptions = new ElasticEmail.Client.RequestOptions();

            String[] _contentTypes = new String[] {
                "application/json"
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/json"
            };


            var localVarContentType = ElasticEmail.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = ElasticEmail.Client.ClientUtils.SelectHeaderAccept(_accepts);

            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.Data = emailTransactionalMessageData;

            // authentication (apikey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-ElasticEmail-ApiKey")))
            {
                localVarRequestOptions.HeaderParameters.Add("X-ElasticEmail-ApiKey", this.Configuration.GetApiKeyWithPrefix("X-ElasticEmail-ApiKey"));
            }

            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.PostAsync <EmailSend>("/emails/transactional", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("EmailsTransactionalPost", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
Beispiel #3
0
 /// <summary>
 /// Send Transactional Email Send transactional emails (recipients will be known to each other). Required Access Level: SendHttp
 /// </summary>
 /// <exception cref="ElasticEmail.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="emailTransactionalMessageData">Email data</param>
 /// <returns>EmailSend</returns>
 public EmailSend EmailsTransactionalPost(EmailTransactionalMessageData emailTransactionalMessageData)
 {
     ElasticEmail.Client.ApiResponse <EmailSend> localVarResponse = EmailsTransactionalPostWithHttpInfo(emailTransactionalMessageData);
     return(localVarResponse.Data);
 }