facebook-nodejs-business-sdk
Version:
SDK for the Facebook Marketing API in Javascript and Node.js
145 lines (136 loc) • 4.44 kB
JavaScript
/*
* 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 Cursor from './../cursor';
import CatalogItemChannelsToIntegrityStatus from './catalog-item-channels-to-integrity-status';
import OverrideDetails from './override-details';
import DynamicVideoMetadata from './dynamic-video-metadata';
/**
* VehicleOffer
* @extends AbstractCrudObject
* @see {@link https://developers.facebook.com/docs/marketing-api/}
*/
export default class VehicleOffer extends AbstractCrudObject {
static get Fields (): Object {
return Object.freeze({
amount_currency: 'amount_currency',
amount_percentage: 'amount_percentage',
amount_price: 'amount_price',
amount_qualifier: 'amount_qualifier',
applinks: 'applinks',
availability: 'availability',
body_style: 'body_style',
cashback_currency: 'cashback_currency',
cashback_price: 'cashback_price',
category_specific_fields: 'category_specific_fields',
currency: 'currency',
custom_label_0: 'custom_label_0',
custom_label_1: 'custom_label_1',
custom_label_2: 'custom_label_2',
custom_label_3: 'custom_label_3',
custom_label_4: 'custom_label_4',
custom_number_0: 'custom_number_0',
custom_number_1: 'custom_number_1',
custom_number_2: 'custom_number_2',
custom_number_3: 'custom_number_3',
custom_number_4: 'custom_number_4',
dma_codes: 'dma_codes',
downpayment_currency: 'downpayment_currency',
downpayment_price: 'downpayment_price',
downpayment_qualifier: 'downpayment_qualifier',
drivetrain: 'drivetrain',
end_date: 'end_date',
end_time: 'end_time',
exterior_color: 'exterior_color',
fuel_type: 'fuel_type',
generation: 'generation',
id: 'id',
image_fetch_status: 'image_fetch_status',
images: 'images',
interior_color: 'interior_color',
interior_upholstery: 'interior_upholstery',
make: 'make',
model: 'model',
offer_description: 'offer_description',
offer_disclaimer: 'offer_disclaimer',
offer_type: 'offer_type',
price: 'price',
product_priority_0: 'product_priority_0',
product_priority_1: 'product_priority_1',
product_priority_2: 'product_priority_2',
product_priority_3: 'product_priority_3',
product_priority_4: 'product_priority_4',
sanitized_images: 'sanitized_images',
start_date: 'start_date',
start_time: 'start_time',
tags: 'tags',
term_length: 'term_length',
term_qualifier: 'term_qualifier',
title: 'title',
transmission: 'transmission',
trim: 'trim',
unit_price: 'unit_price',
url: 'url',
vehicle_offer_id: 'vehicle_offer_id',
visibility: 'visibility',
year: 'year',
});
}
static get ImageFetchStatus (): Object {
return Object.freeze({
direct_upload: 'DIRECT_UPLOAD',
fetched: 'FETCHED',
fetch_failed: 'FETCH_FAILED',
no_status: 'NO_STATUS',
outdated: 'OUTDATED',
partial_fetch: 'PARTIAL_FETCH',
});
}
static get Visibility (): Object {
return Object.freeze({
published: 'PUBLISHED',
staging: 'STAGING',
});
}
getChannelsToIntegrityStatus (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> {
return this.getEdge(
CatalogItemChannelsToIntegrityStatus,
fields,
params,
fetchFirstPage,
'/channels_to_integrity_status'
);
}
getOverrideDetails (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> {
return this.getEdge(
OverrideDetails,
fields,
params,
fetchFirstPage,
'/override_details'
);
}
getVideosMetadata (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> {
return this.getEdge(
DynamicVideoMetadata,
fields,
params,
fetchFirstPage,
'/videos_metadata'
);
}
get (fields: Array<string>, params: Object = {}): VehicleOffer {
// $FlowFixMe : Support Generic Types
return this.read(
fields,
params
);
}
}