Core SDK

SDK helps to speed up BFC implementation based on Poq platform services and makes it as easy as possible.

Installation

npm install @poq/sdk

Description

SDK Provides you with set of clients and mid-level service to work with the Poq Platform. Check API Reference for more details.

Supported Clients

ClientDescriptionAPI Reference
AccountClientAccount client can be helpful in cases when user wants to create refresh token, exchange password on refresh token or return user-specific content blocks.More Details
CheckoutClientCheckout client can be helpful in cases when user wants to operate over some cart by adding items, updating or getting cart itself.More Details
ContentClientContentClient can be helpful in cases when user wants to work with navigation content/categories.More Details
ProductClientProductClient can be helpful in cases when user wants to get single product item by id or collection of products by unique identifiers such as: product ids, listing ids or variant ids.More Details
SearchClientSearchClient can be helpful in cases when user wants to filter and search for product listings which are specified by some particular criteria.More Details

Supported Mid-Level Services

ServiceDescriptionAPI Reference
CheckoutServiceCheckoutService can be helpful in cases when user wants to get enriched cart data (with product info in it).More Details

Examples

Account Client Example

import {
AccountClient,
CreateRefreshTokenRequest,
DecryptPasswordRequest
} from '@poq/sdk';
const main = async () => {
const demoApp = '0481ee22-fd95-4c0d-a280-b70abe984c29';
const accountClient = new AccountClient('https://platform.poq.io');
const refreshTokenPayload = await accountClient.createRefreshToken(
demoApp,
new CreateRefreshTokenRequest('__username__', '__password__')
);
const decryptedPass = await accountClient.decryptPassword(
demoApp,
new DecryptPasswordRequest(refreshTokenPayload.content?.refreshToken)
);
console.dir(refreshTokenPayload.content);
console.dir(decryptedPass.content);
const demoAppNumID = 1234;
const contentBlock = await accountClient.getMyAccountContentBlocks(
demoAppNumID
);
console.dir(contentBlock.content);
};
main();

Product Client Example

import { ProductClient } from '@poq/sdk';
const main = async () => {
const productClient = new ProductClient('https://platform.poq.io');
const demoApp = '0481ee22-fd95-4c0d-a280-b70abe984c29';
const result = await productClient.getById(
demoApp,
'GBP',
'__SOME_ID_IS_HERE__'
);
console.dir(result.content);
};
main();