package gapi-ocaml

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module GapiConfigSource

Configuration module.

Configures Ocurl and authorization method.

Sourcetype debug_function =
  1. | Standard
    (*

    Standard debug function that prints everything on standard output.

    *)
  2. | Custom of Curl.t -> Curl.curlDebugType -> string -> unit
    (*

    Custom debug function.

    *)

Curl debug function used to log server interactions.

Sourcetype client_login_config = {
  1. username : string;
    (*

    Username of the Google account.

    *)
  2. password : string;
    (*

    Password of the Google account.

    *)
}

Client Login parameters.

Sourceval username : (client_login_config, string) GapiLens.t

Client Login username lens.

Sourceval password : (client_login_config, string) GapiLens.t

Client Login password lens.

Sourcetype oauth1_config = {
  1. signature_method : GapiCore.SignatureMethod.t;
    (*

    Signature method used to sign requests. (HMAC_SHA1 is the only supported method)

    *)
  2. consumer_key : string;
    (*

    Consumer key.

    *)
  3. consumer_secret : string;
    (*

    Consumer secret.

    *)
}

OAuth 1.0a parameters.

OAuth1 signature method lens.

Sourceval consumer_key : (oauth1_config, string) GapiLens.t

OAuth1 consumer key lens.

Sourceval consumer_secret : (oauth1_config, string) GapiLens.t

OAuth1 consumer secret lens.

Sourcetype oauth2_config = {
  1. client_id : string;
    (*

    Client ID.

    *)
  2. client_secret : string;
    (*

    Client secret.

    *)
  3. refresh_access_token : (unit -> string) option;
    (*

    Optional external function used to get new access tokens.

    *)
}

OAuth 2 parameters.

Sourceval client_id : (oauth2_config, string) GapiLens.t

OAuth2 client ID lens.

Sourceval client_secret : (oauth2_config, string) GapiLens.t

OAuth2 client secret lens.

Sourceval refresh_access_token : (oauth2_config, (unit -> string) option) GapiLens.t

OAuth2 optional external token refresh function lens.

Sourcetype oauth2_service_account_config = {
  1. service_account_credentials_json : string;
    (*

    Service account credentials JSON file content.

    *)
  2. scopes : string list;
    (*

    List of scopes that the application requests.

    *)
  3. user_to_impersonate : string option;
    (*

    Optional user to impersonate (for G Suite domains).

    *)
  4. refresh_service_account_access_token : (unit -> string) option;
    (*

    Optional external function used to get new access tokens.

    *)
}

OAuth 2 (for service accounts) parameters.

Sourceval service_account_credentials_json : (oauth2_service_account_config, string) GapiLens.t

OAuth2 service account credentials JSON file content (lens).

List of scopes that the application requests (lens).

Sourceval user_to_impersonate : (oauth2_service_account_config, string option) GapiLens.t

Optional user to impersonate (lens).

Sourceval refresh_service_account_access_token : (oauth2_service_account_config, (unit -> string) option) GapiLens.t

Optional external function used to get new access tokens (lens).

Sourcetype auth_config =
  1. | NoAuth
    (*

    No authorization.

    *)
  2. | ClientLogin of client_login_config
    (*

    Client Login.

    *)
  3. | OAuth1 of oauth1_config
    (*

    OAuth1.

    *)
  4. | OAuth2 of oauth2_config
    (*

    OAuth2.

    *)
  5. | OAuth2ServiceAccount of oauth2_service_account_config
    (*

    OAuth2 for service accounts.

    *)

Authorization method.

Sourcetype t = {
  1. application_name : string;
    (*

    Application name, used to build User-Agent HTTP header.

    *)
  2. debug : debug_function option;
    (*

    Debug function used to dump HTTP session. Use None to disable debug output.

    *)
  3. timeout : int option;
    (*

    Global timeout. None defaults to no timeout.

    *)
  4. connect_timeout : int option;
    (*

    Connection timeout. None defaults to 300 seconds.

    *)
  5. compress : bool;
    (*

    Compress requests. (Not yet supported)

    *)
  6. auth : auth_config;
    (*

    Authorization configuration.

    *)
  7. upload_chunk_size : int;
    (*

    Chunk default size (in bytes) used by resumable upload. Should be a multiple of 512KB.

    *)
  8. max_send_speed : int64;
    (*

    If an upload exceeds this speed (counted in bytes per second) on cumulative average during the transfer, the transfer will pause to keep the average rate less than or equal to the parameter value. Defaults to unlimited speed.

    *)
  9. max_recv_speed : int64;
    (*

    If a download exceeds this speed (counted in bytes per second) on cumulative average during the transfer, the transfer will pause to keep the average rate less than or equal to the parameter value. Defaults to unlimited speed.

    *)
  10. low_speed_limit : int;
    (*

    It contains the average transfer speed in bytes per second that the transfer should be below during low_speed_time seconds for libcurl to consider it to be too slow and abort. Defaults to 0 (disabled).

    *)
  11. low_speed_time : int;
    (*

    It contains the time in number seconds that the transfer speed should be below the low_speed_limit for the library to consider it too slow and abort. Defaults to 0 (disabled).

    *)
  12. curl_no_signal : bool;
    (*

    If true, libcurl will not use any functions that install signal handlers or any functions that cause signals to be sent to the process. This option is here to allow multi-threaded unix applications to still set/use all timeout options etc, without risking getting signals. Defaults to true.

    *)
  13. proxy : string option;
    (*

    Set the proxy to use. The parameter should be a string holding the host name or dotted numerical IP address. A numerical IPv6 address must be written within brackets. Defaults to None. To specify port number in this string, append :port to the end of the host name.

    *)
  14. ssl_verifypeer : bool;
    (*

    When ssl_verifypeer is enabled, and the verification fails to prove that the certificate is authentic, the connection fails. When the option is disabled, the peer certificate verification succeeds regardless. Defaults to true.

    *)
}

Library configuration.

Sourceval application_name : (t, string) GapiLens.t

Application name lens.

Sourceval debug : (t, debug_function option) GapiLens.t

Debug function lens.

Sourceval timeout : (t, int option) GapiLens.t

Timeout lens.

Sourceval connect_timeout : (t, int option) GapiLens.t

Connection timeout lens.

Sourceval compress : (t, bool) GapiLens.t

Compression flag lens.

Authorization configuration lens.

Sourceval upload_chunk_size : (t, int) GapiLens.t

Upload chunk size lens.

Sourceval max_send_speed : (t, int64) GapiLens.t

Max send speed lens.

Sourceval max_recv_speed : (t, int64) GapiLens.t

Max receive speed lens.

Sourceval low_speed_limit : (t, int) GapiLens.t

Low speed limit lens.

Sourceval low_speed_time : (t, int) GapiLens.t

Low speed time lens.

Sourceval default : t

Default configuration.

  let default =
    {
      application_name = "gapi-ocaml";
      debug = None;
      timeout = None;
      connect_timeout = None;
      compress = true;
      auth = NoAuth;
      upload_chunk_size = 10485760;
      (* 10MB *)
      max_send_speed = 0L;
      max_recv_speed = 0L;
      low_speed_limit = 0;
      low_speed_time = 0;
    }
Sourceval default_debug : t

Default configuration with debug output enabled.

  let default_debug =
    {
      application_name = "gapi-ocaml";
      debug = Some Standard;
      timeout = None;
      connect_timeout = None;
      compress = false;
      auth = NoAuth;
      upload_chunk_size = 10485760;
      (* 10MB *)
      max_send_speed = 0L;
      max_recv_speed = 0L;
      low_speed_limit = 0;
      low_speed_time = 0;
    }
OCaml

Innovation. Community. Security.