Skip to content

Commit c559fd2

Browse files
committed
fix ts errors
1 parent 42b661a commit c559fd2

File tree

76 files changed

+406
-403
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+406
-403
lines changed

types/facebook-nodejs-business-sdk/facebook-nodejs-business-sdk-tests.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import {
77
ServerEvent,
88
UserData,
99
IGUser,
10-
InstagramInsightsResult
10+
InstagramInsightsResult,
11+
AppData,
12+
ExtendedDeviceInfo
1113
} from 'facebook-nodejs-business-sdk';
1214
import { FacebookRequestError } from 'facebook-nodejs-business-sdk/src/exceptions';
1315
import TEventRequest from "facebook-nodejs-business-sdk/src/objects/serverside/event-request";
@@ -18,7 +20,7 @@ async function testGetAdsFetchFirstPageFalse(): Promise<Array<Record<string, str
1820
const fbAdsApi = new FacebookAdsApi('TOKEN');
1921
fbAdsApi.setDebug(true);
2022

21-
const fbAdAccount = new AdAccount(`act_ID`, undefined, undefined, fbAdsApi);
23+
const fbAdAccount = new AdAccount(`act_ID`, {}, undefined, fbAdsApi);
2224
const cursor = await fbAdAccount.getAds(['id', 'name'], { limit: 10 }, false);
2325

2426
while (cursor.hasNext()) {
@@ -41,7 +43,7 @@ async function testGetAdsFetchFirstPageDefault(): Promise<Array<Record<string, s
4143
const fbAdsApi = new FacebookAdsApi('TOKEN');
4244
fbAdsApi.setDebug(true);
4345

44-
const fbAdAccount = new AdAccount(`act_ID`, undefined, undefined, fbAdsApi);
46+
const fbAdAccount = new AdAccount(`act_ID`, {}, undefined, fbAdsApi);
4547
const cursor = await fbAdAccount.getAds(['id', 'name'], { limit: 10 });
4648

4749
while (true) {
@@ -68,7 +70,7 @@ async function testGetAdsFetchFirstPageBoolean(): Promise<Array<Record<string, s
6870
const fbAdsApi = new FacebookAdsApi('TOKEN');
6971
fbAdsApi.setDebug(true);
7072

71-
const fbAdAccount = new AdAccount(`act_ID`, undefined, undefined, fbAdsApi);
73+
const fbAdAccount = new AdAccount(`act_ID`, {}, undefined, fbAdsApi);
7274
const fetchFirstPage = Math.random() > 0.5;
7375
const cursorOrPromise = fbAdAccount.getAds(['id', 'name'], { limit: 10 }, fetchFirstPage);
7476
const cursor = cursorOrPromise instanceof Promise ? await cursorOrPromise : cursorOrPromise;
@@ -97,21 +99,22 @@ async function testGetAdsFetchFirstPageBoolean(): Promise<Array<Record<string, s
9799

98100
async function checkType() {
99101
const fbAdsApi: FacebookAdsApi = new FacebookAdsApi('TOKEN');
100-
const fbAdAccount: AdAccount = new AdAccount(`act_ID`, undefined, undefined, fbAdsApi);
102+
const fbAdAccount: AdAccount = new AdAccount(`act_ID`, {}, undefined, fbAdsApi);
101103
}
102104

103105
async function testConversionEvent(): Promise<TEventRequest> {
104-
const userData = (new UserData())
106+
const userData = (new UserData('[email protected]','','','','','','','','','','','','','','','','','','','','','','','','',''))
105107
.setEmails(['[email protected]'])
106108
.setPhones(['12345678901', '14251234567']);
107109

108-
const content = (new Content())
109-
.setId('product123');
110+
const content = new Content('product123',5,2,'','','','','');
110111

111-
const customData = (new CustomData())
112+
const customData = (new CustomData(2,'','','',[],[],'','',0,0,'','','','',{}))
112113
.setContents([content]);
114+
const extendedDeviceInfo = new ExtendedDeviceInfo('','','','','','','','','',0,0,'',0,0,0,'');
115+
const appData = new AppData(false, false, '',false, extendedDeviceInfo, false, false, '', '', '', '', '');
113116

114-
const serverEvent = (new ServerEvent())
117+
const serverEvent = (new ServerEvent('',0,'',userData,customData,appData,'',false,'',[],0,0,'',false,''))
115118
.setEventName('Purchase')
116119
.setEventTime(123)
117120
.setUserData(userData)

types/facebook-nodejs-business-sdk/src/api-batch.d.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ declare class FacebookAdsApiBatch {
3636
* @return {Object} An object describing the call
3737
*/
3838
add(method: string, relativePath: string[] | string, params?: Record<string, any>, files?: Record<string, any>, successCallback?: (...args: any[]) => any, failureCallback?: (...args: any[]) => any, request?: APIRequest): {
39-
attachedFiles: void | string;
40-
body: void | string;
39+
attachedFiles: undefined | string;
40+
body: undefined | string;
4141
method: string;
42-
name: void | any;
42+
name: any;
4343
relative_url: string;
4444
};
4545
/**
@@ -52,10 +52,10 @@ declare class FacebookAdsApiBatch {
5252
* @return {Object} An object describing the call
5353
*/
5454
addRequest(request: APIRequest, successCallback?: (...args: any[]) => any, failureCallback?: (...args: any[]) => any): {
55-
attachedFiles: void | string;
56-
body: void | string;
55+
attachedFiles: undefined | string;
56+
body: undefined | string;
5757
method: string;
58-
name: void | any;
58+
name: any;
5959
relative_url: string;
6060
};
6161
/**
@@ -69,6 +69,6 @@ declare class FacebookAdsApiBatch {
6969
* returns a new FacebookAdsApiBatch object with those calls.
7070
* Otherwise, returns None.
7171
*/
72-
execute(): void | Promise<unknown>;
72+
execute(): undefined | Promise<unknown>;
7373
}
7474
export default FacebookAdsApiBatch;

types/facebook-nodejs-business-sdk/src/api.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ export default class FacebookAdsApi {
3636
* @param {Object} [files]
3737
* @return {Promise}
3838
*/
39-
call(method: string, path: string | string[] | String, params?: Record<string, any>, files?: Record<string, any>, useMultipartFormData?: boolean, urlOverride?: string): Promise<any>;
39+
call(method: string, path: string | string[] | string, params?: Record<string, any>, files?: Record<string, any>, useMultipartFormData?: boolean, urlOverride?: string): Promise<any>;
4040
static _encodeParams(params: Record<string, any>): string;
4141
}

types/facebook-nodejs-business-sdk/src/objects/ad-async-request-set.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default class AdAsyncRequestSet extends AbstractCrudObject {
2929
on_complete: "ON_COMPLETE";
3030
}>;
3131
getRequests(fields: string[], params?: Record<string, any>, fetchFirstPage?: boolean): Cursor | Promise<Cursor>;
32-
delete(fields: string[], params?: Record<string, any>): AbstractObject;
32+
get(fields: string[], params?: Record<string, any>): Promise<AbstractObject>;
3333
get(fields: string[], params?: Record<string, any>): Promise<AdAsyncRequestSet>;
3434
update(fields: string[], params?: Record<string, any>): Promise<AdAsyncRequestSet>;
3535
}

types/facebook-nodejs-business-sdk/src/objects/ad-async-request.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ export default class AdAsyncRequest extends AbstractCrudObject {
3131
user_canceled: "USER_CANCELED";
3232
user_canceled_dependency: "USER_CANCELED_DEPENDENCY";
3333
}>;
34-
delete(fields: string[], params?: Record<string, any>): AbstractObject;
34+
get(fields: string[], params?: Record<string, any>): Promise<AbstractObject>;
3535
get(fields: string[], params?: Record<string, any>): Promise<AdAsyncRequest>;
3636
}

types/facebook-nodejs-business-sdk/src/objects/ad-creative.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,10 @@ export default class AdCreative extends AbstractCrudObject {
212212
all: "ALL";
213213
any: "ANY";
214214
}>;
215-
createAdLabel(fields: string[], params?: Record<string, any>, pathOverride?: string | null | undefined): Promise<AdCreative>;
215+
createAdLabel(fields: string[], params?: Record<string, any>, pathOverride?: string | null): Promise<AdCreative>;
216216
getCreativeInsights(fields: string[], params?: Record<string, any>, fetchFirstPage?: boolean): Cursor | Promise<Cursor>;
217217
getPreviews(fields: string[], params?: Record<string, any>, fetchFirstPage?: boolean): Cursor | Promise<Cursor>;
218-
delete(fields: string[], params?: Record<string, any>): AbstractObject;
218+
get(fields: string[], params?: Record<string, any>): Promise<AbstractObject>;
219219
get(fields: string[], params?: Record<string, any>): Promise<AdCreative>;
220220
update(fields: string[], params?: Record<string, any>): Promise<AdCreative>;
221221
}

types/facebook-nodejs-business-sdk/src/objects/ad-label.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default class AdLabel extends AbstractCrudObject {
1717
getAds(fields: string[], params?: Record<string, any>, fetchFirstPage?: boolean): Cursor | Promise<Cursor>;
1818
getAdSets(fields: string[], params?: Record<string, any>, fetchFirstPage?: boolean): Cursor | Promise<Cursor>;
1919
getCampaigns(fields: string[], params?: Record<string, any>, fetchFirstPage?: boolean): Cursor | Promise<Cursor>;
20-
delete(fields: string[], params?: Record<string, any>): AbstractObject;
20+
get(fields: string[], params?: Record<string, any>): Promise<AbstractObject>;
2121
get(fields: string[], params?: Record<string, any>): Promise<AdLabel>;
2222
update(fields: string[], params?: Record<string, any>): Promise<AdLabel>;
2323
}

types/facebook-nodejs-business-sdk/src/objects/ad-monetization-property.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default class AdMonetizationProperty extends AbstractCrudObject {
1010
id: "id";
1111
}>;
1212
getAdNetworkAnalytics(fields: string[], params?: Record<string, any>, fetchFirstPage?: boolean): Cursor | Promise<Cursor>;
13-
createAdNetworkAnalytic(fields: string[], params?: Record<string, any>, pathOverride?: string | null | undefined): Promise<AdMonetizationProperty>;
13+
createAdNetworkAnalytic(fields: string[], params?: Record<string, any>, pathOverride?: string | null): Promise<AdMonetizationProperty>;
1414
getAdNetworkAnalyticsResults(fields: string[], params?: Record<string, any>, fetchFirstPage?: boolean): Cursor | Promise<Cursor>;
1515
get(fields: string[], params?: Record<string, any>): Promise<AdMonetizationProperty>;
1616
}

types/facebook-nodejs-business-sdk/src/objects/ad-rule.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ export default class AdRule extends AbstractCrudObject {
5555
rule_syd_redirect: "RULE_SYD_REDIRECT";
5656
rule_templates_dialog: "RULE_TEMPLATES_DIALOG";
5757
}>;
58-
createExecute(fields: string[], params?: Record<string, any>, pathOverride?: string | null | undefined): Promise<AbstractObject>;
58+
createExecute(fields: string[], params?: Record<string, any>, pathOverride?: string | null): Promise<AbstractObject>;
5959
getHistory(fields: string[], params?: Record<string, any>, fetchFirstPage?: boolean): Cursor | Promise<Cursor>;
60-
createPreview(fields: string[], params?: Record<string, any>, pathOverride?: string | null | undefined): Promise<AdRule>;
61-
delete(fields: string[], params?: Record<string, any>): AbstractObject;
60+
createPreview(fields: string[], params?: Record<string, any>, pathOverride?: string | null): Promise<AdRule>;
61+
get(fields: string[], params?: Record<string, any>): Promise<AbstractObject>;
6262
get(fields: string[], params?: Record<string, any>): Promise<AdRule>;
6363
update(fields: string[], params?: Record<string, any>): Promise<AdRule>;
6464
}

types/facebook-nodejs-business-sdk/src/objects/ad-set.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -236,18 +236,18 @@ export default class AdSet extends AbstractCrudObject {
236236
getAdStudies(fields: string[], params?: Record<string, any>, fetchFirstPage?: boolean): Cursor | Promise<Cursor>;
237237
getAdCreatives(fields: string[], params?: Record<string, any>, fetchFirstPage?: boolean): Cursor | Promise<Cursor>;
238238
deleteAdLabels(params?: Record<string, any>): Promise<any>;
239-
createAdLabel(fields: string[], params?: Record<string, any>, pathOverride?: string | null | undefined): Promise<AdSet>;
239+
createAdLabel(fields: string[], params?: Record<string, any>, pathOverride?: string | null): Promise<AdSet>;
240240
getAdRulesGoverned(fields: string[], params?: Record<string, any>, fetchFirstPage?: boolean): Cursor | Promise<Cursor>;
241241
getAds(fields: string[], params?: Record<string, any>, fetchFirstPage?: boolean): Cursor | Promise<Cursor>;
242242
getAsyncAdRequests(fields: string[], params?: Record<string, any>, fetchFirstPage?: boolean): Cursor | Promise<Cursor>;
243-
createBudgetSchedule(fields: string[], params?: Record<string, any>, pathOverride?: string | null | undefined): Promise<HighDemandPeriod>;
243+
createBudgetSchedule(fields: string[], params?: Record<string, any>, pathOverride?: string | null): Promise<HighDemandPeriod>;
244244
getCopies(fields: string[], params?: Record<string, any>, fetchFirstPage?: boolean): Cursor | Promise<Cursor>;
245-
createCopy(fields: string[], params?: Record<string, any>, pathOverride?: string | null | undefined): Promise<AdSet>;
245+
createCopy(fields: string[], params?: Record<string, any>, pathOverride?: string | null): Promise<AdSet>;
246246
getDeliveryEstimate(fields: string[], params?: Record<string, any>, fetchFirstPage?: boolean): Cursor | Promise<Cursor>;
247247
getInsights(fields: string[], params?: Record<string, any>, fetchFirstPage?: boolean): Cursor | Promise<Cursor>;
248-
getInsightsAsync(fields: string[], params?: Record<string, any>, pathOverride?: string | null | undefined): Promise<AdReportRun>;
248+
getInsightsAsync(fields: string[], params?: Record<string, any>, pathOverride?: string | null): Promise<AdReportRun>;
249249
getTargetingSentenceLines(fields: string[], params?: Record<string, any>, fetchFirstPage?: boolean): Cursor | Promise<Cursor>;
250-
delete(fields: string[], params?: Record<string, any>): AbstractObject;
250+
get(fields: string[], params?: Record<string, any>): Promise<AbstractObject>;
251251
get(fields: string[], params?: Record<string, any>): Promise<AdSet>;
252252
update(fields: string[], params?: Record<string, any>): Promise<AdSet>;
253253
}

0 commit comments

Comments
 (0)