PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 1.7.0.9 All 211 releases
charitable / vendor / square / square / src / Legacy / Models / SearchCatalogObjectsRequest.php

SearchCatalogObjectsRequest.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13, at vendor/square/square/src/Legacy/Models/SearchCatalogObjectsRequest.php

404 lines 14.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Square\Legacy\Models;
6
7 use stdClass;
8
9 class SearchCatalogObjectsRequest implements \JsonSerializable
10 {
11 /**
12 * @var string|null
13 */
14 private $cursor;
15
16 /**
17 * @var string[]|null
18 */
19 private $objectTypes;
20
21 /**
22 * @var bool|null
23 */
24 private $includeDeletedObjects;
25
26 /**
27 * @var bool|null
28 */
29 private $includeRelatedObjects;
30
31 /**
32 * @var string|null
33 */
34 private $beginTime;
35
36 /**
37 * @var CatalogQuery|null
38 */
39 private $query;
40
41 /**
42 * @var int|null
43 */
44 private $limit;
45
46 /**
47 * @var bool|null
48 */
49 private $includeCategoryPathToRoot;
50
51 /**
52 * Returns Cursor.
53 * The pagination cursor returned in the previous response. Leave unset for an initial request.
54 * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination)
55 * for more information.
56 */
57 public function getCursor(): ?string
58 {
59 return $this->cursor;
60 }
61
62 /**
63 * Sets Cursor.
64 * The pagination cursor returned in the previous response. Leave unset for an initial request.
65 * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination)
66 * for more information.
67 *
68 * @maps cursor
69 */
70 public function setCursor(?string $cursor): void
71 {
72 $this->cursor = $cursor;
73 }
74
75 /**
76 * Returns Object Types.
77 * The desired set of object types to appear in the search results.
78 *
79 * If this is unspecified, the operation returns objects of all the top level types at the version
80 * of the Square API used to make the request. Object types that are nested onto other object types
81 * are not included in the defaults.
82 *
83 * At the current API version the default object types are:
84 * ITEM, CATEGORY, TAX, DISCOUNT, MODIFIER_LIST,
85 * PRICING_RULE, PRODUCT_SET, TIME_PERIOD, MEASUREMENT_UNIT,
86 * SUBSCRIPTION_PLAN, ITEM_OPTION, CUSTOM_ATTRIBUTE_DEFINITION, QUICK_AMOUNT_SETTINGS.
87 *
88 * Note that if you wish for the query to return objects belonging to nested types (i.e., COMPONENT,
89 * IMAGE,
90 * ITEM_OPTION_VAL, ITEM_VARIATION, or MODIFIER), you must explicitly include all the types of
91 * interest
92 * in this field.
93 *
94 * @return string[]|null
95 */
96 public function getObjectTypes(): ?array
97 {
98 return $this->objectTypes;
99 }
100
101 /**
102 * Sets Object Types.
103 * The desired set of object types to appear in the search results.
104 *
105 * If this is unspecified, the operation returns objects of all the top level types at the version
106 * of the Square API used to make the request. Object types that are nested onto other object types
107 * are not included in the defaults.
108 *
109 * At the current API version the default object types are:
110 * ITEM, CATEGORY, TAX, DISCOUNT, MODIFIER_LIST,
111 * PRICING_RULE, PRODUCT_SET, TIME_PERIOD, MEASUREMENT_UNIT,
112 * SUBSCRIPTION_PLAN, ITEM_OPTION, CUSTOM_ATTRIBUTE_DEFINITION, QUICK_AMOUNT_SETTINGS.
113 *
114 * Note that if you wish for the query to return objects belonging to nested types (i.e., COMPONENT,
115 * IMAGE,
116 * ITEM_OPTION_VAL, ITEM_VARIATION, or MODIFIER), you must explicitly include all the types of
117 * interest
118 * in this field.
119 *
120 * @maps object_types
121 *
122 * @param string[]|null $objectTypes
123 */
124 public function setObjectTypes(?array $objectTypes): void
125 {
126 $this->objectTypes = $objectTypes;
127 }
128
129 /**
130 * Returns Include Deleted Objects.
131 * If `true`, deleted objects will be included in the results. Deleted objects will have their
132 * `is_deleted` field set to `true`.
133 */
134 public function getIncludeDeletedObjects(): ?bool
135 {
136 return $this->includeDeletedObjects;
137 }
138
139 /**
140 * Sets Include Deleted Objects.
141 * If `true`, deleted objects will be included in the results. Deleted objects will have their
142 * `is_deleted` field set to `true`.
143 *
144 * @maps include_deleted_objects
145 */
146 public function setIncludeDeletedObjects(?bool $includeDeletedObjects): void
147 {
148 $this->includeDeletedObjects = $includeDeletedObjects;
149 }
150
151 /**
152 * Returns Include Related Objects.
153 * If `true`, the response will include additional objects that are related to the
154 * requested objects. Related objects are objects that are referenced by object ID by the objects
155 * in the response. This is helpful if the objects are being fetched for immediate display to a user.
156 * This process only goes one level deep. Objects referenced by the related objects will not be
157 * included.
158 * For example:
159 *
160 * If the `objects` field of the response contains a CatalogItem, its associated
161 * CatalogCategory objects, CatalogTax objects, CatalogImage objects and
162 * CatalogModifierLists will be returned in the `related_objects` field of the
163 * response. If the `objects` field of the response contains a CatalogItemVariation,
164 * its parent CatalogItem will be returned in the `related_objects` field of
165 * the response.
166 *
167 * Default value: `false`
168 */
169 public function getIncludeRelatedObjects(): ?bool
170 {
171 return $this->includeRelatedObjects;
172 }
173
174 /**
175 * Sets Include Related Objects.
176 * If `true`, the response will include additional objects that are related to the
177 * requested objects. Related objects are objects that are referenced by object ID by the objects
178 * in the response. This is helpful if the objects are being fetched for immediate display to a user.
179 * This process only goes one level deep. Objects referenced by the related objects will not be
180 * included.
181 * For example:
182 *
183 * If the `objects` field of the response contains a CatalogItem, its associated
184 * CatalogCategory objects, CatalogTax objects, CatalogImage objects and
185 * CatalogModifierLists will be returned in the `related_objects` field of the
186 * response. If the `objects` field of the response contains a CatalogItemVariation,
187 * its parent CatalogItem will be returned in the `related_objects` field of
188 * the response.
189 *
190 * Default value: `false`
191 *
192 * @maps include_related_objects
193 */
194 public function setIncludeRelatedObjects(?bool $includeRelatedObjects): void
195 {
196 $this->includeRelatedObjects = $includeRelatedObjects;
197 }
198
199 /**
200 * Returns Begin Time.
201 * Return objects modified after this [timestamp](https://developer.squareup.com/docs/build-
202 * basics/working-with-dates), in RFC 3339
203 * format, e.g., `2016-09-04T23:59:33.123Z`. The timestamp is exclusive - objects with a
204 * timestamp equal to `begin_time` will not be included in the response.
205 */
206 public function getBeginTime(): ?string
207 {
208 return $this->beginTime;
209 }
210
211 /**
212 * Sets Begin Time.
213 * Return objects modified after this [timestamp](https://developer.squareup.com/docs/build-
214 * basics/working-with-dates), in RFC 3339
215 * format, e.g., `2016-09-04T23:59:33.123Z`. The timestamp is exclusive - objects with a
216 * timestamp equal to `begin_time` will not be included in the response.
217 *
218 * @maps begin_time
219 */
220 public function setBeginTime(?string $beginTime): void
221 {
222 $this->beginTime = $beginTime;
223 }
224
225 /**
226 * Returns Query.
227 * A query composed of one or more different types of filters to narrow the scope of targeted objects
228 * when calling the `SearchCatalogObjects` endpoint.
229 *
230 * Although a query can have multiple filters, only certain query types can be combined per call to
231 * [SearchCatalogObjects]($e/Catalog/SearchCatalogObjects).
232 * Any combination of the following types may be used together:
233 * - [exact_query]($m/CatalogQueryExact)
234 * - [prefix_query]($m/CatalogQueryPrefix)
235 * - [range_query]($m/CatalogQueryRange)
236 * - [sorted_attribute_query]($m/CatalogQuerySortedAttribute)
237 * - [text_query]($m/CatalogQueryText)
238 *
239 * All other query types cannot be combined with any others.
240 *
241 * When a query filter is based on an attribute, the attribute must be searchable.
242 * Searchable attributes are listed as follows, along their parent types that can be searched for with
243 * applicable query filters.
244 *
245 * Searchable attribute and objects queryable by searchable attributes:
246 * - `name`: `CatalogItem`, `CatalogItemVariation`, `CatalogCategory`, `CatalogTax`, `CatalogDiscount`,
247 * `CatalogModifier`, `CatalogModifierList`, `CatalogItemOption`, `CatalogItemOptionValue`
248 * - `description`: `CatalogItem`, `CatalogItemOptionValue`
249 * - `abbreviation`: `CatalogItem`
250 * - `upc`: `CatalogItemVariation`
251 * - `sku`: `CatalogItemVariation`
252 * - `caption`: `CatalogImage`
253 * - `display_name`: `CatalogItemOption`
254 *
255 * For example, to search for [CatalogItem]($m/CatalogItem) objects by searchable attributes, you can
256 * use
257 * the `"name"`, `"description"`, or `"abbreviation"` attribute in an applicable query filter.
258 */
259 public function getQuery(): ?CatalogQuery
260 {
261 return $this->query;
262 }
263
264 /**
265 * Sets Query.
266 * A query composed of one or more different types of filters to narrow the scope of targeted objects
267 * when calling the `SearchCatalogObjects` endpoint.
268 *
269 * Although a query can have multiple filters, only certain query types can be combined per call to
270 * [SearchCatalogObjects]($e/Catalog/SearchCatalogObjects).
271 * Any combination of the following types may be used together:
272 * - [exact_query]($m/CatalogQueryExact)
273 * - [prefix_query]($m/CatalogQueryPrefix)
274 * - [range_query]($m/CatalogQueryRange)
275 * - [sorted_attribute_query]($m/CatalogQuerySortedAttribute)
276 * - [text_query]($m/CatalogQueryText)
277 *
278 * All other query types cannot be combined with any others.
279 *
280 * When a query filter is based on an attribute, the attribute must be searchable.
281 * Searchable attributes are listed as follows, along their parent types that can be searched for with
282 * applicable query filters.
283 *
284 * Searchable attribute and objects queryable by searchable attributes:
285 * - `name`: `CatalogItem`, `CatalogItemVariation`, `CatalogCategory`, `CatalogTax`, `CatalogDiscount`,
286 * `CatalogModifier`, `CatalogModifierList`, `CatalogItemOption`, `CatalogItemOptionValue`
287 * - `description`: `CatalogItem`, `CatalogItemOptionValue`
288 * - `abbreviation`: `CatalogItem`
289 * - `upc`: `CatalogItemVariation`
290 * - `sku`: `CatalogItemVariation`
291 * - `caption`: `CatalogImage`
292 * - `display_name`: `CatalogItemOption`
293 *
294 * For example, to search for [CatalogItem]($m/CatalogItem) objects by searchable attributes, you can
295 * use
296 * the `"name"`, `"description"`, or `"abbreviation"` attribute in an applicable query filter.
297 *
298 * @maps query
299 */
300 public function setQuery(?CatalogQuery $query): void
301 {
302 $this->query = $query;
303 }
304
305 /**
306 * Returns Limit.
307 * A limit on the number of results to be returned in a single page. The limit is advisory -
308 * the implementation may return more or fewer results. If the supplied limit is negative, zero, or
309 * is higher than the maximum limit of 1,000, it will be ignored.
310 */
311 public function getLimit(): ?int
312 {
313 return $this->limit;
314 }
315
316 /**
317 * Sets Limit.
318 * A limit on the number of results to be returned in a single page. The limit is advisory -
319 * the implementation may return more or fewer results. If the supplied limit is negative, zero, or
320 * is higher than the maximum limit of 1,000, it will be ignored.
321 *
322 * @maps limit
323 */
324 public function setLimit(?int $limit): void
325 {
326 $this->limit = $limit;
327 }
328
329 /**
330 * Returns Include Category Path to Root.
331 * Specifies whether or not to include the `path_to_root` list for each returned category instance. The
332 * `path_to_root` list consists
333 * of `CategoryPathToRootNode` objects and specifies the path that starts with the immediate parent
334 * category of the returned category
335 * and ends with its root category. If the returned category is a top-level category, the
336 * `path_to_root` list is empty and is not returned
337 * in the response payload.
338 */
339 public function getIncludeCategoryPathToRoot(): ?bool
340 {
341 return $this->includeCategoryPathToRoot;
342 }
343
344 /**
345 * Sets Include Category Path to Root.
346 * Specifies whether or not to include the `path_to_root` list for each returned category instance. The
347 * `path_to_root` list consists
348 * of `CategoryPathToRootNode` objects and specifies the path that starts with the immediate parent
349 * category of the returned category
350 * and ends with its root category. If the returned category is a top-level category, the
351 * `path_to_root` list is empty and is not returned
352 * in the response payload.
353 *
354 * @maps include_category_path_to_root
355 */
356 public function setIncludeCategoryPathToRoot(?bool $includeCategoryPathToRoot): void
357 {
358 $this->includeCategoryPathToRoot = $includeCategoryPathToRoot;
359 }
360
361 /**
362 * Encode this object to JSON
363 *
364 * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
365 * are set. (default: false)
366 *
367 * @return array|stdClass
368 */
369 #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
370 public function jsonSerialize(bool $asArrayWhenEmpty = false)
371 {
372 $json = [];
373 if (isset($this->cursor)) {
374 $json['cursor'] = $this->cursor;
375 }
376 if (isset($this->objectTypes)) {
377 $json['object_types'] = $this->objectTypes;
378 }
379 if (isset($this->includeDeletedObjects)) {
380 $json['include_deleted_objects'] = $this->includeDeletedObjects;
381 }
382 if (isset($this->includeRelatedObjects)) {
383 $json['include_related_objects'] = $this->includeRelatedObjects;
384 }
385 if (isset($this->beginTime)) {
386 $json['begin_time'] = $this->beginTime;
387 }
388 if (isset($this->query)) {
389 $json['query'] = $this->query;
390 }
391 if (isset($this->limit)) {
392 $json['limit'] = $this->limit;
393 }
394 if (isset($this->includeCategoryPathToRoot)) {
395 $json['include_category_path_to_root'] = $this->includeCategoryPathToRoot;
396 }
397 $json = array_filter($json, function ($val) {
398 return $val !== null;
399 });
400
401 return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
402 }
403 }
404