facebook-nodejs-business-sdk
Version:
SDK for the Facebook Ads API in Javascript and Node.js
169 lines (153 loc) • 3.61 kB
JavaScript
/**
* Copyright (c) 2017-present, Facebook, Inc.
* 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 AutoOffer from './auto-offer';
import AutomotiveModel from './automotive-model';
import DACheck from './da-check';
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 () {
return Object.freeze({
auto_creation_url: 'auto_creation_url',
filter: 'filter',
id: 'id',
name: 'name',
product_catalog: 'product_catalog',
product_count: 'product_count'
});
}
getAutoOffers (fields, params, fetchFirstPage = true): AutoOffer {
return this.getEdge(
AutoOffer,
fields,
params,
fetchFirstPage,
'/auto_offers'
);
}
getAutomotiveModels (fields, params, fetchFirstPage = true): AutomotiveModel {
return this.getEdge(
AutomotiveModel,
fields,
params,
fetchFirstPage,
'/automotive_models'
);
}
getDaChecks (fields, params, fetchFirstPage = true): DACheck {
return this.getEdge(
DACheck,
fields,
params,
fetchFirstPage,
'/da_checks'
);
}
getDestinations (fields, params, fetchFirstPage = true): Destination {
return this.getEdge(
Destination,
fields,
params,
fetchFirstPage,
'/destinations'
);
}
getFlights (fields, params, fetchFirstPage = true): Flight {
return this.getEdge(
Flight,
fields,
params,
fetchFirstPage,
'/flights'
);
}
getHomeListings (fields, params, fetchFirstPage = true): HomeListing {
return this.getEdge(
HomeListing,
fields,
params,
fetchFirstPage,
'/home_listings'
);
}
getHotels (fields, params, fetchFirstPage = true): Hotel {
return this.getEdge(
Hotel,
fields,
params,
fetchFirstPage,
'/hotels'
);
}
getMediaTitles (fields, params, fetchFirstPage = true): MediaTitle {
return this.getEdge(
MediaTitle,
fields,
params,
fetchFirstPage,
'/media_titles'
);
}
getProducts (fields, params, fetchFirstPage = true): ProductItem {
return this.getEdge(
ProductItem,
fields,
params,
fetchFirstPage,
'/products'
);
}
getVehicleOffers (fields, params, fetchFirstPage = true): VehicleOffer {
return this.getEdge(
VehicleOffer,
fields,
params,
fetchFirstPage,
'/vehicle_offers'
);
}
getVehicles (fields, params, fetchFirstPage = true): Vehicle {
return this.getEdge(
Vehicle,
fields,
params,
fetchFirstPage,
'/vehicles'
);
}
delete (fields, params): AbstractObject {
return super.delete(
params
);
}
get (fields, params): ProductSet {
return this.read(
fields,
params
);
}
update (fields, params): ProductSet {
return super.update(
params
);
}
}