Skip to content

Commit

Permalink
adding login and logout functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Thibaut committed Aug 4, 2021
1 parent 18bdf56 commit f1fc82e
Showing 1 changed file with 46 additions and 1 deletion.
47 changes: 46 additions & 1 deletion src/cordova_googleplus.mli
Original file line number Diff line number Diff line change
@@ -1 +1,46 @@
(*TODO*)
[@@@js.stop]

val available : unit -> bool

[@@@js.start]

[@@@js.implem
let available () =
Js_of_ocaml.Js.Optdef.test Js_of_ocaml.Js.Unsafe.global##.plugins##.googleplus]

module Login : sig
type parameters

type user

type error = Ojs.t

val parameters :

This comment has been minimized.

Copy link
@vouillon

vouillon Aug 27, 2021

Contributor

That should be:

    ?web_client_id:string ->
    ?offline:bool ->
    ?scopes:string ->
    unit ->
    parameters
  • profile and email are strings that can be passed using the scopes parameter
  • id_token and server_auth_code are fields of the user object.

This comment has been minimized.

Copy link
@Thibaut-Gudin

Thibaut-Gudin Aug 27, 2021

Contributor

#2

?web_client_id:string ->
?offline:bool ->
?id_token:string ->
?server_auth_code:string ->
?profile:string ->
?email:string ->
?scopes:Ojs.t list ->
unit ->
parameters
[@@js.builder] [@@js.verbatim_names]

val login :
?param:parameters ->
?onInit:(user -> unit) ->
?onError:(error -> unit) ->
unit ->
unit
[@@js.global "window.plugins.googleplus.login"]
end

type loginResponse

val loginResponse : Login.user -> loginResponse [@@js.call]

val id_token : loginResponse -> string [@@js.get "id_token"]

This comment has been minimized.

Copy link
@vouillon

vouillon Aug 27, 2021

Contributor

That should be directly:

val id_token : loginResponse -> string [@@js.get "id_token"]

This comment has been minimized.

Copy link
@Thibaut-Gudin

Thibaut-Gudin Aug 30, 2021

Contributor

You meen directly "[@@js.get]"?

If it that I maid a PR: #3


val logout : ?onInit:(Ojs.t -> unit) -> ?onError:(Ojs.t -> unit) -> unit -> unit
[@@js.global "window.plugins.googleplus.logout"]

0 comments on commit f1fc82e

Please sign in to comment.