UNPKG

facebook-nodejs-business-sdk

Version:

SDK for the Facebook Marketing API in Javascript and Node.js

161 lines (144 loc) 4.07 kB
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under the license found in the * LICENSE file in the root directory of this source tree. * * @flow */ import {AbstractCrudObject} from './../abstract-crud-object'; import AbstractObject from './../abstract-object'; import Cursor from './../cursor'; import AutomotiveModel from './automotive-model'; import Destination from './destination'; import Flight from './flight'; import HomeListing from './home-listing'; import Hotel from './hotel'; import MediaTitle from './media-title'; import ProductItem from './product-item'; import VehicleOffer from './vehicle-offer'; import Vehicle from './vehicle'; /** * ProductSet * @extends AbstractCrudObject * @see {@link https://developers.facebook.com/docs/marketing-api/} */ export default class ProductSet extends AbstractCrudObject { static get Fields (): Object { return Object.freeze({ auto_creation_url: 'auto_creation_url', filter: 'filter', id: 'id', latest_metadata: 'latest_metadata', live_metadata: 'live_metadata', name: 'name', ordering_info: 'ordering_info', product_catalog: 'product_catalog', product_count: 'product_count', retailer_id: 'retailer_id', }); } getAutomotiveModels (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> { return this.getEdge( AutomotiveModel, fields, params, fetchFirstPage, '/automotive_models' ); } getDestinations (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> { return this.getEdge( Destination, fields, params, fetchFirstPage, '/destinations' ); } getFlights (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> { return this.getEdge( Flight, fields, params, fetchFirstPage, '/flights' ); } getHomeListings (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> { return this.getEdge( HomeListing, fields, params, fetchFirstPage, '/home_listings' ); } getHotels (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> { return this.getEdge( Hotel, fields, params, fetchFirstPage, '/hotels' ); } getMediaTitles (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> { return this.getEdge( MediaTitle, fields, params, fetchFirstPage, '/media_titles' ); } getProducts (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> { return this.getEdge( ProductItem, fields, params, fetchFirstPage, '/products' ); } getVehicleOffers (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> { return this.getEdge( VehicleOffer, fields, params, fetchFirstPage, '/vehicle_offers' ); } getVehicles (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> { return this.getEdge( Vehicle, fields, params, fetchFirstPage, '/vehicles' ); } // $FlowFixMe : Support Generic Types delete (fields: Array<string>, params: Object = {}): AbstractObject { // $FlowFixMe : Support Generic Types return super.delete( params ); } get (fields: Array<string>, params: Object = {}): ProductSet { // $FlowFixMe : Support Generic Types return this.read( fields, params ); } // $FlowFixMe : Support Generic Types update (fields: Array<string>, params: Object = {}): ProductSet { // $FlowFixMe : Support Generic Types return super.update( params ); } }