<commit_before>(* Ocsigen-start
 * http://www.ocsigen.org/ocsigen-start
 *
 * Copyright (C) <NAME>, CNRS, INRIA, Be Sport.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, with linking exception;
 * either version 2.1 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *)

(** This module provides functions and types to manage the current user. *)

[%%shared.start]

type current_user =
  | CU_idontknown
  | CU_notconnected
  | CU_user of Os_types.User.t

(** [get_current_user ()] returns the current user as a {!Os_types.User.t} type.
    If no user is connected, it fails with {!Os_session.Not_connected}. *)
val get_current_user : unit -> Os_types.User.t

(** [get_current_userid ()] returns the ID of the current user.
    If no user is connected, it fails with {!Os_session.Not_connected}. *)
val get_current_userid : unit -> Os_types.User.id

(** Instead of exception, the module [Opt] returns an option. *)
module Opt : sig
  (** [get_current_user ()] returns the current user as a [Os_types.User.t option]
      type. If no user is connected, [None] is returned. *)
  val get_current_user : unit -> Os_types.User.t option<commit_msg>More doc about connection wrappers<commit_after>(* Ocsigen-start
 * http://www.ocsigen.org/ocsigen-start
 *
 * Copyright (C) <NAME>, CNRS, INRIA, Be Sport.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, with linking exception;
 * either version 2.1 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *)


[%%shared.start]

(** This module provides functions and types to manage the current user. *)

(** On server side, this will work only if the current request in wrapped
    in {!Os_session.connected_wrapper}, or {!Os_session.connected_fun},
    etc.
*)

type current_user =
  | CU_idontknown
  | CU_notconnected
  | CU_user of Os_types.User.t

(** [get_current_user ()] returns the current user as a {!Os_types.User.t} type.
    If no user is connected, it fails with {!Os_session.Not_connected}. *)
val get_current_user : unit -> Os_types.User.t

(** [get_current_userid ()] returns the ID of the current user.
    If no user is connected, it fails with {!Os_session.Not_connected}. *)
val get_current_userid : unit -> Os_types.User.id

(** Instead of exception, the module [Opt] returns an option. *)
module Opt : sig
  (** [get_current_user ()] returns the current user as a [Os_types.User.t option]
      type. If no user is connected, [None] is returned. *)
  val get_current_user : unit -> Os_types.User.t option
{'fraction_non_alphanumeric': 0.09144861073644456, 'fraction_numerical': 0.008632317237658484, 'mean_word_length': 3.891820580474934, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1432294', 'n_tokens_mistral': 1103, 'n_tokens_neox': 1054, 'n_words': 473}