UNPKG

facebook-nodejs-business-sdk

Version:
97 lines (87 loc) 2.24 kB
/** * 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 Post from './post'; /** * Link * @extends AbstractCrudObject * @see {@link https://developers.facebook.com/docs/marketing-api/} */ export default class Link extends AbstractCrudObject { static get Fields () { return Object.freeze({ caption: 'caption', created_time: 'created_time', description: 'description', from: 'from', icon: 'icon', id: 'id', link: 'link', message: 'message', multi_share_optimized: 'multi_share_optimized', name: 'name', privacy: 'privacy', via: 'via', }); } getComments (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> { return this.getEdge( Comment, fields, params, fetchFirstPage, '/comments' ); } createComment (fields: Array<string>, params: Object = {}): Promise<Comment> { return this.createEdge( '/comments', fields, params, Comment ); } getLikes (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> { return this.getEdge( Profile, fields, params, fetchFirstPage, '/likes' ); } getReactions (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> { return this.getEdge( Profile, fields, params, fetchFirstPage, '/reactions' ); } 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 = {}): Link { // $FlowFixMe : Support Generic Types return this.read( fields, params ); } }