diff --git a/googleApps.ml b/googleApps.ml index b55311f..757a0e6 100644 --- a/googleApps.ml +++ b/googleApps.ml @@ -1,5 +1,7 @@ include ([%js] : sig + val log: string -> unit [@@js.global "Logger.log"] + module Date : sig type t val t_of_js: Ojs.t -> t @@ -20,25 +22,35 @@ include ([%js] : sig 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 -> blob [@@js.call] end - module FileIterator : sig - type t - val get_files: unit -> t [@@js.global "DriveApp.getFiles"] - val t_of_js: Ojs.t -> t - val has_next: t -> bool [@@js.call] - val next: t -> File.t [@@js.call] - end - - - val log: string -> unit [@@js.global "Logger.log"] - 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] @@ -59,12 +71,10 @@ include ([%js] : sig 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 - type t - val get_name: t -> string [@@js.call] - val get_range: t -> Range.t [@@js.call] + type named + val get_name: named -> string [@@js.call] + val get_range: named -> t [@@js.call] end module SandboxMode : sig @@ -105,9 +115,11 @@ include ([%js] : sig 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 -> NamedRange.t list [@@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 diff --git a/googleApps.mli b/googleApps.mli index cb18397..ac815d6 100644 --- a/googleApps.mli +++ b/googleApps.mli @@ -1,5 +1,7 @@ (** OCaml binding for Google Apps (https://developers.google.com/apps-script/) *) +val log : string -> unit + (** Standard JavaScript Date *) module Date : sig @@ -38,24 +40,37 @@ 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 -end -(** An iterator that allows scripts to iterate over a potentially large -collection of {!File.t}.*) -module FileIterator : -sig - type t + (** 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 -> t - val t_of_js : Ojs.t -> t - val has_next : t -> bool - val next : t -> File.t + 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 *) @@ -85,14 +100,11 @@ sig (** 'top', 'middle' or 'bottom'e *) val set_vertical_alignment: t -> string -> t val set_number_format : t -> string -> t -end - -(** spreadsheet named ranges *) -module NamedRange : -sig - type t - val get_name : t -> string - val get_range : t -> Range.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 @@ -107,6 +119,7 @@ module HtmlOutput : val set_sandbox_mode : t -> SandboxMode.t -> t val set_title : t -> string -> t end + module Menu : sig type t @@ -143,9 +156,14 @@ sig 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 + 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}. *) @@ -222,4 +240,4 @@ sig end -val log : string -> unit +