ocaml-google-app/googleApps.ml
2016-12-08 15:55:51 +01:00

164 lines
6.3 KiB
OCaml

include ([%js] : sig
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
val t_of_js: Ojs.t -> t
val get_id: t -> string [@@js.call]
val get_name: t -> string [@@js.call]
val get_size: t -> int [@@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 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_value: t -> Ojs.t -> t [@@js.call]
end
module NamedRange: sig
type t
val get_name: t -> string [@@js.call]
val get_range: t -> Range.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]
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 -> NamedRange.t list [@@js.call]
val add_menu: string -> Ojs.t list -> unit [@@js.global "Spreadsheet.addMenu"]
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
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 send_email: recipient:string -> subject:string -> body:string -> unit
[@@js.global "GmailApp.sendEmail"]
val search: string -> GmailThread.t list [@@js.global "GmailApp.search"]
end
end)