From a126b184f383460ce0d534c606fd1c8ae6ca8702 Mon Sep 17 00:00:00 2001 From: Matthieu Dubuget Date: Sat, 10 Dec 2016 20:27:33 +0100 Subject: [PATCH] WiP --- googleApps.ml | 34 ++++++++++++++++++++++++---------- googleApps.mli | 41 +++++++++++++++++++++++++++-------------- 2 files changed, 51 insertions(+), 24 deletions(-) diff --git a/googleApps.ml b/googleApps.ml index 922baa4..b55311f 100644 --- a/googleApps.ml +++ b/googleApps.ml @@ -41,6 +41,7 @@ include ([%js] : sig type t 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] @@ -51,6 +52,13 @@ include ([%js] : sig 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] end module NamedRange: sig @@ -99,6 +107,7 @@ include ([%js] : sig val get_name: t -> string [@@js.call] val get_named_ranges: t -> NamedRange.t list [@@js.call] val add_menu: string -> Ojs.t list -> unit [@@js.global "Spreadsheet.addMenu"] + val insert_row: t -> int -> t [@@js.call "insertRows"] end module EmailField : sig @@ -143,21 +152,26 @@ include ([%js] : sig 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] - end - - module GmailThread : sig - type t - val get_messages: t -> GmailMessage.t list [@@js.call] - end - - module GmailApp : sig + 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 search: string -> GmailThread.t list [@@js.global "GmailApp.search"] - end + 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) diff --git a/googleApps.mli b/googleApps.mli index 06f579c..cb18397 100644 --- a/googleApps.mli +++ b/googleApps.mli @@ -64,6 +64,7 @@ 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 @@ -74,6 +75,16 @@ sig 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 end (** spreadsheet named ranges *) @@ -133,6 +144,8 @@ sig val get_data_range : t -> Range.t val get_name : t -> string val get_named_ranges : t -> NamedRange.t list + (* Insert a blank row at the specified index *) + val insert_row: t -> int -> t end (** An email field in a {!Contact.t}. *) @@ -188,25 +201,25 @@ 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 -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 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 search : string -> GmailThread.t list + 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 + val log : string -> unit