import type { ApiClient } from "@promobase/sdk-runtime"; import { Cursor } from "@promobase/sdk-runtime"; import { metaPagination } from "../../pagination.ts"; import type { AutomotiveModelFields } from "./automotive-model.ts"; import type { DestinationFields } from "./destination.ts"; import type { FlightFields } from "./flight.ts"; import type { HomeListingFields } from "./home-listing.ts"; import type { HotelFields } from "./hotel.ts"; import type { ProductFeedRuleFields } from "./product-feed-rule.ts"; import type { ProductFeedScheduleFields } from "./product-feed-schedule.ts"; import type { ProductFeedUploadFields } from "./product-feed-upload.ts"; import type { ProductItemFields } from "./product-item.ts"; import type { VehicleFields } from "./vehicle.ts"; import type { VehicleOfferFields } from "./vehicle-offer.ts"; import type { ProductFeedDelimiter, ProductFeedIngestionSourceType, ProductFeedQuotedFieldsMode } from "../enums.ts"; export interface ProductFeedFields { country: string; created_time: string; default_currency: string; deletion_enabled: boolean; delimiter: ProductFeedDelimiter; encoding: string; file_name: string; id: string; ingestion_source_type: ProductFeedIngestionSourceType; item_sub_type: string; latest_upload: ProductFeedUploadFields; migrated_from_feed_id: string; name: string; override_type: string; primary_feeds: string[]; product_count: number; quoted_fields_mode: ProductFeedQuotedFieldsMode; schedule: ProductFeedScheduleFields; supplementary_feeds: string[]; update_schedule: ProductFeedScheduleFields; } export interface ProductFeedListAutomotiveModelsParams { bulk_pagination?: boolean; filter?: Record; [key: string]: unknown; } export interface ProductFeedListDestinationsParams { bulk_pagination?: boolean; filter?: Record; [key: string]: unknown; } export interface ProductFeedListFlightsParams { bulk_pagination?: boolean; filter?: Record; [key: string]: unknown; } export interface ProductFeedListHomeListingsParams { bulk_pagination?: boolean; filter?: Record; [key: string]: unknown; } export interface ProductFeedListHotelsParams { bulk_pagination?: boolean; filter?: Record; [key: string]: unknown; } export interface ProductFeedListProductsParams { bulk_pagination?: boolean; error_priority?: string; error_type?: string; filter?: Record; [key: string]: unknown; } export interface ProductFeedCreateRulesParams { attribute: string; params?: Record; rule_type: string; [key: string]: unknown; } export interface ProductFeedCreateSupplementaryFeedAssocsParams { assoc_data: Record[]; [key: string]: unknown; } export interface ProductFeedCreateUploadSchedulesParams { upload_schedule?: string; [key: string]: unknown; } export interface ProductFeedCreateUploadsParams { fbe_external_business_id?: string; file?: File | Blob | ReadableStream; password?: string; update_only?: boolean; url?: string; username?: string; [key: string]: unknown; } export interface ProductFeedListVehicleOffersParams { bulk_pagination?: boolean; filter?: Record; [key: string]: unknown; } export interface ProductFeedListVehiclesParams { bulk_pagination?: boolean; filter?: Record; [key: string]: unknown; } export interface ProductFeedUpdateParams { default_currency?: string; deletion_enabled?: boolean; delimiter?: string; encoding?: string; migrated_from_feed_id?: string; name?: string; quoted_fields_mode?: string; schedule?: string; update_schedule?: string; [key: string]: unknown; } export function productFeedNode(client: ApiClient, id: string) { return { __path: id, __brand: undefined as unknown as ProductFeedFields, get: (opts: { fields: F; params?: Record }) => client.get>(`${id}`, opts), update: (params: ProductFeedUpdateParams) => client.post(`${id}`, params as Record), delete: () => client.delete(`${id}`, {}), automotiveModels: (opts: { fields: F; params?: ProductFeedListAutomotiveModelsParams }) => new Cursor>(client, `${id}/automotive_models`, opts as { fields: readonly string[]; params?: Record }, metaPagination()), destinations: (opts: { fields: F; params?: ProductFeedListDestinationsParams }) => new Cursor>(client, `${id}/destinations`, opts as { fields: readonly string[]; params?: Record }, metaPagination()), flights: (opts: { fields: F; params?: ProductFeedListFlightsParams }) => new Cursor>(client, `${id}/flights`, opts as { fields: readonly string[]; params?: Record }, metaPagination()), homeListings: (opts: { fields: F; params?: ProductFeedListHomeListingsParams }) => new Cursor>(client, `${id}/home_listings`, opts as { fields: readonly string[]; params?: Record }, metaPagination()), hotels: (opts: { fields: F; params?: ProductFeedListHotelsParams }) => new Cursor>(client, `${id}/hotels`, opts as { fields: readonly string[]; params?: Record }, metaPagination()), products: (opts: { fields: F; params?: ProductFeedListProductsParams }) => new Cursor>(client, `${id}/products`, opts as { fields: readonly string[]; params?: Record }, metaPagination()), rules: { __path: `${id}/rules`, __brand: undefined as unknown as ProductFeedRuleFields, list: (opts: { fields: F; params?: Record }) => new Cursor>(client, `${id}/rules`, opts as { fields: readonly string[]; params?: Record }, metaPagination()), create: (params: ProductFeedCreateRulesParams) => client.post(`${id}/rules`, params as Record), }, createSupplementaryFeedAssoc: (params: ProductFeedCreateSupplementaryFeedAssocsParams) => client.post>(`${id}/supplementary_feed_assocs`, params as Record), uploadSchedules: { __path: `${id}/upload_schedules`, __brand: undefined as unknown as ProductFeedScheduleFields, list: (opts: { fields: F; params?: Record }) => new Cursor>(client, `${id}/upload_schedules`, opts as { fields: readonly string[]; params?: Record }, metaPagination()), create: (params: ProductFeedCreateUploadSchedulesParams) => client.post(`${id}/upload_schedules`, params as Record), }, uploads: { __path: `${id}/uploads`, __brand: undefined as unknown as ProductFeedUploadFields, list: (opts: { fields: F; params?: Record }) => new Cursor>(client, `${id}/uploads`, opts as { fields: readonly string[]; params?: Record }, metaPagination()), create: (params: ProductFeedCreateUploadsParams) => client.post(`${id}/uploads`, params as Record), }, vehicleOffers: (opts: { fields: F; params?: ProductFeedListVehicleOffersParams }) => new Cursor>(client, `${id}/vehicle_offers`, opts as { fields: readonly string[]; params?: Record }, metaPagination()), vehicles: (opts: { fields: F; params?: ProductFeedListVehiclesParams }) => new Cursor>(client, `${id}/vehicles`, opts as { fields: readonly string[]; params?: Record }, metaPagination()), }; }