Postmark\PostmarkAdminClient::editServer PHP Метод

editServer() публичный Метод

Modify an existing Server. Any parameters passed with NULL will be ignored (their existing values will not be modified).
public editServer ( integer $id, string $name = NULL, string $color = NULL, boolean $rawEmailEnabled = NULL, boolean $smtpApiActivated = NULL, string $inboundHookUrl = NULL, string $bounceHookUrl = NULL, string $openHookUrl = NULL, boolean $postFirstOpenOnly = NULL, boolean $trackOpens = NULL, string $inboundDomain = NULL, integer $inboundSpamThreshold = NULL, string $trackLinks = NULL ) : Postmark\Models\DynamicResponseModel
$id integer The ID of the Server we wish to modify.
$name string Set the name of the server.
$color string Set the color for the server in the Postmark WebUI (must be: 'purple', 'blue', 'turqoise', 'green', 'red', 'yellow', or 'grey')
$rawEmailEnabled boolean Enable raw email to be sent with inbound.
$smtpApiActivated boolean Specifies whether or not SMTP is enabled on this server.
$inboundHookUrl string URL to POST to everytime an inbound event occurs.
$bounceHookUrl string URL to POST to everytime a bounce event occurs.
$openHookUrl string URL to POST to everytime an open event occurs.
$postFirstOpenOnly boolean If set to true, only the first open by a particular recipient will initiate the open webhook. Any subsequent opens of the same email by the same recipient will not initiate the webhook.
$trackOpens boolean Indicates if all emails being sent through this server have open tracking enabled.
$inboundDomain string Inbound domain for MX setup.
$inboundSpamThreshold integer The maximum spam score for an inbound message before it's blocked (range from 0-30).
$trackLinks string Indicates if all emails being sent through this server have link tracking enabled.
Результат Postmark\Models\DynamicResponseModel
    function editServer($id, $name = NULL, $color = NULL, $rawEmailEnabled = NULL, $smtpApiActivated = NULL, $inboundHookUrl = NULL, $bounceHookUrl = NULL, $openHookUrl = NULL, $postFirstOpenOnly = NULL, $trackOpens = NULL, $inboundDomain = NULL, $inboundSpamThreshold = NULL, $trackLinks = NULL)
    {
        $body = array();
        $body['name'] = $name;
        $body['color'] = $color;
        $body['rawEmailEnabled'] = $rawEmailEnabled;
        $body['smtpApiActivated'] = $smtpApiActivated;
        $body['inboundHookUrl'] = $inboundHookUrl;
        $body['bounceHookUrl'] = $bounceHookUrl;
        $body['openHookUrl'] = $openHookUrl;
        $body['postFirstOpenOnly'] = $postFirstOpenOnly;
        $body['trackOpens'] = $trackOpens;
        $body['trackLinks'] = $trackLinks;
        $body['inboundDomain'] = $inboundDomain;
        $body['inboundSpamThreshold'] = $inboundSpamThreshold;
        $response = new DynamicResponseModel($this->processRestRequest('PUT', "/servers/{$id}", $body));
        $response["ID"] = $id;
        return $response;
    }

Usage Example

 function testClientCanEditServer()
 {
     $tk = parent::$testKeys;
     $client = new PostmarkAdminClient($tk->WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT);
     $server = $client->createServer('test-php-edit-' . date('c'), 'purple');
     $updateName = 'test-php-edit-' . date('c') . '-updated';
     $serverUpdated = $client->editServer($server->id, $updateName, 'green');
     $this->assertNotEmpty($serverUpdated);
     $this->assertNotSame($serverUpdated->name, $server->name);
     $this->assertNotSame($serverUpdated->color, $server->color);
 }