invoist 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1598 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Code generated by script/generate.rb from openapi.yaml. DO NOT EDIT.
4
+ # Regenerate with `rake generate`.
5
+
6
+ module Invoist
7
+ # The API's response types, generated from its OpenAPI description.
8
+ #
9
+ # Every model is an immutable `Data` object with a reader per field, named
10
+ # as the API sends it. Fields the API omits are `nil`; fields this version
11
+ # does not know are ignored. Money is always an Integer of minor units.
12
+ module Models
13
+ # The values of DocumentStatus.
14
+ module DocumentStatus
15
+ # `pending`
16
+ PENDING = "pending"
17
+ # `processing`
18
+ PROCESSING = "processing"
19
+ # `done`
20
+ DONE = "done"
21
+ # `failed`
22
+ FAILED = "failed"
23
+ # Every value, in the order the API documents them.
24
+ ALL = [PENDING, PROCESSING, DONE, FAILED].freeze
25
+ end
26
+
27
+ # How the document arrived.
28
+ module DocumentSource
29
+ # `api`
30
+ API = "api"
31
+ # `dashboard`
32
+ DASHBOARD = "dashboard"
33
+ # `email`
34
+ EMAIL = "email"
35
+ # `storage`
36
+ STORAGE = "storage"
37
+ # `sandbox`
38
+ SANDBOX = "sandbox"
39
+ # Every value, in the order the API documents them.
40
+ ALL = [API, DASHBOARD, EMAIL, STORAGE, SANDBOX].freeze
41
+ end
42
+
43
+ # The values of ExtractionStatus.
44
+ module ExtractionStatus
45
+ # `pending`
46
+ PENDING = "pending"
47
+ # `done`
48
+ DONE = "done"
49
+ # `failed`
50
+ FAILED = "failed"
51
+ # Every value, in the order the API documents them.
52
+ ALL = [PENDING, DONE, FAILED].freeze
53
+ end
54
+
55
+ # The values of ReviewStatus.
56
+ module ReviewStatus
57
+ # `pending`
58
+ PENDING = "pending"
59
+ # `resolved`
60
+ RESOLVED = "resolved"
61
+ # `dismissed`
62
+ DISMISSED = "dismissed"
63
+ # Every value, in the order the API documents them.
64
+ ALL = [PENDING, RESOLVED, DISMISSED].freeze
65
+ end
66
+
67
+ # Why the item was flagged.
68
+ module ReviewReason
69
+ # `low_confidence`
70
+ LOW_CONFIDENCE = "low_confidence"
71
+ # `total_mismatch`
72
+ TOTAL_MISMATCH = "total_mismatch"
73
+ # `poor_quality`
74
+ POOR_QUALITY = "poor_quality"
75
+ # `duplicate`
76
+ DUPLICATE = "duplicate"
77
+ # `unusual_vendor`
78
+ UNUSUAL_VENDOR = "unusual_vendor"
79
+ # `bank_details_changed`
80
+ BANK_DETAILS_CHANGED = "bank_details_changed"
81
+ # `amount_anomaly`
82
+ AMOUNT_ANOMALY = "amount_anomaly"
83
+ # `amount_over_limit`
84
+ AMOUNT_OVER_LIMIT = "amount_over_limit"
85
+ # `missing_po_number`
86
+ MISSING_PO_NUMBER = "missing_po_number"
87
+ # Every value, in the order the API documents them.
88
+ ALL = [
89
+ LOW_CONFIDENCE,
90
+ TOTAL_MISMATCH,
91
+ POOR_QUALITY,
92
+ DUPLICATE,
93
+ UNUSUAL_VENDOR,
94
+ BANK_DETAILS_CHANGED,
95
+ AMOUNT_ANOMALY,
96
+ AMOUNT_OVER_LIMIT,
97
+ MISSING_PO_NUMBER
98
+ ].freeze
99
+ end
100
+
101
+ # What a document is. Null is an ordinary invoice.
102
+ module BillKind
103
+ # `invoice`
104
+ INVOICE = "invoice"
105
+ # `reminder`
106
+ REMINDER = "reminder"
107
+ # `debt_collection`
108
+ DEBT_COLLECTION = "debt_collection"
109
+ # `credit_note`
110
+ CREDIT_NOTE = "credit_note"
111
+ # `receipt`
112
+ RECEIPT = "receipt"
113
+ # `payment_confirmation`
114
+ PAYMENT_CONFIRMATION = "payment_confirmation"
115
+ # Every value, in the order the API documents them.
116
+ ALL = [INVOICE, REMINDER, DEBT_COLLECTION, CREDIT_NOTE, RECEIPT, PAYMENT_CONFIRMATION].freeze
117
+ end
118
+
119
+ # A `ErrorDetail`, as the API returns it.
120
+ #
121
+ # @!attribute [r] code
122
+ # @return [String] A stable machine-readable identifier. Branch on
123
+ # this, not the message.
124
+ # @!attribute [r] message
125
+ # @return [String] Human-readable explanation. Wording may change; do
126
+ # not parse it.
127
+ ErrorDetail = Data.define(
128
+ :code,
129
+ :message
130
+ ) do
131
+ include Model
132
+ end
133
+
134
+ # One file's outcome from POST /v1/extract/batch. A rejected file carries
135
+ # `error` and omits the document fields; an accepted one carries the
136
+ # document fields and omits `error`.
137
+ #
138
+ # @!attribute [r] filename
139
+ # @return [String]
140
+ # @!attribute [r] document_id
141
+ # @return [String, nil]
142
+ # @!attribute [r] extraction_id
143
+ # @return [String, nil]
144
+ # @!attribute [r] status
145
+ # @return [String, nil]
146
+ # @!attribute [r] duplicate
147
+ # @return [Boolean, nil] True when this file's bytes were already
148
+ # extracted in this workspace.
149
+ # @!attribute [r] error
150
+ # @return [ErrorDetail, nil] Present only when this file was rejected.
151
+ BatchResultItem = Data.define(
152
+ :filename,
153
+ :document_id,
154
+ :extraction_id,
155
+ :status,
156
+ :duplicate,
157
+ :error
158
+ ) do
159
+ include Model
160
+
161
+ # @api private
162
+ def self.nested_types
163
+ {
164
+ error: ErrorDetail
165
+ }
166
+ end
167
+ end
168
+
169
+ # A `Document`, as the API returns it.
170
+ #
171
+ # @!attribute [r] id
172
+ # @return [String]
173
+ # @!attribute [r] source
174
+ # @return [String]
175
+ # @!attribute [r] original_filename
176
+ # @return [String]
177
+ # @!attribute [r] content_type
178
+ # @return [String]
179
+ # @!attribute [r] byte_size
180
+ # @return [Integer]
181
+ # @!attribute [r] status
182
+ # @return [String]
183
+ # @!attribute [r] approval
184
+ # @return [DocumentApproval, nil]
185
+ # @!attribute [r] created_at
186
+ # @return [String]
187
+ # @!attribute [r] updated_at
188
+ # @return [String]
189
+ Document = Data.define(
190
+ :id,
191
+ :source,
192
+ :original_filename,
193
+ :content_type,
194
+ :byte_size,
195
+ :status,
196
+ :approval,
197
+ :created_at,
198
+ :updated_at
199
+ ) do
200
+ include Model
201
+
202
+ # @api private
203
+ def self.nested_types
204
+ {
205
+ approval: DocumentApproval
206
+ }
207
+ end
208
+ end
209
+
210
+ # Sign-off state. Separate from `status`, which tracks extraction: this is
211
+ # a person's judgement, that is the machine's progress. Always "draft"
212
+ # unless the workspace has an approval mode switched on.
213
+ #
214
+ # @!attribute [r] state
215
+ # @return [String] One of `draft`, `ready`, `approved`,
216
+ # `changes_requested`.
217
+ # @!attribute [r] submitted_by
218
+ # @return [String, nil]
219
+ # @!attribute [r] submitted_by_name
220
+ # @return [String, nil] Captured at the time, so it survives the
221
+ # person leaving.
222
+ # @!attribute [r] submitted_at
223
+ # @return [String, nil]
224
+ # @!attribute [r] approved_by
225
+ # @return [String, nil]
226
+ # @!attribute [r] approved_by_name
227
+ # @return [String, nil]
228
+ # @!attribute [r] approved_at
229
+ # @return [String, nil]
230
+ DocumentApproval = Data.define(
231
+ :state,
232
+ :submitted_by,
233
+ :submitted_by_name,
234
+ :submitted_at,
235
+ :approved_by,
236
+ :approved_by_name,
237
+ :approved_at
238
+ ) do
239
+ include Model
240
+ end
241
+
242
+ # A document plus a flat summary of its latest extraction.
243
+ #
244
+ # @!attribute [r] id
245
+ # @return [String]
246
+ # @!attribute [r] source
247
+ # @return [String]
248
+ # @!attribute [r] original_filename
249
+ # @return [String]
250
+ # @!attribute [r] content_type
251
+ # @return [String]
252
+ # @!attribute [r] byte_size
253
+ # @return [Integer]
254
+ # @!attribute [r] status
255
+ # @return [String]
256
+ # @!attribute [r] vendor_name
257
+ # @return [String, nil]
258
+ # @!attribute [r] invoice_number
259
+ # @return [String, nil]
260
+ # @!attribute [r] reference_number
261
+ # @return [String, nil]
262
+ # @!attribute [r] total_cents
263
+ # @return [Integer, nil]
264
+ # @!attribute [r] base_currency
265
+ # @return [String, nil] The workspace's reporting currency, when one
266
+ # is configured. Null when conversion is off, or when this invoice's
267
+ # currency had no published rate for its date. The invoice's own
268
+ # currency and total_cents remain authoritative.
269
+ # @!attribute [r] base_total_cents
270
+ # @return [Integer, nil] total_cents converted into base_currency, for
271
+ # reporting only.
272
+ # @!attribute [r] fx_rate
273
+ # @return [String, nil] Reporting-currency units per one unit of the
274
+ # invoice currency, as a decimal string so the exact stored value
275
+ # round-trips.
276
+ # @!attribute [r] fx_rate_date
277
+ # @return [String, nil] The date of the published rates used, which is
278
+ # the invoice date or the most recent publication before it.
279
+ # @!attribute [r] fx_source
280
+ # @return [String, nil] Who published the rate, e.g. "ecb".
281
+ # @!attribute [r] currency
282
+ # @return [String, nil]
283
+ # @!attribute [r] category_id
284
+ # @return [String, nil]
285
+ # @!attribute [r] category_name
286
+ # @return [String, nil]
287
+ # @!attribute [r] pending_review
288
+ # @return [Integer] Count of unresolved review items.
289
+ # @!attribute [r] flagged
290
+ # @return [Boolean] True when pending_review is above zero.
291
+ # @!attribute [r] created_at
292
+ # @return [String]
293
+ # @!attribute [r] updated_at
294
+ # @return [String]
295
+ DocumentListItem = Data.define(
296
+ :id,
297
+ :source,
298
+ :original_filename,
299
+ :content_type,
300
+ :byte_size,
301
+ :status,
302
+ :vendor_name,
303
+ :invoice_number,
304
+ :reference_number,
305
+ :total_cents,
306
+ :base_currency,
307
+ :base_total_cents,
308
+ :fx_rate,
309
+ :fx_rate_date,
310
+ :fx_source,
311
+ :currency,
312
+ :category_id,
313
+ :category_name,
314
+ :pending_review,
315
+ :flagged,
316
+ :created_at,
317
+ :updated_at
318
+ ) do
319
+ include Model
320
+ end
321
+
322
+ # A `Extraction`, as the API returns it.
323
+ #
324
+ # @!attribute [r] id
325
+ # @return [String]
326
+ # @!attribute [r] document_id
327
+ # @return [String]
328
+ # @!attribute [r] engine
329
+ # @return [String]
330
+ # @!attribute [r] status
331
+ # @return [String]
332
+ # @!attribute [r] document_kind
333
+ # @return [String, nil] What the document is. Null when the reader
334
+ # could not tell, and on documents read before this field existed;
335
+ # treat null as an ordinary invoice. One of `invoice`, `reminder`,
336
+ # `debt_collection`, `credit_note`, `receipt`, `payment_confirmation`.
337
+ # @!attribute [r] invoice_number
338
+ # @return [String, nil]
339
+ # @!attribute [r] invoice_date
340
+ # @return [String, nil] Absent when not printed on the document.
341
+ # @!attribute [r] due_date
342
+ # @return [String, nil] Absent when not printed on the document.
343
+ # @!attribute [r] po_number
344
+ # @return [String, nil]
345
+ # @!attribute [r] reference_number
346
+ # @return [String, nil] The payment or bank reference, distinct from
347
+ # the invoice number.
348
+ # @!attribute [r] vendor_name
349
+ # @return [String, nil]
350
+ # @!attribute [r] vendor_address
351
+ # @return [String, nil]
352
+ # @!attribute [r] customer_name
353
+ # @return [String, nil]
354
+ # @!attribute [r] currency
355
+ # @return [String, nil] ISO 4217 code, e.g. EUR.
356
+ # @!attribute [r] subtotal_cents
357
+ # @return [Integer, nil]
358
+ # @!attribute [r] tax_cents
359
+ # @return [Integer, nil]
360
+ # @!attribute [r] total_cents
361
+ # @return [Integer, nil]
362
+ # @!attribute [r] base_currency
363
+ # @return [String, nil] The workspace's reporting currency, when one
364
+ # is configured. Null when conversion is off, or when this invoice's
365
+ # currency had no published rate for its date.
366
+ # @!attribute [r] base_total_cents
367
+ # @return [Integer, nil] total_cents converted into base_currency, for
368
+ # reporting only.
369
+ # @!attribute [r] fx_rate
370
+ # @return [String, nil] Reporting-currency units per one unit of the
371
+ # invoice currency, as a decimal string.
372
+ # @!attribute [r] fx_rate_date
373
+ # @return [String, nil] The date of the published rates used.
374
+ # @!attribute [r] fx_source
375
+ # @return [String, nil] Who published the rate, e.g. "ecb".
376
+ # @!attribute [r] confidence
377
+ # @return [Hash{String => Object}, nil] Per-field confidence between 0
378
+ # and 1, keyed by field name.
379
+ # @!attribute [r] line_items
380
+ # @return [Array<LineItem>, nil]
381
+ # @!attribute [r] details
382
+ # @return [Hash{String => Object}, nil] Optional commercial extras
383
+ # (payment terms, tax IDs, IBAN, shipping). On a reminder, collection
384
+ # letter or credit note it also carries original_invoice_number,
385
+ # original_invoice_date, original_creditor, original_amount_cents,
386
+ # fees_cents and interest_cents: the earlier invoice it is about and
387
+ # what was added.
388
+ # @!attribute [r] fraud_indicators
389
+ # @return [Array<FraudIndicator>, nil] Heuristic observations worth a
390
+ # second look. Never a determination that a document is fraudulent.
391
+ # @!attribute [r] file_metadata
392
+ # @return [Hash{String => Object}, nil] Facts read from the file's own
393
+ # EXIF or PDF metadata, never inferred.
394
+ # @!attribute [r] custom
395
+ # @return [Array<CustomValue>, nil] Workspace-declared custom fields,
396
+ # filled during extraction.
397
+ # @!attribute [r] discoveries
398
+ # @return [Array<Discovery>, nil] Coordinate-pinned findings on the
399
+ # first page image.
400
+ # @!attribute [r] quality
401
+ # @return [Quality, nil]
402
+ # @!attribute [r] category_id
403
+ # @return [String, nil]
404
+ # @!attribute [r] category_source
405
+ # @return [String, nil] Who chose the category. One of `model`,
406
+ # `user`, `memory`.
407
+ # @!attribute [r] auto_approved
408
+ # @return [Boolean, nil] True when this skipped the review queue
409
+ # because the vendor had a clean track record.
410
+ # @!attribute [r] error_message
411
+ # @return [String, nil]
412
+ # @!attribute [r] created_at
413
+ # @return [String]
414
+ # @!attribute [r] updated_at
415
+ # @return [String]
416
+ # @!attribute [r] edited_at
417
+ # @return [String, nil] When a person last corrected these fields by
418
+ # hand. Absent if the extraction has never been edited, so its
419
+ # presence is how you tell a human-reviewed record from a purely
420
+ # automatic one.
421
+ Extraction = Data.define(
422
+ :id,
423
+ :document_id,
424
+ :engine,
425
+ :status,
426
+ :document_kind,
427
+ :invoice_number,
428
+ :invoice_date,
429
+ :due_date,
430
+ :po_number,
431
+ :reference_number,
432
+ :vendor_name,
433
+ :vendor_address,
434
+ :customer_name,
435
+ :currency,
436
+ :subtotal_cents,
437
+ :tax_cents,
438
+ :total_cents,
439
+ :base_currency,
440
+ :base_total_cents,
441
+ :fx_rate,
442
+ :fx_rate_date,
443
+ :fx_source,
444
+ :confidence,
445
+ :line_items,
446
+ :details,
447
+ :fraud_indicators,
448
+ :file_metadata,
449
+ :custom,
450
+ :discoveries,
451
+ :quality,
452
+ :category_id,
453
+ :category_source,
454
+ :auto_approved,
455
+ :error_message,
456
+ :created_at,
457
+ :updated_at,
458
+ :edited_at
459
+ ) do
460
+ include Model
461
+
462
+ # @api private
463
+ def self.nested_types
464
+ {
465
+ line_items: [LineItem],
466
+ fraud_indicators: [FraudIndicator],
467
+ custom: [CustomValue],
468
+ discoveries: [Discovery],
469
+ quality: Quality
470
+ }
471
+ end
472
+ end
473
+
474
+ # Progress of the background run that produces an extraction. Reading a
475
+ # document is queued work, so this reports how that work is going: whether
476
+ # it is waiting, running, finished, or has given up.
477
+ #
478
+ # @!attribute [r] status
479
+ # @return [String] `queued` is waiting for a worker, which includes
480
+ # waiting out the backoff between attempts. `failed` means every
481
+ # attempt was used or the failure was one that retrying cannot fix.
482
+ # One of `queued`, `running`, `succeeded`, `failed`.
483
+ # @!attribute [r] attempt_count
484
+ # @return [Integer] Attempts made so far, including the one currently
485
+ # running.
486
+ # @!attribute [r] max_attempts
487
+ # @return [Integer] Attempts allowed before the run is abandoned.
488
+ # Deliberately small, since every attempt is a real extraction.
489
+ # @!attribute [r] retryable
490
+ # @return [Boolean] True when the run has stopped and can be started
491
+ # again. Retrying is a fresh run and is billed as one.
492
+ # @!attribute [r] next_attempt_at
493
+ # @return [String, nil] When the next attempt is due. Present only
494
+ # while a retry is genuinely still coming, so its absence on a queued
495
+ # job means the job has not started yet rather than that it is
496
+ # stalled.
497
+ ExtractionJob = Data.define(
498
+ :status,
499
+ :attempt_count,
500
+ :max_attempts,
501
+ :retryable,
502
+ :next_attempt_at
503
+ ) do
504
+ include Model
505
+ end
506
+
507
+ # A `LineItem`, as the API returns it.
508
+ #
509
+ # @!attribute [r] description
510
+ # @return [String]
511
+ # @!attribute [r] quantity
512
+ # @return [Numeric]
513
+ # @!attribute [r] unit
514
+ # @return [String, nil]
515
+ # @!attribute [r] sku
516
+ # @return [String, nil]
517
+ # @!attribute [r] unit_price_cents
518
+ # @return [Integer, nil] Unit price in whole cents. Null when the
519
+ # price is not an exact number of cents, which happens on utility and
520
+ # fuel invoices priced per unit below one cent. Read unit_price_micros
521
+ # for those.
522
+ # @!attribute [r] unit_price_micros
523
+ # @return [Integer, nil] Unit price in millionths of one currency
524
+ # unit, exact for sub-cent prices. 8.72 cents per kWh is 87200. Set
525
+ # whenever a unit price is printed, including when unit_price_cents is
526
+ # also set.
527
+ # @!attribute [r] line_total_cents
528
+ # @return [Integer, nil]
529
+ # @!attribute [r] tax_cents
530
+ # @return [Integer, nil]
531
+ # @!attribute [r] discount_cents
532
+ # @return [Integer, nil]
533
+ LineItem = Data.define(
534
+ :description,
535
+ :quantity,
536
+ :unit,
537
+ :sku,
538
+ :unit_price_cents,
539
+ :unit_price_micros,
540
+ :line_total_cents,
541
+ :tax_cents,
542
+ :discount_cents
543
+ ) do
544
+ include Model
545
+ end
546
+
547
+ # A `FraudIndicator`, as the API returns it.
548
+ #
549
+ # @!attribute [r] signal
550
+ # @return [String] Model-reported signals are one of `math_mismatch`,
551
+ # `font_inconsistency`, `implausible_dates`, `round_total`,
552
+ # `vendor_details_off`, `possible_edit`. Engine-reported signals add
553
+ # `vendor_bank_change` and `vendor_amount_anomaly`.
554
+ # @!attribute [r] severity
555
+ # @return [String] One of `low`, `medium`, `high`.
556
+ # @!attribute [r] description
557
+ # @return [String]
558
+ # @!attribute [r] source
559
+ # @return [String] `model` when read off the page; `engine` when
560
+ # derived from workspace history. One of `model`, `engine`.
561
+ # @!attribute [r] page
562
+ # @return [Integer, nil] 1-based page number when the finding has a
563
+ # location.
564
+ # @!attribute [r] box
565
+ # @return [RegionBox, nil]
566
+ FraudIndicator = Data.define(
567
+ :signal,
568
+ :severity,
569
+ :description,
570
+ :source,
571
+ :page,
572
+ :box
573
+ ) do
574
+ include Model
575
+
576
+ # @api private
577
+ def self.nested_types
578
+ {
579
+ box: RegionBox
580
+ }
581
+ end
582
+ end
583
+
584
+ # A rectangle on the page image, normalized 0 to 1, origin top-left.
585
+ #
586
+ # @!attribute [r] x
587
+ # @return [Numeric]
588
+ # @!attribute [r] y
589
+ # @return [Numeric]
590
+ # @!attribute [r] w
591
+ # @return [Numeric]
592
+ # @!attribute [r] h
593
+ # @return [Numeric]
594
+ RegionBox = Data.define(
595
+ :x,
596
+ :y,
597
+ :w,
598
+ :h
599
+ ) do
600
+ include Model
601
+ end
602
+
603
+ # A `WebhookEndpoint`, as the API returns it.
604
+ #
605
+ # @!attribute [r] id
606
+ # @return [String]
607
+ # @!attribute [r] url
608
+ # @return [String]
609
+ # @!attribute [r] description
610
+ # @return [String]
611
+ # @!attribute [r] events
612
+ # @return [Array<String>] Subscribed event types; ["*"] means
613
+ # everything.
614
+ # @!attribute [r] enabled
615
+ # @return [Boolean]
616
+ # @!attribute [r] consecutive_failures
617
+ # @return [Integer]
618
+ # @!attribute [r] last_delivery_at
619
+ # @return [String, nil]
620
+ # @!attribute [r] last_status
621
+ # @return [Integer, nil]
622
+ # @!attribute [r] auto_disabled_at
623
+ # @return [String, nil] Set when repeated failures paused this
624
+ # endpoint automatically.
625
+ # @!attribute [r] created_at
626
+ # @return [String]
627
+ WebhookEndpoint = Data.define(
628
+ :id,
629
+ :url,
630
+ :description,
631
+ :events,
632
+ :enabled,
633
+ :consecutive_failures,
634
+ :last_delivery_at,
635
+ :last_status,
636
+ :auto_disabled_at,
637
+ :created_at
638
+ ) do
639
+ include Model
640
+ end
641
+
642
+ # A `WebhookEndpointWithSecret`, as the API returns it.
643
+ #
644
+ # @!attribute [r] id
645
+ # @return [String]
646
+ # @!attribute [r] url
647
+ # @return [String]
648
+ # @!attribute [r] description
649
+ # @return [String]
650
+ # @!attribute [r] events
651
+ # @return [Array<String>] Subscribed event types; ["*"] means
652
+ # everything.
653
+ # @!attribute [r] enabled
654
+ # @return [Boolean]
655
+ # @!attribute [r] consecutive_failures
656
+ # @return [Integer]
657
+ # @!attribute [r] last_delivery_at
658
+ # @return [String, nil]
659
+ # @!attribute [r] last_status
660
+ # @return [Integer, nil]
661
+ # @!attribute [r] auto_disabled_at
662
+ # @return [String, nil] Set when repeated failures paused this
663
+ # endpoint automatically.
664
+ # @!attribute [r] created_at
665
+ # @return [String]
666
+ # @!attribute [r] secret
667
+ # @return [String] HMAC key for X-Invoist-Signature. Returned only
668
+ # here and on rotation, never readable again.
669
+ WebhookEndpointWithSecret = Data.define(
670
+ :id,
671
+ :url,
672
+ :description,
673
+ :events,
674
+ :enabled,
675
+ :consecutive_failures,
676
+ :last_delivery_at,
677
+ :last_status,
678
+ :auto_disabled_at,
679
+ :created_at,
680
+ :secret
681
+ ) do
682
+ include Model
683
+ end
684
+
685
+ # A `Discovery`, as the API returns it.
686
+ #
687
+ # @!attribute [r] page
688
+ # @return [Integer, nil] 1-based page this pin belongs to. Absent or 0
689
+ # means page 1, which is how discoveries extracted before multi-page
690
+ # support are stored.
691
+ # @!attribute [r] x
692
+ # @return [Numeric] Normalized 0 to 1 across that page's image.
693
+ # @!attribute [r] y
694
+ # @return [Numeric] Normalized 0 to 1 down that page's image.
695
+ # @!attribute [r] label
696
+ # @return [String]
697
+ Discovery = Data.define(
698
+ :page,
699
+ :x,
700
+ :y,
701
+ :label
702
+ ) do
703
+ include Model
704
+ end
705
+
706
+ # A `CustomValue`, as the API returns it.
707
+ #
708
+ # @!attribute [r] key
709
+ # @return [String]
710
+ # @!attribute [r] label
711
+ # @return [String]
712
+ # @!attribute [r] value
713
+ # @return [String, nil]
714
+ # @!attribute [r] confidence
715
+ # @return [Numeric, nil]
716
+ CustomValue = Data.define(
717
+ :key,
718
+ :label,
719
+ :value,
720
+ :confidence
721
+ ) do
722
+ include Model
723
+ end
724
+
725
+ # A `Quality`, as the API returns it.
726
+ #
727
+ # @!attribute [r] readability
728
+ # @return [Numeric] 0 to 1, where 1 is crisp and fully legible.
729
+ # @!attribute [r] issues
730
+ # @return [Array<String>] One of `blurry`, `cropped`, `low_contrast`,
731
+ # `rotated`, `handwritten`, `partial`.
732
+ Quality = Data.define(
733
+ :readability,
734
+ :issues
735
+ ) do
736
+ include Model
737
+ end
738
+
739
+ # A `ReviewQueueItem`, as the API returns it.
740
+ #
741
+ # @!attribute [r] id
742
+ # @return [String]
743
+ # @!attribute [r] document_id
744
+ # @return [String]
745
+ # @!attribute [r] extraction_id
746
+ # @return [String]
747
+ # @!attribute [r] reason
748
+ # @return [String]
749
+ # @!attribute [r] status
750
+ # @return [String]
751
+ # @!attribute [r] created_at
752
+ # @return [String]
753
+ # @!attribute [r] resolved_at
754
+ # @return [String, nil]
755
+ ReviewQueueItem = Data.define(
756
+ :id,
757
+ :document_id,
758
+ :extraction_id,
759
+ :reason,
760
+ :status,
761
+ :created_at,
762
+ :resolved_at
763
+ ) do
764
+ include Model
765
+ end
766
+
767
+ # A review item plus a summary of the document it belongs to.
768
+ #
769
+ # @!attribute [r] id
770
+ # @return [String]
771
+ # @!attribute [r] document_id
772
+ # @return [String]
773
+ # @!attribute [r] extraction_id
774
+ # @return [String]
775
+ # @!attribute [r] reason
776
+ # @return [String]
777
+ # @!attribute [r] status
778
+ # @return [String]
779
+ # @!attribute [r] created_at
780
+ # @return [String]
781
+ # @!attribute [r] resolved_at
782
+ # @return [String, nil]
783
+ # @!attribute [r] original_filename
784
+ # @return [String]
785
+ # @!attribute [r] content_type
786
+ # @return [String]
787
+ # @!attribute [r] document_status
788
+ # @return [String]
789
+ # @!attribute [r] vendor_name
790
+ # @return [String, nil]
791
+ # @!attribute [r] invoice_number
792
+ # @return [String, nil]
793
+ # @!attribute [r] reference_number
794
+ # @return [String, nil]
795
+ # @!attribute [r] total_cents
796
+ # @return [Integer, nil]
797
+ # @!attribute [r] currency
798
+ # @return [String, nil]
799
+ ReviewQueueListItem = Data.define(
800
+ :id,
801
+ :document_id,
802
+ :extraction_id,
803
+ :reason,
804
+ :status,
805
+ :created_at,
806
+ :resolved_at,
807
+ :original_filename,
808
+ :content_type,
809
+ :document_status,
810
+ :vendor_name,
811
+ :invoice_number,
812
+ :reference_number,
813
+ :total_cents,
814
+ :currency
815
+ ) do
816
+ include Model
817
+ end
818
+
819
+ # A `Category`, as the API returns it.
820
+ #
821
+ # @!attribute [r] id
822
+ # @return [String]
823
+ # @!attribute [r] name
824
+ # @return [String]
825
+ # @!attribute [r] is_default
826
+ # @return [Boolean] Part of the set seeded with the workspace.
827
+ # @!attribute [r] created_at
828
+ # @return [String]
829
+ Category = Data.define(
830
+ :id,
831
+ :name,
832
+ :is_default,
833
+ :created_at
834
+ ) do
835
+ include Model
836
+ end
837
+
838
+ # A `Usage`, as the API returns it.
839
+ #
840
+ # @!attribute [r] period_start
841
+ # @return [String]
842
+ # @!attribute [r] total_calls
843
+ # @return [Integer]
844
+ # @!attribute [r] total_documents
845
+ # @return [Integer]
846
+ # @!attribute [r] total_cost_cents
847
+ # @return [Integer]
848
+ # @!attribute [r] by_day
849
+ # @return [Array<Usage::ByDay>]
850
+ Usage = Data.define(
851
+ :period_start,
852
+ :total_calls,
853
+ :total_documents,
854
+ :total_cost_cents,
855
+ :by_day
856
+ ) do
857
+ include Model
858
+
859
+ # @api private
860
+ def self.nested_types
861
+ {
862
+ by_day: [Usage::ByDay]
863
+ }
864
+ end
865
+ end
866
+
867
+ # A `ByDay`, as the API returns it.
868
+ #
869
+ # @!attribute [r] day
870
+ # @return [String, nil]
871
+ # @!attribute [r] calls
872
+ # @return [Integer, nil]
873
+ # @!attribute [r] documents
874
+ # @return [Integer, nil]
875
+ Usage::ByDay = Data.define(
876
+ :day,
877
+ :calls,
878
+ :documents
879
+ ) do
880
+ include Model
881
+ end
882
+
883
+ # A `StatsOverview`, as the API returns it.
884
+ #
885
+ # @!attribute [r] documents_this_month
886
+ # @return [Integer]
887
+ # @!attribute [r] documents_total
888
+ # @return [Integer]
889
+ # @!attribute [r] pending_review_count
890
+ # @return [Integer]
891
+ # @!attribute [r] period_start
892
+ # @return [String]
893
+ # @!attribute [r] plan
894
+ # @return [String] One of `starter`, `growth`, `scale`.
895
+ # @!attribute [r] documents_included
896
+ # @return [Integer, nil] Monthly allowance for the plan. Absent for
897
+ # plans without a fixed allowance.
898
+ StatsOverview = Data.define(
899
+ :documents_this_month,
900
+ :documents_total,
901
+ :pending_review_count,
902
+ :period_start,
903
+ :plan,
904
+ :documents_included
905
+ ) do
906
+ include Model
907
+ end
908
+
909
+ # The household's own record on a bill.
910
+ #
911
+ # @!attribute [r] paid_at
912
+ # @return [String, nil] When it was marked paid.
913
+ # @!attribute [r] paid_by
914
+ # @return [String, nil] Who marked it paid.
915
+ # @!attribute [r] assigned_to
916
+ # @return [String, nil] Who is meant to pay it.
917
+ BillRecord = Data.define(
918
+ :paid_at,
919
+ :paid_by,
920
+ :assigned_to
921
+ ) do
922
+ include Model
923
+ end
924
+
925
+ # The bill a letter or receipt is linked to, and how.
926
+ #
927
+ # @!attribute [r] document_id
928
+ # @return [String, nil]
929
+ # @!attribute [r] link
930
+ # @return [String] `matched` or `confirmed` when linked, `suggested`
931
+ # when Invoist only thinks so, empty when unlinked.
932
+ BillRelated = Data.define(
933
+ :document_id,
934
+ :link
935
+ ) do
936
+ include Model
937
+ end
938
+
939
+ # The newest reminder or collection letter about a bill, which says what
940
+ # is owed now.
941
+ #
942
+ # @!attribute [r] document_id
943
+ # @return [String]
944
+ # @!attribute [r] kind
945
+ # @return [String] One of `reminder`, `debt_collection`.
946
+ # @!attribute [r] total_cents
947
+ # @return [Integer, nil]
948
+ # @!attribute [r] currency
949
+ # @return [String, nil]
950
+ # @!attribute [r] due_date
951
+ # @return [String, nil]
952
+ # @!attribute [r] added_cents
953
+ # @return [Integer, nil] Fees and interest added on top of the
954
+ # original.
955
+ # @!attribute [r] count
956
+ # @return [Integer] How many letters came for this bill.
957
+ BillLetter = Data.define(
958
+ :document_id,
959
+ :kind,
960
+ :total_cents,
961
+ :currency,
962
+ :due_date,
963
+ :added_cents,
964
+ :count
965
+ ) do
966
+ include Model
967
+ end
968
+
969
+ # One bill in a household's list.
970
+ #
971
+ # @!attribute [r] id
972
+ # @return [String]
973
+ # @!attribute [r] source
974
+ # @return [String]
975
+ # @!attribute [r] original_filename
976
+ # @return [String]
977
+ # @!attribute [r] content_type
978
+ # @return [String]
979
+ # @!attribute [r] byte_size
980
+ # @return [Integer]
981
+ # @!attribute [r] status
982
+ # @return [String]
983
+ # @!attribute [r] vendor_name
984
+ # @return [String, nil]
985
+ # @!attribute [r] invoice_number
986
+ # @return [String, nil]
987
+ # @!attribute [r] reference_number
988
+ # @return [String, nil]
989
+ # @!attribute [r] total_cents
990
+ # @return [Integer, nil]
991
+ # @!attribute [r] base_currency
992
+ # @return [String, nil] The workspace's reporting currency, when one
993
+ # is configured. Null when conversion is off, or when this invoice's
994
+ # currency had no published rate for its date. The invoice's own
995
+ # currency and total_cents remain authoritative.
996
+ # @!attribute [r] base_total_cents
997
+ # @return [Integer, nil] total_cents converted into base_currency, for
998
+ # reporting only.
999
+ # @!attribute [r] fx_rate
1000
+ # @return [String, nil] Reporting-currency units per one unit of the
1001
+ # invoice currency, as a decimal string so the exact stored value
1002
+ # round-trips.
1003
+ # @!attribute [r] fx_rate_date
1004
+ # @return [String, nil] The date of the published rates used, which is
1005
+ # the invoice date or the most recent publication before it.
1006
+ # @!attribute [r] fx_source
1007
+ # @return [String, nil] Who published the rate, e.g. "ecb".
1008
+ # @!attribute [r] currency
1009
+ # @return [String, nil]
1010
+ # @!attribute [r] category_id
1011
+ # @return [String, nil]
1012
+ # @!attribute [r] category_name
1013
+ # @return [String, nil]
1014
+ # @!attribute [r] pending_review
1015
+ # @return [Integer] Count of unresolved review items.
1016
+ # @!attribute [r] flagged
1017
+ # @return [Boolean] True when pending_review is above zero.
1018
+ # @!attribute [r] created_at
1019
+ # @return [String]
1020
+ # @!attribute [r] updated_at
1021
+ # @return [String]
1022
+ # @!attribute [r] due_date
1023
+ # @return [String, nil]
1024
+ # @!attribute [r] bill
1025
+ # @return [BillRecord]
1026
+ # @!attribute [r] kind
1027
+ # @return [String, nil]
1028
+ # @!attribute [r] related
1029
+ # @return [BillRelated]
1030
+ # @!attribute [r] letter
1031
+ # @return [BillLetter, nil]
1032
+ # @!attribute [r] proof_document_id
1033
+ # @return [String, nil] A receipt or payment confirmation found for
1034
+ # this bill.
1035
+ # @!attribute [r] logo
1036
+ # @return [String, nil] The domain whose logo stands for the sender,
1037
+ # when Invoist shows one: never on a bill with an open warning, never
1038
+ # for a domain that imitates another the household knows.
1039
+ Bill = Data.define(
1040
+ :id,
1041
+ :source,
1042
+ :original_filename,
1043
+ :content_type,
1044
+ :byte_size,
1045
+ :status,
1046
+ :vendor_name,
1047
+ :invoice_number,
1048
+ :reference_number,
1049
+ :total_cents,
1050
+ :base_currency,
1051
+ :base_total_cents,
1052
+ :fx_rate,
1053
+ :fx_rate_date,
1054
+ :fx_source,
1055
+ :currency,
1056
+ :category_id,
1057
+ :category_name,
1058
+ :pending_review,
1059
+ :flagged,
1060
+ :created_at,
1061
+ :updated_at,
1062
+ :due_date,
1063
+ :bill,
1064
+ :kind,
1065
+ :related,
1066
+ :letter,
1067
+ :proof_document_id,
1068
+ :logo
1069
+ ) do
1070
+ include Model
1071
+
1072
+ # @api private
1073
+ def self.nested_types
1074
+ {
1075
+ bill: BillRecord,
1076
+ related: BillRelated,
1077
+ letter: BillLetter
1078
+ }
1079
+ end
1080
+ end
1081
+
1082
+ # One document of a bill's chain (the bill and its letters).
1083
+ #
1084
+ # @!attribute [r] document_id
1085
+ # @return [String]
1086
+ # @!attribute [r] kind
1087
+ # @return [String, nil]
1088
+ # @!attribute [r] link
1089
+ # @return [String, nil]
1090
+ # @!attribute [r] status
1091
+ # @return [String]
1092
+ # @!attribute [r] original_filename
1093
+ # @return [String]
1094
+ # @!attribute [r] vendor_name
1095
+ # @return [String, nil]
1096
+ # @!attribute [r] invoice_number
1097
+ # @return [String, nil]
1098
+ # @!attribute [r] reference_number
1099
+ # @return [String, nil]
1100
+ # @!attribute [r] currency
1101
+ # @return [String, nil]
1102
+ # @!attribute [r] total_cents
1103
+ # @return [Integer, nil]
1104
+ # @!attribute [r] date
1105
+ # @return [String]
1106
+ # @!attribute [r] due_date
1107
+ # @return [String, nil]
1108
+ # @!attribute [r] paid_at
1109
+ # @return [String, nil]
1110
+ # @!attribute [r] fees_cents
1111
+ # @return [Integer, nil]
1112
+ # @!attribute [r] interest_cents
1113
+ # @return [Integer, nil]
1114
+ # @!attribute [r] original_amount_cents
1115
+ # @return [Integer, nil]
1116
+ # @!attribute [r] original_creditor
1117
+ # @return [String, nil]
1118
+ # @!attribute [r] vendor_iban
1119
+ # @return [String, nil]
1120
+ # @!attribute [r] vendor_bic
1121
+ # @return [String, nil]
1122
+ # @!attribute [r] payment_account
1123
+ # @return [String, nil]
1124
+ # @!attribute [r] warnings
1125
+ # @return [Array<BillChainMember::Warning>, nil]
1126
+ BillChainMember = Data.define(
1127
+ :document_id,
1128
+ :kind,
1129
+ :link,
1130
+ :status,
1131
+ :original_filename,
1132
+ :vendor_name,
1133
+ :invoice_number,
1134
+ :reference_number,
1135
+ :currency,
1136
+ :total_cents,
1137
+ :date,
1138
+ :due_date,
1139
+ :paid_at,
1140
+ :fees_cents,
1141
+ :interest_cents,
1142
+ :original_amount_cents,
1143
+ :original_creditor,
1144
+ :vendor_iban,
1145
+ :vendor_bic,
1146
+ :payment_account,
1147
+ :warnings
1148
+ ) do
1149
+ include Model
1150
+
1151
+ # @api private
1152
+ def self.nested_types
1153
+ {
1154
+ warnings: [BillChainMember::Warning]
1155
+ }
1156
+ end
1157
+ end
1158
+
1159
+ # A `Warning`, as the API returns it.
1160
+ #
1161
+ # @!attribute [r] id
1162
+ # @return [String]
1163
+ # @!attribute [r] reason
1164
+ # @return [String]
1165
+ BillChainMember::Warning = Data.define(
1166
+ :id,
1167
+ :reason
1168
+ ) do
1169
+ include Model
1170
+ end
1171
+
1172
+ # One bill with everything read from it.
1173
+ #
1174
+ # @!attribute [r] document
1175
+ # @return [Document]
1176
+ # @!attribute [r] extraction
1177
+ # @return [Extraction, nil]
1178
+ # @!attribute [r] extraction_job
1179
+ # @return [ExtractionJob, nil]
1180
+ # @!attribute [r] review_queue
1181
+ # @return [Array<ReviewQueueItem>] The bill's warnings; open ones have
1182
+ # status `pending`.
1183
+ # @!attribute [r] period_locked
1184
+ # @return [Boolean, nil]
1185
+ # @!attribute [r] bill
1186
+ # @return [BillRecord]
1187
+ # @!attribute [r] related
1188
+ # @return [BillRelated, nil]
1189
+ # @!attribute [r] chain
1190
+ # @return [BillDetail::Chain, nil] The bill and its letters, when it
1191
+ # has any.
1192
+ # @!attribute [r] suggested_bill
1193
+ # @return [BillChainMember, nil]
1194
+ # @!attribute [r] suggested_letters
1195
+ # @return [Array<BillChainMember>, nil]
1196
+ # @!attribute [r] logo
1197
+ # @return [String, nil]
1198
+ BillDetail = Data.define(
1199
+ :document,
1200
+ :extraction,
1201
+ :extraction_job,
1202
+ :review_queue,
1203
+ :period_locked,
1204
+ :bill,
1205
+ :related,
1206
+ :chain,
1207
+ :suggested_bill,
1208
+ :suggested_letters,
1209
+ :logo
1210
+ ) do
1211
+ include Model
1212
+
1213
+ # @api private
1214
+ def self.nested_types
1215
+ {
1216
+ document: Document,
1217
+ extraction: Extraction,
1218
+ extraction_job: ExtractionJob,
1219
+ review_queue: [ReviewQueueItem],
1220
+ bill: BillRecord,
1221
+ related: BillRelated,
1222
+ chain: BillDetail::Chain,
1223
+ suggested_bill: BillChainMember,
1224
+ suggested_letters: [BillChainMember]
1225
+ }
1226
+ end
1227
+ end
1228
+
1229
+ # The bill and its letters, when it has any.
1230
+ #
1231
+ # @!attribute [r] root_id
1232
+ # @return [String]
1233
+ # @!attribute [r] members
1234
+ # @return [Array<BillChainMember>]
1235
+ BillDetail::Chain = Data.define(
1236
+ :root_id,
1237
+ :members
1238
+ ) do
1239
+ include Model
1240
+
1241
+ # @api private
1242
+ def self.nested_types
1243
+ {
1244
+ members: [BillChainMember]
1245
+ }
1246
+ end
1247
+ end
1248
+
1249
+ # A `BillsDue`, as the API returns it.
1250
+ #
1251
+ # @!attribute [r] currency
1252
+ # @return [String]
1253
+ # @!attribute [r] count
1254
+ # @return [Integer]
1255
+ # @!attribute [r] total_cents
1256
+ # @return [Integer]
1257
+ BillsDue = Data.define(
1258
+ :currency,
1259
+ :count,
1260
+ :total_cents
1261
+ ) do
1262
+ include Model
1263
+ end
1264
+
1265
+ # A `BillsSummary`, as the API returns it.
1266
+ #
1267
+ # @!attribute [r] unpaid
1268
+ # @return [Integer] Bills not marked paid.
1269
+ # @!attribute [r] overdue
1270
+ # @return [Integer] Unpaid bills past their due date.
1271
+ # @!attribute [r] due_soon
1272
+ # @return [Array<BillsDue>] Per currency, the unpaid bills due by
1273
+ # today plus `days`, overdue ones included.
1274
+ # @!attribute [r] days
1275
+ # @return [Integer]
1276
+ # @!attribute [r] today
1277
+ # @return [String]
1278
+ BillsSummary = Data.define(
1279
+ :unpaid,
1280
+ :overdue,
1281
+ :due_soon,
1282
+ :days,
1283
+ :today
1284
+ ) do
1285
+ include Model
1286
+
1287
+ # @api private
1288
+ def self.nested_types
1289
+ {
1290
+ due_soon: [BillsDue]
1291
+ }
1292
+ end
1293
+ end
1294
+
1295
+ # A `BillsStats`, as the API returns it.
1296
+ #
1297
+ # @!attribute [r] month
1298
+ # @return [String] `YYYY-MM`
1299
+ # @!attribute [r] totals
1300
+ # @return [Array<BillsStats::Total>]
1301
+ # @!attribute [r] trend
1302
+ # @return [Array<BillsStats::Trend>] Up to twelve months ending with
1303
+ # `month`, per currency; months with no bills are absent.
1304
+ # @!attribute [r] top_senders
1305
+ # @return [Array<BillsStats::TopSender>]
1306
+ # @!attribute [r] senders
1307
+ # @return [Array<BillsStats::Sender>] Everyone who has sent the
1308
+ # household bills, most bills first.
1309
+ BillsStats = Data.define(
1310
+ :month,
1311
+ :totals,
1312
+ :trend,
1313
+ :top_senders,
1314
+ :senders
1315
+ ) do
1316
+ include Model
1317
+
1318
+ # @api private
1319
+ def self.nested_types
1320
+ {
1321
+ totals: [BillsStats::Total],
1322
+ trend: [BillsStats::Trend],
1323
+ top_senders: [BillsStats::TopSender],
1324
+ senders: [BillsStats::Sender]
1325
+ }
1326
+ end
1327
+ end
1328
+
1329
+ # A `Total`, as the API returns it.
1330
+ #
1331
+ # @!attribute [r] currency
1332
+ # @return [String]
1333
+ # @!attribute [r] count
1334
+ # @return [Integer]
1335
+ # @!attribute [r] paid_count
1336
+ # @return [Integer]
1337
+ # @!attribute [r] total_cents
1338
+ # @return [Integer]
1339
+ # @!attribute [r] paid_cents
1340
+ # @return [Integer]
1341
+ BillsStats::Total = Data.define(
1342
+ :currency,
1343
+ :count,
1344
+ :paid_count,
1345
+ :total_cents,
1346
+ :paid_cents
1347
+ ) do
1348
+ include Model
1349
+ end
1350
+
1351
+ # A `Trend`, as the API returns it.
1352
+ #
1353
+ # @!attribute [r] month
1354
+ # @return [String]
1355
+ # @!attribute [r] currency
1356
+ # @return [String]
1357
+ # @!attribute [r] count
1358
+ # @return [Integer]
1359
+ # @!attribute [r] total_cents
1360
+ # @return [Integer]
1361
+ BillsStats::Trend = Data.define(
1362
+ :month,
1363
+ :currency,
1364
+ :count,
1365
+ :total_cents
1366
+ ) do
1367
+ include Model
1368
+ end
1369
+
1370
+ # A `TopSender`, as the API returns it.
1371
+ #
1372
+ # @!attribute [r] name
1373
+ # @return [String]
1374
+ # @!attribute [r] currency
1375
+ # @return [String, nil]
1376
+ # @!attribute [r] count
1377
+ # @return [Integer]
1378
+ # @!attribute [r] total_cents
1379
+ # @return [Integer, nil]
1380
+ # @!attribute [r] logo
1381
+ # @return [String, nil]
1382
+ BillsStats::TopSender = Data.define(
1383
+ :name,
1384
+ :currency,
1385
+ :count,
1386
+ :total_cents,
1387
+ :logo
1388
+ ) do
1389
+ include Model
1390
+ end
1391
+
1392
+ # A `Sender`, as the API returns it.
1393
+ #
1394
+ # @!attribute [r] name
1395
+ # @return [String]
1396
+ # @!attribute [r] count
1397
+ # @return [Integer]
1398
+ BillsStats::Sender = Data.define(
1399
+ :name,
1400
+ :count
1401
+ ) do
1402
+ include Model
1403
+ end
1404
+
1405
+ # A `HeldEmailFile`, as the API returns it.
1406
+ #
1407
+ # @!attribute [r] id
1408
+ # @return [String]
1409
+ # @!attribute [r] filename
1410
+ # @return [String]
1411
+ # @!attribute [r] content_type
1412
+ # @return [String]
1413
+ # @!attribute [r] size_bytes
1414
+ # @return [Integer]
1415
+ HeldEmailFile = Data.define(
1416
+ :id,
1417
+ :filename,
1418
+ :content_type,
1419
+ :size_bytes
1420
+ ) do
1421
+ include Model
1422
+ end
1423
+
1424
+ # An email forwarded to the household that waits for approval.
1425
+ #
1426
+ # @!attribute [r] id
1427
+ # @return [String]
1428
+ # @!attribute [r] from_email
1429
+ # @return [String]
1430
+ # @!attribute [r] subject
1431
+ # @return [String]
1432
+ # @!attribute [r] status
1433
+ # @return [String]
1434
+ # @!attribute [r] reason
1435
+ # @return [String, nil]
1436
+ # @!attribute [r] attachments
1437
+ # @return [Integer, nil]
1438
+ # @!attribute [r] documents
1439
+ # @return [Integer, nil]
1440
+ # @!attribute [r] created_at
1441
+ # @return [String]
1442
+ # @!attribute [r] hold_reason
1443
+ # @return [String, nil] Why it waits. The sender reasons wait for a
1444
+ # person; the plan reasons clear by themselves. One of `new_sender`,
1445
+ # `unverified_sender`, `no_plan`, `quota_used`.
1446
+ # @!attribute [r] held_until
1447
+ # @return [String, nil] When it is deleted if nobody acts.
1448
+ # @!attribute [r] resolved_at
1449
+ # @return [String, nil]
1450
+ # @!attribute [r] bounced
1451
+ # @return [Boolean, nil]
1452
+ # @!attribute [r] forwarded_by
1453
+ # @return [String, nil] The household member whose forwarding rule
1454
+ # passed it on.
1455
+ # @!attribute [r] original_from
1456
+ # @return [String, nil] Who wrote it first, when forwarded by hand.
1457
+ # @!attribute [r] lookalike_of
1458
+ # @return [String, nil] A known domain this sender's imitates.
1459
+ # @!attribute [r] sender
1460
+ # @return [String] What the mail server found about the From address.
1461
+ # One of `verified`, `failed`, `unknown`.
1462
+ # @!attribute [r] files
1463
+ # @return [Array<HeldEmailFile>]
1464
+ # @!attribute [r] logo
1465
+ # @return [String, nil]
1466
+ HeldEmail = Data.define(
1467
+ :id,
1468
+ :from_email,
1469
+ :subject,
1470
+ :status,
1471
+ :reason,
1472
+ :attachments,
1473
+ :documents,
1474
+ :created_at,
1475
+ :hold_reason,
1476
+ :held_until,
1477
+ :resolved_at,
1478
+ :bounced,
1479
+ :forwarded_by,
1480
+ :original_from,
1481
+ :lookalike_of,
1482
+ :sender,
1483
+ :files,
1484
+ :logo
1485
+ ) do
1486
+ include Model
1487
+
1488
+ # @api private
1489
+ def self.nested_types
1490
+ {
1491
+ files: [HeldEmailFile]
1492
+ }
1493
+ end
1494
+ end
1495
+
1496
+ # Submit a document for extraction
1497
+ #
1498
+ # @!attribute [r] document
1499
+ # @return [Document]
1500
+ # @!attribute [r] extraction
1501
+ # @return [Extraction, nil]
1502
+ # @!attribute [r] duplicate
1503
+ # @return [Boolean]
1504
+ ExtractResult = Data.define(
1505
+ :document,
1506
+ :extraction,
1507
+ :duplicate
1508
+ ) do
1509
+ include Model
1510
+
1511
+ # @api private
1512
+ def self.nested_types
1513
+ {
1514
+ document: Document,
1515
+ extraction: Extraction
1516
+ }
1517
+ end
1518
+ end
1519
+
1520
+ # Submit up to 10 documents in one call
1521
+ #
1522
+ # @!attribute [r] results
1523
+ # @return [Array<BatchResultItem>]
1524
+ # @!attribute [r] accepted
1525
+ # @return [Integer] How many files were accepted and queued.
1526
+ # @!attribute [r] rejected
1527
+ # @return [Integer] How many files failed validation or could not be
1528
+ # stored.
1529
+ BatchResult = Data.define(
1530
+ :results,
1531
+ :accepted,
1532
+ :rejected
1533
+ ) do
1534
+ include Model
1535
+
1536
+ # @api private
1537
+ def self.nested_types
1538
+ {
1539
+ results: [BatchResultItem]
1540
+ }
1541
+ end
1542
+ end
1543
+
1544
+ # Fetch a document with its extraction
1545
+ #
1546
+ # @!attribute [r] document
1547
+ # @return [Document]
1548
+ # @!attribute [r] extraction
1549
+ # @return [Extraction, nil]
1550
+ # @!attribute [r] extraction_job
1551
+ # @return [ExtractionJob, nil]
1552
+ # @!attribute [r] review_queue
1553
+ # @return [Array<ReviewQueueItem>]
1554
+ # @!attribute [r] period_locked
1555
+ # @return [Boolean, nil] Whether this document's month is closed. A
1556
+ # locked document can be read and exported but not edited,
1557
+ # categorized, deleted, or re-run until the month is reopened.
1558
+ DocumentDetail = Data.define(
1559
+ :document,
1560
+ :extraction,
1561
+ :extraction_job,
1562
+ :review_queue,
1563
+ :period_locked
1564
+ ) do
1565
+ include Model
1566
+
1567
+ # @api private
1568
+ def self.nested_types
1569
+ {
1570
+ document: Document,
1571
+ extraction: Extraction,
1572
+ extraction_job: ExtractionJob,
1573
+ review_queue: [ReviewQueueItem]
1574
+ }
1575
+ end
1576
+ end
1577
+
1578
+ # List webhook endpoints
1579
+ #
1580
+ # @!attribute [r] endpoints
1581
+ # @return [Array<WebhookEndpoint>]
1582
+ # @!attribute [r] known_events
1583
+ # @return [Array<String>]
1584
+ WebhookEndpointList = Data.define(
1585
+ :endpoints,
1586
+ :known_events
1587
+ ) do
1588
+ include Model
1589
+
1590
+ # @api private
1591
+ def self.nested_types
1592
+ {
1593
+ endpoints: [WebhookEndpoint]
1594
+ }
1595
+ end
1596
+ end
1597
+ end
1598
+ end