API basé sur labels
Permet de chaîner les fonctions
This commit is contained in:
parent
87eabab46d
commit
aaec076974
3
Makefile
3
Makefile
@ -6,6 +6,9 @@ install: META googleApps.mli _build/googleApps.cmo _build/googleApps.cmi _build/
|
||||
uninstall:
|
||||
ocamlfind remove ocaml-google-apps
|
||||
|
||||
googleApps.ml: googleApps.mli
|
||||
ocamlbuild googleApps.ml
|
||||
|
||||
_build/googleApps.cmi: googleApps.mli
|
||||
ocamlbuild googleApps.cmi
|
||||
|
||||
|
189
googleApps.ml
189
googleApps.ml
@ -1,189 +0,0 @@
|
||||
include ([%js] : sig
|
||||
|
||||
val log: string -> unit [@@js.global "Logger.log"]
|
||||
|
||||
module Date : sig
|
||||
type t
|
||||
val t_of_js: Ojs.t -> t
|
||||
val t_to_js: t -> Ojs.t
|
||||
val now: unit -> t [@@js.new "Date"]
|
||||
val get_day: t -> int [@@js.call]
|
||||
val get_full_year: t -> int [@@js.call]
|
||||
val get_month: t -> int [@@js.call]
|
||||
val get_date: t -> int [@@js.call]
|
||||
val get_hours: t -> int [@@js.call]
|
||||
val get_minutes: t -> int [@@js.call]
|
||||
val get_seconds: t -> int [@@js.call]
|
||||
val to_date_string: t -> string [@@js.call]
|
||||
val to_ISO_string: t -> string [@@js.call]
|
||||
val to_locale_date_string: t -> string [@@js.call]
|
||||
val to_string: t -> string [@@js.call]
|
||||
end
|
||||
|
||||
module File : sig
|
||||
type t
|
||||
type iterator
|
||||
type blob
|
||||
type folder
|
||||
val t_of_js: Ojs.t -> t
|
||||
|
||||
val get_folder_by_id: string -> folder [@@js.global "DriveApp.getFolderById"]
|
||||
val get_id: t -> string [@@js.call]
|
||||
val get_name: t -> string [@@js.call]
|
||||
val get_size: t -> int [@@js.call]
|
||||
val get_files: unit -> iterator [@@js.global "DriveApp.getFiles"]
|
||||
val get_file_by_id : string -> t [@@js.global "DriveApp.getFileById"]
|
||||
val has_next: iterator -> bool [@@js.call]
|
||||
val next: iterator -> t [@@js.call]
|
||||
val make_copy: t -> name:string -> folder -> t [@@js.call]
|
||||
|
||||
val copy_blob : blob -> blob [@@js.call]
|
||||
val get_blob_data_as_string : blob -> string [@@js.call "getDataAsString"]
|
||||
val set_blob_data_from_string : blob -> string -> blob [@@js.call "setDataFromString"]
|
||||
val new_blob : string -> blob [@@js.global "Utilities.newBlob"]
|
||||
val set_blob_name: blob -> string -> blob [@@js.call "setName"]
|
||||
val set_blob_content_type: blob -> string -> blob [@@js.call "setContentType"]
|
||||
val blob_to_js: blob -> Ojs.t
|
||||
val get_blob: t -> blob [@@js.call]
|
||||
val set_content: t -> string -> t [@@js.call]
|
||||
end
|
||||
|
||||
module Range : sig
|
||||
type t
|
||||
val clear_format: t -> t [@@js.call]
|
||||
val get_a1_notation: t -> string [@@js.call]
|
||||
val get_background: t -> string [@@js.call]
|
||||
val set_background: t -> string -> t [@@js.call]
|
||||
val get_row: t -> int [@@js.call]
|
||||
val get_last_row: t -> int [@@js.call]
|
||||
val get_column: t -> int [@@js.call]
|
||||
val get_last_column: t -> int [@@js.call]
|
||||
val get_num_columns: t -> int [@@js.call]
|
||||
val get_num_rows: t -> int [@@js.call]
|
||||
val get_values: t -> Ojs.t array array [@@js.call]
|
||||
val get_formulas: t -> string array array [@@js.call]
|
||||
val get_display_values: t -> string array array [@@js.call]
|
||||
val set_value: t -> Ojs.t -> t [@@js.call]
|
||||
val set_values: t -> Ojs.t array array -> t [@@js.call]
|
||||
val offset: t -> row_offset:int -> column_offset:int -> num_rows:int -> num_columns:int -> t [@@js.call]
|
||||
val get_cell: t -> row:int -> column:int -> t [@@js.call]
|
||||
val set_border: t -> top:bool -> left:bool -> bottom:bool -> right:bool -> vertical:bool -> horizontal:bool -> t [@@js.call]
|
||||
val set_horizontal_alignment: t -> string -> t [@@js.call]
|
||||
val set_vertical_alignment: t -> string -> t [@@js.call]
|
||||
val set_number_format : t -> string -> t [@@js.call]
|
||||
|
||||
type named
|
||||
val get_name: named -> string [@@js.call]
|
||||
val get_range: named -> t [@@js.call]
|
||||
end
|
||||
|
||||
module SandboxMode : sig
|
||||
type t
|
||||
val iframe : t [@@js.global "HtmlService.SandboxMode.IFRAME"]
|
||||
end
|
||||
|
||||
module HtmlOutput : sig
|
||||
type t
|
||||
val create_html_output_from_file: string -> t [@@js.global "HtmlService.createHtmlOutputFromFile"]
|
||||
val set_sandbox_mode : t -> SandboxMode.t -> t [@@js.call]
|
||||
val set_title : t -> string -> t [@@js.call]
|
||||
end
|
||||
|
||||
module Menu : sig
|
||||
type t
|
||||
val add_item : t -> caption:string -> functionName:string -> t [@@js.call]
|
||||
val add_separator : t -> t [@@js.call]
|
||||
val add_sub_menu : t -> t -> t [@@js.call]
|
||||
val add_to_ui : t -> unit [@@js.call]
|
||||
end
|
||||
|
||||
module Ui : sig
|
||||
type t
|
||||
type menu
|
||||
val show_sidebar : t -> HtmlOutput.t -> unit [@@js.call]
|
||||
val create_menu : t -> caption:string -> Menu.t [@@js.call]
|
||||
val alert : t -> string -> unit [@@js.call]
|
||||
end
|
||||
|
||||
module Sheet : sig
|
||||
type t
|
||||
val get_active_sheet: unit -> t [@@js.global "SpreadsheetApp.getActiveSheet"]
|
||||
val get_ui: unit -> Ui.t [@@js.global "SpreadsheetApp.getUi"]
|
||||
val get_last_row: t -> int [@@js.call]
|
||||
val get_last_column: t -> int [@@js.call]
|
||||
val get_sheet_values: t -> start_row:int -> start_column:int -> num_rows:int -> num_columns:int -> Ojs.t array array [@@js.call]
|
||||
val get_range: t -> start_row:int -> start_column:int -> num_rows:int -> num_columns:int -> Range.t [@@js.call]
|
||||
val get_data_range: t -> Range.t [@@js.call]
|
||||
val get_name: t -> string [@@js.call]
|
||||
val get_named_ranges: t -> Range.named list [@@js.call]
|
||||
val add_menu: string -> Ojs.t list -> unit [@@js.global "Spreadsheet.addMenu"]
|
||||
val insert_row: t -> int -> t [@@js.call "insertRows"]
|
||||
val hide_row: t -> int -> unit [@@js.call "hideRows"]
|
||||
val show_row: t -> int -> unit [@@js.call "showRows"]
|
||||
end
|
||||
|
||||
module EmailField : sig
|
||||
type t
|
||||
val get_address: t -> string [@@js.call]
|
||||
end
|
||||
|
||||
module PhoneField : sig
|
||||
type t
|
||||
module Field : sig
|
||||
type t
|
||||
val work : t [@@js.global "ContactsApp.Field.WORK_PHONE"]
|
||||
val mobile : t [@@js.global "ContactsApp.Field.MOBILE_PHONE"]
|
||||
val home : t [@@js.global "ContactsApp.Field.HOME_PHONE"]
|
||||
end
|
||||
val get_phone_number: t -> string [@@js.call]
|
||||
end
|
||||
|
||||
module Contacts : sig
|
||||
type t
|
||||
val get_contacts: unit -> t list [@@js.global "ContactsApp.getContacts"]
|
||||
|
||||
val get_family_name: t -> string [@@js.call]
|
||||
val get_given_name: t -> string [@@js.call]
|
||||
val get_full_name: t -> string [@@js.call]
|
||||
|
||||
val get_emails: t -> EmailField.t list [@@js.call]
|
||||
val get_phones: t -> PhoneField.t list [@@js.call]
|
||||
val add_phone: t -> PhoneField.Field.t -> string -> PhoneField.t [@@js.call]
|
||||
|
||||
val create: given_name:string -> family_name:string -> email:string -> t
|
||||
[@@js.global "ContactsApp.createContact"]
|
||||
|
||||
module Group : sig
|
||||
type g
|
||||
val get_contact_group: string -> g [@@js.global "ContactsApp.getContactGroup"]
|
||||
val get_contacts: g -> t list [@@js.call]
|
||||
end
|
||||
val add_to_group: t -> Group.g -> t [@@js.call]
|
||||
val get_contact_groups: t -> Group.g list
|
||||
end
|
||||
|
||||
module GmailMessage : sig
|
||||
type t
|
||||
type thread
|
||||
type label
|
||||
val get_body : t -> string [@@js.call]
|
||||
val get_subject : t -> string [@@js.call]
|
||||
val get_from : t -> string [@@js.call]
|
||||
val get_id : t -> string [@@js.call]
|
||||
val mark_read : t -> t [@@js.call]
|
||||
val get_message_by_id: string -> t [@@js.global "GmailApp.getMessageById"]
|
||||
val get_thread : t -> thread [@@js.call]
|
||||
val get_messages: thread -> t list [@@js.call "getMessages"]
|
||||
val move_to_archive: thread -> thread [@@js.call "moveToArchive"]
|
||||
val search_thread: string -> thread list [@@js.global "GmailApp.search"]
|
||||
val send_email: recipient:string -> subject:string -> body:string -> unit
|
||||
[@@js.global "GmailApp.sendEmail"]
|
||||
val send_email_with_options: recipient:string -> subject:string -> body:string -> Ojs.t -> unit
|
||||
[@@js.global "GmailApp.sendEmail"]
|
||||
|
||||
val get_user_label : string -> label [@@js.global "GmailApp.getUserLabelByName"]
|
||||
val add_label_to_thread : label -> thread -> label [@@js.call "addToThread"]
|
||||
val add_label: thread -> label -> thread [@@js.call "addLabel"]
|
||||
val remove_label: thread -> label -> thread [@@js.call "removeLabel"]
|
||||
end
|
||||
end)
|
279
googleApps.mli
279
googleApps.mli
@ -1,6 +1,6 @@
|
||||
(** OCaml binding for Google Apps (https://developers.google.com/apps-script/) *)
|
||||
|
||||
val log : string -> unit
|
||||
val log : string -> unit [@@js.global "Logger.log"]
|
||||
|
||||
(** Standard JavaScript Date *)
|
||||
module Date :
|
||||
@ -8,170 +8,179 @@ sig
|
||||
type t
|
||||
val t_of_js : Ojs.t -> t
|
||||
val t_to_js : t -> Ojs.t
|
||||
val now : unit -> t
|
||||
val now : unit -> t [@@js.new "Date"]
|
||||
|
||||
(** @return day of the week (0-6) *)
|
||||
val get_day : t -> int
|
||||
val get_day : t -> int [@@js.call]
|
||||
|
||||
(** @return year (4 digits) *)
|
||||
val get_full_year : t -> int
|
||||
val get_full_year : t -> int [@@js.call]
|
||||
|
||||
(** @return month (0-11) *)
|
||||
val get_month : t -> int
|
||||
val get_month : t -> int [@@js.call]
|
||||
|
||||
(** @return day of the month (1-31) *)
|
||||
val get_date : t -> int
|
||||
val get_date : t -> int [@@js.call]
|
||||
|
||||
(** @return hour (0-23) *)
|
||||
val get_hours : t -> int
|
||||
val get_hours : t -> int [@@js.call]
|
||||
|
||||
(** @return minutes (0-59) *)
|
||||
val get_minutes : t -> int
|
||||
val get_minutes : t -> int [@@js.call]
|
||||
|
||||
(** @return seconds (0-59) *)
|
||||
val get_seconds : t -> int
|
||||
val get_seconds : t -> int [@@js.call]
|
||||
|
||||
val to_date_string : t -> string
|
||||
val to_ISO_string : t -> string
|
||||
val to_locale_date_string : t -> string
|
||||
val to_string : t -> string
|
||||
val to_date_string : t -> string [@@js.call]
|
||||
|
||||
val to_ISO_string : t -> string [@@js.call]
|
||||
|
||||
val to_locale_date_string : t -> string [@@js.call]
|
||||
|
||||
val to_string : t -> string [@@js.call]
|
||||
end
|
||||
|
||||
(** Files in Google Drive. *)
|
||||
module File :
|
||||
sig
|
||||
|
||||
type folder
|
||||
type blob
|
||||
val get_folder_by_id: string -> folder [@@js.global "DriveApp.getFolderById"]
|
||||
|
||||
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
|
||||
val get_file_by_id : string -> t [@@js.global "DriveApp.getFileById"]
|
||||
val get_id : t -> string [@@js.call]
|
||||
val get_name : t -> string [@@js.call]
|
||||
val get_size : t -> int [@@js.call]
|
||||
|
||||
|
||||
val make_copy: t -> name:string -> folder:folder -> t [@@js.call]
|
||||
val set_content: t -> content:string -> t [@@js.call]
|
||||
|
||||
(** An iterator that allows scripts to iterate over a potentially
|
||||
large collection of {!File.t}.*)
|
||||
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 get_files : unit -> iterator [@@js.global "DriveApp.getFiles"]
|
||||
val has_next : iterator -> bool [@@js.call]
|
||||
val next : iterator -> t [@@js.call]
|
||||
|
||||
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
|
||||
type blob
|
||||
val blob_to_js: blob -> Ojs.t
|
||||
val get_blob: t -> blob
|
||||
val set_content: t -> string -> t
|
||||
val new_blob : string -> blob [@@js.global "Utilities.newBlob"]
|
||||
val get_blob: t -> blob [@@js.call]
|
||||
val copy_blob : blob -> blob [@@js.call]
|
||||
val get_blob_data_as_string : blob -> string [@@js.call "getDataAsString"]
|
||||
|
||||
val set_blob_data_from_string : blob -> data:string -> blob [@@js.call "setDataFromString"]
|
||||
val set_blob_name: blob -> name:string -> blob [@@js.call "setName"]
|
||||
val set_blob_content_type: blob -> content_type:string -> blob [@@js.call "setContentType"]
|
||||
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
|
||||
val get_a1_notation : t -> string [@@js.call]
|
||||
val get_background : t -> string [@@js.call]
|
||||
val get_row : t -> int [@@js.call]
|
||||
val get_last_row : t -> int [@@js.call]
|
||||
val get_column : t -> int [@@js.call]
|
||||
val get_last_column : t -> int [@@js.call]
|
||||
val get_num_columns : t -> int [@@js.call]
|
||||
val get_num_rows : t -> int [@@js.call]
|
||||
val get_values : t -> Ojs.t array array [@@js.call]
|
||||
val get_formulas : t -> string array array [@@js.call]
|
||||
val get_display_values : t -> string array array [@@js.call]
|
||||
|
||||
val set_background: t -> background:string -> t [@@js.call]
|
||||
val set_value : t -> new_val:Ojs.t -> t [@@js.call "setValue"]
|
||||
val set_values: t -> new_vals:Ojs.t array array -> t [@@js.call "setValues"]
|
||||
val offset: t -> row_offset:int -> column_offset:int
|
||||
-> num_rows:int -> num_columns:int -> t [@@js.call]
|
||||
|
||||
(** 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
|
||||
val get_cell : t -> row:int -> column:int -> t [@@js.call]
|
||||
val set_border: t -> top:bool -> left:bool -> bottom:bool -> right:bool
|
||||
-> vertical:bool -> horizontal:bool -> t [@@js.call]
|
||||
|
||||
(** 'left', 'center' or 'right' *)
|
||||
val set_horizontal_alignment: t -> string -> t
|
||||
val set_horizontal_alignment: t-> align:string -> t [@@js.call]
|
||||
|
||||
(** '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
|
||||
val set_vertical_alignment: t -> align:string-> t [@@js.call]
|
||||
val set_number_format : t -> format:string -> t [@@js.call]
|
||||
val clear_format: t -> t [@@js.call]
|
||||
end
|
||||
|
||||
module SandboxMode : sig
|
||||
type t
|
||||
val iframe : t
|
||||
val iframe : t [@@js.global "HtmlService.SandboxMode.IFRAME"]
|
||||
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
|
||||
[@@js.global "HtmlService.createHtmlOutputFromFile"]
|
||||
val set_sandbox_mode : t -> mode:SandboxMode.t -> t [@@js.call]
|
||||
val set_title : t -> title:string -> t [@@js.call]
|
||||
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
|
||||
val alert : t -> string -> unit
|
||||
val add_to_ui : t -> unit [@@js.call]
|
||||
val add_separator : t -> t [@@js.call]
|
||||
val add_item : t -> caption:string -> function_name:string -> t [@@js.call]
|
||||
val add_sub_menu : t -> submenu:t -> t [@@js.call]
|
||||
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 ->
|
||||
val get_active_sheet : unit -> t [@@js.global "SpreadsheetApp.getActiveSheet"]
|
||||
val get_last_row : t -> int [@@js.call]
|
||||
val get_last_column : t -> int [@@js.call]
|
||||
|
||||
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 ->
|
||||
[@@js.call]
|
||||
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
|
||||
[@@js.call]
|
||||
|
||||
val get_data_range : t -> Range.t [@@js.call]
|
||||
val get_name : t -> string [@@js.call]
|
||||
|
||||
(* Insert a blank row at the specified index *)
|
||||
val insert_row: t -> int -> t
|
||||
val insert_row: t-> index:int -> t [@@js.call "insertRows"]
|
||||
|
||||
(* Hides the row at the given index. *)
|
||||
val hide_row: t -> int -> unit
|
||||
val hide_row: t -> index:int -> unit [@@js.call "hideRows"]
|
||||
|
||||
(* Shows the row at the given index. *)
|
||||
val show_row: t -> int -> unit
|
||||
val show_row: t -> index:int -> unit [@@js.call "showRows"]
|
||||
|
||||
type ui
|
||||
type menu
|
||||
val get_ui: unit -> ui [@@js.global "SpreadsheetApp.getUi"]
|
||||
|
||||
val show_sidebar : ui -> html:HtmlOutput.t -> unit [@@js.call]
|
||||
|
||||
val create_menu : ui -> caption:string -> Menu.t [@@js.call]
|
||||
|
||||
val alert : ui -> msg:string -> unit [@@js.call]
|
||||
end
|
||||
|
||||
(** An email field in a {!Contact.t}. *)
|
||||
module EmailField :
|
||||
sig
|
||||
type t
|
||||
val get_address : t -> string
|
||||
val get_address : t -> string [@@js.call]
|
||||
end
|
||||
|
||||
(** An email field in a {!Contact.t}. *)
|
||||
@ -180,41 +189,45 @@ sig
|
||||
type t
|
||||
module Field : sig
|
||||
type t
|
||||
val work : t
|
||||
val mobile : t
|
||||
val home : t
|
||||
val work : t [@@js.global "ContactsApp.Field.WORK_PHONE"]
|
||||
val mobile : t [@@js.global "ContactsApp.Field.MOBILE_PHONE"]
|
||||
val home : t [@@js.global "ContactsApp.Field.HOME_PHONE"]
|
||||
end
|
||||
val get_phone_number : t -> string
|
||||
val get_phone_number : t -> string [@@js.call]
|
||||
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
|
||||
val get_contact_group : string -> g [@@js.global "ContactsApp.getContactGroup"]
|
||||
val get_contacts : g -> t list [@@js.call]
|
||||
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
|
||||
|
||||
val get_contacts : unit -> t list [@@js.global "ContactsApp.getContacts"]
|
||||
|
||||
(** Create a contact *)
|
||||
val create: given_name:string -> family_name:string -> email:string -> t
|
||||
[@@js.global "ContactsApp.createContact"]
|
||||
|
||||
val get_emails : t -> EmailField.t list [@@js.call]
|
||||
val get_family_name : t -> string [@@js.call]
|
||||
val get_given_name : t -> string [@@js.call]
|
||||
val get_full_name : t -> string [@@js.call]
|
||||
val get_phones : t -> PhoneField.t list [@@js.call]
|
||||
val get_contact_groups : t -> Group.g list [@@js.call]
|
||||
|
||||
val add_phone : t -> field:PhoneField.Field.t -> number:string -> PhoneField.t
|
||||
[@@js.call]
|
||||
|
||||
(** Adds a {!Contact.t} to a {!Group.t} *)
|
||||
val add_to_group: t -> Group.g -> t
|
||||
|
||||
val get_contact_groups: t -> Group.g list
|
||||
val add_to_group: t -> group:Group.g -> t
|
||||
[@@js.call]
|
||||
end
|
||||
|
||||
module GmailMessage :
|
||||
@ -222,22 +235,32 @@ 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
|
||||
|
||||
val get_message_by_id: string -> t [@@js.global "GmailApp.getMessageById"]
|
||||
val get_body : t -> string [@@js.call]
|
||||
val get_subject : t -> string [@@js.call]
|
||||
val get_from : t -> string [@@js.call]
|
||||
val get_id : t -> string [@@js.call]
|
||||
val mark_read : t -> t [@@js.call]
|
||||
|
||||
val get_thread : t -> thread [@@js.call]
|
||||
val get_messages : thread -> t list [@@js.call]
|
||||
val move_to_archive : thread -> thread [@@js.call]
|
||||
val search_thread : string -> thread list [@@js.global "GmailApp.search"]
|
||||
|
||||
val get_user_label_by_name : string -> label [@@js.global "GmailApp.getUserLabelByName"]
|
||||
|
||||
val add_label_to_thread: label -> thread:thread -> label
|
||||
[@@js.call "addToThread"]
|
||||
|
||||
val add_label: thread -> label:label -> thread
|
||||
[@@js.call]
|
||||
|
||||
val remove_label: thread -> label:label -> thread
|
||||
[@@js.call]
|
||||
|
||||
val send_email : recipient:string -> subject:string -> body:string -> unit [@@js.global "GmailApp.sendEmail"]
|
||||
val send_email_with_options : recipient:string -> subject:string -> body:string -> Ojs.t -> unit [@@js.global "GmailApp.sendEmail"]
|
||||
end
|
||||
|
||||
|
||||
|
@ -3,14 +3,22 @@ open Ocamlbuild_plugin
|
||||
module MyProject = struct
|
||||
flag ["js_of_ocaml";"prettyjs"](A"--pretty");
|
||||
flag ["link";"byte";"ocaml";"program";"no_check_prims"](A"-no-check-prims");
|
||||
rule "%.js -> %.byte"
|
||||
rule "%.byte -> %js"
|
||||
~dep:"%.byte"
|
||||
~prod:"%.js"
|
||||
(
|
||||
fun env build ->
|
||||
fun env _ ->
|
||||
let input = env "%.byte" in
|
||||
let tags = tags_of_pathname input ++ "js_of_ocaml" in
|
||||
Cmd(S[A"js_of_ocaml"; T tags; A"+gen_js_api/ojs_runtime.js"; A input])
|
||||
);
|
||||
rule "%.mli -> %.ml"
|
||||
~dep:"%.mli"
|
||||
~prod:"%.ml"
|
||||
(
|
||||
fun env _ ->
|
||||
let input = env "%.mli" in
|
||||
Cmd(S[A"ocamlfind"; A"gen_js_api/gen_js_api"; A input])
|
||||
)
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user