1 | <?php |
||
28 | class Lookup extends AbstractOperation |
||
29 | { |
||
30 | const TYPE_ASIN = 'ASIN'; |
||
31 | const TYPE_SKU = 'SKU'; |
||
32 | const TYPE_UPC = 'UPC'; |
||
33 | const TYPE_EAN = 'EAN'; |
||
34 | const TYPE_ISBN = 'ISBN'; |
||
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | */ |
||
39 | 4 | public function getName() |
|
43 | |||
44 | /** |
||
45 | * Pass up to 10 itemid's which should be looked up |
||
46 | * |
||
47 | * @param array $itemIds |
||
48 | * |
||
49 | * @return Lookup |
||
50 | * |
||
51 | * @throws \Exception |
||
52 | */ |
||
53 | 2 | public function setItemIds(array $itemIds) |
|
64 | |||
65 | /** |
||
66 | * Returns the itemid |
||
67 | * |
||
68 | * @return string |
||
69 | */ |
||
70 | 2 | public function getItemId() |
|
74 | |||
75 | /** |
||
76 | * Sets the itemid which should be looked up |
||
77 | * |
||
78 | * @param string $itemId |
||
79 | * |
||
80 | * @return \ApaiIO\Operations\Lookup |
||
81 | */ |
||
82 | 5 | public function setItemId($itemId) |
|
88 | |||
89 | /** |
||
90 | * Returns the idtype either ASIN (Default), SKU, UPC, EAN, and ISBN |
||
91 | * |
||
92 | * @return string |
||
93 | */ |
||
94 | 1 | public function getIdType() |
|
98 | |||
99 | /** |
||
100 | * Sets the idtype either ASIN (Default), SKU, UPC, EAN, and ISBN |
||
101 | * |
||
102 | * @param string $idType |
||
103 | * |
||
104 | * @return \ApaiIO\Operations\Lookup |
||
105 | */ |
||
106 | 7 | public function setIdType($idType) |
|
107 | { |
||
108 | $idTypes = [ |
||
109 | 7 | self::TYPE_ASIN, |
|
110 | 7 | self::TYPE_SKU, |
|
111 | 7 | self::TYPE_UPC, |
|
112 | 7 | self::TYPE_EAN, |
|
113 | 7 | self::TYPE_ISBN |
|
114 | ]; |
||
115 | |||
116 | 7 | if (!in_array($idType, $idTypes)) { |
|
117 | 1 | throw new \InvalidArgumentException(sprintf( |
|
118 | 1 | "Invalid type '%s' passed. Valid types are: '%s'", |
|
119 | $idType, |
||
120 | 1 | implode(', ', $idTypes) |
|
121 | )); |
||
122 | } |
||
123 | |||
124 | 6 | $this->parameters['IdType'] = $idType; |
|
125 | |||
126 | 6 | if (empty($this->parameters['SearchIndex']) && $idType != self::TYPE_ASIN) { |
|
127 | 5 | $this->parameters['SearchIndex'] = 'All'; |
|
128 | } |
||
129 | |||
130 | 6 | return $this; |
|
131 | } |
||
132 | |||
133 | /** |
||
134 | * Returns the searchindex |
||
135 | * |
||
136 | * @return mixed |
||
137 | */ |
||
138 | 1 | public function getSearchIndex() |
|
142 | |||
143 | /** |
||
144 | * Sets the searchindex which should be used when set IdType other than ASIN |
||
145 | * |
||
146 | * @param string $searchIndex |
||
147 | * |
||
148 | * @return \ApaiIO\Operations\Lookup |
||
149 | */ |
||
150 | 1 | public function setSearchIndex($searchIndex) |
|
156 | |||
157 | /** |
||
158 | * Returns the condition of the items to return. New | Used | Collectible | Refurbished | All |
||
159 | * |
||
160 | * @return string |
||
161 | */ |
||
162 | 2 | public function getCondition() |
|
166 | |||
167 | /** |
||
168 | * Sets the condition of the items to return: New | Used | Collectible | Refurbished | All |
||
169 | * |
||
170 | * Defaults to New. |
||
171 | * |
||
172 | * @param string $condition |
||
173 | * |
||
174 | * @return \ApaiIO\Operations\Search |
||
175 | */ |
||
176 | 2 | public function setCondition($condition) |
|
182 | } |
||
183 |