ocaml-google-app/googleApps.mli
Matthieu Dubuget 54f7114c44 WiP
2016-12-07 23:21:43 +01:00

212 lines
4.6 KiB
OCaml

(** OCaml binding for Google Apps (https://developers.google.com/apps-script/) *)
(** 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 t
val t_of_js : Ojs.t -> t
val get_id : t -> string
val get_name : t -> string
val get_size : t -> int
end
(** An iterator that allows scripts to iterate over a potentially large
collection of {!File.t}.*)
module FileIterator :
sig
type t
(** @return a {!FileIterator.t} for all files of the drive *)
val get_files : unit -> t
val t_of_js : Ojs.t -> t
val has_next : t -> bool
val next : t -> File.t
end
(** spreadsheet ranges *)
module Range :
sig
type t
val get_a1_notation : t -> string
val get_background : t -> string
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
end
(** spreadsheet named ranges *)
module NamedRange :
sig
type t
val get_name : t -> string
val get_range : t -> Range.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 -> NamedRange.t list
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
val get_body : t -> string
val get_subject : t -> string
val get_from : t -> string
end
module GmailThread :
sig
type t
val get_messages: t -> GmailMessage.t list
end
(** Provides access to Gmail threads, messages, and labels. *)
module GmailApp :
sig
(** Send an email *)
val send_email : recipient:string -> subject:string -> body:string -> unit
val search : string -> GmailThread.t list
end
val log : string -> unit