Skip to content

Commit 3d1933b

Browse files
shibulijackshibulijack
shibulijack
authored and
shibulijack
committed
More review comments
1 parent e4bd527 commit 3d1933b

File tree

1 file changed

+31
-16
lines changed

1 file changed

+31
-16
lines changed

src/fb.d.ts

+31-16
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,6 @@ interface FBOptions {
1010
Promise?: Promise<any>;
1111
}
1212

13-
interface FBAPIInterface {
14-
path: string;
15-
method?: string;
16-
params?: object;
17-
callback?: Function;
18-
}
19-
20-
interface FBKeyOrOptions {
21-
key: string;
22-
options: FBOptions;
23-
}
24-
2513
interface SignedRequestResponse {
2614
oauthToken: string;
2715
userId: string;
@@ -34,10 +22,27 @@ interface UsageInterface {
3422
totalCPUTime: number;
3523
}
3624

25+
interface FBError {
26+
name: string;
27+
message: string;
28+
response: number;
29+
}
30+
31+
interface FBResponseObject {
32+
data: any;
33+
error: any;
34+
}
35+
3736
export class Facebook {
3837
constructor(options?: FBOptions);
3938

40-
api(arguments: FBAPIInterface): Promise<any>;
39+
api(path: string): Promise<any>;
40+
41+
api(path: string, method: string): Promise<any>;
42+
43+
api(path: string, params: any): Promise<any>;
44+
45+
api(path: string, method: string, params: any): Promise<any>;
4146

4247
extend(options: FBOptions): Facebook;
4348

@@ -49,9 +54,19 @@ export class Facebook {
4954

5055
getLoginUrl(options: FBOptions): string;
5156

52-
napi(arguments: FBAPIInterface): void;
57+
napi(path: string): void;
58+
59+
napi(path: string, method: string): void;
60+
61+
napi(path: string, params: any): void;
62+
63+
napi(path: string, method: string, params: any): void;
64+
65+
options(): FBOptions;
66+
67+
options(key: string): string;
5368

54-
options(keyOrOptions: keyof FBKeyOrOptions): any;
69+
options(options: FBOptions): void;
5570

5671
parseSignedRequest(signedRequest: string, appSecret: string): SignedRequestResponse;
5772

@@ -62,6 +77,6 @@ export class Facebook {
6277

6378
export const version: string;
6479

65-
export function FacebookApiException(res: Response): Error;
80+
export function FacebookApiException(res: FBResponseObject): FBError;
6681

6782
export const FB: Facebook;

0 commit comments

Comments
 (0)