Closed kevinclarkadstech closed 1 year ago
Another bump for the party. How is this still not supported? :(
I'm shocked. No comment for Facebook. NoTypings for such a big project
Bump. Just stumbled with this when a client asked to be integrated with Facebook Business.
bump to keep it active
another bump
BUUUMP
BUUMMPPPP
Stop thumb downing bumps @Desnoo . Facebook deserves the thumbs down.
@kevinclarkadstech we also do need this. But if you wait for a response you only get notifications about the bump messages and this is really annoying. Every week is ok but not every day.
The PR is merged.
I guess I'm closing this so I don't have to see it anymore. Annoying how the community has to write definitions for a product that Facebook profits from.
Could someone please explain how to use the type definitions from DefinitelyTyped?
Example:
const leadgenForms: LeadgenForm[] = await (new Page(pageId)).getLeadGenForms([
LeadgenForm.Fields.questions,
])
Getting Type 'Cursor' is not assignable to type 'LeadgenForm[]'.
, which makes sense since getLeadGenForms returns Promise<Cursor>
. I also tried
const leadgenForms: Cursor<LeadgenForm[]> = await (new Page(pageId)).getLeadGenForms([
LeadgenForm.Fields.questions,
]);
Not sure how it's supposed to work... Any help is appreciated
@phillipmohr I use this method
public async *fetchInsightPages({
fields,
params,
}: {
fields: string[];
params: Record<string, string>;
}): AsyncGenerator<Insight[]> {
const cursor = await this.fbAdAccount.getInsights(fields, params);
while (true) {
yield cursor.map((item): Insight => {
return {
adId: item.ad_id,
adName: item.ad_name,
...
startDate: item.date_start,
endDate: item.date_stop,
};
});
if (cursor.hasNext()) {
await cursor.next();
} else {
break;
}
}
}
Maybe next method will work too
public async fetchInsights({
fields,
params,
}: {
fields: string[];
params: Record<string, string>;
}): Promise<Insight[]> {
const result: Insight[] = []
const cursor = await this.fbAdAccount.getInsights(fields, params);
while (true) {
for (const item of cursor) {
result.push({
adId: item.ad_id,
adName: item.ad_name,
adSetId: item.adset_id,
// ...
startDate: item.date_start,
endDate: item.date_stop,
});
}
if (cursor.hasNext()) {
await cursor.next();
} else {
break;
}
}
return result;
}
Which SDK version are you using?
"^5.0.1"
What's the issue?
Need TypeScript definitions.
Steps/Sample code to reproduce the issue
1) Create a .ts file 2) Type import fbSdk from 'facebook-nodejs-business-sdk';
Observed Results:
Expected Results:
What did you expect to happen?
To get TypeScript definitions, as this is 2019 and this is an enterprise SDK library. It makes it much easier to consume a library without runtime errors and without consulting documentation frequently.