8
0

complete endpoint tasks

Dieser Commit ist enthalten in:
Daniel Seifert 2024-12-22 13:54:42 +01:00
Ursprung 2e5dbcbea0
Commit da7e3bf38b
Signiert von: DanielS
GPG-Schlüssel-ID: 6A513E13AEE66170
3 geänderte Dateien mit 129 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -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: |

Datei anzeigen

@ -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)
]
]
)
);
}
}

Datei anzeigen

@ -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))
);
}
}