pub struct CatalogApi { /* private fields */ }
Expand description
Programmatically catalogs a Square seller’s products for sale and services for hire.
Implementations§
Source§impl CatalogApi
impl CatalogApi
Sourcepub fn new(config: Configuration, client: HttpClient) -> Self
pub fn new(config: Configuration, client: HttpClient) -> Self
Instantiates a new CatalogApi
Sourcepub async fn batch_delete_catalog_objects(
&self,
body: &BatchDeleteCatalogObjectsRequest,
) -> Result<BatchDeleteCatalogObjectsResponse, ApiError>
pub async fn batch_delete_catalog_objects( &self, body: &BatchDeleteCatalogObjectsRequest, ) -> Result<BatchDeleteCatalogObjectsResponse, ApiError>
Deletes a set of [CatalogItem]s based on the provided list of target IDs and returns a set of successfully deleted IDs in the response.
Deletion is a cascading event such that all children of the targeted object are also deleted. For example, deleting a CatalogItem will also delete all of its [CatalogItemVariation] children.
BatchDeleteCatalogObjects
succeeds even if only a portion of the targeted IDs can be
deleted. The response will only include IDs that were actually deleted.
Sourcepub async fn batch_retrieve_catalog_objects(
&self,
body: &BatchRetrieveCatalogObjectsRequest,
) -> Result<BatchRetrieveCatalogObjectsResponse, ApiError>
pub async fn batch_retrieve_catalog_objects( &self, body: &BatchRetrieveCatalogObjectsRequest, ) -> Result<BatchRetrieveCatalogObjectsResponse, ApiError>
Returns a set of objects based on the provided ID.
Each [CatalogItem] returned in the set includes all of its child information including: all of its [CatalogItemVariation] objects, references to its [CatalogModifierList] objects, and the ids of any [CatalogTax] objects that apply to it.
Sourcepub async fn batch_upsert_catalog_objects(
&self,
body: &BatchUpsertCatalogObjectsRequest,
) -> Result<BatchUpsertCatalogObjectsResponse, ApiError>
pub async fn batch_upsert_catalog_objects( &self, body: &BatchUpsertCatalogObjectsRequest, ) -> Result<BatchUpsertCatalogObjectsResponse, ApiError>
Creates or updates up to 10,000 target objects based on the provided list of objects.
The target objects are grouped into batches and each batch is inserted/updated in an all-or-nothing manner. If an object within a batch is malformed in some way, or violates a database constraint, the entire batch containing that item will be disregarded. However, other batches in the same request may still succeed. Each batch may contain up to 1,000 objects, and batches will be processed in order as long as the total object count for the request (items, variations, modifier lists, discounts, and taxes) is no more than 10,000.
Sourcepub async fn create_catalog_image(
&self,
body: &CreateCatalogImageRequest,
image_filepath: &str,
) -> Result<CreateCatalogImageResponse, ApiError>
pub async fn create_catalog_image( &self, body: &CreateCatalogImageRequest, image_filepath: &str, ) -> Result<CreateCatalogImageResponse, ApiError>
Uploads an image file to be represented by a [CatalogImage] object that can be linked to an existing [CatalogObject] instance.
The resulting CatalogImage
is unattached to any CatalogObject
if the object_id is not
specified.
This CreateCatalogImage
endpoint accepts HTTP multipart/form-data requests with a JSON
part and an image file part in JPEG, PJPEG, PNG, or GIF format. The maximum file size is
15MB.
Sourcepub async fn update_catalog_image(
&self,
image_id: &str,
body: &UpdateCatalogImageRequest,
image_filepath: &str,
) -> Result<UpdateCatalogImageResponse, ApiError>
pub async fn update_catalog_image( &self, image_id: &str, body: &UpdateCatalogImageRequest, image_filepath: &str, ) -> Result<UpdateCatalogImageResponse, ApiError>
Uploads a new image file to replace the existing one in the specified [CatalogImage] object.
This UpdateCatalogImage
endpoint accepts HTTP multipart/form-data requests with a JSON
part and an image file part in JPEG, PJPEG, PNG, or GIF format. The maximum file size is
15MB.
Sourcepub async fn catalog_info(&self) -> Result<CatalogInfoResponse, ApiError>
pub async fn catalog_info(&self) -> Result<CatalogInfoResponse, ApiError>
Retrieves information about the Square Catalog API, such as batch size limits that can be
used by the BatchUpsertCatalogObjects
endpoint.
Sourcepub async fn list_catalog(
&self,
params: &ListCatalogParameters,
) -> Result<ListCatalogResponse, ApiError>
pub async fn list_catalog( &self, params: &ListCatalogParameters, ) -> Result<ListCatalogResponse, ApiError>
Returns a list of all [CatalogObject]s of the specified types in the catalog.
The types
parameter is specified as a comma-separated list of the [CatalogObjectType]
values, for example, “ITEM
, ITEM_VARIATION
, MODIFIER
, MODIFIER_LIST
, CATEGORY
,
DISCOUNT
, TAX
, IMAGE
”.
Important: ListCatalog does not return deleted catalog items. To retrieve deleted
catalog items, use [SearchCatalogObjects] and set the include_deleted_objects
attribute
value to true
.
Sourcepub async fn upsert_catalog_object(
&self,
body: &UpsertCatalogObjectRequest,
) -> Result<UpsertCatalogObjectResponse, ApiError>
pub async fn upsert_catalog_object( &self, body: &UpsertCatalogObjectRequest, ) -> Result<UpsertCatalogObjectResponse, ApiError>
Creates or updates the target [CatalogObject].
Sourcepub async fn delete_catalog_object(
&self,
object_id: &str,
) -> Result<DeleteCatalogObjectResponse, ApiError>
pub async fn delete_catalog_object( &self, object_id: &str, ) -> Result<DeleteCatalogObjectResponse, ApiError>
Deletes a single [CatalogObject] based on the provided ID and returns the set of successfully deleted IDs in the response.
Deletion is a cascading event such that all children of the targeted object are also deleted. For example, deleting a [CatalogItem] will also delete all of its [CatalogItemVariation] children.
Sourcepub async fn retrieve_catalog_object(
&self,
object_id: &str,
params: &RetrieveCatalogObjectParameters,
) -> Result<RetrieveCatalogObjectResponse, ApiError>
pub async fn retrieve_catalog_object( &self, object_id: &str, params: &RetrieveCatalogObjectParameters, ) -> Result<RetrieveCatalogObjectResponse, ApiError>
Returns a single [CatalogItem] as a [CatalogObject] based on the provided ID.
The returned object includes all of the relevant [CatalogItem] information including: [CatalogItemVariation] children, references to its [CatalogModifierList] objects, and the ids of any [CatalogTax] objects that apply to it.
Sourcepub async fn search_catalog_objects(
&self,
body: &SearchCatalogObjectsRequest,
) -> Result<SearchCatalogObjectsResponse, ApiError>
pub async fn search_catalog_objects( &self, body: &SearchCatalogObjectsRequest, ) -> Result<SearchCatalogObjectsResponse, ApiError>
Searches for [CatalogObject] of any type by matching supported search attribute values, excluding custom attribute values on items or item variations, against one or more of the specified query filters.
This (SearchCatalogObjects
) endpoint differs from the SearchCatalogItems
endpoint in the
following aspects:
SearchCatalogItems
can only search for items or item variations, whereasSearchCatalogObjects
can search for any type of catalog objects.SearchCatalogItems
supports the custom attribute query filters to return items or item variations that contain custom attribute values, whereSearchCatalogObjects
does not.SearchCatalogItems
does not support the include_deleted_objects filter to search for deleted items or item variations, whereasSearchCatalogObjects
does.- The both endpoints have different call conventions, including the query filter formats.
Sourcepub async fn search_catalog_items(
&self,
body: &SearchCatalogItemsRequest,
) -> Result<SearchCatalogItemsResponse, ApiError>
pub async fn search_catalog_items( &self, body: &SearchCatalogItemsRequest, ) -> Result<SearchCatalogItemsResponse, ApiError>
Searches for catalog items or item variations by matching supported search attribute values, including custom attribute values, against one or more of the specified query filters.
This (SearchCatalogItems
) endpoint differs from the SearchCatalogObjects
endpoint in the
following aspects:
SearchCatalogItems
can only search for items or item variations, whereasSearchCatalogObjects
can search for any type of catalog objects.SearchCatalogItems
supports the custom attribute query filters to return items or item variations that contain custom attribute values, whereSearchCatalogObjects
does not.SearchCatalogItems
does not support the include_deleted_objects filter to search for deleted items or item variations, whereasSearchCatalogObjects
does.- The both endpoints use different call conventions, including the query filter formats.
Sourcepub async fn update_item_modifier_lists(
&self,
body: &UpdateItemModifierListsRequest,
) -> Result<UpdateItemModifierListsResponse, ApiError>
pub async fn update_item_modifier_lists( &self, body: &UpdateItemModifierListsRequest, ) -> Result<UpdateItemModifierListsResponse, ApiError>
Updates the [CatalogModifierList] objects that apply to the targeted [CatalogItem] without having to perform an upsert on the entire item.
Sourcepub async fn update_item_taxes(
&self,
body: &UpdateItemTaxesRequest,
) -> Result<UpdateItemTaxesResponse, ApiError>
pub async fn update_item_taxes( &self, body: &UpdateItemTaxesRequest, ) -> Result<UpdateItemTaxesResponse, ApiError>
Updates the [CatalogTax] objects that apply to the targeted [CatalogItem] without having to perform an upsert on the entire item.