diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8f3e0a49..b4e9013b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.15.0" + ".": "0.16.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 37514f77..4abb6618 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,136 @@ # Changelog +## 0.16.0 (2025-01-03) + +Full Changelog: [v0.15.0...v0.16.0](https://github.com/orbcorp/orb-java/compare/v0.15.0...v0.16.0) + +### ⚠ BREAKING CHANGES + +* **api:** endpoint expects amount of new allocation price to be a string, not a number ([#10](https://github.com/orbcorp/orb-java/issues/10)) +* **api:** add semi_annual cadence and remove metadata from update items ([#2](https://github.com/orbcorp/orb-java/issues/2)) + +### Features + +* **api:** add semi_annual cadence and remove metadata from update items ([#2](https://github.com/orbcorp/orb-java/issues/2)) ([38298ff](https://github.com/orbcorp/orb-java/commit/38298fffb277246750d838f4f705d3ad1a9237f8)) +* **api:** add support for adding allocation price to subscription ([#8](https://github.com/orbcorp/orb-java/issues/8)) ([d150c33](https://github.com/orbcorp/orb-java/commit/d150c33743c505658aeb09b639ea4b739ad4322c)) +* **api:** add support for query param include_all_blocks ([#11](https://github.com/orbcorp/orb-java/issues/11)) ([73d5e94](https://github.com/orbcorp/orb-java/commit/73d5e9453745dda4c138bed77c3dc71b306f37f3)) +* **api:** add webhook validation and parsing ([#111](https://github.com/orbcorp/orb-java/issues/111)) ([4472875](https://github.com/orbcorp/orb-java/commit/44728754a99a0f06db78e6dffc215da599886913)) +* **api:** api update ([#103](https://github.com/orbcorp/orb-java/issues/103)) ([aeb1fed](https://github.com/orbcorp/orb-java/commit/aeb1fed100a2ec3ab167b802d005238839ce16dd)) +* **api:** api update ([#112](https://github.com/orbcorp/orb-java/issues/112)) ([aedd2bf](https://github.com/orbcorp/orb-java/commit/aedd2bf4a7266560d9b1ee1f372bb4490ac22021)) +* **api:** api update ([#125](https://github.com/orbcorp/orb-java/issues/125)) ([e74b0c3](https://github.com/orbcorp/orb-java/commit/e74b0c31d3d11a4423fc6e7d4e33bbe764a80e8c)) +* **api:** api update ([#129](https://github.com/orbcorp/orb-java/issues/129)) ([e8edbd0](https://github.com/orbcorp/orb-java/commit/e8edbd02e37c71b4f3efdecd13996e6bcb9a1f1e)) +* **api:** api update ([#131](https://github.com/orbcorp/orb-java/issues/131)) ([1733a5c](https://github.com/orbcorp/orb-java/commit/1733a5cdb272627dc19f53269cf11953dc00e37b)) +* **api:** api update ([#137](https://github.com/orbcorp/orb-java/issues/137)) ([60695f9](https://github.com/orbcorp/orb-java/commit/60695f967b5c91f7ebeaa2c36bd5fddc5914a2ea)) +* **api:** api update ([#140](https://github.com/orbcorp/orb-java/issues/140)) ([6a3362e](https://github.com/orbcorp/orb-java/commit/6a3362e8fa8181f732195e8391bf6e39329f23ec)) +* **api:** api update ([#152](https://github.com/orbcorp/orb-java/issues/152)) ([7a78319](https://github.com/orbcorp/orb-java/commit/7a78319428de5e34858e6d9e73c5b4b21da4b2ad)) +* **api:** api update ([#154](https://github.com/orbcorp/orb-java/issues/154)) ([770d4cc](https://github.com/orbcorp/orb-java/commit/770d4cc165b3d6952efd593141759c3b59a1f1b9)) +* **api:** api update ([#159](https://github.com/orbcorp/orb-java/issues/159)) ([f51bb21](https://github.com/orbcorp/orb-java/commit/f51bb21f026a27c10107516546fe079192e5c5ee)) +* **api:** api update ([#161](https://github.com/orbcorp/orb-java/issues/161)) ([6b21c9b](https://github.com/orbcorp/orb-java/commit/6b21c9bccc2baf99fe45c25e62253db9b543381e)) +* **api:** api update ([#81](https://github.com/orbcorp/orb-java/issues/81)) ([6b595ca](https://github.com/orbcorp/orb-java/commit/6b595caf0ced6da64742883efae7ff55aa3a74b6)) +* **api:** api update ([#82](https://github.com/orbcorp/orb-java/issues/82)) ([3d2aa72](https://github.com/orbcorp/orb-java/commit/3d2aa72926de34616e5c622197204f32c48462bf)) +* **api:** api update ([#84](https://github.com/orbcorp/orb-java/issues/84)) ([89db90d](https://github.com/orbcorp/orb-java/commit/89db90d6b9ca93f3469b8095f193e943e2580c83)) +* **api:** api update ([#85](https://github.com/orbcorp/orb-java/issues/85)) ([ccb4f21](https://github.com/orbcorp/orb-java/commit/ccb4f21cabdd7a8db4a57fe7a8de1570ce4a1863)) +* **api:** api update ([#86](https://github.com/orbcorp/orb-java/issues/86)) ([4f4639d](https://github.com/orbcorp/orb-java/commit/4f4639dbf70bbb75f56e96fc574441a37518656e)) +* **api:** api update ([#87](https://github.com/orbcorp/orb-java/issues/87)) ([925563d](https://github.com/orbcorp/orb-java/commit/925563d00a38d6f78a56413aa8a24cf61fc41805)) +* **api:** api update ([#88](https://github.com/orbcorp/orb-java/issues/88)) ([8a09a17](https://github.com/orbcorp/orb-java/commit/8a09a173eec143cc8f574c4623985b69246bc8fe)) +* **api:** api update ([#90](https://github.com/orbcorp/orb-java/issues/90)) ([6a7b7b8](https://github.com/orbcorp/orb-java/commit/6a7b7b8e059d6d1257d0e256818f01f5778a4636)) +* **api:** api update ([#92](https://github.com/orbcorp/orb-java/issues/92)) ([b06d37a](https://github.com/orbcorp/orb-java/commit/b06d37a55e7746a5058750036acf5e7ff888f866)) +* **api:** api update ([#93](https://github.com/orbcorp/orb-java/issues/93)) ([311c123](https://github.com/orbcorp/orb-java/commit/311c123cd870144fcbda844e1d9dbc0843fc320e)) +* **api:** api update ([#94](https://github.com/orbcorp/orb-java/issues/94)) ([1ab1485](https://github.com/orbcorp/orb-java/commit/1ab148544455697718f423e1bde89f39669b53ae)) +* **api:** api update ([#97](https://github.com/orbcorp/orb-java/issues/97)) ([d85ab62](https://github.com/orbcorp/orb-java/commit/d85ab623e23c592afc053ad6ade1aec9c7e07de9)) +* **api:** codegen changes ([#39](https://github.com/orbcorp/orb-java/issues/39)) ([4568489](https://github.com/orbcorp/orb-java/commit/4568489793e5a8793a8ebe847efa218cdaa494e5)) +* **api:** codegen changes ([#48](https://github.com/orbcorp/orb-java/issues/48)) ([8a0190e](https://github.com/orbcorp/orb-java/commit/8a0190e72457485174719ab58948dc474d53ca25)) +* **api:** external connections made optional when updating items ([#9](https://github.com/orbcorp/orb-java/issues/9)) ([d1a63a3](https://github.com/orbcorp/orb-java/commit/d1a63a3edcd71535e421b9ded0f749e96d18b253)) +* **api:** manual updates ([#40](https://github.com/orbcorp/orb-java/issues/40)) ([423de9f](https://github.com/orbcorp/orb-java/commit/423de9f49600ef8deac5049da1f96956fddcf69f)) +* **api:** OpenAPI spec update via Stainless API ([#31](https://github.com/orbcorp/orb-java/issues/31)) ([aec4e89](https://github.com/orbcorp/orb-java/commit/aec4e89c811c7704b68ca6acbe2c81f1f2dbfd8c)) +* **api:** OpenAPI spec update via Stainless API ([#34](https://github.com/orbcorp/orb-java/issues/34)) ([3a42785](https://github.com/orbcorp/orb-java/commit/3a427852b444a502116457fb1d45ff85e9378cd5)) +* **api:** OpenAPI spec update via Stainless API ([#36](https://github.com/orbcorp/orb-java/issues/36)) ([03178df](https://github.com/orbcorp/orb-java/commit/03178dfaa6bfd6a3b180438916cb44738bb084d4)) +* **api:** OpenAPI spec update via Stainless API ([#37](https://github.com/orbcorp/orb-java/issues/37)) ([6d07d56](https://github.com/orbcorp/orb-java/commit/6d07d56a02f520af24180d9e825b9551c8d4bf7a)) +* **api:** OpenAPI spec update via Stainless API ([#38](https://github.com/orbcorp/orb-java/issues/38)) ([a92d627](https://github.com/orbcorp/orb-java/commit/a92d627184db41c58d90bf860e1746276a4228fb)) +* **api:** OpenAPI spec update via Stainless API ([#41](https://github.com/orbcorp/orb-java/issues/41)) ([64fdca5](https://github.com/orbcorp/orb-java/commit/64fdca5952f67afccb6220c99bc39a6417bb8ba2)) +* **api:** OpenAPI spec update via Stainless API ([#43](https://github.com/orbcorp/orb-java/issues/43)) ([ed5e3c8](https://github.com/orbcorp/orb-java/commit/ed5e3c8cafa1abfee247ddbe824700084ef7d7a7)) +* **api:** OpenAPI spec update via Stainless API ([#44](https://github.com/orbcorp/orb-java/issues/44)) ([9941471](https://github.com/orbcorp/orb-java/commit/994147155249ff02075d5c590671654cbcbb6676)) +* **api:** OpenAPI spec update via Stainless API ([#45](https://github.com/orbcorp/orb-java/issues/45)) ([055d0a8](https://github.com/orbcorp/orb-java/commit/055d0a81db48729e99980b83ac275338d6aa1e7b)) +* **api:** OpenAPI spec update via Stainless API ([#47](https://github.com/orbcorp/orb-java/issues/47)) ([cbb6cca](https://github.com/orbcorp/orb-java/commit/cbb6cca7e31e1c44ae3b00811fb5979e2912d5e8)) +* **api:** OpenAPI spec update via Stainless API ([#50](https://github.com/orbcorp/orb-java/issues/50)) ([2bd0af6](https://github.com/orbcorp/orb-java/commit/2bd0af6f644d5f0273003f22af55c4116ea325a0)) +* **api:** OpenAPI spec update via Stainless API ([#51](https://github.com/orbcorp/orb-java/issues/51)) ([c4e232e](https://github.com/orbcorp/orb-java/commit/c4e232ed8a840f5f0da7618f489fa3c24d9c5af4)) +* **api:** OpenAPI spec update via Stainless API ([#52](https://github.com/orbcorp/orb-java/issues/52)) ([773d7e7](https://github.com/orbcorp/orb-java/commit/773d7e71970a4629fbfd32c92ebfd1c8288c3327)) +* **api:** OpenAPI spec update via Stainless API ([#53](https://github.com/orbcorp/orb-java/issues/53)) ([7efa5f4](https://github.com/orbcorp/orb-java/commit/7efa5f4042e763b642d99e3b41dcf5350ceb97b8)) +* **api:** OpenAPI spec update via Stainless API ([#54](https://github.com/orbcorp/orb-java/issues/54)) ([f9006eb](https://github.com/orbcorp/orb-java/commit/f9006ebdc60bb00a77a7d574c82601b32f86ac4c)) +* **api:** OpenAPI spec update via Stainless API ([#55](https://github.com/orbcorp/orb-java/issues/55)) ([73ed069](https://github.com/orbcorp/orb-java/commit/73ed069286d3e6e23081f31bcae1c4739f3ef5c3)) +* **api:** OpenAPI spec update via Stainless API ([#57](https://github.com/orbcorp/orb-java/issues/57)) ([4a3ce75](https://github.com/orbcorp/orb-java/commit/4a3ce752daa3fc63a858b3f94c033b5e2bde0288)) +* **api:** OpenAPI spec update via Stainless API ([#59](https://github.com/orbcorp/orb-java/issues/59)) ([8e8574c](https://github.com/orbcorp/orb-java/commit/8e8574cb159e45ab036088048a1362a6a8c32cc2)) +* **api:** OpenAPI spec update via Stainless API ([#61](https://github.com/orbcorp/orb-java/issues/61)) ([b48f9fe](https://github.com/orbcorp/orb-java/commit/b48f9fe87aae83b2bb028a4c8216a66f26af8801)) +* **api:** OpenAPI spec update via Stainless API ([#63](https://github.com/orbcorp/orb-java/issues/63)) ([fd13223](https://github.com/orbcorp/orb-java/commit/fd13223cd190ecee0312f5d64d74522db567d864)) +* **api:** OpenAPI spec update via Stainless API ([#67](https://github.com/orbcorp/orb-java/issues/67)) ([afffd96](https://github.com/orbcorp/orb-java/commit/afffd968e135d74d899c0377b0f6e5bf1787ae33)) +* **api:** OpenAPI spec update via Stainless API ([#68](https://github.com/orbcorp/orb-java/issues/68)) ([bd66065](https://github.com/orbcorp/orb-java/commit/bd6606510bf4dad9be78d019b9130542d0a9a532)) +* **api:** OpenAPI spec update via Stainless API ([#70](https://github.com/orbcorp/orb-java/issues/70)) ([8ab0aab](https://github.com/orbcorp/orb-java/commit/8ab0aab0ebea8a4d147a9c93b0e30917192743a6)) +* **api:** OpenAPI spec update via Stainless API ([#76](https://github.com/orbcorp/orb-java/issues/76)) ([5013205](https://github.com/orbcorp/orb-java/commit/50132057be8af15e443e6c6ee6a3828d24b888c0)) +* **api:** OpenAPI spec update via Stainless API ([#78](https://github.com/orbcorp/orb-java/issues/78)) ([e745d41](https://github.com/orbcorp/orb-java/commit/e745d410327507e514b35968c97b29c7983b90df)) +* **api:** OpenAPI spec update via Stainless API ([#80](https://github.com/orbcorp/orb-java/issues/80)) ([e1fc9e9](https://github.com/orbcorp/orb-java/commit/e1fc9e9f9b9f38313e051194e430880cfa46dad4)) +* **api:** updates ([#5](https://github.com/orbcorp/orb-java/issues/5)) ([fb8c7d9](https://github.com/orbcorp/orb-java/commit/fb8c7d974e51d260d1bb9aa1f93021a64288589a)) +* **client:** add logging when debug env is set ([#124](https://github.com/orbcorp/orb-java/issues/124)) ([3a54438](https://github.com/orbcorp/orb-java/commit/3a5443850294502d15401f96a0e7680dbd60275d)) +* **client:** add support for `putQueryParam` on `ClientOptions` ([#6](https://github.com/orbcorp/orb-java/issues/6)) ([71d82b0](https://github.com/orbcorp/orb-java/commit/71d82b0545a51df2abb8ebfe852991d9f740d498)) +* **client:** added structured fields to errors ([#65](https://github.com/orbcorp/orb-java/issues/65)) ([e6226f9](https://github.com/orbcorp/orb-java/commit/e6226f9a57e42c1786353757aca5b32744a24ffb)) + + +### Bug Fixes + +* **api:** endpoint expects amount of new allocation price to be a string, not a number ([#10](https://github.com/orbcorp/orb-java/issues/10)) ([f38419a](https://github.com/orbcorp/orb-java/commit/f38419a6c6b10b5137d573dfc9c7f5a96a302348)) +* **docs:** use correct putAdditionalProperty value ([#42](https://github.com/orbcorp/orb-java/issues/42)) ([4f236bc](https://github.com/orbcorp/orb-java/commit/4f236bc7d29a65895aafd0c9c5e6e1745fb42bad)) +* **internal:** add missing options ([49c0367](https://github.com/orbcorp/orb-java/commit/49c03672bca758f032e5125099c0e5bcf415f770)) +* **unions:** fix namespacing in example types for unions that have models ([846d155](https://github.com/orbcorp/orb-java/commit/846d15562417ca933515297623d630db0ec9e9a0)) + + +### Chores + +* **api:** rename `void` to `void_invoice` in Java SDK ([#72](https://github.com/orbcorp/orb-java/issues/72)) ([61d300a](https://github.com/orbcorp/orb-java/commit/61d300a474bca6fc47658bb3daa9dc7f1de44a16)) +* consistent string literal escaping ([#49](https://github.com/orbcorp/orb-java/issues/49)) ([556e69d](https://github.com/orbcorp/orb-java/commit/556e69d08db6005e58612fc83828329c9beb608c)) +* **docs:** improve Coupon description ([#7](https://github.com/orbcorp/orb-java/issues/7)) ([4d1d183](https://github.com/orbcorp/orb-java/commit/4d1d183eba7883c30007edc2aac0ab27c5e62600)) +* **docs:** internal update ([#74](https://github.com/orbcorp/orb-java/issues/74)) ([577588d](https://github.com/orbcorp/orb-java/commit/577588daa262f51547de5eb6785226fdca41be2b)) +* **docs:** internal update ([#75](https://github.com/orbcorp/orb-java/issues/75)) ([6905912](https://github.com/orbcorp/orb-java/commit/69059129d10672b1806b2288e044ff986c53d0c8)) +* **docs:** update readme ([#157](https://github.com/orbcorp/orb-java/issues/157)) ([26c33ec](https://github.com/orbcorp/orb-java/commit/26c33ecb791a128a35e3132359f3265a2e0f89cb)) +* **docs:** updates price intervals docs ([#12](https://github.com/orbcorp/orb-java/issues/12)) ([554df1b](https://github.com/orbcorp/orb-java/commit/554df1b92b83237d8f88cea66bee47524ee8d9db)) +* fix formatting ([6d27c6c](https://github.com/orbcorp/orb-java/commit/6d27c6c9e5047097764aa79cf7cbd00106ad8039)) +* gitignore test server logs ([#13](https://github.com/orbcorp/orb-java/issues/13)) ([11e4ebc](https://github.com/orbcorp/orb-java/commit/11e4ebc52501ab8c6ea3ba15eff0ef82134eda89)) +* **internal:** codegen related update ([#123](https://github.com/orbcorp/orb-java/issues/123)) ([9bbb41f](https://github.com/orbcorp/orb-java/commit/9bbb41f1fca7dfddc6ed2ecd1493c99183405cc5)) +* **internal:** codegen related update ([#134](https://github.com/orbcorp/orb-java/issues/134)) ([61e2a3f](https://github.com/orbcorp/orb-java/commit/61e2a3f250034b37c31697cda1f9366445d88358)) +* **internal:** codegen related update ([#163](https://github.com/orbcorp/orb-java/issues/163)) ([9361feb](https://github.com/orbcorp/orb-java/commit/9361febeaacb3ccaa005071ec9e7cf1a07037566)) +* **internal:** codegen related update ([#164](https://github.com/orbcorp/orb-java/issues/164)) ([d2a3612](https://github.com/orbcorp/orb-java/commit/d2a3612a46c69917fce2ac6a9ba0d8bda398d5d8)) +* **internal:** codegen related update ([#167](https://github.com/orbcorp/orb-java/issues/167)) ([5064c6d](https://github.com/orbcorp/orb-java/commit/5064c6d8c3faec116445162be14797b14e3adf60)) +* **internal:** codegen related update ([#56](https://github.com/orbcorp/orb-java/issues/56)) ([837e1ed](https://github.com/orbcorp/orb-java/commit/837e1ed1619d993c680581d3dc6a9e02e1c9f8a6)) +* **internal:** codegen related update ([#71](https://github.com/orbcorp/orb-java/issues/71)) ([99ddc03](https://github.com/orbcorp/orb-java/commit/99ddc031f02c7fe5648bfad4b6de0481864707cc)) +* **internal:** codegen related update ([#73](https://github.com/orbcorp/orb-java/issues/73)) ([5021325](https://github.com/orbcorp/orb-java/commit/50213258784197ba307bfe34f7c82a8ee821439a)) +* **internal:** fix lint warning for isPresent ([#66](https://github.com/orbcorp/orb-java/issues/66)) ([ff81eb6](https://github.com/orbcorp/orb-java/commit/ff81eb6ab227a308b45b0fa961ce3a8759826fdf)) +* **internal:** remove unused and expand used wildcard imports ([#150](https://github.com/orbcorp/orb-java/issues/150)) ([f2ff940](https://github.com/orbcorp/orb-java/commit/f2ff940f47f5d584cff2d737e02a048b01dc07f3)) +* **internal:** remove unused and expand used wildcard imports ([#151](https://github.com/orbcorp/orb-java/issues/151)) ([36ec9ab](https://github.com/orbcorp/orb-java/commit/36ec9ab1cb60ab066483d92e64df3bbb4cfe1103)) +* **internal:** remove unused imports ([#147](https://github.com/orbcorp/orb-java/issues/147)) ([fb322e7](https://github.com/orbcorp/orb-java/commit/fb322e7077af79c5e7ce7eb7f87bda7e2723df26)) +* **internal:** update example values ([#127](https://github.com/orbcorp/orb-java/issues/127)) ([78608a6](https://github.com/orbcorp/orb-java/commit/78608a6180b01aa0499a9754eff16064d260f4d5)) +* **internal:** version bump ([#100](https://github.com/orbcorp/orb-java/issues/100)) ([3993648](https://github.com/orbcorp/orb-java/commit/39936484979235feef711bfde8f3e2333df69d7b)) +* **internal:** version bump ([#109](https://github.com/orbcorp/orb-java/issues/109)) ([0a4c949](https://github.com/orbcorp/orb-java/commit/0a4c94986ef02371572b282ebd79c0f0d8a8a0b0)) +* **internal:** version bump ([#119](https://github.com/orbcorp/orb-java/issues/119)) ([793a5e4](https://github.com/orbcorp/orb-java/commit/793a5e4c812ce6eadba334e9a084026c8b10d68d)) +* **internal:** version bump ([#121](https://github.com/orbcorp/orb-java/issues/121)) ([8b54a94](https://github.com/orbcorp/orb-java/commit/8b54a9444164d3577705770cd35e1e0806b0f926)) +* **internal:** version bump ([#122](https://github.com/orbcorp/orb-java/issues/122)) ([ed488d2](https://github.com/orbcorp/orb-java/commit/ed488d23958a93d2f606c49307eb5a5abdfdc31d)) +* **internal:** version bump ([#89](https://github.com/orbcorp/orb-java/issues/89)) ([14ae070](https://github.com/orbcorp/orb-java/commit/14ae070250523c21dd90a82cbd70685694bbbb87)) +* rebuild project due to codegen change ([#105](https://github.com/orbcorp/orb-java/issues/105)) ([686edce](https://github.com/orbcorp/orb-java/commit/686edce1218e41f4c48735dfe563601c1b354426)) +* rebuild project due to codegen change ([#107](https://github.com/orbcorp/orb-java/issues/107)) ([15f22cd](https://github.com/orbcorp/orb-java/commit/15f22cdf943dd29bfcd710ef410c92bd33fa237b)) +* rebuild project due to codegen change ([#116](https://github.com/orbcorp/orb-java/issues/116)) ([94d7006](https://github.com/orbcorp/orb-java/commit/94d700697d44adede203c1f7d3dda1e67f37eae2)) +* **test:** remove unused imports ([#148](https://github.com/orbcorp/orb-java/issues/148)) ([6f766e5](https://github.com/orbcorp/orb-java/commit/6f766e534aca6263f04c28321904493f3d02cc1b)) +* **test:** use `JsonValue` instead of `JsonString` ([#149](https://github.com/orbcorp/orb-java/issues/149)) ([119422b](https://github.com/orbcorp/orb-java/commit/119422b8ded3064bf6dd2566b9cfabac0087068c)) +* update example values in tests and docs ([#143](https://github.com/orbcorp/orb-java/issues/143)) ([28f1ab5](https://github.com/orbcorp/orb-java/commit/28f1ab5198e58c2b1e26045d8b81b1504cdd45cb)) + + +### Documentation + +* adjust additional properties example ([#64](https://github.com/orbcorp/orb-java/issues/64)) ([f200314](https://github.com/orbcorp/orb-java/commit/f20031470e553f4e414375e536e1366c2316dfb2)) +* small updates ([#3](https://github.com/orbcorp/orb-java/issues/3)) ([11b888b](https://github.com/orbcorp/orb-java/commit/11b888b44a0063a15bb0bdee64273659b9cc4514)) + + +### Styles + +* **internal:** make enum value definitions less verbose ([#145](https://github.com/orbcorp/orb-java/issues/145)) ([1a3bc07](https://github.com/orbcorp/orb-java/commit/1a3bc075994b287ce658648895c18cf4c8586db0)) +* **internal:** move enum identity methods to bottom of class ([#146](https://github.com/orbcorp/orb-java/issues/146)) ([c2bc9d2](https://github.com/orbcorp/orb-java/commit/c2bc9d251f3dc3eb887467570c68f0335d4a61b1)) + ## 0.15.0 (2025-01-02) Full Changelog: [v0.14.0...v0.15.0](https://github.com/orbcorp/orb-java/compare/v0.14.0...v0.15.0) diff --git a/LICENSE b/LICENSE index 782200ee..00b1f9c8 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2024 Orb + Copyright 2025 Orb Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index 89816dcf..7d809207 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.withorb.api/orb-java)](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.15.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.withorb.api/orb-java)](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.16.0) @@ -25,7 +25,7 @@ The REST API documentation can be found on [docs.withorb.com](https://docs.with ```kotlin -implementation("com.withorb.api:orb-java:0.15.0") +implementation("com.withorb.api:orb-java:0.16.0") ``` #### Maven @@ -34,7 +34,7 @@ implementation("com.withorb.api:orb-java:0.15.0") com.withorb.api orb-java - 0.15.0 + 0.16.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 7d153221..b1ecc9ee 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { allprojects { group = "com.withorb.api" - version = "0.15.0" // x-release-please-version + version = "0.16.0" // x-release-please-version } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt index f1c01fee..6f0bec20 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt @@ -14,8 +14,6 @@ import com.withorb.api.services.blocking.CustomerService import com.withorb.api.services.blocking.CustomerServiceImpl import com.withorb.api.services.blocking.DimensionalPriceGroupService import com.withorb.api.services.blocking.DimensionalPriceGroupServiceImpl -import com.withorb.api.services.blocking.WebhookService -import com.withorb.api.services.blocking.WebhookServiceImpl import com.withorb.api.services.blocking.EventService import com.withorb.api.services.blocking.EventServiceImpl import com.withorb.api.services.blocking.InvoiceLineItemService @@ -34,6 +32,8 @@ import com.withorb.api.services.blocking.SubscriptionService import com.withorb.api.services.blocking.SubscriptionServiceImpl import com.withorb.api.services.blocking.TopLevelService import com.withorb.api.services.blocking.TopLevelServiceImpl +import com.withorb.api.services.blocking.WebhookService +import com.withorb.api.services.blocking.WebhookServiceImpl class OrbClientImpl constructor( diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt index e2f067e5..33e110b3 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt @@ -22,37 +22,29 @@ import java.util.Optional class AlertCreateForCustomerParams constructor( private val customerId: String, - private val currency: String, - private val type: Type, - private val thresholds: List?, + private val body: AlertCreateForCustomerBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun customerId(): String = customerId - fun currency(): String = currency + /** The case sensitive currency or custom pricing unit to use for this alert. */ + fun currency(): String = body.currency() - fun type(): Type = type + /** The type of alert to create. This must be a valid alert type. */ + fun type(): Type = body.type() - fun thresholds(): Optional> = Optional.ofNullable(thresholds) + /** The thresholds that define the values at which the alert will be triggered. */ + fun thresholds(): Optional> = body.thresholds() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): AlertCreateForCustomerBody { - return AlertCreateForCustomerBody( - currency, - type, - thresholds, - additionalBodyProperties, - ) - } + @JvmSynthetic internal fun getBody(): AlertCreateForCustomerBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -101,7 +93,7 @@ constructor( private var currency: String? = null private var type: Type? = null - private var thresholds: List? = null + private var thresholds: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -120,7 +112,14 @@ constructor( fun type(type: Type) = apply { this.type = type } /** The thresholds that define the values at which the alert will be triggered. */ - fun thresholds(thresholds: List) = apply { this.thresholds = thresholds } + fun thresholds(thresholds: List) = apply { + this.thresholds = thresholds.toMutableList() + } + + /** The thresholds that define the values at which the alert will be triggered. */ + fun addThreshold(threshold: Threshold) = apply { + thresholds = (thresholds ?: mutableListOf()).apply { add(threshold) } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -179,41 +178,31 @@ constructor( class Builder { private var customerId: String? = null - private var currency: String? = null - private var type: Type? = null - private var thresholds: MutableList = mutableListOf() + private var body: AlertCreateForCustomerBody.Builder = AlertCreateForCustomerBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(alertCreateForCustomerParams: AlertCreateForCustomerParams) = apply { customerId = alertCreateForCustomerParams.customerId - currency = alertCreateForCustomerParams.currency - type = alertCreateForCustomerParams.type - thresholds = alertCreateForCustomerParams.thresholds?.toMutableList() ?: mutableListOf() + body = alertCreateForCustomerParams.body.toBuilder() additionalHeaders = alertCreateForCustomerParams.additionalHeaders.toBuilder() additionalQueryParams = alertCreateForCustomerParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - alertCreateForCustomerParams.additionalBodyProperties.toMutableMap() } fun customerId(customerId: String) = apply { this.customerId = customerId } /** The case sensitive currency or custom pricing unit to use for this alert. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: String) = apply { body.currency(currency) } /** The type of alert to create. This must be a valid alert type. */ - fun type(type: Type) = apply { this.type = type } + fun type(type: Type) = apply { body.type(type) } /** The thresholds that define the values at which the alert will be triggered. */ - fun thresholds(thresholds: List) = apply { - this.thresholds.clear() - this.thresholds.addAll(thresholds) - } + fun thresholds(thresholds: List) = apply { body.thresholds(thresholds) } /** The thresholds that define the values at which the alert will be triggered. */ - fun addThreshold(threshold: Threshold) = apply { this.thresholds.add(threshold) } + fun addThreshold(threshold: Threshold) = apply { body.addThreshold(threshold) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -314,36 +303,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): AlertCreateForCustomerParams = AlertCreateForCustomerParams( checkNotNull(customerId) { "`customerId` is required but was not set" }, - checkNotNull(currency) { "`currency` is required but was not set" }, - checkNotNull(type) { "`type` is required but was not set" }, - thresholds.toImmutable().ifEmpty { null }, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -517,11 +500,11 @@ constructor( return true } - return /* spotless:off */ other is AlertCreateForCustomerParams && customerId == other.customerId && currency == other.currency && type == other.type && thresholds == other.thresholds && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is AlertCreateForCustomerParams && customerId == other.customerId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(customerId, currency, type, thresholds, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(customerId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "AlertCreateForCustomerParams{customerId=$customerId, currency=$currency, type=$type, thresholds=$thresholds, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "AlertCreateForCustomerParams{customerId=$customerId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt index f76e2f71..41d2f297 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt @@ -22,37 +22,29 @@ import java.util.Optional class AlertCreateForExternalCustomerParams constructor( private val externalCustomerId: String, - private val currency: String, - private val type: Type, - private val thresholds: List?, + private val body: AlertCreateForExternalCustomerBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun externalCustomerId(): String = externalCustomerId - fun currency(): String = currency + /** The case sensitive currency or custom pricing unit to use for this alert. */ + fun currency(): String = body.currency() - fun type(): Type = type + /** The type of alert to create. This must be a valid alert type. */ + fun type(): Type = body.type() - fun thresholds(): Optional> = Optional.ofNullable(thresholds) + /** The thresholds that define the values at which the alert will be triggered. */ + fun thresholds(): Optional> = body.thresholds() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): AlertCreateForExternalCustomerBody { - return AlertCreateForExternalCustomerBody( - currency, - type, - thresholds, - additionalBodyProperties, - ) - } + @JvmSynthetic internal fun getBody(): AlertCreateForExternalCustomerBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -101,7 +93,7 @@ constructor( private var currency: String? = null private var type: Type? = null - private var thresholds: List? = null + private var thresholds: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -122,7 +114,14 @@ constructor( fun type(type: Type) = apply { this.type = type } /** The thresholds that define the values at which the alert will be triggered. */ - fun thresholds(thresholds: List) = apply { this.thresholds = thresholds } + fun thresholds(thresholds: List) = apply { + this.thresholds = thresholds.toMutableList() + } + + /** The thresholds that define the values at which the alert will be triggered. */ + fun addThreshold(threshold: Threshold) = apply { + thresholds = (thresholds ?: mutableListOf()).apply { add(threshold) } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -181,27 +180,20 @@ constructor( class Builder { private var externalCustomerId: String? = null - private var currency: String? = null - private var type: Type? = null - private var thresholds: MutableList = mutableListOf() + private var body: AlertCreateForExternalCustomerBody.Builder = + AlertCreateForExternalCustomerBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( alertCreateForExternalCustomerParams: AlertCreateForExternalCustomerParams ) = apply { externalCustomerId = alertCreateForExternalCustomerParams.externalCustomerId - currency = alertCreateForExternalCustomerParams.currency - type = alertCreateForExternalCustomerParams.type - thresholds = - alertCreateForExternalCustomerParams.thresholds?.toMutableList() ?: mutableListOf() + body = alertCreateForExternalCustomerParams.body.toBuilder() additionalHeaders = alertCreateForExternalCustomerParams.additionalHeaders.toBuilder() additionalQueryParams = alertCreateForExternalCustomerParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - alertCreateForExternalCustomerParams.additionalBodyProperties.toMutableMap() } fun externalCustomerId(externalCustomerId: String) = apply { @@ -209,19 +201,16 @@ constructor( } /** The case sensitive currency or custom pricing unit to use for this alert. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: String) = apply { body.currency(currency) } /** The type of alert to create. This must be a valid alert type. */ - fun type(type: Type) = apply { this.type = type } + fun type(type: Type) = apply { body.type(type) } /** The thresholds that define the values at which the alert will be triggered. */ - fun thresholds(thresholds: List) = apply { - this.thresholds.clear() - this.thresholds.addAll(thresholds) - } + fun thresholds(thresholds: List) = apply { body.thresholds(thresholds) } /** The thresholds that define the values at which the alert will be triggered. */ - fun addThreshold(threshold: Threshold) = apply { this.thresholds.add(threshold) } + fun addThreshold(threshold: Threshold) = apply { body.addThreshold(threshold) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -322,25 +311,22 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): AlertCreateForExternalCustomerParams = @@ -348,12 +334,9 @@ constructor( checkNotNull(externalCustomerId) { "`externalCustomerId` is required but was not set" }, - checkNotNull(currency) { "`currency` is required but was not set" }, - checkNotNull(type) { "`type` is required but was not set" }, - thresholds.toImmutable().ifEmpty { null }, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -527,11 +510,11 @@ constructor( return true } - return /* spotless:off */ other is AlertCreateForExternalCustomerParams && externalCustomerId == other.externalCustomerId && currency == other.currency && type == other.type && thresholds == other.thresholds && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is AlertCreateForExternalCustomerParams && externalCustomerId == other.externalCustomerId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(externalCustomerId, currency, type, thresholds, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(externalCustomerId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "AlertCreateForExternalCustomerParams{externalCustomerId=$externalCustomerId, currency=$currency, type=$type, thresholds=$thresholds, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "AlertCreateForExternalCustomerParams{externalCustomerId=$externalCustomerId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt index b043feac..5287c3aa 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt @@ -22,37 +22,29 @@ import java.util.Optional class AlertCreateForSubscriptionParams constructor( private val subscriptionId: String, - private val thresholds: List, - private val type: Type, - private val metricId: String?, + private val body: AlertCreateForSubscriptionBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun subscriptionId(): String = subscriptionId - fun thresholds(): List = thresholds + /** The thresholds that define the values at which the alert will be triggered. */ + fun thresholds(): List = body.thresholds() - fun type(): Type = type + /** The type of alert to create. This must be a valid alert type. */ + fun type(): Type = body.type() - fun metricId(): Optional = Optional.ofNullable(metricId) + /** The metric to track usage for. */ + fun metricId(): Optional = body.metricId() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): AlertCreateForSubscriptionBody { - return AlertCreateForSubscriptionBody( - thresholds, - type, - metricId, - additionalBodyProperties, - ) - } + @JvmSynthetic internal fun getBody(): AlertCreateForSubscriptionBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -98,7 +90,7 @@ constructor( class Builder { - private var thresholds: List? = null + private var thresholds: MutableList? = null private var type: Type? = null private var metricId: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -114,7 +106,14 @@ constructor( } /** The thresholds that define the values at which the alert will be triggered. */ - fun thresholds(thresholds: List) = apply { this.thresholds = thresholds } + fun thresholds(thresholds: List) = apply { + this.thresholds = thresholds.toMutableList() + } + + /** The thresholds that define the values at which the alert will be triggered. */ + fun addThreshold(threshold: Threshold) = apply { + thresholds = (thresholds ?: mutableListOf()).apply { add(threshold) } + } /** The type of alert to create. This must be a valid alert type. */ fun type(type: Type) = apply { this.type = type } @@ -180,43 +179,34 @@ constructor( class Builder { private var subscriptionId: String? = null - private var thresholds: MutableList = mutableListOf() - private var type: Type? = null - private var metricId: String? = null + private var body: AlertCreateForSubscriptionBody.Builder = + AlertCreateForSubscriptionBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(alertCreateForSubscriptionParams: AlertCreateForSubscriptionParams) = apply { subscriptionId = alertCreateForSubscriptionParams.subscriptionId - thresholds = alertCreateForSubscriptionParams.thresholds.toMutableList() - type = alertCreateForSubscriptionParams.type - metricId = alertCreateForSubscriptionParams.metricId + body = alertCreateForSubscriptionParams.body.toBuilder() additionalHeaders = alertCreateForSubscriptionParams.additionalHeaders.toBuilder() additionalQueryParams = alertCreateForSubscriptionParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - alertCreateForSubscriptionParams.additionalBodyProperties.toMutableMap() } fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } /** The thresholds that define the values at which the alert will be triggered. */ - fun thresholds(thresholds: List) = apply { - this.thresholds.clear() - this.thresholds.addAll(thresholds) - } + fun thresholds(thresholds: List) = apply { body.thresholds(thresholds) } /** The thresholds that define the values at which the alert will be triggered. */ - fun addThreshold(threshold: Threshold) = apply { this.thresholds.add(threshold) } + fun addThreshold(threshold: Threshold) = apply { body.addThreshold(threshold) } /** The type of alert to create. This must be a valid alert type. */ - fun type(type: Type) = apply { this.type = type } + fun type(type: Type) = apply { body.type(type) } /** The metric to track usage for. */ - fun metricId(metricId: String) = apply { this.metricId = metricId } + fun metricId(metricId: String) = apply { body.metricId(metricId) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -317,36 +307,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): AlertCreateForSubscriptionParams = AlertCreateForSubscriptionParams( checkNotNull(subscriptionId) { "`subscriptionId` is required but was not set" }, - thresholds.toImmutable(), - checkNotNull(type) { "`type` is required but was not set" }, - metricId, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -520,11 +504,11 @@ constructor( return true } - return /* spotless:off */ other is AlertCreateForSubscriptionParams && subscriptionId == other.subscriptionId && thresholds == other.thresholds && type == other.type && metricId == other.metricId && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is AlertCreateForSubscriptionParams && subscriptionId == other.subscriptionId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(subscriptionId, thresholds, type, metricId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(subscriptionId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "AlertCreateForSubscriptionParams{subscriptionId=$subscriptionId, thresholds=$thresholds, type=$type, metricId=$metricId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "AlertCreateForSubscriptionParams{subscriptionId=$subscriptionId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertDisableParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertDisableParams.kt index f9a08d4b..6f058fdb 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertDisableParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertDisableParams.kt @@ -21,6 +21,7 @@ constructor( fun alertConfigurationId(): String = alertConfigurationId + /** Used to update the status of a plan alert scoped to this subscription_id */ fun subscriptionId(): Optional = Optional.ofNullable(subscriptionId) fun _additionalHeaders(): Headers = additionalHeaders @@ -30,9 +31,8 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties @JvmSynthetic - internal fun getBody(): Optional> { - return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - } + internal fun getBody(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertEnableParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertEnableParams.kt index a3015c67..6121742f 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertEnableParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertEnableParams.kt @@ -21,6 +21,7 @@ constructor( fun alertConfigurationId(): String = alertConfigurationId + /** Used to update the status of a plan alert scoped to this subscription_id */ fun subscriptionId(): Optional = Optional.ofNullable(subscriptionId) fun _additionalHeaders(): Headers = additionalHeaders @@ -30,9 +31,8 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties @JvmSynthetic - internal fun getBody(): Optional> { - return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - } + internal fun getBody(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListParams.kt index c398e352..93416dfc 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListParams.kt @@ -33,14 +33,22 @@ constructor( fun createdAtLte(): Optional = Optional.ofNullable(createdAtLte) + /** + * Cursor for pagination. This can be populated by the `next_cursor` value returned from the + * initial request. + */ fun cursor(): Optional = Optional.ofNullable(cursor) + /** Fetch alerts scoped to this customer_id */ fun customerId(): Optional = Optional.ofNullable(customerId) + /** Fetch alerts scoped to this external_customer_id */ fun externalCustomerId(): Optional = Optional.ofNullable(externalCustomerId) + /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) + /** Fetch alerts scoped to this subscription_id */ fun subscriptionId(): Optional = Optional.ofNullable(subscriptionId) fun _additionalHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt index 64939f67..4ae8de06 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt @@ -18,26 +18,23 @@ import java.util.Objects class AlertUpdateParams constructor( private val alertConfigurationId: String, - private val thresholds: List, + private val body: AlertUpdateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun alertConfigurationId(): String = alertConfigurationId - fun thresholds(): List = thresholds + /** The thresholds that define the values at which the alert will be triggered. */ + fun thresholds(): List = body.thresholds() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): AlertUpdateBody { - return AlertUpdateBody(thresholds, additionalBodyProperties) - } + @JvmSynthetic internal fun getBody(): AlertUpdateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -75,7 +72,7 @@ constructor( class Builder { - private var thresholds: List? = null + private var thresholds: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -85,7 +82,14 @@ constructor( } /** The thresholds that define the values at which the alert will be triggered. */ - fun thresholds(thresholds: List) = apply { this.thresholds = thresholds } + fun thresholds(thresholds: List) = apply { + this.thresholds = thresholds.toMutableList() + } + + /** The thresholds that define the values at which the alert will be triggered. */ + fun addThreshold(threshold: Threshold) = apply { + thresholds = (thresholds ?: mutableListOf()).apply { add(threshold) } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -143,18 +147,16 @@ constructor( class Builder { private var alertConfigurationId: String? = null - private var thresholds: MutableList = mutableListOf() + private var body: AlertUpdateBody.Builder = AlertUpdateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(alertUpdateParams: AlertUpdateParams) = apply { alertConfigurationId = alertUpdateParams.alertConfigurationId - thresholds = alertUpdateParams.thresholds.toMutableList() + body = alertUpdateParams.body.toBuilder() additionalHeaders = alertUpdateParams.additionalHeaders.toBuilder() additionalQueryParams = alertUpdateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = alertUpdateParams.additionalBodyProperties.toMutableMap() } fun alertConfigurationId(alertConfigurationId: String) = apply { @@ -162,13 +164,10 @@ constructor( } /** The thresholds that define the values at which the alert will be triggered. */ - fun thresholds(thresholds: List) = apply { - this.thresholds.clear() - this.thresholds.addAll(thresholds) - } + fun thresholds(thresholds: List) = apply { body.thresholds(thresholds) } /** The thresholds that define the values at which the alert will be triggered. */ - fun addThreshold(threshold: Threshold) = apply { this.thresholds.add(threshold) } + fun addThreshold(threshold: Threshold) = apply { body.addThreshold(threshold) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -269,25 +268,22 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): AlertUpdateParams = @@ -295,10 +291,9 @@ constructor( checkNotNull(alertConfigurationId) { "`alertConfigurationId` is required but was not set" }, - thresholds.toImmutable(), + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -397,11 +392,11 @@ constructor( return true } - return /* spotless:off */ other is AlertUpdateParams && alertConfigurationId == other.alertConfigurationId && thresholds == other.thresholds && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is AlertUpdateParams && alertConfigurationId == other.alertConfigurationId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(alertConfigurationId, thresholds, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(alertConfigurationId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "AlertUpdateParams{alertConfigurationId=$alertConfigurationId, thresholds=$thresholds, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "AlertUpdateParams{alertConfigurationId=$alertConfigurationId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponArchiveParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponArchiveParams.kt index d19a6599..02209378 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponArchiveParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponArchiveParams.kt @@ -27,9 +27,8 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties @JvmSynthetic - internal fun getBody(): Optional> { - return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - } + internal fun getBody(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt index 847b5794..fc1e9782 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt @@ -32,39 +32,35 @@ import kotlin.jvm.optionals.getOrNull class CouponCreateParams constructor( - private val discount: Discount, - private val redemptionCode: String, - private val durationInMonths: Long?, - private val maxRedemptions: Long?, + private val body: CouponCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun discount(): Discount = discount + fun discount(): Discount = body.discount() - fun redemptionCode(): String = redemptionCode + /** This string can be used to redeem this coupon for a given subscription. */ + fun redemptionCode(): String = body.redemptionCode() - fun durationInMonths(): Optional = Optional.ofNullable(durationInMonths) + /** + * This allows for a coupon's discount to apply for a limited time (determined in months); a + * `null` value here means "unlimited time". + */ + fun durationInMonths(): Optional = body.durationInMonths() - fun maxRedemptions(): Optional = Optional.ofNullable(maxRedemptions) + /** + * The maximum number of redemptions allowed for this coupon before it is exhausted;`null` here + * means "unlimited". + */ + fun maxRedemptions(): Optional = body.maxRedemptions() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): CouponCreateBody { - return CouponCreateBody( - discount, - redemptionCode, - durationInMonths, - maxRedemptions, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): CouponCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -131,6 +127,16 @@ constructor( fun discount(discount: Discount) = apply { this.discount = discount } + fun discount(newCouponPercentageDiscount: Discount.NewCouponPercentageDiscount) = + apply { + this.discount = + Discount.ofNewCouponPercentageDiscount(newCouponPercentageDiscount) + } + + fun discount(newCouponAmountDiscount: Discount.NewCouponAmountDiscount) = apply { + this.discount = Discount.ofNewCouponAmountDiscount(newCouponAmountDiscount) + } + /** This string can be used to redeem this coupon for a given subscription. */ fun redemptionCode(redemptionCode: String) = apply { this.redemptionCode = redemptionCode @@ -209,51 +215,43 @@ constructor( @NoAutoDetect class Builder { - private var discount: Discount? = null - private var redemptionCode: String? = null - private var durationInMonths: Long? = null - private var maxRedemptions: Long? = null + private var body: CouponCreateBody.Builder = CouponCreateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(couponCreateParams: CouponCreateParams) = apply { - discount = couponCreateParams.discount - redemptionCode = couponCreateParams.redemptionCode - durationInMonths = couponCreateParams.durationInMonths - maxRedemptions = couponCreateParams.maxRedemptions + body = couponCreateParams.body.toBuilder() additionalHeaders = couponCreateParams.additionalHeaders.toBuilder() additionalQueryParams = couponCreateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = couponCreateParams.additionalBodyProperties.toMutableMap() } - fun discount(discount: Discount) = apply { this.discount = discount } + fun discount(discount: Discount) = apply { body.discount(discount) } fun discount(newCouponPercentageDiscount: Discount.NewCouponPercentageDiscount) = apply { - this.discount = Discount.ofNewCouponPercentageDiscount(newCouponPercentageDiscount) + body.discount(newCouponPercentageDiscount) } fun discount(newCouponAmountDiscount: Discount.NewCouponAmountDiscount) = apply { - this.discount = Discount.ofNewCouponAmountDiscount(newCouponAmountDiscount) + body.discount(newCouponAmountDiscount) } /** This string can be used to redeem this coupon for a given subscription. */ - fun redemptionCode(redemptionCode: String) = apply { this.redemptionCode = redemptionCode } + fun redemptionCode(redemptionCode: String) = apply { body.redemptionCode(redemptionCode) } /** * This allows for a coupon's discount to apply for a limited time (determined in months); a * `null` value here means "unlimited time". */ fun durationInMonths(durationInMonths: Long) = apply { - this.durationInMonths = durationInMonths + body.durationInMonths(durationInMonths) } /** * The maximum number of redemptions allowed for this coupon before it is exhausted;`null` * here means "unlimited". */ - fun maxRedemptions(maxRedemptions: Long) = apply { this.maxRedemptions = maxRedemptions } + fun maxRedemptions(maxRedemptions: Long) = apply { body.maxRedemptions(maxRedemptions) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -354,36 +352,29 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): CouponCreateParams = CouponCreateParams( - checkNotNull(discount) { "`discount` is required but was not set" }, - checkNotNull(redemptionCode) { "`redemptionCode` is required but was not set" }, - durationInMonths, - maxRedemptions, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -815,11 +806,11 @@ constructor( return true } - return /* spotless:off */ other is CouponCreateParams && discount == other.discount && redemptionCode == other.redemptionCode && durationInMonths == other.durationInMonths && maxRedemptions == other.maxRedemptions && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is CouponCreateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(discount, redemptionCode, durationInMonths, maxRedemptions, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "CouponCreateParams{discount=$discount, redemptionCode=$redemptionCode, durationInMonths=$durationInMonths, maxRedemptions=$maxRedemptions, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "CouponCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListParams.kt index d8416177..a0ac648a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListParams.kt @@ -18,12 +18,19 @@ constructor( private val additionalQueryParams: QueryParams, ) { + /** + * Cursor for pagination. This can be populated by the `next_cursor` value returned from the + * initial request. + */ fun cursor(): Optional = Optional.ofNullable(cursor) + /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) + /** Filter to coupons matching this redemption code. */ fun redemptionCode(): Optional = Optional.ofNullable(redemptionCode) + /** Show archived coupons as well (by default, this endpoint only returns active coupons). */ fun showArchived(): Optional = Optional.ofNullable(showArchived) fun _additionalHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListParams.kt index 940866d2..b1dd0d33 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListParams.kt @@ -19,8 +19,13 @@ constructor( fun couponId(): String = couponId + /** + * Cursor for pagination. This can be populated by the `next_cursor` value returned from the + * initial request. + */ fun cursor(): Optional = Optional.ofNullable(cursor) + /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) fun _additionalHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt index 9cd763f1..c7f345c0 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt @@ -21,35 +21,26 @@ import java.util.Optional class CreditNoteCreateParams constructor( - private val lineItems: List, - private val memo: String?, - private val reason: Reason?, + private val body: CreditNoteCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun lineItems(): List = lineItems + fun lineItems(): List = body.lineItems() - fun memo(): Optional = Optional.ofNullable(memo) + /** An optional memo to attach to the credit note. */ + fun memo(): Optional = body.memo() - fun reason(): Optional = Optional.ofNullable(reason) + /** An optional reason for the credit note. */ + fun reason(): Optional = body.reason() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): CreditNoteCreateBody { - return CreditNoteCreateBody( - lineItems, - memo, - reason, - additionalBodyProperties, - ) - } + @JvmSynthetic internal fun getBody(): CreditNoteCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -87,7 +78,7 @@ constructor( class Builder { - private var lineItems: List? = null + private var lineItems: MutableList? = null private var memo: String? = null private var reason: Reason? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -100,7 +91,13 @@ constructor( additionalProperties = creditNoteCreateBody.additionalProperties.toMutableMap() } - fun lineItems(lineItems: List) = apply { this.lineItems = lineItems } + fun lineItems(lineItems: List) = apply { + this.lineItems = lineItems.toMutableList() + } + + fun addLineItem(lineItem: LineItem) = apply { + lineItems = (lineItems ?: mutableListOf()).apply { add(lineItem) } + } /** An optional memo to attach to the credit note. */ fun memo(memo: String) = apply { this.memo = memo } @@ -165,36 +162,26 @@ constructor( @NoAutoDetect class Builder { - private var lineItems: MutableList = mutableListOf() - private var memo: String? = null - private var reason: Reason? = null + private var body: CreditNoteCreateBody.Builder = CreditNoteCreateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(creditNoteCreateParams: CreditNoteCreateParams) = apply { - lineItems = creditNoteCreateParams.lineItems.toMutableList() - memo = creditNoteCreateParams.memo - reason = creditNoteCreateParams.reason + body = creditNoteCreateParams.body.toBuilder() additionalHeaders = creditNoteCreateParams.additionalHeaders.toBuilder() additionalQueryParams = creditNoteCreateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - creditNoteCreateParams.additionalBodyProperties.toMutableMap() } - fun lineItems(lineItems: List) = apply { - this.lineItems.clear() - this.lineItems.addAll(lineItems) - } + fun lineItems(lineItems: List) = apply { body.lineItems(lineItems) } - fun addLineItem(lineItem: LineItem) = apply { this.lineItems.add(lineItem) } + fun addLineItem(lineItem: LineItem) = apply { body.addLineItem(lineItem) } /** An optional memo to attach to the credit note. */ - fun memo(memo: String) = apply { this.memo = memo } + fun memo(memo: String) = apply { body.memo(memo) } /** An optional reason for the credit note. */ - fun reason(reason: Reason) = apply { this.reason = reason } + fun reason(reason: Reason) = apply { body.reason(reason) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -295,35 +282,29 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): CreditNoteCreateParams = CreditNoteCreateParams( - lineItems.toImmutable(), - memo, - reason, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -496,11 +477,11 @@ constructor( return true } - return /* spotless:off */ other is CreditNoteCreateParams && lineItems == other.lineItems && memo == other.memo && reason == other.reason && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is CreditNoteCreateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(lineItems, memo, reason, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "CreditNoteCreateParams{lineItems=$lineItems, memo=$memo, reason=$reason, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "CreditNoteCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListParams.kt index 4faf30a7..ca8ec60c 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListParams.kt @@ -16,8 +16,13 @@ constructor( private val additionalQueryParams: QueryParams, ) { + /** + * Cursor for pagination. This can be populated by the `next_cursor` value returned from the + * initial request. + */ fun cursor(): Optional = Optional.ofNullable(cursor) + /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) fun _additionalHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt index bc281f4e..1d28ee0c 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt @@ -22,37 +22,27 @@ import java.util.Optional class CustomerBalanceTransactionCreateParams constructor( private val customerId: String, - private val amount: String, - private val type: Type, - private val description: String?, + private val body: CustomerBalanceTransactionCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun customerId(): String = customerId - fun amount(): String = amount + fun amount(): String = body.amount() - fun type(): Type = type + fun type(): Type = body.type() - fun description(): Optional = Optional.ofNullable(description) + /** An optional description that can be specified around this entry. */ + fun description(): Optional = body.description() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): CustomerBalanceTransactionCreateBody { - return CustomerBalanceTransactionCreateBody( - amount, - type, - description, - additionalBodyProperties, - ) - } + @JvmSynthetic internal fun getBody(): CustomerBalanceTransactionCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -177,36 +167,30 @@ constructor( class Builder { private var customerId: String? = null - private var amount: String? = null - private var type: Type? = null - private var description: String? = null + private var body: CustomerBalanceTransactionCreateBody.Builder = + CustomerBalanceTransactionCreateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( customerBalanceTransactionCreateParams: CustomerBalanceTransactionCreateParams ) = apply { customerId = customerBalanceTransactionCreateParams.customerId - amount = customerBalanceTransactionCreateParams.amount - type = customerBalanceTransactionCreateParams.type - description = customerBalanceTransactionCreateParams.description + body = customerBalanceTransactionCreateParams.body.toBuilder() additionalHeaders = customerBalanceTransactionCreateParams.additionalHeaders.toBuilder() additionalQueryParams = customerBalanceTransactionCreateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - customerBalanceTransactionCreateParams.additionalBodyProperties.toMutableMap() } fun customerId(customerId: String) = apply { this.customerId = customerId } - fun amount(amount: String) = apply { this.amount = amount } + fun amount(amount: String) = apply { body.amount(amount) } - fun type(type: Type) = apply { this.type = type } + fun type(type: Type) = apply { body.type(type) } /** An optional description that can be specified around this entry. */ - fun description(description: String) = apply { this.description = description } + fun description(description: String) = apply { body.description(description) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -307,36 +291,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): CustomerBalanceTransactionCreateParams = CustomerBalanceTransactionCreateParams( checkNotNull(customerId) { "`customerId` is required but was not set" }, - checkNotNull(amount) { "`amount` is required but was not set" }, - checkNotNull(type) { "`type` is required but was not set" }, - description, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -402,11 +380,11 @@ constructor( return true } - return /* spotless:off */ other is CustomerBalanceTransactionCreateParams && customerId == other.customerId && amount == other.amount && type == other.type && description == other.description && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is CustomerBalanceTransactionCreateParams && customerId == other.customerId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(customerId, amount, type, description, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(customerId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "CustomerBalanceTransactionCreateParams{customerId=$customerId, amount=$amount, type=$type, description=$description, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "CustomerBalanceTransactionCreateParams{customerId=$customerId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListParams.kt index 51e8497c..360c0f7e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListParams.kt @@ -25,8 +25,13 @@ constructor( fun customerId(): String = customerId + /** + * Cursor for pagination. This can be populated by the `next_cursor` value returned from the + * initial request. + */ fun cursor(): Optional = Optional.ofNullable(cursor) + /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) fun operationTimeGt(): Optional = Optional.ofNullable(operationTimeGt) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt index 49264697..aee3b000 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt @@ -27,12 +27,20 @@ constructor( fun externalCustomerId(): String = externalCustomerId + /** The currency or custom pricing unit to use. */ fun currency(): Optional = Optional.ofNullable(currency) + /** Costs returned are exclusive of `timeframe_end`. */ fun timeframeEnd(): Optional = Optional.ofNullable(timeframeEnd) + /** Costs returned are inclusive of `timeframe_start`. */ fun timeframeStart(): Optional = Optional.ofNullable(timeframeStart) + /** + * Controls whether Orb returns cumulative costs since the start of the billing period, or + * incremental day-by-day costs. If your customer has minimums or discounts, it's strongly + * recommended that you use the default cumulative behavior. + */ fun viewMode(): Optional = Optional.ofNullable(viewMode) fun _additionalHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt index e951305b..9093e277 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt @@ -27,12 +27,20 @@ constructor( fun customerId(): String = customerId + /** The currency or custom pricing unit to use. */ fun currency(): Optional = Optional.ofNullable(currency) + /** Costs returned are exclusive of `timeframe_end`. */ fun timeframeEnd(): Optional = Optional.ofNullable(timeframeEnd) + /** Costs returned are inclusive of `timeframe_start`. */ fun timeframeStart(): Optional = Optional.ofNullable(timeframeStart) + /** + * Controls whether Orb returns cumulative costs since the start of the billing period, or + * incremental day-by-day costs. If your customer has minimums or discounts, it's strongly + * recommended that you use the default cumulative behavior. + */ fun viewMode(): Optional = Optional.ofNullable(viewMode) fun _additionalHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt index 09245d28..180db77d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt @@ -32,93 +32,200 @@ import kotlin.jvm.optionals.getOrNull class CustomerCreateParams constructor( - private val email: String, - private val name: String, - private val accountingSyncConfiguration: AccountingSyncConfiguration?, - private val additionalEmails: List?, - private val autoCollection: Boolean?, - private val billingAddress: BillingAddress?, - private val currency: String?, - private val emailDelivery: Boolean?, - private val externalCustomerId: String?, - private val metadata: Metadata?, - private val paymentProvider: PaymentProvider?, - private val paymentProviderId: String?, - private val reportingConfiguration: ReportingConfiguration?, - private val shippingAddress: ShippingAddress?, - private val taxConfiguration: TaxConfiguration?, - private val taxId: TaxId?, - private val timezone: String?, + private val body: CustomerCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun email(): String = email + /** + * A valid customer email, to be used for notifications. When Orb triggers payment through a + * payment gateway, this email will be used for any automatically issued receipts. + */ + fun email(): String = body.email() - fun name(): String = name + /** The full name of the customer */ + fun name(): String = body.name() fun accountingSyncConfiguration(): Optional = - Optional.ofNullable(accountingSyncConfiguration) + body.accountingSyncConfiguration() - fun additionalEmails(): Optional> = Optional.ofNullable(additionalEmails) + /** + * Additional email addresses for this customer. If populated, these email addresses will be + * CC'd for customer communications. + */ + fun additionalEmails(): Optional> = body.additionalEmails() - fun autoCollection(): Optional = Optional.ofNullable(autoCollection) + /** + * Used to determine if invoices for this customer will automatically attempt to charge a saved + * payment method, if available. This parameter defaults to `True` when a payment provider is + * provided on customer creation. + */ + fun autoCollection(): Optional = body.autoCollection() - fun billingAddress(): Optional = Optional.ofNullable(billingAddress) + fun billingAddress(): Optional = body.billingAddress() - fun currency(): Optional = Optional.ofNullable(currency) + /** + * An ISO 4217 currency string used for the customer's invoices and balance. If not set at + * creation time, will be set at subscription creation time. + */ + fun currency(): Optional = body.currency() - fun emailDelivery(): Optional = Optional.ofNullable(emailDelivery) + fun emailDelivery(): Optional = body.emailDelivery() - fun externalCustomerId(): Optional = Optional.ofNullable(externalCustomerId) + /** + * An optional user-defined ID for this customer resource, used throughout the system as an + * alias for this Customer. Use this field to identify a customer by an existing identifier in + * your system. + */ + fun externalCustomerId(): Optional = body.externalCustomerId() - fun metadata(): Optional = Optional.ofNullable(metadata) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by setting + * the value to `null`, and the entire metadata mapping can be cleared by setting `metadata` to + * `null`. + */ + fun metadata(): Optional = body.metadata() - fun paymentProvider(): Optional = Optional.ofNullable(paymentProvider) + /** + * This is used for creating charges or invoices in an external system via Orb. When not in test + * mode, the connection must first be configured in the Orb webapp. + */ + fun paymentProvider(): Optional = body.paymentProvider() - fun paymentProviderId(): Optional = Optional.ofNullable(paymentProviderId) + /** + * The ID of this customer in an external payments solution, such as Stripe. This is used for + * creating charges or invoices in the external system via Orb. + */ + fun paymentProviderId(): Optional = body.paymentProviderId() - fun reportingConfiguration(): Optional = - Optional.ofNullable(reportingConfiguration) + fun reportingConfiguration(): Optional = body.reportingConfiguration() - fun shippingAddress(): Optional = Optional.ofNullable(shippingAddress) + fun shippingAddress(): Optional = body.shippingAddress() - fun taxConfiguration(): Optional = Optional.ofNullable(taxConfiguration) + fun taxConfiguration(): Optional = body.taxConfiguration() - fun taxId(): Optional = Optional.ofNullable(taxId) + /** + * Tax IDs are commonly required to be displayed on customer invoices, which are added to the + * headers of invoices. + * + * ### Supported Tax ID Countries and Types + * |Country |Type |Description | + * |--------------------|------------|-------------------------------------------------------------------------------------------------------| + * |Andorra |`ad_nrt` |Andorran NRT Number | + * |Argentina |`ar_cuit` |Argentinian Tax ID Number | + * |Australia |`au_abn` |Australian Business Number (AU ABN) | + * |Australia |`au_arn` |Australian Taxation Office Reference Number | + * |Austria |`eu_vat` |European VAT Number | + * |Bahrain |`bh_vat` |Bahraini VAT Number | + * |Belgium |`eu_vat` |European VAT Number | + * |Bolivia |`bo_tin` |Bolivian Tax ID | + * |Brazil |`br_cnpj` |Brazilian CNPJ Number | + * |Brazil |`br_cpf` |Brazilian CPF Number | + * |Bulgaria |`bg_uic` |Bulgaria Unified Identification Code | + * |Bulgaria |`eu_vat` |European VAT Number | + * |Canada |`ca_bn` |Canadian BN | + * |Canada |`ca_gst_hst`|Canadian GST/HST Number | + * |Canada |`ca_pst_bc` |Canadian PST Number (British Columbia) | + * |Canada |`ca_pst_mb` |Canadian PST Number (Manitoba) | + * |Canada |`ca_pst_sk` |Canadian PST Number (Saskatchewan) | + * |Canada |`ca_qst` |Canadian QST Number (Québec) | + * |Chile |`cl_tin` |Chilean TIN | + * |China |`cn_tin` |Chinese Tax ID | + * |Colombia |`co_nit` |Colombian NIT Number | + * |Costa Rica |`cr_tin` |Costa Rican Tax ID | + * |Croatia |`eu_vat` |European VAT Number | + * |Cyprus |`eu_vat` |European VAT Number | + * |Czech Republic |`eu_vat` |European VAT Number | + * |Denmark |`eu_vat` |European VAT Number | + * |Dominican Republic |`do_rcn` |Dominican RCN Number | + * |Ecuador |`ec_ruc` |Ecuadorian RUC Number | + * |Egypt |`eg_tin` |Egyptian Tax Identification Number | + * |El Salvador |`sv_nit` |El Salvadorian NIT Number | + * |Estonia |`eu_vat` |European VAT Number | + * |EU |`eu_oss_vat`|European One Stop Shop VAT Number for non-Union scheme | + * |Finland |`eu_vat` |European VAT Number | + * |France |`eu_vat` |European VAT Number | + * |Georgia |`ge_vat` |Georgian VAT | + * |Germany |`eu_vat` |European VAT Number | + * |Greece |`eu_vat` |European VAT Number | + * |Hong Kong |`hk_br` |Hong Kong BR Number | + * |Hungary |`eu_vat` |European VAT Number | + * |Hungary |`hu_tin` |Hungary Tax Number (adószám) | + * |Iceland |`is_vat` |Icelandic VAT | + * |India |`in_gst` |Indian GST Number | + * |Indonesia |`id_npwp` |Indonesian NPWP Number | + * |Ireland |`eu_vat` |European VAT Number | + * |Israel |`il_vat` |Israel VAT | + * |Italy |`eu_vat` |European VAT Number | + * |Japan |`jp_cn` |Japanese Corporate Number (_Hōjin Bangō_) | + * |Japan |`jp_rn` |Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_)| + * |Japan |`jp_trn` |Japanese Tax Registration Number (_Tōroku Bangō_) | + * |Kazakhstan |`kz_bin` |Kazakhstani Business Identification Number | + * |Kenya |`ke_pin` |Kenya Revenue Authority Personal Identification Number | + * |Latvia |`eu_vat` |European VAT Number | + * |Liechtenstein |`li_uid` |Liechtensteinian UID Number | + * |Lithuania |`eu_vat` |European VAT Number | + * |Luxembourg |`eu_vat` |European VAT Number | + * |Malaysia |`my_frp` |Malaysian FRP Number | + * |Malaysia |`my_itn` |Malaysian ITN | + * |Malaysia |`my_sst` |Malaysian SST Number | + * |Malta |`eu_vat ` |European VAT Number | + * |Mexico |`mx_rfc` |Mexican RFC Number | + * |Netherlands |`eu_vat` |European VAT Number | + * |New Zealand |`nz_gst` |New Zealand GST Number | + * |Nigeria |`ng_tin` |Nigerian Tax Identification Number | + * |Norway |`no_vat` |Norwegian VAT Number | + * |Norway |`no_voec` |Norwegian VAT on e-commerce Number | + * |Oman |`om_vat` |Omani VAT Number | + * |Peru |`pe_ruc` |Peruvian RUC Number | + * |Philippines |`ph_tin ` |Philippines Tax Identification Number | + * |Poland |`eu_vat` |European VAT Number | + * |Portugal |`eu_vat` |European VAT Number | + * |Romania |`eu_vat` |European VAT Number | + * |Romania |`ro_tin` |Romanian Tax ID Number | + * |Russia |`ru_inn` |Russian INN | + * |Russia |`ru_kpp` |Russian KPP | + * |Saudi Arabia |`sa_vat` |Saudi Arabia VAT | + * |Serbia |`rs_pib` |Serbian PIB Number | + * |Singapore |`sg_gst` |Singaporean GST | + * |Singapore |`sg_uen` |Singaporean UEN | + * |Slovakia |`eu_vat` |European VAT Number | + * |Slovenia |`eu_vat` |European VAT Number | + * |Slovenia |`si_tin` |Slovenia Tax Number (davčna številka) | + * |South Africa |`za_vat` |South African VAT Number | + * |South Korea |`kr_brn` |Korean BRN | + * |Spain |`es_cif` |Spanish NIF Number (previously Spanish CIF Number) | + * |Spain |`eu_vat` |European VAT Number | + * |Sweden |`eu_vat` |European VAT Number | + * |Switzerland |`ch_vat` |Switzerland VAT Number | + * |Taiwan |`tw_vat` |Taiwanese VAT | + * |Thailand |`th_vat` |Thai VAT | + * |Turkey |`tr_tin` |Turkish Tax Identification Number | + * |Ukraine |`ua_vat` |Ukrainian VAT | + * |United Arab Emirates|`ae_trn` |United Arab Emirates TRN | + * |United Kingdom |`eu_vat` |Northern Ireland VAT Number | + * |United Kingdom |`gb_vat` |United Kingdom VAT Number | + * |United States |`us_ein` |United States EIN | + * |Uruguay |`uy_ruc` |Uruguayan RUC Number | + * |Venezuela |`ve_rif` |Venezuelan RIF Number | + * |Vietnam |`vn_tin` |Vietnamese Tax ID Number | + */ + fun taxId(): Optional = body.taxId() - fun timezone(): Optional = Optional.ofNullable(timezone) + /** + * A timezone identifier from the IANA timezone database, such as `"America/Los_Angeles"`. This + * defaults to your account's timezone if not set. This cannot be changed after customer + * creation. + */ + fun timezone(): Optional = body.timezone() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): CustomerCreateBody { - return CustomerCreateBody( - email, - name, - accountingSyncConfiguration, - additionalEmails, - autoCollection, - billingAddress, - currency, - emailDelivery, - externalCustomerId, - metadata, - paymentProvider, - paymentProviderId, - reportingConfiguration, - shippingAddress, - taxConfiguration, - taxId, - timezone, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): CustomerCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -361,7 +468,7 @@ constructor( private var email: String? = null private var name: String? = null private var accountingSyncConfiguration: AccountingSyncConfiguration? = null - private var additionalEmails: List? = null + private var additionalEmails: MutableList? = null private var autoCollection: Boolean? = null private var billingAddress: BillingAddress? = null private var currency: String? = null @@ -418,7 +525,16 @@ constructor( * will be CC'd for customer communications. */ fun additionalEmails(additionalEmails: List) = apply { - this.additionalEmails = additionalEmails + this.additionalEmails = additionalEmails.toMutableList() + } + + /** + * Additional email addresses for this customer. If populated, these email addresses + * will be CC'd for customer communications. + */ + fun addAdditionalEmail(additionalEmail: String) = apply { + additionalEmails = + (additionalEmails ?: mutableListOf()).apply { add(additionalEmail) } } /** @@ -486,6 +602,19 @@ constructor( this.taxConfiguration = taxConfiguration } + fun taxConfiguration( + newAvalaraTaxConfiguration: TaxConfiguration.NewAvalaraTaxConfiguration + ) = apply { + this.taxConfiguration = + TaxConfiguration.ofNewAvalaraTaxConfiguration(newAvalaraTaxConfiguration) + } + + fun taxConfiguration(newTaxJarConfiguration: TaxConfiguration.NewTaxJarConfiguration) = + apply { + this.taxConfiguration = + TaxConfiguration.ofNewTaxJarConfiguration(newTaxJarConfiguration) + } + /** * Tax IDs are commonly required to be displayed on customer invoices, which are added * to the headers of invoices. @@ -671,64 +800,29 @@ constructor( @NoAutoDetect class Builder { - private var email: String? = null - private var name: String? = null - private var accountingSyncConfiguration: AccountingSyncConfiguration? = null - private var additionalEmails: MutableList = mutableListOf() - private var autoCollection: Boolean? = null - private var billingAddress: BillingAddress? = null - private var currency: String? = null - private var emailDelivery: Boolean? = null - private var externalCustomerId: String? = null - private var metadata: Metadata? = null - private var paymentProvider: PaymentProvider? = null - private var paymentProviderId: String? = null - private var reportingConfiguration: ReportingConfiguration? = null - private var shippingAddress: ShippingAddress? = null - private var taxConfiguration: TaxConfiguration? = null - private var taxId: TaxId? = null - private var timezone: String? = null + private var body: CustomerCreateBody.Builder = CustomerCreateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(customerCreateParams: CustomerCreateParams) = apply { - email = customerCreateParams.email - name = customerCreateParams.name - accountingSyncConfiguration = customerCreateParams.accountingSyncConfiguration - additionalEmails = - customerCreateParams.additionalEmails?.toMutableList() ?: mutableListOf() - autoCollection = customerCreateParams.autoCollection - billingAddress = customerCreateParams.billingAddress - currency = customerCreateParams.currency - emailDelivery = customerCreateParams.emailDelivery - externalCustomerId = customerCreateParams.externalCustomerId - metadata = customerCreateParams.metadata - paymentProvider = customerCreateParams.paymentProvider - paymentProviderId = customerCreateParams.paymentProviderId - reportingConfiguration = customerCreateParams.reportingConfiguration - shippingAddress = customerCreateParams.shippingAddress - taxConfiguration = customerCreateParams.taxConfiguration - taxId = customerCreateParams.taxId - timezone = customerCreateParams.timezone + body = customerCreateParams.body.toBuilder() additionalHeaders = customerCreateParams.additionalHeaders.toBuilder() additionalQueryParams = customerCreateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = customerCreateParams.additionalBodyProperties.toMutableMap() } /** * A valid customer email, to be used for notifications. When Orb triggers payment through a * payment gateway, this email will be used for any automatically issued receipts. */ - fun email(email: String) = apply { this.email = email } + fun email(email: String) = apply { body.email(email) } /** The full name of the customer */ - fun name(name: String) = apply { this.name = name } + fun name(name: String) = apply { body.name(name) } fun accountingSyncConfiguration(accountingSyncConfiguration: AccountingSyncConfiguration) = apply { - this.accountingSyncConfiguration = accountingSyncConfiguration + body.accountingSyncConfiguration(accountingSyncConfiguration) } /** @@ -736,8 +830,7 @@ constructor( * CC'd for customer communications. */ fun additionalEmails(additionalEmails: List) = apply { - this.additionalEmails.clear() - this.additionalEmails.addAll(additionalEmails) + body.additionalEmails(additionalEmails) } /** @@ -745,7 +838,7 @@ constructor( * CC'd for customer communications. */ fun addAdditionalEmail(additionalEmail: String) = apply { - this.additionalEmails.add(additionalEmail) + body.addAdditionalEmail(additionalEmail) } /** @@ -753,19 +846,19 @@ constructor( * saved payment method, if available. This parameter defaults to `True` when a payment * provider is provided on customer creation. */ - fun autoCollection(autoCollection: Boolean) = apply { this.autoCollection = autoCollection } + fun autoCollection(autoCollection: Boolean) = apply { body.autoCollection(autoCollection) } fun billingAddress(billingAddress: BillingAddress) = apply { - this.billingAddress = billingAddress + body.billingAddress(billingAddress) } /** * An ISO 4217 currency string used for the customer's invoices and balance. If not set at * creation time, will be set at subscription creation time. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: String) = apply { body.currency(currency) } - fun emailDelivery(emailDelivery: Boolean) = apply { this.emailDelivery = emailDelivery } + fun emailDelivery(emailDelivery: Boolean) = apply { body.emailDelivery(emailDelivery) } /** * An optional user-defined ID for this customer resource, used throughout the system as an @@ -773,7 +866,7 @@ constructor( * in your system. */ fun externalCustomerId(externalCustomerId: String) = apply { - this.externalCustomerId = externalCustomerId + body.externalCustomerId(externalCustomerId) } /** @@ -781,14 +874,14 @@ constructor( * setting the value to `null`, and the entire metadata mapping can be cleared by setting * `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata) = apply { body.metadata(metadata) } /** * This is used for creating charges or invoices in an external system via Orb. When not in * test mode, the connection must first be configured in the Orb webapp. */ fun paymentProvider(paymentProvider: PaymentProvider) = apply { - this.paymentProvider = paymentProvider + body.paymentProvider(paymentProvider) } /** @@ -796,32 +889,28 @@ constructor( * for creating charges or invoices in the external system via Orb. */ fun paymentProviderId(paymentProviderId: String) = apply { - this.paymentProviderId = paymentProviderId + body.paymentProviderId(paymentProviderId) } fun reportingConfiguration(reportingConfiguration: ReportingConfiguration) = apply { - this.reportingConfiguration = reportingConfiguration + body.reportingConfiguration(reportingConfiguration) } fun shippingAddress(shippingAddress: ShippingAddress) = apply { - this.shippingAddress = shippingAddress + body.shippingAddress(shippingAddress) } fun taxConfiguration(taxConfiguration: TaxConfiguration) = apply { - this.taxConfiguration = taxConfiguration + body.taxConfiguration(taxConfiguration) } fun taxConfiguration( newAvalaraTaxConfiguration: TaxConfiguration.NewAvalaraTaxConfiguration - ) = apply { - this.taxConfiguration = - TaxConfiguration.ofNewAvalaraTaxConfiguration(newAvalaraTaxConfiguration) - } + ) = apply { body.taxConfiguration(newAvalaraTaxConfiguration) } fun taxConfiguration(newTaxJarConfiguration: TaxConfiguration.NewTaxJarConfiguration) = apply { - this.taxConfiguration = - TaxConfiguration.ofNewTaxJarConfiguration(newTaxJarConfiguration) + body.taxConfiguration(newTaxJarConfiguration) } /** @@ -930,14 +1019,14 @@ constructor( * |Venezuela |`ve_rif` |Venezuelan RIF Number | * |Vietnam |`vn_tin` |Vietnamese Tax ID Number | */ - fun taxId(taxId: TaxId) = apply { this.taxId = taxId } + fun taxId(taxId: TaxId) = apply { body.taxId(taxId) } /** * A timezone identifier from the IANA timezone database, such as `"America/Los_Angeles"`. * This defaults to your account's timezone if not set. This cannot be changed after * customer creation. */ - fun timezone(timezone: String) = apply { this.timezone = timezone } + fun timezone(timezone: String) = apply { body.timezone(timezone) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -1038,49 +1127,29 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): CustomerCreateParams = CustomerCreateParams( - checkNotNull(email) { "`email` is required but was not set" }, - checkNotNull(name) { "`name` is required but was not set" }, - accountingSyncConfiguration, - additionalEmails.toImmutable().ifEmpty { null }, - autoCollection, - billingAddress, - currency, - emailDelivery, - externalCustomerId, - metadata, - paymentProvider, - paymentProviderId, - reportingConfiguration, - shippingAddress, - taxConfiguration, - taxId, - timezone, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -1115,7 +1184,7 @@ constructor( class Builder { private var excluded: Boolean? = null - private var accountingProviders: List? = null + private var accountingProviders: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -1130,7 +1199,12 @@ constructor( fun excluded(excluded: Boolean) = apply { this.excluded = excluded } fun accountingProviders(accountingProviders: List) = apply { - this.accountingProviders = accountingProviders + this.accountingProviders = accountingProviders.toMutableList() + } + + fun addAccountingProvider(accountingProvider: AccountingProvider) = apply { + accountingProviders = + (accountingProviders ?: mutableListOf()).apply { add(accountingProvider) } } fun additionalProperties(additionalProperties: Map) = apply { @@ -3349,11 +3423,11 @@ constructor( return true } - return /* spotless:off */ other is CustomerCreateParams && email == other.email && name == other.name && accountingSyncConfiguration == other.accountingSyncConfiguration && additionalEmails == other.additionalEmails && autoCollection == other.autoCollection && billingAddress == other.billingAddress && currency == other.currency && emailDelivery == other.emailDelivery && externalCustomerId == other.externalCustomerId && metadata == other.metadata && paymentProvider == other.paymentProvider && paymentProviderId == other.paymentProviderId && reportingConfiguration == other.reportingConfiguration && shippingAddress == other.shippingAddress && taxConfiguration == other.taxConfiguration && taxId == other.taxId && timezone == other.timezone && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is CustomerCreateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(email, name, accountingSyncConfiguration, additionalEmails, autoCollection, billingAddress, currency, emailDelivery, externalCustomerId, metadata, paymentProvider, paymentProviderId, reportingConfiguration, shippingAddress, taxConfiguration, taxId, timezone, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "CustomerCreateParams{email=$email, name=$name, accountingSyncConfiguration=$accountingSyncConfiguration, additionalEmails=$additionalEmails, autoCollection=$autoCollection, billingAddress=$billingAddress, currency=$currency, emailDelivery=$emailDelivery, externalCustomerId=$externalCustomerId, metadata=$metadata, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, reportingConfiguration=$reportingConfiguration, shippingAddress=$shippingAddress, taxConfiguration=$taxConfiguration, taxId=$taxId, timezone=$timezone, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "CustomerCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt index cda7e786..d1539601 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt @@ -35,15 +35,7 @@ import kotlin.jvm.optionals.getOrNull class CustomerCreditLedgerCreateEntryByExternalIdParams constructor( private val externalCustomerId: String, - private val addIncrementCreditLedgerEntryRequestParams: - AddIncrementCreditLedgerEntryRequestParams?, - private val addDecrementCreditLedgerEntryRequestParams: - AddDecrementCreditLedgerEntryRequestParams?, - private val addExpirationChangeCreditLedgerEntryRequestParams: - AddExpirationChangeCreditLedgerEntryRequestParams?, - private val addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams?, - private val addAmendmentCreditLedgerEntryRequestParams: - AddAmendmentCreditLedgerEntryRequestParams?, + private val body: CustomerCreditLedgerCreateEntryByExternalIdBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) { @@ -52,37 +44,28 @@ constructor( fun addIncrementCreditLedgerEntryRequestParams(): Optional = - Optional.ofNullable(addIncrementCreditLedgerEntryRequestParams) + body.addIncrementCreditLedgerEntryRequestParams() fun addDecrementCreditLedgerEntryRequestParams(): Optional = - Optional.ofNullable(addDecrementCreditLedgerEntryRequestParams) + body.addDecrementCreditLedgerEntryRequestParams() fun addExpirationChangeCreditLedgerEntryRequestParams(): Optional = - Optional.ofNullable(addExpirationChangeCreditLedgerEntryRequestParams) + body.addExpirationChangeCreditLedgerEntryRequestParams() fun addVoidCreditLedgerEntryRequestParams(): Optional = - Optional.ofNullable(addVoidCreditLedgerEntryRequestParams) + body.addVoidCreditLedgerEntryRequestParams() fun addAmendmentCreditLedgerEntryRequestParams(): Optional = - Optional.ofNullable(addAmendmentCreditLedgerEntryRequestParams) + body.addAmendmentCreditLedgerEntryRequestParams() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic - internal fun getBody(): CustomerCreditLedgerCreateEntryByExternalIdBody { - return CustomerCreditLedgerCreateEntryByExternalIdBody( - addIncrementCreditLedgerEntryRequestParams, - addDecrementCreditLedgerEntryRequestParams, - addExpirationChangeCreditLedgerEntryRequestParams, - addVoidCreditLedgerEntryRequestParams, - addAmendmentCreditLedgerEntryRequestParams, - ) - } + @JvmSynthetic internal fun getBody(): CustomerCreditLedgerCreateEntryByExternalIdBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -444,20 +427,7 @@ constructor( class Builder { private var externalCustomerId: String? = null - private var addIncrementCreditLedgerEntryRequestParams: - AddIncrementCreditLedgerEntryRequestParams? = - null - private var addDecrementCreditLedgerEntryRequestParams: - AddDecrementCreditLedgerEntryRequestParams? = - null - private var addExpirationChangeCreditLedgerEntryRequestParams: - AddExpirationChangeCreditLedgerEntryRequestParams? = - null - private var addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams? = - null - private var addAmendmentCreditLedgerEntryRequestParams: - AddAmendmentCreditLedgerEntryRequestParams? = - null + private var body: CustomerCreditLedgerCreateEntryByExternalIdBody? = null private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -468,21 +438,7 @@ constructor( ) = apply { externalCustomerId = customerCreditLedgerCreateEntryByExternalIdParams.externalCustomerId - addIncrementCreditLedgerEntryRequestParams = - customerCreditLedgerCreateEntryByExternalIdParams - .addIncrementCreditLedgerEntryRequestParams - addDecrementCreditLedgerEntryRequestParams = - customerCreditLedgerCreateEntryByExternalIdParams - .addDecrementCreditLedgerEntryRequestParams - addExpirationChangeCreditLedgerEntryRequestParams = - customerCreditLedgerCreateEntryByExternalIdParams - .addExpirationChangeCreditLedgerEntryRequestParams - addVoidCreditLedgerEntryRequestParams = - customerCreditLedgerCreateEntryByExternalIdParams - .addVoidCreditLedgerEntryRequestParams - addAmendmentCreditLedgerEntryRequestParams = - customerCreditLedgerCreateEntryByExternalIdParams - .addAmendmentCreditLedgerEntryRequestParams + body = customerCreditLedgerCreateEntryByExternalIdParams.body additionalHeaders = customerCreditLedgerCreateEntryByExternalIdParams.additionalHeaders.toBuilder() additionalQueryParams = @@ -496,56 +452,50 @@ constructor( fun forAddIncrementCreditLedgerEntryRequestParams( addIncrementCreditLedgerEntryRequestParams: AddIncrementCreditLedgerEntryRequestParams ) = apply { - this.addIncrementCreditLedgerEntryRequestParams = - addIncrementCreditLedgerEntryRequestParams - this.addDecrementCreditLedgerEntryRequestParams = null - this.addExpirationChangeCreditLedgerEntryRequestParams = null - this.addVoidCreditLedgerEntryRequestParams = null - this.addAmendmentCreditLedgerEntryRequestParams = null + body = + CustomerCreditLedgerCreateEntryByExternalIdBody + .ofAddIncrementCreditLedgerEntryRequestParams( + addIncrementCreditLedgerEntryRequestParams + ) } fun forAddDecrementCreditLedgerEntryRequestParams( addDecrementCreditLedgerEntryRequestParams: AddDecrementCreditLedgerEntryRequestParams ) = apply { - this.addIncrementCreditLedgerEntryRequestParams = null - this.addDecrementCreditLedgerEntryRequestParams = - addDecrementCreditLedgerEntryRequestParams - this.addExpirationChangeCreditLedgerEntryRequestParams = null - this.addVoidCreditLedgerEntryRequestParams = null - this.addAmendmentCreditLedgerEntryRequestParams = null + body = + CustomerCreditLedgerCreateEntryByExternalIdBody + .ofAddDecrementCreditLedgerEntryRequestParams( + addDecrementCreditLedgerEntryRequestParams + ) } fun forAddExpirationChangeCreditLedgerEntryRequestParams( addExpirationChangeCreditLedgerEntryRequestParams: AddExpirationChangeCreditLedgerEntryRequestParams ) = apply { - this.addIncrementCreditLedgerEntryRequestParams = null - this.addDecrementCreditLedgerEntryRequestParams = null - this.addExpirationChangeCreditLedgerEntryRequestParams = - addExpirationChangeCreditLedgerEntryRequestParams - this.addVoidCreditLedgerEntryRequestParams = null - this.addAmendmentCreditLedgerEntryRequestParams = null + body = + CustomerCreditLedgerCreateEntryByExternalIdBody + .ofAddExpirationChangeCreditLedgerEntryRequestParams( + addExpirationChangeCreditLedgerEntryRequestParams + ) } fun forAddVoidCreditLedgerEntryRequestParams( addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams ) = apply { - this.addIncrementCreditLedgerEntryRequestParams = null - this.addDecrementCreditLedgerEntryRequestParams = null - this.addExpirationChangeCreditLedgerEntryRequestParams = null - this.addVoidCreditLedgerEntryRequestParams = addVoidCreditLedgerEntryRequestParams - this.addAmendmentCreditLedgerEntryRequestParams = null + body = + CustomerCreditLedgerCreateEntryByExternalIdBody + .ofAddVoidCreditLedgerEntryRequestParams(addVoidCreditLedgerEntryRequestParams) } fun forAddAmendmentCreditLedgerEntryRequestParams( addAmendmentCreditLedgerEntryRequestParams: AddAmendmentCreditLedgerEntryRequestParams ) = apply { - this.addIncrementCreditLedgerEntryRequestParams = null - this.addDecrementCreditLedgerEntryRequestParams = null - this.addExpirationChangeCreditLedgerEntryRequestParams = null - this.addVoidCreditLedgerEntryRequestParams = null - this.addAmendmentCreditLedgerEntryRequestParams = - addAmendmentCreditLedgerEntryRequestParams + body = + CustomerCreditLedgerCreateEntryByExternalIdBody + .ofAddAmendmentCreditLedgerEntryRequestParams( + addAmendmentCreditLedgerEntryRequestParams + ) } fun additionalHeaders(additionalHeaders: Headers) = apply { @@ -651,11 +601,7 @@ constructor( checkNotNull(externalCustomerId) { "`externalCustomerId` is required but was not set" }, - addIncrementCreditLedgerEntryRequestParams, - addDecrementCreditLedgerEntryRequestParams, - addExpirationChangeCreditLedgerEntryRequestParams, - addVoidCreditLedgerEntryRequestParams, - addAmendmentCreditLedgerEntryRequestParams, + body ?: CustomerCreditLedgerCreateEntryByExternalIdBody(), additionalHeaders.build(), additionalQueryParams.build(), ) @@ -2403,11 +2349,11 @@ constructor( return true } - return /* spotless:off */ other is CustomerCreditLedgerCreateEntryByExternalIdParams && externalCustomerId == other.externalCustomerId && addIncrementCreditLedgerEntryRequestParams == other.addIncrementCreditLedgerEntryRequestParams && addDecrementCreditLedgerEntryRequestParams == other.addDecrementCreditLedgerEntryRequestParams && addExpirationChangeCreditLedgerEntryRequestParams == other.addExpirationChangeCreditLedgerEntryRequestParams && addVoidCreditLedgerEntryRequestParams == other.addVoidCreditLedgerEntryRequestParams && addAmendmentCreditLedgerEntryRequestParams == other.addAmendmentCreditLedgerEntryRequestParams && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + return /* spotless:off */ other is CustomerCreditLedgerCreateEntryByExternalIdParams && externalCustomerId == other.externalCustomerId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(externalCustomerId, addIncrementCreditLedgerEntryRequestParams, addDecrementCreditLedgerEntryRequestParams, addExpirationChangeCreditLedgerEntryRequestParams, addVoidCreditLedgerEntryRequestParams, addAmendmentCreditLedgerEntryRequestParams, additionalHeaders, additionalQueryParams) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(externalCustomerId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "CustomerCreditLedgerCreateEntryByExternalIdParams{externalCustomerId=$externalCustomerId, addIncrementCreditLedgerEntryRequestParams=$addIncrementCreditLedgerEntryRequestParams, addDecrementCreditLedgerEntryRequestParams=$addDecrementCreditLedgerEntryRequestParams, addExpirationChangeCreditLedgerEntryRequestParams=$addExpirationChangeCreditLedgerEntryRequestParams, addVoidCreditLedgerEntryRequestParams=$addVoidCreditLedgerEntryRequestParams, addAmendmentCreditLedgerEntryRequestParams=$addAmendmentCreditLedgerEntryRequestParams, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "CustomerCreditLedgerCreateEntryByExternalIdParams{externalCustomerId=$externalCustomerId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParams.kt index bdbcf703..2767233e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParams.kt @@ -35,15 +35,7 @@ import kotlin.jvm.optionals.getOrNull class CustomerCreditLedgerCreateEntryParams constructor( private val customerId: String, - private val addIncrementCreditLedgerEntryRequestParams: - AddIncrementCreditLedgerEntryRequestParams?, - private val addDecrementCreditLedgerEntryRequestParams: - AddDecrementCreditLedgerEntryRequestParams?, - private val addExpirationChangeCreditLedgerEntryRequestParams: - AddExpirationChangeCreditLedgerEntryRequestParams?, - private val addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams?, - private val addAmendmentCreditLedgerEntryRequestParams: - AddAmendmentCreditLedgerEntryRequestParams?, + private val body: CustomerCreditLedgerCreateEntryBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) { @@ -52,37 +44,28 @@ constructor( fun addIncrementCreditLedgerEntryRequestParams(): Optional = - Optional.ofNullable(addIncrementCreditLedgerEntryRequestParams) + body.addIncrementCreditLedgerEntryRequestParams() fun addDecrementCreditLedgerEntryRequestParams(): Optional = - Optional.ofNullable(addDecrementCreditLedgerEntryRequestParams) + body.addDecrementCreditLedgerEntryRequestParams() fun addExpirationChangeCreditLedgerEntryRequestParams(): Optional = - Optional.ofNullable(addExpirationChangeCreditLedgerEntryRequestParams) + body.addExpirationChangeCreditLedgerEntryRequestParams() fun addVoidCreditLedgerEntryRequestParams(): Optional = - Optional.ofNullable(addVoidCreditLedgerEntryRequestParams) + body.addVoidCreditLedgerEntryRequestParams() fun addAmendmentCreditLedgerEntryRequestParams(): Optional = - Optional.ofNullable(addAmendmentCreditLedgerEntryRequestParams) + body.addAmendmentCreditLedgerEntryRequestParams() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic - internal fun getBody(): CustomerCreditLedgerCreateEntryBody { - return CustomerCreditLedgerCreateEntryBody( - addIncrementCreditLedgerEntryRequestParams, - addDecrementCreditLedgerEntryRequestParams, - addExpirationChangeCreditLedgerEntryRequestParams, - addVoidCreditLedgerEntryRequestParams, - addAmendmentCreditLedgerEntryRequestParams, - ) - } + @JvmSynthetic internal fun getBody(): CustomerCreditLedgerCreateEntryBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -437,20 +420,7 @@ constructor( class Builder { private var customerId: String? = null - private var addIncrementCreditLedgerEntryRequestParams: - AddIncrementCreditLedgerEntryRequestParams? = - null - private var addDecrementCreditLedgerEntryRequestParams: - AddDecrementCreditLedgerEntryRequestParams? = - null - private var addExpirationChangeCreditLedgerEntryRequestParams: - AddExpirationChangeCreditLedgerEntryRequestParams? = - null - private var addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams? = - null - private var addAmendmentCreditLedgerEntryRequestParams: - AddAmendmentCreditLedgerEntryRequestParams? = - null + private var body: CustomerCreditLedgerCreateEntryBody? = null private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -459,17 +429,7 @@ constructor( customerCreditLedgerCreateEntryParams: CustomerCreditLedgerCreateEntryParams ) = apply { customerId = customerCreditLedgerCreateEntryParams.customerId - addIncrementCreditLedgerEntryRequestParams = - customerCreditLedgerCreateEntryParams.addIncrementCreditLedgerEntryRequestParams - addDecrementCreditLedgerEntryRequestParams = - customerCreditLedgerCreateEntryParams.addDecrementCreditLedgerEntryRequestParams - addExpirationChangeCreditLedgerEntryRequestParams = - customerCreditLedgerCreateEntryParams - .addExpirationChangeCreditLedgerEntryRequestParams - addVoidCreditLedgerEntryRequestParams = - customerCreditLedgerCreateEntryParams.addVoidCreditLedgerEntryRequestParams - addAmendmentCreditLedgerEntryRequestParams = - customerCreditLedgerCreateEntryParams.addAmendmentCreditLedgerEntryRequestParams + body = customerCreditLedgerCreateEntryParams.body additionalHeaders = customerCreditLedgerCreateEntryParams.additionalHeaders.toBuilder() additionalQueryParams = customerCreditLedgerCreateEntryParams.additionalQueryParams.toBuilder() @@ -480,56 +440,48 @@ constructor( fun forAddIncrementCreditLedgerEntryRequestParams( addIncrementCreditLedgerEntryRequestParams: AddIncrementCreditLedgerEntryRequestParams ) = apply { - this.addIncrementCreditLedgerEntryRequestParams = - addIncrementCreditLedgerEntryRequestParams - this.addDecrementCreditLedgerEntryRequestParams = null - this.addExpirationChangeCreditLedgerEntryRequestParams = null - this.addVoidCreditLedgerEntryRequestParams = null - this.addAmendmentCreditLedgerEntryRequestParams = null + body = + CustomerCreditLedgerCreateEntryBody.ofAddIncrementCreditLedgerEntryRequestParams( + addIncrementCreditLedgerEntryRequestParams + ) } fun forAddDecrementCreditLedgerEntryRequestParams( addDecrementCreditLedgerEntryRequestParams: AddDecrementCreditLedgerEntryRequestParams ) = apply { - this.addIncrementCreditLedgerEntryRequestParams = null - this.addDecrementCreditLedgerEntryRequestParams = - addDecrementCreditLedgerEntryRequestParams - this.addExpirationChangeCreditLedgerEntryRequestParams = null - this.addVoidCreditLedgerEntryRequestParams = null - this.addAmendmentCreditLedgerEntryRequestParams = null + body = + CustomerCreditLedgerCreateEntryBody.ofAddDecrementCreditLedgerEntryRequestParams( + addDecrementCreditLedgerEntryRequestParams + ) } fun forAddExpirationChangeCreditLedgerEntryRequestParams( addExpirationChangeCreditLedgerEntryRequestParams: AddExpirationChangeCreditLedgerEntryRequestParams ) = apply { - this.addIncrementCreditLedgerEntryRequestParams = null - this.addDecrementCreditLedgerEntryRequestParams = null - this.addExpirationChangeCreditLedgerEntryRequestParams = - addExpirationChangeCreditLedgerEntryRequestParams - this.addVoidCreditLedgerEntryRequestParams = null - this.addAmendmentCreditLedgerEntryRequestParams = null + body = + CustomerCreditLedgerCreateEntryBody + .ofAddExpirationChangeCreditLedgerEntryRequestParams( + addExpirationChangeCreditLedgerEntryRequestParams + ) } fun forAddVoidCreditLedgerEntryRequestParams( addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams ) = apply { - this.addIncrementCreditLedgerEntryRequestParams = null - this.addDecrementCreditLedgerEntryRequestParams = null - this.addExpirationChangeCreditLedgerEntryRequestParams = null - this.addVoidCreditLedgerEntryRequestParams = addVoidCreditLedgerEntryRequestParams - this.addAmendmentCreditLedgerEntryRequestParams = null + body = + CustomerCreditLedgerCreateEntryBody.ofAddVoidCreditLedgerEntryRequestParams( + addVoidCreditLedgerEntryRequestParams + ) } fun forAddAmendmentCreditLedgerEntryRequestParams( addAmendmentCreditLedgerEntryRequestParams: AddAmendmentCreditLedgerEntryRequestParams ) = apply { - this.addIncrementCreditLedgerEntryRequestParams = null - this.addDecrementCreditLedgerEntryRequestParams = null - this.addExpirationChangeCreditLedgerEntryRequestParams = null - this.addVoidCreditLedgerEntryRequestParams = null - this.addAmendmentCreditLedgerEntryRequestParams = - addAmendmentCreditLedgerEntryRequestParams + body = + CustomerCreditLedgerCreateEntryBody.ofAddAmendmentCreditLedgerEntryRequestParams( + addAmendmentCreditLedgerEntryRequestParams + ) } fun additionalHeaders(additionalHeaders: Headers) = apply { @@ -633,11 +585,7 @@ constructor( fun build(): CustomerCreditLedgerCreateEntryParams = CustomerCreditLedgerCreateEntryParams( checkNotNull(customerId) { "`customerId` is required but was not set" }, - addIncrementCreditLedgerEntryRequestParams, - addDecrementCreditLedgerEntryRequestParams, - addExpirationChangeCreditLedgerEntryRequestParams, - addVoidCreditLedgerEntryRequestParams, - addAmendmentCreditLedgerEntryRequestParams, + body ?: CustomerCreditLedgerCreateEntryBody(), additionalHeaders.build(), additionalQueryParams.build(), ) @@ -2385,11 +2333,11 @@ constructor( return true } - return /* spotless:off */ other is CustomerCreditLedgerCreateEntryParams && customerId == other.customerId && addIncrementCreditLedgerEntryRequestParams == other.addIncrementCreditLedgerEntryRequestParams && addDecrementCreditLedgerEntryRequestParams == other.addDecrementCreditLedgerEntryRequestParams && addExpirationChangeCreditLedgerEntryRequestParams == other.addExpirationChangeCreditLedgerEntryRequestParams && addVoidCreditLedgerEntryRequestParams == other.addVoidCreditLedgerEntryRequestParams && addAmendmentCreditLedgerEntryRequestParams == other.addAmendmentCreditLedgerEntryRequestParams && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + return /* spotless:off */ other is CustomerCreditLedgerCreateEntryParams && customerId == other.customerId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(customerId, addIncrementCreditLedgerEntryRequestParams, addDecrementCreditLedgerEntryRequestParams, addExpirationChangeCreditLedgerEntryRequestParams, addVoidCreditLedgerEntryRequestParams, addAmendmentCreditLedgerEntryRequestParams, additionalHeaders, additionalQueryParams) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(customerId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "CustomerCreditLedgerCreateEntryParams{customerId=$customerId, addIncrementCreditLedgerEntryRequestParams=$addIncrementCreditLedgerEntryRequestParams, addDecrementCreditLedgerEntryRequestParams=$addDecrementCreditLedgerEntryRequestParams, addExpirationChangeCreditLedgerEntryRequestParams=$addExpirationChangeCreditLedgerEntryRequestParams, addVoidCreditLedgerEntryRequestParams=$addVoidCreditLedgerEntryRequestParams, addAmendmentCreditLedgerEntryRequestParams=$addAmendmentCreditLedgerEntryRequestParams, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "CustomerCreditLedgerCreateEntryParams{customerId=$customerId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt index 7228f220..80787347 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt @@ -41,14 +41,20 @@ constructor( fun createdAtLte(): Optional = Optional.ofNullable(createdAtLte) + /** The ledger currency or custom pricing unit to use. */ fun currency(): Optional = Optional.ofNullable(currency) + /** + * Cursor for pagination. This can be populated by the `next_cursor` value returned from the + * initial request. + */ fun cursor(): Optional = Optional.ofNullable(cursor) fun entryStatus(): Optional = Optional.ofNullable(entryStatus) fun entryType(): Optional = Optional.ofNullable(entryType) + /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) fun minimumAmount(): Optional = Optional.ofNullable(minimumAmount) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt index 51fa6436..e2b53fff 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt @@ -41,14 +41,20 @@ constructor( fun createdAtLte(): Optional = Optional.ofNullable(createdAtLte) + /** The ledger currency or custom pricing unit to use. */ fun currency(): Optional = Optional.ofNullable(currency) + /** + * Cursor for pagination. This can be populated by the `next_cursor` value returned from the + * initial request. + */ fun cursor(): Optional = Optional.ofNullable(cursor) fun entryStatus(): Optional = Optional.ofNullable(entryStatus) fun entryType(): Optional = Optional.ofNullable(entryType) + /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) fun minimumAmount(): Optional = Optional.ofNullable(minimumAmount) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdParams.kt index d94e184c..d1bb47ff 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListByExternalIdParams.kt @@ -21,12 +21,21 @@ constructor( fun externalCustomerId(): String = externalCustomerId + /** The ledger currency or custom pricing unit to use. */ fun currency(): Optional = Optional.ofNullable(currency) + /** + * Cursor for pagination. This can be populated by the `next_cursor` value returned from the + * initial request. + */ fun cursor(): Optional = Optional.ofNullable(cursor) + /** + * If set to True, all expired and depleted blocks, as well as active block will be returned. + */ fun includeAllBlocks(): Optional = Optional.ofNullable(includeAllBlocks) + /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) fun _additionalHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListParams.kt index 2229acb4..4386f7ac 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditListParams.kt @@ -21,12 +21,21 @@ constructor( fun customerId(): String = customerId + /** The ledger currency or custom pricing unit to use. */ fun currency(): Optional = Optional.ofNullable(currency) + /** + * Cursor for pagination. This can be populated by the `next_cursor` value returned from the + * initial request. + */ fun cursor(): Optional = Optional.ofNullable(cursor) + /** + * If set to True, all expired and depleted blocks, as well as active block will be returned. + */ fun includeAllBlocks(): Optional = Optional.ofNullable(includeAllBlocks) + /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) fun _additionalHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParams.kt index 75208a05..b33af243 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParams.kt @@ -22,53 +22,50 @@ import java.util.Optional class CustomerCreditTopUpCreateByExternalIdParams constructor( private val externalCustomerId: String, - private val amount: String, - private val currency: String, - private val invoiceSettings: InvoiceSettings, - private val perUnitCostBasis: String, - private val threshold: String, - private val expiresAfter: Long?, - private val expiresAfterUnit: ExpiresAfterUnit?, + private val body: CustomerCreditTopUpCreateByExternalIdBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun externalCustomerId(): String = externalCustomerId - fun amount(): String = amount + /** The amount to increment when the threshold is reached. */ + fun amount(): String = body.amount() - fun currency(): String = currency + /** + * The currency or custom pricing unit to use for this top-up. If this is a real-world currency, + * it must match the customer's invoicing currency. + */ + fun currency(): String = body.currency() - fun invoiceSettings(): InvoiceSettings = invoiceSettings + /** Settings for invoices generated by triggered top-ups. */ + fun invoiceSettings(): InvoiceSettings = body.invoiceSettings() - fun perUnitCostBasis(): String = perUnitCostBasis + /** How much, in the customer's currency, to charge for each unit. */ + fun perUnitCostBasis(): String = body.perUnitCostBasis() - fun threshold(): String = threshold + /** + * The threshold at which to trigger the top-up. If the balance is at or below this threshold, + * the top-up will be triggered. + */ + fun threshold(): String = body.threshold() - fun expiresAfter(): Optional = Optional.ofNullable(expiresAfter) + /** + * The number of days or months after which the top-up expires. If unspecified, it does not + * expire. + */ + fun expiresAfter(): Optional = body.expiresAfter() - fun expiresAfterUnit(): Optional = Optional.ofNullable(expiresAfterUnit) + /** The unit of expires_after. */ + fun expiresAfterUnit(): Optional = body.expiresAfterUnit() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): CustomerCreditTopUpCreateByExternalIdBody { - return CustomerCreditTopUpCreateByExternalIdBody( - amount, - currency, - invoiceSettings, - perUnitCostBasis, - threshold, - expiresAfter, - expiresAfterUnit, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): CustomerCreditTopUpCreateByExternalIdBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -266,35 +263,21 @@ constructor( class Builder { private var externalCustomerId: String? = null - private var amount: String? = null - private var currency: String? = null - private var invoiceSettings: InvoiceSettings? = null - private var perUnitCostBasis: String? = null - private var threshold: String? = null - private var expiresAfter: Long? = null - private var expiresAfterUnit: ExpiresAfterUnit? = null + private var body: CustomerCreditTopUpCreateByExternalIdBody.Builder = + CustomerCreditTopUpCreateByExternalIdBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( customerCreditTopUpCreateByExternalIdParams: CustomerCreditTopUpCreateByExternalIdParams ) = apply { externalCustomerId = customerCreditTopUpCreateByExternalIdParams.externalCustomerId - amount = customerCreditTopUpCreateByExternalIdParams.amount - currency = customerCreditTopUpCreateByExternalIdParams.currency - invoiceSettings = customerCreditTopUpCreateByExternalIdParams.invoiceSettings - perUnitCostBasis = customerCreditTopUpCreateByExternalIdParams.perUnitCostBasis - threshold = customerCreditTopUpCreateByExternalIdParams.threshold - expiresAfter = customerCreditTopUpCreateByExternalIdParams.expiresAfter - expiresAfterUnit = customerCreditTopUpCreateByExternalIdParams.expiresAfterUnit + body = customerCreditTopUpCreateByExternalIdParams.body.toBuilder() additionalHeaders = customerCreditTopUpCreateByExternalIdParams.additionalHeaders.toBuilder() additionalQueryParams = customerCreditTopUpCreateByExternalIdParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - customerCreditTopUpCreateByExternalIdParams.additionalBodyProperties.toMutableMap() } fun externalCustomerId(externalCustomerId: String) = apply { @@ -302,39 +285,39 @@ constructor( } /** The amount to increment when the threshold is reached. */ - fun amount(amount: String) = apply { this.amount = amount } + fun amount(amount: String) = apply { body.amount(amount) } /** * The currency or custom pricing unit to use for this top-up. If this is a real-world * currency, it must match the customer's invoicing currency. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: String) = apply { body.currency(currency) } /** Settings for invoices generated by triggered top-ups. */ fun invoiceSettings(invoiceSettings: InvoiceSettings) = apply { - this.invoiceSettings = invoiceSettings + body.invoiceSettings(invoiceSettings) } /** How much, in the customer's currency, to charge for each unit. */ fun perUnitCostBasis(perUnitCostBasis: String) = apply { - this.perUnitCostBasis = perUnitCostBasis + body.perUnitCostBasis(perUnitCostBasis) } /** * The threshold at which to trigger the top-up. If the balance is at or below this * threshold, the top-up will be triggered. */ - fun threshold(threshold: String) = apply { this.threshold = threshold } + fun threshold(threshold: String) = apply { body.threshold(threshold) } /** * The number of days or months after which the top-up expires. If unspecified, it does not * expire. */ - fun expiresAfter(expiresAfter: Long) = apply { this.expiresAfter = expiresAfter } + fun expiresAfter(expiresAfter: Long) = apply { body.expiresAfter(expiresAfter) } /** The unit of expires_after. */ fun expiresAfterUnit(expiresAfterUnit: ExpiresAfterUnit) = apply { - this.expiresAfterUnit = expiresAfterUnit + body.expiresAfterUnit(expiresAfterUnit) } fun additionalHeaders(additionalHeaders: Headers) = apply { @@ -436,25 +419,22 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): CustomerCreditTopUpCreateByExternalIdParams = @@ -462,16 +442,9 @@ constructor( checkNotNull(externalCustomerId) { "`externalCustomerId` is required but was not set" }, - checkNotNull(amount) { "`amount` is required but was not set" }, - checkNotNull(currency) { "`currency` is required but was not set" }, - checkNotNull(invoiceSettings) { "`invoiceSettings` is required but was not set" }, - checkNotNull(perUnitCostBasis) { "`perUnitCostBasis` is required but was not set" }, - checkNotNull(threshold) { "`threshold` is required but was not set" }, - expiresAfter, - expiresAfterUnit, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -673,11 +646,11 @@ constructor( return true } - return /* spotless:off */ other is CustomerCreditTopUpCreateByExternalIdParams && externalCustomerId == other.externalCustomerId && amount == other.amount && currency == other.currency && invoiceSettings == other.invoiceSettings && perUnitCostBasis == other.perUnitCostBasis && threshold == other.threshold && expiresAfter == other.expiresAfter && expiresAfterUnit == other.expiresAfterUnit && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is CustomerCreditTopUpCreateByExternalIdParams && externalCustomerId == other.externalCustomerId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(externalCustomerId, amount, currency, invoiceSettings, perUnitCostBasis, threshold, expiresAfter, expiresAfterUnit, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(externalCustomerId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "CustomerCreditTopUpCreateByExternalIdParams{externalCustomerId=$externalCustomerId, amount=$amount, currency=$currency, invoiceSettings=$invoiceSettings, perUnitCostBasis=$perUnitCostBasis, threshold=$threshold, expiresAfter=$expiresAfter, expiresAfterUnit=$expiresAfterUnit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "CustomerCreditTopUpCreateByExternalIdParams{externalCustomerId=$externalCustomerId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParams.kt index 9cbef739..9a7e41a3 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParams.kt @@ -22,53 +22,50 @@ import java.util.Optional class CustomerCreditTopUpCreateParams constructor( private val customerId: String, - private val amount: String, - private val currency: String, - private val invoiceSettings: InvoiceSettings, - private val perUnitCostBasis: String, - private val threshold: String, - private val expiresAfter: Long?, - private val expiresAfterUnit: ExpiresAfterUnit?, + private val body: CustomerCreditTopUpCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun customerId(): String = customerId - fun amount(): String = amount + /** The amount to increment when the threshold is reached. */ + fun amount(): String = body.amount() - fun currency(): String = currency + /** + * The currency or custom pricing unit to use for this top-up. If this is a real-world currency, + * it must match the customer's invoicing currency. + */ + fun currency(): String = body.currency() - fun invoiceSettings(): InvoiceSettings = invoiceSettings + /** Settings for invoices generated by triggered top-ups. */ + fun invoiceSettings(): InvoiceSettings = body.invoiceSettings() - fun perUnitCostBasis(): String = perUnitCostBasis + /** How much, in the customer's currency, to charge for each unit. */ + fun perUnitCostBasis(): String = body.perUnitCostBasis() - fun threshold(): String = threshold + /** + * The threshold at which to trigger the top-up. If the balance is at or below this threshold, + * the top-up will be triggered. + */ + fun threshold(): String = body.threshold() - fun expiresAfter(): Optional = Optional.ofNullable(expiresAfter) + /** + * The number of days or months after which the top-up expires. If unspecified, it does not + * expire. + */ + fun expiresAfter(): Optional = body.expiresAfter() - fun expiresAfterUnit(): Optional = Optional.ofNullable(expiresAfterUnit) + /** The unit of expires_after. */ + fun expiresAfterUnit(): Optional = body.expiresAfterUnit() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): CustomerCreditTopUpCreateBody { - return CustomerCreditTopUpCreateBody( - amount, - currency, - invoiceSettings, - perUnitCostBasis, - threshold, - expiresAfter, - expiresAfterUnit, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): CustomerCreditTopUpCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -265,71 +262,57 @@ constructor( class Builder { private var customerId: String? = null - private var amount: String? = null - private var currency: String? = null - private var invoiceSettings: InvoiceSettings? = null - private var perUnitCostBasis: String? = null - private var threshold: String? = null - private var expiresAfter: Long? = null - private var expiresAfterUnit: ExpiresAfterUnit? = null + private var body: CustomerCreditTopUpCreateBody.Builder = + CustomerCreditTopUpCreateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(customerCreditTopUpCreateParams: CustomerCreditTopUpCreateParams) = apply { customerId = customerCreditTopUpCreateParams.customerId - amount = customerCreditTopUpCreateParams.amount - currency = customerCreditTopUpCreateParams.currency - invoiceSettings = customerCreditTopUpCreateParams.invoiceSettings - perUnitCostBasis = customerCreditTopUpCreateParams.perUnitCostBasis - threshold = customerCreditTopUpCreateParams.threshold - expiresAfter = customerCreditTopUpCreateParams.expiresAfter - expiresAfterUnit = customerCreditTopUpCreateParams.expiresAfterUnit + body = customerCreditTopUpCreateParams.body.toBuilder() additionalHeaders = customerCreditTopUpCreateParams.additionalHeaders.toBuilder() additionalQueryParams = customerCreditTopUpCreateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - customerCreditTopUpCreateParams.additionalBodyProperties.toMutableMap() } fun customerId(customerId: String) = apply { this.customerId = customerId } /** The amount to increment when the threshold is reached. */ - fun amount(amount: String) = apply { this.amount = amount } + fun amount(amount: String) = apply { body.amount(amount) } /** * The currency or custom pricing unit to use for this top-up. If this is a real-world * currency, it must match the customer's invoicing currency. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: String) = apply { body.currency(currency) } /** Settings for invoices generated by triggered top-ups. */ fun invoiceSettings(invoiceSettings: InvoiceSettings) = apply { - this.invoiceSettings = invoiceSettings + body.invoiceSettings(invoiceSettings) } /** How much, in the customer's currency, to charge for each unit. */ fun perUnitCostBasis(perUnitCostBasis: String) = apply { - this.perUnitCostBasis = perUnitCostBasis + body.perUnitCostBasis(perUnitCostBasis) } /** * The threshold at which to trigger the top-up. If the balance is at or below this * threshold, the top-up will be triggered. */ - fun threshold(threshold: String) = apply { this.threshold = threshold } + fun threshold(threshold: String) = apply { body.threshold(threshold) } /** * The number of days or months after which the top-up expires. If unspecified, it does not * expire. */ - fun expiresAfter(expiresAfter: Long) = apply { this.expiresAfter = expiresAfter } + fun expiresAfter(expiresAfter: Long) = apply { body.expiresAfter(expiresAfter) } /** The unit of expires_after. */ fun expiresAfterUnit(expiresAfterUnit: ExpiresAfterUnit) = apply { - this.expiresAfterUnit = expiresAfterUnit + body.expiresAfterUnit(expiresAfterUnit) } fun additionalHeaders(additionalHeaders: Headers) = apply { @@ -431,40 +414,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): CustomerCreditTopUpCreateParams = CustomerCreditTopUpCreateParams( checkNotNull(customerId) { "`customerId` is required but was not set" }, - checkNotNull(amount) { "`amount` is required but was not set" }, - checkNotNull(currency) { "`currency` is required but was not set" }, - checkNotNull(invoiceSettings) { "`invoiceSettings` is required but was not set" }, - checkNotNull(perUnitCostBasis) { "`perUnitCostBasis` is required but was not set" }, - checkNotNull(threshold) { "`threshold` is required but was not set" }, - expiresAfter, - expiresAfterUnit, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -666,11 +639,11 @@ constructor( return true } - return /* spotless:off */ other is CustomerCreditTopUpCreateParams && customerId == other.customerId && amount == other.amount && currency == other.currency && invoiceSettings == other.invoiceSettings && perUnitCostBasis == other.perUnitCostBasis && threshold == other.threshold && expiresAfter == other.expiresAfter && expiresAfterUnit == other.expiresAfterUnit && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is CustomerCreditTopUpCreateParams && customerId == other.customerId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(customerId, amount, currency, invoiceSettings, perUnitCostBasis, threshold, expiresAfter, expiresAfterUnit, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(customerId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "CustomerCreditTopUpCreateParams{customerId=$customerId, amount=$amount, currency=$currency, invoiceSettings=$invoiceSettings, perUnitCostBasis=$perUnitCostBasis, threshold=$threshold, expiresAfter=$expiresAfter, expiresAfterUnit=$expiresAfterUnit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "CustomerCreditTopUpCreateParams{customerId=$customerId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteByExternalIdParams.kt index 12ce4ee1..c0113576 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteByExternalIdParams.kt @@ -30,9 +30,8 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties @JvmSynthetic - internal fun getBody(): Optional> { - return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - } + internal fun getBody(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteParams.kt index 6b3231af..76e318bf 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteParams.kt @@ -30,9 +30,8 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties @JvmSynthetic - internal fun getBody(): Optional> { - return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - } + internal fun getBody(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdParams.kt index 940a23d9..3a5bcc39 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdParams.kt @@ -19,8 +19,13 @@ constructor( fun externalCustomerId(): String = externalCustomerId + /** + * Cursor for pagination. This can be populated by the `next_cursor` value returned from the + * initial request. + */ fun cursor(): Optional = Optional.ofNullable(cursor) + /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) fun _additionalHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListParams.kt index 9d091362..c306543d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListParams.kt @@ -19,8 +19,13 @@ constructor( fun customerId(): String = customerId + /** + * Cursor for pagination. This can be populated by the `next_cursor` value returned from the + * initial request. + */ fun cursor(): Optional = Optional.ofNullable(cursor) + /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) fun _additionalHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerDeleteParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerDeleteParams.kt index 5600bad4..63ecd62c 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerDeleteParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerDeleteParams.kt @@ -27,9 +27,8 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties @JvmSynthetic - internal fun getBody(): Optional> { - return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - } + internal fun getBody(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListParams.kt index 83c7dc56..0d859b20 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerListParams.kt @@ -30,8 +30,13 @@ constructor( fun createdAtLte(): Optional = Optional.ofNullable(createdAtLte) + /** + * Cursor for pagination. This can be populated by the `next_cursor` value returned from the + * initial request. + */ fun cursor(): Optional = Optional.ofNullable(cursor) + /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) fun _additionalHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt index 02ea78fd..5e90a3b7 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt @@ -33,91 +33,194 @@ import kotlin.jvm.optionals.getOrNull class CustomerUpdateByExternalIdParams constructor( private val id: String, - private val accountingSyncConfiguration: AccountingSyncConfiguration?, - private val additionalEmails: List?, - private val autoCollection: Boolean?, - private val billingAddress: BillingAddress?, - private val currency: String?, - private val email: String?, - private val emailDelivery: Boolean?, - private val externalCustomerId: String?, - private val metadata: Metadata?, - private val name: String?, - private val paymentProvider: PaymentProvider?, - private val paymentProviderId: String?, - private val reportingConfiguration: ReportingConfiguration?, - private val shippingAddress: ShippingAddress?, - private val taxConfiguration: TaxConfiguration?, - private val taxId: TaxId?, + private val body: CustomerUpdateByExternalIdBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun id(): String = id fun accountingSyncConfiguration(): Optional = - Optional.ofNullable(accountingSyncConfiguration) + body.accountingSyncConfiguration() - fun additionalEmails(): Optional> = Optional.ofNullable(additionalEmails) + /** + * Additional email addresses for this customer. If populated, these email addresses will be + * CC'd for customer communications. + */ + fun additionalEmails(): Optional> = body.additionalEmails() - fun autoCollection(): Optional = Optional.ofNullable(autoCollection) + /** + * Used to determine if invoices for this customer will automatically attempt to charge a saved + * payment method, if available. This parameter defaults to `True` when a payment provider is + * provided on customer creation. + */ + fun autoCollection(): Optional = body.autoCollection() - fun billingAddress(): Optional = Optional.ofNullable(billingAddress) + fun billingAddress(): Optional = body.billingAddress() - fun currency(): Optional = Optional.ofNullable(currency) + /** + * An ISO 4217 currency string used for the customer's invoices and balance. If not set at + * creation time, will be set at subscription creation time. + */ + fun currency(): Optional = body.currency() - fun email(): Optional = Optional.ofNullable(email) + /** A valid customer email, to be used for invoicing and notifications. */ + fun email(): Optional = body.email() - fun emailDelivery(): Optional = Optional.ofNullable(emailDelivery) + fun emailDelivery(): Optional = body.emailDelivery() - fun externalCustomerId(): Optional = Optional.ofNullable(externalCustomerId) + /** + * The external customer ID. This can only be set if empty and the customer has no past or + * current subscriptions. + */ + fun externalCustomerId(): Optional = body.externalCustomerId() - fun metadata(): Optional = Optional.ofNullable(metadata) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by setting + * the value to `null`, and the entire metadata mapping can be cleared by setting `metadata` to + * `null`. + */ + fun metadata(): Optional = body.metadata() - fun name(): Optional = Optional.ofNullable(name) + /** The full name of the customer */ + fun name(): Optional = body.name() - fun paymentProvider(): Optional = Optional.ofNullable(paymentProvider) + /** + * This is used for creating charges or invoices in an external system via Orb. When not in test + * mode: + * - the connection must first be configured in the Orb webapp. + * - if the provider is an invoicing provider (`stripe_invoice`, `quickbooks`, `bill.com`, + * `netsuite`), any product mappings must first be configured with the Orb team. + */ + fun paymentProvider(): Optional = body.paymentProvider() - fun paymentProviderId(): Optional = Optional.ofNullable(paymentProviderId) + /** + * The ID of this customer in an external payments solution, such as Stripe. This is used for + * creating charges or invoices in the external system via Orb. + */ + fun paymentProviderId(): Optional = body.paymentProviderId() - fun reportingConfiguration(): Optional = - Optional.ofNullable(reportingConfiguration) + fun reportingConfiguration(): Optional = body.reportingConfiguration() - fun shippingAddress(): Optional = Optional.ofNullable(shippingAddress) + fun shippingAddress(): Optional = body.shippingAddress() - fun taxConfiguration(): Optional = Optional.ofNullable(taxConfiguration) + fun taxConfiguration(): Optional = body.taxConfiguration() - fun taxId(): Optional = Optional.ofNullable(taxId) + /** + * Tax IDs are commonly required to be displayed on customer invoices, which are added to the + * headers of invoices. + * + * ### Supported Tax ID Countries and Types + * |Country |Type |Description | + * |--------------------|------------|-------------------------------------------------------------------------------------------------------| + * |Andorra |`ad_nrt` |Andorran NRT Number | + * |Argentina |`ar_cuit` |Argentinian Tax ID Number | + * |Australia |`au_abn` |Australian Business Number (AU ABN) | + * |Australia |`au_arn` |Australian Taxation Office Reference Number | + * |Austria |`eu_vat` |European VAT Number | + * |Bahrain |`bh_vat` |Bahraini VAT Number | + * |Belgium |`eu_vat` |European VAT Number | + * |Bolivia |`bo_tin` |Bolivian Tax ID | + * |Brazil |`br_cnpj` |Brazilian CNPJ Number | + * |Brazil |`br_cpf` |Brazilian CPF Number | + * |Bulgaria |`bg_uic` |Bulgaria Unified Identification Code | + * |Bulgaria |`eu_vat` |European VAT Number | + * |Canada |`ca_bn` |Canadian BN | + * |Canada |`ca_gst_hst`|Canadian GST/HST Number | + * |Canada |`ca_pst_bc` |Canadian PST Number (British Columbia) | + * |Canada |`ca_pst_mb` |Canadian PST Number (Manitoba) | + * |Canada |`ca_pst_sk` |Canadian PST Number (Saskatchewan) | + * |Canada |`ca_qst` |Canadian QST Number (Québec) | + * |Chile |`cl_tin` |Chilean TIN | + * |China |`cn_tin` |Chinese Tax ID | + * |Colombia |`co_nit` |Colombian NIT Number | + * |Costa Rica |`cr_tin` |Costa Rican Tax ID | + * |Croatia |`eu_vat` |European VAT Number | + * |Cyprus |`eu_vat` |European VAT Number | + * |Czech Republic |`eu_vat` |European VAT Number | + * |Denmark |`eu_vat` |European VAT Number | + * |Dominican Republic |`do_rcn` |Dominican RCN Number | + * |Ecuador |`ec_ruc` |Ecuadorian RUC Number | + * |Egypt |`eg_tin` |Egyptian Tax Identification Number | + * |El Salvador |`sv_nit` |El Salvadorian NIT Number | + * |Estonia |`eu_vat` |European VAT Number | + * |EU |`eu_oss_vat`|European One Stop Shop VAT Number for non-Union scheme | + * |Finland |`eu_vat` |European VAT Number | + * |France |`eu_vat` |European VAT Number | + * |Georgia |`ge_vat` |Georgian VAT | + * |Germany |`eu_vat` |European VAT Number | + * |Greece |`eu_vat` |European VAT Number | + * |Hong Kong |`hk_br` |Hong Kong BR Number | + * |Hungary |`eu_vat` |European VAT Number | + * |Hungary |`hu_tin` |Hungary Tax Number (adószám) | + * |Iceland |`is_vat` |Icelandic VAT | + * |India |`in_gst` |Indian GST Number | + * |Indonesia |`id_npwp` |Indonesian NPWP Number | + * |Ireland |`eu_vat` |European VAT Number | + * |Israel |`il_vat` |Israel VAT | + * |Italy |`eu_vat` |European VAT Number | + * |Japan |`jp_cn` |Japanese Corporate Number (_Hōjin Bangō_) | + * |Japan |`jp_rn` |Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_)| + * |Japan |`jp_trn` |Japanese Tax Registration Number (_Tōroku Bangō_) | + * |Kazakhstan |`kz_bin` |Kazakhstani Business Identification Number | + * |Kenya |`ke_pin` |Kenya Revenue Authority Personal Identification Number | + * |Latvia |`eu_vat` |European VAT Number | + * |Liechtenstein |`li_uid` |Liechtensteinian UID Number | + * |Lithuania |`eu_vat` |European VAT Number | + * |Luxembourg |`eu_vat` |European VAT Number | + * |Malaysia |`my_frp` |Malaysian FRP Number | + * |Malaysia |`my_itn` |Malaysian ITN | + * |Malaysia |`my_sst` |Malaysian SST Number | + * |Malta |`eu_vat ` |European VAT Number | + * |Mexico |`mx_rfc` |Mexican RFC Number | + * |Netherlands |`eu_vat` |European VAT Number | + * |New Zealand |`nz_gst` |New Zealand GST Number | + * |Nigeria |`ng_tin` |Nigerian Tax Identification Number | + * |Norway |`no_vat` |Norwegian VAT Number | + * |Norway |`no_voec` |Norwegian VAT on e-commerce Number | + * |Oman |`om_vat` |Omani VAT Number | + * |Peru |`pe_ruc` |Peruvian RUC Number | + * |Philippines |`ph_tin ` |Philippines Tax Identification Number | + * |Poland |`eu_vat` |European VAT Number | + * |Portugal |`eu_vat` |European VAT Number | + * |Romania |`eu_vat` |European VAT Number | + * |Romania |`ro_tin` |Romanian Tax ID Number | + * |Russia |`ru_inn` |Russian INN | + * |Russia |`ru_kpp` |Russian KPP | + * |Saudi Arabia |`sa_vat` |Saudi Arabia VAT | + * |Serbia |`rs_pib` |Serbian PIB Number | + * |Singapore |`sg_gst` |Singaporean GST | + * |Singapore |`sg_uen` |Singaporean UEN | + * |Slovakia |`eu_vat` |European VAT Number | + * |Slovenia |`eu_vat` |European VAT Number | + * |Slovenia |`si_tin` |Slovenia Tax Number (davčna številka) | + * |South Africa |`za_vat` |South African VAT Number | + * |South Korea |`kr_brn` |Korean BRN | + * |Spain |`es_cif` |Spanish NIF Number (previously Spanish CIF Number) | + * |Spain |`eu_vat` |European VAT Number | + * |Sweden |`eu_vat` |European VAT Number | + * |Switzerland |`ch_vat` |Switzerland VAT Number | + * |Taiwan |`tw_vat` |Taiwanese VAT | + * |Thailand |`th_vat` |Thai VAT | + * |Turkey |`tr_tin` |Turkish Tax Identification Number | + * |Ukraine |`ua_vat` |Ukrainian VAT | + * |United Arab Emirates|`ae_trn` |United Arab Emirates TRN | + * |United Kingdom |`eu_vat` |Northern Ireland VAT Number | + * |United Kingdom |`gb_vat` |United Kingdom VAT Number | + * |United States |`us_ein` |United States EIN | + * |Uruguay |`uy_ruc` |Uruguayan RUC Number | + * |Venezuela |`ve_rif` |Venezuelan RIF Number | + * |Vietnam |`vn_tin` |Vietnamese Tax ID Number | + */ + fun taxId(): Optional = body.taxId() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): CustomerUpdateByExternalIdBody { - return CustomerUpdateByExternalIdBody( - accountingSyncConfiguration, - additionalEmails, - autoCollection, - billingAddress, - currency, - email, - emailDelivery, - externalCustomerId, - metadata, - name, - paymentProvider, - paymentProviderId, - reportingConfiguration, - shippingAddress, - taxConfiguration, - taxId, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): CustomerUpdateByExternalIdBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -356,7 +459,7 @@ constructor( class Builder { private var accountingSyncConfiguration: AccountingSyncConfiguration? = null - private var additionalEmails: List? = null + private var additionalEmails: MutableList? = null private var autoCollection: Boolean? = null private var billingAddress: BillingAddress? = null private var currency: String? = null @@ -407,7 +510,16 @@ constructor( * will be CC'd for customer communications. */ fun additionalEmails(additionalEmails: List) = apply { - this.additionalEmails = additionalEmails + this.additionalEmails = additionalEmails.toMutableList() + } + + /** + * Additional email addresses for this customer. If populated, these email addresses + * will be CC'd for customer communications. + */ + fun addAdditionalEmail(additionalEmail: String) = apply { + additionalEmails = + (additionalEmails ?: mutableListOf()).apply { add(additionalEmail) } } /** @@ -484,6 +596,19 @@ constructor( this.taxConfiguration = taxConfiguration } + fun taxConfiguration( + newAvalaraTaxConfiguration: TaxConfiguration.NewAvalaraTaxConfiguration + ) = apply { + this.taxConfiguration = + TaxConfiguration.ofNewAvalaraTaxConfiguration(newAvalaraTaxConfiguration) + } + + fun taxConfiguration(newTaxJarConfiguration: TaxConfiguration.NewTaxJarConfiguration) = + apply { + this.taxConfiguration = + TaxConfiguration.ofNewTaxJarConfiguration(newTaxJarConfiguration) + } + /** * Tax IDs are commonly required to be displayed on customer invoices, which are added * to the headers of invoices. @@ -662,61 +787,26 @@ constructor( class Builder { private var id: String? = null - private var accountingSyncConfiguration: AccountingSyncConfiguration? = null - private var additionalEmails: MutableList = mutableListOf() - private var autoCollection: Boolean? = null - private var billingAddress: BillingAddress? = null - private var currency: String? = null - private var email: String? = null - private var emailDelivery: Boolean? = null - private var externalCustomerId: String? = null - private var metadata: Metadata? = null - private var name: String? = null - private var paymentProvider: PaymentProvider? = null - private var paymentProviderId: String? = null - private var reportingConfiguration: ReportingConfiguration? = null - private var shippingAddress: ShippingAddress? = null - private var taxConfiguration: TaxConfiguration? = null - private var taxId: TaxId? = null + private var body: CustomerUpdateByExternalIdBody.Builder = + CustomerUpdateByExternalIdBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(customerUpdateByExternalIdParams: CustomerUpdateByExternalIdParams) = apply { id = customerUpdateByExternalIdParams.id - accountingSyncConfiguration = - customerUpdateByExternalIdParams.accountingSyncConfiguration - additionalEmails = - customerUpdateByExternalIdParams.additionalEmails?.toMutableList() - ?: mutableListOf() - autoCollection = customerUpdateByExternalIdParams.autoCollection - billingAddress = customerUpdateByExternalIdParams.billingAddress - currency = customerUpdateByExternalIdParams.currency - email = customerUpdateByExternalIdParams.email - emailDelivery = customerUpdateByExternalIdParams.emailDelivery - externalCustomerId = customerUpdateByExternalIdParams.externalCustomerId - metadata = customerUpdateByExternalIdParams.metadata - name = customerUpdateByExternalIdParams.name - paymentProvider = customerUpdateByExternalIdParams.paymentProvider - paymentProviderId = customerUpdateByExternalIdParams.paymentProviderId - reportingConfiguration = customerUpdateByExternalIdParams.reportingConfiguration - shippingAddress = customerUpdateByExternalIdParams.shippingAddress - taxConfiguration = customerUpdateByExternalIdParams.taxConfiguration - taxId = customerUpdateByExternalIdParams.taxId + body = customerUpdateByExternalIdParams.body.toBuilder() additionalHeaders = customerUpdateByExternalIdParams.additionalHeaders.toBuilder() additionalQueryParams = customerUpdateByExternalIdParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - customerUpdateByExternalIdParams.additionalBodyProperties.toMutableMap() } fun id(id: String) = apply { this.id = id } fun accountingSyncConfiguration(accountingSyncConfiguration: AccountingSyncConfiguration) = apply { - this.accountingSyncConfiguration = accountingSyncConfiguration + body.accountingSyncConfiguration(accountingSyncConfiguration) } /** @@ -724,8 +814,7 @@ constructor( * CC'd for customer communications. */ fun additionalEmails(additionalEmails: List) = apply { - this.additionalEmails.clear() - this.additionalEmails.addAll(additionalEmails) + body.additionalEmails(additionalEmails) } /** @@ -733,7 +822,7 @@ constructor( * CC'd for customer communications. */ fun addAdditionalEmail(additionalEmail: String) = apply { - this.additionalEmails.add(additionalEmail) + body.addAdditionalEmail(additionalEmail) } /** @@ -741,29 +830,29 @@ constructor( * saved payment method, if available. This parameter defaults to `True` when a payment * provider is provided on customer creation. */ - fun autoCollection(autoCollection: Boolean) = apply { this.autoCollection = autoCollection } + fun autoCollection(autoCollection: Boolean) = apply { body.autoCollection(autoCollection) } fun billingAddress(billingAddress: BillingAddress) = apply { - this.billingAddress = billingAddress + body.billingAddress(billingAddress) } /** * An ISO 4217 currency string used for the customer's invoices and balance. If not set at * creation time, will be set at subscription creation time. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: String) = apply { body.currency(currency) } /** A valid customer email, to be used for invoicing and notifications. */ - fun email(email: String) = apply { this.email = email } + fun email(email: String) = apply { body.email(email) } - fun emailDelivery(emailDelivery: Boolean) = apply { this.emailDelivery = emailDelivery } + fun emailDelivery(emailDelivery: Boolean) = apply { body.emailDelivery(emailDelivery) } /** * The external customer ID. This can only be set if empty and the customer has no past or * current subscriptions. */ fun externalCustomerId(externalCustomerId: String) = apply { - this.externalCustomerId = externalCustomerId + body.externalCustomerId(externalCustomerId) } /** @@ -771,10 +860,10 @@ constructor( * setting the value to `null`, and the entire metadata mapping can be cleared by setting * `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata) = apply { body.metadata(metadata) } /** The full name of the customer */ - fun name(name: String) = apply { this.name = name } + fun name(name: String) = apply { body.name(name) } /** * This is used for creating charges or invoices in an external system via Orb. When not in @@ -784,7 +873,7 @@ constructor( * `netsuite`), any product mappings must first be configured with the Orb team. */ fun paymentProvider(paymentProvider: PaymentProvider) = apply { - this.paymentProvider = paymentProvider + body.paymentProvider(paymentProvider) } /** @@ -792,32 +881,28 @@ constructor( * for creating charges or invoices in the external system via Orb. */ fun paymentProviderId(paymentProviderId: String) = apply { - this.paymentProviderId = paymentProviderId + body.paymentProviderId(paymentProviderId) } fun reportingConfiguration(reportingConfiguration: ReportingConfiguration) = apply { - this.reportingConfiguration = reportingConfiguration + body.reportingConfiguration(reportingConfiguration) } fun shippingAddress(shippingAddress: ShippingAddress) = apply { - this.shippingAddress = shippingAddress + body.shippingAddress(shippingAddress) } fun taxConfiguration(taxConfiguration: TaxConfiguration) = apply { - this.taxConfiguration = taxConfiguration + body.taxConfiguration(taxConfiguration) } fun taxConfiguration( newAvalaraTaxConfiguration: TaxConfiguration.NewAvalaraTaxConfiguration - ) = apply { - this.taxConfiguration = - TaxConfiguration.ofNewAvalaraTaxConfiguration(newAvalaraTaxConfiguration) - } + ) = apply { body.taxConfiguration(newAvalaraTaxConfiguration) } fun taxConfiguration(newTaxJarConfiguration: TaxConfiguration.NewTaxJarConfiguration) = apply { - this.taxConfiguration = - TaxConfiguration.ofNewTaxJarConfiguration(newTaxJarConfiguration) + body.taxConfiguration(newTaxJarConfiguration) } /** @@ -926,7 +1011,7 @@ constructor( * |Venezuela |`ve_rif` |Venezuelan RIF Number | * |Vietnam |`vn_tin` |Vietnamese Tax ID Number | */ - fun taxId(taxId: TaxId) = apply { this.taxId = taxId } + fun taxId(taxId: TaxId) = apply { body.taxId(taxId) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -1027,49 +1112,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): CustomerUpdateByExternalIdParams = CustomerUpdateByExternalIdParams( checkNotNull(id) { "`id` is required but was not set" }, - accountingSyncConfiguration, - additionalEmails.toImmutable().ifEmpty { null }, - autoCollection, - billingAddress, - currency, - email, - emailDelivery, - externalCustomerId, - metadata, - name, - paymentProvider, - paymentProviderId, - reportingConfiguration, - shippingAddress, - taxConfiguration, - taxId, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -1104,7 +1170,7 @@ constructor( class Builder { private var excluded: Boolean? = null - private var accountingProviders: List? = null + private var accountingProviders: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -1119,7 +1185,12 @@ constructor( fun excluded(excluded: Boolean) = apply { this.excluded = excluded } fun accountingProviders(accountingProviders: List) = apply { - this.accountingProviders = accountingProviders + this.accountingProviders = accountingProviders.toMutableList() + } + + fun addAccountingProvider(accountingProvider: AccountingProvider) = apply { + accountingProviders = + (accountingProviders ?: mutableListOf()).apply { add(accountingProvider) } } fun additionalProperties(additionalProperties: Map) = apply { @@ -3338,11 +3409,11 @@ constructor( return true } - return /* spotless:off */ other is CustomerUpdateByExternalIdParams && id == other.id && accountingSyncConfiguration == other.accountingSyncConfiguration && additionalEmails == other.additionalEmails && autoCollection == other.autoCollection && billingAddress == other.billingAddress && currency == other.currency && email == other.email && emailDelivery == other.emailDelivery && externalCustomerId == other.externalCustomerId && metadata == other.metadata && name == other.name && paymentProvider == other.paymentProvider && paymentProviderId == other.paymentProviderId && reportingConfiguration == other.reportingConfiguration && shippingAddress == other.shippingAddress && taxConfiguration == other.taxConfiguration && taxId == other.taxId && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is CustomerUpdateByExternalIdParams && id == other.id && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(id, accountingSyncConfiguration, additionalEmails, autoCollection, billingAddress, currency, email, emailDelivery, externalCustomerId, metadata, name, paymentProvider, paymentProviderId, reportingConfiguration, shippingAddress, taxConfiguration, taxId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(id, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "CustomerUpdateByExternalIdParams{id=$id, accountingSyncConfiguration=$accountingSyncConfiguration, additionalEmails=$additionalEmails, autoCollection=$autoCollection, billingAddress=$billingAddress, currency=$currency, email=$email, emailDelivery=$emailDelivery, externalCustomerId=$externalCustomerId, metadata=$metadata, name=$name, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, reportingConfiguration=$reportingConfiguration, shippingAddress=$shippingAddress, taxConfiguration=$taxConfiguration, taxId=$taxId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "CustomerUpdateByExternalIdParams{id=$id, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt index d23393c5..38ce659d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt @@ -33,91 +33,194 @@ import kotlin.jvm.optionals.getOrNull class CustomerUpdateParams constructor( private val customerId: String, - private val accountingSyncConfiguration: AccountingSyncConfiguration?, - private val additionalEmails: List?, - private val autoCollection: Boolean?, - private val billingAddress: BillingAddress?, - private val currency: String?, - private val email: String?, - private val emailDelivery: Boolean?, - private val externalCustomerId: String?, - private val metadata: Metadata?, - private val name: String?, - private val paymentProvider: PaymentProvider?, - private val paymentProviderId: String?, - private val reportingConfiguration: ReportingConfiguration?, - private val shippingAddress: ShippingAddress?, - private val taxConfiguration: TaxConfiguration?, - private val taxId: TaxId?, + private val body: CustomerUpdateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun customerId(): String = customerId fun accountingSyncConfiguration(): Optional = - Optional.ofNullable(accountingSyncConfiguration) + body.accountingSyncConfiguration() - fun additionalEmails(): Optional> = Optional.ofNullable(additionalEmails) + /** + * Additional email addresses for this customer. If populated, these email addresses will be + * CC'd for customer communications. + */ + fun additionalEmails(): Optional> = body.additionalEmails() - fun autoCollection(): Optional = Optional.ofNullable(autoCollection) + /** + * Used to determine if invoices for this customer will automatically attempt to charge a saved + * payment method, if available. This parameter defaults to `True` when a payment provider is + * provided on customer creation. + */ + fun autoCollection(): Optional = body.autoCollection() - fun billingAddress(): Optional = Optional.ofNullable(billingAddress) + fun billingAddress(): Optional = body.billingAddress() - fun currency(): Optional = Optional.ofNullable(currency) + /** + * An ISO 4217 currency string used for the customer's invoices and balance. If not set at + * creation time, will be set at subscription creation time. + */ + fun currency(): Optional = body.currency() - fun email(): Optional = Optional.ofNullable(email) + /** A valid customer email, to be used for invoicing and notifications. */ + fun email(): Optional = body.email() - fun emailDelivery(): Optional = Optional.ofNullable(emailDelivery) + fun emailDelivery(): Optional = body.emailDelivery() - fun externalCustomerId(): Optional = Optional.ofNullable(externalCustomerId) + /** + * The external customer ID. This can only be set if empty and the customer has no past or + * current subscriptions. + */ + fun externalCustomerId(): Optional = body.externalCustomerId() - fun metadata(): Optional = Optional.ofNullable(metadata) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by setting + * the value to `null`, and the entire metadata mapping can be cleared by setting `metadata` to + * `null`. + */ + fun metadata(): Optional = body.metadata() - fun name(): Optional = Optional.ofNullable(name) + /** The full name of the customer */ + fun name(): Optional = body.name() - fun paymentProvider(): Optional = Optional.ofNullable(paymentProvider) + /** + * This is used for creating charges or invoices in an external system via Orb. When not in test + * mode: + * - the connection must first be configured in the Orb webapp. + * - if the provider is an invoicing provider (`stripe_invoice`, `quickbooks`, `bill.com`, + * `netsuite`), any product mappings must first be configured with the Orb team. + */ + fun paymentProvider(): Optional = body.paymentProvider() - fun paymentProviderId(): Optional = Optional.ofNullable(paymentProviderId) + /** + * The ID of this customer in an external payments solution, such as Stripe. This is used for + * creating charges or invoices in the external system via Orb. + */ + fun paymentProviderId(): Optional = body.paymentProviderId() - fun reportingConfiguration(): Optional = - Optional.ofNullable(reportingConfiguration) + fun reportingConfiguration(): Optional = body.reportingConfiguration() - fun shippingAddress(): Optional = Optional.ofNullable(shippingAddress) + fun shippingAddress(): Optional = body.shippingAddress() - fun taxConfiguration(): Optional = Optional.ofNullable(taxConfiguration) + fun taxConfiguration(): Optional = body.taxConfiguration() - fun taxId(): Optional = Optional.ofNullable(taxId) + /** + * Tax IDs are commonly required to be displayed on customer invoices, which are added to the + * headers of invoices. + * + * ### Supported Tax ID Countries and Types + * |Country |Type |Description | + * |--------------------|------------|-------------------------------------------------------------------------------------------------------| + * |Andorra |`ad_nrt` |Andorran NRT Number | + * |Argentina |`ar_cuit` |Argentinian Tax ID Number | + * |Australia |`au_abn` |Australian Business Number (AU ABN) | + * |Australia |`au_arn` |Australian Taxation Office Reference Number | + * |Austria |`eu_vat` |European VAT Number | + * |Bahrain |`bh_vat` |Bahraini VAT Number | + * |Belgium |`eu_vat` |European VAT Number | + * |Bolivia |`bo_tin` |Bolivian Tax ID | + * |Brazil |`br_cnpj` |Brazilian CNPJ Number | + * |Brazil |`br_cpf` |Brazilian CPF Number | + * |Bulgaria |`bg_uic` |Bulgaria Unified Identification Code | + * |Bulgaria |`eu_vat` |European VAT Number | + * |Canada |`ca_bn` |Canadian BN | + * |Canada |`ca_gst_hst`|Canadian GST/HST Number | + * |Canada |`ca_pst_bc` |Canadian PST Number (British Columbia) | + * |Canada |`ca_pst_mb` |Canadian PST Number (Manitoba) | + * |Canada |`ca_pst_sk` |Canadian PST Number (Saskatchewan) | + * |Canada |`ca_qst` |Canadian QST Number (Québec) | + * |Chile |`cl_tin` |Chilean TIN | + * |China |`cn_tin` |Chinese Tax ID | + * |Colombia |`co_nit` |Colombian NIT Number | + * |Costa Rica |`cr_tin` |Costa Rican Tax ID | + * |Croatia |`eu_vat` |European VAT Number | + * |Cyprus |`eu_vat` |European VAT Number | + * |Czech Republic |`eu_vat` |European VAT Number | + * |Denmark |`eu_vat` |European VAT Number | + * |Dominican Republic |`do_rcn` |Dominican RCN Number | + * |Ecuador |`ec_ruc` |Ecuadorian RUC Number | + * |Egypt |`eg_tin` |Egyptian Tax Identification Number | + * |El Salvador |`sv_nit` |El Salvadorian NIT Number | + * |Estonia |`eu_vat` |European VAT Number | + * |EU |`eu_oss_vat`|European One Stop Shop VAT Number for non-Union scheme | + * |Finland |`eu_vat` |European VAT Number | + * |France |`eu_vat` |European VAT Number | + * |Georgia |`ge_vat` |Georgian VAT | + * |Germany |`eu_vat` |European VAT Number | + * |Greece |`eu_vat` |European VAT Number | + * |Hong Kong |`hk_br` |Hong Kong BR Number | + * |Hungary |`eu_vat` |European VAT Number | + * |Hungary |`hu_tin` |Hungary Tax Number (adószám) | + * |Iceland |`is_vat` |Icelandic VAT | + * |India |`in_gst` |Indian GST Number | + * |Indonesia |`id_npwp` |Indonesian NPWP Number | + * |Ireland |`eu_vat` |European VAT Number | + * |Israel |`il_vat` |Israel VAT | + * |Italy |`eu_vat` |European VAT Number | + * |Japan |`jp_cn` |Japanese Corporate Number (_Hōjin Bangō_) | + * |Japan |`jp_rn` |Japanese Registered Foreign Businesses' Registration Number (_Tōroku Kokugai Jigyōsha no Tōroku Bangō_)| + * |Japan |`jp_trn` |Japanese Tax Registration Number (_Tōroku Bangō_) | + * |Kazakhstan |`kz_bin` |Kazakhstani Business Identification Number | + * |Kenya |`ke_pin` |Kenya Revenue Authority Personal Identification Number | + * |Latvia |`eu_vat` |European VAT Number | + * |Liechtenstein |`li_uid` |Liechtensteinian UID Number | + * |Lithuania |`eu_vat` |European VAT Number | + * |Luxembourg |`eu_vat` |European VAT Number | + * |Malaysia |`my_frp` |Malaysian FRP Number | + * |Malaysia |`my_itn` |Malaysian ITN | + * |Malaysia |`my_sst` |Malaysian SST Number | + * |Malta |`eu_vat ` |European VAT Number | + * |Mexico |`mx_rfc` |Mexican RFC Number | + * |Netherlands |`eu_vat` |European VAT Number | + * |New Zealand |`nz_gst` |New Zealand GST Number | + * |Nigeria |`ng_tin` |Nigerian Tax Identification Number | + * |Norway |`no_vat` |Norwegian VAT Number | + * |Norway |`no_voec` |Norwegian VAT on e-commerce Number | + * |Oman |`om_vat` |Omani VAT Number | + * |Peru |`pe_ruc` |Peruvian RUC Number | + * |Philippines |`ph_tin ` |Philippines Tax Identification Number | + * |Poland |`eu_vat` |European VAT Number | + * |Portugal |`eu_vat` |European VAT Number | + * |Romania |`eu_vat` |European VAT Number | + * |Romania |`ro_tin` |Romanian Tax ID Number | + * |Russia |`ru_inn` |Russian INN | + * |Russia |`ru_kpp` |Russian KPP | + * |Saudi Arabia |`sa_vat` |Saudi Arabia VAT | + * |Serbia |`rs_pib` |Serbian PIB Number | + * |Singapore |`sg_gst` |Singaporean GST | + * |Singapore |`sg_uen` |Singaporean UEN | + * |Slovakia |`eu_vat` |European VAT Number | + * |Slovenia |`eu_vat` |European VAT Number | + * |Slovenia |`si_tin` |Slovenia Tax Number (davčna številka) | + * |South Africa |`za_vat` |South African VAT Number | + * |South Korea |`kr_brn` |Korean BRN | + * |Spain |`es_cif` |Spanish NIF Number (previously Spanish CIF Number) | + * |Spain |`eu_vat` |European VAT Number | + * |Sweden |`eu_vat` |European VAT Number | + * |Switzerland |`ch_vat` |Switzerland VAT Number | + * |Taiwan |`tw_vat` |Taiwanese VAT | + * |Thailand |`th_vat` |Thai VAT | + * |Turkey |`tr_tin` |Turkish Tax Identification Number | + * |Ukraine |`ua_vat` |Ukrainian VAT | + * |United Arab Emirates|`ae_trn` |United Arab Emirates TRN | + * |United Kingdom |`eu_vat` |Northern Ireland VAT Number | + * |United Kingdom |`gb_vat` |United Kingdom VAT Number | + * |United States |`us_ein` |United States EIN | + * |Uruguay |`uy_ruc` |Uruguayan RUC Number | + * |Venezuela |`ve_rif` |Venezuelan RIF Number | + * |Vietnam |`vn_tin` |Vietnamese Tax ID Number | + */ + fun taxId(): Optional = body.taxId() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): CustomerUpdateBody { - return CustomerUpdateBody( - accountingSyncConfiguration, - additionalEmails, - autoCollection, - billingAddress, - currency, - email, - emailDelivery, - externalCustomerId, - metadata, - name, - paymentProvider, - paymentProviderId, - reportingConfiguration, - shippingAddress, - taxConfiguration, - taxId, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): CustomerUpdateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -356,7 +459,7 @@ constructor( class Builder { private var accountingSyncConfiguration: AccountingSyncConfiguration? = null - private var additionalEmails: List? = null + private var additionalEmails: MutableList? = null private var autoCollection: Boolean? = null private var billingAddress: BillingAddress? = null private var currency: String? = null @@ -403,7 +506,16 @@ constructor( * will be CC'd for customer communications. */ fun additionalEmails(additionalEmails: List) = apply { - this.additionalEmails = additionalEmails + this.additionalEmails = additionalEmails.toMutableList() + } + + /** + * Additional email addresses for this customer. If populated, these email addresses + * will be CC'd for customer communications. + */ + fun addAdditionalEmail(additionalEmail: String) = apply { + additionalEmails = + (additionalEmails ?: mutableListOf()).apply { add(additionalEmail) } } /** @@ -480,6 +592,19 @@ constructor( this.taxConfiguration = taxConfiguration } + fun taxConfiguration( + newAvalaraTaxConfiguration: TaxConfiguration.NewAvalaraTaxConfiguration + ) = apply { + this.taxConfiguration = + TaxConfiguration.ofNewAvalaraTaxConfiguration(newAvalaraTaxConfiguration) + } + + fun taxConfiguration(newTaxJarConfiguration: TaxConfiguration.NewTaxJarConfiguration) = + apply { + this.taxConfiguration = + TaxConfiguration.ofNewTaxJarConfiguration(newTaxJarConfiguration) + } + /** * Tax IDs are commonly required to be displayed on customer invoices, which are added * to the headers of invoices. @@ -658,56 +783,23 @@ constructor( class Builder { private var customerId: String? = null - private var accountingSyncConfiguration: AccountingSyncConfiguration? = null - private var additionalEmails: MutableList = mutableListOf() - private var autoCollection: Boolean? = null - private var billingAddress: BillingAddress? = null - private var currency: String? = null - private var email: String? = null - private var emailDelivery: Boolean? = null - private var externalCustomerId: String? = null - private var metadata: Metadata? = null - private var name: String? = null - private var paymentProvider: PaymentProvider? = null - private var paymentProviderId: String? = null - private var reportingConfiguration: ReportingConfiguration? = null - private var shippingAddress: ShippingAddress? = null - private var taxConfiguration: TaxConfiguration? = null - private var taxId: TaxId? = null + private var body: CustomerUpdateBody.Builder = CustomerUpdateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(customerUpdateParams: CustomerUpdateParams) = apply { customerId = customerUpdateParams.customerId - accountingSyncConfiguration = customerUpdateParams.accountingSyncConfiguration - additionalEmails = - customerUpdateParams.additionalEmails?.toMutableList() ?: mutableListOf() - autoCollection = customerUpdateParams.autoCollection - billingAddress = customerUpdateParams.billingAddress - currency = customerUpdateParams.currency - email = customerUpdateParams.email - emailDelivery = customerUpdateParams.emailDelivery - externalCustomerId = customerUpdateParams.externalCustomerId - metadata = customerUpdateParams.metadata - name = customerUpdateParams.name - paymentProvider = customerUpdateParams.paymentProvider - paymentProviderId = customerUpdateParams.paymentProviderId - reportingConfiguration = customerUpdateParams.reportingConfiguration - shippingAddress = customerUpdateParams.shippingAddress - taxConfiguration = customerUpdateParams.taxConfiguration - taxId = customerUpdateParams.taxId + body = customerUpdateParams.body.toBuilder() additionalHeaders = customerUpdateParams.additionalHeaders.toBuilder() additionalQueryParams = customerUpdateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = customerUpdateParams.additionalBodyProperties.toMutableMap() } fun customerId(customerId: String) = apply { this.customerId = customerId } fun accountingSyncConfiguration(accountingSyncConfiguration: AccountingSyncConfiguration) = apply { - this.accountingSyncConfiguration = accountingSyncConfiguration + body.accountingSyncConfiguration(accountingSyncConfiguration) } /** @@ -715,8 +807,7 @@ constructor( * CC'd for customer communications. */ fun additionalEmails(additionalEmails: List) = apply { - this.additionalEmails.clear() - this.additionalEmails.addAll(additionalEmails) + body.additionalEmails(additionalEmails) } /** @@ -724,7 +815,7 @@ constructor( * CC'd for customer communications. */ fun addAdditionalEmail(additionalEmail: String) = apply { - this.additionalEmails.add(additionalEmail) + body.addAdditionalEmail(additionalEmail) } /** @@ -732,29 +823,29 @@ constructor( * saved payment method, if available. This parameter defaults to `True` when a payment * provider is provided on customer creation. */ - fun autoCollection(autoCollection: Boolean) = apply { this.autoCollection = autoCollection } + fun autoCollection(autoCollection: Boolean) = apply { body.autoCollection(autoCollection) } fun billingAddress(billingAddress: BillingAddress) = apply { - this.billingAddress = billingAddress + body.billingAddress(billingAddress) } /** * An ISO 4217 currency string used for the customer's invoices and balance. If not set at * creation time, will be set at subscription creation time. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: String) = apply { body.currency(currency) } /** A valid customer email, to be used for invoicing and notifications. */ - fun email(email: String) = apply { this.email = email } + fun email(email: String) = apply { body.email(email) } - fun emailDelivery(emailDelivery: Boolean) = apply { this.emailDelivery = emailDelivery } + fun emailDelivery(emailDelivery: Boolean) = apply { body.emailDelivery(emailDelivery) } /** * The external customer ID. This can only be set if empty and the customer has no past or * current subscriptions. */ fun externalCustomerId(externalCustomerId: String) = apply { - this.externalCustomerId = externalCustomerId + body.externalCustomerId(externalCustomerId) } /** @@ -762,10 +853,10 @@ constructor( * setting the value to `null`, and the entire metadata mapping can be cleared by setting * `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata) = apply { body.metadata(metadata) } /** The full name of the customer */ - fun name(name: String) = apply { this.name = name } + fun name(name: String) = apply { body.name(name) } /** * This is used for creating charges or invoices in an external system via Orb. When not in @@ -775,7 +866,7 @@ constructor( * `netsuite`), any product mappings must first be configured with the Orb team. */ fun paymentProvider(paymentProvider: PaymentProvider) = apply { - this.paymentProvider = paymentProvider + body.paymentProvider(paymentProvider) } /** @@ -783,32 +874,28 @@ constructor( * for creating charges or invoices in the external system via Orb. */ fun paymentProviderId(paymentProviderId: String) = apply { - this.paymentProviderId = paymentProviderId + body.paymentProviderId(paymentProviderId) } fun reportingConfiguration(reportingConfiguration: ReportingConfiguration) = apply { - this.reportingConfiguration = reportingConfiguration + body.reportingConfiguration(reportingConfiguration) } fun shippingAddress(shippingAddress: ShippingAddress) = apply { - this.shippingAddress = shippingAddress + body.shippingAddress(shippingAddress) } fun taxConfiguration(taxConfiguration: TaxConfiguration) = apply { - this.taxConfiguration = taxConfiguration + body.taxConfiguration(taxConfiguration) } fun taxConfiguration( newAvalaraTaxConfiguration: TaxConfiguration.NewAvalaraTaxConfiguration - ) = apply { - this.taxConfiguration = - TaxConfiguration.ofNewAvalaraTaxConfiguration(newAvalaraTaxConfiguration) - } + ) = apply { body.taxConfiguration(newAvalaraTaxConfiguration) } fun taxConfiguration(newTaxJarConfiguration: TaxConfiguration.NewTaxJarConfiguration) = apply { - this.taxConfiguration = - TaxConfiguration.ofNewTaxJarConfiguration(newTaxJarConfiguration) + body.taxConfiguration(newTaxJarConfiguration) } /** @@ -917,7 +1004,7 @@ constructor( * |Venezuela |`ve_rif` |Venezuelan RIF Number | * |Vietnam |`vn_tin` |Vietnamese Tax ID Number | */ - fun taxId(taxId: TaxId) = apply { this.taxId = taxId } + fun taxId(taxId: TaxId) = apply { body.taxId(taxId) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -1018,49 +1105,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): CustomerUpdateParams = CustomerUpdateParams( checkNotNull(customerId) { "`customerId` is required but was not set" }, - accountingSyncConfiguration, - additionalEmails.toImmutable().ifEmpty { null }, - autoCollection, - billingAddress, - currency, - email, - emailDelivery, - externalCustomerId, - metadata, - name, - paymentProvider, - paymentProviderId, - reportingConfiguration, - shippingAddress, - taxConfiguration, - taxId, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -1095,7 +1163,7 @@ constructor( class Builder { private var excluded: Boolean? = null - private var accountingProviders: List? = null + private var accountingProviders: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -1110,7 +1178,12 @@ constructor( fun excluded(excluded: Boolean) = apply { this.excluded = excluded } fun accountingProviders(accountingProviders: List) = apply { - this.accountingProviders = accountingProviders + this.accountingProviders = accountingProviders.toMutableList() + } + + fun addAccountingProvider(accountingProvider: AccountingProvider) = apply { + accountingProviders = + (accountingProviders ?: mutableListOf()).apply { add(accountingProvider) } } fun additionalProperties(additionalProperties: Map) = apply { @@ -3329,11 +3402,11 @@ constructor( return true } - return /* spotless:off */ other is CustomerUpdateParams && customerId == other.customerId && accountingSyncConfiguration == other.accountingSyncConfiguration && additionalEmails == other.additionalEmails && autoCollection == other.autoCollection && billingAddress == other.billingAddress && currency == other.currency && email == other.email && emailDelivery == other.emailDelivery && externalCustomerId == other.externalCustomerId && metadata == other.metadata && name == other.name && paymentProvider == other.paymentProvider && paymentProviderId == other.paymentProviderId && reportingConfiguration == other.reportingConfiguration && shippingAddress == other.shippingAddress && taxConfiguration == other.taxConfiguration && taxId == other.taxId && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is CustomerUpdateParams && customerId == other.customerId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(customerId, accountingSyncConfiguration, additionalEmails, autoCollection, billingAddress, currency, email, emailDelivery, externalCustomerId, metadata, name, paymentProvider, paymentProviderId, reportingConfiguration, shippingAddress, taxConfiguration, taxId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(customerId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "CustomerUpdateParams{customerId=$customerId, accountingSyncConfiguration=$accountingSyncConfiguration, additionalEmails=$additionalEmails, autoCollection=$autoCollection, billingAddress=$billingAddress, currency=$currency, email=$email, emailDelivery=$emailDelivery, externalCustomerId=$externalCustomerId, metadata=$metadata, name=$name, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, reportingConfiguration=$reportingConfiguration, shippingAddress=$shippingAddress, taxConfiguration=$taxConfiguration, taxId=$taxId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "CustomerUpdateParams{customerId=$customerId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupCreateParams.kt index 82f66d03..2905fbdd 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupCreateParams.kt @@ -18,44 +18,34 @@ import java.util.Optional class DimensionalPriceGroupCreateParams constructor( - private val billableMetricId: String, - private val dimensions: List, - private val name: String, - private val externalDimensionalPriceGroupId: String?, - private val metadata: Metadata?, + private val body: DimensionalPriceGroupCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun billableMetricId(): String = billableMetricId + fun billableMetricId(): String = body.billableMetricId() - fun dimensions(): List = dimensions + /** The set of keys (in order) used to disambiguate prices in the group. */ + fun dimensions(): List = body.dimensions() - fun name(): String = name + fun name(): String = body.name() - fun externalDimensionalPriceGroupId(): Optional = - Optional.ofNullable(externalDimensionalPriceGroupId) + fun externalDimensionalPriceGroupId(): Optional = body.externalDimensionalPriceGroupId() - fun metadata(): Optional = Optional.ofNullable(metadata) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by setting + * the value to `null`, and the entire metadata mapping can be cleared by setting `metadata` to + * `null`. + */ + fun metadata(): Optional = body.metadata() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): DimensionalPriceGroupCreateBody { - return DimensionalPriceGroupCreateBody( - billableMetricId, - dimensions, - name, - externalDimensionalPriceGroupId, - metadata, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): DimensionalPriceGroupCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -107,7 +97,7 @@ constructor( class Builder { private var billableMetricId: String? = null - private var dimensions: List? = null + private var dimensions: MutableList? = null private var name: String? = null private var externalDimensionalPriceGroupId: String? = null private var metadata: Metadata? = null @@ -131,7 +121,14 @@ constructor( } /** The set of keys (in order) used to disambiguate prices in the group. */ - fun dimensions(dimensions: List) = apply { this.dimensions = dimensions } + fun dimensions(dimensions: List) = apply { + this.dimensions = dimensions.toMutableList() + } + + /** The set of keys (in order) used to disambiguate prices in the group. */ + fun addDimension(dimension: String) = apply { + dimensions = (dimensions ?: mutableListOf()).apply { add(dimension) } + } fun name(name: String) = apply { this.name = name } @@ -207,48 +204,34 @@ constructor( @NoAutoDetect class Builder { - private var billableMetricId: String? = null - private var dimensions: MutableList = mutableListOf() - private var name: String? = null - private var externalDimensionalPriceGroupId: String? = null - private var metadata: Metadata? = null + private var body: DimensionalPriceGroupCreateBody.Builder = + DimensionalPriceGroupCreateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(dimensionalPriceGroupCreateParams: DimensionalPriceGroupCreateParams) = apply { - billableMetricId = dimensionalPriceGroupCreateParams.billableMetricId - dimensions = dimensionalPriceGroupCreateParams.dimensions.toMutableList() - name = dimensionalPriceGroupCreateParams.name - externalDimensionalPriceGroupId = - dimensionalPriceGroupCreateParams.externalDimensionalPriceGroupId - metadata = dimensionalPriceGroupCreateParams.metadata + body = dimensionalPriceGroupCreateParams.body.toBuilder() additionalHeaders = dimensionalPriceGroupCreateParams.additionalHeaders.toBuilder() additionalQueryParams = dimensionalPriceGroupCreateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - dimensionalPriceGroupCreateParams.additionalBodyProperties.toMutableMap() } fun billableMetricId(billableMetricId: String) = apply { - this.billableMetricId = billableMetricId + body.billableMetricId(billableMetricId) } /** The set of keys (in order) used to disambiguate prices in the group. */ - fun dimensions(dimensions: List) = apply { - this.dimensions.clear() - this.dimensions.addAll(dimensions) - } + fun dimensions(dimensions: List) = apply { body.dimensions(dimensions) } /** The set of keys (in order) used to disambiguate prices in the group. */ - fun addDimension(dimension: String) = apply { this.dimensions.add(dimension) } + fun addDimension(dimension: String) = apply { body.addDimension(dimension) } - fun name(name: String) = apply { this.name = name } + fun name(name: String) = apply { body.name(name) } fun externalDimensionalPriceGroupId(externalDimensionalPriceGroupId: String) = apply { - this.externalDimensionalPriceGroupId = externalDimensionalPriceGroupId + body.externalDimensionalPriceGroupId(externalDimensionalPriceGroupId) } /** @@ -256,7 +239,7 @@ constructor( * setting the value to `null`, and the entire metadata mapping can be cleared by setting * `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata) = apply { body.metadata(metadata) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -357,37 +340,29 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): DimensionalPriceGroupCreateParams = DimensionalPriceGroupCreateParams( - checkNotNull(billableMetricId) { "`billableMetricId` is required but was not set" }, - dimensions.toImmutable(), - checkNotNull(name) { "`name` is required but was not set" }, - externalDimensionalPriceGroupId, - metadata, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -468,11 +443,11 @@ constructor( return true } - return /* spotless:off */ other is DimensionalPriceGroupCreateParams && billableMetricId == other.billableMetricId && dimensions == other.dimensions && name == other.name && externalDimensionalPriceGroupId == other.externalDimensionalPriceGroupId && metadata == other.metadata && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is DimensionalPriceGroupCreateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(billableMetricId, dimensions, name, externalDimensionalPriceGroupId, metadata, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "DimensionalPriceGroupCreateParams{billableMetricId=$billableMetricId, dimensions=$dimensions, name=$name, externalDimensionalPriceGroupId=$externalDimensionalPriceGroupId, metadata=$metadata, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "DimensionalPriceGroupCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupListParams.kt index b466ed88..29ebd53c 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupListParams.kt @@ -16,8 +16,13 @@ constructor( private val additionalQueryParams: QueryParams, ) { + /** + * Cursor for pagination. This can be populated by the `next_cursor` value returned from the + * initial request. + */ fun cursor(): Optional = Optional.ofNullable(cursor) + /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) fun _additionalHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseParams.kt index 80778002..b7032634 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseParams.kt @@ -27,9 +27,8 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties @JvmSynthetic - internal fun getBody(): Optional> { - return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - } + internal fun getBody(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt index 9e359a47..7dcddd76 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt @@ -19,51 +19,55 @@ import java.util.Optional class EventBackfillCreateParams constructor( - private val timeframeEnd: OffsetDateTime, - private val timeframeStart: OffsetDateTime, - private val closeTime: OffsetDateTime?, - private val customerId: String?, - private val deprecationFilter: String?, - private val externalCustomerId: String?, - private val replaceExistingEvents: Boolean?, + private val body: EventBackfillCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun timeframeEnd(): OffsetDateTime = timeframeEnd - - fun timeframeStart(): OffsetDateTime = timeframeStart - - fun closeTime(): Optional = Optional.ofNullable(closeTime) - - fun customerId(): Optional = Optional.ofNullable(customerId) - - fun deprecationFilter(): Optional = Optional.ofNullable(deprecationFilter) - - fun externalCustomerId(): Optional = Optional.ofNullable(externalCustomerId) - - fun replaceExistingEvents(): Optional = Optional.ofNullable(replaceExistingEvents) + /** The (exclusive) end of the usage timeframe affected by this backfill. */ + fun timeframeEnd(): OffsetDateTime = body.timeframeEnd() + + /** The (inclusive) start of the usage timeframe affected by this backfill. */ + fun timeframeStart(): OffsetDateTime = body.timeframeStart() + + /** + * The time at which no more events will be accepted for this backfill. The backfill will + * automatically begin reflecting throughout Orb at the close time. If not specified, it will + * default to 1 day after the creation of the backfill. + */ + fun closeTime(): Optional = body.closeTime() + + /** + * The Orb-generated ID of the customer to which this backfill is scoped. Omitting this field + * will scope the backfill to all customers. + */ + fun customerId(): Optional = body.customerId() + + /** + * A boolean [computed property](../guides/extensibility/advanced-metrics#computed-properties) + * used to filter the set of events to deprecate + */ + fun deprecationFilter(): Optional = body.deprecationFilter() + + /** + * The external customer ID of the customer to which this backfill is scoped. Omitting this + * field will scope the backfill to all customers. + */ + fun externalCustomerId(): Optional = body.externalCustomerId() + + /** + * If true, replaces all existing events in the timeframe with the newly ingested events. If + * false, adds the newly ingested events to the existing events. + */ + fun replaceExistingEvents(): Optional = body.replaceExistingEvents() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): EventBackfillCreateBody { - return EventBackfillCreateBody( - timeframeEnd, - timeframeStart, - closeTime, - customerId, - deprecationFilter, - externalCustomerId, - replaceExistingEvents, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): EventBackfillCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -269,38 +273,23 @@ constructor( @NoAutoDetect class Builder { - private var timeframeEnd: OffsetDateTime? = null - private var timeframeStart: OffsetDateTime? = null - private var closeTime: OffsetDateTime? = null - private var customerId: String? = null - private var deprecationFilter: String? = null - private var externalCustomerId: String? = null - private var replaceExistingEvents: Boolean? = null + private var body: EventBackfillCreateBody.Builder = EventBackfillCreateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(eventBackfillCreateParams: EventBackfillCreateParams) = apply { - timeframeEnd = eventBackfillCreateParams.timeframeEnd - timeframeStart = eventBackfillCreateParams.timeframeStart - closeTime = eventBackfillCreateParams.closeTime - customerId = eventBackfillCreateParams.customerId - deprecationFilter = eventBackfillCreateParams.deprecationFilter - externalCustomerId = eventBackfillCreateParams.externalCustomerId - replaceExistingEvents = eventBackfillCreateParams.replaceExistingEvents + body = eventBackfillCreateParams.body.toBuilder() additionalHeaders = eventBackfillCreateParams.additionalHeaders.toBuilder() additionalQueryParams = eventBackfillCreateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - eventBackfillCreateParams.additionalBodyProperties.toMutableMap() } /** The (exclusive) end of the usage timeframe affected by this backfill. */ - fun timeframeEnd(timeframeEnd: OffsetDateTime) = apply { this.timeframeEnd = timeframeEnd } + fun timeframeEnd(timeframeEnd: OffsetDateTime) = apply { body.timeframeEnd(timeframeEnd) } /** The (inclusive) start of the usage timeframe affected by this backfill. */ fun timeframeStart(timeframeStart: OffsetDateTime) = apply { - this.timeframeStart = timeframeStart + body.timeframeStart(timeframeStart) } /** @@ -308,13 +297,13 @@ constructor( * automatically begin reflecting throughout Orb at the close time. If not specified, it * will default to 1 day after the creation of the backfill. */ - fun closeTime(closeTime: OffsetDateTime) = apply { this.closeTime = closeTime } + fun closeTime(closeTime: OffsetDateTime) = apply { body.closeTime(closeTime) } /** * The Orb-generated ID of the customer to which this backfill is scoped. Omitting this * field will scope the backfill to all customers. */ - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: String) = apply { body.customerId(customerId) } /** * A boolean @@ -322,7 +311,7 @@ constructor( * filter the set of events to deprecate */ fun deprecationFilter(deprecationFilter: String) = apply { - this.deprecationFilter = deprecationFilter + body.deprecationFilter(deprecationFilter) } /** @@ -330,7 +319,7 @@ constructor( * field will scope the backfill to all customers. */ fun externalCustomerId(externalCustomerId: String) = apply { - this.externalCustomerId = externalCustomerId + body.externalCustomerId(externalCustomerId) } /** @@ -338,7 +327,7 @@ constructor( * false, adds the newly ingested events to the existing events. */ fun replaceExistingEvents(replaceExistingEvents: Boolean) = apply { - this.replaceExistingEvents = replaceExistingEvents + body.replaceExistingEvents(replaceExistingEvents) } fun additionalHeaders(additionalHeaders: Headers) = apply { @@ -440,39 +429,29 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): EventBackfillCreateParams = EventBackfillCreateParams( - checkNotNull(timeframeEnd) { "`timeframeEnd` is required but was not set" }, - checkNotNull(timeframeStart) { "`timeframeStart` is required but was not set" }, - closeTime, - customerId, - deprecationFilter, - externalCustomerId, - replaceExistingEvents, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -481,11 +460,11 @@ constructor( return true } - return /* spotless:off */ other is EventBackfillCreateParams && timeframeEnd == other.timeframeEnd && timeframeStart == other.timeframeStart && closeTime == other.closeTime && customerId == other.customerId && deprecationFilter == other.deprecationFilter && externalCustomerId == other.externalCustomerId && replaceExistingEvents == other.replaceExistingEvents && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is EventBackfillCreateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(timeframeEnd, timeframeStart, closeTime, customerId, deprecationFilter, externalCustomerId, replaceExistingEvents, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "EventBackfillCreateParams{timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, closeTime=$closeTime, customerId=$customerId, deprecationFilter=$deprecationFilter, externalCustomerId=$externalCustomerId, replaceExistingEvents=$replaceExistingEvents, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "EventBackfillCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListParams.kt index 1919fec7..c619add7 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillListParams.kt @@ -16,8 +16,13 @@ constructor( private val additionalQueryParams: QueryParams, ) { + /** + * Cursor for pagination. This can be populated by the `next_cursor` value returned from the + * initial request. + */ fun cursor(): Optional = Optional.ofNullable(cursor) + /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) fun _additionalHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertParams.kt index 6f13e254..e31bcd63 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertParams.kt @@ -27,9 +27,8 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties @JvmSynthetic - internal fun getBody(): Optional> { - return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - } + internal fun getBody(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventDeprecateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventDeprecateParams.kt index 41f08196..03248703 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventDeprecateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventDeprecateParams.kt @@ -27,9 +27,8 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties @JvmSynthetic - internal fun getBody(): Optional> { - return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - } + internal fun getBody(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventIngestParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventIngestParams.kt index 6610c6d5..91053f8d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventIngestParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventIngestParams.kt @@ -19,30 +19,31 @@ import java.util.Optional class EventIngestParams constructor( - private val events: List, private val backfillId: String?, private val debug: Boolean?, + private val body: EventIngestBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun events(): List = events - + /** + * If this ingestion request is part of a backfill, this parameter ties the ingested events to + * the backfill + */ fun backfillId(): Optional = Optional.ofNullable(backfillId) + /** Flag to enable additional debug information in the endpoint response */ fun debug(): Optional = Optional.ofNullable(debug) + fun events(): List = body.events() + fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): EventIngestBody { - return EventIngestBody(events, additionalBodyProperties) - } + @JvmSynthetic internal fun getBody(): EventIngestBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -79,7 +80,7 @@ constructor( class Builder { - private var events: List? = null + private var events: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -88,7 +89,11 @@ constructor( additionalProperties = eventIngestBody.additionalProperties.toMutableMap() } - fun events(events: List) = apply { this.events = events } + fun events(events: List) = apply { this.events = events.toMutableList() } + + fun addEvent(event: Event) = apply { + events = (events ?: mutableListOf()).apply { add(event) } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -144,30 +149,21 @@ constructor( @NoAutoDetect class Builder { - private var events: MutableList = mutableListOf() private var backfillId: String? = null private var debug: Boolean? = null + private var body: EventIngestBody.Builder = EventIngestBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(eventIngestParams: EventIngestParams) = apply { - events = eventIngestParams.events.toMutableList() backfillId = eventIngestParams.backfillId debug = eventIngestParams.debug + body = eventIngestParams.body.toBuilder() additionalHeaders = eventIngestParams.additionalHeaders.toBuilder() additionalQueryParams = eventIngestParams.additionalQueryParams.toBuilder() - additionalBodyProperties = eventIngestParams.additionalBodyProperties.toMutableMap() } - fun events(events: List) = apply { - this.events.clear() - this.events.addAll(events) - } - - fun addEvent(event: Event) = apply { this.events.add(event) } - /** * If this ingestion request is part of a backfill, this parameter ties the ingested events * to the backfill @@ -177,6 +173,10 @@ constructor( /** Flag to enable additional debug information in the endpoint response */ fun debug(debug: Boolean) = apply { this.debug = debug } + fun events(events: List) = apply { body.events(events) } + + fun addEvent(event: Event) = apply { body.addEvent(event) } + fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() putAllAdditionalHeaders(additionalHeaders) @@ -276,35 +276,31 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): EventIngestParams = EventIngestParams( - events.toImmutable(), backfillId, debug, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -474,11 +470,11 @@ constructor( return true } - return /* spotless:off */ other is EventIngestParams && events == other.events && backfillId == other.backfillId && debug == other.debug && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is EventIngestParams && backfillId == other.backfillId && debug == other.debug && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(events, backfillId, debug, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(backfillId, debug, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "EventIngestParams{events=$events, backfillId=$backfillId, debug=$debug, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "EventIngestParams{backfillId=$backfillId, debug=$debug, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchParams.kt index a1a42864..850c4e7a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventSearchParams.kt @@ -19,35 +19,37 @@ import java.util.Optional class EventSearchParams constructor( - private val eventIds: List, - private val timeframeEnd: OffsetDateTime?, - private val timeframeStart: OffsetDateTime?, + private val body: EventSearchBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun eventIds(): List = eventIds - - fun timeframeEnd(): Optional = Optional.ofNullable(timeframeEnd) - - fun timeframeStart(): Optional = Optional.ofNullable(timeframeStart) + /** + * This is an explicit array of IDs to filter by. Note that an event's ID is the idempotency_key + * that was originally used for ingestion, and this only supports events that have not been + * amended. Values in this array will be treated case sensitively. + */ + fun eventIds(): List = body.eventIds() + + /** + * The end of the timeframe, exclusive, in which to search events. If not specified, the current + * time is used. + */ + fun timeframeEnd(): Optional = body.timeframeEnd() + + /** + * The start of the timeframe, inclusive, in which to search events. If not specified, the one + * week ago is used. + */ + fun timeframeStart(): Optional = body.timeframeStart() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): EventSearchBody { - return EventSearchBody( - eventIds, - timeframeEnd, - timeframeStart, - additionalBodyProperties, - ) - } + @JvmSynthetic internal fun getBody(): EventSearchBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -98,7 +100,7 @@ constructor( class Builder { - private var eventIds: List? = null + private var eventIds: MutableList? = null private var timeframeEnd: OffsetDateTime? = null private var timeframeStart: OffsetDateTime? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -116,7 +118,18 @@ constructor( * idempotency_key that was originally used for ingestion, and this only supports events * that have not been amended. Values in this array will be treated case sensitively. */ - fun eventIds(eventIds: List) = apply { this.eventIds = eventIds } + fun eventIds(eventIds: List) = apply { + this.eventIds = eventIds.toMutableList() + } + + /** + * This is an explicit array of IDs to filter by. Note that an event's ID is the + * idempotency_key that was originally used for ingestion, and this only supports events + * that have not been amended. Values in this array will be treated case sensitively. + */ + fun addEventId(eventId: String) = apply { + eventIds = (eventIds ?: mutableListOf()).apply { add(eventId) } + } /** * The end of the timeframe, exclusive, in which to search events. If not specified, the @@ -191,21 +204,15 @@ constructor( @NoAutoDetect class Builder { - private var eventIds: MutableList = mutableListOf() - private var timeframeEnd: OffsetDateTime? = null - private var timeframeStart: OffsetDateTime? = null + private var body: EventSearchBody.Builder = EventSearchBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(eventSearchParams: EventSearchParams) = apply { - eventIds = eventSearchParams.eventIds.toMutableList() - timeframeEnd = eventSearchParams.timeframeEnd - timeframeStart = eventSearchParams.timeframeStart + body = eventSearchParams.body.toBuilder() additionalHeaders = eventSearchParams.additionalHeaders.toBuilder() additionalQueryParams = eventSearchParams.additionalQueryParams.toBuilder() - additionalBodyProperties = eventSearchParams.additionalBodyProperties.toMutableMap() } /** @@ -213,30 +220,27 @@ constructor( * idempotency_key that was originally used for ingestion, and this only supports events * that have not been amended. Values in this array will be treated case sensitively. */ - fun eventIds(eventIds: List) = apply { - this.eventIds.clear() - this.eventIds.addAll(eventIds) - } + fun eventIds(eventIds: List) = apply { body.eventIds(eventIds) } /** * This is an explicit array of IDs to filter by. Note that an event's ID is the * idempotency_key that was originally used for ingestion, and this only supports events * that have not been amended. Values in this array will be treated case sensitively. */ - fun addEventId(eventId: String) = apply { this.eventIds.add(eventId) } + fun addEventId(eventId: String) = apply { body.addEventId(eventId) } /** * The end of the timeframe, exclusive, in which to search events. If not specified, the * current time is used. */ - fun timeframeEnd(timeframeEnd: OffsetDateTime) = apply { this.timeframeEnd = timeframeEnd } + fun timeframeEnd(timeframeEnd: OffsetDateTime) = apply { body.timeframeEnd(timeframeEnd) } /** * The start of the timeframe, inclusive, in which to search events. If not specified, the * one week ago is used. */ fun timeframeStart(timeframeStart: OffsetDateTime) = apply { - this.timeframeStart = timeframeStart + body.timeframeStart(timeframeStart) } fun additionalHeaders(additionalHeaders: Headers) = apply { @@ -338,35 +342,29 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): EventSearchParams = EventSearchParams( - eventIds.toImmutable(), - timeframeEnd, - timeframeStart, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -375,11 +373,11 @@ constructor( return true } - return /* spotless:off */ other is EventSearchParams && eventIds == other.eventIds && timeframeEnd == other.timeframeEnd && timeframeStart == other.timeframeStart && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is EventSearchParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(eventIds, timeframeEnd, timeframeStart, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "EventSearchParams{eventIds=$eventIds, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "EventSearchParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventUpdateParams.kt index 316c767e..43e96ee6 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventUpdateParams.kt @@ -20,45 +20,42 @@ import java.util.Optional class EventUpdateParams constructor( private val eventId: String, - private val eventName: String, - private val properties: JsonValue, - private val timestamp: OffsetDateTime, - private val customerId: String?, - private val externalCustomerId: String?, + private val body: EventUpdateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun eventId(): String = eventId - fun eventName(): String = eventName + /** A name to meaningfully identify the action or event type. */ + fun eventName(): String = body.eventName() - fun properties(): JsonValue = properties + /** + * A dictionary of custom properties. Values in this dictionary must be numeric, boolean, or + * strings. Nested dictionaries are disallowed. + */ + fun properties(): JsonValue = body.properties() - fun timestamp(): OffsetDateTime = timestamp + /** + * An ISO 8601 format date with no timezone offset (i.e. UTC). This should represent the time + * that usage was recorded, and is particularly important to attribute usage to a given billing + * period. + */ + fun timestamp(): OffsetDateTime = body.timestamp() - fun customerId(): Optional = Optional.ofNullable(customerId) + /** The Orb Customer identifier */ + fun customerId(): Optional = body.customerId() - fun externalCustomerId(): Optional = Optional.ofNullable(externalCustomerId) + /** An alias for the Orb customer, whose mapping is specified when creating the customer */ + fun externalCustomerId(): Optional = body.externalCustomerId() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): EventUpdateBody { - return EventUpdateBody( - eventName, - properties, - timestamp, - customerId, - externalCustomerId, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): EventUpdateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -223,52 +220,42 @@ constructor( class Builder { private var eventId: String? = null - private var eventName: String? = null - private var properties: JsonValue? = null - private var timestamp: OffsetDateTime? = null - private var customerId: String? = null - private var externalCustomerId: String? = null + private var body: EventUpdateBody.Builder = EventUpdateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(eventUpdateParams: EventUpdateParams) = apply { eventId = eventUpdateParams.eventId - eventName = eventUpdateParams.eventName - properties = eventUpdateParams.properties - timestamp = eventUpdateParams.timestamp - customerId = eventUpdateParams.customerId - externalCustomerId = eventUpdateParams.externalCustomerId + body = eventUpdateParams.body.toBuilder() additionalHeaders = eventUpdateParams.additionalHeaders.toBuilder() additionalQueryParams = eventUpdateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = eventUpdateParams.additionalBodyProperties.toMutableMap() } fun eventId(eventId: String) = apply { this.eventId = eventId } /** A name to meaningfully identify the action or event type. */ - fun eventName(eventName: String) = apply { this.eventName = eventName } + fun eventName(eventName: String) = apply { body.eventName(eventName) } /** * A dictionary of custom properties. Values in this dictionary must be numeric, boolean, or * strings. Nested dictionaries are disallowed. */ - fun properties(properties: JsonValue) = apply { this.properties = properties } + fun properties(properties: JsonValue) = apply { body.properties(properties) } /** * An ISO 8601 format date with no timezone offset (i.e. UTC). This should represent the * time that usage was recorded, and is particularly important to attribute usage to a given * billing period. */ - fun timestamp(timestamp: OffsetDateTime) = apply { this.timestamp = timestamp } + fun timestamp(timestamp: OffsetDateTime) = apply { body.timestamp(timestamp) } /** The Orb Customer identifier */ - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: String) = apply { body.customerId(customerId) } /** An alias for the Orb customer, whose mapping is specified when creating the customer */ fun externalCustomerId(externalCustomerId: String) = apply { - this.externalCustomerId = externalCustomerId + body.externalCustomerId(externalCustomerId) } fun additionalHeaders(additionalHeaders: Headers) = apply { @@ -370,38 +357,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): EventUpdateParams = EventUpdateParams( checkNotNull(eventId) { "`eventId` is required but was not set" }, - checkNotNull(eventName) { "`eventName` is required but was not set" }, - checkNotNull(properties) { "`properties` is required but was not set" }, - checkNotNull(timestamp) { "`timestamp` is required but was not set" }, - customerId, - externalCustomerId, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -410,11 +389,11 @@ constructor( return true } - return /* spotless:off */ other is EventUpdateParams && eventId == other.eventId && eventName == other.eventName && properties == other.properties && timestamp == other.timestamp && customerId == other.customerId && externalCustomerId == other.externalCustomerId && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is EventUpdateParams && eventId == other.eventId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(eventId, eventName, properties, timestamp, customerId, externalCustomerId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(eventId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "EventUpdateParams{eventId=$eventId, eventName=$eventName, properties=$properties, timestamp=$timestamp, customerId=$customerId, externalCustomerId=$externalCustomerId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "EventUpdateParams{eventId=$eventId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumeListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumeListParams.kt index afb0cf71..deca0143 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumeListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventVolumeListParams.kt @@ -20,12 +20,28 @@ constructor( private val additionalQueryParams: QueryParams, ) { + /** + * The start of the timeframe, inclusive, in which to return event volume. All datetime values + * are converted to UTC time. If the specified time isn't hour-aligned, the response includes + * the event volume count for the hour the time falls in. + */ fun timeframeStart(): OffsetDateTime = timeframeStart + /** + * Cursor for pagination. This can be populated by the `next_cursor` value returned from the + * initial request. + */ fun cursor(): Optional = Optional.ofNullable(cursor) + /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) + /** + * The end of the timeframe, exclusive, in which to return event volume. If not specified, the + * current time is used. All datetime values are converted to UTC time.If the specified time + * isn't hour-aligned, the response includes the event volumecount for the hour the time falls + * in. + */ fun timeframeEnd(): Optional = Optional.ofNullable(timeframeEnd) fun _additionalHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceCreateParams.kt index 3685b93c..afc2b4e0 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceCreateParams.kt @@ -23,63 +23,67 @@ import java.util.Optional class InvoiceCreateParams constructor( - private val currency: String, - private val invoiceDate: OffsetDateTime, - private val lineItems: List, - private val netTerms: Long, - private val customerId: String?, - private val discount: Discount?, - private val externalCustomerId: String?, - private val memo: String?, - private val metadata: Metadata?, - private val willAutoIssue: Boolean?, + private val body: InvoiceCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun currency(): String = currency + /** An ISO 4217 currency string. Must be the same as the customer's currency if it is set. */ + fun currency(): String = body.currency() - fun invoiceDate(): OffsetDateTime = invoiceDate + /** + * Optional invoice date to set. Must be in the past, if not set, `invoice_date` is set to the + * current time in the customer's timezone. + */ + fun invoiceDate(): OffsetDateTime = body.invoiceDate() - fun lineItems(): List = lineItems + fun lineItems(): List = body.lineItems() - fun netTerms(): Long = netTerms + /** + * Determines the difference between the invoice issue date for subscription invoices as the + * date that they are due. A value of '0' here represents that the invoice is due on issue, + * whereas a value of 30 represents that the customer has 30 days to pay the invoice. + */ + fun netTerms(): Long = body.netTerms() - fun customerId(): Optional = Optional.ofNullable(customerId) + /** + * The id of the `Customer` to create this invoice for. One of `customer_id` and + * `external_customer_id` are required. + */ + fun customerId(): Optional = body.customerId() - fun discount(): Optional = Optional.ofNullable(discount) + /** An optional discount to attach to the invoice. */ + fun discount(): Optional = body.discount() - fun externalCustomerId(): Optional = Optional.ofNullable(externalCustomerId) + /** + * The `external_customer_id` of the `Customer` to create this invoice for. One of `customer_id` + * and `external_customer_id` are required. + */ + fun externalCustomerId(): Optional = body.externalCustomerId() - fun memo(): Optional = Optional.ofNullable(memo) + /** An optional memo to attach to the invoice. */ + fun memo(): Optional = body.memo() - fun metadata(): Optional = Optional.ofNullable(metadata) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by setting + * the value to `null`, and the entire metadata mapping can be cleared by setting `metadata` to + * `null`. + */ + fun metadata(): Optional = body.metadata() - fun willAutoIssue(): Optional = Optional.ofNullable(willAutoIssue) + /** + * When true, this invoice will automatically be issued upon creation. When false, the resulting + * invoice will require manual review to issue. Defaulted to false. + */ + fun willAutoIssue(): Optional = body.willAutoIssue() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): InvoiceCreateBody { - return InvoiceCreateBody( - currency, - invoiceDate, - lineItems, - netTerms, - customerId, - discount, - externalCustomerId, - memo, - metadata, - willAutoIssue, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): InvoiceCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -172,7 +176,7 @@ constructor( private var currency: String? = null private var invoiceDate: OffsetDateTime? = null - private var lineItems: List? = null + private var lineItems: MutableList? = null private var netTerms: Long? = null private var customerId: String? = null private var discount: Discount? = null @@ -209,7 +213,13 @@ constructor( */ fun invoiceDate(invoiceDate: OffsetDateTime) = apply { this.invoiceDate = invoiceDate } - fun lineItems(lineItems: List) = apply { this.lineItems = lineItems } + fun lineItems(lineItems: List) = apply { + this.lineItems = lineItems.toMutableList() + } + + fun addLineItem(lineItem: LineItem) = apply { + lineItems = (lineItems ?: mutableListOf()).apply { add(lineItem) } + } /** * Determines the difference between the invoice issue date for subscription invoices as @@ -228,6 +238,22 @@ constructor( /** An optional discount to attach to the invoice. */ fun discount(discount: Discount) = apply { this.discount = discount } + fun discount(percentageDiscount: PercentageDiscount) = apply { + this.discount = Discount.ofPercentageDiscount(percentageDiscount) + } + + fun discount(trialDiscount: TrialDiscount) = apply { + this.discount = Discount.ofTrialDiscount(trialDiscount) + } + + fun discount(usageDiscount: Discount.UsageDiscount) = apply { + this.discount = Discount.ofUsageDiscount(usageDiscount) + } + + fun discount(amountDiscount: AmountDiscount) = apply { + this.discount = Discount.ofAmountDiscount(amountDiscount) + } + /** * The `external_customer_id` of the `Customer` to create this invoice for. One of * `customer_id` and `external_customer_id` are required. @@ -316,114 +342,81 @@ constructor( @NoAutoDetect class Builder { - private var currency: String? = null - private var invoiceDate: OffsetDateTime? = null - private var lineItems: MutableList = mutableListOf() - private var netTerms: Long? = null - private var customerId: String? = null - private var discount: Discount? = null - private var externalCustomerId: String? = null - private var memo: String? = null - private var metadata: Metadata? = null - private var willAutoIssue: Boolean? = null + private var body: InvoiceCreateBody.Builder = InvoiceCreateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(invoiceCreateParams: InvoiceCreateParams) = apply { - currency = invoiceCreateParams.currency - invoiceDate = invoiceCreateParams.invoiceDate - lineItems = invoiceCreateParams.lineItems.toMutableList() - netTerms = invoiceCreateParams.netTerms - customerId = invoiceCreateParams.customerId - discount = invoiceCreateParams.discount - externalCustomerId = invoiceCreateParams.externalCustomerId - memo = invoiceCreateParams.memo - metadata = invoiceCreateParams.metadata - willAutoIssue = invoiceCreateParams.willAutoIssue + body = invoiceCreateParams.body.toBuilder() additionalHeaders = invoiceCreateParams.additionalHeaders.toBuilder() additionalQueryParams = invoiceCreateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = invoiceCreateParams.additionalBodyProperties.toMutableMap() } /** * An ISO 4217 currency string. Must be the same as the customer's currency if it is set. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: String) = apply { body.currency(currency) } /** * Optional invoice date to set. Must be in the past, if not set, `invoice_date` is set to * the current time in the customer's timezone. */ - fun invoiceDate(invoiceDate: OffsetDateTime) = apply { this.invoiceDate = invoiceDate } + fun invoiceDate(invoiceDate: OffsetDateTime) = apply { body.invoiceDate(invoiceDate) } - fun lineItems(lineItems: List) = apply { - this.lineItems.clear() - this.lineItems.addAll(lineItems) - } + fun lineItems(lineItems: List) = apply { body.lineItems(lineItems) } - fun addLineItem(lineItem: LineItem) = apply { this.lineItems.add(lineItem) } + fun addLineItem(lineItem: LineItem) = apply { body.addLineItem(lineItem) } /** * Determines the difference between the invoice issue date for subscription invoices as the * date that they are due. A value of '0' here represents that the invoice is due on issue, * whereas a value of 30 represents that the customer has 30 days to pay the invoice. */ - fun netTerms(netTerms: Long) = apply { this.netTerms = netTerms } + fun netTerms(netTerms: Long) = apply { body.netTerms(netTerms) } /** * The id of the `Customer` to create this invoice for. One of `customer_id` and * `external_customer_id` are required. */ - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: String) = apply { body.customerId(customerId) } /** An optional discount to attach to the invoice. */ - fun discount(discount: Discount) = apply { this.discount = discount } + fun discount(discount: Discount) = apply { body.discount(discount) } - /** An optional discount to attach to the invoice. */ fun discount(percentageDiscount: PercentageDiscount) = apply { - this.discount = Discount.ofPercentageDiscount(percentageDiscount) + body.discount(percentageDiscount) } - /** An optional discount to attach to the invoice. */ - fun discount(trialDiscount: TrialDiscount) = apply { - this.discount = Discount.ofTrialDiscount(trialDiscount) - } + fun discount(trialDiscount: TrialDiscount) = apply { body.discount(trialDiscount) } - /** An optional discount to attach to the invoice. */ - fun discount(usageDiscount: Discount.UsageDiscount) = apply { - this.discount = Discount.ofUsageDiscount(usageDiscount) - } + fun discount(usageDiscount: Discount.UsageDiscount) = apply { body.discount(usageDiscount) } - /** An optional discount to attach to the invoice. */ - fun discount(amountDiscount: AmountDiscount) = apply { - this.discount = Discount.ofAmountDiscount(amountDiscount) - } + fun discount(amountDiscount: AmountDiscount) = apply { body.discount(amountDiscount) } /** * The `external_customer_id` of the `Customer` to create this invoice for. One of * `customer_id` and `external_customer_id` are required. */ fun externalCustomerId(externalCustomerId: String) = apply { - this.externalCustomerId = externalCustomerId + body.externalCustomerId(externalCustomerId) } /** An optional memo to attach to the invoice. */ - fun memo(memo: String) = apply { this.memo = memo } + fun memo(memo: String) = apply { body.memo(memo) } /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by setting * `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata) = apply { body.metadata(metadata) } /** * When true, this invoice will automatically be issued upon creation. When false, the * resulting invoice will require manual review to issue. Defaulted to false. */ - fun willAutoIssue(willAutoIssue: Boolean) = apply { this.willAutoIssue = willAutoIssue } + fun willAutoIssue(willAutoIssue: Boolean) = apply { body.willAutoIssue(willAutoIssue) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -524,42 +517,29 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): InvoiceCreateParams = InvoiceCreateParams( - checkNotNull(currency) { "`currency` is required but was not set" }, - checkNotNull(invoiceDate) { "`invoiceDate` is required but was not set" }, - lineItems.toImmutable(), - checkNotNull(netTerms) { "`netTerms` is required but was not set" }, - customerId, - discount, - externalCustomerId, - memo, - metadata, - willAutoIssue, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -910,11 +890,11 @@ constructor( return true } - return /* spotless:off */ other is InvoiceCreateParams && currency == other.currency && invoiceDate == other.invoiceDate && lineItems == other.lineItems && netTerms == other.netTerms && customerId == other.customerId && discount == other.discount && externalCustomerId == other.externalCustomerId && memo == other.memo && metadata == other.metadata && willAutoIssue == other.willAutoIssue && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is InvoiceCreateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(currency, invoiceDate, lineItems, netTerms, customerId, discount, externalCustomerId, memo, metadata, willAutoIssue, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "InvoiceCreateParams{currency=$currency, invoiceDate=$invoiceDate, lineItems=$lineItems, netTerms=$netTerms, customerId=$customerId, discount=$discount, externalCustomerId=$externalCustomerId, memo=$memo, metadata=$metadata, willAutoIssue=$willAutoIssue, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "InvoiceCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceIssueParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceIssueParams.kt index e6166170..2c5e080c 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceIssueParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceIssueParams.kt @@ -19,26 +19,28 @@ import java.util.Optional class InvoiceIssueParams constructor( private val invoiceId: String, - private val synchronous: Boolean?, + private val body: InvoiceIssueBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun invoiceId(): String = invoiceId - fun synchronous(): Optional = Optional.ofNullable(synchronous) + /** + * If true, the invoice will be issued synchronously. If false, the invoice will be issued + * asynchronously. The synchronous option is only available for invoices containin no usage + * fees. If the invoice is configured to sync to an external provider, a successful response + * from this endpoint guarantees the invoice is present in the provider. + */ + fun synchronous(): Optional = body.synchronous() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): InvoiceIssueBody { - return InvoiceIssueBody(synchronous, additionalBodyProperties) - } + @JvmSynthetic internal fun getBody(): InvoiceIssueBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -152,18 +154,16 @@ constructor( class Builder { private var invoiceId: String? = null - private var synchronous: Boolean? = null + private var body: InvoiceIssueBody.Builder = InvoiceIssueBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(invoiceIssueParams: InvoiceIssueParams) = apply { invoiceId = invoiceIssueParams.invoiceId - synchronous = invoiceIssueParams.synchronous + body = invoiceIssueParams.body.toBuilder() additionalHeaders = invoiceIssueParams.additionalHeaders.toBuilder() additionalQueryParams = invoiceIssueParams.additionalQueryParams.toBuilder() - additionalBodyProperties = invoiceIssueParams.additionalBodyProperties.toMutableMap() } fun invoiceId(invoiceId: String) = apply { this.invoiceId = invoiceId } @@ -174,7 +174,7 @@ constructor( * fees. If the invoice is configured to sync to an external provider, a successful response * from this endpoint guarantees the invoice is present in the provider. */ - fun synchronous(synchronous: Boolean) = apply { this.synchronous = synchronous } + fun synchronous(synchronous: Boolean) = apply { body.synchronous(synchronous) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -275,34 +275,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): InvoiceIssueParams = InvoiceIssueParams( checkNotNull(invoiceId) { "`invoiceId` is required but was not set" }, - synchronous, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -311,11 +307,11 @@ constructor( return true } - return /* spotless:off */ other is InvoiceIssueParams && invoiceId == other.invoiceId && synchronous == other.synchronous && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is InvoiceIssueParams && invoiceId == other.invoiceId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(invoiceId, synchronous, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(invoiceId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "InvoiceIssueParams{invoiceId=$invoiceId, synchronous=$synchronous, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "InvoiceIssueParams{invoiceId=$invoiceId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateParams.kt index c319155b..a1975bec 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateParams.kt @@ -18,47 +18,39 @@ import java.util.Objects class InvoiceLineItemCreateParams constructor( - private val amount: String, - private val endDate: LocalDate, - private val invoiceId: String, - private val name: String, - private val quantity: Double, - private val startDate: LocalDate, + private val body: InvoiceLineItemCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun amount(): String = amount + /** The total amount in the invoice's currency to add to the line item. */ + fun amount(): String = body.amount() - fun endDate(): LocalDate = endDate + /** A date string to specify the line item's end date in the customer's timezone. */ + fun endDate(): LocalDate = body.endDate() - fun invoiceId(): String = invoiceId + /** The id of the Invoice to add this line item. */ + fun invoiceId(): String = body.invoiceId() - fun name(): String = name + /** + * The item name associated with this line item. If an item with the same name exists in Orb, + * that item will be associated with the line item. + */ + fun name(): String = body.name() - fun quantity(): Double = quantity + /** The number of units on the line item */ + fun quantity(): Double = body.quantity() - fun startDate(): LocalDate = startDate + /** A date string to specify the line item's start date in the customer's timezone. */ + fun startDate(): LocalDate = body.startDate() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): InvoiceLineItemCreateBody { - return InvoiceLineItemCreateBody( - amount, - endDate, - invoiceId, - name, - quantity, - startDate, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): InvoiceLineItemCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -211,50 +203,37 @@ constructor( @NoAutoDetect class Builder { - private var amount: String? = null - private var endDate: LocalDate? = null - private var invoiceId: String? = null - private var name: String? = null - private var quantity: Double? = null - private var startDate: LocalDate? = null + private var body: InvoiceLineItemCreateBody.Builder = InvoiceLineItemCreateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(invoiceLineItemCreateParams: InvoiceLineItemCreateParams) = apply { - amount = invoiceLineItemCreateParams.amount - endDate = invoiceLineItemCreateParams.endDate - invoiceId = invoiceLineItemCreateParams.invoiceId - name = invoiceLineItemCreateParams.name - quantity = invoiceLineItemCreateParams.quantity - startDate = invoiceLineItemCreateParams.startDate + body = invoiceLineItemCreateParams.body.toBuilder() additionalHeaders = invoiceLineItemCreateParams.additionalHeaders.toBuilder() additionalQueryParams = invoiceLineItemCreateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - invoiceLineItemCreateParams.additionalBodyProperties.toMutableMap() } /** The total amount in the invoice's currency to add to the line item. */ - fun amount(amount: String) = apply { this.amount = amount } + fun amount(amount: String) = apply { body.amount(amount) } /** A date string to specify the line item's end date in the customer's timezone. */ - fun endDate(endDate: LocalDate) = apply { this.endDate = endDate } + fun endDate(endDate: LocalDate) = apply { body.endDate(endDate) } /** The id of the Invoice to add this line item. */ - fun invoiceId(invoiceId: String) = apply { this.invoiceId = invoiceId } + fun invoiceId(invoiceId: String) = apply { body.invoiceId(invoiceId) } /** * The item name associated with this line item. If an item with the same name exists in * Orb, that item will be associated with the line item. */ - fun name(name: String) = apply { this.name = name } + fun name(name: String) = apply { body.name(name) } /** The number of units on the line item */ - fun quantity(quantity: Double) = apply { this.quantity = quantity } + fun quantity(quantity: Double) = apply { body.quantity(quantity) } /** A date string to specify the line item's start date in the customer's timezone. */ - fun startDate(startDate: LocalDate) = apply { this.startDate = startDate } + fun startDate(startDate: LocalDate) = apply { body.startDate(startDate) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -355,38 +334,29 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): InvoiceLineItemCreateParams = InvoiceLineItemCreateParams( - checkNotNull(amount) { "`amount` is required but was not set" }, - checkNotNull(endDate) { "`endDate` is required but was not set" }, - checkNotNull(invoiceId) { "`invoiceId` is required but was not set" }, - checkNotNull(name) { "`name` is required but was not set" }, - checkNotNull(quantity) { "`quantity` is required but was not set" }, - checkNotNull(startDate) { "`startDate` is required but was not set" }, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -395,11 +365,11 @@ constructor( return true } - return /* spotless:off */ other is InvoiceLineItemCreateParams && amount == other.amount && endDate == other.endDate && invoiceId == other.invoiceId && name == other.name && quantity == other.quantity && startDate == other.startDate && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is InvoiceLineItemCreateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(amount, endDate, invoiceId, name, quantity, startDate, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "InvoiceLineItemCreateParams{amount=$amount, endDate=$endDate, invoiceId=$invoiceId, name=$name, quantity=$quantity, startDate=$startDate, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "InvoiceLineItemCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListParams.kt index c8d09b4a..3bf0418b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceListParams.kt @@ -47,6 +47,10 @@ constructor( fun amountLt(): Optional = Optional.ofNullable(amountLt) + /** + * Cursor for pagination. This can be populated by the `next_cursor` value returned from the + * initial request. + */ fun cursor(): Optional = Optional.ofNullable(cursor) fun customerId(): Optional = Optional.ofNullable(customerId) @@ -55,6 +59,11 @@ constructor( fun dueDate(): Optional = Optional.ofNullable(dueDate) + /** + * Filters invoices by their due dates within a specific time range in the past. Specify the + * range as a number followed by 'd' (days) or 'm' (months). For example, '7d' filters invoices + * due in the last 7 days, and '2m' filters those due in the last 2 months. + */ fun dueDateWindow(): Optional = Optional.ofNullable(dueDateWindow) fun dueDateGt(): Optional = Optional.ofNullable(dueDateGt) @@ -73,6 +82,7 @@ constructor( fun isRecurring(): Optional = Optional.ofNullable(isRecurring) + /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) fun status(): Optional> = Optional.ofNullable(status) @@ -160,7 +170,7 @@ constructor( private var invoiceDateLte: OffsetDateTime? = null private var isRecurring: Boolean? = null private var limit: Long? = null - private var status: MutableList = mutableListOf() + private var status: MutableList? = null private var subscriptionId: String? = null private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -184,7 +194,7 @@ constructor( invoiceDateLte = invoiceListParams.invoiceDateLte isRecurring = invoiceListParams.isRecurring limit = invoiceListParams.limit - status = invoiceListParams.status?.toMutableList() ?: mutableListOf() + status = invoiceListParams.status?.toMutableList() subscriptionId = invoiceListParams.subscriptionId additionalHeaders = invoiceListParams.additionalHeaders.toBuilder() additionalQueryParams = invoiceListParams.additionalQueryParams.toBuilder() @@ -244,12 +254,11 @@ constructor( /** The number of items to fetch. Defaults to 20. */ fun limit(limit: Long) = apply { this.limit = limit } - fun status(status: List) = apply { - this.status.clear() - this.status.addAll(status) - } + fun status(status: List) = apply { this.status = status.toMutableList() } - fun addStatus(status: Status) = apply { this.status.add(status) } + fun addStatus(status: Status) = apply { + this.status = (this.status ?: mutableListOf()).apply { add(status) } + } fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } @@ -370,7 +379,7 @@ constructor( invoiceDateLte, isRecurring, limit, - status.toImmutable().ifEmpty { null }, + status?.toImmutable(), subscriptionId, additionalHeaders.build(), additionalQueryParams.build(), diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceMarkPaidParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceMarkPaidParams.kt index 96505c5b..47dbe840 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceMarkPaidParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceMarkPaidParams.kt @@ -20,37 +20,29 @@ import java.util.Optional class InvoiceMarkPaidParams constructor( private val invoiceId: String, - private val paymentReceivedDate: LocalDate, - private val externalId: String?, - private val notes: String?, + private val body: InvoiceMarkPaidBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun invoiceId(): String = invoiceId - fun paymentReceivedDate(): LocalDate = paymentReceivedDate + /** A date string to specify the date of the payment. */ + fun paymentReceivedDate(): LocalDate = body.paymentReceivedDate() - fun externalId(): Optional = Optional.ofNullable(externalId) + /** An optional external ID to associate with the payment. */ + fun externalId(): Optional = body.externalId() - fun notes(): Optional = Optional.ofNullable(notes) + /** An optional note to associate with the payment. */ + fun notes(): Optional = body.notes() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): InvoiceMarkPaidBody { - return InvoiceMarkPaidBody( - paymentReceivedDate, - externalId, - notes, - additionalBodyProperties, - ) - } + @JvmSynthetic internal fun getBody(): InvoiceMarkPaidBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -181,36 +173,30 @@ constructor( class Builder { private var invoiceId: String? = null - private var paymentReceivedDate: LocalDate? = null - private var externalId: String? = null - private var notes: String? = null + private var body: InvoiceMarkPaidBody.Builder = InvoiceMarkPaidBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(invoiceMarkPaidParams: InvoiceMarkPaidParams) = apply { invoiceId = invoiceMarkPaidParams.invoiceId - paymentReceivedDate = invoiceMarkPaidParams.paymentReceivedDate - externalId = invoiceMarkPaidParams.externalId - notes = invoiceMarkPaidParams.notes + body = invoiceMarkPaidParams.body.toBuilder() additionalHeaders = invoiceMarkPaidParams.additionalHeaders.toBuilder() additionalQueryParams = invoiceMarkPaidParams.additionalQueryParams.toBuilder() - additionalBodyProperties = invoiceMarkPaidParams.additionalBodyProperties.toMutableMap() } fun invoiceId(invoiceId: String) = apply { this.invoiceId = invoiceId } /** A date string to specify the date of the payment. */ fun paymentReceivedDate(paymentReceivedDate: LocalDate) = apply { - this.paymentReceivedDate = paymentReceivedDate + body.paymentReceivedDate(paymentReceivedDate) } /** An optional external ID to associate with the payment. */ - fun externalId(externalId: String) = apply { this.externalId = externalId } + fun externalId(externalId: String) = apply { body.externalId(externalId) } /** An optional note to associate with the payment. */ - fun notes(notes: String) = apply { this.notes = notes } + fun notes(notes: String) = apply { body.notes(notes) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -311,38 +297,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): InvoiceMarkPaidParams = InvoiceMarkPaidParams( checkNotNull(invoiceId) { "`invoiceId` is required but was not set" }, - checkNotNull(paymentReceivedDate) { - "`paymentReceivedDate` is required but was not set" - }, - externalId, - notes, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -351,11 +329,11 @@ constructor( return true } - return /* spotless:off */ other is InvoiceMarkPaidParams && invoiceId == other.invoiceId && paymentReceivedDate == other.paymentReceivedDate && externalId == other.externalId && notes == other.notes && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is InvoiceMarkPaidParams && invoiceId == other.invoiceId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(invoiceId, paymentReceivedDate, externalId, notes, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(invoiceId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "InvoiceMarkPaidParams{invoiceId=$invoiceId, paymentReceivedDate=$paymentReceivedDate, externalId=$externalId, notes=$notes, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "InvoiceMarkPaidParams{invoiceId=$invoiceId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoicePayParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoicePayParams.kt index 013d5693..d1d9abfd 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoicePayParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoicePayParams.kt @@ -27,9 +27,8 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties @JvmSynthetic - internal fun getBody(): Optional> { - return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - } + internal fun getBody(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceUpdateParams.kt index 46caef23..e7f6fade 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceUpdateParams.kt @@ -19,26 +19,27 @@ import java.util.Optional class InvoiceUpdateParams constructor( private val invoiceId: String, - private val metadata: Metadata?, + private val body: InvoiceUpdateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun invoiceId(): String = invoiceId - fun metadata(): Optional = Optional.ofNullable(metadata) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by setting + * the value to `null`, and the entire metadata mapping can be cleared by setting `metadata` to + * `null`. + */ + fun metadata(): Optional = body.metadata() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): InvoiceUpdateBody { - return InvoiceUpdateBody(metadata, additionalBodyProperties) - } + @JvmSynthetic internal fun getBody(): InvoiceUpdateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -148,18 +149,16 @@ constructor( class Builder { private var invoiceId: String? = null - private var metadata: Metadata? = null + private var body: InvoiceUpdateBody.Builder = InvoiceUpdateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(invoiceUpdateParams: InvoiceUpdateParams) = apply { invoiceId = invoiceUpdateParams.invoiceId - metadata = invoiceUpdateParams.metadata + body = invoiceUpdateParams.body.toBuilder() additionalHeaders = invoiceUpdateParams.additionalHeaders.toBuilder() additionalQueryParams = invoiceUpdateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = invoiceUpdateParams.additionalBodyProperties.toMutableMap() } fun invoiceId(invoiceId: String) = apply { this.invoiceId = invoiceId } @@ -169,7 +168,7 @@ constructor( * setting the value to `null`, and the entire metadata mapping can be cleared by setting * `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata) = apply { body.metadata(metadata) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -270,34 +269,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): InvoiceUpdateParams = InvoiceUpdateParams( checkNotNull(invoiceId) { "`invoiceId` is required but was not set" }, - metadata, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -378,11 +373,11 @@ constructor( return true } - return /* spotless:off */ other is InvoiceUpdateParams && invoiceId == other.invoiceId && metadata == other.metadata && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is InvoiceUpdateParams && invoiceId == other.invoiceId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(invoiceId, metadata, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(invoiceId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "InvoiceUpdateParams{invoiceId=$invoiceId, metadata=$metadata, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "InvoiceUpdateParams{invoiceId=$invoiceId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceVoidInvoiceParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceVoidInvoiceParams.kt index 0b7a4aa9..3c471265 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceVoidInvoiceParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceVoidInvoiceParams.kt @@ -27,9 +27,8 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties @JvmSynthetic - internal fun getBody(): Optional> { - return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - } + internal fun getBody(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemCreateParams.kt index 9e6d1ced..5d6d559d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemCreateParams.kt @@ -17,24 +17,21 @@ import java.util.Objects class ItemCreateParams constructor( - private val name: String, + private val body: ItemCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun name(): String = name + /** The name of the item. */ + fun name(): String = body.name() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): ItemCreateBody { - return ItemCreateBody(name, additionalBodyProperties) - } + @JvmSynthetic internal fun getBody(): ItemCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -131,21 +128,19 @@ constructor( @NoAutoDetect class Builder { - private var name: String? = null + private var body: ItemCreateBody.Builder = ItemCreateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(itemCreateParams: ItemCreateParams) = apply { - name = itemCreateParams.name + body = itemCreateParams.body.toBuilder() additionalHeaders = itemCreateParams.additionalHeaders.toBuilder() additionalQueryParams = itemCreateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = itemCreateParams.additionalBodyProperties.toMutableMap() } /** The name of the item. */ - fun name(name: String) = apply { this.name = name } + fun name(name: String) = apply { body.name(name) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -246,33 +241,29 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): ItemCreateParams = ItemCreateParams( - checkNotNull(name) { "`name` is required but was not set" }, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -281,11 +272,11 @@ constructor( return true } - return /* spotless:off */ other is ItemCreateParams && name == other.name && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is ItemCreateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(name, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "ItemCreateParams{name=$name, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "ItemCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListParams.kt index cde51969..d4d790fb 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemListParams.kt @@ -16,8 +16,13 @@ constructor( private val additionalQueryParams: QueryParams, ) { + /** + * Cursor for pagination. This can be populated by the `next_cursor` value returned from the + * initial request. + */ fun cursor(): Optional = Optional.ofNullable(cursor) + /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) fun _additionalHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemUpdateParams.kt index f607d42f..adc508bd 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/ItemUpdateParams.kt @@ -22,34 +22,24 @@ import java.util.Optional class ItemUpdateParams constructor( private val itemId: String, - private val externalConnections: List?, - private val name: String?, + private val body: ItemUpdateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun itemId(): String = itemId - fun externalConnections(): Optional> = - Optional.ofNullable(externalConnections) + fun externalConnections(): Optional> = body.externalConnections() - fun name(): Optional = Optional.ofNullable(name) + fun name(): Optional = body.name() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): ItemUpdateBody { - return ItemUpdateBody( - externalConnections, - name, - additionalBodyProperties, - ) - } + @JvmSynthetic internal fun getBody(): ItemUpdateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -97,7 +87,7 @@ constructor( class Builder { - private var externalConnections: List? = null + private var externalConnections: MutableList? = null private var name: String? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -109,7 +99,12 @@ constructor( } fun externalConnections(externalConnections: List) = apply { - this.externalConnections = externalConnections + this.externalConnections = externalConnections.toMutableList() + } + + fun addExternalConnection(externalConnection: ExternalConnection) = apply { + externalConnections = + (externalConnections ?: mutableListOf()).apply { add(externalConnection) } } fun name(name: String) = apply { this.name = name } @@ -170,35 +165,29 @@ constructor( class Builder { private var itemId: String? = null - private var externalConnections: MutableList = mutableListOf() - private var name: String? = null + private var body: ItemUpdateBody.Builder = ItemUpdateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(itemUpdateParams: ItemUpdateParams) = apply { itemId = itemUpdateParams.itemId - externalConnections = - itemUpdateParams.externalConnections?.toMutableList() ?: mutableListOf() - name = itemUpdateParams.name + body = itemUpdateParams.body.toBuilder() additionalHeaders = itemUpdateParams.additionalHeaders.toBuilder() additionalQueryParams = itemUpdateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = itemUpdateParams.additionalBodyProperties.toMutableMap() } fun itemId(itemId: String) = apply { this.itemId = itemId } fun externalConnections(externalConnections: List) = apply { - this.externalConnections.clear() - this.externalConnections.addAll(externalConnections) + body.externalConnections(externalConnections) } fun addExternalConnection(externalConnection: ExternalConnection) = apply { - this.externalConnections.add(externalConnection) + body.addExternalConnection(externalConnection) } - fun name(name: String) = apply { this.name = name } + fun name(name: String) = apply { body.name(name) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -299,35 +288,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): ItemUpdateParams = ItemUpdateParams( checkNotNull(itemId) { "`itemId` is required but was not set" }, - externalConnections.toImmutable().ifEmpty { null }, - name, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -520,11 +504,11 @@ constructor( return true } - return /* spotless:off */ other is ItemUpdateParams && itemId == other.itemId && externalConnections == other.externalConnections && name == other.name && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is ItemUpdateParams && itemId == other.itemId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(itemId, externalConnections, name, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(itemId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "ItemUpdateParams{itemId=$itemId, externalConnections=$externalConnections, name=$name, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "ItemUpdateParams{itemId=$itemId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricCreateParams.kt index db4f224b..3333fe01 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricCreateParams.kt @@ -18,43 +18,37 @@ import java.util.Optional class MetricCreateParams constructor( - private val description: String?, - private val itemId: String, - private val name: String, - private val sql: String, - private val metadata: Metadata?, + private val body: MetricCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun description(): Optional = Optional.ofNullable(description) + /** A description of the metric. */ + fun description(): Optional = body.description() - fun itemId(): String = itemId + /** The id of the item */ + fun itemId(): String = body.itemId() - fun name(): String = name + /** The name of the metric. */ + fun name(): String = body.name() - fun sql(): String = sql + /** A sql string defining the metric. */ + fun sql(): String = body.sql() - fun metadata(): Optional = Optional.ofNullable(metadata) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by setting + * the value to `null`, and the entire metadata mapping can be cleared by setting `metadata` to + * `null`. + */ + fun metadata(): Optional = body.metadata() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): MetricCreateBody { - return MetricCreateBody( - description, - itemId, - name, - sql, - metadata, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): MetricCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -200,45 +194,35 @@ constructor( @NoAutoDetect class Builder { - private var description: String? = null - private var itemId: String? = null - private var name: String? = null - private var sql: String? = null - private var metadata: Metadata? = null + private var body: MetricCreateBody.Builder = MetricCreateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(metricCreateParams: MetricCreateParams) = apply { - description = metricCreateParams.description - itemId = metricCreateParams.itemId - name = metricCreateParams.name - sql = metricCreateParams.sql - metadata = metricCreateParams.metadata + body = metricCreateParams.body.toBuilder() additionalHeaders = metricCreateParams.additionalHeaders.toBuilder() additionalQueryParams = metricCreateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = metricCreateParams.additionalBodyProperties.toMutableMap() } /** A description of the metric. */ - fun description(description: String) = apply { this.description = description } + fun description(description: String) = apply { body.description(description) } /** The id of the item */ - fun itemId(itemId: String) = apply { this.itemId = itemId } + fun itemId(itemId: String) = apply { body.itemId(itemId) } /** The name of the metric. */ - fun name(name: String) = apply { this.name = name } + fun name(name: String) = apply { body.name(name) } /** A sql string defining the metric. */ - fun sql(sql: String) = apply { this.sql = sql } + fun sql(sql: String) = apply { body.sql(sql) } /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by setting * `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata) = apply { body.metadata(metadata) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -339,37 +323,29 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): MetricCreateParams = MetricCreateParams( - description, - checkNotNull(itemId) { "`itemId` is required but was not set" }, - checkNotNull(name) { "`name` is required but was not set" }, - checkNotNull(sql) { "`sql` is required but was not set" }, - metadata, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -450,11 +426,11 @@ constructor( return true } - return /* spotless:off */ other is MetricCreateParams && description == other.description && itemId == other.itemId && name == other.name && sql == other.sql && metadata == other.metadata && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is MetricCreateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(description, itemId, name, sql, metadata, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "MetricCreateParams{description=$description, itemId=$itemId, name=$name, sql=$sql, metadata=$metadata, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "MetricCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListParams.kt index 5db3d8c9..bc2c7c63 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricListParams.kt @@ -30,8 +30,13 @@ constructor( fun createdAtLte(): Optional = Optional.ofNullable(createdAtLte) + /** + * Cursor for pagination. This can be populated by the `next_cursor` value returned from the + * initial request. + */ fun cursor(): Optional = Optional.ofNullable(cursor) + /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) fun _additionalHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricUpdateParams.kt index 82ebc67a..122ec16a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MetricUpdateParams.kt @@ -19,26 +19,27 @@ import java.util.Optional class MetricUpdateParams constructor( private val metricId: String, - private val metadata: Metadata?, + private val body: MetricUpdateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun metricId(): String = metricId - fun metadata(): Optional = Optional.ofNullable(metadata) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by setting + * the value to `null`, and the entire metadata mapping can be cleared by setting `metadata` to + * `null`. + */ + fun metadata(): Optional = body.metadata() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): MetricUpdateBody { - return MetricUpdateBody(metadata, additionalBodyProperties) - } + @JvmSynthetic internal fun getBody(): MetricUpdateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -148,18 +149,16 @@ constructor( class Builder { private var metricId: String? = null - private var metadata: Metadata? = null + private var body: MetricUpdateBody.Builder = MetricUpdateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(metricUpdateParams: MetricUpdateParams) = apply { metricId = metricUpdateParams.metricId - metadata = metricUpdateParams.metadata + body = metricUpdateParams.body.toBuilder() additionalHeaders = metricUpdateParams.additionalHeaders.toBuilder() additionalQueryParams = metricUpdateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = metricUpdateParams.additionalBodyProperties.toMutableMap() } fun metricId(metricId: String) = apply { this.metricId = metricId } @@ -169,7 +168,7 @@ constructor( * setting the value to `null`, and the entire metadata mapping can be cleared by setting * `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata) = apply { body.metadata(metadata) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -270,34 +269,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): MetricUpdateParams = MetricUpdateParams( checkNotNull(metricId) { "`metricId` is required but was not set" }, - metadata, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -378,11 +373,11 @@ constructor( return true } - return /* spotless:off */ other is MetricUpdateParams && metricId == other.metricId && metadata == other.metadata && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is MetricUpdateParams && metricId == other.metricId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(metricId, metadata, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(metricId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "MetricUpdateParams{metricId=$metricId, metadata=$metadata, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "MetricUpdateParams{metricId=$metricId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanCreateParams.kt index dee2d0d2..48acfd10 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanCreateParams.kt @@ -32,55 +32,53 @@ import kotlin.jvm.optionals.getOrNull class PlanCreateParams constructor( - private val currency: String, - private val name: String, - private val prices: List, - private val defaultInvoiceMemo: String?, - private val externalPlanId: String?, - private val metadata: Metadata?, - private val netTerms: Long?, - private val status: Status?, + private val body: PlanCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun currency(): String = currency + /** An ISO 4217 currency string for invoices generated by subscriptions on this plan. */ + fun currency(): String = body.currency() - fun name(): String = name + fun name(): String = body.name() - fun prices(): List = prices + /** + * Prices for this plan. If the plan has phases, this includes prices across all phases of the + * plan. + */ + fun prices(): List = body.prices() - fun defaultInvoiceMemo(): Optional = Optional.ofNullable(defaultInvoiceMemo) + /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ + fun defaultInvoiceMemo(): Optional = body.defaultInvoiceMemo() - fun externalPlanId(): Optional = Optional.ofNullable(externalPlanId) + fun externalPlanId(): Optional = body.externalPlanId() - fun metadata(): Optional = Optional.ofNullable(metadata) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by setting + * the value to `null`, and the entire metadata mapping can be cleared by setting `metadata` to + * `null`. + */ + fun metadata(): Optional = body.metadata() - fun netTerms(): Optional = Optional.ofNullable(netTerms) + /** + * The net terms determines the difference between the invoice date and the issue date for the + * invoice. If you intend the invoice to be due on issue, set this to 0. + */ + fun netTerms(): Optional = body.netTerms() - fun status(): Optional = Optional.ofNullable(status) + /** + * The status of the plan to create (either active or draft). If not specified, this defaults to + * active. + */ + fun status(): Optional = body.status() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): PlanCreateBody { - return PlanCreateBody( - currency, - name, - prices, - defaultInvoiceMemo, - externalPlanId, - metadata, - netTerms, - status, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): PlanCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -154,7 +152,7 @@ constructor( private var currency: String? = null private var name: String? = null - private var prices: List? = null + private var prices: MutableList? = null private var defaultInvoiceMemo: String? = null private var externalPlanId: String? = null private var metadata: Metadata? = null @@ -184,7 +182,15 @@ constructor( * Prices for this plan. If the plan has phases, this includes prices across all phases * of the plan. */ - fun prices(prices: List) = apply { this.prices = prices } + fun prices(prices: List) = apply { this.prices = prices.toMutableList() } + + /** + * Prices for this plan. If the plan has phases, this includes prices across all phases + * of the plan. + */ + fun addPrice(price: Price) = apply { + prices = (prices ?: mutableListOf()).apply { add(price) } + } /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ fun defaultInvoiceMemo(defaultInvoiceMemo: String) = apply { @@ -275,78 +281,59 @@ constructor( @NoAutoDetect class Builder { - private var currency: String? = null - private var name: String? = null - private var prices: MutableList = mutableListOf() - private var defaultInvoiceMemo: String? = null - private var externalPlanId: String? = null - private var metadata: Metadata? = null - private var netTerms: Long? = null - private var status: Status? = null + private var body: PlanCreateBody.Builder = PlanCreateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(planCreateParams: PlanCreateParams) = apply { - currency = planCreateParams.currency - name = planCreateParams.name - prices = planCreateParams.prices.toMutableList() - defaultInvoiceMemo = planCreateParams.defaultInvoiceMemo - externalPlanId = planCreateParams.externalPlanId - metadata = planCreateParams.metadata - netTerms = planCreateParams.netTerms - status = planCreateParams.status + body = planCreateParams.body.toBuilder() additionalHeaders = planCreateParams.additionalHeaders.toBuilder() additionalQueryParams = planCreateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = planCreateParams.additionalBodyProperties.toMutableMap() } /** An ISO 4217 currency string for invoices generated by subscriptions on this plan. */ - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: String) = apply { body.currency(currency) } - fun name(name: String) = apply { this.name = name } + fun name(name: String) = apply { body.name(name) } /** * Prices for this plan. If the plan has phases, this includes prices across all phases of * the plan. */ - fun prices(prices: List) = apply { - this.prices.clear() - this.prices.addAll(prices) - } + fun prices(prices: List) = apply { body.prices(prices) } /** * Prices for this plan. If the plan has phases, this includes prices across all phases of * the plan. */ - fun addPrice(price: Price) = apply { this.prices.add(price) } + fun addPrice(price: Price) = apply { body.addPrice(price) } /** Free-form text which is available on the invoice PDF and the Orb invoice portal. */ fun defaultInvoiceMemo(defaultInvoiceMemo: String) = apply { - this.defaultInvoiceMemo = defaultInvoiceMemo + body.defaultInvoiceMemo(defaultInvoiceMemo) } - fun externalPlanId(externalPlanId: String) = apply { this.externalPlanId = externalPlanId } + fun externalPlanId(externalPlanId: String) = apply { body.externalPlanId(externalPlanId) } /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by setting * `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata) = apply { body.metadata(metadata) } /** * The net terms determines the difference between the invoice date and the issue date for * the invoice. If you intend the invoice to be due on issue, set this to 0. */ - fun netTerms(netTerms: Long) = apply { this.netTerms = netTerms } + fun netTerms(netTerms: Long) = apply { body.netTerms(netTerms) } /** * The status of the plan to create (either active or draft). If not specified, this * defaults to active. */ - fun status(status: Status) = apply { this.status = status } + fun status(status: Status) = apply { body.status(status) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -447,40 +434,29 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): PlanCreateParams = PlanCreateParams( - checkNotNull(currency) { "`currency` is required but was not set" }, - checkNotNull(name) { "`name` is required but was not set" }, - prices.toImmutable(), - defaultInvoiceMemo, - externalPlanId, - metadata, - netTerms, - status, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -3384,9 +3360,9 @@ constructor( class Builder { - private var dimensions: List? = null + private var dimensions: MutableList? = null private var defaultUnitAmount: String? = null - private var matrixValues: List? = null + private var matrixValues: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -3399,7 +3375,12 @@ constructor( /** One or two event property values to evaluate matrix groups by */ fun dimensions(dimensions: List) = apply { - this.dimensions = dimensions + this.dimensions = dimensions.toMutableList() + } + + /** One or two event property values to evaluate matrix groups by */ + fun addDimension(dimension: String) = apply { + dimensions = (dimensions ?: mutableListOf()).apply { add(dimension) } } /** @@ -3412,7 +3393,12 @@ constructor( /** Matrix values for specified matrix grouping keys */ fun matrixValues(matrixValues: List) = apply { - this.matrixValues = matrixValues + this.matrixValues = matrixValues.toMutableList() + } + + /** Matrix values for specified matrix grouping keys */ + fun addMatrixValue(matrixValue: MatrixValue) = apply { + matrixValues = (matrixValues ?: mutableListOf()).apply { add(matrixValue) } } fun additionalProperties(additionalProperties: Map) = apply { @@ -3487,7 +3473,7 @@ constructor( class Builder { private var unitAmount: String? = null - private var dimensionValues: List? = null + private var dimensionValues: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -3507,7 +3493,17 @@ constructor( * cloud region and an instance tier. */ fun dimensionValues(dimensionValues: List) = apply { - this.dimensionValues = dimensionValues + this.dimensionValues = dimensionValues.toMutableList() + } + + /** + * One or two matrix keys to filter usage to this Matrix value by. For + * example, ["region", "tier"] could be used to filter cloud usage by a + * cloud region and an instance tier. + */ + fun addDimensionValue(dimensionValue: String) = apply { + dimensionValues = + (dimensionValues ?: mutableListOf()).apply { add(dimensionValue) } } fun additionalProperties(additionalProperties: Map) = @@ -4480,7 +4476,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -4490,7 +4486,12 @@ constructor( } /** Tiers for rating based on total usage quantities into the specified tier */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** Tiers for rating based on total usage quantities into the specified tier */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5506,7 +5507,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -5519,7 +5520,15 @@ constructor( * Tiers for a Graduated BPS pricing model, where usage is bucketed into * specified tiers */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** + * Tiers for a Graduated BPS pricing model, where usage is bucketed into + * specified tiers + */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -7333,7 +7342,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -7346,7 +7355,15 @@ constructor( * Tiers for a bulk BPS pricing model where all usage is aggregated to a single * tier based on total volume */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** + * Tiers for a bulk BPS pricing model where all usage is aggregated to a single + * tier based on total volume + */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -8353,7 +8370,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -8363,7 +8380,12 @@ constructor( } /** Bulk tiers for rating based on total usage volume */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** Bulk tiers for rating based on total usage volume */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -20986,11 +21008,11 @@ constructor( return true } - return /* spotless:off */ other is PlanCreateParams && currency == other.currency && name == other.name && prices == other.prices && defaultInvoiceMemo == other.defaultInvoiceMemo && externalPlanId == other.externalPlanId && metadata == other.metadata && netTerms == other.netTerms && status == other.status && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is PlanCreateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(currency, name, prices, defaultInvoiceMemo, externalPlanId, metadata, netTerms, status, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "PlanCreateParams{currency=$currency, name=$name, prices=$prices, defaultInvoiceMemo=$defaultInvoiceMemo, externalPlanId=$externalPlanId, metadata=$metadata, netTerms=$netTerms, status=$status, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "PlanCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParams.kt index f32b0607..07c783bc 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParams.kt @@ -19,33 +19,33 @@ import java.util.Optional class PlanExternalPlanIdUpdateParams constructor( private val otherExternalPlanId: String, - private val externalPlanId: String?, - private val metadata: Metadata?, + private val body: PlanExternalPlanIdUpdateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun otherExternalPlanId(): String = otherExternalPlanId - fun externalPlanId(): Optional = Optional.ofNullable(externalPlanId) + /** + * An optional user-defined ID for this plan resource, used throughout the system as an alias + * for this Plan. Use this field to identify a plan by an existing identifier in your system. + */ + fun externalPlanId(): Optional = body.externalPlanId() - fun metadata(): Optional = Optional.ofNullable(metadata) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by setting + * the value to `null`, and the entire metadata mapping can be cleared by setting `metadata` to + * `null`. + */ + fun metadata(): Optional = body.metadata() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): PlanExternalPlanIdUpdateBody { - return PlanExternalPlanIdUpdateBody( - externalPlanId, - metadata, - additionalBodyProperties, - ) - } + @JvmSynthetic internal fun getBody(): PlanExternalPlanIdUpdateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -180,21 +180,17 @@ constructor( class Builder { private var otherExternalPlanId: String? = null - private var externalPlanId: String? = null - private var metadata: Metadata? = null + private var body: PlanExternalPlanIdUpdateBody.Builder = + PlanExternalPlanIdUpdateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(planExternalPlanIdUpdateParams: PlanExternalPlanIdUpdateParams) = apply { otherExternalPlanId = planExternalPlanIdUpdateParams.otherExternalPlanId - externalPlanId = planExternalPlanIdUpdateParams.externalPlanId - metadata = planExternalPlanIdUpdateParams.metadata + body = planExternalPlanIdUpdateParams.body.toBuilder() additionalHeaders = planExternalPlanIdUpdateParams.additionalHeaders.toBuilder() additionalQueryParams = planExternalPlanIdUpdateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - planExternalPlanIdUpdateParams.additionalBodyProperties.toMutableMap() } fun otherExternalPlanId(otherExternalPlanId: String) = apply { @@ -206,14 +202,14 @@ constructor( * alias for this Plan. Use this field to identify a plan by an existing identifier in your * system. */ - fun externalPlanId(externalPlanId: String) = apply { this.externalPlanId = externalPlanId } + fun externalPlanId(externalPlanId: String) = apply { body.externalPlanId(externalPlanId) } /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by setting * `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata) = apply { body.metadata(metadata) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -314,25 +310,22 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): PlanExternalPlanIdUpdateParams = @@ -340,11 +333,9 @@ constructor( checkNotNull(otherExternalPlanId) { "`otherExternalPlanId` is required but was not set" }, - externalPlanId, - metadata, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -425,11 +416,11 @@ constructor( return true } - return /* spotless:off */ other is PlanExternalPlanIdUpdateParams && otherExternalPlanId == other.otherExternalPlanId && externalPlanId == other.externalPlanId && metadata == other.metadata && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is PlanExternalPlanIdUpdateParams && otherExternalPlanId == other.otherExternalPlanId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(otherExternalPlanId, externalPlanId, metadata, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(otherExternalPlanId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "PlanExternalPlanIdUpdateParams{otherExternalPlanId=$otherExternalPlanId, externalPlanId=$externalPlanId, metadata=$metadata, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "PlanExternalPlanIdUpdateParams{otherExternalPlanId=$otherExternalPlanId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListParams.kt index dec12d2e..c84d0bae 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanListParams.kt @@ -35,10 +35,16 @@ constructor( fun createdAtLte(): Optional = Optional.ofNullable(createdAtLte) + /** + * Cursor for pagination. This can be populated by the `next_cursor` value returned from the + * initial request. + */ fun cursor(): Optional = Optional.ofNullable(cursor) + /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) + /** The plan status to filter to ('active', 'archived', or 'draft'). */ fun status(): Optional = Optional.ofNullable(status) fun _additionalHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanUpdateParams.kt index 1c5c78f2..e29bb2d8 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PlanUpdateParams.kt @@ -19,33 +19,33 @@ import java.util.Optional class PlanUpdateParams constructor( private val planId: String, - private val externalPlanId: String?, - private val metadata: Metadata?, + private val body: PlanUpdateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun planId(): String = planId - fun externalPlanId(): Optional = Optional.ofNullable(externalPlanId) + /** + * An optional user-defined ID for this plan resource, used throughout the system as an alias + * for this Plan. Use this field to identify a plan by an existing identifier in your system. + */ + fun externalPlanId(): Optional = body.externalPlanId() - fun metadata(): Optional = Optional.ofNullable(metadata) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by setting + * the value to `null`, and the entire metadata mapping can be cleared by setting `metadata` to + * `null`. + */ + fun metadata(): Optional = body.metadata() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): PlanUpdateBody { - return PlanUpdateBody( - externalPlanId, - metadata, - additionalBodyProperties, - ) - } + @JvmSynthetic internal fun getBody(): PlanUpdateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -179,20 +179,16 @@ constructor( class Builder { private var planId: String? = null - private var externalPlanId: String? = null - private var metadata: Metadata? = null + private var body: PlanUpdateBody.Builder = PlanUpdateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(planUpdateParams: PlanUpdateParams) = apply { planId = planUpdateParams.planId - externalPlanId = planUpdateParams.externalPlanId - metadata = planUpdateParams.metadata + body = planUpdateParams.body.toBuilder() additionalHeaders = planUpdateParams.additionalHeaders.toBuilder() additionalQueryParams = planUpdateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = planUpdateParams.additionalBodyProperties.toMutableMap() } fun planId(planId: String) = apply { this.planId = planId } @@ -202,14 +198,14 @@ constructor( * alias for this Plan. Use this field to identify a plan by an existing identifier in your * system. */ - fun externalPlanId(externalPlanId: String) = apply { this.externalPlanId = externalPlanId } + fun externalPlanId(externalPlanId: String) = apply { body.externalPlanId(externalPlanId) } /** * User-specified key/value pairs for the resource. Individual keys can be removed by * setting the value to `null`, and the entire metadata mapping can be cleared by setting * `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata) = apply { body.metadata(metadata) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -310,35 +306,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): PlanUpdateParams = PlanUpdateParams( checkNotNull(planId) { "`planId` is required but was not set" }, - externalPlanId, - metadata, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -419,11 +410,11 @@ constructor( return true } - return /* spotless:off */ other is PlanUpdateParams && planId == other.planId && externalPlanId == other.externalPlanId && metadata == other.metadata && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is PlanUpdateParams && planId == other.planId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(planId, externalPlanId, metadata, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(planId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "PlanUpdateParams{planId=$planId, externalPlanId=$externalPlanId, metadata=$metadata, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "PlanUpdateParams{planId=$planId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt index 9669c23e..ef3ca41e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt @@ -32,144 +32,86 @@ import kotlin.jvm.optionals.getOrNull class PriceCreateParams constructor( - private val newFloatingUnitPrice: NewFloatingUnitPrice?, - private val newFloatingPackagePrice: NewFloatingPackagePrice?, - private val newFloatingMatrixPrice: NewFloatingMatrixPrice?, - private val newFloatingMatrixWithAllocationPrice: NewFloatingMatrixWithAllocationPrice?, - private val newFloatingTieredPrice: NewFloatingTieredPrice?, - private val newFloatingTieredBpsPrice: NewFloatingTieredBpsPrice?, - private val newFloatingBpsPrice: NewFloatingBpsPrice?, - private val newFloatingBulkBpsPrice: NewFloatingBulkBpsPrice?, - private val newFloatingBulkPrice: NewFloatingBulkPrice?, - private val newFloatingThresholdTotalAmountPrice: NewFloatingThresholdTotalAmountPrice?, - private val newFloatingTieredPackagePrice: NewFloatingTieredPackagePrice?, - private val newFloatingGroupedTieredPrice: NewFloatingGroupedTieredPrice?, - private val newFloatingTieredWithMinimumPrice: NewFloatingTieredWithMinimumPrice?, - private val newFloatingPackageWithAllocationPrice: NewFloatingPackageWithAllocationPrice?, - private val newFloatingTieredPackageWithMinimumPrice: NewFloatingTieredPackageWithMinimumPrice?, - private val newFloatingUnitWithPercentPrice: NewFloatingUnitWithPercentPrice?, - private val newFloatingTieredWithProrationPrice: NewFloatingTieredWithProrationPrice?, - private val newFloatingUnitWithProrationPrice: NewFloatingUnitWithProrationPrice?, - private val newFloatingGroupedAllocationPrice: NewFloatingGroupedAllocationPrice?, - private val newFloatingGroupedWithProratedMinimumPrice: - NewFloatingGroupedWithProratedMinimumPrice?, - private val newFloatingGroupedWithMeteredMinimumPrice: - NewFloatingGroupedWithMeteredMinimumPrice?, - private val newFloatingMatrixWithDisplayNamePrice: NewFloatingMatrixWithDisplayNamePrice?, - private val newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice?, - private val newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice?, + private val body: PriceCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) { - fun newFloatingUnitPrice(): Optional = - Optional.ofNullable(newFloatingUnitPrice) + fun newFloatingUnitPrice(): Optional = body.newFloatingUnitPrice() fun newFloatingPackagePrice(): Optional = - Optional.ofNullable(newFloatingPackagePrice) + body.newFloatingPackagePrice() - fun newFloatingMatrixPrice(): Optional = - Optional.ofNullable(newFloatingMatrixPrice) + fun newFloatingMatrixPrice(): Optional = body.newFloatingMatrixPrice() fun newFloatingMatrixWithAllocationPrice(): Optional = - Optional.ofNullable(newFloatingMatrixWithAllocationPrice) + body.newFloatingMatrixWithAllocationPrice() - fun newFloatingTieredPrice(): Optional = - Optional.ofNullable(newFloatingTieredPrice) + fun newFloatingTieredPrice(): Optional = body.newFloatingTieredPrice() fun newFloatingTieredBpsPrice(): Optional = - Optional.ofNullable(newFloatingTieredBpsPrice) + body.newFloatingTieredBpsPrice() - fun newFloatingBpsPrice(): Optional = - Optional.ofNullable(newFloatingBpsPrice) + fun newFloatingBpsPrice(): Optional = body.newFloatingBpsPrice() fun newFloatingBulkBpsPrice(): Optional = - Optional.ofNullable(newFloatingBulkBpsPrice) + body.newFloatingBulkBpsPrice() - fun newFloatingBulkPrice(): Optional = - Optional.ofNullable(newFloatingBulkPrice) + fun newFloatingBulkPrice(): Optional = body.newFloatingBulkPrice() fun newFloatingThresholdTotalAmountPrice(): Optional = - Optional.ofNullable(newFloatingThresholdTotalAmountPrice) + body.newFloatingThresholdTotalAmountPrice() fun newFloatingTieredPackagePrice(): Optional = - Optional.ofNullable(newFloatingTieredPackagePrice) + body.newFloatingTieredPackagePrice() fun newFloatingGroupedTieredPrice(): Optional = - Optional.ofNullable(newFloatingGroupedTieredPrice) + body.newFloatingGroupedTieredPrice() fun newFloatingTieredWithMinimumPrice(): Optional = - Optional.ofNullable(newFloatingTieredWithMinimumPrice) + body.newFloatingTieredWithMinimumPrice() fun newFloatingPackageWithAllocationPrice(): Optional = - Optional.ofNullable(newFloatingPackageWithAllocationPrice) + body.newFloatingPackageWithAllocationPrice() fun newFloatingTieredPackageWithMinimumPrice(): Optional = - Optional.ofNullable(newFloatingTieredPackageWithMinimumPrice) + body.newFloatingTieredPackageWithMinimumPrice() fun newFloatingUnitWithPercentPrice(): Optional = - Optional.ofNullable(newFloatingUnitWithPercentPrice) + body.newFloatingUnitWithPercentPrice() fun newFloatingTieredWithProrationPrice(): Optional = - Optional.ofNullable(newFloatingTieredWithProrationPrice) + body.newFloatingTieredWithProrationPrice() fun newFloatingUnitWithProrationPrice(): Optional = - Optional.ofNullable(newFloatingUnitWithProrationPrice) + body.newFloatingUnitWithProrationPrice() fun newFloatingGroupedAllocationPrice(): Optional = - Optional.ofNullable(newFloatingGroupedAllocationPrice) + body.newFloatingGroupedAllocationPrice() fun newFloatingGroupedWithProratedMinimumPrice(): Optional = - Optional.ofNullable(newFloatingGroupedWithProratedMinimumPrice) + body.newFloatingGroupedWithProratedMinimumPrice() fun newFloatingGroupedWithMeteredMinimumPrice(): Optional = - Optional.ofNullable(newFloatingGroupedWithMeteredMinimumPrice) + body.newFloatingGroupedWithMeteredMinimumPrice() fun newFloatingMatrixWithDisplayNamePrice(): Optional = - Optional.ofNullable(newFloatingMatrixWithDisplayNamePrice) + body.newFloatingMatrixWithDisplayNamePrice() fun newFloatingBulkWithProrationPrice(): Optional = - Optional.ofNullable(newFloatingBulkWithProrationPrice) + body.newFloatingBulkWithProrationPrice() fun newFloatingGroupedTieredPackagePrice(): Optional = - Optional.ofNullable(newFloatingGroupedTieredPackagePrice) + body.newFloatingGroupedTieredPackagePrice() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic - internal fun getBody(): PriceCreateBody { - return PriceCreateBody( - newFloatingUnitPrice, - newFloatingPackagePrice, - newFloatingMatrixPrice, - newFloatingMatrixWithAllocationPrice, - newFloatingTieredPrice, - newFloatingTieredBpsPrice, - newFloatingBpsPrice, - newFloatingBulkBpsPrice, - newFloatingBulkPrice, - newFloatingThresholdTotalAmountPrice, - newFloatingTieredPackagePrice, - newFloatingGroupedTieredPrice, - newFloatingTieredWithMinimumPrice, - newFloatingPackageWithAllocationPrice, - newFloatingTieredPackageWithMinimumPrice, - newFloatingUnitWithPercentPrice, - newFloatingTieredWithProrationPrice, - newFloatingUnitWithProrationPrice, - newFloatingGroupedAllocationPrice, - newFloatingGroupedWithProratedMinimumPrice, - newFloatingGroupedWithMeteredMinimumPrice, - newFloatingMatrixWithDisplayNamePrice, - newFloatingBulkWithProrationPrice, - newFloatingGroupedTieredPackagePrice, - ) - } + @JvmSynthetic internal fun getBody(): PriceCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -1111,764 +1053,184 @@ constructor( @NoAutoDetect class Builder { - private var newFloatingUnitPrice: NewFloatingUnitPrice? = null - private var newFloatingPackagePrice: NewFloatingPackagePrice? = null - private var newFloatingMatrixPrice: NewFloatingMatrixPrice? = null - private var newFloatingMatrixWithAllocationPrice: NewFloatingMatrixWithAllocationPrice? = - null - private var newFloatingTieredPrice: NewFloatingTieredPrice? = null - private var newFloatingTieredBpsPrice: NewFloatingTieredBpsPrice? = null - private var newFloatingBpsPrice: NewFloatingBpsPrice? = null - private var newFloatingBulkBpsPrice: NewFloatingBulkBpsPrice? = null - private var newFloatingBulkPrice: NewFloatingBulkPrice? = null - private var newFloatingThresholdTotalAmountPrice: NewFloatingThresholdTotalAmountPrice? = - null - private var newFloatingTieredPackagePrice: NewFloatingTieredPackagePrice? = null - private var newFloatingGroupedTieredPrice: NewFloatingGroupedTieredPrice? = null - private var newFloatingTieredWithMinimumPrice: NewFloatingTieredWithMinimumPrice? = null - private var newFloatingPackageWithAllocationPrice: NewFloatingPackageWithAllocationPrice? = - null - private var newFloatingTieredPackageWithMinimumPrice: - NewFloatingTieredPackageWithMinimumPrice? = - null - private var newFloatingUnitWithPercentPrice: NewFloatingUnitWithPercentPrice? = null - private var newFloatingTieredWithProrationPrice: NewFloatingTieredWithProrationPrice? = null - private var newFloatingUnitWithProrationPrice: NewFloatingUnitWithProrationPrice? = null - private var newFloatingGroupedAllocationPrice: NewFloatingGroupedAllocationPrice? = null - private var newFloatingGroupedWithProratedMinimumPrice: - NewFloatingGroupedWithProratedMinimumPrice? = - null - private var newFloatingGroupedWithMeteredMinimumPrice: - NewFloatingGroupedWithMeteredMinimumPrice? = - null - private var newFloatingMatrixWithDisplayNamePrice: NewFloatingMatrixWithDisplayNamePrice? = - null - private var newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice? = null - private var newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice? = - null + private var body: PriceCreateBody? = null private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @JvmSynthetic internal fun from(priceCreateParams: PriceCreateParams) = apply { - newFloatingUnitPrice = priceCreateParams.newFloatingUnitPrice - newFloatingPackagePrice = priceCreateParams.newFloatingPackagePrice - newFloatingMatrixPrice = priceCreateParams.newFloatingMatrixPrice - newFloatingMatrixWithAllocationPrice = - priceCreateParams.newFloatingMatrixWithAllocationPrice - newFloatingTieredPrice = priceCreateParams.newFloatingTieredPrice - newFloatingTieredBpsPrice = priceCreateParams.newFloatingTieredBpsPrice - newFloatingBpsPrice = priceCreateParams.newFloatingBpsPrice - newFloatingBulkBpsPrice = priceCreateParams.newFloatingBulkBpsPrice - newFloatingBulkPrice = priceCreateParams.newFloatingBulkPrice - newFloatingThresholdTotalAmountPrice = - priceCreateParams.newFloatingThresholdTotalAmountPrice - newFloatingTieredPackagePrice = priceCreateParams.newFloatingTieredPackagePrice - newFloatingGroupedTieredPrice = priceCreateParams.newFloatingGroupedTieredPrice - newFloatingTieredWithMinimumPrice = priceCreateParams.newFloatingTieredWithMinimumPrice - newFloatingPackageWithAllocationPrice = - priceCreateParams.newFloatingPackageWithAllocationPrice - newFloatingTieredPackageWithMinimumPrice = - priceCreateParams.newFloatingTieredPackageWithMinimumPrice - newFloatingUnitWithPercentPrice = priceCreateParams.newFloatingUnitWithPercentPrice - newFloatingTieredWithProrationPrice = - priceCreateParams.newFloatingTieredWithProrationPrice - newFloatingUnitWithProrationPrice = priceCreateParams.newFloatingUnitWithProrationPrice - newFloatingGroupedAllocationPrice = priceCreateParams.newFloatingGroupedAllocationPrice - newFloatingGroupedWithProratedMinimumPrice = - priceCreateParams.newFloatingGroupedWithProratedMinimumPrice - newFloatingGroupedWithMeteredMinimumPrice = - priceCreateParams.newFloatingGroupedWithMeteredMinimumPrice - newFloatingMatrixWithDisplayNamePrice = - priceCreateParams.newFloatingMatrixWithDisplayNamePrice - newFloatingBulkWithProrationPrice = priceCreateParams.newFloatingBulkWithProrationPrice - newFloatingGroupedTieredPackagePrice = - priceCreateParams.newFloatingGroupedTieredPackagePrice + body = priceCreateParams.body additionalHeaders = priceCreateParams.additionalHeaders.toBuilder() additionalQueryParams = priceCreateParams.additionalQueryParams.toBuilder() } fun forNewFloatingUnitPrice(newFloatingUnitPrice: NewFloatingUnitPrice) = apply { - this.newFloatingUnitPrice = newFloatingUnitPrice - this.newFloatingPackagePrice = null - this.newFloatingMatrixPrice = null - this.newFloatingMatrixWithAllocationPrice = null - this.newFloatingTieredPrice = null - this.newFloatingTieredBpsPrice = null - this.newFloatingBpsPrice = null - this.newFloatingBulkBpsPrice = null - this.newFloatingBulkPrice = null - this.newFloatingThresholdTotalAmountPrice = null - this.newFloatingTieredPackagePrice = null - this.newFloatingGroupedTieredPrice = null - this.newFloatingTieredWithMinimumPrice = null - this.newFloatingPackageWithAllocationPrice = null - this.newFloatingTieredPackageWithMinimumPrice = null - this.newFloatingUnitWithPercentPrice = null - this.newFloatingTieredWithProrationPrice = null - this.newFloatingUnitWithProrationPrice = null - this.newFloatingGroupedAllocationPrice = null - this.newFloatingGroupedWithProratedMinimumPrice = null - this.newFloatingGroupedWithMeteredMinimumPrice = null - this.newFloatingMatrixWithDisplayNamePrice = null - this.newFloatingBulkWithProrationPrice = null - this.newFloatingGroupedTieredPackagePrice = null + body = PriceCreateBody.ofNewFloatingUnitPrice(newFloatingUnitPrice) } fun forNewFloatingPackagePrice(newFloatingPackagePrice: NewFloatingPackagePrice) = apply { - this.newFloatingUnitPrice = null - this.newFloatingPackagePrice = newFloatingPackagePrice - this.newFloatingMatrixPrice = null - this.newFloatingMatrixWithAllocationPrice = null - this.newFloatingTieredPrice = null - this.newFloatingTieredBpsPrice = null - this.newFloatingBpsPrice = null - this.newFloatingBulkBpsPrice = null - this.newFloatingBulkPrice = null - this.newFloatingThresholdTotalAmountPrice = null - this.newFloatingTieredPackagePrice = null - this.newFloatingGroupedTieredPrice = null - this.newFloatingTieredWithMinimumPrice = null - this.newFloatingPackageWithAllocationPrice = null - this.newFloatingTieredPackageWithMinimumPrice = null - this.newFloatingUnitWithPercentPrice = null - this.newFloatingTieredWithProrationPrice = null - this.newFloatingUnitWithProrationPrice = null - this.newFloatingGroupedAllocationPrice = null - this.newFloatingGroupedWithProratedMinimumPrice = null - this.newFloatingGroupedWithMeteredMinimumPrice = null - this.newFloatingMatrixWithDisplayNamePrice = null - this.newFloatingBulkWithProrationPrice = null - this.newFloatingGroupedTieredPackagePrice = null + body = PriceCreateBody.ofNewFloatingPackagePrice(newFloatingPackagePrice) } fun forNewFloatingMatrixPrice(newFloatingMatrixPrice: NewFloatingMatrixPrice) = apply { - this.newFloatingUnitPrice = null - this.newFloatingPackagePrice = null - this.newFloatingMatrixPrice = newFloatingMatrixPrice - this.newFloatingMatrixWithAllocationPrice = null - this.newFloatingTieredPrice = null - this.newFloatingTieredBpsPrice = null - this.newFloatingBpsPrice = null - this.newFloatingBulkBpsPrice = null - this.newFloatingBulkPrice = null - this.newFloatingThresholdTotalAmountPrice = null - this.newFloatingTieredPackagePrice = null - this.newFloatingGroupedTieredPrice = null - this.newFloatingTieredWithMinimumPrice = null - this.newFloatingPackageWithAllocationPrice = null - this.newFloatingTieredPackageWithMinimumPrice = null - this.newFloatingUnitWithPercentPrice = null - this.newFloatingTieredWithProrationPrice = null - this.newFloatingUnitWithProrationPrice = null - this.newFloatingGroupedAllocationPrice = null - this.newFloatingGroupedWithProratedMinimumPrice = null - this.newFloatingGroupedWithMeteredMinimumPrice = null - this.newFloatingMatrixWithDisplayNamePrice = null - this.newFloatingBulkWithProrationPrice = null - this.newFloatingGroupedTieredPackagePrice = null + body = PriceCreateBody.ofNewFloatingMatrixPrice(newFloatingMatrixPrice) } fun forNewFloatingMatrixWithAllocationPrice( newFloatingMatrixWithAllocationPrice: NewFloatingMatrixWithAllocationPrice ) = apply { - this.newFloatingUnitPrice = null - this.newFloatingPackagePrice = null - this.newFloatingMatrixPrice = null - this.newFloatingMatrixWithAllocationPrice = newFloatingMatrixWithAllocationPrice - this.newFloatingTieredPrice = null - this.newFloatingTieredBpsPrice = null - this.newFloatingBpsPrice = null - this.newFloatingBulkBpsPrice = null - this.newFloatingBulkPrice = null - this.newFloatingThresholdTotalAmountPrice = null - this.newFloatingTieredPackagePrice = null - this.newFloatingGroupedTieredPrice = null - this.newFloatingTieredWithMinimumPrice = null - this.newFloatingPackageWithAllocationPrice = null - this.newFloatingTieredPackageWithMinimumPrice = null - this.newFloatingUnitWithPercentPrice = null - this.newFloatingTieredWithProrationPrice = null - this.newFloatingUnitWithProrationPrice = null - this.newFloatingGroupedAllocationPrice = null - this.newFloatingGroupedWithProratedMinimumPrice = null - this.newFloatingGroupedWithMeteredMinimumPrice = null - this.newFloatingMatrixWithDisplayNamePrice = null - this.newFloatingBulkWithProrationPrice = null - this.newFloatingGroupedTieredPackagePrice = null + body = + PriceCreateBody.ofNewFloatingMatrixWithAllocationPrice( + newFloatingMatrixWithAllocationPrice + ) } fun forNewFloatingTieredPrice(newFloatingTieredPrice: NewFloatingTieredPrice) = apply { - this.newFloatingUnitPrice = null - this.newFloatingPackagePrice = null - this.newFloatingMatrixPrice = null - this.newFloatingMatrixWithAllocationPrice = null - this.newFloatingTieredPrice = newFloatingTieredPrice - this.newFloatingTieredBpsPrice = null - this.newFloatingBpsPrice = null - this.newFloatingBulkBpsPrice = null - this.newFloatingBulkPrice = null - this.newFloatingThresholdTotalAmountPrice = null - this.newFloatingTieredPackagePrice = null - this.newFloatingGroupedTieredPrice = null - this.newFloatingTieredWithMinimumPrice = null - this.newFloatingPackageWithAllocationPrice = null - this.newFloatingTieredPackageWithMinimumPrice = null - this.newFloatingUnitWithPercentPrice = null - this.newFloatingTieredWithProrationPrice = null - this.newFloatingUnitWithProrationPrice = null - this.newFloatingGroupedAllocationPrice = null - this.newFloatingGroupedWithProratedMinimumPrice = null - this.newFloatingGroupedWithMeteredMinimumPrice = null - this.newFloatingMatrixWithDisplayNamePrice = null - this.newFloatingBulkWithProrationPrice = null - this.newFloatingGroupedTieredPackagePrice = null + body = PriceCreateBody.ofNewFloatingTieredPrice(newFloatingTieredPrice) } fun forNewFloatingTieredBpsPrice(newFloatingTieredBpsPrice: NewFloatingTieredBpsPrice) = apply { - this.newFloatingUnitPrice = null - this.newFloatingPackagePrice = null - this.newFloatingMatrixPrice = null - this.newFloatingMatrixWithAllocationPrice = null - this.newFloatingTieredPrice = null - this.newFloatingTieredBpsPrice = newFloatingTieredBpsPrice - this.newFloatingBpsPrice = null - this.newFloatingBulkBpsPrice = null - this.newFloatingBulkPrice = null - this.newFloatingThresholdTotalAmountPrice = null - this.newFloatingTieredPackagePrice = null - this.newFloatingGroupedTieredPrice = null - this.newFloatingTieredWithMinimumPrice = null - this.newFloatingPackageWithAllocationPrice = null - this.newFloatingTieredPackageWithMinimumPrice = null - this.newFloatingUnitWithPercentPrice = null - this.newFloatingTieredWithProrationPrice = null - this.newFloatingUnitWithProrationPrice = null - this.newFloatingGroupedAllocationPrice = null - this.newFloatingGroupedWithProratedMinimumPrice = null - this.newFloatingGroupedWithMeteredMinimumPrice = null - this.newFloatingMatrixWithDisplayNamePrice = null - this.newFloatingBulkWithProrationPrice = null - this.newFloatingGroupedTieredPackagePrice = null + body = PriceCreateBody.ofNewFloatingTieredBpsPrice(newFloatingTieredBpsPrice) } fun forNewFloatingBpsPrice(newFloatingBpsPrice: NewFloatingBpsPrice) = apply { - this.newFloatingUnitPrice = null - this.newFloatingPackagePrice = null - this.newFloatingMatrixPrice = null - this.newFloatingMatrixWithAllocationPrice = null - this.newFloatingTieredPrice = null - this.newFloatingTieredBpsPrice = null - this.newFloatingBpsPrice = newFloatingBpsPrice - this.newFloatingBulkBpsPrice = null - this.newFloatingBulkPrice = null - this.newFloatingThresholdTotalAmountPrice = null - this.newFloatingTieredPackagePrice = null - this.newFloatingGroupedTieredPrice = null - this.newFloatingTieredWithMinimumPrice = null - this.newFloatingPackageWithAllocationPrice = null - this.newFloatingTieredPackageWithMinimumPrice = null - this.newFloatingUnitWithPercentPrice = null - this.newFloatingTieredWithProrationPrice = null - this.newFloatingUnitWithProrationPrice = null - this.newFloatingGroupedAllocationPrice = null - this.newFloatingGroupedWithProratedMinimumPrice = null - this.newFloatingGroupedWithMeteredMinimumPrice = null - this.newFloatingMatrixWithDisplayNamePrice = null - this.newFloatingBulkWithProrationPrice = null - this.newFloatingGroupedTieredPackagePrice = null + body = PriceCreateBody.ofNewFloatingBpsPrice(newFloatingBpsPrice) } fun forNewFloatingBulkBpsPrice(newFloatingBulkBpsPrice: NewFloatingBulkBpsPrice) = apply { - this.newFloatingUnitPrice = null - this.newFloatingPackagePrice = null - this.newFloatingMatrixPrice = null - this.newFloatingMatrixWithAllocationPrice = null - this.newFloatingTieredPrice = null - this.newFloatingTieredBpsPrice = null - this.newFloatingBpsPrice = null - this.newFloatingBulkBpsPrice = newFloatingBulkBpsPrice - this.newFloatingBulkPrice = null - this.newFloatingThresholdTotalAmountPrice = null - this.newFloatingTieredPackagePrice = null - this.newFloatingGroupedTieredPrice = null - this.newFloatingTieredWithMinimumPrice = null - this.newFloatingPackageWithAllocationPrice = null - this.newFloatingTieredPackageWithMinimumPrice = null - this.newFloatingUnitWithPercentPrice = null - this.newFloatingTieredWithProrationPrice = null - this.newFloatingUnitWithProrationPrice = null - this.newFloatingGroupedAllocationPrice = null - this.newFloatingGroupedWithProratedMinimumPrice = null - this.newFloatingGroupedWithMeteredMinimumPrice = null - this.newFloatingMatrixWithDisplayNamePrice = null - this.newFloatingBulkWithProrationPrice = null - this.newFloatingGroupedTieredPackagePrice = null + body = PriceCreateBody.ofNewFloatingBulkBpsPrice(newFloatingBulkBpsPrice) } fun forNewFloatingBulkPrice(newFloatingBulkPrice: NewFloatingBulkPrice) = apply { - this.newFloatingUnitPrice = null - this.newFloatingPackagePrice = null - this.newFloatingMatrixPrice = null - this.newFloatingMatrixWithAllocationPrice = null - this.newFloatingTieredPrice = null - this.newFloatingTieredBpsPrice = null - this.newFloatingBpsPrice = null - this.newFloatingBulkBpsPrice = null - this.newFloatingBulkPrice = newFloatingBulkPrice - this.newFloatingThresholdTotalAmountPrice = null - this.newFloatingTieredPackagePrice = null - this.newFloatingGroupedTieredPrice = null - this.newFloatingTieredWithMinimumPrice = null - this.newFloatingPackageWithAllocationPrice = null - this.newFloatingTieredPackageWithMinimumPrice = null - this.newFloatingUnitWithPercentPrice = null - this.newFloatingTieredWithProrationPrice = null - this.newFloatingUnitWithProrationPrice = null - this.newFloatingGroupedAllocationPrice = null - this.newFloatingGroupedWithProratedMinimumPrice = null - this.newFloatingGroupedWithMeteredMinimumPrice = null - this.newFloatingMatrixWithDisplayNamePrice = null - this.newFloatingBulkWithProrationPrice = null - this.newFloatingGroupedTieredPackagePrice = null + body = PriceCreateBody.ofNewFloatingBulkPrice(newFloatingBulkPrice) } fun forNewFloatingThresholdTotalAmountPrice( newFloatingThresholdTotalAmountPrice: NewFloatingThresholdTotalAmountPrice ) = apply { - this.newFloatingUnitPrice = null - this.newFloatingPackagePrice = null - this.newFloatingMatrixPrice = null - this.newFloatingMatrixWithAllocationPrice = null - this.newFloatingTieredPrice = null - this.newFloatingTieredBpsPrice = null - this.newFloatingBpsPrice = null - this.newFloatingBulkBpsPrice = null - this.newFloatingBulkPrice = null - this.newFloatingThresholdTotalAmountPrice = newFloatingThresholdTotalAmountPrice - this.newFloatingTieredPackagePrice = null - this.newFloatingGroupedTieredPrice = null - this.newFloatingTieredWithMinimumPrice = null - this.newFloatingPackageWithAllocationPrice = null - this.newFloatingTieredPackageWithMinimumPrice = null - this.newFloatingUnitWithPercentPrice = null - this.newFloatingTieredWithProrationPrice = null - this.newFloatingUnitWithProrationPrice = null - this.newFloatingGroupedAllocationPrice = null - this.newFloatingGroupedWithProratedMinimumPrice = null - this.newFloatingGroupedWithMeteredMinimumPrice = null - this.newFloatingMatrixWithDisplayNamePrice = null - this.newFloatingBulkWithProrationPrice = null - this.newFloatingGroupedTieredPackagePrice = null + body = + PriceCreateBody.ofNewFloatingThresholdTotalAmountPrice( + newFloatingThresholdTotalAmountPrice + ) } fun forNewFloatingTieredPackagePrice( newFloatingTieredPackagePrice: NewFloatingTieredPackagePrice ) = apply { - this.newFloatingUnitPrice = null - this.newFloatingPackagePrice = null - this.newFloatingMatrixPrice = null - this.newFloatingMatrixWithAllocationPrice = null - this.newFloatingTieredPrice = null - this.newFloatingTieredBpsPrice = null - this.newFloatingBpsPrice = null - this.newFloatingBulkBpsPrice = null - this.newFloatingBulkPrice = null - this.newFloatingThresholdTotalAmountPrice = null - this.newFloatingTieredPackagePrice = newFloatingTieredPackagePrice - this.newFloatingGroupedTieredPrice = null - this.newFloatingTieredWithMinimumPrice = null - this.newFloatingPackageWithAllocationPrice = null - this.newFloatingTieredPackageWithMinimumPrice = null - this.newFloatingUnitWithPercentPrice = null - this.newFloatingTieredWithProrationPrice = null - this.newFloatingUnitWithProrationPrice = null - this.newFloatingGroupedAllocationPrice = null - this.newFloatingGroupedWithProratedMinimumPrice = null - this.newFloatingGroupedWithMeteredMinimumPrice = null - this.newFloatingMatrixWithDisplayNamePrice = null - this.newFloatingBulkWithProrationPrice = null - this.newFloatingGroupedTieredPackagePrice = null + body = PriceCreateBody.ofNewFloatingTieredPackagePrice(newFloatingTieredPackagePrice) } fun forNewFloatingGroupedTieredPrice( newFloatingGroupedTieredPrice: NewFloatingGroupedTieredPrice ) = apply { - this.newFloatingUnitPrice = null - this.newFloatingPackagePrice = null - this.newFloatingMatrixPrice = null - this.newFloatingMatrixWithAllocationPrice = null - this.newFloatingTieredPrice = null - this.newFloatingTieredBpsPrice = null - this.newFloatingBpsPrice = null - this.newFloatingBulkBpsPrice = null - this.newFloatingBulkPrice = null - this.newFloatingThresholdTotalAmountPrice = null - this.newFloatingTieredPackagePrice = null - this.newFloatingGroupedTieredPrice = newFloatingGroupedTieredPrice - this.newFloatingTieredWithMinimumPrice = null - this.newFloatingPackageWithAllocationPrice = null - this.newFloatingTieredPackageWithMinimumPrice = null - this.newFloatingUnitWithPercentPrice = null - this.newFloatingTieredWithProrationPrice = null - this.newFloatingUnitWithProrationPrice = null - this.newFloatingGroupedAllocationPrice = null - this.newFloatingGroupedWithProratedMinimumPrice = null - this.newFloatingGroupedWithMeteredMinimumPrice = null - this.newFloatingMatrixWithDisplayNamePrice = null - this.newFloatingBulkWithProrationPrice = null - this.newFloatingGroupedTieredPackagePrice = null + body = PriceCreateBody.ofNewFloatingGroupedTieredPrice(newFloatingGroupedTieredPrice) } fun forNewFloatingTieredWithMinimumPrice( newFloatingTieredWithMinimumPrice: NewFloatingTieredWithMinimumPrice ) = apply { - this.newFloatingUnitPrice = null - this.newFloatingPackagePrice = null - this.newFloatingMatrixPrice = null - this.newFloatingMatrixWithAllocationPrice = null - this.newFloatingTieredPrice = null - this.newFloatingTieredBpsPrice = null - this.newFloatingBpsPrice = null - this.newFloatingBulkBpsPrice = null - this.newFloatingBulkPrice = null - this.newFloatingThresholdTotalAmountPrice = null - this.newFloatingTieredPackagePrice = null - this.newFloatingGroupedTieredPrice = null - this.newFloatingTieredWithMinimumPrice = newFloatingTieredWithMinimumPrice - this.newFloatingPackageWithAllocationPrice = null - this.newFloatingTieredPackageWithMinimumPrice = null - this.newFloatingUnitWithPercentPrice = null - this.newFloatingTieredWithProrationPrice = null - this.newFloatingUnitWithProrationPrice = null - this.newFloatingGroupedAllocationPrice = null - this.newFloatingGroupedWithProratedMinimumPrice = null - this.newFloatingGroupedWithMeteredMinimumPrice = null - this.newFloatingMatrixWithDisplayNamePrice = null - this.newFloatingBulkWithProrationPrice = null - this.newFloatingGroupedTieredPackagePrice = null + body = + PriceCreateBody.ofNewFloatingTieredWithMinimumPrice( + newFloatingTieredWithMinimumPrice + ) } fun forNewFloatingPackageWithAllocationPrice( newFloatingPackageWithAllocationPrice: NewFloatingPackageWithAllocationPrice ) = apply { - this.newFloatingUnitPrice = null - this.newFloatingPackagePrice = null - this.newFloatingMatrixPrice = null - this.newFloatingMatrixWithAllocationPrice = null - this.newFloatingTieredPrice = null - this.newFloatingTieredBpsPrice = null - this.newFloatingBpsPrice = null - this.newFloatingBulkBpsPrice = null - this.newFloatingBulkPrice = null - this.newFloatingThresholdTotalAmountPrice = null - this.newFloatingTieredPackagePrice = null - this.newFloatingGroupedTieredPrice = null - this.newFloatingTieredWithMinimumPrice = null - this.newFloatingPackageWithAllocationPrice = newFloatingPackageWithAllocationPrice - this.newFloatingTieredPackageWithMinimumPrice = null - this.newFloatingUnitWithPercentPrice = null - this.newFloatingTieredWithProrationPrice = null - this.newFloatingUnitWithProrationPrice = null - this.newFloatingGroupedAllocationPrice = null - this.newFloatingGroupedWithProratedMinimumPrice = null - this.newFloatingGroupedWithMeteredMinimumPrice = null - this.newFloatingMatrixWithDisplayNamePrice = null - this.newFloatingBulkWithProrationPrice = null - this.newFloatingGroupedTieredPackagePrice = null + body = + PriceCreateBody.ofNewFloatingPackageWithAllocationPrice( + newFloatingPackageWithAllocationPrice + ) } fun forNewFloatingTieredPackageWithMinimumPrice( newFloatingTieredPackageWithMinimumPrice: NewFloatingTieredPackageWithMinimumPrice ) = apply { - this.newFloatingUnitPrice = null - this.newFloatingPackagePrice = null - this.newFloatingMatrixPrice = null - this.newFloatingMatrixWithAllocationPrice = null - this.newFloatingTieredPrice = null - this.newFloatingTieredBpsPrice = null - this.newFloatingBpsPrice = null - this.newFloatingBulkBpsPrice = null - this.newFloatingBulkPrice = null - this.newFloatingThresholdTotalAmountPrice = null - this.newFloatingTieredPackagePrice = null - this.newFloatingGroupedTieredPrice = null - this.newFloatingTieredWithMinimumPrice = null - this.newFloatingPackageWithAllocationPrice = null - this.newFloatingTieredPackageWithMinimumPrice = newFloatingTieredPackageWithMinimumPrice - this.newFloatingUnitWithPercentPrice = null - this.newFloatingTieredWithProrationPrice = null - this.newFloatingUnitWithProrationPrice = null - this.newFloatingGroupedAllocationPrice = null - this.newFloatingGroupedWithProratedMinimumPrice = null - this.newFloatingGroupedWithMeteredMinimumPrice = null - this.newFloatingMatrixWithDisplayNamePrice = null - this.newFloatingBulkWithProrationPrice = null - this.newFloatingGroupedTieredPackagePrice = null + body = + PriceCreateBody.ofNewFloatingTieredPackageWithMinimumPrice( + newFloatingTieredPackageWithMinimumPrice + ) } fun forNewFloatingUnitWithPercentPrice( newFloatingUnitWithPercentPrice: NewFloatingUnitWithPercentPrice ) = apply { - this.newFloatingUnitPrice = null - this.newFloatingPackagePrice = null - this.newFloatingMatrixPrice = null - this.newFloatingMatrixWithAllocationPrice = null - this.newFloatingTieredPrice = null - this.newFloatingTieredBpsPrice = null - this.newFloatingBpsPrice = null - this.newFloatingBulkBpsPrice = null - this.newFloatingBulkPrice = null - this.newFloatingThresholdTotalAmountPrice = null - this.newFloatingTieredPackagePrice = null - this.newFloatingGroupedTieredPrice = null - this.newFloatingTieredWithMinimumPrice = null - this.newFloatingPackageWithAllocationPrice = null - this.newFloatingTieredPackageWithMinimumPrice = null - this.newFloatingUnitWithPercentPrice = newFloatingUnitWithPercentPrice - this.newFloatingTieredWithProrationPrice = null - this.newFloatingUnitWithProrationPrice = null - this.newFloatingGroupedAllocationPrice = null - this.newFloatingGroupedWithProratedMinimumPrice = null - this.newFloatingGroupedWithMeteredMinimumPrice = null - this.newFloatingMatrixWithDisplayNamePrice = null - this.newFloatingBulkWithProrationPrice = null - this.newFloatingGroupedTieredPackagePrice = null + body = + PriceCreateBody.ofNewFloatingUnitWithPercentPrice(newFloatingUnitWithPercentPrice) } fun forNewFloatingTieredWithProrationPrice( newFloatingTieredWithProrationPrice: NewFloatingTieredWithProrationPrice ) = apply { - this.newFloatingUnitPrice = null - this.newFloatingPackagePrice = null - this.newFloatingMatrixPrice = null - this.newFloatingMatrixWithAllocationPrice = null - this.newFloatingTieredPrice = null - this.newFloatingTieredBpsPrice = null - this.newFloatingBpsPrice = null - this.newFloatingBulkBpsPrice = null - this.newFloatingBulkPrice = null - this.newFloatingThresholdTotalAmountPrice = null - this.newFloatingTieredPackagePrice = null - this.newFloatingGroupedTieredPrice = null - this.newFloatingTieredWithMinimumPrice = null - this.newFloatingPackageWithAllocationPrice = null - this.newFloatingTieredPackageWithMinimumPrice = null - this.newFloatingUnitWithPercentPrice = null - this.newFloatingTieredWithProrationPrice = newFloatingTieredWithProrationPrice - this.newFloatingUnitWithProrationPrice = null - this.newFloatingGroupedAllocationPrice = null - this.newFloatingGroupedWithProratedMinimumPrice = null - this.newFloatingGroupedWithMeteredMinimumPrice = null - this.newFloatingMatrixWithDisplayNamePrice = null - this.newFloatingBulkWithProrationPrice = null - this.newFloatingGroupedTieredPackagePrice = null + body = + PriceCreateBody.ofNewFloatingTieredWithProrationPrice( + newFloatingTieredWithProrationPrice + ) } fun forNewFloatingUnitWithProrationPrice( newFloatingUnitWithProrationPrice: NewFloatingUnitWithProrationPrice ) = apply { - this.newFloatingUnitPrice = null - this.newFloatingPackagePrice = null - this.newFloatingMatrixPrice = null - this.newFloatingMatrixWithAllocationPrice = null - this.newFloatingTieredPrice = null - this.newFloatingTieredBpsPrice = null - this.newFloatingBpsPrice = null - this.newFloatingBulkBpsPrice = null - this.newFloatingBulkPrice = null - this.newFloatingThresholdTotalAmountPrice = null - this.newFloatingTieredPackagePrice = null - this.newFloatingGroupedTieredPrice = null - this.newFloatingTieredWithMinimumPrice = null - this.newFloatingPackageWithAllocationPrice = null - this.newFloatingTieredPackageWithMinimumPrice = null - this.newFloatingUnitWithPercentPrice = null - this.newFloatingTieredWithProrationPrice = null - this.newFloatingUnitWithProrationPrice = newFloatingUnitWithProrationPrice - this.newFloatingGroupedAllocationPrice = null - this.newFloatingGroupedWithProratedMinimumPrice = null - this.newFloatingGroupedWithMeteredMinimumPrice = null - this.newFloatingMatrixWithDisplayNamePrice = null - this.newFloatingBulkWithProrationPrice = null - this.newFloatingGroupedTieredPackagePrice = null + body = + PriceCreateBody.ofNewFloatingUnitWithProrationPrice( + newFloatingUnitWithProrationPrice + ) } fun forNewFloatingGroupedAllocationPrice( newFloatingGroupedAllocationPrice: NewFloatingGroupedAllocationPrice ) = apply { - this.newFloatingUnitPrice = null - this.newFloatingPackagePrice = null - this.newFloatingMatrixPrice = null - this.newFloatingMatrixWithAllocationPrice = null - this.newFloatingTieredPrice = null - this.newFloatingTieredBpsPrice = null - this.newFloatingBpsPrice = null - this.newFloatingBulkBpsPrice = null - this.newFloatingBulkPrice = null - this.newFloatingThresholdTotalAmountPrice = null - this.newFloatingTieredPackagePrice = null - this.newFloatingGroupedTieredPrice = null - this.newFloatingTieredWithMinimumPrice = null - this.newFloatingPackageWithAllocationPrice = null - this.newFloatingTieredPackageWithMinimumPrice = null - this.newFloatingUnitWithPercentPrice = null - this.newFloatingTieredWithProrationPrice = null - this.newFloatingUnitWithProrationPrice = null - this.newFloatingGroupedAllocationPrice = newFloatingGroupedAllocationPrice - this.newFloatingGroupedWithProratedMinimumPrice = null - this.newFloatingGroupedWithMeteredMinimumPrice = null - this.newFloatingMatrixWithDisplayNamePrice = null - this.newFloatingBulkWithProrationPrice = null - this.newFloatingGroupedTieredPackagePrice = null + body = + PriceCreateBody.ofNewFloatingGroupedAllocationPrice( + newFloatingGroupedAllocationPrice + ) } fun forNewFloatingGroupedWithProratedMinimumPrice( newFloatingGroupedWithProratedMinimumPrice: NewFloatingGroupedWithProratedMinimumPrice ) = apply { - this.newFloatingUnitPrice = null - this.newFloatingPackagePrice = null - this.newFloatingMatrixPrice = null - this.newFloatingMatrixWithAllocationPrice = null - this.newFloatingTieredPrice = null - this.newFloatingTieredBpsPrice = null - this.newFloatingBpsPrice = null - this.newFloatingBulkBpsPrice = null - this.newFloatingBulkPrice = null - this.newFloatingThresholdTotalAmountPrice = null - this.newFloatingTieredPackagePrice = null - this.newFloatingGroupedTieredPrice = null - this.newFloatingTieredWithMinimumPrice = null - this.newFloatingPackageWithAllocationPrice = null - this.newFloatingTieredPackageWithMinimumPrice = null - this.newFloatingUnitWithPercentPrice = null - this.newFloatingTieredWithProrationPrice = null - this.newFloatingUnitWithProrationPrice = null - this.newFloatingGroupedAllocationPrice = null - this.newFloatingGroupedWithProratedMinimumPrice = - newFloatingGroupedWithProratedMinimumPrice - this.newFloatingGroupedWithMeteredMinimumPrice = null - this.newFloatingMatrixWithDisplayNamePrice = null - this.newFloatingBulkWithProrationPrice = null - this.newFloatingGroupedTieredPackagePrice = null + body = + PriceCreateBody.ofNewFloatingGroupedWithProratedMinimumPrice( + newFloatingGroupedWithProratedMinimumPrice + ) } fun forNewFloatingGroupedWithMeteredMinimumPrice( newFloatingGroupedWithMeteredMinimumPrice: NewFloatingGroupedWithMeteredMinimumPrice ) = apply { - this.newFloatingUnitPrice = null - this.newFloatingPackagePrice = null - this.newFloatingMatrixPrice = null - this.newFloatingMatrixWithAllocationPrice = null - this.newFloatingTieredPrice = null - this.newFloatingTieredBpsPrice = null - this.newFloatingBpsPrice = null - this.newFloatingBulkBpsPrice = null - this.newFloatingBulkPrice = null - this.newFloatingThresholdTotalAmountPrice = null - this.newFloatingTieredPackagePrice = null - this.newFloatingGroupedTieredPrice = null - this.newFloatingTieredWithMinimumPrice = null - this.newFloatingPackageWithAllocationPrice = null - this.newFloatingTieredPackageWithMinimumPrice = null - this.newFloatingUnitWithPercentPrice = null - this.newFloatingTieredWithProrationPrice = null - this.newFloatingUnitWithProrationPrice = null - this.newFloatingGroupedAllocationPrice = null - this.newFloatingGroupedWithProratedMinimumPrice = null - this.newFloatingGroupedWithMeteredMinimumPrice = - newFloatingGroupedWithMeteredMinimumPrice - this.newFloatingMatrixWithDisplayNamePrice = null - this.newFloatingBulkWithProrationPrice = null - this.newFloatingGroupedTieredPackagePrice = null + body = + PriceCreateBody.ofNewFloatingGroupedWithMeteredMinimumPrice( + newFloatingGroupedWithMeteredMinimumPrice + ) } fun forNewFloatingMatrixWithDisplayNamePrice( newFloatingMatrixWithDisplayNamePrice: NewFloatingMatrixWithDisplayNamePrice ) = apply { - this.newFloatingUnitPrice = null - this.newFloatingPackagePrice = null - this.newFloatingMatrixPrice = null - this.newFloatingMatrixWithAllocationPrice = null - this.newFloatingTieredPrice = null - this.newFloatingTieredBpsPrice = null - this.newFloatingBpsPrice = null - this.newFloatingBulkBpsPrice = null - this.newFloatingBulkPrice = null - this.newFloatingThresholdTotalAmountPrice = null - this.newFloatingTieredPackagePrice = null - this.newFloatingGroupedTieredPrice = null - this.newFloatingTieredWithMinimumPrice = null - this.newFloatingPackageWithAllocationPrice = null - this.newFloatingTieredPackageWithMinimumPrice = null - this.newFloatingUnitWithPercentPrice = null - this.newFloatingTieredWithProrationPrice = null - this.newFloatingUnitWithProrationPrice = null - this.newFloatingGroupedAllocationPrice = null - this.newFloatingGroupedWithProratedMinimumPrice = null - this.newFloatingGroupedWithMeteredMinimumPrice = null - this.newFloatingMatrixWithDisplayNamePrice = newFloatingMatrixWithDisplayNamePrice - this.newFloatingBulkWithProrationPrice = null - this.newFloatingGroupedTieredPackagePrice = null + body = + PriceCreateBody.ofNewFloatingMatrixWithDisplayNamePrice( + newFloatingMatrixWithDisplayNamePrice + ) } fun forNewFloatingBulkWithProrationPrice( newFloatingBulkWithProrationPrice: NewFloatingBulkWithProrationPrice ) = apply { - this.newFloatingUnitPrice = null - this.newFloatingPackagePrice = null - this.newFloatingMatrixPrice = null - this.newFloatingMatrixWithAllocationPrice = null - this.newFloatingTieredPrice = null - this.newFloatingTieredBpsPrice = null - this.newFloatingBpsPrice = null - this.newFloatingBulkBpsPrice = null - this.newFloatingBulkPrice = null - this.newFloatingThresholdTotalAmountPrice = null - this.newFloatingTieredPackagePrice = null - this.newFloatingGroupedTieredPrice = null - this.newFloatingTieredWithMinimumPrice = null - this.newFloatingPackageWithAllocationPrice = null - this.newFloatingTieredPackageWithMinimumPrice = null - this.newFloatingUnitWithPercentPrice = null - this.newFloatingTieredWithProrationPrice = null - this.newFloatingUnitWithProrationPrice = null - this.newFloatingGroupedAllocationPrice = null - this.newFloatingGroupedWithProratedMinimumPrice = null - this.newFloatingGroupedWithMeteredMinimumPrice = null - this.newFloatingMatrixWithDisplayNamePrice = null - this.newFloatingBulkWithProrationPrice = newFloatingBulkWithProrationPrice - this.newFloatingGroupedTieredPackagePrice = null + body = + PriceCreateBody.ofNewFloatingBulkWithProrationPrice( + newFloatingBulkWithProrationPrice + ) } fun forNewFloatingGroupedTieredPackagePrice( newFloatingGroupedTieredPackagePrice: NewFloatingGroupedTieredPackagePrice ) = apply { - this.newFloatingUnitPrice = null - this.newFloatingPackagePrice = null - this.newFloatingMatrixPrice = null - this.newFloatingMatrixWithAllocationPrice = null - this.newFloatingTieredPrice = null - this.newFloatingTieredBpsPrice = null - this.newFloatingBpsPrice = null - this.newFloatingBulkBpsPrice = null - this.newFloatingBulkPrice = null - this.newFloatingThresholdTotalAmountPrice = null - this.newFloatingTieredPackagePrice = null - this.newFloatingGroupedTieredPrice = null - this.newFloatingTieredWithMinimumPrice = null - this.newFloatingPackageWithAllocationPrice = null - this.newFloatingTieredPackageWithMinimumPrice = null - this.newFloatingUnitWithPercentPrice = null - this.newFloatingTieredWithProrationPrice = null - this.newFloatingUnitWithProrationPrice = null - this.newFloatingGroupedAllocationPrice = null - this.newFloatingGroupedWithProratedMinimumPrice = null - this.newFloatingGroupedWithMeteredMinimumPrice = null - this.newFloatingMatrixWithDisplayNamePrice = null - this.newFloatingBulkWithProrationPrice = null - this.newFloatingGroupedTieredPackagePrice = newFloatingGroupedTieredPackagePrice + body = + PriceCreateBody.ofNewFloatingGroupedTieredPackagePrice( + newFloatingGroupedTieredPackagePrice + ) } fun additionalHeaders(additionalHeaders: Headers) = apply { @@ -1971,30 +1333,7 @@ constructor( fun build(): PriceCreateParams = PriceCreateParams( - newFloatingUnitPrice, - newFloatingPackagePrice, - newFloatingMatrixPrice, - newFloatingMatrixWithAllocationPrice, - newFloatingTieredPrice, - newFloatingTieredBpsPrice, - newFloatingBpsPrice, - newFloatingBulkBpsPrice, - newFloatingBulkPrice, - newFloatingThresholdTotalAmountPrice, - newFloatingTieredPackagePrice, - newFloatingGroupedTieredPrice, - newFloatingTieredWithMinimumPrice, - newFloatingPackageWithAllocationPrice, - newFloatingTieredPackageWithMinimumPrice, - newFloatingUnitWithPercentPrice, - newFloatingTieredWithProrationPrice, - newFloatingUnitWithProrationPrice, - newFloatingGroupedAllocationPrice, - newFloatingGroupedWithProratedMinimumPrice, - newFloatingGroupedWithMeteredMinimumPrice, - newFloatingMatrixWithDisplayNamePrice, - newFloatingBulkWithProrationPrice, - newFloatingGroupedTieredPackagePrice, + body ?: PriceCreateBody(), additionalHeaders.build(), additionalQueryParams.build(), ) @@ -4146,9 +3485,9 @@ constructor( class Builder { - private var dimensions: List? = null + private var dimensions: MutableList? = null private var defaultUnitAmount: String? = null - private var matrixValues: List? = null + private var matrixValues: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -4160,7 +3499,14 @@ constructor( } /** One or two event property values to evaluate matrix groups by */ - fun dimensions(dimensions: List) = apply { this.dimensions = dimensions } + fun dimensions(dimensions: List) = apply { + this.dimensions = dimensions.toMutableList() + } + + /** One or two event property values to evaluate matrix groups by */ + fun addDimension(dimension: String) = apply { + dimensions = (dimensions ?: mutableListOf()).apply { add(dimension) } + } /** * Default per unit rate for any usage not bucketed into a specified matrix_value @@ -4171,7 +3517,12 @@ constructor( /** Matrix values for specified matrix grouping keys */ fun matrixValues(matrixValues: List) = apply { - this.matrixValues = matrixValues + this.matrixValues = matrixValues.toMutableList() + } + + /** Matrix values for specified matrix grouping keys */ + fun addMatrixValue(matrixValue: MatrixValue) = apply { + matrixValues = (matrixValues ?: mutableListOf()).apply { add(matrixValue) } } fun additionalProperties(additionalProperties: Map) = apply { @@ -4244,7 +3595,7 @@ constructor( class Builder { private var unitAmount: String? = null - private var dimensionValues: List? = null + private var dimensionValues: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -4263,7 +3614,17 @@ constructor( * an instance tier. */ fun dimensionValues(dimensionValues: List) = apply { - this.dimensionValues = dimensionValues + this.dimensionValues = dimensionValues.toMutableList() + } + + /** + * One or two matrix keys to filter usage to this Matrix value by. For example, + * ["region", "tier"] could be used to filter cloud usage by a cloud region and + * an instance tier. + */ + fun addDimensionValue(dimensionValue: String) = apply { + dimensionValues = + (dimensionValues ?: mutableListOf()).apply { add(dimensionValue) } } fun additionalProperties(additionalProperties: Map) = apply { @@ -5178,9 +4539,9 @@ constructor( class Builder { - private var dimensions: List? = null + private var dimensions: MutableList? = null private var defaultUnitAmount: String? = null - private var matrixValues: List? = null + private var matrixValues: MutableList? = null private var allocation: Double? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -5195,7 +4556,14 @@ constructor( } /** One or two event property values to evaluate matrix groups by */ - fun dimensions(dimensions: List) = apply { this.dimensions = dimensions } + fun dimensions(dimensions: List) = apply { + this.dimensions = dimensions.toMutableList() + } + + /** One or two event property values to evaluate matrix groups by */ + fun addDimension(dimension: String) = apply { + dimensions = (dimensions ?: mutableListOf()).apply { add(dimension) } + } /** * Default per unit rate for any usage not bucketed into a specified matrix_value @@ -5206,7 +4574,12 @@ constructor( /** Matrix values for specified matrix grouping keys */ fun matrixValues(matrixValues: List) = apply { - this.matrixValues = matrixValues + this.matrixValues = matrixValues.toMutableList() + } + + /** Matrix values for specified matrix grouping keys */ + fun addMatrixValue(matrixValue: MatrixValue) = apply { + matrixValues = (matrixValues ?: mutableListOf()).apply { add(matrixValue) } } /** Allocation to be used to calculate the price */ @@ -5283,7 +4656,7 @@ constructor( class Builder { private var unitAmount: String? = null - private var dimensionValues: List? = null + private var dimensionValues: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -5302,7 +4675,17 @@ constructor( * an instance tier. */ fun dimensionValues(dimensionValues: List) = apply { - this.dimensionValues = dimensionValues + this.dimensionValues = dimensionValues.toMutableList() + } + + /** + * One or two matrix keys to filter usage to this Matrix value by. For example, + * ["region", "tier"] could be used to filter cloud usage by a cloud region and + * an instance tier. + */ + fun addDimensionValue(dimensionValue: String) = apply { + dimensionValues = + (dimensionValues ?: mutableListOf()).apply { add(dimensionValue) } } fun additionalProperties(additionalProperties: Map) = apply { @@ -6245,7 +5628,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -6255,7 +5638,12 @@ constructor( } /** Tiers for rating based on total usage quantities into the specified tier */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** Tiers for rating based on total usage quantities into the specified tier */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -7233,7 +6621,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -7246,7 +6634,15 @@ constructor( * Tiers for a Graduated BPS pricing model, where usage is bucketed into specified * tiers */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** + * Tiers for a Graduated BPS pricing model, where usage is bucketed into specified + * tiers + */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -9000,7 +8396,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -9013,7 +8409,15 @@ constructor( * Tiers for a bulk BPS pricing model where all usage is aggregated to a single tier * based on total volume */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** + * Tiers for a bulk BPS pricing model where all usage is aggregated to a single tier + * based on total volume + */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -9990,7 +9394,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -10000,7 +9404,12 @@ constructor( } /** Bulk tiers for rating based on total usage volume */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** Bulk tiers for rating based on total usage volume */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -23859,11 +23268,11 @@ constructor( return true } - return /* spotless:off */ other is PriceCreateParams && newFloatingUnitPrice == other.newFloatingUnitPrice && newFloatingPackagePrice == other.newFloatingPackagePrice && newFloatingMatrixPrice == other.newFloatingMatrixPrice && newFloatingMatrixWithAllocationPrice == other.newFloatingMatrixWithAllocationPrice && newFloatingTieredPrice == other.newFloatingTieredPrice && newFloatingTieredBpsPrice == other.newFloatingTieredBpsPrice && newFloatingBpsPrice == other.newFloatingBpsPrice && newFloatingBulkBpsPrice == other.newFloatingBulkBpsPrice && newFloatingBulkPrice == other.newFloatingBulkPrice && newFloatingThresholdTotalAmountPrice == other.newFloatingThresholdTotalAmountPrice && newFloatingTieredPackagePrice == other.newFloatingTieredPackagePrice && newFloatingGroupedTieredPrice == other.newFloatingGroupedTieredPrice && newFloatingTieredWithMinimumPrice == other.newFloatingTieredWithMinimumPrice && newFloatingPackageWithAllocationPrice == other.newFloatingPackageWithAllocationPrice && newFloatingTieredPackageWithMinimumPrice == other.newFloatingTieredPackageWithMinimumPrice && newFloatingUnitWithPercentPrice == other.newFloatingUnitWithPercentPrice && newFloatingTieredWithProrationPrice == other.newFloatingTieredWithProrationPrice && newFloatingUnitWithProrationPrice == other.newFloatingUnitWithProrationPrice && newFloatingGroupedAllocationPrice == other.newFloatingGroupedAllocationPrice && newFloatingGroupedWithProratedMinimumPrice == other.newFloatingGroupedWithProratedMinimumPrice && newFloatingGroupedWithMeteredMinimumPrice == other.newFloatingGroupedWithMeteredMinimumPrice && newFloatingMatrixWithDisplayNamePrice == other.newFloatingMatrixWithDisplayNamePrice && newFloatingBulkWithProrationPrice == other.newFloatingBulkWithProrationPrice && newFloatingGroupedTieredPackagePrice == other.newFloatingGroupedTieredPackagePrice && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + return /* spotless:off */ other is PriceCreateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(newFloatingUnitPrice, newFloatingPackagePrice, newFloatingMatrixPrice, newFloatingMatrixWithAllocationPrice, newFloatingTieredPrice, newFloatingTieredBpsPrice, newFloatingBpsPrice, newFloatingBulkBpsPrice, newFloatingBulkPrice, newFloatingThresholdTotalAmountPrice, newFloatingTieredPackagePrice, newFloatingGroupedTieredPrice, newFloatingTieredWithMinimumPrice, newFloatingPackageWithAllocationPrice, newFloatingTieredPackageWithMinimumPrice, newFloatingUnitWithPercentPrice, newFloatingTieredWithProrationPrice, newFloatingUnitWithProrationPrice, newFloatingGroupedAllocationPrice, newFloatingGroupedWithProratedMinimumPrice, newFloatingGroupedWithMeteredMinimumPrice, newFloatingMatrixWithDisplayNamePrice, newFloatingBulkWithProrationPrice, newFloatingGroupedTieredPackagePrice, additionalHeaders, additionalQueryParams) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "PriceCreateParams{newFloatingUnitPrice=$newFloatingUnitPrice, newFloatingPackagePrice=$newFloatingPackagePrice, newFloatingMatrixPrice=$newFloatingMatrixPrice, newFloatingMatrixWithAllocationPrice=$newFloatingMatrixWithAllocationPrice, newFloatingTieredPrice=$newFloatingTieredPrice, newFloatingTieredBpsPrice=$newFloatingTieredBpsPrice, newFloatingBpsPrice=$newFloatingBpsPrice, newFloatingBulkBpsPrice=$newFloatingBulkBpsPrice, newFloatingBulkPrice=$newFloatingBulkPrice, newFloatingThresholdTotalAmountPrice=$newFloatingThresholdTotalAmountPrice, newFloatingTieredPackagePrice=$newFloatingTieredPackagePrice, newFloatingGroupedTieredPrice=$newFloatingGroupedTieredPrice, newFloatingTieredWithMinimumPrice=$newFloatingTieredWithMinimumPrice, newFloatingPackageWithAllocationPrice=$newFloatingPackageWithAllocationPrice, newFloatingTieredPackageWithMinimumPrice=$newFloatingTieredPackageWithMinimumPrice, newFloatingUnitWithPercentPrice=$newFloatingUnitWithPercentPrice, newFloatingTieredWithProrationPrice=$newFloatingTieredWithProrationPrice, newFloatingUnitWithProrationPrice=$newFloatingUnitWithProrationPrice, newFloatingGroupedAllocationPrice=$newFloatingGroupedAllocationPrice, newFloatingGroupedWithProratedMinimumPrice=$newFloatingGroupedWithProratedMinimumPrice, newFloatingGroupedWithMeteredMinimumPrice=$newFloatingGroupedWithMeteredMinimumPrice, newFloatingMatrixWithDisplayNamePrice=$newFloatingMatrixWithDisplayNamePrice, newFloatingBulkWithProrationPrice=$newFloatingBulkWithProrationPrice, newFloatingGroupedTieredPackagePrice=$newFloatingGroupedTieredPackagePrice, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "PriceCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateParams.kt index c1207d3c..b9c3bd0c 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateParams.kt @@ -20,49 +20,45 @@ import java.util.Optional class PriceEvaluateParams constructor( private val priceId: String, - private val timeframeEnd: OffsetDateTime, - private val timeframeStart: OffsetDateTime, - private val customerId: String?, - private val externalCustomerId: String?, - private val filter: String?, - private val groupingKeys: List?, + private val body: PriceEvaluateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun priceId(): String = priceId - fun timeframeEnd(): OffsetDateTime = timeframeEnd + /** The exclusive upper bound for event timestamps */ + fun timeframeEnd(): OffsetDateTime = body.timeframeEnd() - fun timeframeStart(): OffsetDateTime = timeframeStart + /** The inclusive lower bound for event timestamps */ + fun timeframeStart(): OffsetDateTime = body.timeframeStart() - fun customerId(): Optional = Optional.ofNullable(customerId) + /** The ID of the customer to which this evaluation is scoped. */ + fun customerId(): Optional = body.customerId() - fun externalCustomerId(): Optional = Optional.ofNullable(externalCustomerId) + /** The external customer ID of the customer to which this evaluation is scoped. */ + fun externalCustomerId(): Optional = body.externalCustomerId() - fun filter(): Optional = Optional.ofNullable(filter) + /** + * A boolean [computed property](../guides/extensibility/advanced-metrics#computed-properties) + * used to filter the underlying billable metric + */ + fun filter(): Optional = body.filter() - fun groupingKeys(): Optional> = Optional.ofNullable(groupingKeys) + /** + * Properties (or + * [computed properties](../guides/extensibility/advanced-metrics#computed-properties)) used to + * group the underlying billable metric + */ + fun groupingKeys(): Optional> = body.groupingKeys() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): PriceEvaluateBody { - return PriceEvaluateBody( - timeframeEnd, - timeframeStart, - customerId, - externalCustomerId, - filter, - groupingKeys, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): PriceEvaluateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -136,7 +132,7 @@ constructor( private var customerId: String? = null private var externalCustomerId: String? = null private var filter: String? = null - private var groupingKeys: List? = null + private var groupingKeys: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -181,7 +177,16 @@ constructor( * used to group the underlying billable metric */ fun groupingKeys(groupingKeys: List) = apply { - this.groupingKeys = groupingKeys + this.groupingKeys = groupingKeys.toMutableList() + } + + /** + * Properties (or + * [computed properties](../guides/extensibility/advanced-metrics#computed-properties)) + * used to group the underlying billable metric + */ + fun addGroupingKey(groupingKey: String) = apply { + groupingKeys = (groupingKeys ?: mutableListOf()).apply { add(groupingKey) } } fun additionalProperties(additionalProperties: Map) = apply { @@ -244,46 +249,34 @@ constructor( class Builder { private var priceId: String? = null - private var timeframeEnd: OffsetDateTime? = null - private var timeframeStart: OffsetDateTime? = null - private var customerId: String? = null - private var externalCustomerId: String? = null - private var filter: String? = null - private var groupingKeys: MutableList = mutableListOf() + private var body: PriceEvaluateBody.Builder = PriceEvaluateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(priceEvaluateParams: PriceEvaluateParams) = apply { priceId = priceEvaluateParams.priceId - timeframeEnd = priceEvaluateParams.timeframeEnd - timeframeStart = priceEvaluateParams.timeframeStart - customerId = priceEvaluateParams.customerId - externalCustomerId = priceEvaluateParams.externalCustomerId - filter = priceEvaluateParams.filter - groupingKeys = priceEvaluateParams.groupingKeys?.toMutableList() ?: mutableListOf() + body = priceEvaluateParams.body.toBuilder() additionalHeaders = priceEvaluateParams.additionalHeaders.toBuilder() additionalQueryParams = priceEvaluateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = priceEvaluateParams.additionalBodyProperties.toMutableMap() } fun priceId(priceId: String) = apply { this.priceId = priceId } /** The exclusive upper bound for event timestamps */ - fun timeframeEnd(timeframeEnd: OffsetDateTime) = apply { this.timeframeEnd = timeframeEnd } + fun timeframeEnd(timeframeEnd: OffsetDateTime) = apply { body.timeframeEnd(timeframeEnd) } /** The inclusive lower bound for event timestamps */ fun timeframeStart(timeframeStart: OffsetDateTime) = apply { - this.timeframeStart = timeframeStart + body.timeframeStart(timeframeStart) } /** The ID of the customer to which this evaluation is scoped. */ - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: String) = apply { body.customerId(customerId) } /** The external customer ID of the customer to which this evaluation is scoped. */ fun externalCustomerId(externalCustomerId: String) = apply { - this.externalCustomerId = externalCustomerId + body.externalCustomerId(externalCustomerId) } /** @@ -291,24 +284,21 @@ constructor( * [computed property](../guides/extensibility/advanced-metrics#computed-properties) used to * filter the underlying billable metric */ - fun filter(filter: String) = apply { this.filter = filter } + fun filter(filter: String) = apply { body.filter(filter) } /** * Properties (or * [computed properties](../guides/extensibility/advanced-metrics#computed-properties)) used * to group the underlying billable metric */ - fun groupingKeys(groupingKeys: List) = apply { - this.groupingKeys.clear() - this.groupingKeys.addAll(groupingKeys) - } + fun groupingKeys(groupingKeys: List) = apply { body.groupingKeys(groupingKeys) } /** * Properties (or * [computed properties](../guides/extensibility/advanced-metrics#computed-properties)) used * to group the underlying billable metric */ - fun addGroupingKey(groupingKey: String) = apply { this.groupingKeys.add(groupingKey) } + fun addGroupingKey(groupingKey: String) = apply { body.addGroupingKey(groupingKey) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -409,39 +399,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): PriceEvaluateParams = PriceEvaluateParams( checkNotNull(priceId) { "`priceId` is required but was not set" }, - checkNotNull(timeframeEnd) { "`timeframeEnd` is required but was not set" }, - checkNotNull(timeframeStart) { "`timeframeStart` is required but was not set" }, - customerId, - externalCustomerId, - filter, - groupingKeys.toImmutable().ifEmpty { null }, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -450,11 +431,11 @@ constructor( return true } - return /* spotless:off */ other is PriceEvaluateParams && priceId == other.priceId && timeframeEnd == other.timeframeEnd && timeframeStart == other.timeframeStart && customerId == other.customerId && externalCustomerId == other.externalCustomerId && filter == other.filter && groupingKeys == other.groupingKeys && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is PriceEvaluateParams && priceId == other.priceId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(priceId, timeframeEnd, timeframeStart, customerId, externalCustomerId, filter, groupingKeys, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(priceId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "PriceEvaluateParams{priceId=$priceId, timeframeEnd=$timeframeEnd, timeframeStart=$timeframeStart, customerId=$customerId, externalCustomerId=$externalCustomerId, filter=$filter, groupingKeys=$groupingKeys, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "PriceEvaluateParams{priceId=$priceId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParams.kt index dc4d7f49..25a1dd2b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParams.kt @@ -19,26 +19,27 @@ import java.util.Optional class PriceExternalPriceIdUpdateParams constructor( private val externalPriceId: String, - private val metadata: Metadata?, + private val body: PriceExternalPriceIdUpdateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun externalPriceId(): String = externalPriceId - fun metadata(): Optional = Optional.ofNullable(metadata) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by setting + * the value to `null`, and the entire metadata mapping can be cleared by setting `metadata` to + * `null`. + */ + fun metadata(): Optional = body.metadata() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): PriceExternalPriceIdUpdateBody { - return PriceExternalPriceIdUpdateBody(metadata, additionalBodyProperties) - } + @JvmSynthetic internal fun getBody(): PriceExternalPriceIdUpdateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -150,21 +151,19 @@ constructor( class Builder { private var externalPriceId: String? = null - private var metadata: Metadata? = null + private var body: PriceExternalPriceIdUpdateBody.Builder = + PriceExternalPriceIdUpdateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(priceExternalPriceIdUpdateParams: PriceExternalPriceIdUpdateParams) = apply { externalPriceId = priceExternalPriceIdUpdateParams.externalPriceId - metadata = priceExternalPriceIdUpdateParams.metadata + body = priceExternalPriceIdUpdateParams.body.toBuilder() additionalHeaders = priceExternalPriceIdUpdateParams.additionalHeaders.toBuilder() additionalQueryParams = priceExternalPriceIdUpdateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - priceExternalPriceIdUpdateParams.additionalBodyProperties.toMutableMap() } fun externalPriceId(externalPriceId: String) = apply { @@ -176,7 +175,7 @@ constructor( * setting the value to `null`, and the entire metadata mapping can be cleared by setting * `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata) = apply { body.metadata(metadata) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -277,34 +276,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): PriceExternalPriceIdUpdateParams = PriceExternalPriceIdUpdateParams( checkNotNull(externalPriceId) { "`externalPriceId` is required but was not set" }, - metadata, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -385,11 +380,11 @@ constructor( return true } - return /* spotless:off */ other is PriceExternalPriceIdUpdateParams && externalPriceId == other.externalPriceId && metadata == other.metadata && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is PriceExternalPriceIdUpdateParams && externalPriceId == other.externalPriceId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(externalPriceId, metadata, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(externalPriceId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "PriceExternalPriceIdUpdateParams{externalPriceId=$externalPriceId, metadata=$metadata, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "PriceExternalPriceIdUpdateParams{externalPriceId=$externalPriceId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListParams.kt index de6b3e80..9429ae7d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceListParams.kt @@ -16,8 +16,13 @@ constructor( private val additionalQueryParams: QueryParams, ) { + /** + * Cursor for pagination. This can be populated by the `next_cursor` value returned from the + * initial request. + */ fun cursor(): Optional = Optional.ofNullable(cursor) + /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) fun _additionalHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceUpdateParams.kt index e2a79857..db5afcfa 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceUpdateParams.kt @@ -19,26 +19,27 @@ import java.util.Optional class PriceUpdateParams constructor( private val priceId: String, - private val metadata: Metadata?, + private val body: PriceUpdateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun priceId(): String = priceId - fun metadata(): Optional = Optional.ofNullable(metadata) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by setting + * the value to `null`, and the entire metadata mapping can be cleared by setting `metadata` to + * `null`. + */ + fun metadata(): Optional = body.metadata() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): PriceUpdateBody { - return PriceUpdateBody(metadata, additionalBodyProperties) - } + @JvmSynthetic internal fun getBody(): PriceUpdateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -148,18 +149,16 @@ constructor( class Builder { private var priceId: String? = null - private var metadata: Metadata? = null + private var body: PriceUpdateBody.Builder = PriceUpdateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(priceUpdateParams: PriceUpdateParams) = apply { priceId = priceUpdateParams.priceId - metadata = priceUpdateParams.metadata + body = priceUpdateParams.body.toBuilder() additionalHeaders = priceUpdateParams.additionalHeaders.toBuilder() additionalQueryParams = priceUpdateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = priceUpdateParams.additionalBodyProperties.toMutableMap() } fun priceId(priceId: String) = apply { this.priceId = priceId } @@ -169,7 +168,7 @@ constructor( * setting the value to `null`, and the entire metadata mapping can be cleared by setting * `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata) = apply { body.metadata(metadata) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -270,34 +269,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): PriceUpdateParams = PriceUpdateParams( checkNotNull(priceId) { "`priceId` is required but was not set" }, - metadata, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -378,11 +373,11 @@ constructor( return true } - return /* spotless:off */ other is PriceUpdateParams && priceId == other.priceId && metadata == other.metadata && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is PriceUpdateParams && priceId == other.priceId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(priceId, metadata, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(priceId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "PriceUpdateParams{priceId=$priceId, metadata=$metadata, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "PriceUpdateParams{priceId=$priceId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelParams.kt index 90a6fd2d..375ec935 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelParams.kt @@ -23,33 +23,29 @@ import java.util.Optional class SubscriptionCancelParams constructor( private val subscriptionId: String, - private val cancelOption: CancelOption, - private val cancellationDate: OffsetDateTime?, + private val body: SubscriptionCancelBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun subscriptionId(): String = subscriptionId - fun cancelOption(): CancelOption = cancelOption + /** Determines the timing of subscription cancellation */ + fun cancelOption(): CancelOption = body.cancelOption() - fun cancellationDate(): Optional = Optional.ofNullable(cancellationDate) + /** + * The date that the cancellation should take effect. This parameter can only be passed if the + * `cancel_option` is `requested_date`. + */ + fun cancellationDate(): Optional = body.cancellationDate() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): SubscriptionCancelBody { - return SubscriptionCancelBody( - cancelOption, - cancellationDate, - additionalBodyProperties, - ) - } + @JvmSynthetic internal fun getBody(): SubscriptionCancelBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -175,34 +171,29 @@ constructor( class Builder { private var subscriptionId: String? = null - private var cancelOption: CancelOption? = null - private var cancellationDate: OffsetDateTime? = null + private var body: SubscriptionCancelBody.Builder = SubscriptionCancelBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(subscriptionCancelParams: SubscriptionCancelParams) = apply { subscriptionId = subscriptionCancelParams.subscriptionId - cancelOption = subscriptionCancelParams.cancelOption - cancellationDate = subscriptionCancelParams.cancellationDate + body = subscriptionCancelParams.body.toBuilder() additionalHeaders = subscriptionCancelParams.additionalHeaders.toBuilder() additionalQueryParams = subscriptionCancelParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - subscriptionCancelParams.additionalBodyProperties.toMutableMap() } fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } /** Determines the timing of subscription cancellation */ - fun cancelOption(cancelOption: CancelOption) = apply { this.cancelOption = cancelOption } + fun cancelOption(cancelOption: CancelOption) = apply { body.cancelOption(cancelOption) } /** * The date that the cancellation should take effect. This parameter can only be passed if * the `cancel_option` is `requested_date`. */ fun cancellationDate(cancellationDate: OffsetDateTime) = apply { - this.cancellationDate = cancellationDate + body.cancellationDate(cancellationDate) } fun additionalHeaders(additionalHeaders: Headers) = apply { @@ -304,35 +295,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): SubscriptionCancelParams = SubscriptionCancelParams( checkNotNull(subscriptionId) { "`subscriptionId` is required but was not set" }, - checkNotNull(cancelOption) { "`cancelOption` is required but was not set" }, - cancellationDate, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -404,11 +390,11 @@ constructor( return true } - return /* spotless:off */ other is SubscriptionCancelParams && subscriptionId == other.subscriptionId && cancelOption == other.cancelOption && cancellationDate == other.cancellationDate && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionCancelParams && subscriptionId == other.subscriptionId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(subscriptionId, cancelOption, cancellationDate, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(subscriptionId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "SubscriptionCancelParams{subscriptionId=$subscriptionId, cancelOption=$cancelOption, cancellationDate=$cancellationDate, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "SubscriptionCancelParams{subscriptionId=$subscriptionId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateParams.kt index fd8eb1fc..afbb76fb 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateParams.kt @@ -33,149 +33,156 @@ import kotlin.jvm.optionals.getOrNull class SubscriptionCreateParams constructor( - private val addAdjustments: List?, - private val addPrices: List?, - private val alignBillingWithSubscriptionStartDate: Boolean?, - private val autoCollection: Boolean?, - private val awsRegion: String?, - private val billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration?, - private val couponRedemptionCode: String?, - private val creditsOverageRate: Double?, - private val customerId: String?, - private val defaultInvoiceMemo: String?, - private val endDate: OffsetDateTime?, - private val externalCustomerId: String?, - private val externalMarketplace: ExternalMarketplace?, - private val externalMarketplaceReportingId: String?, - private val externalPlanId: String?, - private val filter: String?, - private val initialPhaseOrder: Long?, - private val invoicingThreshold: String?, - private val metadata: Metadata?, - private val netTerms: Long?, - private val perCreditOverageAmount: Double?, - private val planId: String?, - private val planVersionNumber: Long?, - private val priceOverrides: List?, - private val removeAdjustments: List?, - private val removePrices: List?, - private val replaceAdjustments: List?, - private val replacePrices: List?, - private val startDate: OffsetDateTime?, - private val trialDurationDays: Long?, + private val body: SubscriptionCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun addAdjustments(): Optional> = Optional.ofNullable(addAdjustments) + /** + * Additional adjustments to be added to the subscription. (Only available for accounts that + * have migrated off of legacy subscription overrides) + */ + fun addAdjustments(): Optional> = body.addAdjustments() - fun addPrices(): Optional> = Optional.ofNullable(addPrices) + /** + * Additional prices to be added to the subscription. (Only available for accounts that have + * migrated off of legacy subscription overrides) + */ + fun addPrices(): Optional> = body.addPrices() fun alignBillingWithSubscriptionStartDate(): Optional = - Optional.ofNullable(alignBillingWithSubscriptionStartDate) + body.alignBillingWithSubscriptionStartDate() - fun autoCollection(): Optional = Optional.ofNullable(autoCollection) + /** + * Determines whether issued invoices for this subscription will automatically be charged with + * the saved payment method on the due date. If not specified, this defaults to the behavior + * configured for this customer. + */ + fun autoCollection(): Optional = body.autoCollection() - fun awsRegion(): Optional = Optional.ofNullable(awsRegion) + fun awsRegion(): Optional = body.awsRegion() fun billingCycleAnchorConfiguration(): Optional = - Optional.ofNullable(billingCycleAnchorConfiguration) + body.billingCycleAnchorConfiguration() - fun couponRedemptionCode(): Optional = Optional.ofNullable(couponRedemptionCode) + /** + * Redemption code to be used for this subscription. If the coupon cannot be found by its + * redemption code, or cannot be redeemed, an error response will be returned and the + * subscription creation or plan change will not be scheduled. + */ + fun couponRedemptionCode(): Optional = body.couponRedemptionCode() - fun creditsOverageRate(): Optional = Optional.ofNullable(creditsOverageRate) + fun creditsOverageRate(): Optional = body.creditsOverageRate() - fun customerId(): Optional = Optional.ofNullable(customerId) + fun customerId(): Optional = body.customerId() - fun defaultInvoiceMemo(): Optional = Optional.ofNullable(defaultInvoiceMemo) + /** + * Determines the default memo on this subscription's invoices. Note that if this is not + * provided, it is determined by the plan configuration. + */ + fun defaultInvoiceMemo(): Optional = body.defaultInvoiceMemo() - fun endDate(): Optional = Optional.ofNullable(endDate) + fun endDate(): Optional = body.endDate() - fun externalCustomerId(): Optional = Optional.ofNullable(externalCustomerId) + fun externalCustomerId(): Optional = body.externalCustomerId() - fun externalMarketplace(): Optional = - Optional.ofNullable(externalMarketplace) + fun externalMarketplace(): Optional = body.externalMarketplace() - fun externalMarketplaceReportingId(): Optional = - Optional.ofNullable(externalMarketplaceReportingId) + fun externalMarketplaceReportingId(): Optional = body.externalMarketplaceReportingId() - fun externalPlanId(): Optional = Optional.ofNullable(externalPlanId) + /** + * The external_plan_id of the plan that the given subscription should be switched to. Note that + * either this property or `plan_id` must be specified. + */ + fun externalPlanId(): Optional = body.externalPlanId() - fun filter(): Optional = Optional.ofNullable(filter) + /** + * An additional filter to apply to usage queries. This filter must be expressed as a boolean + * [computed property](../guides/extensibility/advanced-metrics#computed-properties). If null, + * usage queries will not include any additional filter. + */ + fun filter(): Optional = body.filter() - fun initialPhaseOrder(): Optional = Optional.ofNullable(initialPhaseOrder) + /** The phase of the plan to start with */ + fun initialPhaseOrder(): Optional = body.initialPhaseOrder() - fun invoicingThreshold(): Optional = Optional.ofNullable(invoicingThreshold) + /** + * When this subscription's accrued usage reaches this threshold, an invoice will be issued for + * the subscription. If not specified, invoices will only be issued at the end of the billing + * period. + */ + fun invoicingThreshold(): Optional = body.invoicingThreshold() - fun metadata(): Optional = Optional.ofNullable(metadata) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by setting + * the value to `null`, and the entire metadata mapping can be cleared by setting `metadata` to + * `null`. + */ + fun metadata(): Optional = body.metadata() - fun netTerms(): Optional = Optional.ofNullable(netTerms) + /** + * The net terms determines the difference between the invoice date and the issue date for the + * invoice. If you intend the invoice to be due on issue, set this to 0. If not provided, this + * defaults to the value specified in the plan. + */ + fun netTerms(): Optional = body.netTerms() - fun perCreditOverageAmount(): Optional = Optional.ofNullable(perCreditOverageAmount) + fun perCreditOverageAmount(): Optional = body.perCreditOverageAmount() - fun planId(): Optional = Optional.ofNullable(planId) + /** + * The plan that the given subscription should be switched to. Note that either this property or + * `external_plan_id` must be specified. + */ + fun planId(): Optional = body.planId() - fun planVersionNumber(): Optional = Optional.ofNullable(planVersionNumber) + /** + * Specifies which version of the plan to subscribe to. If null, the default version will be + * used. + */ + fun planVersionNumber(): Optional = body.planVersionNumber() - fun priceOverrides(): Optional> = Optional.ofNullable(priceOverrides) + /** Optionally provide a list of overrides for prices on the plan */ + fun priceOverrides(): Optional> = body.priceOverrides() - fun removeAdjustments(): Optional> = - Optional.ofNullable(removeAdjustments) + /** + * Plan adjustments to be removed from the subscription. (Only available for accounts that have + * migrated off of legacy subscription overrides) + */ + fun removeAdjustments(): Optional> = body.removeAdjustments() - fun removePrices(): Optional> = Optional.ofNullable(removePrices) + /** + * Plan prices to be removed from the subscription. (Only available for accounts that have + * migrated off of legacy subscription overrides) + */ + fun removePrices(): Optional> = body.removePrices() - fun replaceAdjustments(): Optional> = - Optional.ofNullable(replaceAdjustments) + /** + * Plan adjustments to be replaced with additional adjustments on the subscription. (Only + * available for accounts that have migrated off of legacy subscription overrides) + */ + fun replaceAdjustments(): Optional> = body.replaceAdjustments() - fun replacePrices(): Optional> = Optional.ofNullable(replacePrices) + /** + * Plan prices to be replaced with additional prices on the subscription. (Only available for + * accounts that have migrated off of legacy subscription overrides) + */ + fun replacePrices(): Optional> = body.replacePrices() - fun startDate(): Optional = Optional.ofNullable(startDate) + fun startDate(): Optional = body.startDate() - fun trialDurationDays(): Optional = Optional.ofNullable(trialDurationDays) + /** + * The duration of the trial period in days. If not provided, this defaults to the value + * specified in the plan. If `0` is provided, the trial on the plan will be skipped. + */ + fun trialDurationDays(): Optional = body.trialDurationDays() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): SubscriptionCreateBody { - return SubscriptionCreateBody( - addAdjustments, - addPrices, - alignBillingWithSubscriptionStartDate, - autoCollection, - awsRegion, - billingCycleAnchorConfiguration, - couponRedemptionCode, - creditsOverageRate, - customerId, - defaultInvoiceMemo, - endDate, - externalCustomerId, - externalMarketplace, - externalMarketplaceReportingId, - externalPlanId, - filter, - initialPhaseOrder, - invoicingThreshold, - metadata, - netTerms, - perCreditOverageAmount, - planId, - planVersionNumber, - priceOverrides, - removeAdjustments, - removePrices, - replaceAdjustments, - replacePrices, - startDate, - trialDurationDays, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): SubscriptionCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -405,8 +412,8 @@ constructor( class Builder { - private var addAdjustments: List? = null - private var addPrices: List? = null + private var addAdjustments: MutableList? = null + private var addPrices: MutableList? = null private var alignBillingWithSubscriptionStartDate: Boolean? = null private var autoCollection: Boolean? = null private var awsRegion: String? = null @@ -428,11 +435,11 @@ constructor( private var perCreditOverageAmount: Double? = null private var planId: String? = null private var planVersionNumber: Long? = null - private var priceOverrides: List? = null - private var removeAdjustments: List? = null - private var removePrices: List? = null - private var replaceAdjustments: List? = null - private var replacePrices: List? = null + private var priceOverrides: MutableList? = null + private var removeAdjustments: MutableList? = null + private var removePrices: MutableList? = null + private var replaceAdjustments: MutableList? = null + private var replacePrices: MutableList? = null private var startDate: OffsetDateTime? = null private var trialDurationDays: Long? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -480,14 +487,32 @@ constructor( * that have migrated off of legacy subscription overrides) */ fun addAdjustments(addAdjustments: List) = apply { - this.addAdjustments = addAdjustments + this.addAdjustments = addAdjustments.toMutableList() + } + + /** + * Additional adjustments to be added to the subscription. (Only available for accounts + * that have migrated off of legacy subscription overrides) + */ + fun addAddAdjustment(addAdjustment: AddAdjustment) = apply { + addAdjustments = (addAdjustments ?: mutableListOf()).apply { add(addAdjustment) } + } + + /** + * Additional prices to be added to the subscription. (Only available for accounts that + * have migrated off of legacy subscription overrides) + */ + fun addPrices(addPrices: List) = apply { + this.addPrices = addPrices.toMutableList() } /** * Additional prices to be added to the subscription. (Only available for accounts that * have migrated off of legacy subscription overrides) */ - fun addPrices(addPrices: List) = apply { this.addPrices = addPrices } + fun addAddPrice(addPrice: AddPrice) = apply { + addPrices = (addPrices ?: mutableListOf()).apply { add(addPrice) } + } fun alignBillingWithSubscriptionStartDate( alignBillingWithSubscriptionStartDate: Boolean @@ -611,7 +636,12 @@ constructor( /** Optionally provide a list of overrides for prices on the plan */ fun priceOverrides(priceOverrides: List) = apply { - this.priceOverrides = priceOverrides + this.priceOverrides = priceOverrides.toMutableList() + } + + /** Optionally provide a list of overrides for prices on the plan */ + fun addPriceOverride(priceOverride: JsonValue) = apply { + priceOverrides = (priceOverrides ?: mutableListOf()).apply { add(priceOverride) } } /** @@ -619,7 +649,16 @@ constructor( * that have migrated off of legacy subscription overrides) */ fun removeAdjustments(removeAdjustments: List) = apply { - this.removeAdjustments = removeAdjustments + this.removeAdjustments = removeAdjustments.toMutableList() + } + + /** + * Plan adjustments to be removed from the subscription. (Only available for accounts + * that have migrated off of legacy subscription overrides) + */ + fun addRemoveAdjustment(removeAdjustment: RemoveAdjustment) = apply { + removeAdjustments = + (removeAdjustments ?: mutableListOf()).apply { add(removeAdjustment) } } /** @@ -627,7 +666,15 @@ constructor( * have migrated off of legacy subscription overrides) */ fun removePrices(removePrices: List) = apply { - this.removePrices = removePrices + this.removePrices = removePrices.toMutableList() + } + + /** + * Plan prices to be removed from the subscription. (Only available for accounts that + * have migrated off of legacy subscription overrides) + */ + fun addRemovePrice(removePrice: RemovePrice) = apply { + removePrices = (removePrices ?: mutableListOf()).apply { add(removePrice) } } /** @@ -635,7 +682,16 @@ constructor( * (Only available for accounts that have migrated off of legacy subscription overrides) */ fun replaceAdjustments(replaceAdjustments: List) = apply { - this.replaceAdjustments = replaceAdjustments + this.replaceAdjustments = replaceAdjustments.toMutableList() + } + + /** + * Plan adjustments to be replaced with additional adjustments on the subscription. + * (Only available for accounts that have migrated off of legacy subscription overrides) + */ + fun addReplaceAdjustment(replaceAdjustment: ReplaceAdjustment) = apply { + replaceAdjustments = + (replaceAdjustments ?: mutableListOf()).apply { add(replaceAdjustment) } } /** @@ -643,7 +699,15 @@ constructor( * available for accounts that have migrated off of legacy subscription overrides) */ fun replacePrices(replacePrices: List) = apply { - this.replacePrices = replacePrices + this.replacePrices = replacePrices.toMutableList() + } + + /** + * Plan prices to be replaced with additional prices on the subscription. (Only + * available for accounts that have migrated off of legacy subscription overrides) + */ + fun addReplacePrice(replacePrice: ReplacePrice) = apply { + replacePrices = (replacePrices ?: mutableListOf()).apply { add(replacePrice) } } fun startDate(startDate: OffsetDateTime) = apply { this.startDate = startDate } @@ -739,83 +803,15 @@ constructor( @NoAutoDetect class Builder { - private var addAdjustments: MutableList = mutableListOf() - private var addPrices: MutableList = mutableListOf() - private var alignBillingWithSubscriptionStartDate: Boolean? = null - private var autoCollection: Boolean? = null - private var awsRegion: String? = null - private var billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration? = null - private var couponRedemptionCode: String? = null - private var creditsOverageRate: Double? = null - private var customerId: String? = null - private var defaultInvoiceMemo: String? = null - private var endDate: OffsetDateTime? = null - private var externalCustomerId: String? = null - private var externalMarketplace: ExternalMarketplace? = null - private var externalMarketplaceReportingId: String? = null - private var externalPlanId: String? = null - private var filter: String? = null - private var initialPhaseOrder: Long? = null - private var invoicingThreshold: String? = null - private var metadata: Metadata? = null - private var netTerms: Long? = null - private var perCreditOverageAmount: Double? = null - private var planId: String? = null - private var planVersionNumber: Long? = null - private var priceOverrides: MutableList = mutableListOf() - private var removeAdjustments: MutableList = mutableListOf() - private var removePrices: MutableList = mutableListOf() - private var replaceAdjustments: MutableList = mutableListOf() - private var replacePrices: MutableList = mutableListOf() - private var startDate: OffsetDateTime? = null - private var trialDurationDays: Long? = null + private var body: SubscriptionCreateBody.Builder = SubscriptionCreateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(subscriptionCreateParams: SubscriptionCreateParams) = apply { - addAdjustments = - subscriptionCreateParams.addAdjustments?.toMutableList() ?: mutableListOf() - addPrices = subscriptionCreateParams.addPrices?.toMutableList() ?: mutableListOf() - alignBillingWithSubscriptionStartDate = - subscriptionCreateParams.alignBillingWithSubscriptionStartDate - autoCollection = subscriptionCreateParams.autoCollection - awsRegion = subscriptionCreateParams.awsRegion - billingCycleAnchorConfiguration = - subscriptionCreateParams.billingCycleAnchorConfiguration - couponRedemptionCode = subscriptionCreateParams.couponRedemptionCode - creditsOverageRate = subscriptionCreateParams.creditsOverageRate - customerId = subscriptionCreateParams.customerId - defaultInvoiceMemo = subscriptionCreateParams.defaultInvoiceMemo - endDate = subscriptionCreateParams.endDate - externalCustomerId = subscriptionCreateParams.externalCustomerId - externalMarketplace = subscriptionCreateParams.externalMarketplace - externalMarketplaceReportingId = subscriptionCreateParams.externalMarketplaceReportingId - externalPlanId = subscriptionCreateParams.externalPlanId - filter = subscriptionCreateParams.filter - initialPhaseOrder = subscriptionCreateParams.initialPhaseOrder - invoicingThreshold = subscriptionCreateParams.invoicingThreshold - metadata = subscriptionCreateParams.metadata - netTerms = subscriptionCreateParams.netTerms - perCreditOverageAmount = subscriptionCreateParams.perCreditOverageAmount - planId = subscriptionCreateParams.planId - planVersionNumber = subscriptionCreateParams.planVersionNumber - priceOverrides = - subscriptionCreateParams.priceOverrides?.toMutableList() ?: mutableListOf() - removeAdjustments = - subscriptionCreateParams.removeAdjustments?.toMutableList() ?: mutableListOf() - removePrices = subscriptionCreateParams.removePrices?.toMutableList() ?: mutableListOf() - replaceAdjustments = - subscriptionCreateParams.replaceAdjustments?.toMutableList() ?: mutableListOf() - replacePrices = - subscriptionCreateParams.replacePrices?.toMutableList() ?: mutableListOf() - startDate = subscriptionCreateParams.startDate - trialDurationDays = subscriptionCreateParams.trialDurationDays + body = subscriptionCreateParams.body.toBuilder() additionalHeaders = subscriptionCreateParams.additionalHeaders.toBuilder() additionalQueryParams = subscriptionCreateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - subscriptionCreateParams.additionalBodyProperties.toMutableMap() } /** @@ -823,8 +819,7 @@ constructor( * have migrated off of legacy subscription overrides) */ fun addAdjustments(addAdjustments: List) = apply { - this.addAdjustments.clear() - this.addAdjustments.addAll(addAdjustments) + body.addAdjustments(addAdjustments) } /** @@ -832,27 +827,24 @@ constructor( * have migrated off of legacy subscription overrides) */ fun addAddAdjustment(addAdjustment: AddAdjustment) = apply { - this.addAdjustments.add(addAdjustment) + body.addAddAdjustment(addAdjustment) } /** * Additional prices to be added to the subscription. (Only available for accounts that have * migrated off of legacy subscription overrides) */ - fun addPrices(addPrices: List) = apply { - this.addPrices.clear() - this.addPrices.addAll(addPrices) - } + fun addPrices(addPrices: List) = apply { body.addPrices(addPrices) } /** * Additional prices to be added to the subscription. (Only available for accounts that have * migrated off of legacy subscription overrides) */ - fun addAddPrice(addPrice: AddPrice) = apply { this.addPrices.add(addPrice) } + fun addAddPrice(addPrice: AddPrice) = apply { body.addAddPrice(addPrice) } fun alignBillingWithSubscriptionStartDate(alignBillingWithSubscriptionStartDate: Boolean) = apply { - this.alignBillingWithSubscriptionStartDate = alignBillingWithSubscriptionStartDate + body.alignBillingWithSubscriptionStartDate(alignBillingWithSubscriptionStartDate) } /** @@ -860,13 +852,13 @@ constructor( * with the saved payment method on the due date. If not specified, this defaults to the * behavior configured for this customer. */ - fun autoCollection(autoCollection: Boolean) = apply { this.autoCollection = autoCollection } + fun autoCollection(autoCollection: Boolean) = apply { body.autoCollection(autoCollection) } - fun awsRegion(awsRegion: String) = apply { this.awsRegion = awsRegion } + fun awsRegion(awsRegion: String) = apply { body.awsRegion(awsRegion) } fun billingCycleAnchorConfiguration( billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration - ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } + ) = apply { body.billingCycleAnchorConfiguration(billingCycleAnchorConfiguration) } /** * Redemption code to be used for this subscription. If the coupon cannot be found by its @@ -874,42 +866,42 @@ constructor( * subscription creation or plan change will not be scheduled. */ fun couponRedemptionCode(couponRedemptionCode: String) = apply { - this.couponRedemptionCode = couponRedemptionCode + body.couponRedemptionCode(couponRedemptionCode) } fun creditsOverageRate(creditsOverageRate: Double) = apply { - this.creditsOverageRate = creditsOverageRate + body.creditsOverageRate(creditsOverageRate) } - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: String) = apply { body.customerId(customerId) } /** * Determines the default memo on this subscription's invoices. Note that if this is not * provided, it is determined by the plan configuration. */ fun defaultInvoiceMemo(defaultInvoiceMemo: String) = apply { - this.defaultInvoiceMemo = defaultInvoiceMemo + body.defaultInvoiceMemo(defaultInvoiceMemo) } - fun endDate(endDate: OffsetDateTime) = apply { this.endDate = endDate } + fun endDate(endDate: OffsetDateTime) = apply { body.endDate(endDate) } fun externalCustomerId(externalCustomerId: String) = apply { - this.externalCustomerId = externalCustomerId + body.externalCustomerId(externalCustomerId) } fun externalMarketplace(externalMarketplace: ExternalMarketplace) = apply { - this.externalMarketplace = externalMarketplace + body.externalMarketplace(externalMarketplace) } fun externalMarketplaceReportingId(externalMarketplaceReportingId: String) = apply { - this.externalMarketplaceReportingId = externalMarketplaceReportingId + body.externalMarketplaceReportingId(externalMarketplaceReportingId) } /** * The external_plan_id of the plan that the given subscription should be switched to. Note * that either this property or `plan_id` must be specified. */ - fun externalPlanId(externalPlanId: String) = apply { this.externalPlanId = externalPlanId } + fun externalPlanId(externalPlanId: String) = apply { body.externalPlanId(externalPlanId) } /** * An additional filter to apply to usage queries. This filter must be expressed as a @@ -917,11 +909,11 @@ constructor( * [computed property](../guides/extensibility/advanced-metrics#computed-properties). If * null, usage queries will not include any additional filter. */ - fun filter(filter: String) = apply { this.filter = filter } + fun filter(filter: String) = apply { body.filter(filter) } /** The phase of the plan to start with */ fun initialPhaseOrder(initialPhaseOrder: Long) = apply { - this.initialPhaseOrder = initialPhaseOrder + body.initialPhaseOrder(initialPhaseOrder) } /** @@ -930,7 +922,7 @@ constructor( * billing period. */ fun invoicingThreshold(invoicingThreshold: String) = apply { - this.invoicingThreshold = invoicingThreshold + body.invoicingThreshold(invoicingThreshold) } /** @@ -938,42 +930,41 @@ constructor( * setting the value to `null`, and the entire metadata mapping can be cleared by setting * `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata) = apply { body.metadata(metadata) } /** * The net terms determines the difference between the invoice date and the issue date for * the invoice. If you intend the invoice to be due on issue, set this to 0. If not * provided, this defaults to the value specified in the plan. */ - fun netTerms(netTerms: Long) = apply { this.netTerms = netTerms } + fun netTerms(netTerms: Long) = apply { body.netTerms(netTerms) } fun perCreditOverageAmount(perCreditOverageAmount: Double) = apply { - this.perCreditOverageAmount = perCreditOverageAmount + body.perCreditOverageAmount(perCreditOverageAmount) } /** * The plan that the given subscription should be switched to. Note that either this * property or `external_plan_id` must be specified. */ - fun planId(planId: String) = apply { this.planId = planId } + fun planId(planId: String) = apply { body.planId(planId) } /** * Specifies which version of the plan to subscribe to. If null, the default version will be * used. */ fun planVersionNumber(planVersionNumber: Long) = apply { - this.planVersionNumber = planVersionNumber + body.planVersionNumber(planVersionNumber) } /** Optionally provide a list of overrides for prices on the plan */ fun priceOverrides(priceOverrides: List) = apply { - this.priceOverrides.clear() - this.priceOverrides.addAll(priceOverrides) + body.priceOverrides(priceOverrides) } /** Optionally provide a list of overrides for prices on the plan */ fun addPriceOverride(priceOverride: JsonValue) = apply { - this.priceOverrides.add(priceOverride) + body.addPriceOverride(priceOverride) } /** @@ -981,8 +972,7 @@ constructor( * have migrated off of legacy subscription overrides) */ fun removeAdjustments(removeAdjustments: List) = apply { - this.removeAdjustments.clear() - this.removeAdjustments.addAll(removeAdjustments) + body.removeAdjustments(removeAdjustments) } /** @@ -990,7 +980,7 @@ constructor( * have migrated off of legacy subscription overrides) */ fun addRemoveAdjustment(removeAdjustment: RemoveAdjustment) = apply { - this.removeAdjustments.add(removeAdjustment) + body.addRemoveAdjustment(removeAdjustment) } /** @@ -998,23 +988,21 @@ constructor( * migrated off of legacy subscription overrides) */ fun removePrices(removePrices: List) = apply { - this.removePrices.clear() - this.removePrices.addAll(removePrices) + body.removePrices(removePrices) } /** * Plan prices to be removed from the subscription. (Only available for accounts that have * migrated off of legacy subscription overrides) */ - fun addRemovePrice(removePrice: RemovePrice) = apply { this.removePrices.add(removePrice) } + fun addRemovePrice(removePrice: RemovePrice) = apply { body.addRemovePrice(removePrice) } /** * Plan adjustments to be replaced with additional adjustments on the subscription. (Only * available for accounts that have migrated off of legacy subscription overrides) */ fun replaceAdjustments(replaceAdjustments: List) = apply { - this.replaceAdjustments.clear() - this.replaceAdjustments.addAll(replaceAdjustments) + body.replaceAdjustments(replaceAdjustments) } /** @@ -1022,7 +1010,7 @@ constructor( * available for accounts that have migrated off of legacy subscription overrides) */ fun addReplaceAdjustment(replaceAdjustment: ReplaceAdjustment) = apply { - this.replaceAdjustments.add(replaceAdjustment) + body.addReplaceAdjustment(replaceAdjustment) } /** @@ -1030,8 +1018,7 @@ constructor( * for accounts that have migrated off of legacy subscription overrides) */ fun replacePrices(replacePrices: List) = apply { - this.replacePrices.clear() - this.replacePrices.addAll(replacePrices) + body.replacePrices(replacePrices) } /** @@ -1039,17 +1026,17 @@ constructor( * for accounts that have migrated off of legacy subscription overrides) */ fun addReplacePrice(replacePrice: ReplacePrice) = apply { - this.replacePrices.add(replacePrice) + body.addReplacePrice(replacePrice) } - fun startDate(startDate: OffsetDateTime) = apply { this.startDate = startDate } + fun startDate(startDate: OffsetDateTime) = apply { body.startDate(startDate) } /** * The duration of the trial period in days. If not provided, this defaults to the value * specified in the plan. If `0` is provided, the trial on the plan will be skipped. */ fun trialDurationDays(trialDurationDays: Long) = apply { - this.trialDurationDays = trialDurationDays + body.trialDurationDays(trialDurationDays) } fun additionalHeaders(additionalHeaders: Headers) = apply { @@ -1151,62 +1138,29 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): SubscriptionCreateParams = SubscriptionCreateParams( - addAdjustments.toImmutable().ifEmpty { null }, - addPrices.toImmutable().ifEmpty { null }, - alignBillingWithSubscriptionStartDate, - autoCollection, - awsRegion, - billingCycleAnchorConfiguration, - couponRedemptionCode, - creditsOverageRate, - customerId, - defaultInvoiceMemo, - endDate, - externalCustomerId, - externalMarketplace, - externalMarketplaceReportingId, - externalPlanId, - filter, - initialPhaseOrder, - invoicingThreshold, - metadata, - netTerms, - perCreditOverageAmount, - planId, - planVersionNumber, - priceOverrides.toImmutable().ifEmpty { null }, - removeAdjustments.toImmutable().ifEmpty { null }, - removePrices.toImmutable().ifEmpty { null }, - replaceAdjustments.toImmutable().ifEmpty { null }, - replacePrices.toImmutable().ifEmpty { null }, - startDate, - trialDurationDays, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -1276,6 +1230,26 @@ constructor( /** The definition of a new adjustment to create and add to the subscription. */ fun adjustment(adjustment: Adjustment) = apply { this.adjustment = adjustment } + fun adjustment(newPercentageDiscount: Adjustment.NewPercentageDiscount) = apply { + this.adjustment = Adjustment.ofNewPercentageDiscount(newPercentageDiscount) + } + + fun adjustment(newUsageDiscount: Adjustment.NewUsageDiscount) = apply { + this.adjustment = Adjustment.ofNewUsageDiscount(newUsageDiscount) + } + + fun adjustment(newAmountDiscount: Adjustment.NewAmountDiscount) = apply { + this.adjustment = Adjustment.ofNewAmountDiscount(newAmountDiscount) + } + + fun adjustment(newMinimum: Adjustment.NewMinimum) = apply { + this.adjustment = Adjustment.ofNewMinimum(newMinimum) + } + + fun adjustment(newMaximum: Adjustment.NewMaximum) = apply { + this.adjustment = Adjustment.ofNewMaximum(newMaximum) + } + /** * The start date of the adjustment interval. This is the date that the adjustment will * start affecting prices on the subscription. If null, the adjustment will start when @@ -1549,7 +1523,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var percentageDiscount: Double? = null @@ -1567,7 +1541,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -1736,7 +1716,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var usageDiscount: Double? = null @@ -1753,7 +1733,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -1922,7 +1908,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var amountDiscount: String? = null @@ -1939,7 +1925,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -2112,7 +2104,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var minimumAmount: String? = null @@ -2131,7 +2123,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -2304,7 +2302,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var maximumAmount: String? = null @@ -2321,7 +2319,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -2554,7 +2558,7 @@ constructor( private var planPhaseOrder: Long? = null private var minimumAmount: String? = null private var maximumAmount: String? = null - private var discounts: List? = null + private var discounts: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -2582,6 +2586,126 @@ constructor( /** The definition of a new price to create and add to the subscription. */ fun price(price: Price) = apply { this.price = price } + fun price(newSubscriptionUnitPrice: Price.NewSubscriptionUnitPrice) = apply { + this.price = Price.ofNewSubscriptionUnitPrice(newSubscriptionUnitPrice) + } + + fun price(newSubscriptionPackagePrice: Price.NewSubscriptionPackagePrice) = apply { + this.price = Price.ofNewSubscriptionPackagePrice(newSubscriptionPackagePrice) + } + + fun price(newSubscriptionMatrixPrice: Price.NewSubscriptionMatrixPrice) = apply { + this.price = Price.ofNewSubscriptionMatrixPrice(newSubscriptionMatrixPrice) + } + + fun price(newSubscriptionTieredPrice: Price.NewSubscriptionTieredPrice) = apply { + this.price = Price.ofNewSubscriptionTieredPrice(newSubscriptionTieredPrice) + } + + fun price(newSubscriptionTieredBpsPrice: Price.NewSubscriptionTieredBpsPrice) = apply { + this.price = Price.ofNewSubscriptionTieredBpsPrice(newSubscriptionTieredBpsPrice) + } + + fun price(newSubscriptionBpsPrice: Price.NewSubscriptionBpsPrice) = apply { + this.price = Price.ofNewSubscriptionBpsPrice(newSubscriptionBpsPrice) + } + + fun price(newSubscriptionBulkBpsPrice: Price.NewSubscriptionBulkBpsPrice) = apply { + this.price = Price.ofNewSubscriptionBulkBpsPrice(newSubscriptionBulkBpsPrice) + } + + fun price(newSubscriptionBulkPrice: Price.NewSubscriptionBulkPrice) = apply { + this.price = Price.ofNewSubscriptionBulkPrice(newSubscriptionBulkPrice) + } + + fun price( + newSubscriptionThresholdTotalAmountPrice: + Price.NewSubscriptionThresholdTotalAmountPrice + ) = apply { + this.price = + Price.ofNewSubscriptionThresholdTotalAmountPrice( + newSubscriptionThresholdTotalAmountPrice + ) + } + + fun price(newSubscriptionTieredPackagePrice: Price.NewSubscriptionTieredPackagePrice) = + apply { + this.price = + Price.ofNewSubscriptionTieredPackagePrice(newSubscriptionTieredPackagePrice) + } + + fun price( + newSubscriptionTieredWithMinimumPrice: Price.NewSubscriptionTieredWithMinimumPrice + ) = apply { + this.price = + Price.ofNewSubscriptionTieredWithMinimumPrice( + newSubscriptionTieredWithMinimumPrice + ) + } + + fun price( + newSubscriptionUnitWithPercentPrice: Price.NewSubscriptionUnitWithPercentPrice + ) = apply { + this.price = + Price.ofNewSubscriptionUnitWithPercentPrice(newSubscriptionUnitWithPercentPrice) + } + + fun price( + newSubscriptionPackageWithAllocationPrice: + Price.NewSubscriptionPackageWithAllocationPrice + ) = apply { + this.price = + Price.ofNewSubscriptionPackageWithAllocationPrice( + newSubscriptionPackageWithAllocationPrice + ) + } + + fun price( + newSubscriptionTierWithProrationPrice: Price.NewSubscriptionTierWithProrationPrice + ) = apply { + this.price = + Price.ofNewSubscriptionTierWithProrationPrice( + newSubscriptionTierWithProrationPrice + ) + } + + fun price( + newSubscriptionUnitWithProrationPrice: Price.NewSubscriptionUnitWithProrationPrice + ) = apply { + this.price = + Price.ofNewSubscriptionUnitWithProrationPrice( + newSubscriptionUnitWithProrationPrice + ) + } + + fun price( + newSubscriptionGroupedAllocationPrice: Price.NewSubscriptionGroupedAllocationPrice + ) = apply { + this.price = + Price.ofNewSubscriptionGroupedAllocationPrice( + newSubscriptionGroupedAllocationPrice + ) + } + + fun price( + newSubscriptionGroupedWithProratedMinimumPrice: + Price.NewSubscriptionGroupedWithProratedMinimumPrice + ) = apply { + this.price = + Price.ofNewSubscriptionGroupedWithProratedMinimumPrice( + newSubscriptionGroupedWithProratedMinimumPrice + ) + } + + fun price( + newSubscriptionBulkWithProrationPrice: Price.NewSubscriptionBulkWithProrationPrice + ) = apply { + this.price = + Price.ofNewSubscriptionBulkWithProrationPrice( + newSubscriptionBulkWithProrationPrice + ) + } + /** * The start date of the price interval. This is the date that the price will start * billing on the subscription. If null, billing will start when the phase or @@ -2616,7 +2740,17 @@ constructor( * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for this * price. */ - fun discounts(discounts: List) = apply { this.discounts = discounts } + fun discounts(discounts: List) = apply { + this.discounts = discounts.toMutableList() + } + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for this + * price. + */ + fun addDiscount(discount: Discount) = apply { + discounts = (discounts ?: mutableListOf()).apply { add(discount) } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5964,9 +6098,9 @@ constructor( class Builder { - private var dimensions: List? = null + private var dimensions: MutableList? = null private var defaultUnitAmount: String? = null - private var matrixValues: List? = null + private var matrixValues: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -5980,7 +6114,12 @@ constructor( /** One or two event property values to evaluate matrix groups by */ fun dimensions(dimensions: List) = apply { - this.dimensions = dimensions + this.dimensions = dimensions.toMutableList() + } + + /** One or two event property values to evaluate matrix groups by */ + fun addDimension(dimension: String) = apply { + dimensions = (dimensions ?: mutableListOf()).apply { add(dimension) } } /** @@ -5993,7 +6132,13 @@ constructor( /** Matrix values for specified matrix grouping keys */ fun matrixValues(matrixValues: List) = apply { - this.matrixValues = matrixValues + this.matrixValues = matrixValues.toMutableList() + } + + /** Matrix values for specified matrix grouping keys */ + fun addMatrixValue(matrixValue: MatrixValue) = apply { + matrixValues = + (matrixValues ?: mutableListOf()).apply { add(matrixValue) } } fun additionalProperties(additionalProperties: Map) = @@ -6072,7 +6217,7 @@ constructor( class Builder { private var unitAmount: String? = null - private var dimensionValues: List? = null + private var dimensionValues: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -6095,7 +6240,19 @@ constructor( * cloud region and an instance tier. */ fun dimensionValues(dimensionValues: List) = apply { - this.dimensionValues = dimensionValues + this.dimensionValues = dimensionValues.toMutableList() + } + + /** + * One or two matrix keys to filter usage to this Matrix value by. For + * example, ["region", "tier"] could be used to filter cloud usage by a + * cloud region and an instance tier. + */ + fun addDimensionValue(dimensionValue: String) = apply { + dimensionValues = + (dimensionValues ?: mutableListOf()).apply { + add(dimensionValue) + } } fun additionalProperties(additionalProperties: Map) = @@ -7106,7 +7263,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -7119,7 +7276,14 @@ constructor( /** * Tiers for rating based on total usage quantities into the specified tier */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** + * Tiers for rating based on total usage quantities into the specified tier + */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { @@ -8177,7 +8341,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -8192,7 +8356,15 @@ constructor( * Tiers for a Graduated BPS pricing model, where usage is bucketed into * specified tiers */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** + * Tiers for a Graduated BPS pricing model, where usage is bucketed into + * specified tiers + */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { @@ -10075,7 +10247,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -10089,7 +10261,15 @@ constructor( * Tiers for a bulk BPS pricing model where all usage is aggregated to a * single tier based on total volume */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** + * Tiers for a bulk BPS pricing model where all usage is aggregated to a + * single tier based on total volume + */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { @@ -11131,7 +11311,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -11142,7 +11322,12 @@ constructor( } /** Bulk tiers for rating based on total usage volume */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** Bulk tiers for rating based on total usage volume */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { @@ -21787,6 +21972,26 @@ constructor( /** The definition of a new adjustment to create and add to the subscription. */ fun adjustment(adjustment: Adjustment) = apply { this.adjustment = adjustment } + fun adjustment(newPercentageDiscount: Adjustment.NewPercentageDiscount) = apply { + this.adjustment = Adjustment.ofNewPercentageDiscount(newPercentageDiscount) + } + + fun adjustment(newUsageDiscount: Adjustment.NewUsageDiscount) = apply { + this.adjustment = Adjustment.ofNewUsageDiscount(newUsageDiscount) + } + + fun adjustment(newAmountDiscount: Adjustment.NewAmountDiscount) = apply { + this.adjustment = Adjustment.ofNewAmountDiscount(newAmountDiscount) + } + + fun adjustment(newMinimum: Adjustment.NewMinimum) = apply { + this.adjustment = Adjustment.ofNewMinimum(newMinimum) + } + + fun adjustment(newMaximum: Adjustment.NewMaximum) = apply { + this.adjustment = Adjustment.ofNewMaximum(newMaximum) + } + /** The id of the adjustment on the plan to replace in the subscription. */ fun replacesAdjustmentId(replacesAdjustmentId: String) = apply { this.replacesAdjustmentId = replacesAdjustmentId @@ -22046,7 +22251,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var percentageDiscount: Double? = null @@ -22064,7 +22269,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -22233,7 +22444,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var usageDiscount: Double? = null @@ -22250,7 +22461,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -22419,7 +22636,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var amountDiscount: String? = null @@ -22436,7 +22653,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -22609,7 +22832,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var minimumAmount: String? = null @@ -22628,7 +22851,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -22801,7 +23030,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var maximumAmount: String? = null @@ -22818,7 +23047,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -23039,7 +23274,7 @@ constructor( private var replacesPriceId: String? = null private var minimumAmount: String? = null private var maximumAmount: String? = null - private var discounts: List? = null + private var discounts: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -23066,6 +23301,126 @@ constructor( /** The definition of a new price to create and add to the subscription. */ fun price(price: Price) = apply { this.price = price } + fun price(newSubscriptionUnitPrice: Price.NewSubscriptionUnitPrice) = apply { + this.price = Price.ofNewSubscriptionUnitPrice(newSubscriptionUnitPrice) + } + + fun price(newSubscriptionPackagePrice: Price.NewSubscriptionPackagePrice) = apply { + this.price = Price.ofNewSubscriptionPackagePrice(newSubscriptionPackagePrice) + } + + fun price(newSubscriptionMatrixPrice: Price.NewSubscriptionMatrixPrice) = apply { + this.price = Price.ofNewSubscriptionMatrixPrice(newSubscriptionMatrixPrice) + } + + fun price(newSubscriptionTieredPrice: Price.NewSubscriptionTieredPrice) = apply { + this.price = Price.ofNewSubscriptionTieredPrice(newSubscriptionTieredPrice) + } + + fun price(newSubscriptionTieredBpsPrice: Price.NewSubscriptionTieredBpsPrice) = apply { + this.price = Price.ofNewSubscriptionTieredBpsPrice(newSubscriptionTieredBpsPrice) + } + + fun price(newSubscriptionBpsPrice: Price.NewSubscriptionBpsPrice) = apply { + this.price = Price.ofNewSubscriptionBpsPrice(newSubscriptionBpsPrice) + } + + fun price(newSubscriptionBulkBpsPrice: Price.NewSubscriptionBulkBpsPrice) = apply { + this.price = Price.ofNewSubscriptionBulkBpsPrice(newSubscriptionBulkBpsPrice) + } + + fun price(newSubscriptionBulkPrice: Price.NewSubscriptionBulkPrice) = apply { + this.price = Price.ofNewSubscriptionBulkPrice(newSubscriptionBulkPrice) + } + + fun price( + newSubscriptionThresholdTotalAmountPrice: + Price.NewSubscriptionThresholdTotalAmountPrice + ) = apply { + this.price = + Price.ofNewSubscriptionThresholdTotalAmountPrice( + newSubscriptionThresholdTotalAmountPrice + ) + } + + fun price(newSubscriptionTieredPackagePrice: Price.NewSubscriptionTieredPackagePrice) = + apply { + this.price = + Price.ofNewSubscriptionTieredPackagePrice(newSubscriptionTieredPackagePrice) + } + + fun price( + newSubscriptionTieredWithMinimumPrice: Price.NewSubscriptionTieredWithMinimumPrice + ) = apply { + this.price = + Price.ofNewSubscriptionTieredWithMinimumPrice( + newSubscriptionTieredWithMinimumPrice + ) + } + + fun price( + newSubscriptionUnitWithPercentPrice: Price.NewSubscriptionUnitWithPercentPrice + ) = apply { + this.price = + Price.ofNewSubscriptionUnitWithPercentPrice(newSubscriptionUnitWithPercentPrice) + } + + fun price( + newSubscriptionPackageWithAllocationPrice: + Price.NewSubscriptionPackageWithAllocationPrice + ) = apply { + this.price = + Price.ofNewSubscriptionPackageWithAllocationPrice( + newSubscriptionPackageWithAllocationPrice + ) + } + + fun price( + newSubscriptionTierWithProrationPrice: Price.NewSubscriptionTierWithProrationPrice + ) = apply { + this.price = + Price.ofNewSubscriptionTierWithProrationPrice( + newSubscriptionTierWithProrationPrice + ) + } + + fun price( + newSubscriptionUnitWithProrationPrice: Price.NewSubscriptionUnitWithProrationPrice + ) = apply { + this.price = + Price.ofNewSubscriptionUnitWithProrationPrice( + newSubscriptionUnitWithProrationPrice + ) + } + + fun price( + newSubscriptionGroupedAllocationPrice: Price.NewSubscriptionGroupedAllocationPrice + ) = apply { + this.price = + Price.ofNewSubscriptionGroupedAllocationPrice( + newSubscriptionGroupedAllocationPrice + ) + } + + fun price( + newSubscriptionGroupedWithProratedMinimumPrice: + Price.NewSubscriptionGroupedWithProratedMinimumPrice + ) = apply { + this.price = + Price.ofNewSubscriptionGroupedWithProratedMinimumPrice( + newSubscriptionGroupedWithProratedMinimumPrice + ) + } + + fun price( + newSubscriptionBulkWithProrationPrice: Price.NewSubscriptionBulkWithProrationPrice + ) = apply { + this.price = + Price.ofNewSubscriptionBulkWithProrationPrice( + newSubscriptionBulkWithProrationPrice + ) + } + /** The new quantity of the price, if the price is a fixed price. */ fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { this.fixedPriceQuantity = fixedPriceQuantity @@ -23092,7 +23447,17 @@ constructor( * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for the * replacement price. */ - fun discounts(discounts: List) = apply { this.discounts = discounts } + fun discounts(discounts: List) = apply { + this.discounts = discounts.toMutableList() + } + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for the + * replacement price. + */ + fun addDiscount(discount: Discount) = apply { + discounts = (discounts ?: mutableListOf()).apply { add(discount) } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -26441,9 +26806,9 @@ constructor( class Builder { - private var dimensions: List? = null + private var dimensions: MutableList? = null private var defaultUnitAmount: String? = null - private var matrixValues: List? = null + private var matrixValues: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -26457,7 +26822,12 @@ constructor( /** One or two event property values to evaluate matrix groups by */ fun dimensions(dimensions: List) = apply { - this.dimensions = dimensions + this.dimensions = dimensions.toMutableList() + } + + /** One or two event property values to evaluate matrix groups by */ + fun addDimension(dimension: String) = apply { + dimensions = (dimensions ?: mutableListOf()).apply { add(dimension) } } /** @@ -26470,7 +26840,13 @@ constructor( /** Matrix values for specified matrix grouping keys */ fun matrixValues(matrixValues: List) = apply { - this.matrixValues = matrixValues + this.matrixValues = matrixValues.toMutableList() + } + + /** Matrix values for specified matrix grouping keys */ + fun addMatrixValue(matrixValue: MatrixValue) = apply { + matrixValues = + (matrixValues ?: mutableListOf()).apply { add(matrixValue) } } fun additionalProperties(additionalProperties: Map) = @@ -26549,7 +26925,7 @@ constructor( class Builder { private var unitAmount: String? = null - private var dimensionValues: List? = null + private var dimensionValues: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -26572,7 +26948,19 @@ constructor( * cloud region and an instance tier. */ fun dimensionValues(dimensionValues: List) = apply { - this.dimensionValues = dimensionValues + this.dimensionValues = dimensionValues.toMutableList() + } + + /** + * One or two matrix keys to filter usage to this Matrix value by. For + * example, ["region", "tier"] could be used to filter cloud usage by a + * cloud region and an instance tier. + */ + fun addDimensionValue(dimensionValue: String) = apply { + dimensionValues = + (dimensionValues ?: mutableListOf()).apply { + add(dimensionValue) + } } fun additionalProperties(additionalProperties: Map) = @@ -27583,7 +27971,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -27596,7 +27984,14 @@ constructor( /** * Tiers for rating based on total usage quantities into the specified tier */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** + * Tiers for rating based on total usage quantities into the specified tier + */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { @@ -28654,7 +29049,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -28669,7 +29064,15 @@ constructor( * Tiers for a Graduated BPS pricing model, where usage is bucketed into * specified tiers */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** + * Tiers for a Graduated BPS pricing model, where usage is bucketed into + * specified tiers + */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { @@ -30552,7 +30955,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -30566,7 +30969,15 @@ constructor( * Tiers for a bulk BPS pricing model where all usage is aggregated to a * single tier based on total volume */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** + * Tiers for a bulk BPS pricing model where all usage is aggregated to a + * single tier based on total volume + */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { @@ -31608,7 +32019,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -31619,7 +32030,12 @@ constructor( } /** Bulk tiers for rating based on total usage volume */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** Bulk tiers for rating based on total usage volume */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { @@ -41790,11 +42206,11 @@ constructor( return true } - return /* spotless:off */ other is SubscriptionCreateParams && addAdjustments == other.addAdjustments && addPrices == other.addPrices && alignBillingWithSubscriptionStartDate == other.alignBillingWithSubscriptionStartDate && autoCollection == other.autoCollection && awsRegion == other.awsRegion && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && couponRedemptionCode == other.couponRedemptionCode && creditsOverageRate == other.creditsOverageRate && customerId == other.customerId && defaultInvoiceMemo == other.defaultInvoiceMemo && endDate == other.endDate && externalCustomerId == other.externalCustomerId && externalMarketplace == other.externalMarketplace && externalMarketplaceReportingId == other.externalMarketplaceReportingId && externalPlanId == other.externalPlanId && filter == other.filter && initialPhaseOrder == other.initialPhaseOrder && invoicingThreshold == other.invoicingThreshold && metadata == other.metadata && netTerms == other.netTerms && perCreditOverageAmount == other.perCreditOverageAmount && planId == other.planId && planVersionNumber == other.planVersionNumber && priceOverrides == other.priceOverrides && removeAdjustments == other.removeAdjustments && removePrices == other.removePrices && replaceAdjustments == other.replaceAdjustments && replacePrices == other.replacePrices && startDate == other.startDate && trialDurationDays == other.trialDurationDays && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionCreateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(addAdjustments, addPrices, alignBillingWithSubscriptionStartDate, autoCollection, awsRegion, billingCycleAnchorConfiguration, couponRedemptionCode, creditsOverageRate, customerId, defaultInvoiceMemo, endDate, externalCustomerId, externalMarketplace, externalMarketplaceReportingId, externalPlanId, filter, initialPhaseOrder, invoicingThreshold, metadata, netTerms, perCreditOverageAmount, planId, planVersionNumber, priceOverrides, removeAdjustments, removePrices, replaceAdjustments, replacePrices, startDate, trialDurationDays, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "SubscriptionCreateParams{addAdjustments=$addAdjustments, addPrices=$addPrices, alignBillingWithSubscriptionStartDate=$alignBillingWithSubscriptionStartDate, autoCollection=$autoCollection, awsRegion=$awsRegion, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, couponRedemptionCode=$couponRedemptionCode, creditsOverageRate=$creditsOverageRate, customerId=$customerId, defaultInvoiceMemo=$defaultInvoiceMemo, endDate=$endDate, externalCustomerId=$externalCustomerId, externalMarketplace=$externalMarketplace, externalMarketplaceReportingId=$externalMarketplaceReportingId, externalPlanId=$externalPlanId, filter=$filter, initialPhaseOrder=$initialPhaseOrder, invoicingThreshold=$invoicingThreshold, metadata=$metadata, netTerms=$netTerms, perCreditOverageAmount=$perCreditOverageAmount, planId=$planId, planVersionNumber=$planVersionNumber, priceOverrides=$priceOverrides, removeAdjustments=$removeAdjustments, removePrices=$removePrices, replaceAdjustments=$replaceAdjustments, replacePrices=$replacePrices, startDate=$startDate, trialDurationDays=$trialDurationDays, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "SubscriptionCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchCostsParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchCostsParams.kt index 4561da61..5f9c9537 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchCostsParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchCostsParams.kt @@ -27,12 +27,20 @@ constructor( fun subscriptionId(): String = subscriptionId + /** The currency or custom pricing unit to use. */ fun currency(): Optional = Optional.ofNullable(currency) + /** Costs returned are exclusive of `timeframe_end`. */ fun timeframeEnd(): Optional = Optional.ofNullable(timeframeEnd) + /** Costs returned are inclusive of `timeframe_start`. */ fun timeframeStart(): Optional = Optional.ofNullable(timeframeStart) + /** + * Controls whether Orb returns cumulative costs since the start of the billing period, or + * incremental day-by-day costs. If your customer has minimums or discounts, it's strongly + * recommended that you use the default cumulative behavior. + */ fun viewMode(): Optional = Optional.ofNullable(viewMode) fun _additionalHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchScheduleParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchScheduleParams.kt index 6caf711c..81710f22 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchScheduleParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchScheduleParams.kt @@ -25,8 +25,13 @@ constructor( fun subscriptionId(): String = subscriptionId + /** + * Cursor for pagination. This can be populated by the `next_cursor` value returned from the + * initial request. + */ fun cursor(): Optional = Optional.ofNullable(cursor) + /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) fun startDateGt(): Optional = Optional.ofNullable(startDateGt) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchUsageParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchUsageParams.kt index b47bedd2..894bd445 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchUsageParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionFetchUsageParams.kt @@ -33,24 +33,38 @@ constructor( fun subscriptionId(): String = subscriptionId + /** + * When specified in conjunction with `group_by`, this parameter filters usage to a single + * billable metric. Note that both `group_by` and `billable_metric_id` must be specified + * together. + */ fun billableMetricId(): Optional = Optional.ofNullable(billableMetricId) fun firstDimensionKey(): Optional = Optional.ofNullable(firstDimensionKey) fun firstDimensionValue(): Optional = Optional.ofNullable(firstDimensionValue) + /** This determines the windowing of usage reporting. */ fun granularity(): Optional = Optional.ofNullable(granularity) + /** Groups per-price usage by the key provided. */ fun groupBy(): Optional = Optional.ofNullable(groupBy) fun secondDimensionKey(): Optional = Optional.ofNullable(secondDimensionKey) fun secondDimensionValue(): Optional = Optional.ofNullable(secondDimensionValue) + /** Usage returned is exclusive of `timeframe_end`. */ fun timeframeEnd(): Optional = Optional.ofNullable(timeframeEnd) + /** Usage returned is inclusive of `timeframe_start`. */ fun timeframeStart(): Optional = Optional.ofNullable(timeframeStart) + /** + * Controls whether Orb returns cumulative usage since the start of the billing period, or + * incremental day-by-day usage. If your customer has minimums or discounts, it's strongly + * recommended that you use the default cumulative behavior. + */ fun viewMode(): Optional = Optional.ofNullable(viewMode) fun _additionalHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListParams.kt index 80cf559b..3ff95a95 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListParams.kt @@ -38,12 +38,17 @@ constructor( fun createdAtLte(): Optional = Optional.ofNullable(createdAtLte) + /** + * Cursor for pagination. This can be populated by the `next_cursor` value returned from the + * initial request. + */ fun cursor(): Optional = Optional.ofNullable(cursor) fun customerId(): Optional> = Optional.ofNullable(customerId) fun externalCustomerId(): Optional = Optional.ofNullable(externalCustomerId) + /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) fun status(): Optional = Optional.ofNullable(status) @@ -107,7 +112,7 @@ constructor( private var createdAtLt: OffsetDateTime? = null private var createdAtLte: OffsetDateTime? = null private var cursor: String? = null - private var customerId: MutableList = mutableListOf() + private var customerId: MutableList? = null private var externalCustomerId: String? = null private var limit: Long? = null private var status: Status? = null @@ -121,7 +126,7 @@ constructor( createdAtLt = subscriptionListParams.createdAtLt createdAtLte = subscriptionListParams.createdAtLte cursor = subscriptionListParams.cursor - customerId = subscriptionListParams.customerId?.toMutableList() ?: mutableListOf() + customerId = subscriptionListParams.customerId?.toMutableList() externalCustomerId = subscriptionListParams.externalCustomerId limit = subscriptionListParams.limit status = subscriptionListParams.status @@ -144,11 +149,12 @@ constructor( fun cursor(cursor: String) = apply { this.cursor = cursor } fun customerId(customerId: List) = apply { - this.customerId.clear() - this.customerId.addAll(customerId) + this.customerId = customerId.toMutableList() } - fun addCustomerId(customerId: String) = apply { this.customerId.add(customerId) } + fun addCustomerId(customerId: String) = apply { + this.customerId = (this.customerId ?: mutableListOf()).apply { add(customerId) } + } fun externalCustomerId(externalCustomerId: String) = apply { this.externalCustomerId = externalCustomerId @@ -264,7 +270,7 @@ constructor( createdAtLt, createdAtLte, cursor, - customerId.toImmutable().ifEmpty { null }, + customerId?.toImmutable(), externalCustomerId, limit, status, diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt index 4d5175f3..5f621d80 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt @@ -34,41 +34,32 @@ import kotlin.jvm.optionals.getOrNull class SubscriptionPriceIntervalsParams constructor( private val subscriptionId: String, - private val add: List?, - private val addAdjustments: List?, - private val edit: List?, - private val editAdjustments: List?, + private val body: SubscriptionPriceIntervalsBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun subscriptionId(): String = subscriptionId - fun add(): Optional> = Optional.ofNullable(add) + /** A list of price intervals to add to the subscription. */ + fun add(): Optional> = body.add() - fun addAdjustments(): Optional> = Optional.ofNullable(addAdjustments) + /** A list of adjustments to add to the subscription. */ + fun addAdjustments(): Optional> = body.addAdjustments() - fun edit(): Optional> = Optional.ofNullable(edit) + /** A list of price intervals to edit on the subscription. */ + fun edit(): Optional> = body.edit() - fun editAdjustments(): Optional> = Optional.ofNullable(editAdjustments) + /** A list of adjustments to edit on the subscription. */ + fun editAdjustments(): Optional> = body.editAdjustments() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): SubscriptionPriceIntervalsBody { - return SubscriptionPriceIntervalsBody( - add, - addAdjustments, - edit, - editAdjustments, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): SubscriptionPriceIntervalsBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -120,10 +111,10 @@ constructor( class Builder { - private var add: List? = null - private var addAdjustments: List? = null - private var edit: List? = null - private var editAdjustments: List? = null + private var add: MutableList? = null + private var addAdjustments: MutableList? = null + private var edit: MutableList? = null + private var editAdjustments: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -139,19 +130,39 @@ constructor( } /** A list of price intervals to add to the subscription. */ - fun add(add: List) = apply { this.add = add } + fun add(add: List) = apply { this.add = add.toMutableList() } + + /** A list of price intervals to add to the subscription. */ + fun addAdd(add: Add) = apply { + this.add = (this.add ?: mutableListOf()).apply { add(add) } + } /** A list of adjustments to add to the subscription. */ fun addAdjustments(addAdjustments: List) = apply { - this.addAdjustments = addAdjustments + this.addAdjustments = addAdjustments.toMutableList() } + /** A list of adjustments to add to the subscription. */ + fun addAddAdjustment(addAdjustment: AddAdjustment) = apply { + addAdjustments = (addAdjustments ?: mutableListOf()).apply { add(addAdjustment) } + } + + /** A list of price intervals to edit on the subscription. */ + fun edit(edit: List) = apply { this.edit = edit.toMutableList() } + /** A list of price intervals to edit on the subscription. */ - fun edit(edit: List) = apply { this.edit = edit } + fun addEdit(edit: Edit) = apply { + this.edit = (this.edit ?: mutableListOf()).apply { add(edit) } + } /** A list of adjustments to edit on the subscription. */ fun editAdjustments(editAdjustments: List) = apply { - this.editAdjustments = editAdjustments + this.editAdjustments = editAdjustments.toMutableList() + } + + /** A list of adjustments to edit on the subscription. */ + fun addEditAdjustment(editAdjustment: EditAdjustment) = apply { + editAdjustments = (editAdjustments ?: mutableListOf()).apply { add(editAdjustment) } } fun additionalProperties(additionalProperties: Map) = apply { @@ -212,73 +223,53 @@ constructor( class Builder { private var subscriptionId: String? = null - private var add: MutableList = mutableListOf() - private var addAdjustments: MutableList = mutableListOf() - private var edit: MutableList = mutableListOf() - private var editAdjustments: MutableList = mutableListOf() + private var body: SubscriptionPriceIntervalsBody.Builder = + SubscriptionPriceIntervalsBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(subscriptionPriceIntervalsParams: SubscriptionPriceIntervalsParams) = apply { subscriptionId = subscriptionPriceIntervalsParams.subscriptionId - add = subscriptionPriceIntervalsParams.add?.toMutableList() ?: mutableListOf() - addAdjustments = - subscriptionPriceIntervalsParams.addAdjustments?.toMutableList() - ?: mutableListOf() - edit = subscriptionPriceIntervalsParams.edit?.toMutableList() ?: mutableListOf() - editAdjustments = - subscriptionPriceIntervalsParams.editAdjustments?.toMutableList() - ?: mutableListOf() + body = subscriptionPriceIntervalsParams.body.toBuilder() additionalHeaders = subscriptionPriceIntervalsParams.additionalHeaders.toBuilder() additionalQueryParams = subscriptionPriceIntervalsParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - subscriptionPriceIntervalsParams.additionalBodyProperties.toMutableMap() } fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } /** A list of price intervals to add to the subscription. */ - fun add(add: List) = apply { - this.add.clear() - this.add.addAll(add) - } + fun add(add: List) = apply { body.add(add) } /** A list of price intervals to add to the subscription. */ - fun addAdd(add: Add) = apply { this.add.add(add) } + fun addAdd(add: Add) = apply { body.addAdd(add) } /** A list of adjustments to add to the subscription. */ fun addAdjustments(addAdjustments: List) = apply { - this.addAdjustments.clear() - this.addAdjustments.addAll(addAdjustments) + body.addAdjustments(addAdjustments) } /** A list of adjustments to add to the subscription. */ fun addAddAdjustment(addAdjustment: AddAdjustment) = apply { - this.addAdjustments.add(addAdjustment) + body.addAddAdjustment(addAdjustment) } /** A list of price intervals to edit on the subscription. */ - fun edit(edit: List) = apply { - this.edit.clear() - this.edit.addAll(edit) - } + fun edit(edit: List) = apply { body.edit(edit) } /** A list of price intervals to edit on the subscription. */ - fun addEdit(edit: Edit) = apply { this.edit.add(edit) } + fun addEdit(edit: Edit) = apply { body.addEdit(edit) } /** A list of adjustments to edit on the subscription. */ fun editAdjustments(editAdjustments: List) = apply { - this.editAdjustments.clear() - this.editAdjustments.addAll(editAdjustments) + body.editAdjustments(editAdjustments) } /** A list of adjustments to edit on the subscription. */ fun addEditAdjustment(editAdjustment: EditAdjustment) = apply { - this.editAdjustments.add(editAdjustment) + body.addEditAdjustment(editAdjustment) } fun additionalHeaders(additionalHeaders: Headers) = apply { @@ -380,37 +371,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): SubscriptionPriceIntervalsParams = SubscriptionPriceIntervalsParams( checkNotNull(subscriptionId) { "`subscriptionId` is required but was not set" }, - add.toImmutable().ifEmpty { null }, - addAdjustments.toImmutable().ifEmpty { null }, - edit.toImmutable().ifEmpty { null }, - editAdjustments.toImmutable().ifEmpty { null }, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -501,8 +485,8 @@ constructor( private var allocationPrice: AllocationPrice? = null private var startDate: StartDate? = null private var endDate: EndDate? = null - private var fixedFeeQuantityTransitions: List? = null - private var discounts: List? = null + private var fixedFeeQuantityTransitions: MutableList? = null + private var discounts: MutableList? = null private var minimumAmount: Double? = null private var maximumAmount: Double? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -533,6 +517,158 @@ constructor( /** The definition of a new price to create and add to the subscription. */ fun price(price: Price) = apply { this.price = price } + fun price(newFloatingUnitPrice: Price.NewFloatingUnitPrice) = apply { + this.price = Price.ofNewFloatingUnitPrice(newFloatingUnitPrice) + } + + fun price(newFloatingPackagePrice: Price.NewFloatingPackagePrice) = apply { + this.price = Price.ofNewFloatingPackagePrice(newFloatingPackagePrice) + } + + fun price(newFloatingMatrixPrice: Price.NewFloatingMatrixPrice) = apply { + this.price = Price.ofNewFloatingMatrixPrice(newFloatingMatrixPrice) + } + + fun price( + newFloatingMatrixWithAllocationPrice: Price.NewFloatingMatrixWithAllocationPrice + ) = apply { + this.price = + Price.ofNewFloatingMatrixWithAllocationPrice( + newFloatingMatrixWithAllocationPrice + ) + } + + fun price(newFloatingTieredPrice: Price.NewFloatingTieredPrice) = apply { + this.price = Price.ofNewFloatingTieredPrice(newFloatingTieredPrice) + } + + fun price(newFloatingTieredBpsPrice: Price.NewFloatingTieredBpsPrice) = apply { + this.price = Price.ofNewFloatingTieredBpsPrice(newFloatingTieredBpsPrice) + } + + fun price(newFloatingBpsPrice: Price.NewFloatingBpsPrice) = apply { + this.price = Price.ofNewFloatingBpsPrice(newFloatingBpsPrice) + } + + fun price(newFloatingBulkBpsPrice: Price.NewFloatingBulkBpsPrice) = apply { + this.price = Price.ofNewFloatingBulkBpsPrice(newFloatingBulkBpsPrice) + } + + fun price(newFloatingBulkPrice: Price.NewFloatingBulkPrice) = apply { + this.price = Price.ofNewFloatingBulkPrice(newFloatingBulkPrice) + } + + fun price( + newFloatingThresholdTotalAmountPrice: Price.NewFloatingThresholdTotalAmountPrice + ) = apply { + this.price = + Price.ofNewFloatingThresholdTotalAmountPrice( + newFloatingThresholdTotalAmountPrice + ) + } + + fun price(newFloatingTieredPackagePrice: Price.NewFloatingTieredPackagePrice) = apply { + this.price = Price.ofNewFloatingTieredPackagePrice(newFloatingTieredPackagePrice) + } + + fun price(newFloatingGroupedTieredPrice: Price.NewFloatingGroupedTieredPrice) = apply { + this.price = Price.ofNewFloatingGroupedTieredPrice(newFloatingGroupedTieredPrice) + } + + fun price(newFloatingTieredWithMinimumPrice: Price.NewFloatingTieredWithMinimumPrice) = + apply { + this.price = + Price.ofNewFloatingTieredWithMinimumPrice(newFloatingTieredWithMinimumPrice) + } + + fun price( + newFloatingPackageWithAllocationPrice: Price.NewFloatingPackageWithAllocationPrice + ) = apply { + this.price = + Price.ofNewFloatingPackageWithAllocationPrice( + newFloatingPackageWithAllocationPrice + ) + } + + fun price( + newFloatingTieredPackageWithMinimumPrice: + Price.NewFloatingTieredPackageWithMinimumPrice + ) = apply { + this.price = + Price.ofNewFloatingTieredPackageWithMinimumPrice( + newFloatingTieredPackageWithMinimumPrice + ) + } + + fun price(newFloatingUnitWithPercentPrice: Price.NewFloatingUnitWithPercentPrice) = + apply { + this.price = + Price.ofNewFloatingUnitWithPercentPrice(newFloatingUnitWithPercentPrice) + } + + fun price( + newFloatingTieredWithProrationPrice: Price.NewFloatingTieredWithProrationPrice + ) = apply { + this.price = + Price.ofNewFloatingTieredWithProrationPrice(newFloatingTieredWithProrationPrice) + } + + fun price(newFloatingUnitWithProrationPrice: Price.NewFloatingUnitWithProrationPrice) = + apply { + this.price = + Price.ofNewFloatingUnitWithProrationPrice(newFloatingUnitWithProrationPrice) + } + + fun price(newFloatingGroupedAllocationPrice: Price.NewFloatingGroupedAllocationPrice) = + apply { + this.price = + Price.ofNewFloatingGroupedAllocationPrice(newFloatingGroupedAllocationPrice) + } + + fun price( + newFloatingGroupedWithProratedMinimumPrice: + Price.NewFloatingGroupedWithProratedMinimumPrice + ) = apply { + this.price = + Price.ofNewFloatingGroupedWithProratedMinimumPrice( + newFloatingGroupedWithProratedMinimumPrice + ) + } + + fun price( + newFloatingGroupedWithMeteredMinimumPrice: + Price.NewFloatingGroupedWithMeteredMinimumPrice + ) = apply { + this.price = + Price.ofNewFloatingGroupedWithMeteredMinimumPrice( + newFloatingGroupedWithMeteredMinimumPrice + ) + } + + fun price( + newFloatingMatrixWithDisplayNamePrice: Price.NewFloatingMatrixWithDisplayNamePrice + ) = apply { + this.price = + Price.ofNewFloatingMatrixWithDisplayNamePrice( + newFloatingMatrixWithDisplayNamePrice + ) + } + + fun price(newFloatingBulkWithProrationPrice: Price.NewFloatingBulkWithProrationPrice) = + apply { + this.price = + Price.ofNewFloatingBulkWithProrationPrice(newFloatingBulkWithProrationPrice) + } + + fun price( + newFloatingGroupedTieredPackagePrice: Price.NewFloatingGroupedTieredPackagePrice + ) = apply { + this.price = + Price.ofNewFloatingGroupedTieredPackagePrice( + newFloatingGroupedTieredPackagePrice + ) + } + /** The definition of a new allocation price to create and add to the subscription. */ fun allocationPrice(allocationPrice: AllocationPrice) = apply { this.allocationPrice = allocationPrice @@ -544,19 +680,54 @@ constructor( */ fun startDate(startDate: StartDate) = apply { this.startDate = startDate } + fun startDate(dateTime: OffsetDateTime) = apply { + this.startDate = StartDate.ofDateTime(dateTime) + } + + fun startDate(billingCycleRelativeDate: BillingCycleRelativeDate) = apply { + this.startDate = StartDate.ofBillingCycleRelativeDate(billingCycleRelativeDate) + } + /** * The end date of the price interval. This is the date that the price will stop billing * on the subscription. */ fun endDate(endDate: EndDate) = apply { this.endDate = endDate } + fun endDate(dateTime: OffsetDateTime) = apply { + this.endDate = EndDate.ofDateTime(dateTime) + } + + fun endDate(billingCycleRelativeDate: BillingCycleRelativeDate) = apply { + this.endDate = EndDate.ofBillingCycleRelativeDate(billingCycleRelativeDate) + } + /** A list of fixed fee quantity transitions to initialize on the price interval. */ fun fixedFeeQuantityTransitions( fixedFeeQuantityTransitions: List - ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } + ) = apply { + this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions.toMutableList() + } + + /** A list of fixed fee quantity transitions to initialize on the price interval. */ + fun addFixedFeeQuantityTransition( + fixedFeeQuantityTransition: FixedFeeQuantityTransition + ) = apply { + fixedFeeQuantityTransitions = + (fixedFeeQuantityTransitions ?: mutableListOf()).apply { + add(fixedFeeQuantityTransition) + } + } + + /** A list of discounts to initialize on the price interval. */ + fun discounts(discounts: List) = apply { + this.discounts = discounts.toMutableList() + } /** A list of discounts to initialize on the price interval. */ - fun discounts(discounts: List) = apply { this.discounts = discounts } + fun addDiscount(discount: Discount) = apply { + discounts = (discounts ?: mutableListOf()).apply { add(discount) } + } /** * The minimum amount that will be billed for this price interval for a given billing @@ -5006,9 +5177,9 @@ constructor( class Builder { - private var dimensions: List? = null + private var dimensions: MutableList? = null private var defaultUnitAmount: String? = null - private var matrixValues: List? = null + private var matrixValues: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -5022,7 +5193,12 @@ constructor( /** One or two event property values to evaluate matrix groups by */ fun dimensions(dimensions: List) = apply { - this.dimensions = dimensions + this.dimensions = dimensions.toMutableList() + } + + /** One or two event property values to evaluate matrix groups by */ + fun addDimension(dimension: String) = apply { + dimensions = (dimensions ?: mutableListOf()).apply { add(dimension) } } /** @@ -5035,7 +5211,13 @@ constructor( /** Matrix values for specified matrix grouping keys */ fun matrixValues(matrixValues: List) = apply { - this.matrixValues = matrixValues + this.matrixValues = matrixValues.toMutableList() + } + + /** Matrix values for specified matrix grouping keys */ + fun addMatrixValue(matrixValue: MatrixValue) = apply { + matrixValues = + (matrixValues ?: mutableListOf()).apply { add(matrixValue) } } fun additionalProperties(additionalProperties: Map) = @@ -5114,7 +5296,7 @@ constructor( class Builder { private var unitAmount: String? = null - private var dimensionValues: List? = null + private var dimensionValues: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -5137,7 +5319,19 @@ constructor( * cloud region and an instance tier. */ fun dimensionValues(dimensionValues: List) = apply { - this.dimensionValues = dimensionValues + this.dimensionValues = dimensionValues.toMutableList() + } + + /** + * One or two matrix keys to filter usage to this Matrix value by. For + * example, ["region", "tier"] could be used to filter cloud usage by a + * cloud region and an instance tier. + */ + fun addDimensionValue(dimensionValue: String) = apply { + dimensionValues = + (dimensionValues ?: mutableListOf()).apply { + add(dimensionValue) + } } fun additionalProperties(additionalProperties: Map) = @@ -6094,9 +6288,9 @@ constructor( class Builder { - private var dimensions: List? = null + private var dimensions: MutableList? = null private var defaultUnitAmount: String? = null - private var matrixValues: List? = null + private var matrixValues: MutableList? = null private var allocation: Double? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -6115,7 +6309,12 @@ constructor( /** One or two event property values to evaluate matrix groups by */ fun dimensions(dimensions: List) = apply { - this.dimensions = dimensions + this.dimensions = dimensions.toMutableList() + } + + /** One or two event property values to evaluate matrix groups by */ + fun addDimension(dimension: String) = apply { + dimensions = (dimensions ?: mutableListOf()).apply { add(dimension) } } /** @@ -6128,7 +6327,13 @@ constructor( /** Matrix values for specified matrix grouping keys */ fun matrixValues(matrixValues: List) = apply { - this.matrixValues = matrixValues + this.matrixValues = matrixValues.toMutableList() + } + + /** Matrix values for specified matrix grouping keys */ + fun addMatrixValue(matrixValue: MatrixValue) = apply { + matrixValues = + (matrixValues ?: mutableListOf()).apply { add(matrixValue) } } /** Allocation to be used to calculate the price */ @@ -6213,7 +6418,7 @@ constructor( class Builder { private var unitAmount: String? = null - private var dimensionValues: List? = null + private var dimensionValues: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -6236,7 +6441,19 @@ constructor( * cloud region and an instance tier. */ fun dimensionValues(dimensionValues: List) = apply { - this.dimensionValues = dimensionValues + this.dimensionValues = dimensionValues.toMutableList() + } + + /** + * One or two matrix keys to filter usage to this Matrix value by. For + * example, ["region", "tier"] could be used to filter cloud usage by a + * cloud region and an instance tier. + */ + fun addDimensionValue(dimensionValue: String) = apply { + dimensionValues = + (dimensionValues ?: mutableListOf()).apply { + add(dimensionValue) + } } fun additionalProperties(additionalProperties: Map) = @@ -7221,7 +7438,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -7234,7 +7451,14 @@ constructor( /** * Tiers for rating based on total usage quantities into the specified tier */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** + * Tiers for rating based on total usage quantities into the specified tier + */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { @@ -8267,7 +8491,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -8282,7 +8506,15 @@ constructor( * Tiers for a Graduated BPS pricing model, where usage is bucketed into * specified tiers */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** + * Tiers for a Graduated BPS pricing model, where usage is bucketed into + * specified tiers + */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { @@ -10115,7 +10347,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -10129,7 +10361,15 @@ constructor( * Tiers for a bulk BPS pricing model where all usage is aggregated to a * single tier based on total volume */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** + * Tiers for a bulk BPS pricing model where all usage is aggregated to a + * single tier based on total volume + */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { @@ -11146,7 +11386,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -11157,7 +11397,12 @@ constructor( } /** Bulk tiers for rating based on total usage volume */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** Bulk tiers for rating based on total usage volume */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { @@ -25714,18 +25959,54 @@ constructor( /** The definition of a new adjustment to create and add to the subscription. */ fun adjustment(adjustment: Adjustment) = apply { this.adjustment = adjustment } + fun adjustment(newPercentageDiscount: Adjustment.NewPercentageDiscount) = apply { + this.adjustment = Adjustment.ofNewPercentageDiscount(newPercentageDiscount) + } + + fun adjustment(newUsageDiscount: Adjustment.NewUsageDiscount) = apply { + this.adjustment = Adjustment.ofNewUsageDiscount(newUsageDiscount) + } + + fun adjustment(newAmountDiscount: Adjustment.NewAmountDiscount) = apply { + this.adjustment = Adjustment.ofNewAmountDiscount(newAmountDiscount) + } + + fun adjustment(newMinimum: Adjustment.NewMinimum) = apply { + this.adjustment = Adjustment.ofNewMinimum(newMinimum) + } + + fun adjustment(newMaximum: Adjustment.NewMaximum) = apply { + this.adjustment = Adjustment.ofNewMaximum(newMaximum) + } + /** * The start date of the adjustment interval. This is the date that the adjustment will * start affecting prices on the subscription. */ fun startDate(startDate: StartDate) = apply { this.startDate = startDate } + fun startDate(dateTime: OffsetDateTime) = apply { + this.startDate = StartDate.ofDateTime(dateTime) + } + + fun startDate(billingCycleRelativeDate: BillingCycleRelativeDate) = apply { + this.startDate = StartDate.ofBillingCycleRelativeDate(billingCycleRelativeDate) + } + /** * The end date of the adjustment interval. This is the date that the adjustment will * stop affecting prices on the subscription. */ fun endDate(endDate: EndDate) = apply { this.endDate = endDate } + fun endDate(dateTime: OffsetDateTime) = apply { + this.endDate = EndDate.ofDateTime(dateTime) + } + + fun endDate(billingCycleRelativeDate: BillingCycleRelativeDate) = apply { + this.endDate = EndDate.ofBillingCycleRelativeDate(billingCycleRelativeDate) + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -25979,7 +26260,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var percentageDiscount: Double? = null @@ -25997,7 +26278,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -26166,7 +26453,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var usageDiscount: Double? = null @@ -26183,7 +26470,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -26352,7 +26645,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var amountDiscount: String? = null @@ -26369,7 +26662,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -26542,7 +26841,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var minimumAmount: String? = null @@ -26561,7 +26860,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -26734,7 +27039,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var maximumAmount: String? = null @@ -26751,7 +27056,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -27178,7 +27489,7 @@ constructor( private var priceIntervalId: String? = null private var startDate: StartDate? = null private var endDate: EndDate? = null - private var fixedFeeQuantityTransitions: List? = null + private var fixedFeeQuantityTransitions: MutableList? = null private var billingCycleDay: Long? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -27203,12 +27514,28 @@ constructor( */ fun startDate(startDate: StartDate) = apply { this.startDate = startDate } + fun startDate(dateTime: OffsetDateTime) = apply { + this.startDate = StartDate.ofDateTime(dateTime) + } + + fun startDate(billingCycleRelativeDate: BillingCycleRelativeDate) = apply { + this.startDate = StartDate.ofBillingCycleRelativeDate(billingCycleRelativeDate) + } + /** * The updated end date of this price interval. If not specified, the start date will * not be updated. */ fun endDate(endDate: EndDate) = apply { this.endDate = endDate } + fun endDate(dateTime: OffsetDateTime) = apply { + this.endDate = EndDate.ofDateTime(dateTime) + } + + fun endDate(billingCycleRelativeDate: BillingCycleRelativeDate) = apply { + this.endDate = EndDate.ofBillingCycleRelativeDate(billingCycleRelativeDate) + } + /** * A list of fixed fee quantity transitions to use for this price interval. Note that * this list will overwrite all existing fixed fee quantity transitions on the price @@ -27216,7 +27543,23 @@ constructor( */ fun fixedFeeQuantityTransitions( fixedFeeQuantityTransitions: List - ) = apply { this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions } + ) = apply { + this.fixedFeeQuantityTransitions = fixedFeeQuantityTransitions.toMutableList() + } + + /** + * A list of fixed fee quantity transitions to use for this price interval. Note that + * this list will overwrite all existing fixed fee quantity transitions on the price + * interval. + */ + fun addFixedFeeQuantityTransition( + fixedFeeQuantityTransition: FixedFeeQuantityTransition + ) = apply { + fixedFeeQuantityTransitions = + (fixedFeeQuantityTransitions ?: mutableListOf()).apply { + add(fixedFeeQuantityTransition) + } + } /** * The updated billing cycle day for this price interval. If not specified, the billing @@ -27659,12 +28002,28 @@ constructor( */ fun startDate(startDate: StartDate) = apply { this.startDate = startDate } + fun startDate(dateTime: OffsetDateTime) = apply { + this.startDate = StartDate.ofDateTime(dateTime) + } + + fun startDate(billingCycleRelativeDate: BillingCycleRelativeDate) = apply { + this.startDate = StartDate.ofBillingCycleRelativeDate(billingCycleRelativeDate) + } + /** * The updated end date of this adjustment interval. If not specified, the start date * will not be updated. */ fun endDate(endDate: EndDate) = apply { this.endDate = endDate } + fun endDate(dateTime: OffsetDateTime) = apply { + this.endDate = EndDate.ofDateTime(dateTime) + } + + fun endDate(billingCycleRelativeDate: BillingCycleRelativeDate) = apply { + this.endDate = EndDate.ofBillingCycleRelativeDate(billingCycleRelativeDate) + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -27936,11 +28295,11 @@ constructor( return true } - return /* spotless:off */ other is SubscriptionPriceIntervalsParams && subscriptionId == other.subscriptionId && add == other.add && addAdjustments == other.addAdjustments && edit == other.edit && editAdjustments == other.editAdjustments && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionPriceIntervalsParams && subscriptionId == other.subscriptionId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(subscriptionId, add, addAdjustments, edit, editAdjustments, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(subscriptionId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "SubscriptionPriceIntervalsParams{subscriptionId=$subscriptionId, add=$add, addAdjustments=$addAdjustments, edit=$edit, editAdjustments=$editAdjustments, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "SubscriptionPriceIntervalsParams{subscriptionId=$subscriptionId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParams.kt index d05b06e1..1df97ed3 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParams.kt @@ -34,130 +34,153 @@ import kotlin.jvm.optionals.getOrNull class SubscriptionSchedulePlanChangeParams constructor( private val subscriptionId: String, - private val changeOption: ChangeOption, - private val addAdjustments: List?, - private val addPrices: List?, - private val alignBillingWithPlanChangeDate: Boolean?, - private val autoCollection: Boolean?, - private val billingCycleAlignment: BillingCycleAlignment?, - private val billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration?, - private val changeDate: OffsetDateTime?, - private val couponRedemptionCode: String?, - private val creditsOverageRate: Double?, - private val defaultInvoiceMemo: String?, - private val externalPlanId: String?, - private val filter: String?, - private val initialPhaseOrder: Long?, - private val invoicingThreshold: String?, - private val netTerms: Long?, - private val perCreditOverageAmount: Double?, - private val planId: String?, - private val planVersionNumber: Long?, - private val priceOverrides: List?, - private val removeAdjustments: List?, - private val removePrices: List?, - private val replaceAdjustments: List?, - private val replacePrices: List?, - private val trialDurationDays: Long?, + private val body: SubscriptionSchedulePlanChangeBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun subscriptionId(): String = subscriptionId - fun changeOption(): ChangeOption = changeOption - - fun addAdjustments(): Optional> = Optional.ofNullable(addAdjustments) - - fun addPrices(): Optional> = Optional.ofNullable(addPrices) - - fun alignBillingWithPlanChangeDate(): Optional = - Optional.ofNullable(alignBillingWithPlanChangeDate) - - fun autoCollection(): Optional = Optional.ofNullable(autoCollection) - - fun billingCycleAlignment(): Optional = - Optional.ofNullable(billingCycleAlignment) + fun changeOption(): ChangeOption = body.changeOption() + + /** + * Additional adjustments to be added to the subscription. (Only available for accounts that + * have migrated off of legacy subscription overrides) + */ + fun addAdjustments(): Optional> = body.addAdjustments() + + /** + * Additional prices to be added to the subscription. (Only available for accounts that have + * migrated off of legacy subscription overrides) + */ + fun addPrices(): Optional> = body.addPrices() + + /** + * [DEPRECATED] Use billing_cycle_alignment instead. Reset billing periods to be aligned with + * the plan change's effective date. + */ + fun alignBillingWithPlanChangeDate(): Optional = body.alignBillingWithPlanChangeDate() + + /** + * Determines whether issued invoices for this subscription will automatically be charged with + * the saved payment method on the due date. If not specified, this defaults to the behavior + * configured for this customer. + */ + fun autoCollection(): Optional = body.autoCollection() + + /** + * Reset billing periods to be aligned with the plan change's effective date or start of the + * month. Defaults to `unchanged` which keeps subscription's existing billing cycle alignment. + */ + fun billingCycleAlignment(): Optional = body.billingCycleAlignment() fun billingCycleAnchorConfiguration(): Optional = - Optional.ofNullable(billingCycleAnchorConfiguration) - - fun changeDate(): Optional = Optional.ofNullable(changeDate) - - fun couponRedemptionCode(): Optional = Optional.ofNullable(couponRedemptionCode) - - fun creditsOverageRate(): Optional = Optional.ofNullable(creditsOverageRate) - - fun defaultInvoiceMemo(): Optional = Optional.ofNullable(defaultInvoiceMemo) - - fun externalPlanId(): Optional = Optional.ofNullable(externalPlanId) - - fun filter(): Optional = Optional.ofNullable(filter) - - fun initialPhaseOrder(): Optional = Optional.ofNullable(initialPhaseOrder) - - fun invoicingThreshold(): Optional = Optional.ofNullable(invoicingThreshold) - - fun netTerms(): Optional = Optional.ofNullable(netTerms) - - fun perCreditOverageAmount(): Optional = Optional.ofNullable(perCreditOverageAmount) - - fun planId(): Optional = Optional.ofNullable(planId) - - fun planVersionNumber(): Optional = Optional.ofNullable(planVersionNumber) - - fun priceOverrides(): Optional> = Optional.ofNullable(priceOverrides) - - fun removeAdjustments(): Optional> = - Optional.ofNullable(removeAdjustments) - - fun removePrices(): Optional> = Optional.ofNullable(removePrices) - - fun replaceAdjustments(): Optional> = - Optional.ofNullable(replaceAdjustments) - - fun replacePrices(): Optional> = Optional.ofNullable(replacePrices) - - fun trialDurationDays(): Optional = Optional.ofNullable(trialDurationDays) + body.billingCycleAnchorConfiguration() + + /** + * The date that the plan change should take effect. This parameter can only be passed if the + * `change_option` is `requested_date`. + */ + fun changeDate(): Optional = body.changeDate() + + /** + * Redemption code to be used for this subscription. If the coupon cannot be found by its + * redemption code, or cannot be redeemed, an error response will be returned and the + * subscription creation or plan change will not be scheduled. + */ + fun couponRedemptionCode(): Optional = body.couponRedemptionCode() + + fun creditsOverageRate(): Optional = body.creditsOverageRate() + + /** + * Determines the default memo on this subscription's invoices. Note that if this is not + * provided, it is determined by the plan configuration. + */ + fun defaultInvoiceMemo(): Optional = body.defaultInvoiceMemo() + + /** + * The external_plan_id of the plan that the given subscription should be switched to. Note that + * either this property or `plan_id` must be specified. + */ + fun externalPlanId(): Optional = body.externalPlanId() + + /** + * An additional filter to apply to usage queries. This filter must be expressed as a boolean + * [computed property](../guides/extensibility/advanced-metrics#computed-properties). If null, + * usage queries will not include any additional filter. + */ + fun filter(): Optional = body.filter() + + /** The phase of the plan to start with */ + fun initialPhaseOrder(): Optional = body.initialPhaseOrder() + + /** + * When this subscription's accrued usage reaches this threshold, an invoice will be issued for + * the subscription. If not specified, invoices will only be issued at the end of the billing + * period. + */ + fun invoicingThreshold(): Optional = body.invoicingThreshold() + + /** + * The net terms determines the difference between the invoice date and the issue date for the + * invoice. If you intend the invoice to be due on issue, set this to 0. If not provided, this + * defaults to the value specified in the plan. + */ + fun netTerms(): Optional = body.netTerms() + + fun perCreditOverageAmount(): Optional = body.perCreditOverageAmount() + + /** + * The plan that the given subscription should be switched to. Note that either this property or + * `external_plan_id` must be specified. + */ + fun planId(): Optional = body.planId() + + /** + * Specifies which version of the plan to change to. If null, the default version will be used. + */ + fun planVersionNumber(): Optional = body.planVersionNumber() + + /** Optionally provide a list of overrides for prices on the plan */ + fun priceOverrides(): Optional> = body.priceOverrides() + + /** + * Plan adjustments to be removed from the subscription. (Only available for accounts that have + * migrated off of legacy subscription overrides) + */ + fun removeAdjustments(): Optional> = body.removeAdjustments() + + /** + * Plan prices to be removed from the subscription. (Only available for accounts that have + * migrated off of legacy subscription overrides) + */ + fun removePrices(): Optional> = body.removePrices() + + /** + * Plan adjustments to be replaced with additional adjustments on the subscription. (Only + * available for accounts that have migrated off of legacy subscription overrides) + */ + fun replaceAdjustments(): Optional> = body.replaceAdjustments() + + /** + * Plan prices to be replaced with additional prices on the subscription. (Only available for + * accounts that have migrated off of legacy subscription overrides) + */ + fun replacePrices(): Optional> = body.replacePrices() + + /** + * The duration of the trial period in days. If not provided, this defaults to the value + * specified in the plan. If `0` is provided, the trial on the plan will be skipped. + */ + fun trialDurationDays(): Optional = body.trialDurationDays() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): SubscriptionSchedulePlanChangeBody { - return SubscriptionSchedulePlanChangeBody( - changeOption, - addAdjustments, - addPrices, - alignBillingWithPlanChangeDate, - autoCollection, - billingCycleAlignment, - billingCycleAnchorConfiguration, - changeDate, - couponRedemptionCode, - creditsOverageRate, - defaultInvoiceMemo, - externalPlanId, - filter, - initialPhaseOrder, - invoicingThreshold, - netTerms, - perCreditOverageAmount, - planId, - planVersionNumber, - priceOverrides, - removeAdjustments, - removePrices, - replaceAdjustments, - replacePrices, - trialDurationDays, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): SubscriptionSchedulePlanChangeBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -382,8 +405,8 @@ constructor( class Builder { private var changeOption: ChangeOption? = null - private var addAdjustments: List? = null - private var addPrices: List? = null + private var addAdjustments: MutableList? = null + private var addPrices: MutableList? = null private var alignBillingWithPlanChangeDate: Boolean? = null private var autoCollection: Boolean? = null private var billingCycleAlignment: BillingCycleAlignment? = null @@ -400,11 +423,11 @@ constructor( private var perCreditOverageAmount: Double? = null private var planId: String? = null private var planVersionNumber: Long? = null - private var priceOverrides: List? = null - private var removeAdjustments: List? = null - private var removePrices: List? = null - private var replaceAdjustments: List? = null - private var replacePrices: List? = null + private var priceOverrides: MutableList? = null + private var removeAdjustments: MutableList? = null + private var removePrices: MutableList? = null + private var replaceAdjustments: MutableList? = null + private var replacePrices: MutableList? = null private var trialDurationDays: Long? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -454,14 +477,32 @@ constructor( * that have migrated off of legacy subscription overrides) */ fun addAdjustments(addAdjustments: List) = apply { - this.addAdjustments = addAdjustments + this.addAdjustments = addAdjustments.toMutableList() + } + + /** + * Additional adjustments to be added to the subscription. (Only available for accounts + * that have migrated off of legacy subscription overrides) + */ + fun addAddAdjustment(addAdjustment: AddAdjustment) = apply { + addAdjustments = (addAdjustments ?: mutableListOf()).apply { add(addAdjustment) } } /** * Additional prices to be added to the subscription. (Only available for accounts that * have migrated off of legacy subscription overrides) */ - fun addPrices(addPrices: List) = apply { this.addPrices = addPrices } + fun addPrices(addPrices: List) = apply { + this.addPrices = addPrices.toMutableList() + } + + /** + * Additional prices to be added to the subscription. (Only available for accounts that + * have migrated off of legacy subscription overrides) + */ + fun addAddPrice(addPrice: AddPrice) = apply { + addPrices = (addPrices ?: mutableListOf()).apply { add(addPrice) } + } /** * [DEPRECATED] Use billing_cycle_alignment instead. Reset billing periods to be aligned @@ -577,7 +618,12 @@ constructor( /** Optionally provide a list of overrides for prices on the plan */ fun priceOverrides(priceOverrides: List) = apply { - this.priceOverrides = priceOverrides + this.priceOverrides = priceOverrides.toMutableList() + } + + /** Optionally provide a list of overrides for prices on the plan */ + fun addPriceOverride(priceOverride: JsonValue) = apply { + priceOverrides = (priceOverrides ?: mutableListOf()).apply { add(priceOverride) } } /** @@ -585,7 +631,16 @@ constructor( * that have migrated off of legacy subscription overrides) */ fun removeAdjustments(removeAdjustments: List) = apply { - this.removeAdjustments = removeAdjustments + this.removeAdjustments = removeAdjustments.toMutableList() + } + + /** + * Plan adjustments to be removed from the subscription. (Only available for accounts + * that have migrated off of legacy subscription overrides) + */ + fun addRemoveAdjustment(removeAdjustment: RemoveAdjustment) = apply { + removeAdjustments = + (removeAdjustments ?: mutableListOf()).apply { add(removeAdjustment) } } /** @@ -593,7 +648,15 @@ constructor( * have migrated off of legacy subscription overrides) */ fun removePrices(removePrices: List) = apply { - this.removePrices = removePrices + this.removePrices = removePrices.toMutableList() + } + + /** + * Plan prices to be removed from the subscription. (Only available for accounts that + * have migrated off of legacy subscription overrides) + */ + fun addRemovePrice(removePrice: RemovePrice) = apply { + removePrices = (removePrices ?: mutableListOf()).apply { add(removePrice) } } /** @@ -601,7 +664,16 @@ constructor( * (Only available for accounts that have migrated off of legacy subscription overrides) */ fun replaceAdjustments(replaceAdjustments: List) = apply { - this.replaceAdjustments = replaceAdjustments + this.replaceAdjustments = replaceAdjustments.toMutableList() + } + + /** + * Plan adjustments to be replaced with additional adjustments on the subscription. + * (Only available for accounts that have migrated off of legacy subscription overrides) + */ + fun addReplaceAdjustment(replaceAdjustment: ReplaceAdjustment) = apply { + replaceAdjustments = + (replaceAdjustments ?: mutableListOf()).apply { add(replaceAdjustment) } } /** @@ -609,7 +681,15 @@ constructor( * available for accounts that have migrated off of legacy subscription overrides) */ fun replacePrices(replacePrices: List) = apply { - this.replacePrices = replacePrices + this.replacePrices = replacePrices.toMutableList() + } + + /** + * Plan prices to be replaced with additional prices on the subscription. (Only + * available for accounts that have migrated off of legacy subscription overrides) + */ + fun addReplacePrice(replacePrice: ReplacePrice) = apply { + replacePrices = (replacePrices ?: mutableListOf()).apply { add(replacePrice) } } /** @@ -699,98 +779,32 @@ constructor( class Builder { private var subscriptionId: String? = null - private var changeOption: ChangeOption? = null - private var addAdjustments: MutableList = mutableListOf() - private var addPrices: MutableList = mutableListOf() - private var alignBillingWithPlanChangeDate: Boolean? = null - private var autoCollection: Boolean? = null - private var billingCycleAlignment: BillingCycleAlignment? = null - private var billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration? = null - private var changeDate: OffsetDateTime? = null - private var couponRedemptionCode: String? = null - private var creditsOverageRate: Double? = null - private var defaultInvoiceMemo: String? = null - private var externalPlanId: String? = null - private var filter: String? = null - private var initialPhaseOrder: Long? = null - private var invoicingThreshold: String? = null - private var netTerms: Long? = null - private var perCreditOverageAmount: Double? = null - private var planId: String? = null - private var planVersionNumber: Long? = null - private var priceOverrides: MutableList = mutableListOf() - private var removeAdjustments: MutableList = mutableListOf() - private var removePrices: MutableList = mutableListOf() - private var replaceAdjustments: MutableList = mutableListOf() - private var replacePrices: MutableList = mutableListOf() - private var trialDurationDays: Long? = null + private var body: SubscriptionSchedulePlanChangeBody.Builder = + SubscriptionSchedulePlanChangeBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( subscriptionSchedulePlanChangeParams: SubscriptionSchedulePlanChangeParams ) = apply { subscriptionId = subscriptionSchedulePlanChangeParams.subscriptionId - changeOption = subscriptionSchedulePlanChangeParams.changeOption - addAdjustments = - subscriptionSchedulePlanChangeParams.addAdjustments?.toMutableList() - ?: mutableListOf() - addPrices = - subscriptionSchedulePlanChangeParams.addPrices?.toMutableList() ?: mutableListOf() - alignBillingWithPlanChangeDate = - subscriptionSchedulePlanChangeParams.alignBillingWithPlanChangeDate - autoCollection = subscriptionSchedulePlanChangeParams.autoCollection - billingCycleAlignment = subscriptionSchedulePlanChangeParams.billingCycleAlignment - billingCycleAnchorConfiguration = - subscriptionSchedulePlanChangeParams.billingCycleAnchorConfiguration - changeDate = subscriptionSchedulePlanChangeParams.changeDate - couponRedemptionCode = subscriptionSchedulePlanChangeParams.couponRedemptionCode - creditsOverageRate = subscriptionSchedulePlanChangeParams.creditsOverageRate - defaultInvoiceMemo = subscriptionSchedulePlanChangeParams.defaultInvoiceMemo - externalPlanId = subscriptionSchedulePlanChangeParams.externalPlanId - filter = subscriptionSchedulePlanChangeParams.filter - initialPhaseOrder = subscriptionSchedulePlanChangeParams.initialPhaseOrder - invoicingThreshold = subscriptionSchedulePlanChangeParams.invoicingThreshold - netTerms = subscriptionSchedulePlanChangeParams.netTerms - perCreditOverageAmount = subscriptionSchedulePlanChangeParams.perCreditOverageAmount - planId = subscriptionSchedulePlanChangeParams.planId - planVersionNumber = subscriptionSchedulePlanChangeParams.planVersionNumber - priceOverrides = - subscriptionSchedulePlanChangeParams.priceOverrides?.toMutableList() - ?: mutableListOf() - removeAdjustments = - subscriptionSchedulePlanChangeParams.removeAdjustments?.toMutableList() - ?: mutableListOf() - removePrices = - subscriptionSchedulePlanChangeParams.removePrices?.toMutableList() - ?: mutableListOf() - replaceAdjustments = - subscriptionSchedulePlanChangeParams.replaceAdjustments?.toMutableList() - ?: mutableListOf() - replacePrices = - subscriptionSchedulePlanChangeParams.replacePrices?.toMutableList() - ?: mutableListOf() - trialDurationDays = subscriptionSchedulePlanChangeParams.trialDurationDays + body = subscriptionSchedulePlanChangeParams.body.toBuilder() additionalHeaders = subscriptionSchedulePlanChangeParams.additionalHeaders.toBuilder() additionalQueryParams = subscriptionSchedulePlanChangeParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - subscriptionSchedulePlanChangeParams.additionalBodyProperties.toMutableMap() } fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } - fun changeOption(changeOption: ChangeOption) = apply { this.changeOption = changeOption } + fun changeOption(changeOption: ChangeOption) = apply { body.changeOption(changeOption) } /** * Additional adjustments to be added to the subscription. (Only available for accounts that * have migrated off of legacy subscription overrides) */ fun addAdjustments(addAdjustments: List) = apply { - this.addAdjustments.clear() - this.addAdjustments.addAll(addAdjustments) + body.addAdjustments(addAdjustments) } /** @@ -798,30 +812,27 @@ constructor( * have migrated off of legacy subscription overrides) */ fun addAddAdjustment(addAdjustment: AddAdjustment) = apply { - this.addAdjustments.add(addAdjustment) + body.addAddAdjustment(addAdjustment) } /** * Additional prices to be added to the subscription. (Only available for accounts that have * migrated off of legacy subscription overrides) */ - fun addPrices(addPrices: List) = apply { - this.addPrices.clear() - this.addPrices.addAll(addPrices) - } + fun addPrices(addPrices: List) = apply { body.addPrices(addPrices) } /** * Additional prices to be added to the subscription. (Only available for accounts that have * migrated off of legacy subscription overrides) */ - fun addAddPrice(addPrice: AddPrice) = apply { this.addPrices.add(addPrice) } + fun addAddPrice(addPrice: AddPrice) = apply { body.addAddPrice(addPrice) } /** * [DEPRECATED] Use billing_cycle_alignment instead. Reset billing periods to be aligned * with the plan change's effective date. */ fun alignBillingWithPlanChangeDate(alignBillingWithPlanChangeDate: Boolean) = apply { - this.alignBillingWithPlanChangeDate = alignBillingWithPlanChangeDate + body.alignBillingWithPlanChangeDate(alignBillingWithPlanChangeDate) } /** @@ -829,7 +840,7 @@ constructor( * with the saved payment method on the due date. If not specified, this defaults to the * behavior configured for this customer. */ - fun autoCollection(autoCollection: Boolean) = apply { this.autoCollection = autoCollection } + fun autoCollection(autoCollection: Boolean) = apply { body.autoCollection(autoCollection) } /** * Reset billing periods to be aligned with the plan change's effective date or start of the @@ -837,18 +848,18 @@ constructor( * alignment. */ fun billingCycleAlignment(billingCycleAlignment: BillingCycleAlignment) = apply { - this.billingCycleAlignment = billingCycleAlignment + body.billingCycleAlignment(billingCycleAlignment) } fun billingCycleAnchorConfiguration( billingCycleAnchorConfiguration: BillingCycleAnchorConfiguration - ) = apply { this.billingCycleAnchorConfiguration = billingCycleAnchorConfiguration } + ) = apply { body.billingCycleAnchorConfiguration(billingCycleAnchorConfiguration) } /** * The date that the plan change should take effect. This parameter can only be passed if * the `change_option` is `requested_date`. */ - fun changeDate(changeDate: OffsetDateTime) = apply { this.changeDate = changeDate } + fun changeDate(changeDate: OffsetDateTime) = apply { body.changeDate(changeDate) } /** * Redemption code to be used for this subscription. If the coupon cannot be found by its @@ -856,11 +867,11 @@ constructor( * subscription creation or plan change will not be scheduled. */ fun couponRedemptionCode(couponRedemptionCode: String) = apply { - this.couponRedemptionCode = couponRedemptionCode + body.couponRedemptionCode(couponRedemptionCode) } fun creditsOverageRate(creditsOverageRate: Double) = apply { - this.creditsOverageRate = creditsOverageRate + body.creditsOverageRate(creditsOverageRate) } /** @@ -868,14 +879,14 @@ constructor( * provided, it is determined by the plan configuration. */ fun defaultInvoiceMemo(defaultInvoiceMemo: String) = apply { - this.defaultInvoiceMemo = defaultInvoiceMemo + body.defaultInvoiceMemo(defaultInvoiceMemo) } /** * The external_plan_id of the plan that the given subscription should be switched to. Note * that either this property or `plan_id` must be specified. */ - fun externalPlanId(externalPlanId: String) = apply { this.externalPlanId = externalPlanId } + fun externalPlanId(externalPlanId: String) = apply { body.externalPlanId(externalPlanId) } /** * An additional filter to apply to usage queries. This filter must be expressed as a @@ -883,11 +894,11 @@ constructor( * [computed property](../guides/extensibility/advanced-metrics#computed-properties). If * null, usage queries will not include any additional filter. */ - fun filter(filter: String) = apply { this.filter = filter } + fun filter(filter: String) = apply { body.filter(filter) } /** The phase of the plan to start with */ fun initialPhaseOrder(initialPhaseOrder: Long) = apply { - this.initialPhaseOrder = initialPhaseOrder + body.initialPhaseOrder(initialPhaseOrder) } /** @@ -896,7 +907,7 @@ constructor( * billing period. */ fun invoicingThreshold(invoicingThreshold: String) = apply { - this.invoicingThreshold = invoicingThreshold + body.invoicingThreshold(invoicingThreshold) } /** @@ -904,35 +915,34 @@ constructor( * the invoice. If you intend the invoice to be due on issue, set this to 0. If not * provided, this defaults to the value specified in the plan. */ - fun netTerms(netTerms: Long) = apply { this.netTerms = netTerms } + fun netTerms(netTerms: Long) = apply { body.netTerms(netTerms) } fun perCreditOverageAmount(perCreditOverageAmount: Double) = apply { - this.perCreditOverageAmount = perCreditOverageAmount + body.perCreditOverageAmount(perCreditOverageAmount) } /** * The plan that the given subscription should be switched to. Note that either this * property or `external_plan_id` must be specified. */ - fun planId(planId: String) = apply { this.planId = planId } + fun planId(planId: String) = apply { body.planId(planId) } /** * Specifies which version of the plan to change to. If null, the default version will be * used. */ fun planVersionNumber(planVersionNumber: Long) = apply { - this.planVersionNumber = planVersionNumber + body.planVersionNumber(planVersionNumber) } /** Optionally provide a list of overrides for prices on the plan */ fun priceOverrides(priceOverrides: List) = apply { - this.priceOverrides.clear() - this.priceOverrides.addAll(priceOverrides) + body.priceOverrides(priceOverrides) } /** Optionally provide a list of overrides for prices on the plan */ fun addPriceOverride(priceOverride: JsonValue) = apply { - this.priceOverrides.add(priceOverride) + body.addPriceOverride(priceOverride) } /** @@ -940,8 +950,7 @@ constructor( * have migrated off of legacy subscription overrides) */ fun removeAdjustments(removeAdjustments: List) = apply { - this.removeAdjustments.clear() - this.removeAdjustments.addAll(removeAdjustments) + body.removeAdjustments(removeAdjustments) } /** @@ -949,7 +958,7 @@ constructor( * have migrated off of legacy subscription overrides) */ fun addRemoveAdjustment(removeAdjustment: RemoveAdjustment) = apply { - this.removeAdjustments.add(removeAdjustment) + body.addRemoveAdjustment(removeAdjustment) } /** @@ -957,23 +966,21 @@ constructor( * migrated off of legacy subscription overrides) */ fun removePrices(removePrices: List) = apply { - this.removePrices.clear() - this.removePrices.addAll(removePrices) + body.removePrices(removePrices) } /** * Plan prices to be removed from the subscription. (Only available for accounts that have * migrated off of legacy subscription overrides) */ - fun addRemovePrice(removePrice: RemovePrice) = apply { this.removePrices.add(removePrice) } + fun addRemovePrice(removePrice: RemovePrice) = apply { body.addRemovePrice(removePrice) } /** * Plan adjustments to be replaced with additional adjustments on the subscription. (Only * available for accounts that have migrated off of legacy subscription overrides) */ fun replaceAdjustments(replaceAdjustments: List) = apply { - this.replaceAdjustments.clear() - this.replaceAdjustments.addAll(replaceAdjustments) + body.replaceAdjustments(replaceAdjustments) } /** @@ -981,7 +988,7 @@ constructor( * available for accounts that have migrated off of legacy subscription overrides) */ fun addReplaceAdjustment(replaceAdjustment: ReplaceAdjustment) = apply { - this.replaceAdjustments.add(replaceAdjustment) + body.addReplaceAdjustment(replaceAdjustment) } /** @@ -989,8 +996,7 @@ constructor( * for accounts that have migrated off of legacy subscription overrides) */ fun replacePrices(replacePrices: List) = apply { - this.replacePrices.clear() - this.replacePrices.addAll(replacePrices) + body.replacePrices(replacePrices) } /** @@ -998,7 +1004,7 @@ constructor( * for accounts that have migrated off of legacy subscription overrides) */ fun addReplacePrice(replacePrice: ReplacePrice) = apply { - this.replacePrices.add(replacePrice) + body.addReplacePrice(replacePrice) } /** @@ -1006,7 +1012,7 @@ constructor( * specified in the plan. If `0` is provided, the trial on the plan will be skipped. */ fun trialDurationDays(trialDurationDays: Long) = apply { - this.trialDurationDays = trialDurationDays + body.trialDurationDays(trialDurationDays) } fun additionalHeaders(additionalHeaders: Headers) = apply { @@ -1108,58 +1114,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): SubscriptionSchedulePlanChangeParams = SubscriptionSchedulePlanChangeParams( checkNotNull(subscriptionId) { "`subscriptionId` is required but was not set" }, - checkNotNull(changeOption) { "`changeOption` is required but was not set" }, - addAdjustments.toImmutable().ifEmpty { null }, - addPrices.toImmutable().ifEmpty { null }, - alignBillingWithPlanChangeDate, - autoCollection, - billingCycleAlignment, - billingCycleAnchorConfiguration, - changeDate, - couponRedemptionCode, - creditsOverageRate, - defaultInvoiceMemo, - externalPlanId, - filter, - initialPhaseOrder, - invoicingThreshold, - netTerms, - perCreditOverageAmount, - planId, - planVersionNumber, - priceOverrides.toImmutable().ifEmpty { null }, - removeAdjustments.toImmutable().ifEmpty { null }, - removePrices.toImmutable().ifEmpty { null }, - replaceAdjustments.toImmutable().ifEmpty { null }, - replacePrices.toImmutable().ifEmpty { null }, - trialDurationDays, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -1292,6 +1270,26 @@ constructor( /** The definition of a new adjustment to create and add to the subscription. */ fun adjustment(adjustment: Adjustment) = apply { this.adjustment = adjustment } + fun adjustment(newPercentageDiscount: Adjustment.NewPercentageDiscount) = apply { + this.adjustment = Adjustment.ofNewPercentageDiscount(newPercentageDiscount) + } + + fun adjustment(newUsageDiscount: Adjustment.NewUsageDiscount) = apply { + this.adjustment = Adjustment.ofNewUsageDiscount(newUsageDiscount) + } + + fun adjustment(newAmountDiscount: Adjustment.NewAmountDiscount) = apply { + this.adjustment = Adjustment.ofNewAmountDiscount(newAmountDiscount) + } + + fun adjustment(newMinimum: Adjustment.NewMinimum) = apply { + this.adjustment = Adjustment.ofNewMinimum(newMinimum) + } + + fun adjustment(newMaximum: Adjustment.NewMaximum) = apply { + this.adjustment = Adjustment.ofNewMaximum(newMaximum) + } + /** * The start date of the adjustment interval. This is the date that the adjustment will * start affecting prices on the subscription. If null, the adjustment will start when @@ -1565,7 +1563,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var percentageDiscount: Double? = null @@ -1583,7 +1581,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -1752,7 +1756,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var usageDiscount: Double? = null @@ -1769,7 +1773,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -1938,7 +1948,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var amountDiscount: String? = null @@ -1955,7 +1965,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -2128,7 +2144,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var minimumAmount: String? = null @@ -2147,7 +2163,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -2320,7 +2342,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var maximumAmount: String? = null @@ -2337,7 +2359,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -2570,7 +2598,7 @@ constructor( private var planPhaseOrder: Long? = null private var minimumAmount: String? = null private var maximumAmount: String? = null - private var discounts: List? = null + private var discounts: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -2598,6 +2626,126 @@ constructor( /** The definition of a new price to create and add to the subscription. */ fun price(price: Price) = apply { this.price = price } + fun price(newSubscriptionUnitPrice: Price.NewSubscriptionUnitPrice) = apply { + this.price = Price.ofNewSubscriptionUnitPrice(newSubscriptionUnitPrice) + } + + fun price(newSubscriptionPackagePrice: Price.NewSubscriptionPackagePrice) = apply { + this.price = Price.ofNewSubscriptionPackagePrice(newSubscriptionPackagePrice) + } + + fun price(newSubscriptionMatrixPrice: Price.NewSubscriptionMatrixPrice) = apply { + this.price = Price.ofNewSubscriptionMatrixPrice(newSubscriptionMatrixPrice) + } + + fun price(newSubscriptionTieredPrice: Price.NewSubscriptionTieredPrice) = apply { + this.price = Price.ofNewSubscriptionTieredPrice(newSubscriptionTieredPrice) + } + + fun price(newSubscriptionTieredBpsPrice: Price.NewSubscriptionTieredBpsPrice) = apply { + this.price = Price.ofNewSubscriptionTieredBpsPrice(newSubscriptionTieredBpsPrice) + } + + fun price(newSubscriptionBpsPrice: Price.NewSubscriptionBpsPrice) = apply { + this.price = Price.ofNewSubscriptionBpsPrice(newSubscriptionBpsPrice) + } + + fun price(newSubscriptionBulkBpsPrice: Price.NewSubscriptionBulkBpsPrice) = apply { + this.price = Price.ofNewSubscriptionBulkBpsPrice(newSubscriptionBulkBpsPrice) + } + + fun price(newSubscriptionBulkPrice: Price.NewSubscriptionBulkPrice) = apply { + this.price = Price.ofNewSubscriptionBulkPrice(newSubscriptionBulkPrice) + } + + fun price( + newSubscriptionThresholdTotalAmountPrice: + Price.NewSubscriptionThresholdTotalAmountPrice + ) = apply { + this.price = + Price.ofNewSubscriptionThresholdTotalAmountPrice( + newSubscriptionThresholdTotalAmountPrice + ) + } + + fun price(newSubscriptionTieredPackagePrice: Price.NewSubscriptionTieredPackagePrice) = + apply { + this.price = + Price.ofNewSubscriptionTieredPackagePrice(newSubscriptionTieredPackagePrice) + } + + fun price( + newSubscriptionTieredWithMinimumPrice: Price.NewSubscriptionTieredWithMinimumPrice + ) = apply { + this.price = + Price.ofNewSubscriptionTieredWithMinimumPrice( + newSubscriptionTieredWithMinimumPrice + ) + } + + fun price( + newSubscriptionUnitWithPercentPrice: Price.NewSubscriptionUnitWithPercentPrice + ) = apply { + this.price = + Price.ofNewSubscriptionUnitWithPercentPrice(newSubscriptionUnitWithPercentPrice) + } + + fun price( + newSubscriptionPackageWithAllocationPrice: + Price.NewSubscriptionPackageWithAllocationPrice + ) = apply { + this.price = + Price.ofNewSubscriptionPackageWithAllocationPrice( + newSubscriptionPackageWithAllocationPrice + ) + } + + fun price( + newSubscriptionTierWithProrationPrice: Price.NewSubscriptionTierWithProrationPrice + ) = apply { + this.price = + Price.ofNewSubscriptionTierWithProrationPrice( + newSubscriptionTierWithProrationPrice + ) + } + + fun price( + newSubscriptionUnitWithProrationPrice: Price.NewSubscriptionUnitWithProrationPrice + ) = apply { + this.price = + Price.ofNewSubscriptionUnitWithProrationPrice( + newSubscriptionUnitWithProrationPrice + ) + } + + fun price( + newSubscriptionGroupedAllocationPrice: Price.NewSubscriptionGroupedAllocationPrice + ) = apply { + this.price = + Price.ofNewSubscriptionGroupedAllocationPrice( + newSubscriptionGroupedAllocationPrice + ) + } + + fun price( + newSubscriptionGroupedWithProratedMinimumPrice: + Price.NewSubscriptionGroupedWithProratedMinimumPrice + ) = apply { + this.price = + Price.ofNewSubscriptionGroupedWithProratedMinimumPrice( + newSubscriptionGroupedWithProratedMinimumPrice + ) + } + + fun price( + newSubscriptionBulkWithProrationPrice: Price.NewSubscriptionBulkWithProrationPrice + ) = apply { + this.price = + Price.ofNewSubscriptionBulkWithProrationPrice( + newSubscriptionBulkWithProrationPrice + ) + } + /** * The start date of the price interval. This is the date that the price will start * billing on the subscription. If null, billing will start when the phase or @@ -2632,7 +2780,17 @@ constructor( * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for this * price. */ - fun discounts(discounts: List) = apply { this.discounts = discounts } + fun discounts(discounts: List) = apply { + this.discounts = discounts.toMutableList() + } + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for this + * price. + */ + fun addDiscount(discount: Discount) = apply { + discounts = (discounts ?: mutableListOf()).apply { add(discount) } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -5980,9 +6138,9 @@ constructor( class Builder { - private var dimensions: List? = null + private var dimensions: MutableList? = null private var defaultUnitAmount: String? = null - private var matrixValues: List? = null + private var matrixValues: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -5996,7 +6154,12 @@ constructor( /** One or two event property values to evaluate matrix groups by */ fun dimensions(dimensions: List) = apply { - this.dimensions = dimensions + this.dimensions = dimensions.toMutableList() + } + + /** One or two event property values to evaluate matrix groups by */ + fun addDimension(dimension: String) = apply { + dimensions = (dimensions ?: mutableListOf()).apply { add(dimension) } } /** @@ -6009,7 +6172,13 @@ constructor( /** Matrix values for specified matrix grouping keys */ fun matrixValues(matrixValues: List) = apply { - this.matrixValues = matrixValues + this.matrixValues = matrixValues.toMutableList() + } + + /** Matrix values for specified matrix grouping keys */ + fun addMatrixValue(matrixValue: MatrixValue) = apply { + matrixValues = + (matrixValues ?: mutableListOf()).apply { add(matrixValue) } } fun additionalProperties(additionalProperties: Map) = @@ -6088,7 +6257,7 @@ constructor( class Builder { private var unitAmount: String? = null - private var dimensionValues: List? = null + private var dimensionValues: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -6111,7 +6280,19 @@ constructor( * cloud region and an instance tier. */ fun dimensionValues(dimensionValues: List) = apply { - this.dimensionValues = dimensionValues + this.dimensionValues = dimensionValues.toMutableList() + } + + /** + * One or two matrix keys to filter usage to this Matrix value by. For + * example, ["region", "tier"] could be used to filter cloud usage by a + * cloud region and an instance tier. + */ + fun addDimensionValue(dimensionValue: String) = apply { + dimensionValues = + (dimensionValues ?: mutableListOf()).apply { + add(dimensionValue) + } } fun additionalProperties(additionalProperties: Map) = @@ -7122,7 +7303,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -7135,7 +7316,14 @@ constructor( /** * Tiers for rating based on total usage quantities into the specified tier */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** + * Tiers for rating based on total usage quantities into the specified tier + */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { @@ -8193,7 +8381,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -8208,7 +8396,15 @@ constructor( * Tiers for a Graduated BPS pricing model, where usage is bucketed into * specified tiers */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** + * Tiers for a Graduated BPS pricing model, where usage is bucketed into + * specified tiers + */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { @@ -10091,7 +10287,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -10105,7 +10301,15 @@ constructor( * Tiers for a bulk BPS pricing model where all usage is aggregated to a * single tier based on total volume */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** + * Tiers for a bulk BPS pricing model where all usage is aggregated to a + * single tier based on total volume + */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { @@ -11147,7 +11351,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -11158,7 +11362,12 @@ constructor( } /** Bulk tiers for rating based on total usage volume */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** Bulk tiers for rating based on total usage volume */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { @@ -21731,6 +21940,26 @@ constructor( /** The definition of a new adjustment to create and add to the subscription. */ fun adjustment(adjustment: Adjustment) = apply { this.adjustment = adjustment } + fun adjustment(newPercentageDiscount: Adjustment.NewPercentageDiscount) = apply { + this.adjustment = Adjustment.ofNewPercentageDiscount(newPercentageDiscount) + } + + fun adjustment(newUsageDiscount: Adjustment.NewUsageDiscount) = apply { + this.adjustment = Adjustment.ofNewUsageDiscount(newUsageDiscount) + } + + fun adjustment(newAmountDiscount: Adjustment.NewAmountDiscount) = apply { + this.adjustment = Adjustment.ofNewAmountDiscount(newAmountDiscount) + } + + fun adjustment(newMinimum: Adjustment.NewMinimum) = apply { + this.adjustment = Adjustment.ofNewMinimum(newMinimum) + } + + fun adjustment(newMaximum: Adjustment.NewMaximum) = apply { + this.adjustment = Adjustment.ofNewMaximum(newMaximum) + } + /** The id of the adjustment on the plan to replace in the subscription. */ fun replacesAdjustmentId(replacesAdjustmentId: String) = apply { this.replacesAdjustmentId = replacesAdjustmentId @@ -21990,7 +22219,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var percentageDiscount: Double? = null @@ -22008,7 +22237,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -22177,7 +22412,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var usageDiscount: Double? = null @@ -22194,7 +22429,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -22363,7 +22604,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var amountDiscount: String? = null @@ -22380,7 +22621,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -22553,7 +22800,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var minimumAmount: String? = null @@ -22572,7 +22819,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -22745,7 +22998,7 @@ constructor( class Builder { - private var appliesToPriceIds: List? = null + private var appliesToPriceIds: MutableList? = null private var isInvoiceLevel: Boolean? = null private var adjustmentType: AdjustmentType? = null private var maximumAmount: String? = null @@ -22762,7 +23015,13 @@ constructor( /** The set of price IDs to which this adjustment applies. */ fun appliesToPriceIds(appliesToPriceIds: List) = apply { - this.appliesToPriceIds = appliesToPriceIds + this.appliesToPriceIds = appliesToPriceIds.toMutableList() + } + + /** The set of price IDs to which this adjustment applies. */ + fun addAppliesToPriceId(appliesToPriceId: String) = apply { + appliesToPriceIds = + (appliesToPriceIds ?: mutableListOf()).apply { add(appliesToPriceId) } } /** @@ -22983,7 +23242,7 @@ constructor( private var replacesPriceId: String? = null private var minimumAmount: String? = null private var maximumAmount: String? = null - private var discounts: List? = null + private var discounts: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -23010,6 +23269,126 @@ constructor( /** The definition of a new price to create and add to the subscription. */ fun price(price: Price) = apply { this.price = price } + fun price(newSubscriptionUnitPrice: Price.NewSubscriptionUnitPrice) = apply { + this.price = Price.ofNewSubscriptionUnitPrice(newSubscriptionUnitPrice) + } + + fun price(newSubscriptionPackagePrice: Price.NewSubscriptionPackagePrice) = apply { + this.price = Price.ofNewSubscriptionPackagePrice(newSubscriptionPackagePrice) + } + + fun price(newSubscriptionMatrixPrice: Price.NewSubscriptionMatrixPrice) = apply { + this.price = Price.ofNewSubscriptionMatrixPrice(newSubscriptionMatrixPrice) + } + + fun price(newSubscriptionTieredPrice: Price.NewSubscriptionTieredPrice) = apply { + this.price = Price.ofNewSubscriptionTieredPrice(newSubscriptionTieredPrice) + } + + fun price(newSubscriptionTieredBpsPrice: Price.NewSubscriptionTieredBpsPrice) = apply { + this.price = Price.ofNewSubscriptionTieredBpsPrice(newSubscriptionTieredBpsPrice) + } + + fun price(newSubscriptionBpsPrice: Price.NewSubscriptionBpsPrice) = apply { + this.price = Price.ofNewSubscriptionBpsPrice(newSubscriptionBpsPrice) + } + + fun price(newSubscriptionBulkBpsPrice: Price.NewSubscriptionBulkBpsPrice) = apply { + this.price = Price.ofNewSubscriptionBulkBpsPrice(newSubscriptionBulkBpsPrice) + } + + fun price(newSubscriptionBulkPrice: Price.NewSubscriptionBulkPrice) = apply { + this.price = Price.ofNewSubscriptionBulkPrice(newSubscriptionBulkPrice) + } + + fun price( + newSubscriptionThresholdTotalAmountPrice: + Price.NewSubscriptionThresholdTotalAmountPrice + ) = apply { + this.price = + Price.ofNewSubscriptionThresholdTotalAmountPrice( + newSubscriptionThresholdTotalAmountPrice + ) + } + + fun price(newSubscriptionTieredPackagePrice: Price.NewSubscriptionTieredPackagePrice) = + apply { + this.price = + Price.ofNewSubscriptionTieredPackagePrice(newSubscriptionTieredPackagePrice) + } + + fun price( + newSubscriptionTieredWithMinimumPrice: Price.NewSubscriptionTieredWithMinimumPrice + ) = apply { + this.price = + Price.ofNewSubscriptionTieredWithMinimumPrice( + newSubscriptionTieredWithMinimumPrice + ) + } + + fun price( + newSubscriptionUnitWithPercentPrice: Price.NewSubscriptionUnitWithPercentPrice + ) = apply { + this.price = + Price.ofNewSubscriptionUnitWithPercentPrice(newSubscriptionUnitWithPercentPrice) + } + + fun price( + newSubscriptionPackageWithAllocationPrice: + Price.NewSubscriptionPackageWithAllocationPrice + ) = apply { + this.price = + Price.ofNewSubscriptionPackageWithAllocationPrice( + newSubscriptionPackageWithAllocationPrice + ) + } + + fun price( + newSubscriptionTierWithProrationPrice: Price.NewSubscriptionTierWithProrationPrice + ) = apply { + this.price = + Price.ofNewSubscriptionTierWithProrationPrice( + newSubscriptionTierWithProrationPrice + ) + } + + fun price( + newSubscriptionUnitWithProrationPrice: Price.NewSubscriptionUnitWithProrationPrice + ) = apply { + this.price = + Price.ofNewSubscriptionUnitWithProrationPrice( + newSubscriptionUnitWithProrationPrice + ) + } + + fun price( + newSubscriptionGroupedAllocationPrice: Price.NewSubscriptionGroupedAllocationPrice + ) = apply { + this.price = + Price.ofNewSubscriptionGroupedAllocationPrice( + newSubscriptionGroupedAllocationPrice + ) + } + + fun price( + newSubscriptionGroupedWithProratedMinimumPrice: + Price.NewSubscriptionGroupedWithProratedMinimumPrice + ) = apply { + this.price = + Price.ofNewSubscriptionGroupedWithProratedMinimumPrice( + newSubscriptionGroupedWithProratedMinimumPrice + ) + } + + fun price( + newSubscriptionBulkWithProrationPrice: Price.NewSubscriptionBulkWithProrationPrice + ) = apply { + this.price = + Price.ofNewSubscriptionBulkWithProrationPrice( + newSubscriptionBulkWithProrationPrice + ) + } + /** The new quantity of the price, if the price is a fixed price. */ fun fixedPriceQuantity(fixedPriceQuantity: Double) = apply { this.fixedPriceQuantity = fixedPriceQuantity @@ -23036,7 +23415,17 @@ constructor( * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for the * replacement price. */ - fun discounts(discounts: List) = apply { this.discounts = discounts } + fun discounts(discounts: List) = apply { + this.discounts = discounts.toMutableList() + } + + /** + * [DEPRECATED] Use add_adjustments instead. The subscription's discounts for the + * replacement price. + */ + fun addDiscount(discount: Discount) = apply { + discounts = (discounts ?: mutableListOf()).apply { add(discount) } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -26385,9 +26774,9 @@ constructor( class Builder { - private var dimensions: List? = null + private var dimensions: MutableList? = null private var defaultUnitAmount: String? = null - private var matrixValues: List? = null + private var matrixValues: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -26401,7 +26790,12 @@ constructor( /** One or two event property values to evaluate matrix groups by */ fun dimensions(dimensions: List) = apply { - this.dimensions = dimensions + this.dimensions = dimensions.toMutableList() + } + + /** One or two event property values to evaluate matrix groups by */ + fun addDimension(dimension: String) = apply { + dimensions = (dimensions ?: mutableListOf()).apply { add(dimension) } } /** @@ -26414,7 +26808,13 @@ constructor( /** Matrix values for specified matrix grouping keys */ fun matrixValues(matrixValues: List) = apply { - this.matrixValues = matrixValues + this.matrixValues = matrixValues.toMutableList() + } + + /** Matrix values for specified matrix grouping keys */ + fun addMatrixValue(matrixValue: MatrixValue) = apply { + matrixValues = + (matrixValues ?: mutableListOf()).apply { add(matrixValue) } } fun additionalProperties(additionalProperties: Map) = @@ -26493,7 +26893,7 @@ constructor( class Builder { private var unitAmount: String? = null - private var dimensionValues: List? = null + private var dimensionValues: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -26516,7 +26916,19 @@ constructor( * cloud region and an instance tier. */ fun dimensionValues(dimensionValues: List) = apply { - this.dimensionValues = dimensionValues + this.dimensionValues = dimensionValues.toMutableList() + } + + /** + * One or two matrix keys to filter usage to this Matrix value by. For + * example, ["region", "tier"] could be used to filter cloud usage by a + * cloud region and an instance tier. + */ + fun addDimensionValue(dimensionValue: String) = apply { + dimensionValues = + (dimensionValues ?: mutableListOf()).apply { + add(dimensionValue) + } } fun additionalProperties(additionalProperties: Map) = @@ -27527,7 +27939,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -27540,7 +27952,14 @@ constructor( /** * Tiers for rating based on total usage quantities into the specified tier */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** + * Tiers for rating based on total usage quantities into the specified tier + */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { @@ -28598,7 +29017,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -28613,7 +29032,15 @@ constructor( * Tiers for a Graduated BPS pricing model, where usage is bucketed into * specified tiers */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** + * Tiers for a Graduated BPS pricing model, where usage is bucketed into + * specified tiers + */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { @@ -30496,7 +30923,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -30510,7 +30937,15 @@ constructor( * Tiers for a bulk BPS pricing model where all usage is aggregated to a * single tier based on total volume */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** + * Tiers for a bulk BPS pricing model where all usage is aggregated to a + * single tier based on total volume + */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { @@ -31552,7 +31987,7 @@ constructor( class Builder { - private var tiers: List? = null + private var tiers: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -31563,7 +31998,12 @@ constructor( } /** Bulk tiers for rating based on total usage volume */ - fun tiers(tiers: List) = apply { this.tiers = tiers } + fun tiers(tiers: List) = apply { this.tiers = tiers.toMutableList() } + + /** Bulk tiers for rating based on total usage volume */ + fun addTier(tier: Tier) = apply { + tiers = (tiers ?: mutableListOf()).apply { add(tier) } + } fun additionalProperties(additionalProperties: Map) = apply { @@ -41734,11 +42174,11 @@ constructor( return true } - return /* spotless:off */ other is SubscriptionSchedulePlanChangeParams && subscriptionId == other.subscriptionId && changeOption == other.changeOption && addAdjustments == other.addAdjustments && addPrices == other.addPrices && alignBillingWithPlanChangeDate == other.alignBillingWithPlanChangeDate && autoCollection == other.autoCollection && billingCycleAlignment == other.billingCycleAlignment && billingCycleAnchorConfiguration == other.billingCycleAnchorConfiguration && changeDate == other.changeDate && couponRedemptionCode == other.couponRedemptionCode && creditsOverageRate == other.creditsOverageRate && defaultInvoiceMemo == other.defaultInvoiceMemo && externalPlanId == other.externalPlanId && filter == other.filter && initialPhaseOrder == other.initialPhaseOrder && invoicingThreshold == other.invoicingThreshold && netTerms == other.netTerms && perCreditOverageAmount == other.perCreditOverageAmount && planId == other.planId && planVersionNumber == other.planVersionNumber && priceOverrides == other.priceOverrides && removeAdjustments == other.removeAdjustments && removePrices == other.removePrices && replaceAdjustments == other.replaceAdjustments && replacePrices == other.replacePrices && trialDurationDays == other.trialDurationDays && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionSchedulePlanChangeParams && subscriptionId == other.subscriptionId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(subscriptionId, changeOption, addAdjustments, addPrices, alignBillingWithPlanChangeDate, autoCollection, billingCycleAlignment, billingCycleAnchorConfiguration, changeDate, couponRedemptionCode, creditsOverageRate, defaultInvoiceMemo, externalPlanId, filter, initialPhaseOrder, invoicingThreshold, netTerms, perCreditOverageAmount, planId, planVersionNumber, priceOverrides, removeAdjustments, removePrices, replaceAdjustments, replacePrices, trialDurationDays, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(subscriptionId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "SubscriptionSchedulePlanChangeParams{subscriptionId=$subscriptionId, changeOption=$changeOption, addAdjustments=$addAdjustments, addPrices=$addPrices, alignBillingWithPlanChangeDate=$alignBillingWithPlanChangeDate, autoCollection=$autoCollection, billingCycleAlignment=$billingCycleAlignment, billingCycleAnchorConfiguration=$billingCycleAnchorConfiguration, changeDate=$changeDate, couponRedemptionCode=$couponRedemptionCode, creditsOverageRate=$creditsOverageRate, defaultInvoiceMemo=$defaultInvoiceMemo, externalPlanId=$externalPlanId, filter=$filter, initialPhaseOrder=$initialPhaseOrder, invoicingThreshold=$invoicingThreshold, netTerms=$netTerms, perCreditOverageAmount=$perCreditOverageAmount, planId=$planId, planVersionNumber=$planVersionNumber, priceOverrides=$priceOverrides, removeAdjustments=$removeAdjustments, removePrices=$removePrices, replaceAdjustments=$replaceAdjustments, replacePrices=$replacePrices, trialDurationDays=$trialDurationDays, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "SubscriptionSchedulePlanChangeParams{subscriptionId=$subscriptionId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseParams.kt index 8965c80f..d02d59f8 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseParams.kt @@ -20,26 +20,26 @@ import java.util.Optional class SubscriptionTriggerPhaseParams constructor( private val subscriptionId: String, - private val effectiveDate: LocalDate?, + private val body: SubscriptionTriggerPhaseBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun subscriptionId(): String = subscriptionId - fun effectiveDate(): Optional = Optional.ofNullable(effectiveDate) + /** + * The date on which the phase change should take effect. If not provided, defaults to today in + * the customer's timezone. + */ + fun effectiveDate(): Optional = body.effectiveDate() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): SubscriptionTriggerPhaseBody { - return SubscriptionTriggerPhaseBody(effectiveDate, additionalBodyProperties) - } + @JvmSynthetic internal fun getBody(): SubscriptionTriggerPhaseBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -151,19 +151,17 @@ constructor( class Builder { private var subscriptionId: String? = null - private var effectiveDate: LocalDate? = null + private var body: SubscriptionTriggerPhaseBody.Builder = + SubscriptionTriggerPhaseBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(subscriptionTriggerPhaseParams: SubscriptionTriggerPhaseParams) = apply { subscriptionId = subscriptionTriggerPhaseParams.subscriptionId - effectiveDate = subscriptionTriggerPhaseParams.effectiveDate + body = subscriptionTriggerPhaseParams.body.toBuilder() additionalHeaders = subscriptionTriggerPhaseParams.additionalHeaders.toBuilder() additionalQueryParams = subscriptionTriggerPhaseParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - subscriptionTriggerPhaseParams.additionalBodyProperties.toMutableMap() } fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } @@ -172,7 +170,7 @@ constructor( * The date on which the phase change should take effect. If not provided, defaults to today * in the customer's timezone. */ - fun effectiveDate(effectiveDate: LocalDate) = apply { this.effectiveDate = effectiveDate } + fun effectiveDate(effectiveDate: LocalDate) = apply { body.effectiveDate(effectiveDate) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -273,34 +271,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): SubscriptionTriggerPhaseParams = SubscriptionTriggerPhaseParams( checkNotNull(subscriptionId) { "`subscriptionId` is required but was not set" }, - effectiveDate, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -309,11 +303,11 @@ constructor( return true } - return /* spotless:off */ other is SubscriptionTriggerPhaseParams && subscriptionId == other.subscriptionId && effectiveDate == other.effectiveDate && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionTriggerPhaseParams && subscriptionId == other.subscriptionId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(subscriptionId, effectiveDate, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(subscriptionId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "SubscriptionTriggerPhaseParams{subscriptionId=$subscriptionId, effectiveDate=$effectiveDate, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "SubscriptionTriggerPhaseParams{subscriptionId=$subscriptionId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationParams.kt index 130a1dc3..f9b83ee5 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationParams.kt @@ -27,9 +27,8 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties @JvmSynthetic - internal fun getBody(): Optional> { - return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - } + internal fun getBody(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesParams.kt index fa8b1d2f..9a5e8b0a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesParams.kt @@ -18,26 +18,23 @@ import java.util.Objects class SubscriptionUnscheduleFixedFeeQuantityUpdatesParams constructor( private val subscriptionId: String, - private val priceId: String, + private val body: SubscriptionUnscheduleFixedFeeQuantityUpdatesBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun subscriptionId(): String = subscriptionId - fun priceId(): String = priceId + /** Price for which the updates should be cleared. Must be a fixed fee. */ + fun priceId(): String = body.priceId() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): SubscriptionUnscheduleFixedFeeQuantityUpdatesBody { - return SubscriptionUnscheduleFixedFeeQuantityUpdatesBody(priceId, additionalBodyProperties) - } + @JvmSynthetic internal fun getBody(): SubscriptionUnscheduleFixedFeeQuantityUpdatesBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -147,10 +144,10 @@ constructor( class Builder { private var subscriptionId: String? = null - private var priceId: String? = null + private var body: SubscriptionUnscheduleFixedFeeQuantityUpdatesBody.Builder = + SubscriptionUnscheduleFixedFeeQuantityUpdatesBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( @@ -158,21 +155,18 @@ constructor( SubscriptionUnscheduleFixedFeeQuantityUpdatesParams ) = apply { subscriptionId = subscriptionUnscheduleFixedFeeQuantityUpdatesParams.subscriptionId - priceId = subscriptionUnscheduleFixedFeeQuantityUpdatesParams.priceId + body = subscriptionUnscheduleFixedFeeQuantityUpdatesParams.body.toBuilder() additionalHeaders = subscriptionUnscheduleFixedFeeQuantityUpdatesParams.additionalHeaders.toBuilder() additionalQueryParams = subscriptionUnscheduleFixedFeeQuantityUpdatesParams.additionalQueryParams .toBuilder() - additionalBodyProperties = - subscriptionUnscheduleFixedFeeQuantityUpdatesParams.additionalBodyProperties - .toMutableMap() } fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } /** Price for which the updates should be cleared. Must be a fixed fee. */ - fun priceId(priceId: String) = apply { this.priceId = priceId } + fun priceId(priceId: String) = apply { body.priceId(priceId) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -273,34 +267,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): SubscriptionUnscheduleFixedFeeQuantityUpdatesParams = SubscriptionUnscheduleFixedFeeQuantityUpdatesParams( checkNotNull(subscriptionId) { "`subscriptionId` is required but was not set" }, - checkNotNull(priceId) { "`priceId` is required but was not set" }, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -309,11 +299,11 @@ constructor( return true } - return /* spotless:off */ other is SubscriptionUnscheduleFixedFeeQuantityUpdatesParams && subscriptionId == other.subscriptionId && priceId == other.priceId && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionUnscheduleFixedFeeQuantityUpdatesParams && subscriptionId == other.subscriptionId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(subscriptionId, priceId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(subscriptionId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "SubscriptionUnscheduleFixedFeeQuantityUpdatesParams{subscriptionId=$subscriptionId, priceId=$priceId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "SubscriptionUnscheduleFixedFeeQuantityUpdatesParams{subscriptionId=$subscriptionId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesParams.kt index 2f29baa1..7de0a3cc 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesParams.kt @@ -27,9 +27,8 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties @JvmSynthetic - internal fun getBody(): Optional> { - return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - } + internal fun getBody(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityParams.kt index 5bff02a7..2c0e9ba4 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityParams.kt @@ -23,41 +23,39 @@ import java.util.Optional class SubscriptionUpdateFixedFeeQuantityParams constructor( private val subscriptionId: String, - private val priceId: String, - private val quantity: Double, - private val changeOption: ChangeOption?, - private val effectiveDate: LocalDate?, + private val body: SubscriptionUpdateFixedFeeQuantityBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun subscriptionId(): String = subscriptionId - fun priceId(): String = priceId + /** Price for which the quantity should be updated. Must be a fixed fee. */ + fun priceId(): String = body.priceId() - fun quantity(): Double = quantity + fun quantity(): Double = body.quantity() - fun changeOption(): Optional = Optional.ofNullable(changeOption) + /** + * Determines when the change takes effect. Note that if `effective_date` is specified, this + * defaults to `effective_date`. Otherwise, this defaults to `immediate` unless it's explicitly + * set to `upcoming_invoice. + */ + fun changeOption(): Optional = body.changeOption() - fun effectiveDate(): Optional = Optional.ofNullable(effectiveDate) + /** + * The date that the quantity change should take effect, localized to the customer's timezone. + * Ifthis parameter is not passed in, the quantity change is effective according to + * `change_option`. + */ + fun effectiveDate(): Optional = body.effectiveDate() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): SubscriptionUpdateFixedFeeQuantityBody { - return SubscriptionUpdateFixedFeeQuantityBody( - priceId, - quantity, - changeOption, - effectiveDate, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): SubscriptionUpdateFixedFeeQuantityBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -215,51 +213,43 @@ constructor( class Builder { private var subscriptionId: String? = null - private var priceId: String? = null - private var quantity: Double? = null - private var changeOption: ChangeOption? = null - private var effectiveDate: LocalDate? = null + private var body: SubscriptionUpdateFixedFeeQuantityBody.Builder = + SubscriptionUpdateFixedFeeQuantityBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( subscriptionUpdateFixedFeeQuantityParams: SubscriptionUpdateFixedFeeQuantityParams ) = apply { subscriptionId = subscriptionUpdateFixedFeeQuantityParams.subscriptionId - priceId = subscriptionUpdateFixedFeeQuantityParams.priceId - quantity = subscriptionUpdateFixedFeeQuantityParams.quantity - changeOption = subscriptionUpdateFixedFeeQuantityParams.changeOption - effectiveDate = subscriptionUpdateFixedFeeQuantityParams.effectiveDate + body = subscriptionUpdateFixedFeeQuantityParams.body.toBuilder() additionalHeaders = subscriptionUpdateFixedFeeQuantityParams.additionalHeaders.toBuilder() additionalQueryParams = subscriptionUpdateFixedFeeQuantityParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - subscriptionUpdateFixedFeeQuantityParams.additionalBodyProperties.toMutableMap() } fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } /** Price for which the quantity should be updated. Must be a fixed fee. */ - fun priceId(priceId: String) = apply { this.priceId = priceId } + fun priceId(priceId: String) = apply { body.priceId(priceId) } - fun quantity(quantity: Double) = apply { this.quantity = quantity } + fun quantity(quantity: Double) = apply { body.quantity(quantity) } /** * Determines when the change takes effect. Note that if `effective_date` is specified, this * defaults to `effective_date`. Otherwise, this defaults to `immediate` unless it's * explicitly set to `upcoming_invoice. */ - fun changeOption(changeOption: ChangeOption) = apply { this.changeOption = changeOption } + fun changeOption(changeOption: ChangeOption) = apply { body.changeOption(changeOption) } /** * The date that the quantity change should take effect, localized to the customer's * timezone. Ifthis parameter is not passed in, the quantity change is effective according * to `change_option`. */ - fun effectiveDate(effectiveDate: LocalDate) = apply { this.effectiveDate = effectiveDate } + fun effectiveDate(effectiveDate: LocalDate) = apply { body.effectiveDate(effectiveDate) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -360,37 +350,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): SubscriptionUpdateFixedFeeQuantityParams = SubscriptionUpdateFixedFeeQuantityParams( checkNotNull(subscriptionId) { "`subscriptionId` is required but was not set" }, - checkNotNull(priceId) { "`priceId` is required but was not set" }, - checkNotNull(quantity) { "`quantity` is required but was not set" }, - changeOption, - effectiveDate, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -462,11 +445,11 @@ constructor( return true } - return /* spotless:off */ other is SubscriptionUpdateFixedFeeQuantityParams && subscriptionId == other.subscriptionId && priceId == other.priceId && quantity == other.quantity && changeOption == other.changeOption && effectiveDate == other.effectiveDate && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionUpdateFixedFeeQuantityParams && subscriptionId == other.subscriptionId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(subscriptionId, priceId, quantity, changeOption, effectiveDate, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(subscriptionId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "SubscriptionUpdateFixedFeeQuantityParams{subscriptionId=$subscriptionId, priceId=$priceId, quantity=$quantity, changeOption=$changeOption, effectiveDate=$effectiveDate, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "SubscriptionUpdateFixedFeeQuantityParams{subscriptionId=$subscriptionId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateParams.kt index 2f4182a3..0c7b1984 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateParams.kt @@ -19,45 +19,53 @@ import java.util.Optional class SubscriptionUpdateParams constructor( private val subscriptionId: String, - private val autoCollection: Boolean?, - private val defaultInvoiceMemo: String?, - private val invoicingThreshold: String?, - private val metadata: Metadata?, - private val netTerms: Long?, + private val body: SubscriptionUpdateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun subscriptionId(): String = subscriptionId - fun autoCollection(): Optional = Optional.ofNullable(autoCollection) + /** + * Determines whether issued invoices for this subscription will automatically be charged with + * the saved payment method on the due date. This property defaults to the plan's behavior. + */ + fun autoCollection(): Optional = body.autoCollection() - fun defaultInvoiceMemo(): Optional = Optional.ofNullable(defaultInvoiceMemo) + /** + * Determines the default memo on this subscription's invoices. Note that if this is not + * provided, it is determined by the plan configuration. + */ + fun defaultInvoiceMemo(): Optional = body.defaultInvoiceMemo() - fun invoicingThreshold(): Optional = Optional.ofNullable(invoicingThreshold) + /** + * When this subscription's accrued usage reaches this threshold, an invoice will be issued for + * the subscription. If not specified, invoices will only be issued at the end of the billing + * period. + */ + fun invoicingThreshold(): Optional = body.invoicingThreshold() - fun metadata(): Optional = Optional.ofNullable(metadata) + /** + * User-specified key/value pairs for the resource. Individual keys can be removed by setting + * the value to `null`, and the entire metadata mapping can be cleared by setting `metadata` to + * `null`. + */ + fun metadata(): Optional = body.metadata() - fun netTerms(): Optional = Optional.ofNullable(netTerms) + /** + * Determines the difference between the invoice issue date for subscription invoices as the + * date that they are due. A value of `0` here represents that the invoice is due on issue, + * whereas a value of `30` represents that the customer has a month to pay the invoice. + */ + fun netTerms(): Optional = body.netTerms() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): SubscriptionUpdateBody { - return SubscriptionUpdateBody( - autoCollection, - defaultInvoiceMemo, - invoicingThreshold, - metadata, - netTerms, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): SubscriptionUpdateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -250,27 +258,16 @@ constructor( class Builder { private var subscriptionId: String? = null - private var autoCollection: Boolean? = null - private var defaultInvoiceMemo: String? = null - private var invoicingThreshold: String? = null - private var metadata: Metadata? = null - private var netTerms: Long? = null + private var body: SubscriptionUpdateBody.Builder = SubscriptionUpdateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(subscriptionUpdateParams: SubscriptionUpdateParams) = apply { subscriptionId = subscriptionUpdateParams.subscriptionId - autoCollection = subscriptionUpdateParams.autoCollection - defaultInvoiceMemo = subscriptionUpdateParams.defaultInvoiceMemo - invoicingThreshold = subscriptionUpdateParams.invoicingThreshold - metadata = subscriptionUpdateParams.metadata - netTerms = subscriptionUpdateParams.netTerms + body = subscriptionUpdateParams.body.toBuilder() additionalHeaders = subscriptionUpdateParams.additionalHeaders.toBuilder() additionalQueryParams = subscriptionUpdateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - subscriptionUpdateParams.additionalBodyProperties.toMutableMap() } fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } @@ -280,14 +277,14 @@ constructor( * with the saved payment method on the due date. This property defaults to the plan's * behavior. */ - fun autoCollection(autoCollection: Boolean) = apply { this.autoCollection = autoCollection } + fun autoCollection(autoCollection: Boolean) = apply { body.autoCollection(autoCollection) } /** * Determines the default memo on this subscription's invoices. Note that if this is not * provided, it is determined by the plan configuration. */ fun defaultInvoiceMemo(defaultInvoiceMemo: String) = apply { - this.defaultInvoiceMemo = defaultInvoiceMemo + body.defaultInvoiceMemo(defaultInvoiceMemo) } /** @@ -296,7 +293,7 @@ constructor( * billing period. */ fun invoicingThreshold(invoicingThreshold: String) = apply { - this.invoicingThreshold = invoicingThreshold + body.invoicingThreshold(invoicingThreshold) } /** @@ -304,14 +301,14 @@ constructor( * setting the value to `null`, and the entire metadata mapping can be cleared by setting * `metadata` to `null`. */ - fun metadata(metadata: Metadata) = apply { this.metadata = metadata } + fun metadata(metadata: Metadata) = apply { body.metadata(metadata) } /** * Determines the difference between the invoice issue date for subscription invoices as the * date that they are due. A value of `0` here represents that the invoice is due on issue, * whereas a value of `30` represents that the customer has a month to pay the invoice. */ - fun netTerms(netTerms: Long) = apply { this.netTerms = netTerms } + fun netTerms(netTerms: Long) = apply { body.netTerms(netTerms) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -412,38 +409,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): SubscriptionUpdateParams = SubscriptionUpdateParams( checkNotNull(subscriptionId) { "`subscriptionId` is required but was not set" }, - autoCollection, - defaultInvoiceMemo, - invoicingThreshold, - metadata, - netTerms, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -524,11 +513,11 @@ constructor( return true } - return /* spotless:off */ other is SubscriptionUpdateParams && subscriptionId == other.subscriptionId && autoCollection == other.autoCollection && defaultInvoiceMemo == other.defaultInvoiceMemo && invoicingThreshold == other.invoicingThreshold && metadata == other.metadata && netTerms == other.netTerms && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionUpdateParams && subscriptionId == other.subscriptionId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(subscriptionId, autoCollection, defaultInvoiceMemo, invoicingThreshold, metadata, netTerms, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(subscriptionId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "SubscriptionUpdateParams{subscriptionId=$subscriptionId, autoCollection=$autoCollection, defaultInvoiceMemo=$defaultInvoiceMemo, invoicingThreshold=$invoicingThreshold, metadata=$metadata, netTerms=$netTerms, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "SubscriptionUpdateParams{subscriptionId=$subscriptionId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialParams.kt index 646514d1..41f0fe93 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialParams.kt @@ -33,33 +33,32 @@ import java.util.Optional class SubscriptionUpdateTrialParams constructor( private val subscriptionId: String, - private val trialEndDate: TrialEndDate, - private val shift: Boolean?, + private val body: SubscriptionUpdateTrialBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun subscriptionId(): String = subscriptionId - fun trialEndDate(): TrialEndDate = trialEndDate + /** + * The new date that the trial should end, or the literal string `immediate` to end the trial + * immediately. + */ + fun trialEndDate(): TrialEndDate = body.trialEndDate() - fun shift(): Optional = Optional.ofNullable(shift) + /** + * If true, shifts subsequent price and adjustment intervals (preserving their durations, but + * adjusting their absolute dates). + */ + fun shift(): Optional = body.shift() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): SubscriptionUpdateTrialBody { - return SubscriptionUpdateTrialBody( - trialEndDate, - shift, - additionalBodyProperties, - ) - } + @JvmSynthetic internal fun getBody(): SubscriptionUpdateTrialBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -127,6 +126,14 @@ constructor( this.trialEndDate = trialEndDate } + fun trialEndDate(offsetDateTime: OffsetDateTime) = apply { + this.trialEndDate = TrialEndDate.ofOffsetDateTime(offsetDateTime) + } + + fun trialEndDate(unionMember1: TrialEndDate.UnionMember1) = apply { + this.trialEndDate = TrialEndDate.ofUnionMember1(unionMember1) + } + /** * If true, shifts subsequent price and adjustment intervals (preserving their * durations, but adjusting their absolute dates). @@ -189,21 +196,17 @@ constructor( class Builder { private var subscriptionId: String? = null - private var trialEndDate: TrialEndDate? = null - private var shift: Boolean? = null + private var body: SubscriptionUpdateTrialBody.Builder = + SubscriptionUpdateTrialBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(subscriptionUpdateTrialParams: SubscriptionUpdateTrialParams) = apply { subscriptionId = subscriptionUpdateTrialParams.subscriptionId - trialEndDate = subscriptionUpdateTrialParams.trialEndDate - shift = subscriptionUpdateTrialParams.shift + body = subscriptionUpdateTrialParams.body.toBuilder() additionalHeaders = subscriptionUpdateTrialParams.additionalHeaders.toBuilder() additionalQueryParams = subscriptionUpdateTrialParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - subscriptionUpdateTrialParams.additionalBodyProperties.toMutableMap() } fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } @@ -212,29 +215,21 @@ constructor( * The new date that the trial should end, or the literal string `immediate` to end the * trial immediately. */ - fun trialEndDate(trialEndDate: TrialEndDate) = apply { this.trialEndDate = trialEndDate } + fun trialEndDate(trialEndDate: TrialEndDate) = apply { body.trialEndDate(trialEndDate) } - /** - * The new date that the trial should end, or the literal string `immediate` to end the - * trial immediately. - */ fun trialEndDate(offsetDateTime: OffsetDateTime) = apply { - this.trialEndDate = TrialEndDate.ofOffsetDateTime(offsetDateTime) + body.trialEndDate(offsetDateTime) } - /** - * The new date that the trial should end, or the literal string `immediate` to end the - * trial immediately. - */ fun trialEndDate(unionMember1: TrialEndDate.UnionMember1) = apply { - this.trialEndDate = TrialEndDate.ofUnionMember1(unionMember1) + body.trialEndDate(unionMember1) } /** * If true, shifts subsequent price and adjustment intervals (preserving their durations, * but adjusting their absolute dates). */ - fun shift(shift: Boolean) = apply { this.shift = shift } + fun shift(shift: Boolean) = apply { body.shift(shift) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -335,35 +330,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): SubscriptionUpdateTrialParams = SubscriptionUpdateTrialParams( checkNotNull(subscriptionId) { "`subscriptionId` is required but was not set" }, - checkNotNull(trialEndDate) { "`trialEndDate` is required but was not set" }, - shift, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -527,11 +517,11 @@ constructor( return true } - return /* spotless:off */ other is SubscriptionUpdateTrialParams && subscriptionId == other.subscriptionId && trialEndDate == other.trialEndDate && shift == other.shift && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SubscriptionUpdateTrialParams && subscriptionId == other.subscriptionId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(subscriptionId, trialEndDate, shift, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(subscriptionId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "SubscriptionUpdateTrialParams{subscriptionId=$subscriptionId, trialEndDate=$trialEndDate, shift=$shift, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "SubscriptionUpdateTrialParams{subscriptionId=$subscriptionId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" }