lib/API/TemplatesApi.php
/**
     * Create request for operation 'renderTemplate'
     *
     * @param  string $template_id (required)
     * @param  string $context This is the context your email template will be rendered with. Email templates are rendered with contexts in a similar manner to how Django templates are rendered. This means that nested template variables can be referenced via dot notation and template variables without corresponding context values are treated as falsy and output nothing. (optional, default to '{ "name" : "George Washington", "state" : "VA" }')
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Psr7\Request
     */
Create request for operation 'renderTemplate'
@param  string $template_id (required)
@param  string $context This is the context your email template will be rendered with. Email templates are rendered with contexts in a similar manner to how Django templates are rendered. This means that nested template variables can be referenced via dot notation and template variables without corresponding context values are treated as falsy and output nothing.


Create request for operation ' renderTemplate ' @param string $template_id ( required ) @param string $context This is the context your email template will be rendered with . Email templates are rendered with contexts in a similar manner to how Django templates are rendered . This means that nested template variables can be referenced via dot notation and template variables without corresponding context values are treated as falsy and output nothing .
public function renderTemplateRequest($template_id, $context = '{ "name" : "George Washington", "state" : "VA" }')
    {
        if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) {
            throw new \InvalidArgumentException(
                'Missing the required parameter $template_id when calling renderTemplate'
            );
        }
        $resourcePath = '/v1/email-template/{template_id}/render';
        $formParams = [];
        $queryParams = [];
        $headerParams = [];
        $httpBody = '';
        $multipart = false;
        if ($template_id !== null) {
            $resourcePath = str_replace(
                '{' . 'template_id' . '}',
                ObjectSerializer::toPathValue($template_id),
                $resourcePath
            );
        }
        if ($context !== null) {
            $formParams['context'] = ObjectSerializer::toFormValue($context);
        }
        if ($multipart) {
            $headers = $this->headerSelector->selectHeadersForMultipart(
                ['application/json']
            );
        } else {
            $headers = $this->headerSelector->selectHeaders(
                ['application/json'],
                ['application/x-www-form-urlencoded']
            );
        }
        if (count($formParams) > 0) {
            if ($multipart) {
                $multipartContents = [];
                foreach ($formParams as $formParamName => $formParamValue) {
                    $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
                    foreach ($formParamValueItems as $formParamValueItem) {
                        $multipartContents[] = [
                            'name' => $formParamName,
                            'contents' => $formParamValueItem
                        ];
                    }
                }
                $httpBody = new MultipartStream($multipartContents);
            } elseif ($headers['Content-Type'] === 'application/json') {
                $httpBody = \GuzzleHttp\json_encode($formParams);
            } else {
                $httpBody = \GuzzleHttp\Psr7\Query::build($formParams);
            }
        }
        $apiKey = $this->config->getApiKeyWithPrefix('api_key');
        if ($apiKey !== null) {
            $queryParams['api_key'] = $apiKey;
        }
        $defaultHeaders = [];
        if ($this->config->getUserAgent()) {
            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
        }
        $headers = array_merge(
            $defaultHeaders,
            $headerParams,
            $headers
        );
        $query = \GuzzleHttp\Psr7\Query::build($queryParams);
        return new Request(
            'POST',
            $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
            $headers,
            $httpBody
        );
    }
public function renderTemplateRequest ( $ template_id , $ context = '{ "name" : "George Washington", "state" : "VA" }' ) { if ( $ template_id === null || ( is_array ( $ template_id ) && count ( $ template_id ) === 0 ) ) { throw new \ InvalidArgumentException ( 'Missing the required parameter $template_id when calling renderTemplate' ) ; } $ resourcePath = '/v1/email-template/{template_id}/render' ; $ formParams = [ ] ; $ queryParams = [ ] ; $ headerParams = [ ] ; $ httpBody = '' ; $ multipart = false ; if ( $ template_id !== null ) { $ resourcePath = str_replace ( '{' . 'template_id' . '}' , ObjectSerializer :: toPathValue ( $ template_id ) , $ resourcePath ) ; } if ( $ context !== null ) { $ formParams [ 'context' ] = ObjectSerializer :: toFormValue ( $ context ) ; } if ( $ multipart ) { $ headers = $ this -> headerSelector -> selectHeadersForMultipart ( [ 'application/json' ] ) ; } else { $ headers = $ this -> headerSelector -> selectHeaders ( [ 'application/json' ] , [ 'application/x-www-form-urlencoded' ] ) ; } if ( count ( $ formParams ) > 0 ) { if ( $ multipart ) { $ multipartContents = [ ] ; foreach ( $ formParams as $ formParamName => $ formParamValue ) { $ formParamValueItems = is_array ( $ formParamValue ) ? $ formParamValue : [ $ formParamValue ] ; foreach ( $ formParamValueItems as $ formParamValueItem ) { $ multipartContents [ ] = [ 'name' => $ formParamName , 'contents' => $ formParamValueItem ] ; } } $ httpBody = new MultipartStream ( $ multipartContents ) ; } elseif ( $ headers [ 'Content-Type' ] === 'application/json' ) { $ httpBody = \ GuzzleHttp \ json_encode ( $ formParams ) ; } else { $ httpBody = \ GuzzleHttp \ Psr7 \ Query :: build ( $ formParams ) ; } } $ apiKey = $ this -> config -> getApiKeyWithPrefix ( 'api_key' ) ; if ( $ apiKey !== null ) { $ queryParams [ 'api_key' ] = $ apiKey ; } $ defaultHeaders = [ ] ; if ( $ this -> config -> getUserAgent ( ) ) { $ defaultHeaders [ 'User-Agent' ] = $ this -> config -> getUserAgent ( ) ; } $ headers = array_merge ( $ defaultHeaders , $ headerParams , $ headers ) ; $ query = \ GuzzleHttp \ Psr7 \ Query :: build ( $ queryParams ) ; return new Request ( 'POST' , $ this -> config -> getHost ( ) . $ resourcePath . ( $ query ? " ? { $ query } " : '' ) , $ headers , $ httpBody ) ; }
Create request for operation 'renderTemplate'
 @param  string $template_id (required)
 @param  string $context This is the context your email template will be rendered with.
Create request for operation ' renderTemplate ' @param string $template_id ( required ) @param string $context This is the context your email template will be rendered with .
// verify the required parameter 'template_id' is set // path params // form params // for model (json/xml) // for HTTP post (form) // for HTTP post (form) // this endpoint requires API key authentication