Products
in package
* Products resource for managing catalog products.
Request arrays use the API's documented snake_case field names. Successful responses
are returned as immutable values from the corresponding singular resource namespace.
Table of Contents
Methods
- __construct() : mixed
- Creates the products resource client.
- addPrice() : Price
- Add a price to a product (POST /products/add_price).
- archive() : Product
- Archive a product (POST /products/archive).
- create() : Product
- Create a product (POST /products/create).
- lookup() : Product
- Lookup a product by ID (POST /products/lookup).
- page() : Page
- Page through products (POST /products/page).
- publish() : Product
- Publish a product (POST /products/publish).
- search() : ResourceSearchPage
- Search products with a typed resource-local query.
- setDefaultUnitPrice() : Product
- Set a product's default unit price (POST /products/set_default_unit_price).
- unpublish() : Product
- Unpublish a product (POST /products/unpublish).
- update() : Product
- Update a product (POST /products/update).
Methods
__construct()
Creates the products resource client.
public
__construct(HttpClient $http) : mixed
Parameters
- $http : HttpClient
-
Shared authenticated HTTP transport used by this resource client.
addPrice()
Add a price to a product (POST /products/add_price).
public
addPrice(array<string, mixed>|AddPriceRequest $payload) : Price
Sends the documented request through the shared authenticated transport and hydrates the successful response into the declared return type.
Parameters
- $payload : array<string, mixed>|AddPriceRequest
-
Price definition for this product.
Return values
Price —The resulting price.
archive()
Archive a product (POST /products/archive).
public
archive(string $productId) : Product
Sends the documented request through the shared authenticated transport and hydrates the successful response into the declared return type.
Parameters
- $productId : string
-
Unique identifier of the product.
Return values
Product —The archived product.
create()
Create a product (POST /products/create).
public
create(array<string, mixed> $payload) : Product
Sends the documented request through the shared authenticated transport and hydrates the successful response into the declared return type.
Parameters
- $payload : array<string, mixed>
-
Request fields keyed by the documented
snake_caseAPI names.
Return values
Product —The created product.
lookup()
Lookup a product by ID (POST /products/lookup).
public
lookup(string $productId) : Product
Sends the documented request through the shared authenticated transport and hydrates the successful response into the declared return type.
Parameters
- $productId : string
-
Unique identifier of the product.
Return values
Product —The requested product.
page()
Page through products (POST /products/page).
public
page([array<string, mixed> $payload = [] ]) : Page
Sends the documented request through the shared authenticated transport and hydrates the successful response into the declared return type.
Parameters
- $payload : array<string, mixed> = []
-
Request fields keyed by the documented
snake_caseAPI names.
Return values
Page —A typed page of matching products.
publish()
Publish a product (POST /products/publish).
public
publish(string $productId) : Product
Sends the documented request through the shared authenticated transport and hydrates the successful response into the declared return type.
Parameters
- $productId : string
-
Unique identifier of the product.
Return values
Product —The resulting product.
search()
Search products with a typed resource-local query.
public
search(ResourceSearchRequest $payload) : ResourceSearchPage
Parameters
- $payload : ResourceSearchRequest
Return values
ResourceSearchPagesetDefaultUnitPrice()
Set a product's default unit price (POST /products/set_default_unit_price).
public
setDefaultUnitPrice(array<string, mixed> $payload) : Product
Sends the documented request through the shared authenticated transport and hydrates the successful response into the declared return type.
Parameters
- $payload : array<string, mixed>
-
Request fields keyed by the documented
snake_caseAPI names.
Return values
Product —The resulting product.
unpublish()
Unpublish a product (POST /products/unpublish).
public
unpublish(string $productId) : Product
Sends the documented request through the shared authenticated transport and hydrates the successful response into the declared return type.
Parameters
- $productId : string
-
Unique identifier of the product.
Return values
Product —The resulting product.
update()
Update a product (POST /products/update).
public
update(array<string, mixed> $payload) : Product
Sends the documented request through the shared authenticated transport and hydrates the successful response into the declared return type.
Parameters
- $payload : array<string, mixed>
-
Request fields keyed by the documented
snake_caseAPI names.
Return values
Product —The updated product.