export type HttpUrl = string; export type SubscriptionName = string; export type SubscriptionMerchantApplicationName = string; export type SubscriptionMerchantApplicationVersion = string; export type Email = string; export type CreateSubscriptionRequest = {targetUrl: HttpUrl, name: SubscriptionName, merchantApplicationName: SubscriptionMerchantApplicationName, merchantApplicationVersion: SubscriptionMerchantApplicationVersion, merchantEmailAlert?: Email | undefined}; export type CreateApiV2UserMarketplacesOrdersSubscriptionsIdArgs = {id: unknown, body: CreateSubscriptionRequest}; export type CreateApiV2UserMarketplacesOrdersSubscriptionsIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Creates a subscription to the orders * * POST /v2/user/marketplaces/orders/subscriptions/{id} */ export const createApiV2UserMarketplacesOrdersSubscriptionsId = async (args: CreateApiV2UserMarketplacesOrdersSubscriptionsIdArgs, options?: CreateApiV2UserMarketplacesOrdersSubscriptionsIdOptions) => { 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/subscriptions/${encodeURIComponent(String(args.id))}${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 };