Class: Lockally::DraftsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/lockally/api/drafts_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ DraftsApi

Returns a new instance of DraftsApi.



19
20
21
# File 'lib/lockally/api/drafts_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/lockally/api/drafts_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#v1_drafts_draft_id_approve_post(draft_id, opts = {}) ⇒ Object

Approve a pending draft (human) Sends the draft exactly as reviewed, through the agent stream (loop detector included). Fires draft.approved.

Parameters:

  • draft_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


27
28
29
30
# File 'lib/lockally/api/drafts_api.rb', line 27

def v1_drafts_draft_id_approve_post(draft_id, opts = {})
  data, _status_code, _headers = v1_drafts_draft_id_approve_post_with_http_info(draft_id, opts)
  data
end

#v1_drafts_draft_id_approve_post_with_http_info(draft_id, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Approve a pending draft (human) Sends the draft exactly as reviewed, through the agent stream (loop detector included). Fires draft.approved.

Parameters:

  • draft_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



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
# File 'lib/lockally/api/drafts_api.rb', line 37

def v1_drafts_draft_id_approve_post_with_http_info(draft_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DraftsApi.v1_drafts_draft_id_approve_post ...'
  end
  # verify the required parameter 'draft_id' is set
  if @api_client.config.client_side_validation && draft_id.nil?
    fail ArgumentError, "Missing the required parameter 'draft_id' when calling DraftsApi.v1_drafts_draft_id_approve_post"
  end
  # resource path
  local_var_path = '/v1/drafts/{draftID}/approve'.sub('{draftID}', CGI.escape(draft_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"DraftsApi.v1_drafts_draft_id_approve_post",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DraftsApi#v1_drafts_draft_id_approve_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#v1_drafts_draft_id_cancel_post(draft_id, opts = {}) ⇒ Object

Withdraw a pending draft Only the API key that created the draft may cancel it.

Parameters:

  • draft_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


90
91
92
93
# File 'lib/lockally/api/drafts_api.rb', line 90

def v1_drafts_draft_id_cancel_post(draft_id, opts = {})
  data, _status_code, _headers = v1_drafts_draft_id_cancel_post_with_http_info(draft_id, opts)
  data
end

#v1_drafts_draft_id_cancel_post_with_http_info(draft_id, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Withdraw a pending draft Only the API key that created the draft may cancel it.

Parameters:

  • draft_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



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
# File 'lib/lockally/api/drafts_api.rb', line 100

def v1_drafts_draft_id_cancel_post_with_http_info(draft_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DraftsApi.v1_drafts_draft_id_cancel_post ...'
  end
  # verify the required parameter 'draft_id' is set
  if @api_client.config.client_side_validation && draft_id.nil?
    fail ArgumentError, "Missing the required parameter 'draft_id' when calling DraftsApi.v1_drafts_draft_id_cancel_post"
  end
  # resource path
  local_var_path = '/v1/drafts/{draftID}/cancel'.sub('{draftID}', CGI.escape(draft_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"DraftsApi.v1_drafts_draft_id_cancel_post",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DraftsApi#v1_drafts_draft_id_cancel_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#v1_drafts_draft_id_get(draft_id, opts = {}) ⇒ Object

Get a draft

Parameters:

  • draft_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


152
153
154
155
# File 'lib/lockally/api/drafts_api.rb', line 152

def v1_drafts_draft_id_get(draft_id, opts = {})
  data, _status_code, _headers = v1_drafts_draft_id_get_with_http_info(draft_id, opts)
  data
end

#v1_drafts_draft_id_get_with_http_info(draft_id, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Get a draft

Parameters:

  • draft_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



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
# File 'lib/lockally/api/drafts_api.rb', line 161

def v1_drafts_draft_id_get_with_http_info(draft_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DraftsApi.v1_drafts_draft_id_get ...'
  end
  # verify the required parameter 'draft_id' is set
  if @api_client.config.client_side_validation && draft_id.nil?
    fail ArgumentError, "Missing the required parameter 'draft_id' when calling DraftsApi.v1_drafts_draft_id_get"
  end
  # resource path
  local_var_path = '/v1/drafts/{draftID}'.sub('{draftID}', CGI.escape(draft_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"DraftsApi.v1_drafts_draft_id_get",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DraftsApi#v1_drafts_draft_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#v1_drafts_draft_id_reject_post(draft_id, opts = {}) ⇒ Object

Reject a pending draft (human) Body: \"...\" (optional). Fires draft.rejected.

Parameters:

  • draft_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


214
215
216
217
# File 'lib/lockally/api/drafts_api.rb', line 214

def v1_drafts_draft_id_reject_post(draft_id, opts = {})
  data, _status_code, _headers = v1_drafts_draft_id_reject_post_with_http_info(draft_id, opts)
  data
end

#v1_drafts_draft_id_reject_post_with_http_info(draft_id, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Reject a pending draft (human) Body: \"...\" (optional). Fires draft.rejected.

Parameters:

  • draft_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# File 'lib/lockally/api/drafts_api.rb', line 224

def v1_drafts_draft_id_reject_post_with_http_info(draft_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DraftsApi.v1_drafts_draft_id_reject_post ...'
  end
  # verify the required parameter 'draft_id' is set
  if @api_client.config.client_side_validation && draft_id.nil?
    fail ArgumentError, "Missing the required parameter 'draft_id' when calling DraftsApi.v1_drafts_draft_id_reject_post"
  end
  # resource path
  local_var_path = '/v1/drafts/{draftID}/reject'.sub('{draftID}', CGI.escape(draft_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"DraftsApi.v1_drafts_draft_id_reject_post",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DraftsApi#v1_drafts_draft_id_reject_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#v1_drafts_get(opts = {}) ⇒ Object

List drafts Filter with ?status=pending_approval|sent|rejected|cancelled. Keys see drafts of granted mailboxes; admin sessions see all.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :status (String)
  • :limit (Integer) — default: default to 50

Returns:

  • (Object)


278
279
280
281
# File 'lib/lockally/api/drafts_api.rb', line 278

def v1_drafts_get(opts = {})
  data, _status_code, _headers = v1_drafts_get_with_http_info(opts)
  data
end

#v1_drafts_get_with_http_info(opts = {}) ⇒ Array<(Object, Integer, Hash)>

List drafts Filter with ?status=pending_approval|sent|rejected|cancelled. Keys see drafts of granted mailboxes; admin sessions see all.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :status (String)
  • :limit (Integer) — default: default to 50

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/lockally/api/drafts_api.rb', line 289

def v1_drafts_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DraftsApi.v1_drafts_get ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 200
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DraftsApi.v1_drafts_get, must be smaller than or equal to 200.'
  end

  # resource path
  local_var_path = '/v1/drafts'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"DraftsApi.v1_drafts_get",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DraftsApi#v1_drafts_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#v1_inboxes_mailbox_drafts_post(mailbox, idempotency_key, opts = {}) ⇒ Object

Propose a new conversation as a draft New-conversation drafts ALWAYS require human approval (policy flag new_thread). Idempotency-Key required.

Parameters:

  • mailbox (String)
  • idempotency_key (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


345
346
347
348
# File 'lib/lockally/api/drafts_api.rb', line 345

def v1_inboxes_mailbox_drafts_post(mailbox, idempotency_key, opts = {})
  data, _status_code, _headers = v1_inboxes_mailbox_drafts_post_with_http_info(mailbox, idempotency_key, opts)
  data
end

#v1_inboxes_mailbox_drafts_post_with_http_info(mailbox, idempotency_key, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Propose a new conversation as a draft New-conversation drafts ALWAYS require human approval (policy flag new_thread). Idempotency-Key required.

Parameters:

  • mailbox (String)
  • idempotency_key (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
# File 'lib/lockally/api/drafts_api.rb', line 356

def v1_inboxes_mailbox_drafts_post_with_http_info(mailbox, idempotency_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DraftsApi.v1_inboxes_mailbox_drafts_post ...'
  end
  # verify the required parameter 'mailbox' is set
  if @api_client.config.client_side_validation && mailbox.nil?
    fail ArgumentError, "Missing the required parameter 'mailbox' when calling DraftsApi.v1_inboxes_mailbox_drafts_post"
  end
  # verify the required parameter 'idempotency_key' is set
  if @api_client.config.client_side_validation && idempotency_key.nil?
    fail ArgumentError, "Missing the required parameter 'idempotency_key' when calling DraftsApi.v1_inboxes_mailbox_drafts_post"
  end
  if @api_client.config.client_side_validation && idempotency_key.to_s.length > 255
    fail ArgumentError, 'invalid value for "idempotency_key" when calling DraftsApi.v1_inboxes_mailbox_drafts_post, the character length must be smaller than or equal to 255.'
  end

  # resource path
  local_var_path = '/v1/inboxes/{mailbox}/drafts'.sub('{mailbox}', CGI.escape(mailbox.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'Idempotency-Key'] = idempotency_key

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"DraftsApi.v1_inboxes_mailbox_drafts_post",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DraftsApi#v1_inboxes_mailbox_drafts_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#v1_threads_thread_id_drafts_post(thread_id, idempotency_key, opts = {}) ⇒ Object

Propose a reply as a draft The safe default over /reply: the deterministic policy engine auto-sends clean in-thread replies and holds anything risky (PII, new recipients, injection-flagged threads, always-approve mailboxes) for human approval. Fires draft.pending_approval when held. Idempotency-Key required.

Parameters:

  • thread_id (String)
  • idempotency_key (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


419
420
421
422
# File 'lib/lockally/api/drafts_api.rb', line 419

def v1_threads_thread_id_drafts_post(thread_id, idempotency_key, opts = {})
  data, _status_code, _headers = v1_threads_thread_id_drafts_post_with_http_info(thread_id, idempotency_key, opts)
  data
end

#v1_threads_thread_id_drafts_post_with_http_info(thread_id, idempotency_key, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Propose a reply as a draft The safe default over /reply: the deterministic policy engine auto-sends clean in-thread replies and holds anything risky (PII, new recipients, injection-flagged threads, always-approve mailboxes) for human approval. Fires draft.pending_approval when held. Idempotency-Key required.

Parameters:

  • thread_id (String)
  • idempotency_key (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
# File 'lib/lockally/api/drafts_api.rb', line 430

def v1_threads_thread_id_drafts_post_with_http_info(thread_id, idempotency_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DraftsApi.v1_threads_thread_id_drafts_post ...'
  end
  # verify the required parameter 'thread_id' is set
  if @api_client.config.client_side_validation && thread_id.nil?
    fail ArgumentError, "Missing the required parameter 'thread_id' when calling DraftsApi.v1_threads_thread_id_drafts_post"
  end
  # verify the required parameter 'idempotency_key' is set
  if @api_client.config.client_side_validation && idempotency_key.nil?
    fail ArgumentError, "Missing the required parameter 'idempotency_key' when calling DraftsApi.v1_threads_thread_id_drafts_post"
  end
  if @api_client.config.client_side_validation && idempotency_key.to_s.length > 255
    fail ArgumentError, 'invalid value for "idempotency_key" when calling DraftsApi.v1_threads_thread_id_drafts_post, the character length must be smaller than or equal to 255.'
  end

  # resource path
  local_var_path = '/v1/threads/{threadID}/drafts'.sub('{threadID}', CGI.escape(thread_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'Idempotency-Key'] = idempotency_key

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"DraftsApi.v1_threads_thread_id_drafts_post",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DraftsApi#v1_threads_thread_id_drafts_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end