package gapi-ocaml

  1. Overview
  2. Docs
A simple OCaml client for Google Services

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.4.8.tar.gz
sha256=5cc769af46198deb88707ccb50398088316e60f51db8c36389e6a2aae4c2ad30
md5=d918a22fde1b1d49a9783fb2f932d059

doc/src/gapi-ocaml/gapiConfig.ml.html

Source file gapiConfig.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
type debug_function =
  | Standard
  | Custom of (Curl.t -> Curl.curlDebugType -> string -> unit)

type client_login_config = { username : string; password : string }

let username =
  {
    GapiLens.get = (fun x -> x.username);
    GapiLens.set = (fun v x -> { x with username = v });
  }

let password =
  {
    GapiLens.get = (fun x -> x.password);
    GapiLens.set = (fun v x -> { x with password = v });
  }

type oauth1_config = {
  signature_method : GapiCore.SignatureMethod.t;
  consumer_key : string;
  consumer_secret : string;
}

let signature_method =
  {
    GapiLens.get = (fun x -> x.signature_method);
    GapiLens.set = (fun v x -> { x with signature_method = v });
  }

let consumer_key =
  {
    GapiLens.get = (fun x -> x.consumer_key);
    GapiLens.set = (fun v x -> { x with consumer_key = v });
  }

let consumer_secret =
  {
    GapiLens.get = (fun x -> x.consumer_secret);
    GapiLens.set = (fun v x -> { x with consumer_secret = v });
  }

type oauth2_config = {
  client_id : string;
  client_secret : string;
  refresh_access_token : (unit -> string) option;
}

let client_id =
  {
    GapiLens.get = (fun x -> x.client_id);
    GapiLens.set = (fun v x -> { x with client_id = v });
  }

let client_secret =
  {
    GapiLens.get = (fun x -> x.client_secret);
    GapiLens.set = (fun v x -> { x with client_secret = v });
  }

let refresh_access_token =
  {
    GapiLens.get = (fun x -> x.refresh_access_token);
    GapiLens.set = (fun v x -> { x with refresh_access_token = v });
  }

type oauth2_service_account_config = {
  service_account_credentials_json : string;
  scopes : string list;
  user_to_impersonate : string option;
  refresh_service_account_access_token : (unit -> string) option;
}

let service_account_credentials_json =
  {
    GapiLens.get = (fun x -> x.service_account_credentials_json);
    GapiLens.set = (fun v x -> { x with service_account_credentials_json = v });
  }

let scopes =
  {
    GapiLens.get = (fun x -> x.scopes);
    GapiLens.set = (fun v x -> { x with scopes = v });
  }

let user_to_impersonate =
  {
    GapiLens.get = (fun x -> x.user_to_impersonate);
    GapiLens.set = (fun v x -> { x with user_to_impersonate = v });
  }

let refresh_service_account_access_token =
  {
    GapiLens.get = (fun x -> x.refresh_service_account_access_token);
    GapiLens.set =
      (fun v x -> { x with refresh_service_account_access_token = v });
  }

type auth_config =
  | NoAuth
  | ClientLogin of client_login_config
  | OAuth1 of oauth1_config
  | OAuth2 of oauth2_config
  | OAuth2ServiceAccount of oauth2_service_account_config

(* TODO: proxy config? ip, port, user+pwd *)
type t = {
  application_name : string;
  debug : debug_function option;
  timeout : int option;
  connect_timeout : int option;
  compress : bool;
  auth : auth_config;
  upload_chunk_size : int;
  max_send_speed : int64;
  max_recv_speed : int64;
  low_speed_limit : int;
  low_speed_time : int;
  curl_no_signal : bool;
  proxy : string option;
  ssl_verifypeer : bool;
}

let application_name =
  {
    GapiLens.get = (fun x -> x.application_name);
    GapiLens.set = (fun v x -> { x with application_name = v });
  }

let debug =
  {
    GapiLens.get = (fun x -> x.debug);
    GapiLens.set = (fun v x -> { x with debug = v });
  }

let timeout =
  {
    GapiLens.get = (fun x -> x.timeout);
    GapiLens.set = (fun v x -> { x with timeout = v });
  }

let connect_timeout =
  {
    GapiLens.get = (fun x -> x.connect_timeout);
    GapiLens.set = (fun v x -> { x with connect_timeout = v });
  }

let compress =
  {
    GapiLens.get = (fun x -> x.compress);
    GapiLens.set = (fun v x -> { x with compress = v });
  }

let auth =
  {
    GapiLens.get = (fun x -> x.auth);
    GapiLens.set = (fun v x -> { x with auth = v });
  }

let upload_chunk_size =
  {
    GapiLens.get = (fun x -> x.upload_chunk_size);
    GapiLens.set = (fun v x -> { x with upload_chunk_size = v });
  }

let max_send_speed =
  {
    GapiLens.get = (fun x -> x.max_send_speed);
    GapiLens.set = (fun v x -> { x with max_send_speed = v });
  }

let max_recv_speed =
  {
    GapiLens.get = (fun x -> x.max_recv_speed);
    GapiLens.set = (fun v x -> { x with max_recv_speed = v });
  }

let low_speed_limit =
  {
    GapiLens.get = (fun x -> x.low_speed_limit);
    GapiLens.set = (fun v x -> { x with low_speed_limit = v });
  }

let low_speed_time =
  {
    GapiLens.get = (fun x -> x.low_speed_time);
    GapiLens.set = (fun v x -> { x with low_speed_time = v });
  }

let curl_no_signal =
  {
    GapiLens.get = (fun x -> x.curl_no_signal);
    GapiLens.set = (fun v x -> { x with curl_no_signal = v });
  }

let proxy =
  {
    GapiLens.get = (fun x -> x.proxy);
    GapiLens.set = (fun v x -> { x with proxy = v });
  }

let ssl_verifypeer =
  {
    GapiLens.get = (fun x -> x.ssl_verifypeer);
    GapiLens.set = (fun v x -> { x with ssl_verifypeer = v });
  }

let default =
  {
    application_name = "gapi-ocaml";
    debug = None;
    timeout = None;
    connect_timeout = None;
    compress = true;
    auth = NoAuth;
    upload_chunk_size = 10485760;
    max_send_speed = 0L;
    max_recv_speed = 0L;
    low_speed_limit = 0;
    low_speed_time = 0;
    curl_no_signal = true;
    proxy = None;
    ssl_verifypeer = true;
  }

let default_debug =
  {
    application_name = "gapi-ocaml";
    debug = Some Standard;
    timeout = None;
    connect_timeout = None;
    compress = false;
    auth = NoAuth;
    upload_chunk_size = 10485760;
    max_send_speed = 0L;
    max_recv_speed = 0L;
    low_speed_limit = 0;
    low_speed_time = 0;
    curl_no_signal = true;
    proxy = None;
    ssl_verifypeer = true;
  }