This commit is contained in:
Matthieu Dubuget 2016-12-12 20:56:59 +01:00
parent a126b184f3
commit 945aa3f5db
2 changed files with 67 additions and 37 deletions

View File

@ -1,5 +1,7 @@
include ([%js] : sig include ([%js] : sig
val log: string -> unit [@@js.global "Logger.log"]
module Date : sig module Date : sig
type t type t
val t_of_js: Ojs.t -> t val t_of_js: Ojs.t -> t
@ -20,25 +22,35 @@ include ([%js] : sig
module File : sig module File : sig
type t type t
type iterator
type blob
type folder
val t_of_js: Ojs.t -> t 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_id: t -> string [@@js.call]
val get_name: t -> string [@@js.call] val get_name: t -> string [@@js.call]
val get_size: t -> int [@@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 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 module Range : sig
type t type t
val clear_format: t -> t [@@js.call]
val get_a1_notation: t -> string [@@js.call] val get_a1_notation: t -> string [@@js.call]
val get_background: t -> string [@@js.call] val get_background: t -> string [@@js.call]
val set_background: t -> string -> t [@@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_horizontal_alignment: t -> string -> t [@@js.call]
val set_vertical_alignment: t -> string -> t [@@js.call] val set_vertical_alignment: t -> string -> t [@@js.call]
val set_number_format : t -> string -> t [@@js.call] val set_number_format : t -> string -> t [@@js.call]
end
module NamedRange: sig type named
type t val get_name: named -> string [@@js.call]
val get_name: t -> string [@@js.call] val get_range: named -> t [@@js.call]
val get_range: t -> Range.t [@@js.call]
end end
module SandboxMode : sig 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_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_data_range: t -> Range.t [@@js.call]
val get_name: t -> string [@@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 add_menu: string -> Ojs.t list -> unit [@@js.global "Spreadsheet.addMenu"]
val insert_row: t -> int -> t [@@js.call "insertRows"] 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 end
module EmailField : sig module EmailField : sig

View File

@ -1,5 +1,7 @@
(** OCaml binding for Google Apps (https://developers.google.com/apps-script/) *) (** OCaml binding for Google Apps (https://developers.google.com/apps-script/) *)
val log : string -> unit
(** Standard JavaScript Date *) (** Standard JavaScript Date *)
module Date : module Date :
sig sig
@ -38,24 +40,37 @@ end
(** Files in Google Drive. *) (** Files in Google Drive. *)
module File : module File :
sig sig
type folder
type blob
type t type t
val t_of_js : Ojs.t -> t val t_of_js : Ojs.t -> t
val get_file_by_id : string -> t
val get_id : t -> string val get_id : t -> string
val get_name : t -> string val get_name : t -> string
val get_size : t -> int val get_size : t -> int
end
(** An iterator that allows scripts to iterate over a potentially large (** An iterator that allows scripts to iterate over a potentially
collection of {!File.t}.*) large collection of {!File.t}.*)
module FileIterator : type iterator
sig
type t
(** @return a {!FileIterator.t} for all files of the drive *) (** @return a {!FileIterator.t} for all files of the drive *)
val get_files : unit -> t val get_files : unit -> iterator
val t_of_js : Ojs.t -> t val has_next : iterator -> bool
val has_next : t -> bool val next : iterator -> t
val next : t -> File.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 end
(** spreadsheet ranges *) (** spreadsheet ranges *)
@ -85,14 +100,11 @@ sig
(** 'top', 'middle' or 'bottom'e *) (** 'top', 'middle' or 'bottom'e *)
val set_vertical_alignment: t -> string -> t val set_vertical_alignment: t -> string -> t
val set_number_format : t -> string -> t val set_number_format : t -> string -> t
end val clear_format: t -> t
(** spreadsheet named ranges *)
(** spreadsheet named ranges *) type named
module NamedRange : val get_name : named -> string
sig val get_range : named -> t
type t
val get_name : t -> string
val get_range : t -> Range.t
end end
module SandboxMode : sig module SandboxMode : sig
@ -107,6 +119,7 @@ module HtmlOutput :
val set_sandbox_mode : t -> SandboxMode.t -> t val set_sandbox_mode : t -> SandboxMode.t -> t
val set_title : t -> string -> t val set_title : t -> string -> t
end end
module Menu : module Menu :
sig sig
type t type t
@ -143,9 +156,14 @@ sig
start_column:int -> num_rows:int -> num_columns:int -> Range.t start_column:int -> num_rows:int -> num_columns:int -> Range.t
val get_data_range : t -> Range.t val get_data_range : t -> Range.t
val get_name : t -> string 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 *) (* Insert a blank row at the specified index *)
val insert_row: t -> int -> t 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 end
(** An email field in a {!Contact.t}. *) (** An email field in a {!Contact.t}. *)
@ -222,4 +240,4 @@ sig
end end
val log : string -> unit