1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
*/ |
4
|
|
|
|
5
|
|
|
namespace Commercetools\Core\Builder\Request; |
6
|
|
|
|
7
|
|
|
use Commercetools\Core\Model\ShoppingList\MyShoppingListDraft; |
8
|
|
|
use Commercetools\Core\Model\ShoppingList\ShoppingList; |
9
|
|
|
use Commercetools\Core\Request\Me\MeShoppingListByIdGetRequest; |
10
|
|
|
use Commercetools\Core\Request\Me\MeShoppingListByKeyGetRequest; |
11
|
|
|
use Commercetools\Core\Request\Me\MeShoppingListCreateRequest; |
12
|
|
|
use Commercetools\Core\Request\Me\MeShoppingListDeleteByKeyRequest; |
13
|
|
|
use Commercetools\Core\Request\Me\MeShoppingListDeleteRequest; |
14
|
|
|
use Commercetools\Core\Request\Me\MeShoppingListQueryRequest; |
15
|
|
|
use Commercetools\Core\Request\Me\MeShoppingListUpdateByKeyRequest; |
16
|
|
|
use Commercetools\Core\Request\Me\MeShoppingListUpdateRequest; |
17
|
|
|
|
18
|
|
|
class MeShoppingListRequestBuilder |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* @return MeShoppingListQueryRequest |
22
|
|
|
*/ |
23
|
|
|
public function query() |
24
|
|
|
{ |
25
|
|
|
return MeShoppingListQueryRequest::of(); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @param ShoppingList $shoppingList |
30
|
|
|
* @return MeShoppingListUpdateRequest |
31
|
|
|
*/ |
32
|
|
|
public function update(ShoppingList $shoppingList) |
33
|
|
|
{ |
34
|
|
|
return MeShoppingListUpdateRequest::ofIdAndVersion($shoppingList->getId(), $shoppingList->getVersion()); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @param ShoppingList $shoppingList |
39
|
|
|
* @return MeShoppingListUpdateByKeyRequest |
40
|
|
|
*/ |
41
|
1 |
|
public function updateByKey(ShoppingList $shoppingList) |
42
|
|
|
{ |
43
|
1 |
|
return MeShoppingListUpdateByKeyRequest::ofKeyAndVersion($shoppingList->getKey(), $shoppingList->getVersion()); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @param string $shoppingListId |
48
|
|
|
* @return MeShoppingListByIdGetRequest |
49
|
|
|
*/ |
50
|
|
|
public function getById($shoppingListId) |
51
|
|
|
{ |
52
|
|
|
return MeShoppingListByIdGetRequest::ofId($shoppingListId); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @param string $shoppingListKey |
57
|
|
|
* @return MeShoppingListByKeyGetRequest |
58
|
|
|
*/ |
59
|
1 |
|
public function getByKey($shoppingListKey) |
60
|
|
|
{ |
61
|
1 |
|
return MeShoppingListByKeyGetRequest::ofKey($shoppingListKey); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @param MyShoppingListDraft $myShoppingListDraft |
66
|
|
|
* @return MeShoppingListCreateRequest |
67
|
|
|
*/ |
68
|
3 |
|
public function create(MyShoppingListDraft $myShoppingListDraft) |
69
|
|
|
{ |
70
|
3 |
|
return MeShoppingListCreateRequest::ofDraft($myShoppingListDraft); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @param ShoppingList $shoppingList |
75
|
|
|
* @return MeShoppingListDeleteRequest |
76
|
|
|
*/ |
77
|
|
|
public function delete(ShoppingList $shoppingList) |
78
|
|
|
{ |
79
|
|
|
return MeShoppingListDeleteRequest::ofIdAndVersion($shoppingList->getId(), $shoppingList->getVersion()); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @param ShoppingList $shoppingList |
84
|
|
|
* @return MeShoppingListDeleteByKeyRequest |
85
|
|
|
*/ |
86
|
1 |
|
public function deleteByKey(ShoppingList $shoppingList) |
87
|
|
|
{ |
88
|
1 |
|
return MeShoppingListDeleteByKeyRequest::ofKeyAndVersion($shoppingList->getKey(), $shoppingList->getVersion()); |
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
|