facebook-nodejs-business-sdk
Version:
SDK for the Facebook Marketing API in Javascript and Node.js
104 lines (94 loc) • 2.86 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 Cursor from './../cursor';
import AdAccount from './ad-account';
import BusinessAssetGroup from './business-asset-group';
import Page from './page';
import ProductCatalog from './product-catalog';
/**
* SystemUser
* @extends AbstractCrudObject
* @see {@link https://developers.facebook.com/docs/marketing-api/}
*/
export default class SystemUser extends AbstractCrudObject {
static get Fields (): Object {
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',
default: 'DEFAULT',
developer: 'DEVELOPER',
employee: 'EMPLOYEE',
finance_analyst: 'FINANCE_ANALYST',
finance_edit: 'FINANCE_EDIT',
finance_editor: 'FINANCE_EDITOR',
finance_view: 'FINANCE_VIEW',
manage: 'MANAGE',
partner_center_admin: 'PARTNER_CENTER_ADMIN',
partner_center_analyst: 'PARTNER_CENTER_ANALYST',
partner_center_education: 'PARTNER_CENTER_EDUCATION',
partner_center_marketing: 'PARTNER_CENTER_MARKETING',
partner_center_operations: 'PARTNER_CENTER_OPERATIONS',
});
}
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'
);
}
get (fields: Array<string>, params: Object = {}): SystemUser {
// $FlowFixMe : Support Generic Types
return this.read(
fields,
params
);
}
}