complete endpoint tasks
This commit is contained in:
bovenliggende
2e5dbcbea0
commit
da7e3bf38b
@ -42,4 +42,4 @@ $subscriber = $klicktipp->subscriber()->search($subscriberId);
|
||||
|--------------------------------------------------------------------------------------|-------------------------|
|
||||
| account | :ballot_box_with_check: |
|
||||
| subscriber | :ballot_box_with_check: |
|
||||
| tag | :white_check_mark: |
|
||||
| tag | :ballot_box_with_check: |
|
||||
|
@ -50,4 +50,88 @@ class Subscriber extends Model
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws BaseException|GuzzleException
|
||||
*/
|
||||
public function subscribe(
|
||||
string $mailAddress,
|
||||
string $listId,
|
||||
string $tagId,
|
||||
array $fields,
|
||||
string $smsNumber
|
||||
): string
|
||||
{
|
||||
return current(
|
||||
$this->connection->requestAndParse(
|
||||
'POST',
|
||||
'subscriber',
|
||||
[
|
||||
RequestOptions::FORM_PARAMS => [
|
||||
'email' => trim($mailAddress),
|
||||
'listid' => trim($listId),
|
||||
'tagid' => trim($tagId),
|
||||
'fields' => array_filter($fields),
|
||||
'smsnumber' => trim($smsNumber),
|
||||
]
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws BaseException|GuzzleException
|
||||
*/
|
||||
public function unsubscribe(string $mailAddress): string
|
||||
{
|
||||
return current(
|
||||
$this->connection->requestAndParse(
|
||||
'POST',
|
||||
'subscriber/unsubscribe',
|
||||
[
|
||||
RequestOptions::FORM_PARAMS => [
|
||||
'email' => trim($mailAddress)
|
||||
]
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws BaseException|GuzzleException
|
||||
*/
|
||||
public function tag(string $mailAddress, string $tagId): string
|
||||
{
|
||||
return current(
|
||||
$this->connection->requestAndParse(
|
||||
'POST',
|
||||
'subscriber/tag',
|
||||
[
|
||||
RequestOptions::FORM_PARAMS => [
|
||||
'email' => trim($mailAddress),
|
||||
'tagid' => trim($tagId)
|
||||
]
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws BaseException|GuzzleException
|
||||
*/
|
||||
public function untag(string $mailAddress, string $tagId): string
|
||||
{
|
||||
return current(
|
||||
$this->connection->requestAndParse(
|
||||
'POST',
|
||||
'subscriber/search',
|
||||
[
|
||||
RequestOptions::FORM_PARAMS => [
|
||||
'email' => trim($mailAddress),
|
||||
'tagid' => trim($tagId)
|
||||
]
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -27,12 +27,52 @@ class Tag extends Model
|
||||
{
|
||||
$data = $this->connection->requestAndParse(
|
||||
'GET',
|
||||
'tag/'.urlencode(trim($tagId)),
|
||||
[
|
||||
RequestOptions::QUERY => $this->getQuery()
|
||||
]
|
||||
'tag/'.urlencode(trim($tagId))
|
||||
);
|
||||
|
||||
return new TagEntity($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws BaseException|GuzzleException
|
||||
*/
|
||||
public function create(string $name): array
|
||||
{
|
||||
return $this->connection->requestAndParse(
|
||||
'POST',
|
||||
'tag/',
|
||||
[
|
||||
RequestOptions::FORM_PARAMS => [
|
||||
'name' => trim($name)
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws BaseException|GuzzleException
|
||||
*/
|
||||
public function update(string $tagId, string $newName): array
|
||||
{
|
||||
return $this->connection->requestAndParse(
|
||||
'PUT',
|
||||
'tag/'.urlencode(trim($tagId)),
|
||||
[
|
||||
RequestOptions::FORM_PARAMS => [
|
||||
'name' => trim($newName)
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws BaseException|GuzzleException
|
||||
*/
|
||||
public function delete(string $tagId): array
|
||||
{
|
||||
return $this->connection->requestAndParse(
|
||||
'DELETE',
|
||||
'tag/'.urlencode(trim($tagId))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Laden…
x
Verwijs in nieuw issue
Block a user