@forgecart/sdk
v1.202607161748.0
Published
ForgeCart Client SDK
Downloads
1,778
Readme
@forgecart/sdk
ForgeCart Client SDK
Installation
npm install @forgecart/sdkUsage
Standalone Admin Client
import { ForgeCartAdminClient } from '@forgecart/sdk';
const admin = new ForgeCartAdminClient({
endpoint: 'https://api.mystore.com/admin-api',
channelToken: 'my-channel-token',
adminSecret: 'my-admin-secret',
});
admin.setAuthToken(token);
const result = await admin.products.products({ take: 10 });Standalone Shop Client
import { ForgeCartShopClient } from '@forgecart/sdk';
const shop = new ForgeCartShopClient({
endpoint: 'https://api.mystore.com/shop-api',
channelToken: 'my-channel-token',
});
const order = await shop.cart.addItemToOrder({ variantId, quantity: 1 });Union Client (Admin + Shop)
import { ForgeCartClient } from '@forgecart/sdk';
const client = new ForgeCartClient({
endpoint: 'https://api.mystore.com',
channelToken: 'my-channel-token',
adminSecret: 'my-admin-secret',
});
client.setAuthToken(token);
const products = await client.admin.products.products({ take: 10 });
const order = await client.shop.cart.addItemToOrder({ variantId, quantity: 1 });Namespaces
client.admin— entry, fieldDefinition, publish, acfSchema, acf, administrator, analyticsGateway, asset, audienceMembership, audienceSegment, auth, settings, channel, chat, collection, country, address, group, customerAnalytics, customerGroup, customer, deployment, facet, fulfillmentRequest, fulfillment, hookDispatch, hook, market, marketingAttribution, marketingEvent, marketingIdentity, mission, onboarding, coupon, draft, modification, note, orderAnalytics, orderModification, order, payment, manageable, plugin, optionGroup, option, productOption, productVariant, product, promotion, role, scheduledJob, search, seller, sellingPlan, shipping, stockAnalytics, stock, subscriptionAnalytics, subscription, tax, transaction, zoneclient.shop— acf, auth, cart, channel, checkout, collection, country, customer, facet, hookDispatch, hook, marketingEvent, marketingIdentity, order, payment, product, search, sellingPlan, shipping, subscription
NestJS Integration
import { ForgeCartGraphQLModule } from '@forgecart/sdk';
// Admin only
@Module({
imports: [ForgeCartGraphQLModule.forAdmin({
endpoint: 'https://api.mystore.com/admin-api',
channelToken: 'my-channel-token',
})],
})
export class AppModule {}
// Full union (admin + shop)
@Module({
imports: [ForgeCartGraphQLModule.forRoot({
endpoint: 'https://api.mystore.com',
channelToken: 'my-channel-token',
})],
})
export class AppModule {}Auto-generated by @forgecart/client-sdk-generators.
