perata-sdk 0.2.0 → 0.4.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.
data/lib/perata/params.rb CHANGED
@@ -3,6 +3,239 @@
3
3
  # Code generated by sdk/generator. DO NOT EDIT.
4
4
 
5
5
  module Perata
6
+ # The body of benefits:create.
7
+ class BenefitsCreateParams < Params
8
+ MEMBERS = %i[description metadata name properties type visibility].freeze
9
+
10
+ # @return [String, nil]
11
+ attr_reader :description
12
+
13
+ # Até 50 pares; valor em texto, número ou booleano. No feature_flag, os valores da flag.
14
+ # @return [Hash{String => Object}, nil]
15
+ attr_reader :metadata
16
+
17
+ # Como o benefício aparece nos produtos e para o cliente; até 80 caracteres.
18
+ # @return [String]
19
+ attr_reader :name
20
+
21
+ # Os campos do tipo. custom: note. license_key: prefix, expires_in, expires_unit (day, month, year), activation_limit, customer_can_deactivate, usage_limit. meter_credit: meter_id, units, rollover. feature_flag: nenhum.
22
+ # @return [Hash{String => Object}, nil]
23
+ attr_reader :properties
24
+
25
+ # @return [String ("custom", "license_key", "feature_flag", "meter_credit")]
26
+ attr_reader :type
27
+
28
+ # @return [String ("public", "private"), nil]
29
+ attr_reader :visibility
30
+
31
+ def initialize(description: nil, metadata: nil, name:, properties: nil, type:, visibility: nil)
32
+ @description = description
33
+ @metadata = metadata
34
+ @name = name
35
+ @properties = properties
36
+ @type = type
37
+ @visibility = visibility
38
+ freeze
39
+ end
40
+
41
+ # The body as the API reads it.
42
+ def to_wire
43
+ wire = {}
44
+ wire["description"] = @description unless @description.nil?
45
+ wire["metadata"] = Perata.wire(@metadata) unless @metadata.nil?
46
+ wire["name"] = @name
47
+ wire["properties"] = Perata.wire(@properties) unless @properties.nil?
48
+ wire["type"] = @type
49
+ wire["visibility"] = @visibility unless @visibility.nil?
50
+ wire
51
+ end
52
+ end
53
+
54
+ # The body of benefits:update.
55
+ class BenefitsUpdateParams < Params
56
+ MEMBERS = %i[metadata name properties visibility].freeze
57
+
58
+ # Substitui os metadados; {} os limpa.
59
+ # @return [Hash{String => Object}, nil]
60
+ attr_reader :metadata
61
+
62
+ # @return [String, nil]
63
+ attr_reader :name
64
+
65
+ # Os campos do tipo, aplicados sobre os guardados; o que ficar de fora não muda.
66
+ # @return [Hash{String => Object}, nil]
67
+ attr_reader :properties
68
+
69
+ # @return [String ("public", "private"), nil]
70
+ attr_reader :visibility
71
+
72
+ def initialize(metadata: nil, name: nil, properties: nil, visibility: nil)
73
+ @metadata = metadata
74
+ @name = name
75
+ @properties = properties
76
+ @visibility = visibility
77
+ freeze
78
+ end
79
+
80
+ # The body as the API reads it.
81
+ def to_wire
82
+ wire = {}
83
+ wire["metadata"] = Perata.wire(@metadata) unless @metadata.nil?
84
+ wire["name"] = @name unless @name.nil?
85
+ wire["properties"] = Perata.wire(@properties) unless @properties.nil?
86
+ wire["visibility"] = @visibility unless @visibility.nil?
87
+ wire
88
+ end
89
+ end
90
+
91
+ # The body of checkout-links:create.
92
+ class CheckoutLinksCreateParams < Params
93
+ MEMBERS = %i[allow_discount_codes cancel_url capture_mode discount_id expires_at label max_installments metadata price_id price_ids product_id quantity require_billing_address success_url trial_interval trial_interval_count].freeze
94
+
95
+ # @return [Boolean, nil]
96
+ attr_reader :allow_discount_codes
97
+
98
+ # @return [String, nil]
99
+ attr_reader :cancel_url
100
+
101
+ # @return [String ("automatic", "manual"), nil]
102
+ attr_reader :capture_mode
103
+
104
+ # Desconto fixado no link.
105
+ # @return [String, nil]
106
+ attr_reader :discount_id
107
+
108
+ # Data e hora RFC 3339 no futuro.
109
+ # @return [String, nil]
110
+ attr_reader :expires_at
111
+
112
+ # @return [String, nil]
113
+ attr_reader :label
114
+
115
+ # De 0 a 12; 0 segue a organização.
116
+ # @return [Integer, nil]
117
+ attr_reader :max_installments
118
+
119
+ # Até 50 pares; valor em texto, número ou booleano.
120
+ # @return [Hash{String => Object}, nil]
121
+ attr_reader :metadata
122
+
123
+ # @return [String, nil]
124
+ attr_reader :price_id
125
+
126
+ # Um preço de cada produto, na ordem em que o comprador os vê; até 20.
127
+ # @return [Array<String>, nil]
128
+ attr_reader :price_ids
129
+
130
+ # Com price_id, o produto que o link vende; ou use price_ids.
131
+ # @return [String, nil]
132
+ attr_reader :product_id
133
+
134
+ # @return [Integer, nil]
135
+ attr_reader :quantity
136
+
137
+ # @return [Boolean, nil]
138
+ attr_reader :require_billing_address
139
+
140
+ # @return [String, nil]
141
+ attr_reader :success_url
142
+
143
+ # @return [String ("day", "week", "month", "year"), nil]
144
+ attr_reader :trial_interval
145
+
146
+ # @return [Integer, nil]
147
+ attr_reader :trial_interval_count
148
+
149
+ def initialize(allow_discount_codes: nil, cancel_url: nil, capture_mode: nil, discount_id: nil, expires_at: nil, label: nil, max_installments: nil, metadata: nil, price_id: nil, price_ids: nil, product_id: nil, quantity: nil, require_billing_address: nil, success_url: nil, trial_interval: nil, trial_interval_count: nil)
150
+ @allow_discount_codes = allow_discount_codes
151
+ @cancel_url = cancel_url
152
+ @capture_mode = capture_mode
153
+ @discount_id = discount_id
154
+ @expires_at = expires_at
155
+ @label = label
156
+ @max_installments = max_installments
157
+ @metadata = metadata
158
+ @price_id = price_id
159
+ @price_ids = price_ids
160
+ @product_id = product_id
161
+ @quantity = quantity
162
+ @require_billing_address = require_billing_address
163
+ @success_url = success_url
164
+ @trial_interval = trial_interval
165
+ @trial_interval_count = trial_interval_count
166
+ freeze
167
+ end
168
+
169
+ # The body as the API reads it.
170
+ def to_wire
171
+ wire = {}
172
+ wire["allow_discount_codes"] = @allow_discount_codes unless @allow_discount_codes.nil?
173
+ wire["cancel_url"] = @cancel_url unless @cancel_url.nil?
174
+ wire["capture_mode"] = @capture_mode unless @capture_mode.nil?
175
+ wire["discount_id"] = @discount_id unless @discount_id.nil?
176
+ wire["expires_at"] = @expires_at unless @expires_at.nil?
177
+ wire["label"] = @label unless @label.nil?
178
+ wire["max_installments"] = @max_installments unless @max_installments.nil?
179
+ wire["metadata"] = Perata.wire(@metadata) unless @metadata.nil?
180
+ wire["price_id"] = @price_id unless @price_id.nil?
181
+ wire["price_ids"] = Perata.wire(@price_ids) unless @price_ids.nil?
182
+ wire["product_id"] = @product_id unless @product_id.nil?
183
+ wire["quantity"] = @quantity unless @quantity.nil?
184
+ wire["require_billing_address"] = @require_billing_address unless @require_billing_address.nil?
185
+ wire["success_url"] = @success_url unless @success_url.nil?
186
+ wire["trial_interval"] = @trial_interval unless @trial_interval.nil?
187
+ wire["trial_interval_count"] = @trial_interval_count unless @trial_interval_count.nil?
188
+ wire
189
+ end
190
+ end
191
+
192
+ # The body of checkout-links:update.
193
+ class CheckoutLinksUpdateParams < Params
194
+ MEMBERS = %i[cancel_url label metadata price_ids require_billing_address success_url].freeze
195
+
196
+ # @return [String, nil]
197
+ attr_reader :cancel_url
198
+
199
+ # @return [String, nil]
200
+ attr_reader :label
201
+
202
+ # Substitui os metadados; {} os limpa.
203
+ # @return [Hash{String => Object}, nil]
204
+ attr_reader :metadata
205
+
206
+ # Substitui os produtos do link.
207
+ # @return [Array<String>, nil]
208
+ attr_reader :price_ids
209
+
210
+ # @return [Boolean, nil]
211
+ attr_reader :require_billing_address
212
+
213
+ # @return [String, nil]
214
+ attr_reader :success_url
215
+
216
+ def initialize(cancel_url: nil, label: nil, metadata: nil, price_ids: nil, require_billing_address: nil, success_url: nil)
217
+ @cancel_url = cancel_url
218
+ @label = label
219
+ @metadata = metadata
220
+ @price_ids = price_ids
221
+ @require_billing_address = require_billing_address
222
+ @success_url = success_url
223
+ freeze
224
+ end
225
+
226
+ # The body as the API reads it.
227
+ def to_wire
228
+ wire = {}
229
+ wire["cancel_url"] = @cancel_url unless @cancel_url.nil?
230
+ wire["label"] = @label unless @label.nil?
231
+ wire["metadata"] = Perata.wire(@metadata) unless @metadata.nil?
232
+ wire["price_ids"] = Perata.wire(@price_ids) unless @price_ids.nil?
233
+ wire["require_billing_address"] = @require_billing_address unless @require_billing_address.nil?
234
+ wire["success_url"] = @success_url unless @success_url.nil?
235
+ wire
236
+ end
237
+ end
238
+
6
239
  # The body of checkouts:create.
7
240
  class CheckoutsCreateParams < Params
8
241
  MEMBERS = %i[cancel_url label price_id product_id quantity success_url].freeze
@@ -48,15 +281,52 @@ module Perata
48
281
  end
49
282
  end
50
283
 
284
+ # The body of checkouts:update.
285
+ class CheckoutsUpdateParams < Params
286
+ MEMBERS = %i[cancel_url label success_url].freeze
287
+
288
+ # Endereço https; vazio retira.
289
+ # @return [String, nil]
290
+ attr_reader :cancel_url
291
+
292
+ # @return [String, nil]
293
+ attr_reader :label
294
+
295
+ # Endereço https; vazio retira.
296
+ # @return [String, nil]
297
+ attr_reader :success_url
298
+
299
+ def initialize(cancel_url: nil, label: nil, success_url: nil)
300
+ @cancel_url = cancel_url
301
+ @label = label
302
+ @success_url = success_url
303
+ freeze
304
+ end
305
+
306
+ # The body as the API reads it.
307
+ def to_wire
308
+ wire = {}
309
+ wire["cancel_url"] = @cancel_url unless @cancel_url.nil?
310
+ wire["label"] = @label unless @label.nil?
311
+ wire["success_url"] = @success_url unless @success_url.nil?
312
+ wire
313
+ end
314
+ end
315
+
51
316
  # The body of customer-sessions:create.
52
317
  class CustomerSessionsCreateParams < Params
53
- MEMBERS = %i[customer_id].freeze
318
+ MEMBERS = %i[customer_id return_url].freeze
54
319
 
55
320
  # @return [String]
56
321
  attr_reader :customer_id
57
322
 
58
- def initialize(customer_id:)
323
+ # Optional https address of your app the portal offers to go back to.
324
+ # @return [String, nil]
325
+ attr_reader :return_url
326
+
327
+ def initialize(customer_id:, return_url: nil)
59
328
  @customer_id = customer_id
329
+ @return_url = return_url
60
330
  freeze
61
331
  end
62
332
 
@@ -64,6 +334,7 @@ module Perata
64
334
  def to_wire
65
335
  wire = {}
66
336
  wire["customer_id"] = @customer_id
337
+ wire["return_url"] = @return_url unless @return_url.nil?
67
338
  wire
68
339
  end
69
340
  end
@@ -75,6 +346,7 @@ module Perata
75
346
  # @return [String]
76
347
  attr_reader :email
77
348
 
349
+ # Até 120 caracteres, sem barra (/) nem caracteres de controle.
78
350
  # @return [String, nil]
79
351
  attr_reader :external_id
80
352
 
@@ -98,6 +370,220 @@ module Perata
98
370
  end
99
371
  end
100
372
 
373
+ # The body of customers:update.
374
+ class CustomersUpdateParams < Params
375
+ MEMBERS = %i[email external_id name].freeze
376
+
377
+ # @return [String, nil]
378
+ attr_reader :email
379
+
380
+ # Só pode ser definido uma vez. Até 120 caracteres, sem barra (/) nem caracteres de controle.
381
+ # @return [String, nil]
382
+ attr_reader :external_id
383
+
384
+ # @return [String, nil]
385
+ attr_reader :name
386
+
387
+ def initialize(email: nil, external_id: nil, name: nil)
388
+ @email = email
389
+ @external_id = external_id
390
+ @name = name
391
+ freeze
392
+ end
393
+
394
+ # The body as the API reads it.
395
+ def to_wire
396
+ wire = {}
397
+ wire["email"] = @email unless @email.nil?
398
+ wire["external_id"] = @external_id unless @external_id.nil?
399
+ wire["name"] = @name unless @name.nil?
400
+ wire
401
+ end
402
+ end
403
+
404
+ # The body of discounts:create.
405
+ class DiscountsCreateParams < Params
406
+ MEMBERS = %i[amount_cents basis_points code duration duration_in_months ends_at max_redemptions max_redemptions_per_customer name product_ids starts_at type].freeze
407
+
408
+ # Em centavos, obrigatório no tipo fixed.
409
+ # @return [Integer, nil]
410
+ attr_reader :amount_cents
411
+
412
+ # De 1 a 10000, obrigatório no tipo percentage.
413
+ # @return [Integer, nil]
414
+ attr_reader :basis_points
415
+
416
+ # Até 64 letras, números, hífens ou sublinhados; sem ele o desconto só se aplica por um link de checkout ou pela API.
417
+ # @return [String, nil]
418
+ attr_reader :code
419
+
420
+ # @return [String ("once", "repeating", "forever")]
421
+ attr_reader :duration
422
+
423
+ # De 1 a 120, só no duration repeating.
424
+ # @return [Integer, nil]
425
+ attr_reader :duration_in_months
426
+
427
+ # Data e hora RFC 3339, depois de starts_at.
428
+ # @return [String, nil]
429
+ attr_reader :ends_at
430
+
431
+ # @return [Integer, nil]
432
+ attr_reader :max_redemptions
433
+
434
+ # @return [Integer, nil]
435
+ attr_reader :max_redemptions_per_customer
436
+
437
+ # @return [String]
438
+ attr_reader :name
439
+
440
+ # Os produtos do desconto; vazio, todos.
441
+ # @return [Array<String>, nil]
442
+ attr_reader :product_ids
443
+
444
+ # Data e hora RFC 3339; agora, se omitida.
445
+ # @return [String, nil]
446
+ attr_reader :starts_at
447
+
448
+ # @return [String ("percentage", "fixed")]
449
+ attr_reader :type
450
+
451
+ def initialize(amount_cents: nil, basis_points: nil, code: nil, duration:, duration_in_months: nil, ends_at: nil, max_redemptions: nil, max_redemptions_per_customer: nil, name:, product_ids: nil, starts_at: nil, type:)
452
+ @amount_cents = amount_cents
453
+ @basis_points = basis_points
454
+ @code = code
455
+ @duration = duration
456
+ @duration_in_months = duration_in_months
457
+ @ends_at = ends_at
458
+ @max_redemptions = max_redemptions
459
+ @max_redemptions_per_customer = max_redemptions_per_customer
460
+ @name = name
461
+ @product_ids = product_ids
462
+ @starts_at = starts_at
463
+ @type = type
464
+ freeze
465
+ end
466
+
467
+ # The body as the API reads it.
468
+ def to_wire
469
+ wire = {}
470
+ wire["amount_cents"] = @amount_cents unless @amount_cents.nil?
471
+ wire["basis_points"] = @basis_points unless @basis_points.nil?
472
+ wire["code"] = @code unless @code.nil?
473
+ wire["duration"] = @duration
474
+ wire["duration_in_months"] = @duration_in_months unless @duration_in_months.nil?
475
+ wire["ends_at"] = @ends_at unless @ends_at.nil?
476
+ wire["max_redemptions"] = @max_redemptions unless @max_redemptions.nil?
477
+ wire["max_redemptions_per_customer"] = @max_redemptions_per_customer unless @max_redemptions_per_customer.nil?
478
+ wire["name"] = @name
479
+ wire["product_ids"] = Perata.wire(@product_ids) unless @product_ids.nil?
480
+ wire["starts_at"] = @starts_at unless @starts_at.nil?
481
+ wire["type"] = @type
482
+ wire
483
+ end
484
+ end
485
+
486
+ # The body of discounts:update.
487
+ class DiscountsUpdateParams < Params
488
+ MEMBERS = %i[amount_cents basis_points code duration_in_months ends_at max_redemptions max_redemptions_per_customer name product_ids starts_at].freeze
489
+
490
+ # @return [Integer, nil]
491
+ attr_reader :amount_cents
492
+
493
+ # @return [Integer, nil]
494
+ attr_reader :basis_points
495
+
496
+ # null tira o código.
497
+ # @return [String, nil]
498
+ attr_reader :code
499
+
500
+ # @return [Integer, nil]
501
+ attr_reader :duration_in_months
502
+
503
+ # null tira o fim.
504
+ # @return [String, nil]
505
+ attr_reader :ends_at
506
+
507
+ # null tira o limite.
508
+ # @return [Integer, nil]
509
+ attr_reader :max_redemptions
510
+
511
+ # null tira o limite.
512
+ # @return [Integer, nil]
513
+ attr_reader :max_redemptions_per_customer
514
+
515
+ # @return [String, nil]
516
+ attr_reader :name
517
+
518
+ # Substitui os produtos do desconto.
519
+ # @return [Array<String>, nil]
520
+ attr_reader :product_ids
521
+
522
+ # @return [String, nil]
523
+ attr_reader :starts_at
524
+
525
+ def initialize(amount_cents: nil, basis_points: nil, code: nil, duration_in_months: nil, ends_at: nil, max_redemptions: nil, max_redemptions_per_customer: nil, name: nil, product_ids: nil, starts_at: nil)
526
+ @amount_cents = amount_cents
527
+ @basis_points = basis_points
528
+ @code = code
529
+ @duration_in_months = duration_in_months
530
+ @ends_at = ends_at
531
+ @max_redemptions = max_redemptions
532
+ @max_redemptions_per_customer = max_redemptions_per_customer
533
+ @name = name
534
+ @product_ids = product_ids
535
+ @starts_at = starts_at
536
+ freeze
537
+ end
538
+
539
+ # The body as the API reads it.
540
+ def to_wire
541
+ wire = {}
542
+ wire["amount_cents"] = @amount_cents unless @amount_cents.nil?
543
+ wire["basis_points"] = @basis_points unless @basis_points.nil?
544
+ wire["code"] = @code unless @code.nil?
545
+ wire["duration_in_months"] = @duration_in_months unless @duration_in_months.nil?
546
+ wire["ends_at"] = @ends_at unless @ends_at.nil?
547
+ wire["max_redemptions"] = @max_redemptions unless @max_redemptions.nil?
548
+ wire["max_redemptions_per_customer"] = @max_redemptions_per_customer unless @max_redemptions_per_customer.nil?
549
+ wire["name"] = @name unless @name.nil?
550
+ wire["product_ids"] = Perata.wire(@product_ids) unless @product_ids.nil?
551
+ wire["starts_at"] = @starts_at unless @starts_at.nil?
552
+ wire
553
+ end
554
+ end
555
+
556
+ # The body of customers:update_external.
557
+ class CustomersUpdateExternalParams < Params
558
+ MEMBERS = %i[email external_id name].freeze
559
+
560
+ # @return [String, nil]
561
+ attr_reader :email
562
+
563
+ # Só pode ser definido uma vez. Até 120 caracteres, sem barra (/) nem caracteres de controle.
564
+ # @return [String, nil]
565
+ attr_reader :external_id
566
+
567
+ # @return [String, nil]
568
+ attr_reader :name
569
+
570
+ def initialize(email: nil, external_id: nil, name: nil)
571
+ @email = email
572
+ @external_id = external_id
573
+ @name = name
574
+ freeze
575
+ end
576
+
577
+ # The body as the API reads it.
578
+ def to_wire
579
+ wire = {}
580
+ wire["email"] = @email unless @email.nil?
581
+ wire["external_id"] = @external_id unless @external_id.nil?
582
+ wire["name"] = @name unless @name.nil?
583
+ wire
584
+ end
585
+ end
586
+
101
587
  # The body of prices:create.
102
588
  class PricesCreateParams < Params
103
589
  MEMBERS = %i[amount_cents interval product_id type].freeze
@@ -105,6 +591,7 @@ module Perata
105
591
  # @return [Integer]
106
592
  attr_reader :amount_cents
107
593
 
594
+ # Obrigatório no preço recorrente; o preço one_time não tem intervalo.
108
595
  # @return [String ("month", "year"), nil]
109
596
  attr_reader :interval
110
597
 
@@ -158,6 +645,31 @@ module Perata
158
645
  end
159
646
  end
160
647
 
648
+ # The body of products:update.
649
+ class ProductsUpdateParams < Params
650
+ MEMBERS = %i[description name].freeze
651
+
652
+ # @return [String, nil]
653
+ attr_reader :description
654
+
655
+ # @return [String, nil]
656
+ attr_reader :name
657
+
658
+ def initialize(description: nil, name: nil)
659
+ @description = description
660
+ @name = name
661
+ freeze
662
+ end
663
+
664
+ # The body as the API reads it.
665
+ def to_wire
666
+ wire = {}
667
+ wire["description"] = @description unless @description.nil?
668
+ wire["name"] = @name unless @name.nil?
669
+ wire
670
+ end
671
+ end
672
+
161
673
  # The body of refunds:create.
162
674
  class RefundsCreateParams < Params
163
675
  MEMBERS = %i[amount_cents note payment_id reason].freeze
@@ -193,6 +705,39 @@ module Perata
193
705
  end
194
706
  end
195
707
 
708
+ # The body of subscriptions:update.
709
+ class SubscriptionsUpdateParams < Params
710
+ MEMBERS = %i[price_id proration_behavior quantity].freeze
711
+
712
+ # O preço recorrente para onde a assinatura vai.
713
+ # @return [String]
714
+ attr_reader :price_id
715
+
716
+ # prorate (padrão): rateia o resto do período no próximo valor cobrado; invoice: cobra a diferença agora; next_period: troca no fim do período; reset: cobra o período inteiro do novo plano agora e reinicia o ciclo.
717
+ # @return [String ("prorate", "invoice", "next_period", "reset"), nil]
718
+ attr_reader :proration_behavior
719
+
720
+ # A nova quantidade; omitida, fica a atual.
721
+ # @return [Integer, nil]
722
+ attr_reader :quantity
723
+
724
+ def initialize(price_id:, proration_behavior: nil, quantity: nil)
725
+ @price_id = price_id
726
+ @proration_behavior = proration_behavior
727
+ @quantity = quantity
728
+ freeze
729
+ end
730
+
731
+ # The body as the API reads it.
732
+ def to_wire
733
+ wire = {}
734
+ wire["price_id"] = @price_id
735
+ wire["proration_behavior"] = @proration_behavior unless @proration_behavior.nil?
736
+ wire["quantity"] = @quantity unless @quantity.nil?
737
+ wire
738
+ end
739
+ end
740
+
196
741
  # The body of subscriptions:cancel.
197
742
  class SubscriptionsCancelParams < Params
198
743
  MEMBERS = %i[at_period_end reason].freeze
@@ -217,4 +762,222 @@ module Perata
217
762
  wire
218
763
  end
219
764
  end
765
+
766
+ # The body of usage.ingest.
767
+ class UsageIngestParams < Params
768
+ MEMBERS = %i[events].freeze
769
+
770
+ # @return [Array<UsageIngestEvent>]
771
+ attr_reader :events
772
+
773
+ def initialize(events:)
774
+ @events = events
775
+ freeze
776
+ end
777
+
778
+ # The body as the API reads it.
779
+ def to_wire
780
+ wire = {}
781
+ wire["events"] = Perata.wire(@events)
782
+ wire
783
+ end
784
+ end
785
+
786
+ # Opcional. O custo de atender o evento para o vendedor, em metadata._cost; alimenta Análises › Custos e as margens.
787
+ class UsageIngestEventCost < Params
788
+ MEMBERS = %i[amount currency].freeze
789
+
790
+ # Custo em centavos, como string decimal com até seis casas.
791
+ # @return [String]
792
+ attr_reader :amount
793
+
794
+ # Moeda do custo. Apenas brl.
795
+ # @return [String ("brl")]
796
+ attr_reader :currency
797
+
798
+ def initialize(amount:, currency:)
799
+ @amount = amount
800
+ @currency = currency
801
+ freeze
802
+ end
803
+
804
+ # The body as the API reads it.
805
+ def to_wire
806
+ wire = {}
807
+ wire["amount"] = @amount
808
+ wire["currency"] = @currency
809
+ wire
810
+ end
811
+ end
812
+
813
+ # Opcional. O modelo e o fornecedor que atenderam o evento, em metadata._llm; os contadores continuam nos campos de tokens.
814
+ class UsageIngestEventLlm < Params
815
+ MEMBERS = %i[model vendor].freeze
816
+
817
+ # Modelo que atendeu o evento.
818
+ # @return [String]
819
+ attr_reader :model
820
+
821
+ # Fornecedor do modelo.
822
+ # @return [String]
823
+ attr_reader :vendor
824
+
825
+ def initialize(model:, vendor:)
826
+ @model = model
827
+ @vendor = vendor
828
+ freeze
829
+ end
830
+
831
+ # The body as the API reads it.
832
+ def to_wire
833
+ wire = {}
834
+ wire["model"] = @model
835
+ wire["vendor"] = @vendor
836
+ wire
837
+ end
838
+ end
839
+
840
+ # One item of events in UsageIngestParams.
841
+ class UsageIngestEvent < Params
842
+ MEMBERS = %i[_cost _llm cached_tokens customer_id external_event_id input_tokens occurred_at output_tokens parent_id].freeze
843
+
844
+ # Opcional. O custo de atender o evento para o vendedor, em metadata._cost; alimenta Análises › Custos e as margens.
845
+ # @return [UsageIngestEventCost, nil]
846
+ attr_reader :_cost
847
+
848
+ # Opcional. O modelo e o fornecedor que atenderam o evento, em metadata._llm; os contadores continuam nos campos de tokens.
849
+ # @return [UsageIngestEventLlm, nil]
850
+ attr_reader :_llm
851
+
852
+ # @return [String]
853
+ attr_reader :cached_tokens
854
+
855
+ # @return [String]
856
+ attr_reader :customer_id
857
+
858
+ # @return [String]
859
+ attr_reader :external_event_id
860
+
861
+ # @return [String]
862
+ attr_reader :input_tokens
863
+
864
+ # @return [String]
865
+ attr_reader :occurred_at
866
+
867
+ # @return [String]
868
+ attr_reader :output_tokens
869
+
870
+ # Opcional. O evento pai, pelo id da Peráta ou pelo external_event_id que a mesma fonte enviou; o pai precisa chegar antes, inclusive antes no mesmo lote.
871
+ # @return [String, nil]
872
+ attr_reader :parent_id
873
+
874
+ def initialize(_cost: nil, _llm: nil, cached_tokens:, customer_id:, external_event_id:, input_tokens:, occurred_at:, output_tokens:, parent_id: nil)
875
+ @_cost = _cost
876
+ @_llm = _llm
877
+ @cached_tokens = cached_tokens
878
+ @customer_id = customer_id
879
+ @external_event_id = external_event_id
880
+ @input_tokens = input_tokens
881
+ @occurred_at = occurred_at
882
+ @output_tokens = output_tokens
883
+ @parent_id = parent_id
884
+ freeze
885
+ end
886
+
887
+ # The body as the API reads it.
888
+ def to_wire
889
+ wire = {}
890
+ wire["_cost"] = Perata.wire(@_cost) unless @_cost.nil?
891
+ wire["_llm"] = Perata.wire(@_llm) unless @_llm.nil?
892
+ wire["cached_tokens"] = @cached_tokens
893
+ wire["customer_id"] = @customer_id
894
+ wire["external_event_id"] = @external_event_id
895
+ wire["input_tokens"] = @input_tokens
896
+ wire["occurred_at"] = @occurred_at
897
+ wire["output_tokens"] = @output_tokens
898
+ wire["parent_id"] = @parent_id unless @parent_id.nil?
899
+ wire
900
+ end
901
+ end
902
+
903
+ # The body of webhooks:create_endpoint.
904
+ class WebhooksCreateEndpointParams < Params
905
+ MEMBERS = %i[description events format url].freeze
906
+
907
+ # Sem ele, o domínio do endereço. Único por organização e ambiente.
908
+ # @return [String, nil]
909
+ attr_reader :description
910
+
911
+ # Os eventos de que o endpoint é avisado, da lista de eventos deste documento; sem eles, nenhum é enviado.
912
+ # @return [Array<String>, nil]
913
+ attr_reader :events
914
+
915
+ # Sem ele, o que o endereço indica.
916
+ # @return [String ("raw", "discord", "slack"), nil]
917
+ attr_reader :format
918
+
919
+ # Endereço https público; endereços internos são recusados.
920
+ # @return [String]
921
+ attr_reader :url
922
+
923
+ def initialize(description: nil, events: nil, format: nil, url:)
924
+ @description = description
925
+ @events = events
926
+ @format = format
927
+ @url = url
928
+ freeze
929
+ end
930
+
931
+ # The body as the API reads it.
932
+ def to_wire
933
+ wire = {}
934
+ wire["description"] = @description unless @description.nil?
935
+ wire["events"] = Perata.wire(@events) unless @events.nil?
936
+ wire["format"] = @format unless @format.nil?
937
+ wire["url"] = @url
938
+ wire
939
+ end
940
+ end
941
+
942
+ # The body of webhooks:update_endpoint.
943
+ class WebhooksUpdateEndpointParams < Params
944
+ MEMBERS = %i[description enabled events format url].freeze
945
+
946
+ # @return [String, nil]
947
+ attr_reader :description
948
+
949
+ # false desliga o envio, e as entregas esperam; true o religa.
950
+ # @return [Boolean, nil]
951
+ attr_reader :enabled
952
+
953
+ # Substitui os eventos.
954
+ # @return [Array<String>, nil]
955
+ attr_reader :events
956
+
957
+ # @return [String ("raw", "discord", "slack"), nil]
958
+ attr_reader :format
959
+
960
+ # @return [String, nil]
961
+ attr_reader :url
962
+
963
+ def initialize(description: nil, enabled: nil, events: nil, format: nil, url: nil)
964
+ @description = description
965
+ @enabled = enabled
966
+ @events = events
967
+ @format = format
968
+ @url = url
969
+ freeze
970
+ end
971
+
972
+ # The body as the API reads it.
973
+ def to_wire
974
+ wire = {}
975
+ wire["description"] = @description unless @description.nil?
976
+ wire["enabled"] = @enabled unless @enabled.nil?
977
+ wire["events"] = Perata.wire(@events) unless @events.nil?
978
+ wire["format"] = @format unless @format.nil?
979
+ wire["url"] = @url unless @url.nil?
980
+ wire
981
+ end
982
+ end
220
983
  end