export type BeezUPCommonMarketplaceTechnicalCode = string; export type AccountId = number; export type AutomaticTransition = {marketplaceTechnicalCode: BeezUPCommonMarketplaceTechnicalCode, accountId: AccountId, orderStatusTransitionId: number, enabled: boolean}; export type ConfigureAutomaticTransitionRequest = {automaticTransitions: Array}; export type CreateApiV2UserMarketplacesOrdersAutomaticTransitionsArgs = {body: ConfigureAutomaticTransitionRequest}; export type CreateApiV2UserMarketplacesOrdersAutomaticTransitionsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Configure new or existing automatic Order status transition * * POST /v2/user/marketplaces/orders/automaticTransitions */ export const createApiV2UserMarketplacesOrdersAutomaticTransitions = async (args: CreateApiV2UserMarketplacesOrdersAutomaticTransitionsArgs, options?: CreateApiV2UserMarketplacesOrdersAutomaticTransitionsOptions) => { const {baseUrl = "https://api.beezup.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v2/user/marketplaces/orders/automaticTransitions${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };