facebook-nodejs-business-sdk
Version:
SDK for the Facebook Ads API in Javascript and Node.js
103 lines (93 loc) • 2.66 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 AdAccount from './ad-account';
import BusinessAssetGroup from './business-asset-group';
import Page from './page';
import ProductCatalog from './product-catalog';
import User from './user';
/**
* SystemUser
* @extends AbstractCrudObject
* @see {@link https://developers.facebook.com/docs/marketing-api/}
*/
export default class SystemUser extends AbstractCrudObject {
static get Fields () {
return Object.freeze({
created_by: 'created_by',
created_time: 'created_time',
finance_permission: 'finance_permission',
id: 'id',
ip_permission: 'ip_permission',
name: 'name',
});
}
static get Role (): Object {
return Object.freeze({
admin: 'ADMIN',
ads_rights_reviewer: 'ADS_RIGHTS_REVIEWER',
employee: 'EMPLOYEE',
finance_analyst: 'FINANCE_ANALYST',
finance_editor: 'FINANCE_EDITOR',
});
}
getAssignedAdAccounts (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> {
return this.getEdge(
AdAccount,
fields,
params,
fetchFirstPage,
'/assigned_ad_accounts'
);
}
getAssignedBusinessAssetGroups (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> {
return this.getEdge(
BusinessAssetGroup,
fields,
params,
fetchFirstPage,
'/assigned_business_asset_groups'
);
}
getAssignedPages (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> {
return this.getEdge(
Page,
fields,
params,
fetchFirstPage,
'/assigned_pages'
);
}
getAssignedProductCatalogs (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> {
return this.getEdge(
ProductCatalog,
fields,
params,
fetchFirstPage,
'/assigned_product_catalogs'
);
}
getUpdatedBy (fields: Array<string>, params: Object = {}, fetchFirstPage: boolean = true): Cursor | Promise<*> {
return this.getEdge(
User,
fields,
params,
fetchFirstPage,
'/updated_by'
);
}
get (fields: Array<string>, params: Object = {}): SystemUser {
// $FlowFixMe : Support Generic Types
return this.read(
fields,
params
);
}
}