export type RejectionReasonSchema = {key: string, type: string, name: string, description: string}; export type GetProductMasterSchema = {external_reference_key?: (string | null) | undefined, status: string, rejection_reasons?: (Array | null) | undefined, rejection_message?: (string | null) | undefined, rejected_product_ids_hint?: (Array | null) | undefined}; export type ProductMasterStatusUpdatedWebhookMessageSchema = {id: number, event: 'product_master.status_updated', timestamp?: string | undefined, message: GetProductMasterSchema, subscription_id?: (number | null) | undefined}; export type CreateApiApiV1WebhooksProductMasterStatusUpdatedArgs = {body: ProductMasterStatusUpdatedWebhookMessageSchema}; export type CreateApiApiV1WebhooksProductMasterStatusUpdatedOptions = {baseUrl: string, APIKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Product Master Status Updated Webhook * * POST /api/v1/webhooks/product-master-status-updated */ export const createApiApiV1WebhooksProductMasterStatusUpdated = async (args: CreateApiApiV1WebhooksProductMasterStatusUpdatedArgs, options: CreateApiApiV1WebhooksProductMasterStatusUpdatedOptions) => { const {baseUrl, fetch: fetchFn = fetch, APIKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (APIKeyAuth !== undefined) headers.set("X-API-Key", APIKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/webhooks/product-master-status-updated${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 };