export type StoreId = string; export type CreateApiManagerOrderV1OrdersOrderCreatedArgs = {'X-Store-Id': StoreId, 'X-Event-Id': string}; export type CreateApiManagerOrderV1OrdersOrderCreatedOptions = {baseUrl?: string | undefined, OAuth20?: string | undefined, fetch?: typeof fetch | undefined}; /** * Notify the result of a Create Order event * * POST /manager/order/v1/orders/order-created */ export const createApiManagerOrderV1OrdersOrderCreated = async (args: CreateApiManagerOrderV1OrdersOrderCreatedArgs, options?: CreateApiManagerOrderV1OrdersOrderCreatedOptions) => { const {baseUrl = "https://partners.tryotter.com", fetch: fetchFn = fetch, OAuth20} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['X-Store-Id'] != null) headers.set("X-Store-Id", String(args['X-Store-Id'])) if (args['X-Event-Id'] != null) headers.set("X-Event-Id", String(args['X-Event-Id'])) if (OAuth20 !== undefined) headers.set('authorization', `Bearer ${OAuth20}`) const url = `${baseUrl.replace(/\/+$/, '')}/manager/order/v1/orders/order-created${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };