facebook-nodejs-business-sdk
Version:
SDK for the Facebook Ads API in Javascript and Node.js
81 lines (72 loc) • 2.02 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 Cursor from './../cursor';
import Business from './business';
import AdAccount from './ad-account';
/**
* InstagramUser
* @extends AbstractCrudObject
* @see {@link https://developers.facebook.com/docs/marketing-api/}
*/
export default class InstagramUser extends AbstractCrudObject {
static get Fields () {
return Object.freeze({
follow_count: 'follow_count',
followed_by_count: 'followed_by_count',
has_profile_picture: 'has_profile_picture',
id: 'id',
is_private: 'is_private',
is_published: 'is_published',
media_count: 'media_count',
profile_pic: 'profile_pic',
username: 'username',
});
}
deleteAgencies (params: Object = {}): Promise<*> {
return super.deleteEdge(
'/agencies',
params
);
}
getAgencies (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> {
return this.getEdge(
Business,
fields,
params,
fetchFirstPage,
'/agencies'
);
}
getAuthorizedAdAccounts (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> {
return this.getEdge(
AdAccount,
fields,
params,
fetchFirstPage,
'/authorized_adaccounts'
);
}
createAuthorizedAdAccount (fields: Array<string>, params: Object = {}): Promise<InstagramUser> {
return this.createEdge(
'/authorized_adaccounts',
fields,
params,
InstagramUser
);
}
get (fields: Array<string>, params: Object = {}): InstagramUser {
// $FlowFixMe : Support Generic Types
return this.read(
fields,
params
);
}
}