UNPKG

omnipartners

Version:
784 lines (783 loc) 21.4 kB
import Api, { IApiFetchOptions } from "../../lib/Api"; import { ICollectionDataOptions, IProductDataOptions, IArticlesDataOptions } from "../../types"; export interface IProduct { product_id: string; product_ean: string; product_label: string; product_friendly_name?: string; product_recommended_retail_price: string; product_weight: string; product_net_weight: string; product_gross_weight: string | null; product_packaging_units: string | null; product_packaging_container_type_info: string | null; product_packaging_value: string | null; product_packaging_gross_weight: string | null; product_collection_reference: string; product_groups: string[]; "pro_adviced_price ": string; pro_animal_type: string; pro_cust_box: string; pro_deals_label: string; pro_inventory: string; pro_net_weight: string; pro_price: string; pro_price_cat: string; pro_price_catconv: string; pro_price_dog: string; pro_price_dogconv: string; pro_price_pos: string; } export declare type IGetCollectionsByTargetingInfoInputFilterByAll = { filter_type: "SPECIES"; species_type?: string; univers?: string; breed?: string; } | { filter_type: "NEUTERED"; neutered: "YES" | "NO"; } | { filter_type: "GENDER"; gender: "M" | "F"; } | { filter_type: "PURCHASE_PLACE"; purchase_place: string; } | { filter_type: "AGE"; unit?: "WEEK" | "MONTH" | "YEAR"; age?: string; age_from?: string; age_to?: string; } | { filter_type: "RANGE"; range_reference: string; } | { filter_type: "PET_BCS"; pet_bcs: number; } | { filter_type: "PET_WEIGHT"; pet_weight: string; } | { filter_type: "PET_STAGES"; pet_stages: string[]; } | { filter_type: "TARGET_AUDIENCE"; public_visibility: "YES" | "NO"; partners_visibility: "YES" | "NO"; partner_types: string[]; } | { filter_type: "PET_ALLERGENS"; pet_allergens: string[]; } | { filter_type: "PET_HEALTH_CONTEXT"; pet_health_context: string[]; }; export interface IGetCollectionsByTargetingInfoInputFilterByAllSimple { filter_type: "SPECIES" | "NEUTERED" | "GENDER" | "PURCHASE_PLACE" | "AGE" | "RANGE" | "PET_BCS" | "PET_WEIGHT" | "PET_STAGES" | "TARGET_AUDIENCE" | "PET_ALLERGENS" | "PET_HEALTH_CONTEXT"; species_type?: string; univers?: string; breed?: string; neutered?: "YES" | "NO"; gender?: "M" | "F"; purchase_place?: string; unit?: "WEEK" | "MONTH" | "YEAR"; age?: string; age_from?: string; age_to?: string; range_reference?: string; pet_bcs?: number; pet_weight?: string; pet_stages?: string[]; public_visibility?: "YES" | "NO"; partners_visibility?: "YES" | "NO"; partner_types?: string[]; pet_allergens?: string[]; pet_health_context?: string[]; } export interface IGetCollectionsByTargetingInfoInput { partner_id?: string; partner_id_type?: string; deal_reference?: string; partner_group_handle?: string; pet_guid?: string; user_guid?: string; diagnostic_codes?: string; filter_by_all?: IGetCollectionsByTargetingInfoInputFilterByAllSimple[] | IGetCollectionsByTargetingInfoInputFilterByAll[]; filter_type?: string; species_type?: string; univers?: string; breed?: string; neutered?: string; gender?: string; purchase_place?: string; unit?: string; age?: string; age_from?: string; age_to?: string; dob?: string; pathologies?: string; lifestyle?: string; operator?: string; range_reference?: string; pet_weight?: string; pet_bcs?: string; pet_stages?: string; partners_visibility?: string; public_visibility?: string; partner_types?: string; pet_allergens?: string; pet_health_context?: string; language?: string; use_https_urls?: string; show_ration?: string; apply_range_exlusions?: string; data_options?: IProductDataOptions; ration_predicted_weight?: string; } export declare type IGetArticlesByTargetingInfoInputFilterByAll = { filter_type: "SPECIES"; species_type?: string; univers?: string; breed?: string; } | { filter_type: "NEUTERED"; neutered: "YES" | "NO"; } | { filter_type: "GENDER"; gender: "M" | "F"; } | { filter_type: "AGE"; unit?: "WEEK" | "MONTH" | "YEAR"; age?: string; age_from?: string; age_to?: string; } | { filter_type: "PATHOLOGIES"; pathologies?: string[]; operator?: "All" | "Any"; } | { filter_type: "LIFESTYLE"; lifestyle?: string[]; operator?: "All" | "Any"; } | { filter_type: "PET_BCS"; pet_bcs: number; } | { filter_type: "PET_STAGES"; pet_stages: string[]; } | { filter_type: "PET_ALLERGENS"; pet_allergens: string[]; } | { filter_type: "PET_HEALTH_CONTEXT"; pet_health_context: string[]; }; export interface IGetArticlesByTargetingInfoInputFilterByAllSimple { filter_type: "SPECIES" | "NEUTERED" | "GENDER" | "AGE" | "PATHOLOGIES" | "LIFESTYLE" | "PET_BCS" | "PET_STAGES" | "PET_ALLERGENS" | "PET_HEALTH_CONTEXT"; species_type?: string; universe?: string; breed?: string; neutered?: boolean; gender?: "M" | "F"; unit?: "WEEK" | "MONTH" | "YEAR"; age?: string; age_from?: string; age_to?: string; pathologies?: string[]; lifestyle?: string[]; operator?: "All" | "Any"; pet_bcs?: number; pet_stages?: string[]; pet_allergens?: string[]; pet_health_context?: string[]; } export interface IGetArticlesByTargetingInformationInput { filter_by_all: IGetArticlesByTargetingInfoInputFilterByAllSimple[] | IGetArticlesByTargetingInfoInputFilterByAll[]; pet_guid?: string; filter_type?: string; species_type?: string; universe?: string; breed?: string; neutered?: string; gender?: string; unit?: string; age?: string; age_from?: string; age_to?: string; dob?: string; pathologies?: string[]; lifestyle?: string[]; operator?: string; pet_bcs?: number; pet_stages?: string[]; pet_allergens?: string[]; pet_health_context?: string[]; language?: string; data_options?: IArticlesDataOptions; user_guid?: string; } export interface IGetArticlesByTargetingInformation { reference: string; generic_name: string; name: string; description: string; introduction: string; id: string; score: number; secondary_sorting_weight: string; max_score: number; content?: { category: string; category_picture_url: string; type?: string; header: string; body: string; link: string; link_text: string; picture_url: string; picture_target_link: string; }; targeting?: { pathologies: string; pet_stage: { code: string; }[]; pet_gender: string; pet_neutered: string; pet_lifestyle_code: { code: string; }[]; sort_weight: string; pet_species: string[]; pet_universe: string; pet_breed: string; pet_allergens: string; pet_health_context: string; pet_bcs_operator: string; pet_bcs_start: string; pet_bcs_end: string; pet_age_from: string; pet_age_to: string; pet_age_unit: string; }; targeting_constraints?: { pet_stage_constraint: string; pet_gender_constraint: string; pet_neutered_constraint: string; pet_lifestyle_constraint: string; pet_species_constraint: string; pet_universe_constraint: string; pet_breed_constraint: string; pet_bcs_constraint: string; pet_health_context_constraint: string; pet_allergen_constraint: string; pet_age_constraint: string; special_needs_constraint: boolean; }; } export interface IGetArticleInput { article_reference: string; language: string; data_options?: IArticlesDataOptions; } export interface IGetArticleByPetGuidInput { pet_guid: string; language?: string; data_options?: IArticlesDataOptions; } export interface IGetArticleByUserGuidInput { user_guid: string; language?: string; data_options?: IArticlesDataOptions; } export interface ICollectionAvailablePackage { ean: string; label: string; weight: string; net_weight: string; gross_weight: null; packaging_units: string; packaging_value: string; packaging_gross_weight: string | null; container_type_info: { code: string; generic_name: string; tranlated_name: { fr: string; }; measure_type: string; measure_unit: string; }; } export interface IGetCollectionsByTargetingInfoCollection { reference: string; generic_name: string; name: string; energy_level: number; has_image: boolean; description: string; tag_line: string; introduction: string; id: string; score: number; secondary_sorting_weight: string; range_priority_order: string; max_score: number; pf_tracking_reference: string; criteria_source_reference: string | null; images?: { image: string; image_small: string; image_medium: string; image_large: string; }; product_groups?: string[]; available_packages?: ICollectionAvailablePackage[]; } export interface IGetCollectionByPetGUIDInput { pet_guid: string; user_guid?: string; partner_id?: string; partner_id_type?: string; partner_group_handle?: string; language?: string; add_clientof_partner_groups?: string; use_https_urls?: string; apply_range_exlusions?: string; data_options?: string[]; is_gestation?: string; sort_order?: string; component_sort_order?: string; ignore_old_format?: string; } export interface IGetCollectionWithProductsInput { use_https_urls?: 0 | 1; collection_reference?: string; product_group_handle?: string; add_product_details?: 0 | 1; add_product_groups?: 0 | 1; lang?: string; } export interface IGetCollectionWithProducts { collection_reference: string; collection_generic_name: string; collection_name: string; collection_range_reference: string; collection_range_family_reference: string; has_image: 0 | 1; collection_image?: string; collection_image_small?: string; collection_image_medium?: string; collection_image_large?: string; products: { product_label: string; product_friendly_name?: string; product_recommended_retail_price?: string; product_weight: string; product_ean: string; product_code: string; product_groups: string[]; pro_brand_label?: string; pro_range: string; pro_range_name: string; pro_member_price?: string; pro_rank?: string; pro_stock?: string; pro_stock_location?: string; pro_url_fr?: string; pro_url_nl?: string; }[]; } export interface IGetCollectionByPetGUID { reference: string; generic_name: string; name: string; energy_level: number; has_image: 1 | 0; excluded_pathologies: string; description: string; tag_line: string; introduction: string; range_reference: string; family_reference: string; stage: [{ code: "ADULT"; name: "ADULT"; }, { code: "MATURE"; name: "MATURE"; }]; image: string; image_small: string; image_medium: string; image_large: string; criteria_match: string; criteria_requested: string; criteria_defined: string; criteria_source: string; secondary_sorting_weight: string; pf_tracking_reference: string; criteria_source_reference: string; range?: { reference: string; generic_name: string; priority: string; name: string; tag_line: string; description: string; targeting: { incl_partner_groups: string[]; excl_partner_groups: string[]; incl_places_purchase: string[]; excl_places_purchase: string[]; }; }; } export interface IGetCollectionDetailsInput { collection_reference: string; language: string; use_https_urls?: 0 | 1; data_options?: ICollectionDataOptions; component_sort_order?: string; ignore_old_format?: string; } export interface ICollectionDetailBenefit { id: string; title: string; description: string; image: string; } export interface ICollectionDetailProduct { ean: string; code: string; label: string; weight?: string | null; net_weight?: string | null; gross_weight?: string | null; } export interface ICollectionDetailRelatedCollection { reference: string; type: string; } export interface ICollectionDetail { reference: string; generic_name: string; name: string; energy_level: number; has_image: 0 | 1; contains: []; does_not_contain: []; caloric_table: null; benefits: ICollectionDetailBenefit[]; key_benefits?: string[]; collection_reference: string; collection_generic_name: string; collection_name: string; collection_description: string; collection_tag_line: string; collection_introduction: string; collection_range_reference: string; collection_range_family_reference: string; collection_energy_level: number; collection_image?: string; collection_image_small?: string; collection_image_medium?: string; collection_image_large?: string; collection_caloric_table: null; images?: { image?: string | null; image_small?: string | null; image_medium?: string | null; image_large?: string | null; }; products?: ICollectionDetailProduct[]; related_collections?: ICollectionDetailRelatedCollection[]; range?: { reference: string; generic_name: string; priority: string; name: string; tag_line: string; description: string; targeting: { incl_partner_groups: string[]; excl_partner_groups: string[]; incl_places_purchase: string[]; excl_places_purchase: string[]; }; }; available_packages?: { ean: string; code: string; label: string; weight?: string; net_weight?: string; gross_weight?: string; packaging_units?: string; packaging_value?: string; packaging_gross_weight?: string; container_type_info?: string; }[]; } export interface IProductGroupListItem { product_group_handle: string; product_group_name: string; } export interface IFindProductCollectionInput { use_https_urls?: 0 | 1; resolve_by: string; value: string; language?: string; data_options?: ICollectionDataOptions; component_sort_order?: string; ignore_old_format?: 0 | 1; search_mode?: "exact" | "sounds_like" | "looks_like" | "partial_string" | "partial_words"; } export declare type ApproximationCodes = "APC001" | "APC002" | "APC003" | "APC004" | "APC005" | "APC006"; /** * * **@pet_weight**: required only if pet has no weight set */ export interface IGetCollectionPetRationInput { pet_weight?: string; pet_guid: string; pet_predicted_adult_weight?: string; pet_bcs?: string; energy_level?: string; collection_reference?: string; language?: string; } export interface ICollectionPetRation { debug: { exponent: number; constant: number; }; energy_value: number; ration_value: number; energy_value_unit: string; ration_value_unit: string; approximation_codes: ApproximationCodes[]; ration_in_cups_per_day: string; number_of_cups_per_day: string; } export interface IAddProductInput { product_ean: number | string; product_label: string; product_code: string; product_status: 1 | 0; product_collection_reference?: string; product_collection_gen_name?: string; product_group_handles?: string; product_friendly_name?: string; product_rr_price?: string; product_pp_price?: string; product_weight?: number; product_gross_weight?: number; product_packaging_container_type?: string; product_packaging_value?: string; product_packaging_units?: number; product_packaging_gross_weight?: number; product_publicly_not_available?: 1 | 0; custom_fields?: Record<string, string>; } export default class Products extends Api { defaultHost: string; errorMap: { 1000: { message: string; }; 1001: { message: string; }; 1002: { message: string; }; 1003: { message: string; }; 1004: { message: string; }; 1005: { message: string; }; 1006: { message: string; }; 1014: { message: string; }; 1024: { message: string; }; 1027: { message: string; }; 1028: { message: string; }; 1060: { message: string; }; 1008: { message: string; }; 1009: { message: string; }; 1015: { message: string; }; 1016: { message: string; }; 1017: { message: string; }; 1021: { message: string; }; 1023: { message: string; }; 1058: { message: string; }; 1030: { message: string; }; 1034: { message: string; }; 1035: { message: string; }; 1939: { message: string; }; 1940: { message: string; }; 1941: { message: string; }; 1942: { message: string; }; 1943: { message: string; }; 1954: { message: string; }; 1955: { message: string; }; 1968: { message: string; }; 1969: { message: string; }; 1973: { message: string; }; 1974: { message: string; }; 1975: { message: string; }; 1977: { message: string; }; 1979: { message: string; }; 1980: { message: string; }; 1981: { message: string; }; 1982: { message: string; }; 1983: { message: string; }; 1984: { message: string; }; 1991: { message: string; }; 1992: { message: string; }; 1989: { message: string; }; 2005: { message: string; }; 2010: { message: string; }; }; _call(action: string, data: any, options?: IApiFetchOptions): Promise<any>; getProduct(data: { product_ean?: string; product_code?: string; }): Promise<{ data: IProduct; }>; getCollectionDetails(data: IGetCollectionDetailsInput): Promise<{ data: ICollectionDetail; }>; findProductCollection(data: IFindProductCollectionInput): Promise<{ data: [ICollectionDetail]; }>; getCollectionsByTargetingInfo(data: IGetCollectionsByTargetingInfoInput): Promise<{ data: IGetCollectionsByTargetingInfoCollection[]; }>; getCollectionsByPetGUID(data: IGetCollectionByPetGUIDInput): Promise<{ data: IGetCollectionByPetGUID[]; }>; getCollectionsWithProducts(data?: IGetCollectionWithProductsInput): Promise<{ data: IGetCollectionWithProducts[]; }>; getProductGroupList(data?: { group_handle?: string; }): Promise<{ data: IProductGroupListItem[]; }>; getCollectionAvailablePackage(data?: { collection_reference: string; show_public_products_only?: 0 | 1; use_https_urls?: 0 | 1; language?: string; }): Promise<{ data: { reference: string; products: ICollectionAvailablePackage[]; }[]; }>; getCollectionPetRation(data?: IGetCollectionPetRationInput): Promise<{ data: ICollectionPetRation; }>; getArticlesByTargetingInformation(data: IGetArticlesByTargetingInformationInput): Promise<{ data: IGetArticlesByTargetingInformation[]; }>; getArticlesByPetGuid(data: IGetArticleByPetGuidInput): Promise<{ data: IGetArticlesByTargetingInformation[]; }>; getArticlesByUserGuid(data: IGetArticleByUserGuidInput): Promise<{ data: IGetArticlesByTargetingInformation[]; }>; getArticle(data: IGetArticleInput): Promise<{ data: IGetArticlesByTargetingInformation; }>; addProduct({ custom_fields, ...fields }: IAddProductInput): Promise<{ statusCode: number; }>; }