Skip to content

Class: GroupAPI

Group API client for managing product groups. Provides methods to retrieve groups and their associated products.

Constructors

Constructor

ts
new GroupAPI(http: HttpClient, apiKey: string): GroupAPI;

Parameters

http

HttpClient

apiKey

string

Returns

GroupAPI

Methods

getAllGroups()

ts
getAllGroups(params?: {
  fromDate?: string;
  updatedDate?: string;
}): Promise<string[]>;

Retrieves all product groups with optional date filtering.

Parameters

params?

Optional filter parameters

fromDate?

string

Filter groups created from this date (YYYY-MM-DD format)

updatedDate?

string

Filter groups updated from this date

Returns

Promise<string[]>

Promise resolving to an array of group names

Throws

When the API returns an error

Throws

When a network error occurs

Example

typescript
const groups = await sdk.groups().getAllGroups({
  fromDate: '2024-01-01'
});

getGroupProducts()

ts
getGroupProducts(groupName: string): Promise<GroupProduct[]>;

Retrieves all products belonging to a specific group.

Parameters

groupName

string

The name of the group to get products for

Returns

Promise<GroupProduct[]>

Promise resolving to an array of group products

Throws

When the API returns an error

Throws

When a network error occurs

Example

typescript
const products = await sdk.groups().getGroupProducts('electronics');
products.forEach(p => console.log(p.name));