Created
November 27, 2016 16:50
-
-
Save hktonylee/21e9e3024250f9312ea058da7f03b522 to your computer and use it in GitHub Desktop.
Typescript Typing Definition for react-native-fbsdk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module "react-native-fbsdk" { | |
export interface LoginResult { | |
isCancelled: boolean, | |
grantedPermissions?: Array<string>, | |
declinedPermissions?: Array<string>, | |
} | |
export type DefaultAudience = 'friends' | 'everyone' | 'only_me'; | |
export type LoginBehaviorIOS = 'native' | 'browser' | 'system_account' | 'web'; | |
export type LoginBehaviorAndroid = 'native_with_fallback' | 'native_only' | 'web_only' | |
//////////////////////////////////////////////////////////////////////////////////////////////// | |
export type LoginBehavior = LoginBehaviorIOS | LoginBehaviorAndroid; | |
export class LoginManager { | |
static logInWithReadPermissions(permissions: Array<string>): Promise<LoginResult>; | |
static logInWithPublishPermissions(permissions: Array<string>): Promise<LoginResult>; | |
static getLoginBehavior(): Promise<LoginBehavior>; | |
static setLoginBehavior(loginBehavior: LoginBehavior): void; | |
static getDefaultAudience(): Promise<DefaultAudience>; | |
static setDefaultAudience(defaultAudience: DefaultAudience): void; | |
static logOut(): void; | |
} | |
//////////////////////////////////////////////////////////////////////////////////////////////// | |
export interface LoginButtonProperties extends React.Props<LoginButtonStatic> { | |
onLoginFinished?: (error: {message: string, domain?: string, code?: string, userInfo?: any}, result: LoginResult) => void; | |
onLogoutFinished?: () => void; | |
loginBehaviorIOS?: LoginBehaviorIOS; | |
} | |
export interface LoginButtonStatic extends React.ComponentClass<LoginButtonProperties> { | |
} | |
export var LoginButton: LoginButtonStatic; | |
export type LoginButton = LoginButtonStatic; | |
//////////////////////////////////////////////////////////////////////////////////////////////// | |
interface AccessTokenMap { | |
accessToken: string, | |
applicationID: string, | |
userID: string, | |
permissions: Array<string>, | |
declinedPermissions: Array<string>, | |
accessTokenSource?: string, | |
expirationTime: number, | |
lastRefreshTime: number, | |
} | |
export class AccessToken { | |
accessToken: string; | |
applicationID: string; | |
userID: string; | |
permissions: Array<string>; | |
declinedPermissions: Array<string>; | |
accessTokenSource?: string; | |
expirationTime: number; | |
lastRefreshTime: number; | |
static getCurrentAccessToken(): Promise<AccessToken | null>; | |
static setCurrentAccessToken(accessToken: AccessTokenMap): void; | |
static refreshCurrentAccessTokenAsync(): Promise<any>; | |
getExpires(): number; | |
getPermissions(): Array<string>; | |
getDeclinedPermissions(): Array<string>; | |
getLastRefresh(): number; | |
getApplicationId(): string; | |
getUserId(): string; | |
} | |
//////////////////////////////////////////////////////////////////////////////////////////////// | |
export type GraphRequestCallback = (error?: Object, result?: Object) => void; | |
export type GraphRequestParameters = {[key: string]: Object}; | |
export interface GraphRequestConfig { | |
httpMethod?: string, | |
version?: string, | |
parameters?: GraphRequestParameters, | |
accessToken?: string | |
} | |
export class GraphRequest { | |
graphPath: string; | |
config?: GraphRequestConfig; | |
callback?: GraphRequestCallback; | |
constructor(graphPath: string, config?: GraphRequestConfig, callback?: GraphRequestCallback); | |
addStringParameter(paramString: string, key: string): void; | |
} | |
export class GraphRequestManager { | |
requestBatch: Array<GraphRequest>; | |
requestCallbacks: Array<GraphRequestCallback | null>; | |
batchCallback: GraphRequestCallback; | |
constructor(); | |
addRequest(request: GraphRequest): GraphRequestManager; | |
addBatchCallback(callback: (error?: Object, result?: Object) => void): GraphRequestManager; | |
start(timeout?: number): void; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
missing import inside
declare module
block:import React, {ComponentClass, Props} from 'react';