facebook-nodejs-business-sdk
Version:
SDK for the Facebook Ads API in Javascript and Node.js
85 lines (76 loc) • 1.99 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 Cursor from './../cursor';
import Comment from './comment';
import Profile from './profile';
import Photo from './photo';
import Post from './post';
/**
* LifeEvent
* @extends AbstractCrudObject
* @see {@link https://developers.facebook.com/docs/marketing-api/}
*/
export default class LifeEvent extends AbstractCrudObject {
static get Fields () {
return Object.freeze({
description: 'description',
end_time: 'end_time',
from: 'from',
id: 'id',
is_hidden: 'is_hidden',
start_time: 'start_time',
title: 'title',
updated_time: 'updated_time',
});
}
getComments (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> {
return this.getEdge(
Comment,
fields,
params,
fetchFirstPage,
'/comments'
);
}
getLikes (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> {
return this.getEdge(
Profile,
fields,
params,
fetchFirstPage,
'/likes'
);
}
getPhotos (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> {
return this.getEdge(
Photo,
fields,
params,
fetchFirstPage,
'/photos'
);
}
getSharedPosts (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> {
return this.getEdge(
Post,
fields,
params,
fetchFirstPage,
'/sharedposts'
);
}
get (fields: Array<string>, params: Object = {}): LifeEvent {
// $FlowFixMe : Support Generic Types
return this.read(
fields,
params
);
}
}