Skip to content

Commit

Permalink
Merge pull request #2 from bigpaulie/master
Browse files Browse the repository at this point in the history
Adding notification preferences endpoints
  • Loading branch information
marrek13 authored Feb 1, 2018
2 parents 826fdb0 + 45d53c3 commit bb94fc0
Show file tree
Hide file tree
Showing 16 changed files with 295 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ Package currently has got support for calling Bonanza's methods:
* reviseFixedPriceItem
* endFixedPriceItem
* updateBooth
* setNotificationPreferences
* getNotificationPreferences

Please refer to the Bonanza's API docs here: https://api.bonanza.com/docs
14 changes: 14 additions & 0 deletions src/Shoplo/BonanzaApi/Client/BonanzaClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
use Shoplo\BonanzaApi\Request\GetBoothRequest;
use Shoplo\BonanzaApi\Request\GetCategoriesRequest;
use Shoplo\BonanzaApi\Request\GetCategoryTraitsRequest;
use Shoplo\BonanzaApi\Request\GetNotificationPreferencesRequest;
use Shoplo\BonanzaApi\Request\GetOrdersRequest;
use Shoplo\BonanzaApi\Request\GetSingleItemRequest;
use Shoplo\BonanzaApi\Request\GetUnlistedItemRequest;
use Shoplo\BonanzaApi\Request\GetUserProfileRequest;
use Shoplo\BonanzaApi\Request\GetUserRequest;
use Shoplo\BonanzaApi\Request\ReviseFixedPriceItemRequest;
use Shoplo\BonanzaApi\Request\SetNotificationPreferencesRequest;
use Shoplo\BonanzaApi\Request\UpdateBoothRequest;
use Shoplo\BonanzaApi\Response\AddFixedPriceItemResponse;
use Shoplo\BonanzaApi\Response\BaseResponse;
Expand All @@ -36,12 +38,14 @@
use Shoplo\BonanzaApi\Response\GetBoothResponse;
use Shoplo\BonanzaApi\Response\GetCategoriesResponse;
use Shoplo\BonanzaApi\Response\GetCategoryTraitsResponse;
use Shoplo\BonanzaApi\Response\GetNotificationPreferencesResponse;
use Shoplo\BonanzaApi\Response\GetOrdersResponse;
use Shoplo\BonanzaApi\Response\GetSingleItemResponse;
use Shoplo\BonanzaApi\Response\GetUnlistedItemResponse;
use Shoplo\BonanzaApi\Response\GetUserProfileResponse;
use Shoplo\BonanzaApi\Response\GetUserResponse;
use Shoplo\BonanzaApi\Response\ReviseFixedPriceItemResponse;
use Shoplo\BonanzaApi\Response\SetNotificationPreferencesResponse;
use Shoplo\BonanzaApi\Response\UpdateBoothResponse;

class BonanzaClient
Expand Down Expand Up @@ -231,4 +235,14 @@ public function updateBooth(UpdateBoothRequest $request): UpdateBoothResponse
{
return $this->post(__FUNCTION__, $request, true);
}

public function setNotificationPreferences(SetNotificationPreferencesRequest $request): SetNotificationPreferencesResponse
{
return $this->post(__FUNCTION__, $request, true);
}

public function getNotificationPreferences(GetNotificationPreferencesRequest $request): GetNotificationPreferencesResponse
{
return $this->post(__FUNCTION__, $request, true);
}
}
9 changes: 9 additions & 0 deletions src/Shoplo/BonanzaApi/Enums/DeliveryUrlDetailsStatusType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Shoplo\BonanzaApi\Enums;

class DeliveryUrlDetailsStatusType
{
const STATUS_ENABLE = 'Enable';
const STATUS_DISABLE = 'Disable';
}
9 changes: 9 additions & 0 deletions src/Shoplo/BonanzaApi/Enums/NotificationEnableStatusType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Shoplo\BonanzaApi\Enums;

class NotificationEnableStatusType
{
const ENABLE = 'Enable';
const DISABLE = 'Disable';
}
11 changes: 11 additions & 0 deletions src/Shoplo/BonanzaApi/Enums/NotificationType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Shoplo\BonanzaApi\Enums;

class NotificationType
{
const ASK_SELLER_QUESTION = 'askSellerQuestion';
const FEEDBACK = 'feedback';
const FIXED_PRICE_TRANSACTION = 'fixedPriceTransaction';
const ITEM_MARKED_SHIPPED = 'itemMarkedShipped';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php


namespace Shoplo\BonanzaApi\Request;

use JMS\Serializer\Annotation as Serializer;
use Shoplo\BonanzaApi\Type\AddItemType;
use Shoplo\BonanzaApi\Type\DeliveryURLDetailsType;
use Shoplo\BonanzaApi\Type\ApplicationDeliveryPreferencesType;
use Shoplo\BonanzaApi\Type\RequesterCredentialsType;
use Shoplo\BonanzaApi\Type\UserDeliveryPreferenceArrayType;

class GetNotificationPreferencesRequest
{
/**
* @var RequesterCredentialsType
*
* @Serializer\Type("Shoplo\BonanzaApi\Type\RequesterCredentialsType")
*/
public $requesterCredentials;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace Shoplo\BonanzaApi\Request;

use JMS\Serializer\Annotation as Serializer;
use Shoplo\BonanzaApi\Type\AddItemType;
use Shoplo\BonanzaApi\Type\DeliveryURLDetailsType;
use Shoplo\BonanzaApi\Type\ApplicationDeliveryPreferencesType;
use Shoplo\BonanzaApi\Type\RequesterCredentialsType;
use Shoplo\BonanzaApi\Type\UserDeliveryPreferenceArrayType;

class SetNotificationPreferencesRequest
{
/**
* @var RequesterCredentialsType
*
* @Serializer\Type("Shoplo\BonanzaApi\Type\RequesterCredentialsType")
*/
public $requesterCredentials;

/**
* @var ApplicationDeliveryPreferencesType
*
* @Serializer\Type("Shoplo\BonanzaApi\Type\ApplicationDeliveryPreferencesType")
*/
public $applicationDeliveryPreferences;

/**
* @var UserDeliveryPreferenceArrayType
*
* @Serializer\Type("Shoplo\BonanzaApi\Type\UserDeliveryPreferenceArrayType")
*/
public $userDeliveryPreferenceArray;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Shoplo\BonanzaApi\Response;

use JMS\Serializer\Annotation as Serializer;
use Shoplo\BonanzaApi\Type\GetNotificationPreferencesResponseType;

class GetNotificationPreferencesResponse extends BaseResponse
{
/**
* @var GetNotificationPreferencesResponseType
*
* @Serializer\Type("Shoplo\BonanzaApi\Type\GetNotificationPreferencesResponseType")
*/
public $getNotificationPreferencesResponse;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Shoplo\BonanzaApi\Response;

use JMS\Serializer\Annotation as Serializer;
use Shoplo\BonanzaApi\Type\FixedPriceItemResponseType;
use Shoplo\BonanzaApi\Type\SetNotificationPreferencesResponseType;

class SetNotificationPreferencesResponse extends BaseResponse
{
/**
* @var SetNotificationPreferencesResponseType
*
* @Serializer\Type("Shoplo\BonanzaApi\Type\SetNotificationPreferencesResponseType")
*/
public $setNotificationPreferencesResponse;
}
23 changes: 23 additions & 0 deletions src/Shoplo/BonanzaApi/Type/ApplicationDeliveryPreferencesType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace Shoplo\BonanzaApi\Type;

use JMS\Serializer\Annotation as Serializer;

class ApplicationDeliveryPreferencesType
{

/**
* @var string
*
* @Serializer\Type("string")
*/
public $applicationEnable;

/**
* @var DeliveryURLDetailsType
*
* @Serializer\Type("Shoplo\BonanzaApi\Type\DeliveryURLDetailsType")
*/
public $deliveryURLDetails;
}
19 changes: 19 additions & 0 deletions src/Shoplo/BonanzaApi/Type/DeliveryURLDetailsType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Shoplo\BonanzaApi\Type;

use JMS\Serializer\Annotation as Serializer;

class DeliveryURLDetailsType
{

/**
* @var string
*/
public $deliveryURL;

/**
* @var string
*/
public $status;
}
17 changes: 17 additions & 0 deletions src/Shoplo/BonanzaApi/Type/EventNotificationType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Shoplo\BonanzaApi\Type;

class EventNotificationType
{

/**
* @var string
*/
public $eventEnable;

/**
* @var string
*/
public $eventType;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace Shoplo\BonanzaApi\Type;

use JMS\Serializer\Annotation as Serializer;
use Shoplo\BonanzaApi\Type\ApplicationDeliveryPreferencesType;
use Shoplo\BonanzaApi\Type\UserDeliveryPreferenceArrayType;

class GetNotificationPreferencesResponseType extends BaseResponseType
{

/**
* @var ApplicationDeliveryPreferencesType
*
* @Serializer\Type("Shoplo\BonanzaApi\Type\ApplicationDeliveryPreferencesType")
*/
public $applicationDeliveryPreferences;

/**
* @var UserDeliveryPreferenceArrayType
*
* @Serializer\Type("Shoplo\BonanzaApi\Type\UserDeliveryPreferenceArrayType")
*/
public $userDeliveryPreferenceArray;
}
30 changes: 30 additions & 0 deletions src/Shoplo/BonanzaApi/Type/NotificationEnableType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Shoplo\BonanzaApi\Type;

use JMS\Serializer\Annotation as Serializer;

class NotificationEnableType
{

/**
* @var string
*
* @Serializer\Type("string")
*/
public $eventEnable;

/**
* @var EventNotificationType
*
* @Serializer\Type("Shoplo\BonanzaApi\Type\EventNotificationType")
*/
public $eventType;

/**
* @var bool
*
* @Serializer\Type("boolean")
*/
public $detailed;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php


namespace Shoplo\BonanzaApi\Type;


use JMS\Serializer\Annotation as Serializer;

class SetNotificationPreferencesResponseType extends BaseResponseType
{

/**
* @var int
*
* @Serializer\Type("integer")
*/
public $notificationId;

/**
* @var int
*
* @Serializer\Type("integer")
*/
public $deliveryURLsProcessed;

/**
* @var int
*
* @Serializer\Type("integer")
*/
public $eventsProcessed;
}
16 changes: 16 additions & 0 deletions src/Shoplo/BonanzaApi/Type/UserDeliveryPreferenceArrayType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Shoplo\BonanzaApi\Type;

use JMS\Serializer\Annotation as Serializer;

class UserDeliveryPreferenceArrayType
{

/**
* @var NotificationEnableType[]
*
* @Serializer\Type("array<Shoplo\BonanzaApi\Type\NotificationEnableType>")
*/
public $notificationEnable;
}

0 comments on commit bb94fc0

Please sign in to comment.