Example #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 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);
        }
Example #2
0
        /// <summary>
        /// Send Bulk Emails Send bulk merge email. Required Access Level: SendHttp
        /// </summary>
        /// <exception cref="ElasticEmail.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="emailMessageData">Email data</param>
        /// <returns>ApiResponse of EmailSend</returns>
        public ElasticEmail.Client.ApiResponse <EmailSend> EmailsPostWithHttpInfo(EmailMessageData emailMessageData)
        {
            // verify the required parameter 'emailMessageData' is set
            if (emailMessageData == null)
            {
                throw new ElasticEmail.Client.ApiException(400, "Missing required parameter 'emailMessageData' when calling EmailsApi->EmailsPost");
            }

            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 = emailMessageData;

            // 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 = this.Client.Post <EmailSend>("/emails", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }
Example #3
0
        /// <summary>
        /// View Email Returns email details for viewing or rendering. Required Access Level: None
        /// </summary>
        /// <exception cref="ElasticEmail.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="msgid">Message identifier</param>
        /// <returns>ApiResponse of EmailData</returns>
        public ElasticEmail.Client.ApiResponse <EmailData> EmailsByMsgidViewGetWithHttpInfo(string msgid)
        {
            // verify the required parameter 'msgid' is set
            if (msgid == null)
            {
                throw new ElasticEmail.Client.ApiException(400, "Missing required parameter 'msgid' when calling EmailsApi->EmailsByMsgidViewGet");
            }

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

            String[] _contentTypes = new String[] {
            };

            // 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.PathParameters.Add("msgid", ElasticEmail.Client.ClientUtils.ParameterToString(msgid)); // path parameter

            // 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 = this.Client.Get <EmailData>("/emails/{msgid}/view", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }