Skip to content

Commit

Permalink
Merge pull request #70 from ToshY/feature/64-user-marketing-details-a…
Browse files Browse the repository at this point in the history
…nd-notifications

base api - add marketing details and notifications list
  • Loading branch information
ToshY authored Apr 22, 2023
2 parents e4a33d9 + 405bb13 commit ca36206
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/base-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1952,12 +1952,24 @@ $baseApi->acceptDpa();
$baseApi->getDpaDetailsHtml();
```

#### [List Notifications](https://docs.bunny.net/reference/userpublic_notificationslist)

```php
$baseApi->listNotifications();
```

#### [Set Notifications Opened](https://docs.bunny.net/reference/userpublic_setnotificationsopened)

```php
$baseApi->setNotificationsOpened();
```

#### [Get Marketing Details](https://docs.bunny.net/reference/userpublic_marketingdetails)

```php
$baseApi->getMarketingDetails();
```

#### [Get What's New Items](https://docs.bunny.net/reference/userpublic_whatsnew)

```php
Expand Down
32 changes: 32 additions & 0 deletions src/BaseAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,11 @@
use ToshY\BunnyNet\Model\API\Base\User\GetDPADetails;
use ToshY\BunnyNet\Model\API\Base\User\GetDPADetailsHTML;
use ToshY\BunnyNet\Model\API\Base\User\GetHomeFeed;
use ToshY\BunnyNet\Model\API\Base\User\GetMarketingDetails;
use ToshY\BunnyNet\Model\API\Base\User\GetUserDetails;
use ToshY\BunnyNet\Model\API\Base\User\GetWhatsNewItems;
use ToshY\BunnyNet\Model\API\Base\User\ListCloseAccountReasons;
use ToshY\BunnyNet\Model\API\Base\User\ListNotifications;
use ToshY\BunnyNet\Model\API\Base\User\ResendEmailConfirmation;
use ToshY\BunnyNet\Model\API\Base\User\ResetAPIKey;
use ToshY\BunnyNet\Model\API\Base\User\ResetWhatsNew;
Expand Down Expand Up @@ -2650,6 +2652,21 @@ public function getDpaDetailsHtml(): BunnyClientResponseInterface
);
}

/**
* @throws ClientExceptionInterface
* @throws Exception\BunnyClientResponseException
* @throws Exception\JSONException
* @return BunnyClientResponseInterface
*/
public function listNotifications(): BunnyClientResponseInterface
{
$endpoint = new ListNotifications();

return $this->client->request(
endpoint: $endpoint,
);
}

/**
* @throws ClientExceptionInterface
* @throws Exception\BunnyClientResponseException
Expand All @@ -2665,6 +2682,21 @@ public function setNotificationsOpened(): BunnyClientResponseInterface
);
}

/**
* @throws ClientExceptionInterface
* @throws Exception\BunnyClientResponseException
* @throws Exception\JSONException
* @return BunnyClientResponseInterface
*/
public function getMarketingDetails(): BunnyClientResponseInterface
{
$endpoint = new GetMarketingDetails();

return $this->client->request(
endpoint: $endpoint,
);
}

/**
* @throws ClientExceptionInterface
* @throws Exception\BunnyClientResponseException
Expand Down
29 changes: 29 additions & 0 deletions src/Model/API/Base/User/GetMarketingDetails.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

namespace ToshY\BunnyNet\Model\API\Base\User;

use ToshY\BunnyNet\Enum\Header;
use ToshY\BunnyNet\Enum\Method;
use ToshY\BunnyNet\Model\EndpointInterface;

class GetMarketingDetails implements EndpointInterface
{
public function getMethod(): Method
{
return Method::GET;
}

public function getPath(): string
{
return 'user/mkd';
}

public function getHeaders(): array
{
return [
Header::ACCEPT_JSON,
];
}
}
29 changes: 29 additions & 0 deletions src/Model/API/Base/User/ListNotifications.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

namespace ToshY\BunnyNet\Model\API\Base\User;

use ToshY\BunnyNet\Enum\Header;
use ToshY\BunnyNet\Enum\Method;
use ToshY\BunnyNet\Model\EndpointInterface;

class ListNotifications implements EndpointInterface
{
public function getMethod(): Method
{
return Method::GET;
}

public function getPath(): string
{
return 'user/notifications';
}

public function getHeaders(): array
{
return [
Header::ACCEPT_JSON,
];
}
}

0 comments on commit ca36206

Please sign in to comment.