facebook-nodejs-business-sdk
Version:
SDK for the Facebook Marketing API in Javascript and Node.js
90 lines (80 loc) • 2.27 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 AbstractObject from './../abstract-object';
import Cursor from './../cursor';
import Comment from './comment';
/**
* IGMediaForIGOnlyAPI
* @extends AbstractCrudObject
* @see {@link https://developers.facebook.com/docs/marketing-api/}
*/
export default class IGMediaForIGOnlyAPI extends AbstractCrudObject {
static get Fields (): Object {
return Object.freeze({
caption: 'caption',
comments_count: 'comments_count',
id: 'id',
is_comment_enabled: 'is_comment_enabled',
is_shared_to_feed: 'is_shared_to_feed',
like_count: 'like_count',
media_product_type: 'media_product_type',
media_type: 'media_type',
media_url: 'media_url',
owner: 'owner',
permalink: 'permalink',
shortcode: 'shortcode',
thumbnail_url: 'thumbnail_url',
timestamp: 'timestamp',
username: 'username',
});
}
getChildren (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> {
return this.getEdge(
AbstractObject,
fields,
params,
fetchFirstPage,
'/children'
);
}
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 = {}, pathOverride?: ?string = null): Promise<AbstractObject> {
return this.createEdge(
'/comments',
fields,
params,
null,
pathOverride,
);
}
get (fields: Array<string>, params: Object = {}): IGMediaForIGOnlyAPI {
// $FlowFixMe : Support Generic Types
return this.read(
fields,
params
);
}
// $FlowFixMe : Support Generic Types
update (fields: Array<string>, params: Object = {}): AbstractObject {
// $FlowFixMe : Support Generic Types
return super.update(
params
);
}
}