@ commercialtools- test- data/ channel (英语)
此软件包为商务工具平台提供了数据模型 Channel 类型
https://docs.com/api/projects/channels (中文(中国大陆) )
安装
$ pnpm add -D @commercetools-test-data/channel
使用量
import {
ChannelRest,
ChannelDraftRest,
ChannelGraphql,
ChannelDraftGraphql,
} from '@commercetools-test-data/inventory-entry';
const channelRest = ChannelRest.random().build();
const channelDraftRest = ChannelDraftRest.random().build();
const channelGraphql = ChannelGraphql.random().build();
const channelDraftGraphql = ChannelDraftGraphql.random().build();
// Presets
const withInventorySupplyAndProductDistributionRolesRest =
ChannelDraftRest.presets
.withInventorySupplyAndProductDistributionRoles()
.build();
const withInventorySupplyAndProductDistributionRolesGraphql =
ChannelDraftGraphql.presets
.withInventorySupplyAndProductDistributionRoles()
.build();
对于倒向相容性,我们仍然支持使用通用数据模型,但是你应该考虑这些模型的后遗症,因为我们将来将去除它们.
import {
Channel,
ChannelDraft,
type TChannel,
type TChannelDraft,
} from '@commercetools-test-data/channel';
const channel = Channel.random().build<TChannel>();
const channelDraft = ChannelDraft.random().build<TChannelDraft>();
// Presets
const withInventorySupplyAndProductDistributionRoles = ChannelDraft.presets
.withInventorySupplyAndProductDistributionRoles()
.build<TChannelDraft>();