lib/API/TemplatesApi.php
/**
     * Operation sendTemplateAsyncWithHttpInfo
     *
     * Render and Send Template
     *
     * @param  string $template_id (required)
     * @param  string $from_email (required)
     * @param  string $from_name (required)
     * @param  string $subject (required)
     * @param  string $to **Mixed**. string, or JSON encoded array of objects with \\\&quot;email\\\&quot; and \\\&quot;name\\\&quot; keys. &#x60;abraham.lincoln@klaviyo.com&#x60; OR &#x60;[{\\\&quot;name\\\&quot;:\\\&quot;Abraham Lincoln\\\&quot;,\\\&quot;email\\\&quot;:\\\&quot;abraham.lincoln@klaviyo.com\\\&quot;}]&#x60; (required)
     * @param  string $context Optional, JSON object. 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. ex: &#x60;{ \\\&quot;name\\\&quot; : \\\&quot;George Washington\\\&quot;, \\\&quot;state\\\&quot; : \\\&quot;VA\\\&quot; }&#x60; (optional, default to '{ "name" : "George Washington", "state" : "VA" }')
     *
     * @throws \InvalidArgumentException
     * @return \GuzzleHttp\Promise\PromiseInterface
     */
Operation sendTemplateAsyncWithHttpInfo
Render and Send Template




Operation sendTemplateAsyncWithHttpInfo Render and Send Template
public function sendTemplateAsyncWithHttpInfo($template_id, $from_email, $from_name, $subject, $to, $context = '{ "name" : "George Washington", "state" : "VA" }')
    {
        $returnType = 'array<string,object>';
        $request = $this->sendTemplateRequest($template_id, $from_email, $from_name, $subject, $to, $context);
        return $this->client
            ->sendAsync($request, $this->createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    if ($returnType === '\SplFileObject') {
                        $content = $response->getBody(); 
                    } else {
                        $content = (string) $response->getBody();
                    }
                    return [
                        ObjectSerializer::deserialize($content, $returnType, []),
                        $response->getStatusCode(),
                        $response->getHeaders()
                    ];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        (string) $response->getBody()
                    );
                }
            );
    }
public function sendTemplateAsyncWithHttpInfo ( $ template_id , $ from_email , $ from_name , $ subject , $ to , $ context = '{ "name" : "George Washington", "state" : "VA" }' ) { $ returnType = 'array<string,object>' ; $ request = $ this -> sendTemplateRequest ( $ template_id , $ from_email , $ from_name , $ subject , $ to , $ context ) ; return $ this -> client -> sendAsync ( $ request , $ this -> createHttpClientOption ( ) ) -> then ( function ( $ response ) use ( $ returnType ) { if ( $ returnType === '\SplFileObject' ) { $ content = $ response -> getBody ( ) ; } else { $ content = ( string ) $ response -> getBody ( ) ; } return [ ObjectSerializer :: deserialize ( $ content , $ returnType , [ ] ) , $ response -> getStatusCode ( ) , $ response -> getHeaders ( ) ] ; } , function ( $ exception ) { $ response = $ exception -> getResponse ( ) ; $ statusCode = $ response -> getStatusCode ( ) ; throw new ApiException ( sprintf ( '[%d] Error connecting to the API (%s)' , $ statusCode , $ exception -> getRequest ( ) -> getUri ( ) ) , $ statusCode , $ response -> getHeaders ( ) , ( string ) $ response -> getBody ( ) ) ; } ) ; }
Operation sendTemplateAsyncWithHttpInfo
 Render and Send Template
Operation sendTemplateAsyncWithHttpInfo Render and Send Template
//stream goes to serializer