export type CreateEcommerceAppDto = {name: string, slug?: string | undefined, description: string, logo_url: string, website_url?: string | undefined, developer_name: string, contact_email: string, contact_phone: string, oauth: {authorize_url?: string | undefined, token_url?: string | undefined, client_id?: string | undefined, client_secret?: string | undefined, scopes?: Array | undefined, account_info_url?: string | undefined}, capabilities: {inbound_events?: (Array<'order' | 'checkout' | 'fulfillment' | 'product'>) | undefined, outbound?: ({products_list?: {url: string} | undefined, order_get?: {url: string} | undefined, stock_get?: {url: string} | undefined, checkout_create?: {url: string} | undefined, customer_get?: {url: string} | undefined}) | undefined}}; export type CreateApiApiEcommerceAppArgs = {body: CreateEcommerceAppDto}; export type CreateApiApiEcommerceAppOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create an app * * POST /api/ecommerce-app */ export const createApiApiEcommerceApp = async (args: CreateApiApiEcommerceAppArgs, options?: CreateApiApiEcommerceAppOptions) => { const {baseUrl = "https://api.vambe.me", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/api/ecommerce-app${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 };