Skip to content

Commit

Permalink
Added endpoint to truncate contact list (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
inDeev committed Sep 7, 2022
1 parent c65905e commit 6fd7282
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Request/Contactlists/ContactlistEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,9 @@ public function get(int $listId): Contactlist
return new Contactlist($this->api, $listId);
}

public function truncate(int $listId): ContactlistTruncate
{
return new ContactlistTruncate($this->api, $listId);
}

}
50 changes: 50 additions & 0 deletions src/Request/Contactlists/ContactlistTruncate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php declare(strict_types=1);

namespace SmartEmailing\v3\Request\Contactlists;

use SmartEmailing\v3\Api;
use SmartEmailing\v3\Exceptions\InvalidFormatException;
use SmartEmailing\v3\Request\AbstractRequest;

class ContactlistTruncate extends AbstractRequest
{
/** @var int */
private $listId;

public function __construct(Api $api, int $listId)
{
parent::__construct($api);

$this->listId = $listId;
}

protected function method(): string
{
return 'POST';
}

protected function endpoint(): string
{
return 'contactlists/' . $this->listId . '/truncate';
}

protected function options(): array
{
return [
'json' => $this->jsonSerialize()
];
}

private function toArray(): array
{
return [];
}

/**
* @return array
*/
public function jsonSerialize()
{
return $this->toArray();
}
}

0 comments on commit 6fd7282

Please sign in to comment.