Guest User

Untitled

a guest
Jan 6th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.20 KB | None | 0 0
  1. // ts2fable 0.5.2
  2. module rec Firebase
  3. open System
  4. open Fable.Core
  5. open Fable.Import.JS
  6.  
  7.  
  8. type [<AllowNullLiteral>] IExports =
  9. abstract EmailAuthProvider: EmailAuthProviderStatic
  10. abstract EmailAuthProvider_Instance: EmailAuthProvider_InstanceStatic
  11. abstract FacebookAuthProvider: FacebookAuthProviderStatic
  12. abstract FacebookAuthProvider_Instance: FacebookAuthProvider_InstanceStatic
  13. abstract GithubAuthProvider: GithubAuthProviderStatic
  14. abstract GithubAuthProvider_Instance: GithubAuthProvider_InstanceStatic
  15. abstract GoogleAuthProvider: GoogleAuthProviderStatic
  16. abstract GoogleAuthProvider_Instance: GoogleAuthProvider_InstanceStatic
  17. abstract OAuthProvider: OAuthProviderStatic
  18. abstract PhoneAuthProvider: PhoneAuthProviderStatic
  19. abstract PhoneAuthProvider_Instance: PhoneAuthProvider_InstanceStatic
  20. abstract RecaptchaVerifier: RecaptchaVerifierStatic
  21. abstract RecaptchaVerifier_Instance: RecaptchaVerifier_InstanceStatic
  22. abstract TwitterAuthProvider: TwitterAuthProviderStatic
  23. abstract TwitterAuthProvider_Instance: TwitterAuthProvider_InstanceStatic
  24. abstract FirebaseAuth: FirebaseAuthStatic
  25. /// <summary>Helper to make a Subscribe function (just like Promise helps make a
  26. /// Thenable).</summary>
  27. /// <param name="executor">Function which can make calls to a single Observer
  28. /// as a proxy.</param>
  29. /// <param name="onNoObservers">Callback when count of Observers goes to zero.</param>
  30. abstract createSubscribe: executor: Executor<'T> * ?onNoObservers: Executor<'T> -> Subscribe<'T>
  31. /// Turn synchronous function into one called asynchronously.
  32. abstract async: fn: Function * ?onError: ErrorFn -> Function
  33.  
  34. type FirebaseOptions = {
  35. apiKey: string
  36. authDomain: string
  37. databaseURL: string
  38. projectId: string
  39. storageBucket: string
  40. messagingSenderId : string
  41. }
  42.  
  43. type [<AllowNullLiteral>] FirebaseApp =
  44. /// The (read-only) name (identifier) for this App. '[DEFAULT]' is the default
  45. /// App.
  46. abstract name: string with get, set
  47. /// The (read-only) configuration options from the app initialization.
  48. abstract options: FirebaseOptions with get, set
  49. /// Make the given App unusable and free resources.
  50. abstract delete: unit -> Promise<unit>
  51.  
  52. type [<AllowNullLiteral>] FirebaseAppStatic =
  53. [<Emit "new $0($1...)">] abstract Create: unit -> FirebaseApp
  54.  
  55. type [<AllowNullLiteral>] FirebaseNamespace =
  56. /// <summary>Create (and intialize) a FirebaseApp.</summary>
  57. /// <param name="options">Options to configure the services used in the App.</param>
  58. /// <param name="name">The optional name of the app to initialize ('[DEFAULT]' if
  59. /// omitted)</param>
  60. abstract initializeApp: options: FirebaseOptions * ?name: string -> FirebaseApp
  61. abstract app: FirebaseApp with get, set
  62. /// A (read-only) array of all the initialized Apps.
  63. abstract apps: ResizeArray<FirebaseApp> with get, set
  64. abstract Promise: obj with get, set
  65. abstract SDK_VERSION: string with get, set
  66. //abstract auth: FirebaseAuth option with get, set
  67. abstract auth: ?app: FirebaseApp -> FirebaseAuth
  68. /// <summary>Helper to make a Subscribe function (just like Promise helps make a
  69. /// Thenable).</summary>
  70. /// <param name="executor">Function which can make calls to a single Observer
  71. /// as a proxy.</param>
  72. /// <param name="onNoObservers">Callback when count of Observers goes to zero.</param>
  73. abstract createSubscribe: executor: Executor<'T> * ?onNoObservers: Executor<'T> -> Subscribe<'T>
  74. /// Turn synchronous function into one called asynchronously.
  75. abstract async: fn: Function * ?onError: ErrorFn -> Function
  76.  
  77. type [<AllowNullLiteral>] User =
  78. inherit UserInfo
  79. abstract delete: unit -> Promise<obj option>
  80. abstract emailVerified: bool with get, set
  81. abstract getIdToken: ?forceRefresh: bool -> Promise<obj option>
  82. abstract getToken: ?forceRefresh: bool -> Promise<obj option>
  83. abstract isAnonymous: bool with get, set
  84. abstract linkAndRetrieveDataWithCredential: credential: AuthCredential -> Promise<obj option>
  85. abstract linkWithCredential: credential: AuthCredential -> Promise<obj option>
  86. abstract linkWithPhoneNumber: phoneNumber: string * applicationVerifier: ApplicationVerifier -> Promise<obj option>
  87. abstract linkWithPopup: provider: AuthProvider -> Promise<obj option>
  88. abstract linkWithRedirect: provider: AuthProvider -> Promise<obj option>
  89. abstract metadata: UserMetadata with get, set
  90. abstract phoneNumber: string option with get, set
  91. abstract providerData: ResizeArray<UserInfo option> with get, set
  92. abstract reauthenticateAndRetrieveDataWithCredential: credential: AuthCredential -> Promise<obj option>
  93. abstract reauthenticateWithCredential: credential: AuthCredential -> Promise<obj option>
  94. abstract reauthenticateWithPhoneNumber: phoneNumber: string * applicationVerifier: ApplicationVerifier -> Promise<obj option>
  95. abstract reauthenticateWithPopup: provider: AuthProvider -> Promise<obj option>
  96. abstract reauthenticateWithRedirect: provider: AuthProvider -> Promise<obj option>
  97. abstract refreshToken: string with get, set
  98. abstract reload: unit -> Promise<obj option>
  99. abstract sendEmailVerification: ?actionCodeSettings: ActionCodeSettings option -> Promise<obj option>
  100. abstract toJSON: unit -> Object
  101. abstract unlink: providerId: string -> Promise<obj option>
  102. abstract updateEmail: newEmail: string -> Promise<obj option>
  103. abstract updatePassword: newPassword: string -> Promise<obj option>
  104. abstract updatePhoneNumber: phoneCredential: AuthCredential -> Promise<obj option>
  105. abstract updateProfile: profile: UserUpdateProfileProfile -> Promise<obj option>
  106.  
  107. type [<AllowNullLiteral>] UserUpdateProfileProfile =
  108. abstract displayName: string option with get, set
  109. abstract photoURL: string option with get, set
  110.  
  111. type [<AllowNullLiteral>] UserInfo =
  112. abstract displayName: string option with get, set
  113. abstract email: string option with get, set
  114. abstract phoneNumber: string option with get, set
  115. abstract photoURL: string option with get, set
  116. abstract providerId: string with get, set
  117. abstract uid: string with get, set
  118.  
  119. type [<AllowNullLiteral>] ActionCodeInfo = interface end
  120.  
  121. type ActionCodeSettings = obj
  122.  
  123. type AdditionalUserInfo = obj
  124.  
  125. type [<AllowNullLiteral>] ApplicationVerifier =
  126. abstract ``type``: string with get, set
  127. abstract verify: unit -> Promise<obj option>
  128.  
  129. type [<AllowNullLiteral>] AuthCredential =
  130. abstract providerId: string with get, set
  131.  
  132. type [<AllowNullLiteral>] AuthProvider =
  133. abstract providerId: string with get, set
  134.  
  135. type [<AllowNullLiteral>] ConfirmationResult =
  136. abstract confirm: verificationCode: string -> Promise<obj option>
  137. abstract verificationId: string with get, set
  138.  
  139. type [<AllowNullLiteral>] EmailAuthProvider =
  140. inherit EmailAuthProvider_Instance
  141. abstract PROVIDER_ID: string with get, set
  142.  
  143. type [<AllowNullLiteral>] EmailAuthProviderStatic =
  144. [<Emit "new $0($1...)">] abstract Create: unit -> EmailAuthProvider
  145. abstract credential: email: string * password: string -> AuthCredential
  146.  
  147. type [<AllowNullLiteral>] EmailAuthProvider_Instance =
  148. inherit AuthProvider
  149. abstract providerId: string with get, set
  150.  
  151. type [<AllowNullLiteral>] EmailAuthProvider_InstanceStatic =
  152. [<Emit "new $0($1...)">] abstract Create: unit -> EmailAuthProvider_Instance
  153.  
  154. type [<AllowNullLiteral>] Error =
  155. abstract code: string with get, set
  156. abstract message: string with get, set
  157.  
  158. type [<AllowNullLiteral>] FacebookAuthProvider =
  159. inherit FacebookAuthProvider_Instance
  160. abstract PROVIDER_ID: string with get, set
  161.  
  162. type [<AllowNullLiteral>] FacebookAuthProviderStatic =
  163. [<Emit "new $0($1...)">] abstract Create: unit -> FacebookAuthProvider
  164. abstract credential: token: string -> AuthCredential
  165.  
  166. type [<AllowNullLiteral>] FacebookAuthProvider_Instance =
  167. inherit AuthProvider
  168. abstract addScope: scope: string -> AuthProvider
  169. abstract providerId: string with get, set
  170. abstract setCustomParameters: customOAuthParameters: Object -> AuthProvider
  171.  
  172. type [<AllowNullLiteral>] FacebookAuthProvider_InstanceStatic =
  173. [<Emit "new $0($1...)">] abstract Create: unit -> FacebookAuthProvider_Instance
  174.  
  175. type [<AllowNullLiteral>] GithubAuthProvider =
  176. inherit GithubAuthProvider_Instance
  177. abstract PROVIDER_ID: string with get, set
  178.  
  179. type [<AllowNullLiteral>] GithubAuthProviderStatic =
  180. [<Emit "new $0($1...)">] abstract Create: unit -> GithubAuthProvider
  181. abstract credential: token: string -> AuthCredential
  182.  
  183. type [<AllowNullLiteral>] GithubAuthProvider_Instance =
  184. inherit AuthProvider
  185. abstract addScope: scope: string -> AuthProvider
  186. abstract providerId: string with get, set
  187. abstract setCustomParameters: customOAuthParameters: Object -> AuthProvider
  188.  
  189. type [<AllowNullLiteral>] GithubAuthProvider_InstanceStatic =
  190. [<Emit "new $0($1...)">] abstract Create: unit -> GithubAuthProvider_Instance
  191.  
  192. type [<AllowNullLiteral>] GoogleAuthProvider =
  193. inherit GoogleAuthProvider_Instance
  194. abstract PROVIDER_ID: string with get, set
  195.  
  196. type [<AllowNullLiteral>] GoogleAuthProviderStatic =
  197. [<Emit "new $0($1...)">] abstract Create: unit -> GoogleAuthProvider
  198. abstract credential: ?idToken: string option * ?accessToken: string option -> AuthCredential
  199.  
  200. type [<AllowNullLiteral>] GoogleAuthProvider_Instance =
  201. inherit AuthProvider
  202. abstract addScope: scope: string -> AuthProvider
  203. abstract providerId: string with get, set
  204. abstract setCustomParameters: customOAuthParameters: Object -> AuthProvider
  205.  
  206. type [<AllowNullLiteral>] GoogleAuthProvider_InstanceStatic =
  207. [<Emit "new $0($1...)">] abstract Create: unit -> GoogleAuthProvider_Instance
  208.  
  209. type [<AllowNullLiteral>] OAuthProvider =
  210. inherit AuthProvider
  211. abstract providerId: string with get, set
  212. abstract addScope: scope: string -> AuthProvider
  213. abstract credential: ?idToken: string * ?accessToken: string -> OAuthCredential
  214. abstract setCustomParameters: customOAuthParameters: Object -> AuthProvider
  215.  
  216. type [<AllowNullLiteral>] OAuthProviderStatic =
  217. [<Emit "new $0($1...)">] abstract Create: unit -> OAuthProvider
  218.  
  219. type [<AllowNullLiteral>] PhoneAuthProvider =
  220. inherit PhoneAuthProvider_Instance
  221. abstract PROVIDER_ID: string with get, set
  222.  
  223. type [<AllowNullLiteral>] PhoneAuthProviderStatic =
  224. [<Emit "new $0($1...)">] abstract Create: unit -> PhoneAuthProvider
  225. abstract credential: verificationId: string * verificationCode: string -> AuthCredential
  226.  
  227. type [<AllowNullLiteral>] PhoneAuthProvider_Instance =
  228. inherit AuthProvider
  229. abstract providerId: string with get, set
  230. abstract verifyPhoneNumber: phoneNumber: string * applicationVerifier: ApplicationVerifier -> Promise<obj option>
  231.  
  232. type [<AllowNullLiteral>] PhoneAuthProvider_InstanceStatic =
  233. [<Emit "new $0($1...)">] abstract Create: ?auth: FirebaseAuth option -> PhoneAuthProvider_Instance
  234.  
  235. type [<AllowNullLiteral>] RecaptchaVerifier =
  236. inherit RecaptchaVerifier_Instance
  237.  
  238. type [<AllowNullLiteral>] RecaptchaVerifierStatic =
  239. [<Emit "new $0($1...)">] abstract Create: unit -> RecaptchaVerifier
  240.  
  241. type [<AllowNullLiteral>] RecaptchaVerifier_Instance =
  242. inherit ApplicationVerifier
  243. abstract clear: unit -> obj option
  244. abstract render: unit -> Promise<obj option>
  245. abstract ``type``: string with get, set
  246. abstract verify: unit -> Promise<obj option>
  247.  
  248. type [<AllowNullLiteral>] RecaptchaVerifier_InstanceStatic =
  249. [<Emit "new $0($1...)">] abstract Create: container: U2<obj option, string> * ?parameters: Object option * ?app: FirebaseApp option -> RecaptchaVerifier_Instance
  250.  
  251. type [<AllowNullLiteral>] TwitterAuthProvider =
  252. inherit TwitterAuthProvider_Instance
  253. abstract PROVIDER_ID: string with get, set
  254.  
  255. type [<AllowNullLiteral>] TwitterAuthProviderStatic =
  256. [<Emit "new $0($1...)">] abstract Create: unit -> TwitterAuthProvider
  257. abstract credential: token: string * secret: string -> AuthCredential
  258.  
  259. type [<AllowNullLiteral>] TwitterAuthProvider_Instance =
  260. inherit AuthProvider
  261. abstract providerId: string with get, set
  262. abstract setCustomParameters: customOAuthParameters: Object -> AuthProvider
  263.  
  264. type [<AllowNullLiteral>] TwitterAuthProvider_InstanceStatic =
  265. [<Emit "new $0($1...)">] abstract Create: unit -> TwitterAuthProvider_Instance
  266.  
  267. type UserCredential =
  268. obj
  269.  
  270. type [<AllowNullLiteral>] UserMetadata =
  271. abstract creationTime: string option with get, set
  272. abstract lastSignInTime: string option with get, set
  273.  
  274. type Persistence =
  275. string
  276.  
  277. type [<AllowNullLiteral>] OAuthCredential =
  278. inherit AuthCredential
  279. abstract idToken: string option with get, set
  280. abstract accessToken: string option with get, set
  281. abstract secret: string option with get, set
  282.  
  283. type [<AllowNullLiteral>] FirebaseAuth =
  284. abstract Persistence: obj with get, set
  285. abstract app: FirebaseApp with get, set
  286. abstract applyActionCode: code: string -> Promise<obj option>
  287. abstract checkActionCode: code: string -> Promise<obj option>
  288. abstract confirmPasswordReset: code: string * newPassword: string -> Promise<obj option>
  289. abstract createUserWithEmailAndPassword: email: string * password: string -> Promise<User option>
  290. abstract createUserAndRetrieveDataWithEmailAndPassword: email: string * password: string -> Promise<obj option>
  291. abstract currentUser: User option with get, set
  292. abstract fetchProvidersForEmail: email: string -> Promise<obj option>
  293. abstract getRedirectResult: unit -> Promise<obj option>
  294. abstract languageCode: string option with get, set
  295. abstract onAuthStateChanged: nextOrObserver: U2<Observer<obj option, obj option>, (User option -> obj option)> * ?error: (Error -> obj option) * ?completed: Unsubscribe -> Unsubscribe
  296. abstract onIdTokenChanged: nextOrObserver: U2<Observer<obj option, obj option>, (User option -> obj option)> * ?error: (Error -> obj option) * ?completed: Unsubscribe -> Unsubscribe
  297. abstract sendPasswordResetEmail: email: string * ?actionCodeSettings: ActionCodeSettings option -> Promise<obj option>
  298. abstract setPersistence: persistence: Persistence -> Promise<obj option>
  299. abstract signInAndRetrieveDataWithCredential: credential: AuthCredential -> Promise<obj option>
  300. abstract signInAnonymously: unit -> Promise<obj option>
  301. abstract signInAnonymouslyAndRetrieveData: unit -> Promise<obj option>
  302. abstract signInWithCredential: credential: AuthCredential -> Promise<obj option>
  303. abstract signInWithCustomToken: token: string -> Promise<obj option>
  304. abstract signInAndRetrieveDataWithCustomToken: token: string -> Promise<obj option>
  305. abstract signInWithEmailAndPassword: email: string * password: string -> Promise<obj option>
  306. abstract signInAndRetrieveDataWithEmailAndPassword: email: string * password: string -> Promise<obj option>
  307. abstract signInWithPhoneNumber: phoneNumber: string * applicationVerifier: ApplicationVerifier -> Promise<obj option>
  308. abstract signInWithPopup: provider: AuthProvider -> Promise<obj option>
  309. abstract signInWithRedirect: provider: AuthProvider -> Promise<obj option>
  310. abstract signOut: unit -> Promise<obj option>
  311. abstract useDeviceLanguage: unit -> obj option
  312. abstract verifyPasswordResetCode: code: string -> Promise<obj option>
  313.  
  314. type [<AllowNullLiteral>] FirebaseAuthStatic =
  315. [<Emit "new $0($1...)">] abstract Create: unit -> FirebaseAuth
  316.  
  317. // Firebase Util
  318.  
  319. type NextFn<'T> =
  320. ('T -> unit)
  321.  
  322. type ErrorFn =
  323. (Error -> unit)
  324.  
  325. type CompleteFn =
  326. (unit -> unit)
  327.  
  328. type [<AllowNullLiteral>] Observer<'V, 'E> =
  329. abstract next: value: 'V option -> obj option
  330. abstract error: error: 'E -> obj option
  331. abstract complete: unit -> obj option
  332.  
  333. type [<AllowNullLiteral>] PartialObserver<'T> =
  334. abstract next: NextFn<'T> option with get, set
  335. abstract error: ErrorFn option with get, set
  336. abstract complete: CompleteFn option with get, set
  337.  
  338. type Unsubscribe =
  339. (unit -> unit)
  340.  
  341. /// The Subscribe interface has two forms - passing the inline function
  342. /// callbacks, or a object interface with callback properties.
  343. type [<AllowNullLiteral>] Subscribe<'T> =
  344. [<Emit "$0($1...)">] abstract Invoke: ?next: NextFn<'T> * ?error: ErrorFn * ?complete: CompleteFn -> Unsubscribe
  345. [<Emit "$0($1...)">] abstract Invoke: observer: PartialObserver<'T> -> Unsubscribe
  346.  
  347. type [<AllowNullLiteral>] Observable<'T> =
  348. abstract subscribe: Subscribe<'T> with get, set
  349.  
  350. type Executor<'T> =
  351. (Observer<'T, Error> -> unit)
Add Comment
Please, Sign In to add comment