2023-01-27 03:22:44 -08:00
|
|
|
import type { OptionsWithUri } from 'request';
|
2020-11-04 03:25:18 -08:00
|
|
|
|
2023-01-27 03:22:44 -08:00
|
|
|
import type {
|
2023-03-09 09:13:15 -08:00
|
|
|
IDataObject,
|
2020-11-04 03:25:18 -08:00
|
|
|
IExecuteFunctions,
|
|
|
|
IExecuteSingleFunctions,
|
|
|
|
IHookFunctions,
|
|
|
|
ILoadOptionsFunctions,
|
|
|
|
IWebhookFunctions,
|
2023-03-09 09:13:15 -08:00
|
|
|
JsonObject,
|
|
|
|
} from 'n8n-workflow';
|
2023-01-27 03:22:44 -08:00
|
|
|
import { NodeApiError } from 'n8n-workflow';
|
2021-07-29 06:32:01 -07:00
|
|
|
|
2022-08-01 13:47:55 -07:00
|
|
|
import { capitalCase } from 'change-case';
|
2020-11-04 03:25:18 -08:00
|
|
|
|
2022-08-01 13:47:55 -07:00
|
|
|
export async function facebookApiRequest(
|
|
|
|
this:
|
|
|
|
| IHookFunctions
|
|
|
|
| IExecuteFunctions
|
|
|
|
| IExecuteSingleFunctions
|
|
|
|
| ILoadOptionsFunctions
|
|
|
|
| IWebhookFunctions,
|
|
|
|
method: string,
|
|
|
|
resource: string,
|
2022-12-02 06:25:21 -08:00
|
|
|
|
2022-08-01 13:47:55 -07:00
|
|
|
body: any = {},
|
|
|
|
qs: IDataObject = {},
|
|
|
|
uri?: string,
|
2022-11-08 06:28:21 -08:00
|
|
|
_option: IDataObject = {},
|
2022-08-01 13:47:55 -07:00
|
|
|
): Promise<any> {
|
2020-11-04 03:25:18 -08:00
|
|
|
let credentials;
|
|
|
|
|
|
|
|
if (this.getNode().name.includes('Trigger')) {
|
2022-04-14 23:00:47 -07:00
|
|
|
credentials = await this.getCredentials('facebookGraphAppApi');
|
2020-11-04 03:25:18 -08:00
|
|
|
} else {
|
2022-04-14 23:00:47 -07:00
|
|
|
credentials = await this.getCredentials('facebookGraphApi');
|
2020-11-04 03:25:18 -08:00
|
|
|
}
|
|
|
|
|
2022-12-02 12:54:28 -08:00
|
|
|
qs.access_token = credentials.accessToken;
|
2020-11-04 03:25:18 -08:00
|
|
|
|
|
|
|
const options: OptionsWithUri = {
|
|
|
|
headers: {
|
|
|
|
accept: 'application/json,text/*;q=0.99',
|
|
|
|
},
|
|
|
|
method,
|
|
|
|
qs,
|
|
|
|
body,
|
|
|
|
gzip: true,
|
2023-01-19 04:37:19 -08:00
|
|
|
uri: uri || `https://graph.facebook.com/v8.0${resource}`,
|
2020-11-04 03:25:18 -08:00
|
|
|
json: true,
|
|
|
|
};
|
|
|
|
|
|
|
|
try {
|
2022-12-23 10:09:52 -08:00
|
|
|
return await this.helpers.request(options);
|
2020-11-04 03:25:18 -08:00
|
|
|
} catch (error) {
|
2023-02-27 19:39:43 -08:00
|
|
|
throw new NodeApiError(this.getNode(), error as JsonObject);
|
2020-11-04 03:25:18 -08:00
|
|
|
}
|
|
|
|
}
|
2021-07-29 06:32:01 -07:00
|
|
|
|
|
|
|
export function getFields(object: string) {
|
|
|
|
const data = {
|
2022-08-01 13:47:55 -07:00
|
|
|
adAccount: [
|
2021-07-29 06:32:01 -07:00
|
|
|
{
|
|
|
|
value: 'in_process_ad_objects',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'with_issues_ad_objects',
|
|
|
|
},
|
|
|
|
],
|
2022-08-01 13:47:55 -07:00
|
|
|
page: [
|
2021-07-29 06:32:01 -07:00
|
|
|
{
|
|
|
|
value: 'affiliation',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Affliation profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'attire',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Attire profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'awards',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Awards profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'bio',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Biography profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'birthday',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Birthday profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'category',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Birthday profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'company_overview',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Company Overview profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'culinary_team',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Culinary Team profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'current_location',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Current Location profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'description',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Story Description profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'email',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Email profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'feed',
|
2022-12-29 03:20:43 -08:00
|
|
|
description:
|
|
|
|
"Describes nearly all changes to a Page's feed, such as Posts, shares, likes, etc",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'founded',
|
2022-12-29 03:20:43 -08:00
|
|
|
description:
|
|
|
|
"Describes changes to a page's Founded profile field. This is different from the Start Date field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'general_info',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's General Information profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'general_manager',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's General Information profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'hometown',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Homewtown profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'hours',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Hours profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'leadgen',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's leadgen settings",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'live_videos',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's live video status",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'location',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Location profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'members',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Members profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'mention',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: 'Describes new mentions of a page, including mentions in comments, posts, etc',
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'merchant_review',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's merchant review settings",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'mission',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Mission profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'name',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Name profile field.",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'page_about_story',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'page_change_proposal',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: 'Data for page change proposal.',
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'page_upcoming_change',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: 'Webhooks data for page upcoming changes',
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'parking',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Parking profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'payment_options',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes change to a page's Payment profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'personal_info',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Personal Information profile field.",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'personal_interests',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Personal Interests profile field.",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'phone',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Phone profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'picture',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's profile picture",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'price_range',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Price Range profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'product_review',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's product review settings",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'products',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Products profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'public_transit',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Public Transit profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'ratings',
|
2022-12-29 03:20:43 -08:00
|
|
|
description:
|
|
|
|
"Describes changes to a page's ratings, including new ratings or a user's comments or reactions on a rating",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'videos',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: 'Describes changes to the encoding status of a video on a page',
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'website',
|
2022-12-29 03:20:43 -08:00
|
|
|
description: "Describes changes to a page's Website profile field",
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
],
|
2022-08-01 13:47:55 -07:00
|
|
|
application: [
|
2021-07-29 06:32:01 -07:00
|
|
|
{
|
|
|
|
value: 'ad_account',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'ads_rules_engine',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'async_requests',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'async_sessions',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'group_install',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'oe_reseller_onboarding_request_created',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'plugin_comment',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'plugin_comment_reply',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'plugin_comment_reply',
|
|
|
|
},
|
|
|
|
],
|
2022-08-01 13:47:55 -07:00
|
|
|
certificateTransparency: [
|
2021-07-29 06:32:01 -07:00
|
|
|
{
|
|
|
|
value: 'certificate',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'phishing',
|
|
|
|
},
|
|
|
|
],
|
2022-08-01 13:47:55 -07:00
|
|
|
instagram: [
|
2021-07-29 06:32:01 -07:00
|
|
|
{
|
|
|
|
value: 'comments',
|
|
|
|
description: 'Notifies you when an Instagram User comments on a media object that you own',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'messaging_handover',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'mentions',
|
2022-08-01 13:47:55 -07:00
|
|
|
description:
|
|
|
|
'Notifies you when an Instagram User @mentions you in a comment or caption on a media object that you do not own',
|
2021-07-29 06:32:01 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'messages',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'messaging_seen',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'standby',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'story_insights',
|
|
|
|
},
|
|
|
|
],
|
2022-08-01 13:47:55 -07:00
|
|
|
permissions: [
|
2021-07-29 06:32:01 -07:00
|
|
|
{
|
|
|
|
value: 'bookmarked',
|
|
|
|
description: 'Whether the user has added or removed the app bookmark',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'connected',
|
|
|
|
description: 'Whether the user is connected or disconnected from the app',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'user_birthday',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'user_hometown',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'user_location',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'user_likes',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'user_managed_groups',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'user_events',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'user_photos',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'user_videos',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'user_friends',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'user_posts',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'user_gender',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'user_link',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'user_age_range',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'email',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'read_insights',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'read_page_mailboxes',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'pages_show_list',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'pages_manage_cta',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'business_management',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'pages_messaging',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'pages_messaging_phone_number',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'pages_messaging_subscriptions',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'read_audience_network_insights',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'pages_manage_instant_articles',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'publish_video',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'openid',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'catalog_management',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'gaming_user_locale',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'groups_show_list',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'instagram_basic',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'instagram_manage_comments',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'instagram_manage_insights',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'instagram_content_publish',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'publish_to_groups',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'groups_access_member_info',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'leads_retrieval',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'whatsapp_business_management',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'instagram_manage_messages',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'attribution_read',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'page_events',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'ads_management',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'ads_read',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'pages_read_engagement',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'pages_manage_metadata',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'pages_read_user_content',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'pages_manage_ads',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'pages_manage_posts',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'pages_manage_engagement',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'public_search',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'social_ads',
|
|
|
|
},
|
|
|
|
],
|
2022-08-01 13:47:55 -07:00
|
|
|
users: [
|
2021-07-29 06:32:01 -07:00
|
|
|
{
|
|
|
|
value: 'about',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'birthday',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'books',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'email',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'feed',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'first_name',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'friends',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'gender',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'hometown',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'last_name',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'likes',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'live_videos',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'location',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'music',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'name',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'photos',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'pic_big_https',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'pic_https',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'pic_small_https',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'pic_square_https',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'platform',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'quotes',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'status',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'television',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'videos',
|
|
|
|
},
|
|
|
|
],
|
2022-08-01 13:47:55 -07:00
|
|
|
whatsappBusinessAccount: [
|
2021-07-29 06:32:01 -07:00
|
|
|
{
|
|
|
|
value: 'message_template_status_update',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'phone_number_name_update',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'phone_number_quality_update',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'account_review_update',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 'account_update',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
} as { [key: string]: any };
|
|
|
|
|
2023-02-27 19:39:43 -08:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
2022-12-02 12:54:28 -08:00
|
|
|
return [{ name: '*', value: '*' }].concat(data[object] || []).map((fieldObject: IDataObject) => ({
|
|
|
|
...fieldObject,
|
|
|
|
name: fieldObject.value !== '*' ? capitalCase(fieldObject.value as string) : fieldObject.value,
|
|
|
|
}));
|
2021-07-29 06:32:01 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export function getAllFields(object: string) {
|
2022-08-01 13:47:55 -07:00
|
|
|
return getFields(object)
|
|
|
|
.filter((field: IDataObject) => field.value !== '*')
|
|
|
|
.map((field: IDataObject) => field.value);
|
2022-04-14 23:00:47 -07:00
|
|
|
}
|