ocaml-google-app/googleApps.mli
Matthieu Dubuget 945aa3f5db WiP
2016-12-12 20:56:59 +01:00

244 lines
6.2 KiB
OCaml

(** OCaml binding for Google Apps (https://developers.google.com/apps-script/) *)
val log : string -> unit
(** Standard JavaScript Date *)
module Date :
sig
type t
val t_of_js : Ojs.t -> t
val t_to_js : t -> Ojs.t
val now : unit -> t
(** @return day of the week (0-6) *)
val get_day : t -> int
(** @return year (4 digits) *)
val get_full_year : t -> int
(** @return month (0-11) *)
val get_month : t -> int
(** @return day of the month (1-31) *)
val get_date : t -> int
(** @return hour (0-23) *)
val get_hours : t -> int
(** @return minutes (0-59) *)
val get_minutes : t -> int
(** @return seconds (0-59) *)
val get_seconds : t -> int
val to_date_string : t -> string
val to_ISO_string : t -> string
val to_locale_date_string : t -> string
val to_string : t -> string
end
(** Files in Google Drive. *)
module File :
sig
type folder
type blob
type t
val t_of_js : Ojs.t -> t
val get_file_by_id : string -> t
val get_id : t -> string
val get_name : t -> string
val get_size : t -> int
(** An iterator that allows scripts to iterate over a potentially
large collection of {!File.t}.*)
type iterator
(** @return a {!FileIterator.t} for all files of the drive *)
val get_files : unit -> iterator
val has_next : iterator -> bool
val next : iterator -> t
val get_file_by_id : string -> t
val make_copy: t -> name:string -> folder -> t
val get_folder_by_id: string -> folder
val copy_blob : blob -> blob
val get_blob_data_as_string : blob -> string
val set_blob_data_from_string : blob -> string -> blob
val new_blob : string -> blob
val set_blob_name: blob -> string -> blob
val set_blob_content_type: blob -> string -> blob
val blob_to_js: blob -> Ojs.t
val get_blob: t -> blob
val set_content: t -> blob
end
(** spreadsheet ranges *)
module Range :
sig
type t
val get_a1_notation : t -> string
val get_background : t -> string
val set_background: t -> string -> t
val get_row : t -> int
val get_last_row : t -> int
val get_column : t -> int
val get_last_column : t -> int
val get_num_columns : t -> int
val get_num_rows : t -> int
val get_values : t -> Ojs.t array array
val get_formulas : t -> string array array
val get_display_values : t -> string array array
val set_value : t -> Ojs.t -> t
val set_values: t -> Ojs.t array array -> t
val offset: t -> row_offset:int -> column_offset:int -> num_rows:int -> num_columns:int -> t
(** Returns a given cell within a range. *)
val get_cell: t -> row:int -> column:int -> t
val set_border: t -> top:bool -> left:bool -> bottom:bool -> right:bool -> vertical:bool -> horizontal:bool -> t
(** 'left', 'center' or 'right' *)
val set_horizontal_alignment: t -> string -> t
(** 'top', 'middle' or 'bottom'e *)
val set_vertical_alignment: t -> string -> t
val set_number_format : t -> string -> t
val clear_format: t -> t
(** spreadsheet named ranges *)
type named
val get_name : named -> string
val get_range : named -> t
end
module SandboxMode : sig
type t
val iframe : t
end
module HtmlOutput :
sig
type t
val create_html_output_from_file : string -> t
val set_sandbox_mode : t -> SandboxMode.t -> t
val set_title : t -> string -> t
end
module Menu :
sig
type t
val add_item : t -> caption:string -> functionName:string -> t
val add_separator : t -> t
val add_sub_menu : t -> t -> t
val add_to_ui : t -> unit
end
module Ui :
sig
type t
type menu
val show_sidebar : t -> HtmlOutput.t -> unit
val create_menu : t -> caption:string -> Menu.t
end
(** Access and modify spreadsheet sheets. *)
module Sheet :
sig
type t
val get_active_sheet : unit -> t
val get_ui: unit -> Ui.t
val get_last_row : t -> int
val get_last_column : t -> int
val get_sheet_values :
t ->
start_row:int ->
start_column:int ->
num_rows:int -> num_columns:int -> Ojs.t array array
val get_range :
t ->
start_row:int ->
start_column:int -> num_rows:int -> num_columns:int -> Range.t
val get_data_range : t -> Range.t
val get_name : t -> string
val get_named_ranges : t -> Range.named list
(* Insert a blank row at the specified index *)
val insert_row: t -> int -> t
(* Hides the row at the given index. *)
val hide_row: t -> int -> unit
(* Shows the row at the given index. *)
val show_row: t -> int -> unit
end
(** An email field in a {!Contact.t}. *)
module EmailField :
sig
type t
val get_address : t -> string
end
(** An email field in a {!Contact.t}. *)
module PhoneField :
sig
type t
module Field : sig
type t
val work : t
val mobile : t
val home : t
end
val get_phone_number : t -> string
end
(** A {!Contact.t} contains the name, address, and various contact details of a contact.*)
module Contacts :
sig
type t
val get_contacts : unit -> t list
(** Create a contact *)
val create: given_name:string -> family_name:string -> email:string -> t
(** A {!Group.t} is is a group of contacts. *)
module Group :
sig
type g
val get_contact_group : string -> g
val get_contacts : g -> t list
end
val get_emails : t -> EmailField.t list
val get_family_name : t -> string
val get_given_name : t -> string
val get_full_name : t -> string
val get_phones : t -> PhoneField.t list
val get_contact_groups : t -> Group.g list
val add_phone : t -> PhoneField.Field.t -> string -> PhoneField.t
(** Adds a {!Contact.t} to a {!Group.t} *)
val add_to_group: t -> Group.g -> t
val get_contact_groups: t -> Group.g list
end
module GmailMessage :
sig
type t
type thread
type label
val get_body : t -> string
val get_subject : t -> string
val get_from : t -> string
val get_id : t -> string
val mark_read : t -> t
val get_message_by_id: string -> t
val get_thread : t -> thread
val get_messages : thread -> t list
val move_to_archive : thread -> thread
val search_thread : string -> thread list
val send_email : recipient:string -> subject:string -> body:string -> unit
val send_email_with_options : recipient:string -> subject:string -> body:string -> Ojs.t -> unit
val get_user_label : string -> label
val add_label_to_thread : label -> thread -> label
val add_label: thread -> label -> thread
val remove_label: thread -> label -> thread
end