|
1 | 1 | # File generated from our OpenAPI spec by Stainless. |
2 | 2 |
|
3 | | -from typing import List, Union, Optional |
| 3 | +from typing import List, Optional |
4 | 4 | from datetime import datetime |
5 | 5 |
|
6 | 6 | from ..price import Price |
7 | 7 | from ..._models import BaseModel |
8 | 8 |
|
9 | | -__all__ = [ |
10 | | - "CostListByExternalIDResponse", |
11 | | - "Data", |
12 | | - "DataPerPriceCost", |
13 | | - "DataPerPriceCostPerPriceCost", |
14 | | - "DataPerPriceCostPerPriceCostPriceGroup", |
15 | | - "DataPerPriceCostPerPriceCostV2", |
16 | | - "DataPerPriceCostPerPriceCostV2PriceGroup", |
17 | | -] |
| 9 | +__all__ = ["CostListByExternalIDResponse", "Data", "DataPerPriceCost"] |
18 | 10 |
|
19 | 11 |
|
20 | | -class DataPerPriceCostPerPriceCostPriceGroup(BaseModel): |
21 | | - grouping_key: str |
22 | | - """Grouping key to break down a single price's costs""" |
23 | | - |
24 | | - grouping_value: Optional[str] = None |
25 | | - |
26 | | - secondary_grouping_key: Optional[str] = None |
27 | | - """If the price is a matrix price, this is the second dimension key""" |
28 | | - |
29 | | - secondary_grouping_value: Optional[str] = None |
30 | | - |
31 | | - total: str |
32 | | - """Total costs for this group for the timeframe. |
33 | | -
|
34 | | - Note that this does not account for any minimums or discounts. |
35 | | - """ |
36 | | - |
37 | | - |
38 | | -class DataPerPriceCostPerPriceCost(BaseModel): |
| 12 | +class DataPerPriceCost(BaseModel): |
39 | 13 | price: Price |
40 | 14 | """ |
41 | 15 | The Price resource represents a price that can be billed on a subscription, |
@@ -277,289 +251,10 @@ class DataPerPriceCostPerPriceCost(BaseModel): |
277 | 251 | total: str |
278 | 252 | """Price's contributions for the timeframe, including minimums and discounts.""" |
279 | 253 |
|
280 | | - price_groups: Optional[List[DataPerPriceCostPerPriceCostPriceGroup]] = None |
281 | | - """ |
282 | | - If a `group_by` attribute is passed in, array of costs per `grouping_key`, |
283 | | - `grouping_value` or `secondary_grouping_key`, `secondary_grouping_value`. |
284 | | - """ |
285 | | - |
286 | 254 | quantity: Optional[float] = None |
287 | 255 | """The price's quantity for the timeframe""" |
288 | 256 |
|
289 | 257 |
|
290 | | -class DataPerPriceCostPerPriceCostV2PriceGroup(BaseModel): |
291 | | - grouping_key: str |
292 | | - """Grouping key to break down a single price's costs""" |
293 | | - |
294 | | - grouping_value: Optional[str] = None |
295 | | - |
296 | | - secondary_grouping_key: Optional[str] = None |
297 | | - """If the price is a matrix price, this is the second dimension key""" |
298 | | - |
299 | | - secondary_grouping_value: Optional[str] = None |
300 | | - |
301 | | - total: str |
302 | | - """Total costs for this group for the timeframe. |
303 | | -
|
304 | | - Note that this does not account for any minimums or discounts. |
305 | | - """ |
306 | | - |
307 | | - |
308 | | -class DataPerPriceCostPerPriceCostV2(BaseModel): |
309 | | - price: Price |
310 | | - """ |
311 | | - The Price resource represents a price that can be billed on a subscription, |
312 | | - resulting in a charge on an invoice in the form of an invoice line item. Prices |
313 | | - take a quantity and determine an amount to bill. |
314 | | -
|
315 | | - Orb supports a few different pricing models out of the box. Each of these models |
316 | | - is serialized differently in a given Price object. The model_type field |
317 | | - determines the key for the configuration object that is present. |
318 | | -
|
319 | | - ## Unit pricing |
320 | | -
|
321 | | - With unit pricing, each unit costs a fixed amount. |
322 | | -
|
323 | | - ```json |
324 | | - { |
325 | | - ... |
326 | | - "model_type": "unit", |
327 | | - "unit_config": { |
328 | | - "unit_amount": "0.50" |
329 | | - } |
330 | | - ... |
331 | | - } |
332 | | - ``` |
333 | | -
|
334 | | - ## Tiered pricing |
335 | | -
|
336 | | - In tiered pricing, the cost of a given unit depends on the tier range that it |
337 | | - falls into, where each tier range is defined by an upper and lower bound. For |
338 | | - example, the first ten units may cost $0.50 each and all units thereafter may |
339 | | - cost $0.10 each. |
340 | | -
|
341 | | - ```json |
342 | | - { |
343 | | - ... |
344 | | - "model_type": "tiered", |
345 | | - "tiered_config": { |
346 | | - "tiers": [ |
347 | | - { |
348 | | - "first_unit": 1, |
349 | | - "last_unit": 10, |
350 | | - "unit_amount": "0.50" |
351 | | - }, |
352 | | - { |
353 | | - "first_unit": 11, |
354 | | - "last_unit": null, |
355 | | - "unit_amount": "0.10" |
356 | | - } |
357 | | - ] |
358 | | - } |
359 | | - ... |
360 | | - ``` |
361 | | -
|
362 | | - ## Bulk pricing |
363 | | -
|
364 | | - Bulk pricing applies when the number of units determine the cost of all units. |
365 | | - For example, if you've bought less than 10 units, they may each be $0.50 for a |
366 | | - total of $5.00. Once you've bought more than 10 units, all units may now be |
367 | | - priced at $0.40 (i.e. 101 units total would be $40.40). |
368 | | -
|
369 | | - ```json |
370 | | - { |
371 | | - ... |
372 | | - "model_type": "bulk", |
373 | | - "bulk_config": { |
374 | | - "tiers": [ |
375 | | - { |
376 | | - "maximum_units": 10, |
377 | | - "unit_amount": "0.50" |
378 | | - }, |
379 | | - { |
380 | | - "maximum_units": 1000, |
381 | | - "unit_amount": "0.40" |
382 | | - } |
383 | | - ] |
384 | | - } |
385 | | - ... |
386 | | - } |
387 | | - ``` |
388 | | -
|
389 | | - ## Package pricing |
390 | | -
|
391 | | - Package pricing defines the size or granularity of a unit for billing purposes. |
392 | | - For example, if the package size is set to 5, then 4 units will be billed as 5 |
393 | | - and 6 units will be billed at 10. |
394 | | -
|
395 | | - ```json |
396 | | - { |
397 | | - ... |
398 | | - "model_type": "package", |
399 | | - "package_config": { |
400 | | - "package_amount": "0.80", |
401 | | - "package_size": 10 |
402 | | - } |
403 | | - ... |
404 | | - } |
405 | | - ``` |
406 | | -
|
407 | | - ## BPS pricing |
408 | | -
|
409 | | - BPS pricing specifies a per-event (e.g. per-payment) rate in one hundredth of a |
410 | | - percent (the number of basis points to charge), as well as a cap per event to |
411 | | - assess. For example, this would allow you to assess a fee of 0.25% on every |
412 | | - payment you process, with a maximum charge of $25 per payment. |
413 | | -
|
414 | | - ```json |
415 | | - { |
416 | | - ... |
417 | | - "model_type": "bps", |
418 | | - "bps_config": { |
419 | | - "bps": 125, |
420 | | - "per_unit_maximum": "11.00" |
421 | | - } |
422 | | - ... |
423 | | - } |
424 | | - ``` |
425 | | -
|
426 | | - ## Bulk BPS pricing |
427 | | -
|
428 | | - Bulk BPS pricing specifies BPS parameters in a tiered manner, dependent on the |
429 | | - total quantity across all events. Similar to bulk pricing, the BPS parameters of |
430 | | - a given event depends on the tier range that the billing period falls into. Each |
431 | | - tier range is defined by an upper bound. For example, after $1.5M of payment |
432 | | - volume is reached, each individual payment may have a lower cap or a smaller |
433 | | - take-rate. |
434 | | -
|
435 | | - ```json |
436 | | - ... |
437 | | - "model_type": "bulk_bps", |
438 | | - "bulk_bps_config": { |
439 | | - "tiers": [ |
440 | | - { |
441 | | - "maximum_amount": "1000000.00", |
442 | | - "bps": 125, |
443 | | - "per_unit_maximum": "19.00" |
444 | | - }, |
445 | | - { |
446 | | - "maximum_amount": null, |
447 | | - "bps": 115, |
448 | | - "per_unit_maximum": "4.00" |
449 | | - } |
450 | | - ] |
451 | | - } |
452 | | - ... |
453 | | - } |
454 | | - ``` |
455 | | -
|
456 | | - ## Tiered BPS pricing |
457 | | -
|
458 | | - Tiered BPS pricing specifies BPS parameters in a graduated manner, where an |
459 | | - event's applicable parameter is a function of its marginal addition to the |
460 | | - period total. Similar to tiered pricing, the BPS parameters of a given event |
461 | | - depends on the tier range that it falls into, where each tier range is defined |
462 | | - by an upper and lower bound. For example, the first few payments may have a 0.8 |
463 | | - BPS take-rate and all payments after a specific volume may incur a take-rate of |
464 | | - 0.5 BPS each. |
465 | | -
|
466 | | - ```json |
467 | | - ... |
468 | | - "model_type": "tiered_bps", |
469 | | - "tiered_bps_config": { |
470 | | - "tiers": [ |
471 | | - { |
472 | | - "minimum_amount": "0", |
473 | | - "maximum_amount": "1000000.00", |
474 | | - "bps": 125, |
475 | | - "per_unit_maximum": "19.00" |
476 | | - }, |
477 | | - { |
478 | | - "minimum_amount": "1000000.00", |
479 | | - "maximum_amount": null, |
480 | | - "bps": 115, |
481 | | - "per_unit_maximum": "4.00" |
482 | | - } |
483 | | - ] |
484 | | - } |
485 | | - ... |
486 | | - } |
487 | | - ``` |
488 | | -
|
489 | | - ## Matrix pricing |
490 | | -
|
491 | | - Matrix pricing defines a set of unit prices in a one or two-dimensional matrix. |
492 | | - `dimensions` defines the two event property values evaluated in this pricing |
493 | | - model. In a one-dimensional matrix, the second value is `null`. Every |
494 | | - configuration has a list of `matrix_values` which give the unit prices for |
495 | | - specified property values. In a one-dimensional matrix, the matrix values will |
496 | | - have `dimension_values` where the second value of the pair is null. If an event |
497 | | - does not match any of the dimension values in the matrix, it will resort to the |
498 | | - `default_unit_amount`. |
499 | | -
|
500 | | - ```json |
501 | | - { |
502 | | - "model_type": "matrix" |
503 | | - "matrix_config": { |
504 | | - "default_unit_amount": "3.00", |
505 | | - "dimensions": [ |
506 | | - "cluster_name", |
507 | | - "region" |
508 | | - ], |
509 | | - "matrix_values": [ |
510 | | - { |
511 | | - "dimension_values": [ |
512 | | - "alpha", |
513 | | - "west" |
514 | | - ], |
515 | | - "unit_amount": "2.00" |
516 | | - }, |
517 | | - ... |
518 | | - ] |
519 | | - } |
520 | | - } |
521 | | - ``` |
522 | | -
|
523 | | - ### Fixed fees |
524 | | -
|
525 | | - Fixed fees are prices that are applied independent of usage quantities, and |
526 | | - follow unit pricing. They also have an additional parameter |
527 | | - `fixed_price_quantity`. If the Price represents a fixed cost, this represents |
528 | | - the quantity of units applied. |
529 | | -
|
530 | | - ```json |
531 | | - { |
532 | | - ... |
533 | | - "id": "price_id", |
534 | | - "model_type": "unit", |
535 | | - "unit_config": { |
536 | | - "unit_amount": "2.00" |
537 | | - }, |
538 | | - "fixed_price_quantity": 3.0 |
539 | | - ... |
540 | | - } |
541 | | - ``` |
542 | | - """ |
543 | | - |
544 | | - subtotal: str |
545 | | - """Price's contributions for the timeframe, excluding any minimums and discounts.""" |
546 | | - |
547 | | - total: str |
548 | | - """Price's contributions for the timeframe, including minimums and discounts.""" |
549 | | - |
550 | | - price_groups: Optional[List[DataPerPriceCostPerPriceCostV2PriceGroup]] = None |
551 | | - """ |
552 | | - If a `group_by` attribute is passed in, array of costs per `grouping_key`, |
553 | | - `grouping_value` or `secondary_grouping_key`, `secondary_grouping_value`. |
554 | | - """ |
555 | | - |
556 | | - quantity: Optional[float] = None |
557 | | - """The price's quantity for the timeframe""" |
558 | | - |
559 | | - |
560 | | -DataPerPriceCost = Union[DataPerPriceCostPerPriceCost, DataPerPriceCostPerPriceCostV2] |
561 | | - |
562 | | - |
563 | 258 | class Data(BaseModel): |
564 | 259 | per_price_costs: List[DataPerPriceCost] |
565 | 260 |
|
|
0 commit comments