@chargebee/code-sample-generator 0.3.5 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/browser.js +11 -11
  2. package/dist/code-sample-generator.css +42 -23
  3. package/dist/components/Carousel.d.ts.map +1 -1
  4. package/dist/core/expander.d.ts.map +1 -1
  5. package/dist/core/ir-builder.d.ts.map +1 -1
  6. package/dist/core/minimal-types.d.ts +2 -0
  7. package/dist/core/minimal-types.d.ts.map +1 -1
  8. package/dist/core/types.d.ts +2 -0
  9. package/dist/core/types.d.ts.map +1 -1
  10. package/dist/core/validation.d.ts.map +1 -1
  11. package/dist/{generate-from-sample-rMSyyork.js → generate-from-sample-DhbfCFUp.js} +1404 -659
  12. package/dist/{generate-from-sample-rMSyyork.js.map → generate-from-sample-DhbfCFUp.js.map} +1 -1
  13. package/dist/generated/ops/v2-pcv1/create_a_usage_event.d.ts.map +1 -1
  14. package/dist/generated/ops/v2-pcv1/create_an_offer_event.d.ts.map +1 -1
  15. package/dist/generated/ops/v2-pcv1/create_an_offer_fulfillment.d.ts.map +1 -1
  16. package/dist/generated/ops/v2-pcv1/get_uploaded_file_processing_status.d.ts.map +1 -1
  17. package/dist/generated/ops/v2-pcv1/get_usages_file_upload_url.d.ts.map +1 -1
  18. package/dist/generated/ops/v2-pcv1/ingest_usages_in_batch.d.ts.map +1 -1
  19. package/dist/generated/ops/v2-pcv1/list_personalized_offers.d.ts.map +1 -1
  20. package/dist/generated/ops/v2-pcv1/retrieve_an_offer_fulfillment.d.ts.map +1 -1
  21. package/dist/generated/ops/v2-pcv1/update_an_offer_fulfillment.d.ts.map +1 -1
  22. package/dist/generated/ops/v2-pcv2/create_a_usage_event.d.ts.map +1 -1
  23. package/dist/generated/ops/v2-pcv2/create_an_offer_event.d.ts.map +1 -1
  24. package/dist/generated/ops/v2-pcv2/create_an_offer_fulfillment.d.ts.map +1 -1
  25. package/dist/generated/ops/v2-pcv2/get_uploaded_file_processing_status.d.ts.map +1 -1
  26. package/dist/generated/ops/v2-pcv2/get_usages_file_upload_url.d.ts.map +1 -1
  27. package/dist/generated/ops/v2-pcv2/ingest_usages_in_batch.d.ts.map +1 -1
  28. package/dist/generated/ops/v2-pcv2/list_personalized_offers.d.ts.map +1 -1
  29. package/dist/generated/ops/v2-pcv2/retrieve_an_offer_fulfillment.d.ts.map +1 -1
  30. package/dist/generated/ops/v2-pcv2/update_an_offer_fulfillment.d.ts.map +1 -1
  31. package/dist/generators/dotnet.d.ts.map +1 -1
  32. package/dist/generators/go.d.ts.map +1 -1
  33. package/dist/generators/java/utils.d.ts.map +1 -1
  34. package/dist/generators/java/v3.d.ts.map +1 -1
  35. package/dist/generators/java/v4.d.ts.map +1 -1
  36. package/dist/generators/nodejs.d.ts.map +1 -1
  37. package/dist/generators/php.d.ts.map +1 -1
  38. package/dist/generators/ruby.d.ts.map +1 -1
  39. package/dist/generators/utils.d.ts +5 -0
  40. package/dist/generators/utils.d.ts.map +1 -1
  41. package/dist/index.js +155 -322
  42. package/dist/index.js.map +1 -1
  43. package/dist/samples/repo.d.ts.map +1 -1
  44. package/dist/templates/utils.d.ts.map +1 -1
  45. package/dist/types.d.ts +8 -0
  46. package/dist/types.d.ts.map +1 -1
  47. package/dist/utils/generate-code-sample.d.ts +9 -0
  48. package/dist/utils/generate-code-sample.d.ts.map +1 -1
  49. package/dist/utils/generate-from-sample.d.ts.map +1 -1
  50. package/package.json +14 -15
@@ -133,9 +133,9 @@ function Carousel({
133
133
  return null;
134
134
  }
135
135
  if (items.length === 1) {
136
- return /* @__PURE__ */ jsx("div", { className: `relative ${className}`, children: items[0] });
136
+ return /* @__PURE__ */ jsx("div", { className: `carousel-container relative ${className}`, children: items[0] });
137
137
  }
138
- return /* @__PURE__ */ jsxs("div", { className: `relative ${className}`, children: [
138
+ return /* @__PURE__ */ jsxs("div", { className: `carousel-container relative ${className}`, children: [
139
139
  /* @__PURE__ */ jsxs("div", { className: "carousel-nav-bar flex items-center justify-between px-8 py-4", children: [
140
140
  /* @__PURE__ */ jsxs(
141
141
  "button",
@@ -9633,7 +9633,7 @@ function CodeBlock({
9633
9633
  "div",
9634
9634
  {
9635
9635
  ref: containerRef,
9636
- className: `font-mono text-[13px] leading-relaxed transition-all duration-300 ease-in-out ${className} ${hideImportsProp ? "hide-code-imports" : ""}`,
9636
+ className: `font-mono text-[13px] leading-relaxed transition-all duration-300 ease-in-out ${isDark ? "dark" : ""} ${className} ${hideImportsProp ? "hide-code-imports" : ""}`,
9637
9637
  style: {
9638
9638
  backgroundColor: isDark ? "#24292e" : "#ffffff",
9639
9639
  // Always white background for light mode (matching API Explorer design)
@@ -10294,6 +10294,365 @@ function LanguageSwitcher({
10294
10294
  )) })
10295
10295
  ] });
10296
10296
  }
10297
+ function getDefaultExportFromCjs(x) {
10298
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
10299
+ }
10300
+ function commonjsRequire(path) {
10301
+ throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
10302
+ }
10303
+ var pluralize$2 = { exports: {} };
10304
+ var pluralize$1 = pluralize$2.exports;
10305
+ var hasRequiredPluralize;
10306
+ function requirePluralize() {
10307
+ if (hasRequiredPluralize) return pluralize$2.exports;
10308
+ hasRequiredPluralize = 1;
10309
+ (function(module, exports$1) {
10310
+ (function(root2, pluralize2) {
10311
+ if (typeof commonjsRequire === "function" && true && true) {
10312
+ module.exports = pluralize2();
10313
+ } else {
10314
+ root2.pluralize = pluralize2();
10315
+ }
10316
+ })(pluralize$1, function() {
10317
+ var pluralRules = [];
10318
+ var singularRules = [];
10319
+ var uncountables = {};
10320
+ var irregularPlurals = {};
10321
+ var irregularSingles = {};
10322
+ function sanitizeRule(rule) {
10323
+ if (typeof rule === "string") {
10324
+ return new RegExp("^" + rule + "$", "i");
10325
+ }
10326
+ return rule;
10327
+ }
10328
+ function restoreCase(word, token) {
10329
+ if (word === token) return token;
10330
+ if (word === word.toLowerCase()) return token.toLowerCase();
10331
+ if (word === word.toUpperCase()) return token.toUpperCase();
10332
+ if (word[0] === word[0].toUpperCase()) {
10333
+ return token.charAt(0).toUpperCase() + token.substr(1).toLowerCase();
10334
+ }
10335
+ return token.toLowerCase();
10336
+ }
10337
+ function interpolate(str, args) {
10338
+ return str.replace(/\$(\d{1,2})/g, function(match, index) {
10339
+ return args[index] || "";
10340
+ });
10341
+ }
10342
+ function replace(word, rule) {
10343
+ return word.replace(rule[0], function(match, index) {
10344
+ var result = interpolate(rule[1], arguments);
10345
+ if (match === "") {
10346
+ return restoreCase(word[index - 1], result);
10347
+ }
10348
+ return restoreCase(match, result);
10349
+ });
10350
+ }
10351
+ function sanitizeWord(token, word, rules) {
10352
+ if (!token.length || uncountables.hasOwnProperty(token)) {
10353
+ return word;
10354
+ }
10355
+ var len = rules.length;
10356
+ while (len--) {
10357
+ var rule = rules[len];
10358
+ if (rule[0].test(word)) return replace(word, rule);
10359
+ }
10360
+ return word;
10361
+ }
10362
+ function replaceWord(replaceMap, keepMap, rules) {
10363
+ return function(word) {
10364
+ var token = word.toLowerCase();
10365
+ if (keepMap.hasOwnProperty(token)) {
10366
+ return restoreCase(word, token);
10367
+ }
10368
+ if (replaceMap.hasOwnProperty(token)) {
10369
+ return restoreCase(word, replaceMap[token]);
10370
+ }
10371
+ return sanitizeWord(token, word, rules);
10372
+ };
10373
+ }
10374
+ function checkWord(replaceMap, keepMap, rules, bool) {
10375
+ return function(word) {
10376
+ var token = word.toLowerCase();
10377
+ if (keepMap.hasOwnProperty(token)) return true;
10378
+ if (replaceMap.hasOwnProperty(token)) return false;
10379
+ return sanitizeWord(token, token, rules) === token;
10380
+ };
10381
+ }
10382
+ function pluralize2(word, count, inclusive) {
10383
+ var pluralized = count === 1 ? pluralize2.singular(word) : pluralize2.plural(word);
10384
+ return (inclusive ? count + " " : "") + pluralized;
10385
+ }
10386
+ pluralize2.plural = replaceWord(
10387
+ irregularSingles,
10388
+ irregularPlurals,
10389
+ pluralRules
10390
+ );
10391
+ pluralize2.isPlural = checkWord(
10392
+ irregularSingles,
10393
+ irregularPlurals,
10394
+ pluralRules
10395
+ );
10396
+ pluralize2.singular = replaceWord(
10397
+ irregularPlurals,
10398
+ irregularSingles,
10399
+ singularRules
10400
+ );
10401
+ pluralize2.isSingular = checkWord(
10402
+ irregularPlurals,
10403
+ irregularSingles,
10404
+ singularRules
10405
+ );
10406
+ pluralize2.addPluralRule = function(rule, replacement) {
10407
+ pluralRules.push([sanitizeRule(rule), replacement]);
10408
+ };
10409
+ pluralize2.addSingularRule = function(rule, replacement) {
10410
+ singularRules.push([sanitizeRule(rule), replacement]);
10411
+ };
10412
+ pluralize2.addUncountableRule = function(word) {
10413
+ if (typeof word === "string") {
10414
+ uncountables[word.toLowerCase()] = true;
10415
+ return;
10416
+ }
10417
+ pluralize2.addPluralRule(word, "$0");
10418
+ pluralize2.addSingularRule(word, "$0");
10419
+ };
10420
+ pluralize2.addIrregularRule = function(single, plural) {
10421
+ plural = plural.toLowerCase();
10422
+ single = single.toLowerCase();
10423
+ irregularSingles[single] = plural;
10424
+ irregularPlurals[plural] = single;
10425
+ };
10426
+ [
10427
+ // Pronouns.
10428
+ ["I", "we"],
10429
+ ["me", "us"],
10430
+ ["he", "they"],
10431
+ ["she", "they"],
10432
+ ["them", "them"],
10433
+ ["myself", "ourselves"],
10434
+ ["yourself", "yourselves"],
10435
+ ["itself", "themselves"],
10436
+ ["herself", "themselves"],
10437
+ ["himself", "themselves"],
10438
+ ["themself", "themselves"],
10439
+ ["is", "are"],
10440
+ ["was", "were"],
10441
+ ["has", "have"],
10442
+ ["this", "these"],
10443
+ ["that", "those"],
10444
+ // Words ending in with a consonant and `o`.
10445
+ ["echo", "echoes"],
10446
+ ["dingo", "dingoes"],
10447
+ ["volcano", "volcanoes"],
10448
+ ["tornado", "tornadoes"],
10449
+ ["torpedo", "torpedoes"],
10450
+ // Ends with `us`.
10451
+ ["genus", "genera"],
10452
+ ["viscus", "viscera"],
10453
+ // Ends with `ma`.
10454
+ ["stigma", "stigmata"],
10455
+ ["stoma", "stomata"],
10456
+ ["dogma", "dogmata"],
10457
+ ["lemma", "lemmata"],
10458
+ ["schema", "schemata"],
10459
+ ["anathema", "anathemata"],
10460
+ // Other irregular rules.
10461
+ ["ox", "oxen"],
10462
+ ["axe", "axes"],
10463
+ ["die", "dice"],
10464
+ ["yes", "yeses"],
10465
+ ["foot", "feet"],
10466
+ ["eave", "eaves"],
10467
+ ["goose", "geese"],
10468
+ ["tooth", "teeth"],
10469
+ ["quiz", "quizzes"],
10470
+ ["human", "humans"],
10471
+ ["proof", "proofs"],
10472
+ ["carve", "carves"],
10473
+ ["valve", "valves"],
10474
+ ["looey", "looies"],
10475
+ ["thief", "thieves"],
10476
+ ["groove", "grooves"],
10477
+ ["pickaxe", "pickaxes"],
10478
+ ["passerby", "passersby"]
10479
+ ].forEach(function(rule) {
10480
+ return pluralize2.addIrregularRule(rule[0], rule[1]);
10481
+ });
10482
+ [
10483
+ [/s?$/i, "s"],
10484
+ [/[^\u0000-\u007F]$/i, "$0"],
10485
+ [/([^aeiou]ese)$/i, "$1"],
10486
+ [/(ax|test)is$/i, "$1es"],
10487
+ [/(alias|[^aou]us|t[lm]as|gas|ris)$/i, "$1es"],
10488
+ [/(e[mn]u)s?$/i, "$1s"],
10489
+ [/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, "$1"],
10490
+ [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1i"],
10491
+ [/(alumn|alg|vertebr)(?:a|ae)$/i, "$1ae"],
10492
+ [/(seraph|cherub)(?:im)?$/i, "$1im"],
10493
+ [/(her|at|gr)o$/i, "$1oes"],
10494
+ [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, "$1a"],
10495
+ [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, "$1a"],
10496
+ [/sis$/i, "ses"],
10497
+ [/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, "$1$2ves"],
10498
+ [/([^aeiouy]|qu)y$/i, "$1ies"],
10499
+ [/([^ch][ieo][ln])ey$/i, "$1ies"],
10500
+ [/(x|ch|ss|sh|zz)$/i, "$1es"],
10501
+ [/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, "$1ices"],
10502
+ [/\b((?:tit)?m|l)(?:ice|ouse)$/i, "$1ice"],
10503
+ [/(pe)(?:rson|ople)$/i, "$1ople"],
10504
+ [/(child)(?:ren)?$/i, "$1ren"],
10505
+ [/eaux$/i, "$0"],
10506
+ [/m[ae]n$/i, "men"],
10507
+ ["thou", "you"]
10508
+ ].forEach(function(rule) {
10509
+ return pluralize2.addPluralRule(rule[0], rule[1]);
10510
+ });
10511
+ [
10512
+ [/s$/i, ""],
10513
+ [/(ss)$/i, "$1"],
10514
+ [/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, "$1fe"],
10515
+ [/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, "$1f"],
10516
+ [/ies$/i, "y"],
10517
+ [/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, "$1ie"],
10518
+ [/\b(mon|smil)ies$/i, "$1ey"],
10519
+ [/\b((?:tit)?m|l)ice$/i, "$1ouse"],
10520
+ [/(seraph|cherub)im$/i, "$1"],
10521
+ [/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, "$1"],
10522
+ [/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, "$1sis"],
10523
+ [/(movie|twelve|abuse|e[mn]u)s$/i, "$1"],
10524
+ [/(test)(?:is|es)$/i, "$1is"],
10525
+ [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1us"],
10526
+ [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, "$1um"],
10527
+ [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, "$1on"],
10528
+ [/(alumn|alg|vertebr)ae$/i, "$1a"],
10529
+ [/(cod|mur|sil|vert|ind)ices$/i, "$1ex"],
10530
+ [/(matr|append)ices$/i, "$1ix"],
10531
+ [/(pe)(rson|ople)$/i, "$1rson"],
10532
+ [/(child)ren$/i, "$1"],
10533
+ [/(eau)x?$/i, "$1"],
10534
+ [/men$/i, "man"]
10535
+ ].forEach(function(rule) {
10536
+ return pluralize2.addSingularRule(rule[0], rule[1]);
10537
+ });
10538
+ [
10539
+ // Singular words with no plurals.
10540
+ "adulthood",
10541
+ "advice",
10542
+ "agenda",
10543
+ "aid",
10544
+ "aircraft",
10545
+ "alcohol",
10546
+ "ammo",
10547
+ "analytics",
10548
+ "anime",
10549
+ "athletics",
10550
+ "audio",
10551
+ "bison",
10552
+ "blood",
10553
+ "bream",
10554
+ "buffalo",
10555
+ "butter",
10556
+ "carp",
10557
+ "cash",
10558
+ "chassis",
10559
+ "chess",
10560
+ "clothing",
10561
+ "cod",
10562
+ "commerce",
10563
+ "cooperation",
10564
+ "corps",
10565
+ "debris",
10566
+ "diabetes",
10567
+ "digestion",
10568
+ "elk",
10569
+ "energy",
10570
+ "equipment",
10571
+ "excretion",
10572
+ "expertise",
10573
+ "firmware",
10574
+ "flounder",
10575
+ "fun",
10576
+ "gallows",
10577
+ "garbage",
10578
+ "graffiti",
10579
+ "hardware",
10580
+ "headquarters",
10581
+ "health",
10582
+ "herpes",
10583
+ "highjinks",
10584
+ "homework",
10585
+ "housework",
10586
+ "information",
10587
+ "jeans",
10588
+ "justice",
10589
+ "kudos",
10590
+ "labour",
10591
+ "literature",
10592
+ "machinery",
10593
+ "mackerel",
10594
+ "mail",
10595
+ "media",
10596
+ "mews",
10597
+ "moose",
10598
+ "music",
10599
+ "mud",
10600
+ "manga",
10601
+ "news",
10602
+ "only",
10603
+ "personnel",
10604
+ "pike",
10605
+ "plankton",
10606
+ "pliers",
10607
+ "police",
10608
+ "pollution",
10609
+ "premises",
10610
+ "rain",
10611
+ "research",
10612
+ "rice",
10613
+ "salmon",
10614
+ "scissors",
10615
+ "series",
10616
+ "sewage",
10617
+ "shambles",
10618
+ "shrimp",
10619
+ "software",
10620
+ "species",
10621
+ "staff",
10622
+ "swine",
10623
+ "tennis",
10624
+ "traffic",
10625
+ "transportation",
10626
+ "trout",
10627
+ "tuna",
10628
+ "wealth",
10629
+ "welfare",
10630
+ "whiting",
10631
+ "wildebeest",
10632
+ "wildlife",
10633
+ "you",
10634
+ /pok[eé]mon$/i,
10635
+ // Regexes.
10636
+ /[^aeiou]ese$/i,
10637
+ // "chinese", "japanese"
10638
+ /deer$/i,
10639
+ // "deer", "reindeer"
10640
+ /fish$/i,
10641
+ // "fish", "blowfish", "angelfish"
10642
+ /measles$/i,
10643
+ /o[iu]s$/i,
10644
+ // "carnivorous"
10645
+ /pox$/i,
10646
+ // "chickpox", "smallpox"
10647
+ /sheep$/i
10648
+ ].forEach(pluralize2.addUncountableRule);
10649
+ return pluralize2;
10650
+ });
10651
+ })(pluralize$2);
10652
+ return pluralize$2.exports;
10653
+ }
10654
+ var pluralizeExports = requirePluralize();
10655
+ const pluralize = /* @__PURE__ */ getDefaultExportFromCjs(pluralizeExports);
10297
10656
  const descriptor$c7 = {
10298
10657
  "id": "activate_a_portal_session",
10299
10658
  "http": {
@@ -24804,6 +25163,7 @@ const descriptor$9F = {
24804
25163
  },
24805
25164
  "resource": "usage_event",
24806
25165
  "method": "create",
25166
+ "subDomain": "ingest",
24807
25167
  "flags": {
24808
25168
  "json": true,
24809
25169
  "rb": true
@@ -26524,6 +26884,7 @@ const descriptor$9u = {
26524
26884
  },
26525
26885
  "resource": "offer_event",
26526
26886
  "method": "offerEvents",
26887
+ "subDomain": "grow",
26527
26888
  "flags": {
26528
26889
  "json": true,
26529
26890
  "rb": true
@@ -26552,6 +26913,7 @@ const descriptor$9t = {
26552
26913
  },
26553
26914
  "resource": "offer_fulfillment",
26554
26915
  "method": "offerFulfillments",
26916
+ "subDomain": "grow",
26555
26917
  "flags": {
26556
26918
  "json": true,
26557
26919
  "rb": true
@@ -40801,6 +41163,7 @@ const descriptor$8w = {
40801
41163
  },
40802
41164
  "resource": "usage_file",
40803
41165
  "method": "processingStatus",
41166
+ "subDomain": "file-ingest",
40804
41167
  "returns": [
40805
41168
  {
40806
41169
  "n": "usage_file",
@@ -40817,6 +41180,7 @@ const descriptor$8v = {
40817
41180
  },
40818
41181
  "resource": "usage_file",
40819
41182
  "method": "uploadUrl",
41183
+ "subDomain": "file-ingest",
40820
41184
  "flags": {
40821
41185
  "rb": true
40822
41186
  },
@@ -45462,6 +45826,7 @@ const descriptor$8k = {
45462
45826
  },
45463
45827
  "resource": "usage_event",
45464
45828
  "method": "batchIngest",
45829
+ "subDomain": "ingest",
45465
45830
  "flags": {
45466
45831
  "json": true,
45467
45832
  "batch": true,
@@ -50242,6 +50607,7 @@ const descriptor$7$ = {
50242
50607
  },
50243
50608
  "resource": "personalized_offer",
50244
50609
  "method": "personalizedOffers",
50610
+ "subDomain": "grow",
50245
50611
  "flags": {
50246
50612
  "json": true,
50247
50613
  "rb": true
@@ -55707,6 +56073,7 @@ const descriptor$6G = {
55707
56073
  },
55708
56074
  "resource": "offer_fulfillment",
55709
56075
  "method": "offerFulfillmentsGet",
56076
+ "subDomain": "grow",
55710
56077
  "flags": {
55711
56078
  "json": true
55712
56079
  },
@@ -59135,6 +59502,7 @@ const descriptor$62 = {
59135
59502
  },
59136
59503
  "resource": "offer_fulfillment",
59137
59504
  "method": "offerFulfillmentsUpdate",
59505
+ "subDomain": "grow",
59138
59506
  "flags": {
59139
59507
  "json": true,
59140
59508
  "rb": true
@@ -70538,6 +70906,7 @@ const descriptor$4Q = {
70538
70906
  },
70539
70907
  "resource": "usage_event",
70540
70908
  "method": "create",
70909
+ "subDomain": "ingest",
70541
70910
  "flags": {
70542
70911
  "json": true,
70543
70912
  "rb": true
@@ -71888,6 +72257,7 @@ const descriptor$4D = {
71888
72257
  },
71889
72258
  "resource": "offer_event",
71890
72259
  "method": "offerEvents",
72260
+ "subDomain": "grow",
71891
72261
  "flags": {
71892
72262
  "json": true,
71893
72263
  "rb": true
@@ -71916,6 +72286,7 @@ const descriptor$4C = {
71916
72286
  },
71917
72287
  "resource": "offer_fulfillment",
71918
72288
  "method": "offerFulfillments",
72289
+ "subDomain": "grow",
71919
72290
  "flags": {
71920
72291
  "json": true,
71921
72292
  "rb": true
@@ -91614,6 +91985,7 @@ const descriptor$3p = {
91614
91985
  },
91615
91986
  "resource": "usage_file",
91616
91987
  "method": "processingStatus",
91988
+ "subDomain": "file-ingest",
91617
91989
  "returns": [
91618
91990
  {
91619
91991
  "n": "usage_file",
@@ -91630,6 +92002,7 @@ const descriptor$3o = {
91630
92002
  },
91631
92003
  "resource": "usage_file",
91632
92004
  "method": "uploadUrl",
92005
+ "subDomain": "file-ingest",
91633
92006
  "flags": {
91634
92007
  "rb": true
91635
92008
  },
@@ -95561,6 +95934,7 @@ const descriptor$3e = {
95561
95934
  },
95562
95935
  "resource": "usage_event",
95563
95936
  "method": "batchIngest",
95937
+ "subDomain": "ingest",
95564
95938
  "flags": {
95565
95939
  "json": true,
95566
95940
  "batch": true,
@@ -102177,6 +102551,7 @@ const descriptor$2F = {
102177
102551
  },
102178
102552
  "resource": "personalized_offer",
102179
102553
  "method": "personalizedOffers",
102554
+ "subDomain": "grow",
102180
102555
  "flags": {
102181
102556
  "json": true,
102182
102557
  "rb": true
@@ -108220,6 +108595,7 @@ const descriptor$13 = {
108220
108595
  },
108221
108596
  "resource": "offer_fulfillment",
108222
108597
  "method": "offerFulfillmentsGet",
108598
+ "subDomain": "grow",
108223
108599
  "flags": {
108224
108600
  "json": true
108225
108601
  },
@@ -111743,6 +112119,7 @@ const descriptor$j = {
111743
112119
  },
111744
112120
  "resource": "offer_fulfillment",
111745
112121
  "method": "offerFulfillmentsUpdate",
112122
+ "subDomain": "grow",
111746
112123
  "flags": {
111747
112124
  "json": true,
111748
112125
  "rb": true
@@ -114991,15 +115368,18 @@ function formatCurlValue(value, schema) {
114991
115368
  }
114992
115369
  return `"${escapeShell(String(value))}"`;
114993
115370
  }
114994
- function toCamelCase$1(str) {
115371
+ function toCamelCase(str) {
114995
115372
  return camelCase(str);
114996
115373
  }
114997
- function toPascalCase$1(str) {
115374
+ function toPascalCase(str) {
114998
115375
  return pascalCase(str);
114999
115376
  }
115000
115377
  function toSnakeCase(str) {
115001
115378
  return snakeCase(str);
115002
115379
  }
115380
+ function singularize$1(word) {
115381
+ return pluralize.singular(word);
115382
+ }
115003
115383
  function isEnumValue$1(value, schema) {
115004
115384
  if (!schema || !schema.enum) return false;
115005
115385
  const v = value.toLowerCase();
@@ -115141,375 +115521,6 @@ const curlGenerator = {
115141
115521
  displayName: "cURL",
115142
115522
  generate: generateCurl
115143
115523
  };
115144
- function getDefaultExportFromCjs(x) {
115145
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
115146
- }
115147
- function commonjsRequire(path) {
115148
- throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
115149
- }
115150
- var pluralize$2 = { exports: {} };
115151
- var pluralize$1 = pluralize$2.exports;
115152
- var hasRequiredPluralize;
115153
- function requirePluralize() {
115154
- if (hasRequiredPluralize) return pluralize$2.exports;
115155
- hasRequiredPluralize = 1;
115156
- (function(module, exports$1) {
115157
- (function(root2, pluralize2) {
115158
- if (typeof commonjsRequire === "function" && true && true) {
115159
- module.exports = pluralize2();
115160
- } else {
115161
- root2.pluralize = pluralize2();
115162
- }
115163
- })(pluralize$1, function() {
115164
- var pluralRules = [];
115165
- var singularRules = [];
115166
- var uncountables = {};
115167
- var irregularPlurals = {};
115168
- var irregularSingles = {};
115169
- function sanitizeRule(rule) {
115170
- if (typeof rule === "string") {
115171
- return new RegExp("^" + rule + "$", "i");
115172
- }
115173
- return rule;
115174
- }
115175
- function restoreCase(word, token) {
115176
- if (word === token) return token;
115177
- if (word === word.toLowerCase()) return token.toLowerCase();
115178
- if (word === word.toUpperCase()) return token.toUpperCase();
115179
- if (word[0] === word[0].toUpperCase()) {
115180
- return token.charAt(0).toUpperCase() + token.substr(1).toLowerCase();
115181
- }
115182
- return token.toLowerCase();
115183
- }
115184
- function interpolate(str, args) {
115185
- return str.replace(/\$(\d{1,2})/g, function(match, index) {
115186
- return args[index] || "";
115187
- });
115188
- }
115189
- function replace(word, rule) {
115190
- return word.replace(rule[0], function(match, index) {
115191
- var result = interpolate(rule[1], arguments);
115192
- if (match === "") {
115193
- return restoreCase(word[index - 1], result);
115194
- }
115195
- return restoreCase(match, result);
115196
- });
115197
- }
115198
- function sanitizeWord(token, word, rules) {
115199
- if (!token.length || uncountables.hasOwnProperty(token)) {
115200
- return word;
115201
- }
115202
- var len = rules.length;
115203
- while (len--) {
115204
- var rule = rules[len];
115205
- if (rule[0].test(word)) return replace(word, rule);
115206
- }
115207
- return word;
115208
- }
115209
- function replaceWord(replaceMap, keepMap, rules) {
115210
- return function(word) {
115211
- var token = word.toLowerCase();
115212
- if (keepMap.hasOwnProperty(token)) {
115213
- return restoreCase(word, token);
115214
- }
115215
- if (replaceMap.hasOwnProperty(token)) {
115216
- return restoreCase(word, replaceMap[token]);
115217
- }
115218
- return sanitizeWord(token, word, rules);
115219
- };
115220
- }
115221
- function checkWord(replaceMap, keepMap, rules, bool) {
115222
- return function(word) {
115223
- var token = word.toLowerCase();
115224
- if (keepMap.hasOwnProperty(token)) return true;
115225
- if (replaceMap.hasOwnProperty(token)) return false;
115226
- return sanitizeWord(token, token, rules) === token;
115227
- };
115228
- }
115229
- function pluralize2(word, count, inclusive) {
115230
- var pluralized = count === 1 ? pluralize2.singular(word) : pluralize2.plural(word);
115231
- return (inclusive ? count + " " : "") + pluralized;
115232
- }
115233
- pluralize2.plural = replaceWord(
115234
- irregularSingles,
115235
- irregularPlurals,
115236
- pluralRules
115237
- );
115238
- pluralize2.isPlural = checkWord(
115239
- irregularSingles,
115240
- irregularPlurals,
115241
- pluralRules
115242
- );
115243
- pluralize2.singular = replaceWord(
115244
- irregularPlurals,
115245
- irregularSingles,
115246
- singularRules
115247
- );
115248
- pluralize2.isSingular = checkWord(
115249
- irregularPlurals,
115250
- irregularSingles,
115251
- singularRules
115252
- );
115253
- pluralize2.addPluralRule = function(rule, replacement) {
115254
- pluralRules.push([sanitizeRule(rule), replacement]);
115255
- };
115256
- pluralize2.addSingularRule = function(rule, replacement) {
115257
- singularRules.push([sanitizeRule(rule), replacement]);
115258
- };
115259
- pluralize2.addUncountableRule = function(word) {
115260
- if (typeof word === "string") {
115261
- uncountables[word.toLowerCase()] = true;
115262
- return;
115263
- }
115264
- pluralize2.addPluralRule(word, "$0");
115265
- pluralize2.addSingularRule(word, "$0");
115266
- };
115267
- pluralize2.addIrregularRule = function(single, plural) {
115268
- plural = plural.toLowerCase();
115269
- single = single.toLowerCase();
115270
- irregularSingles[single] = plural;
115271
- irregularPlurals[plural] = single;
115272
- };
115273
- [
115274
- // Pronouns.
115275
- ["I", "we"],
115276
- ["me", "us"],
115277
- ["he", "they"],
115278
- ["she", "they"],
115279
- ["them", "them"],
115280
- ["myself", "ourselves"],
115281
- ["yourself", "yourselves"],
115282
- ["itself", "themselves"],
115283
- ["herself", "themselves"],
115284
- ["himself", "themselves"],
115285
- ["themself", "themselves"],
115286
- ["is", "are"],
115287
- ["was", "were"],
115288
- ["has", "have"],
115289
- ["this", "these"],
115290
- ["that", "those"],
115291
- // Words ending in with a consonant and `o`.
115292
- ["echo", "echoes"],
115293
- ["dingo", "dingoes"],
115294
- ["volcano", "volcanoes"],
115295
- ["tornado", "tornadoes"],
115296
- ["torpedo", "torpedoes"],
115297
- // Ends with `us`.
115298
- ["genus", "genera"],
115299
- ["viscus", "viscera"],
115300
- // Ends with `ma`.
115301
- ["stigma", "stigmata"],
115302
- ["stoma", "stomata"],
115303
- ["dogma", "dogmata"],
115304
- ["lemma", "lemmata"],
115305
- ["schema", "schemata"],
115306
- ["anathema", "anathemata"],
115307
- // Other irregular rules.
115308
- ["ox", "oxen"],
115309
- ["axe", "axes"],
115310
- ["die", "dice"],
115311
- ["yes", "yeses"],
115312
- ["foot", "feet"],
115313
- ["eave", "eaves"],
115314
- ["goose", "geese"],
115315
- ["tooth", "teeth"],
115316
- ["quiz", "quizzes"],
115317
- ["human", "humans"],
115318
- ["proof", "proofs"],
115319
- ["carve", "carves"],
115320
- ["valve", "valves"],
115321
- ["looey", "looies"],
115322
- ["thief", "thieves"],
115323
- ["groove", "grooves"],
115324
- ["pickaxe", "pickaxes"],
115325
- ["passerby", "passersby"]
115326
- ].forEach(function(rule) {
115327
- return pluralize2.addIrregularRule(rule[0], rule[1]);
115328
- });
115329
- [
115330
- [/s?$/i, "s"],
115331
- [/[^\u0000-\u007F]$/i, "$0"],
115332
- [/([^aeiou]ese)$/i, "$1"],
115333
- [/(ax|test)is$/i, "$1es"],
115334
- [/(alias|[^aou]us|t[lm]as|gas|ris)$/i, "$1es"],
115335
- [/(e[mn]u)s?$/i, "$1s"],
115336
- [/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, "$1"],
115337
- [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1i"],
115338
- [/(alumn|alg|vertebr)(?:a|ae)$/i, "$1ae"],
115339
- [/(seraph|cherub)(?:im)?$/i, "$1im"],
115340
- [/(her|at|gr)o$/i, "$1oes"],
115341
- [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, "$1a"],
115342
- [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, "$1a"],
115343
- [/sis$/i, "ses"],
115344
- [/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, "$1$2ves"],
115345
- [/([^aeiouy]|qu)y$/i, "$1ies"],
115346
- [/([^ch][ieo][ln])ey$/i, "$1ies"],
115347
- [/(x|ch|ss|sh|zz)$/i, "$1es"],
115348
- [/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, "$1ices"],
115349
- [/\b((?:tit)?m|l)(?:ice|ouse)$/i, "$1ice"],
115350
- [/(pe)(?:rson|ople)$/i, "$1ople"],
115351
- [/(child)(?:ren)?$/i, "$1ren"],
115352
- [/eaux$/i, "$0"],
115353
- [/m[ae]n$/i, "men"],
115354
- ["thou", "you"]
115355
- ].forEach(function(rule) {
115356
- return pluralize2.addPluralRule(rule[0], rule[1]);
115357
- });
115358
- [
115359
- [/s$/i, ""],
115360
- [/(ss)$/i, "$1"],
115361
- [/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, "$1fe"],
115362
- [/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, "$1f"],
115363
- [/ies$/i, "y"],
115364
- [/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, "$1ie"],
115365
- [/\b(mon|smil)ies$/i, "$1ey"],
115366
- [/\b((?:tit)?m|l)ice$/i, "$1ouse"],
115367
- [/(seraph|cherub)im$/i, "$1"],
115368
- [/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, "$1"],
115369
- [/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, "$1sis"],
115370
- [/(movie|twelve|abuse|e[mn]u)s$/i, "$1"],
115371
- [/(test)(?:is|es)$/i, "$1is"],
115372
- [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1us"],
115373
- [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, "$1um"],
115374
- [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, "$1on"],
115375
- [/(alumn|alg|vertebr)ae$/i, "$1a"],
115376
- [/(cod|mur|sil|vert|ind)ices$/i, "$1ex"],
115377
- [/(matr|append)ices$/i, "$1ix"],
115378
- [/(pe)(rson|ople)$/i, "$1rson"],
115379
- [/(child)ren$/i, "$1"],
115380
- [/(eau)x?$/i, "$1"],
115381
- [/men$/i, "man"]
115382
- ].forEach(function(rule) {
115383
- return pluralize2.addSingularRule(rule[0], rule[1]);
115384
- });
115385
- [
115386
- // Singular words with no plurals.
115387
- "adulthood",
115388
- "advice",
115389
- "agenda",
115390
- "aid",
115391
- "aircraft",
115392
- "alcohol",
115393
- "ammo",
115394
- "analytics",
115395
- "anime",
115396
- "athletics",
115397
- "audio",
115398
- "bison",
115399
- "blood",
115400
- "bream",
115401
- "buffalo",
115402
- "butter",
115403
- "carp",
115404
- "cash",
115405
- "chassis",
115406
- "chess",
115407
- "clothing",
115408
- "cod",
115409
- "commerce",
115410
- "cooperation",
115411
- "corps",
115412
- "debris",
115413
- "diabetes",
115414
- "digestion",
115415
- "elk",
115416
- "energy",
115417
- "equipment",
115418
- "excretion",
115419
- "expertise",
115420
- "firmware",
115421
- "flounder",
115422
- "fun",
115423
- "gallows",
115424
- "garbage",
115425
- "graffiti",
115426
- "hardware",
115427
- "headquarters",
115428
- "health",
115429
- "herpes",
115430
- "highjinks",
115431
- "homework",
115432
- "housework",
115433
- "information",
115434
- "jeans",
115435
- "justice",
115436
- "kudos",
115437
- "labour",
115438
- "literature",
115439
- "machinery",
115440
- "mackerel",
115441
- "mail",
115442
- "media",
115443
- "mews",
115444
- "moose",
115445
- "music",
115446
- "mud",
115447
- "manga",
115448
- "news",
115449
- "only",
115450
- "personnel",
115451
- "pike",
115452
- "plankton",
115453
- "pliers",
115454
- "police",
115455
- "pollution",
115456
- "premises",
115457
- "rain",
115458
- "research",
115459
- "rice",
115460
- "salmon",
115461
- "scissors",
115462
- "series",
115463
- "sewage",
115464
- "shambles",
115465
- "shrimp",
115466
- "software",
115467
- "species",
115468
- "staff",
115469
- "swine",
115470
- "tennis",
115471
- "traffic",
115472
- "transportation",
115473
- "trout",
115474
- "tuna",
115475
- "wealth",
115476
- "welfare",
115477
- "whiting",
115478
- "wildebeest",
115479
- "wildlife",
115480
- "you",
115481
- /pok[eé]mon$/i,
115482
- // Regexes.
115483
- /[^aeiou]ese$/i,
115484
- // "chinese", "japanese"
115485
- /deer$/i,
115486
- // "deer", "reindeer"
115487
- /fish$/i,
115488
- // "fish", "blowfish", "angelfish"
115489
- /measles$/i,
115490
- /o[iu]s$/i,
115491
- // "carnivorous"
115492
- /pox$/i,
115493
- // "chickpox", "smallpox"
115494
- /sheep$/i
115495
- ].forEach(pluralize2.addUncountableRule);
115496
- return pluralize2;
115497
- });
115498
- })(pluralize$2);
115499
- return pluralize$2.exports;
115500
- }
115501
- var pluralizeExports = requirePluralize();
115502
- const pluralize = /* @__PURE__ */ getDefaultExportFromCjs(pluralizeExports);
115503
- function toPascalCase(str) {
115504
- return str.split(/[-_]/).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join("");
115505
- }
115506
- function toCamelCase(str) {
115507
- const pascal = toPascalCase(str);
115508
- return pascal.charAt(0).toLowerCase() + pascal.slice(1);
115509
- }
115510
- function singularize$1(word) {
115511
- return pluralize.singular(word);
115512
- }
115513
115524
  const CS_KEYWORDS = /* @__PURE__ */ new Set([
115514
115525
  "abstract",
115515
115526
  "as",
@@ -115629,19 +115640,40 @@ function formatJObject(obj) {
115629
115640
  ${props.map((p2) => ` ${p2}`).join(",\n")}
115630
115641
  }`;
115631
115642
  }
115632
- function formatDictionary(obj) {
115633
- const entries = Object.entries(obj);
115634
- if (entries.length === 0) return "new Dictionary<string, object>()";
115635
- const props = entries.map(([k, v]) => {
115636
- const formattedVal = typeof v === "string" ? `"${v.replace(/"/g, '\\"')}"` : typeof v === "number" || typeof v === "boolean" ? String(v) : `"${JSON.stringify(v).replace(/"/g, '\\"')}"`;
115637
- return `["${k}"] = ${formattedVal}`;
115643
+ function buildEventBatchIngestDeclarations(events) {
115644
+ const preLines = [];
115645
+ const validEvents = events.filter(
115646
+ (e) => typeof e === "object" && e !== null && !Array.isArray(e)
115647
+ );
115648
+ const builderExprs = [];
115649
+ validEvents.forEach((evt, idx) => {
115650
+ const dedupId = evt.deduplication_id !== void 0 ? `"${String(evt.deduplication_id).replace(/"/g, '\\"')}"` : '""';
115651
+ const subId = evt.subscription_id !== void 0 ? `"${String(evt.subscription_id).replace(/"/g, '\\"')}"` : '""';
115652
+ const ts = evt.usage_timestamp;
115653
+ const tsVal = typeof ts === "number" ? `${ts}L` : typeof ts === "string" ? `${ts}L` : "0L";
115654
+ let propsVarName = `eventProperties${idx + 1}`;
115655
+ if (evt.properties && typeof evt.properties === "object" && !Array.isArray(evt.properties)) {
115656
+ const obj = evt.properties;
115657
+ preLines.push(`var ${propsVarName} = new Dictionary<string, object>();`);
115658
+ for (const [k, v] of Object.entries(obj)) {
115659
+ const formattedVal = typeof v === "string" ? `"${v.replace(/"/g, '\\"')}"` : typeof v === "number" || typeof v === "boolean" ? String(v) : `"${JSON.stringify(v).replace(/"/g, '\\"')}"`;
115660
+ preLines.push(`${propsVarName}.Add("${k}", ${formattedVal});`);
115661
+ }
115662
+ } else {
115663
+ propsVarName = "new Dictionary<string, object>()";
115664
+ }
115665
+ builderExprs.push(
115666
+ `new UsageEvent.EventBatchIngestInputParamsBuilder().SetDeduplicationId(${dedupId}).SetSubscriptionId(${subId}).SetUsageTimestamp(${tsVal}).SetProperties(${propsVarName}).Build()`
115667
+ );
115638
115668
  });
115639
- if (props.length <= 2) {
115640
- return `new Dictionary<string, object> { ${props.join(", ")} }`;
115641
- }
115642
- return `new Dictionary<string, object> {
115643
- ${props.map((p2) => ` ${p2}`).join(",\n")}
115644
- }`;
115669
+ preLines.push(
115670
+ `var events = new List<UsageEvent.EventBatchIngestInputParams> {`
115671
+ );
115672
+ builderExprs.forEach((expr, idx) => {
115673
+ preLines.push(` ${expr}${idx < builderExprs.length - 1 ? "," : ""}`);
115674
+ });
115675
+ preLines.push(`};`);
115676
+ return { preLines, varName: "events" };
115645
115677
  }
115646
115678
  function formatDotnetValue(value, schemaLookup, key2, resourcePascal, directSchema) {
115647
115679
  if (value === null || value === void 0) {
@@ -115674,12 +115706,15 @@ function formatDotnetValue(value, schemaLookup, key2, resourcePascal, directSche
115674
115706
  if (isNumericSchema && /^-?\d+(\.\d+)?$/.test(value)) {
115675
115707
  return value;
115676
115708
  }
115677
- if (isEnumValue$1(value, schema)) {
115678
- const formattedEnum = formatEnumValue(value, "pascalCase");
115709
+ const normalizedEnumValue = schema?.enum && !isEnumValue$1(value, schema) ? schema.enum.find(
115710
+ (e) => e.toLowerCase().replace(/-/g, "_") === value.toLowerCase().replace(/-/g, "_")
115711
+ ) ?? value : value;
115712
+ if (isEnumValue$1(normalizedEnumValue, schema)) {
115713
+ const formattedEnum = formatEnumValue(normalizedEnumValue, "pascalCase");
115679
115714
  if (schema?.sdkEnumName) {
115680
115715
  const resourceEnumKey = resourcePascal ? `${resourcePascal}:${schema.sdkEnumName}` : "";
115681
115716
  const forceResourceScoped = DOTNET_FORCE_RESOURCE_SCOPED_ENUMS.has(resourceEnumKey);
115682
- if (!forceResourceScoped && (DOTNET_GLOBAL_ENUM_NAMES.has(schema.sdkEnumName) || schema.isGlobalEnum)) {
115717
+ if (!forceResourceScoped && schema.isGlobalEnum) {
115683
115718
  return `${schema.sdkEnumName}Enum.${formattedEnum}`;
115684
115719
  }
115685
115720
  if (resourcePascal) {
@@ -115699,6 +115734,10 @@ function formatDotnetValue(value, schemaLookup, key2, resourcePascal, directSche
115699
115734
  } catch {
115700
115735
  }
115701
115736
  }
115737
+ if (schema?.type === "array") {
115738
+ const innerVal = formatDotnetValue(value);
115739
+ return `new JArray { ${innerVal} }`;
115740
+ }
115702
115741
  const escaped = value.replace(/"/g, '\\"');
115703
115742
  return `"${escaped}"`;
115704
115743
  }
@@ -115708,81 +115747,6 @@ function formatDotnetValue(value, schemaLookup, key2, resourcePascal, directSche
115708
115747
  }
115709
115748
  return `"${JSON.stringify(value).replace(/"/g, '\\"')}"`;
115710
115749
  }
115711
- const DOTNET_GLOBAL_ENUM_NAMES = /* @__PURE__ */ new Set([
115712
- "AccountHolderType",
115713
- "AccountReceivablesHandling",
115714
- "AccountType",
115715
- "Action",
115716
- "ApiVersion",
115717
- "ApplyOn",
115718
- "AutoCollection",
115719
- "AvalaraSaleType",
115720
- "BillingAlignmentMode",
115721
- "BillingDateMode",
115722
- "BillingDayOfWeekMode",
115723
- "BillingPeriodUnit",
115724
- "BillingStartOption",
115725
- "CancelOption",
115726
- "Category",
115727
- "ChangeOption",
115728
- "Channel",
115729
- "ChargeModel",
115730
- "ChargeOn",
115731
- "ChargeOnEvent",
115732
- "ChargeOnOption",
115733
- "ChargesHandling",
115734
- "ContractTermCancelOption",
115735
- "CreditOptionForCurrentTermCharges",
115736
- "CreditType",
115737
- "CustomerType",
115738
- "DedupeOption",
115739
- "DirectDebitScheme",
115740
- "FriendOfferType",
115741
- "Gateway",
115742
- "HierarchyOperationType",
115743
- "InvoiceDunningHandling",
115744
- "Layout",
115745
- "NotifyReferralSystem",
115746
- "OfflinePaymentMethod",
115747
- "OnEvent",
115748
- "Operation",
115749
- "OperationType",
115750
- "PauseOption",
115751
- "PaymentInitiator",
115752
- "PaymentMethod",
115753
- "PaymentMethodSavePolicy",
115754
- "PaymentMethodType",
115755
- "PaymentVoucherType",
115756
- "PriceType",
115757
- "PricingModel",
115758
- "PricingType",
115759
- "ProductCatalogVersion",
115760
- "ProrationType",
115761
- "ReferralSystem",
115762
- "ReferrerRewardType",
115763
- "RefundableCreditsHandling",
115764
- "ReportBy",
115765
- "ResumeOption",
115766
- "RetryEngine",
115767
- "Role",
115768
- "ScheduleType",
115769
- "Source",
115770
- "Tax1JurisType",
115771
- "Tax2JurisType",
115772
- "Tax3JurisType",
115773
- "Tax4JurisType",
115774
- "TaxExemptReason",
115775
- "TaxJurisType",
115776
- "TaxOverrideReason",
115777
- "Taxability",
115778
- "TrialEndAction",
115779
- "UnbilledChargesHandling",
115780
- "UnbilledChargesOption",
115781
- "UnpaidInvoicesHandling",
115782
- "UsageAccumulationResetFrequency",
115783
- "ValidationStatus",
115784
- "VoucherType"
115785
- ]);
115786
115750
  const DOTNET_METHOD_OVERRIDES = {
115787
115751
  // Card (customer sub-resource) - uses descriptive method names
115788
115752
  copy_card: "CopyCardForCustomer",
@@ -115805,10 +115769,21 @@ const DOTNET_FORCE_RESOURCE_SCOPED_ENUMS = /* @__PURE__ */ new Set([
115805
115769
  ]);
115806
115770
  const TOP_LEVEL_SUB_RESOURCE_PARENTS = /* @__PURE__ */ new Set(["credit_note"]);
115807
115771
  const TOP_LEVEL_ARRAY_PARENTS = /* @__PURE__ */ new Set(["unbilled_charges"]);
115772
+ const DOTNET_PARAM_RENAMES = {
115773
+ create_a_hosted_page_to_view_boleto_vouchers: {
115774
+ voucher: "payment_voucher"
115775
+ }
115776
+ };
115808
115777
  const DOTNET_DICTIONARY_PARAMS = /* @__PURE__ */ new Set([
115809
115778
  "usage_event:properties",
115810
115779
  "personalized_offer:custom"
115811
115780
  ]);
115781
+ const DOTNET_BUILDER_LIST_PARAMS = /* @__PURE__ */ new Set(["ingest_usages_in_batch:events"]);
115782
+ const DOTNET_NESTED_BUILDER_PARAMS = {
115783
+ "list_personalized_offers:request_context": {
115784
+ builderClass: "PersonalizedOffer.RequestContextPersonalizedOffersInputParamsBuilder"
115785
+ }
115786
+ };
115812
115787
  function toSdkMethodName(method, operationId) {
115813
115788
  if (operationId && DOTNET_METHOD_OVERRIDES[operationId]) {
115814
115789
  return DOTNET_METHOD_OVERRIDES[operationId];
@@ -115820,15 +115795,16 @@ function toSdkMethodName(method, operationId) {
115820
115795
  const DEFAULT_OPTIONS$7 = {
115821
115796
  includeResponse: true
115822
115797
  };
115823
- function parseBracketNotation$6(flatParams) {
115798
+ function parseBracketNotation$6(flatParams, operationId) {
115824
115799
  const params = /* @__PURE__ */ new Map();
115825
115800
  const filters = [];
115801
+ const renames = operationId ? DOTNET_PARAM_RENAMES[operationId] : void 0;
115826
115802
  for (const param of flatParams) {
115827
115803
  if (param.filterOperator) {
115828
115804
  filters.push(param);
115829
115805
  continue;
115830
115806
  }
115831
- const key2 = param.key;
115807
+ const key2 = renames ? param.key.replace(/^([^[]+)/, (_, p2) => renames[p2] ?? p2) : param.key;
115832
115808
  const multiMatch = key2.match(/^([^[]+)\[([^\]]+)\]\[(\d+)\]$/);
115833
115809
  if (multiMatch) {
115834
115810
  const [, parent, field, indexStr] = multiMatch;
@@ -115880,7 +115856,10 @@ function generateDotnet(ir, options = DEFAULT_OPTIONS$7) {
115880
115856
  DOTNET_METHODSDK_OVERRIDES[rawMethod] ?? rawMethod,
115881
115857
  ir.operation.id
115882
115858
  );
115883
- const { params, filters } = parseBracketNotation$6(ir.flatParams);
115859
+ const { params, filters } = parseBracketNotation$6(
115860
+ ir.flatParams,
115861
+ ir.operation.id
115862
+ );
115884
115863
  const schemaLookup = buildSchemaLookup$1(ir.flatParams);
115885
115864
  const pathParam = getPathParam$2(ir);
115886
115865
  const isListOperation = ir.operation.isListOperation;
@@ -115892,26 +115871,33 @@ function generateDotnet(ir, options = DEFAULT_OPTIONS$7) {
115892
115871
  if (p2.filterOperator) return false;
115893
115872
  const s = p2.schema;
115894
115873
  if (!s?.enum || !s.sdkEnumName) return false;
115895
- return DOTNET_GLOBAL_ENUM_NAMES.has(s.sdkEnumName) || !!s.isGlobalEnum;
115874
+ return !!s.isGlobalEnum;
115896
115875
  });
115897
115876
  const hasEnums = hasFilterEnums || hasBodyGlobalEnums;
115898
115877
  const hasSortBy = filters.some((f) => f.key.startsWith("sort_by["));
115899
115878
  const resource = ir.operation.resource;
115900
115879
  const freeformVars = /* @__PURE__ */ new Map();
115901
- for (const [name, param] of params.entries()) {
115880
+ Array.from(params.entries()).forEach(([name, param]) => {
115902
115881
  if (isFreeformObject(param.schema, param.value)) {
115903
115882
  const useDict = DOTNET_DICTIONARY_PARAMS.has(`${resource}:${name}`);
115904
115883
  freeformVars.set(name, { varName: toCamelCase(name), useDict });
115905
115884
  }
115906
- }
115885
+ });
115907
115886
  const hasJObjectFreeform = Array.from(freeformVars.values()).some(
115908
115887
  (v) => !v.useDict
115909
115888
  );
115910
115889
  const hasDictFreeform = Array.from(freeformVars.values()).some(
115911
115890
  (v) => v.useDict
115912
115891
  );
115892
+ const hasBuilderListParams = Array.from(params.entries()).some(
115893
+ ([name, param]) => {
115894
+ const key2 = `${ir.operation.id}:${name}`;
115895
+ return DOTNET_BUILDER_LIST_PARAMS.has(key2) && Array.isArray(param.value);
115896
+ }
115897
+ );
115913
115898
  const hasJArrayParams = ir.flatParams.some((p2) => {
115914
115899
  if (Array.isArray(p2.value)) return true;
115900
+ if (p2.schema.type === "array") return true;
115915
115901
  if (typeof p2.value === "string") {
115916
115902
  const t = p2.value.trim();
115917
115903
  if (t.startsWith("[") && t.endsWith("]")) {
@@ -115935,7 +115921,7 @@ function generateDotnet(ir, options = DEFAULT_OPTIONS$7) {
115935
115921
  if (hasJObjectFreeform || hasJArrayParams) {
115936
115922
  lines.push("using Newtonsoft.Json.Linq;");
115937
115923
  }
115938
- if (hasDictFreeform) {
115924
+ if (hasDictFreeform || hasBuilderListParams) {
115939
115925
  lines.push("using System.Collections.Generic;");
115940
115926
  }
115941
115927
  lines.push("");
@@ -115947,19 +115933,36 @@ function generateDotnet(ir, options = DEFAULT_OPTIONS$7) {
115947
115933
  `ApiConfig.SetBaseUrl("${proto}://api.${ir.host}${portSuffix}/api/${ir.apiVersion}");`
115948
115934
  );
115949
115935
  }
115950
- for (const [name, { varName, useDict }] of freeformVars.entries()) {
115936
+ Array.from(freeformVars.entries()).forEach(([name, { varName, useDict }]) => {
115951
115937
  const param = params.get(name);
115952
115938
  const obj = param?.value !== void 0 ? resolveFreeformValue(param.value) : null;
115953
115939
  if (useDict) {
115954
- lines.push(
115955
- `var ${varName} = ${obj ? formatDictionary(obj) : "new Dictionary<string, object>()"};`
115956
- );
115940
+ lines.push(`var ${varName} = new Dictionary<string, object>();`);
115941
+ if (obj) {
115942
+ for (const [k, v] of Object.entries(obj)) {
115943
+ const formattedVal = typeof v === "string" ? `"${v.replace(/"/g, '\\"')}"` : typeof v === "number" || typeof v === "boolean" ? String(v) : `"${JSON.stringify(v).replace(/"/g, '\\"')}"`;
115944
+ lines.push(`${varName}.Add("${k}", ${formattedVal});`);
115945
+ }
115946
+ }
115957
115947
  } else {
115958
115948
  lines.push(
115959
115949
  `var ${varName} = ${obj ? formatJObject(obj) : "new JObject()"};`
115960
115950
  );
115961
115951
  }
115962
- }
115952
+ });
115953
+ const builderListVars = /* @__PURE__ */ new Map();
115954
+ Array.from(params.entries()).forEach(([name, param]) => {
115955
+ const key2 = `${ir.operation.id}:${name}`;
115956
+ if (DOTNET_BUILDER_LIST_PARAMS.has(key2) && Array.isArray(param.value)) {
115957
+ if (name === "events" && ir.operation.id === "ingest_usages_in_batch") {
115958
+ const { preLines, varName } = buildEventBatchIngestDeclarations(
115959
+ param.value
115960
+ );
115961
+ lines.push(...preLines);
115962
+ builderListVars.set(name, varName);
115963
+ }
115964
+ }
115965
+ });
115963
115966
  const resultType = isListOperation ? "ListResult" : "EntityResult";
115964
115967
  const pathArg = pathParam ? `("${pathParam}")` : "()";
115965
115968
  const paramLines = buildParameterLines$1(
@@ -115968,7 +115971,8 @@ function generateDotnet(ir, options = DEFAULT_OPTIONS$7) {
115968
115971
  schemaLookup,
115969
115972
  resourcePascal,
115970
115973
  ir.operation.id,
115971
- freeformVars
115974
+ freeformVars,
115975
+ builderListVars
115972
115976
  );
115973
115977
  if (paramLines.length === 0) {
115974
115978
  lines.push(
@@ -115992,10 +115996,10 @@ function generateDotnet(ir, options = DEFAULT_OPTIONS$7) {
115992
115996
  const DOTNET_PARAM_AS_FILTER = {
115993
115997
  list_attached_items: ["item_id"]
115994
115998
  };
115995
- function buildParameterLines$1(params, filters, schemaLookup, resourcePascal, operationId, freeformVars) {
115999
+ function buildParameterLines$1(params, filters, schemaLookup, resourcePascal, operationId, freeformVars, builderListVars) {
115996
116000
  const lines = [];
115997
116001
  const paramAsFilter = operationId && DOTNET_PARAM_AS_FILTER[operationId] ? new Set(DOTNET_PARAM_AS_FILTER[operationId]) : null;
115998
- for (const [name, param] of params.entries()) {
116002
+ for (const [name, param] of Array.from(params.entries())) {
115999
116003
  if (paramAsFilter?.has(name) && param.value !== void 0 && typeof param.value === "string") {
116000
116004
  const methodName = toPascalCase(name);
116001
116005
  lines.push(
@@ -116014,6 +116018,25 @@ function buildParameterLines$1(params, filters, schemaLookup, resourcePascal, op
116014
116018
  );
116015
116019
  continue;
116016
116020
  }
116021
+ const nestedBuilderKey = operationId && `${operationId}:${name}`;
116022
+ const nestedBuilder = nestedBuilderKey && DOTNET_NESTED_BUILDER_PARAMS[nestedBuilderKey];
116023
+ if (nestedBuilder && param.children && param.children.size > 0) {
116024
+ const methodName = toPascalCase(name);
116025
+ const setters = Array.from(param.children.entries()).filter(([, child]) => child.value !== void 0).map(([childName, child]) => {
116026
+ const setterName = `Set${toPascalCase(childName)}`;
116027
+ const val = formatDotnetValue(
116028
+ child.value,
116029
+ schemaLookup,
116030
+ childName,
116031
+ resourcePascal
116032
+ );
116033
+ return `.${setterName}(${val})`;
116034
+ }).join("");
116035
+ lines.push(
116036
+ `.${methodName}(new ${nestedBuilder.builderClass}()${setters}.Build())`
116037
+ );
116038
+ continue;
116039
+ }
116017
116040
  if (param.children && param.children.size > 0) {
116018
116041
  lines.push(
116019
116042
  ...formatNestedFlat(name, param.children, schemaLookup, resourcePascal)
@@ -116026,6 +116049,12 @@ function buildParameterLines$1(params, filters, schemaLookup, resourcePascal, op
116026
116049
  lines.push(`.${methodName}(${freeform.varName})`);
116027
116050
  continue;
116028
116051
  }
116052
+ const builderListVar = builderListVars?.get(name);
116053
+ if (builderListVar) {
116054
+ const methodName = toPascalCase(name);
116055
+ lines.push(`.${methodName}(${builderListVar})`);
116056
+ continue;
116057
+ }
116029
116058
  if (param.value !== void 0) {
116030
116059
  const methodName = toPascalCase(name);
116031
116060
  const value = formatDotnetValue(
@@ -116046,11 +116075,11 @@ function formatMultiArray$2(name, arrayItems, schemaLookup, resourcePascal) {
116046
116075
  const lines = [];
116047
116076
  const singularName = singularize$1(name);
116048
116077
  const baseName = toPascalCase(singularName);
116049
- const sortedIndices = [...arrayItems.keys()].sort((a, b) => a - b);
116078
+ const sortedIndices = Array.from(arrayItems.keys()).sort((a, b) => a - b);
116050
116079
  for (const idx of sortedIndices) {
116051
116080
  const itemProps = arrayItems.get(idx);
116052
116081
  if (!itemProps) continue;
116053
- for (const [propName, propParam] of itemProps.entries()) {
116082
+ for (const [propName, propParam] of Array.from(itemProps.entries())) {
116054
116083
  if (propParam.value !== void 0) {
116055
116084
  const methodName = `${baseName}${toPascalCase(propName)}`;
116056
116085
  const arrayKey = `${name}[${propName}][${idx}]`;
@@ -116071,10 +116100,10 @@ function formatMultiArray$2(name, arrayItems, schemaLookup, resourcePascal) {
116071
116100
  function formatNestedFlat(parentName, children, schemaLookup, resourcePascal) {
116072
116101
  const lines = [];
116073
116102
  const parentPascal = toPascalCase(parentName);
116074
- const childKeys = [...children.keys()];
116103
+ const childKeys = Array.from(children.keys());
116075
116104
  const allNumeric = childKeys.length > 0 && childKeys.every((k) => /^\d+$/.test(k));
116076
116105
  if (allNumeric) {
116077
- const sorted = [...children.entries()].filter(([, p2]) => p2.value !== void 0).sort(([a], [b]) => parseInt(a, 10) - parseInt(b, 10));
116106
+ const sorted = Array.from(children.entries()).filter(([, p2]) => p2.value !== void 0).sort(([a], [b]) => parseInt(a, 10) - parseInt(b, 10));
116078
116107
  if (sorted.length > 0) {
116079
116108
  const values = sorted.map(([idx, childParam]) => {
116080
116109
  const nestedKey = `${parentName}[${idx}]`;
@@ -116089,7 +116118,7 @@ function formatNestedFlat(parentName, children, schemaLookup, resourcePascal) {
116089
116118
  }
116090
116119
  return lines;
116091
116120
  }
116092
- for (const [childName, childParam] of children.entries()) {
116121
+ for (const [childName, childParam] of Array.from(children.entries())) {
116093
116122
  if (childParam.value !== void 0) {
116094
116123
  const methodName = `${parentPascal}${toPascalCase(childName)}`;
116095
116124
  const nestedKey = `${parentName}[${childName}]`;
@@ -116249,12 +116278,12 @@ const OPERATION_OVERRIDES = {
116249
116278
  enumTypeName: "EntityType"
116250
116279
  }
116251
116280
  },
116252
- // Python SDK: payment_source.type filter uses PaymentSourceType (global), not PaymentSource.Type
116281
+ // Python SDK: payment_source.type filter uses global enum Type (chargebee.Type.CARD), not PaymentSource.Type or PaymentSourceType
116253
116282
  list_payment_sources: {
116254
116283
  type: {
116255
116284
  isGlobal: true,
116256
116285
  owningResource: null,
116257
- enumTypeName: "PaymentSourceType"
116286
+ enumTypeName: "Type"
116258
116287
  }
116259
116288
  },
116260
116289
  // Python SDK: Event.EventType not exposed; use global EventType enum
@@ -116376,7 +116405,7 @@ const GO_CROSS_RESOURCE_ENUM_OWNERS = /* @__PURE__ */ new Set([
116376
116405
  "unbilled_charge"
116377
116406
  ]);
116378
116407
  function formatGoEnum(resolved, value, operationResource) {
116379
- const valuePascal = toPascalCase$1(value);
116408
+ const valuePascal = toPascalCase(value);
116380
116409
  if (resolved.isGlobal) {
116381
116410
  const constantName2 = `${resolved.enumTypeName}${valuePascal}`;
116382
116411
  return {
@@ -116387,7 +116416,7 @@ function formatGoEnum(resolved, value, operationResource) {
116387
116416
  }
116388
116417
  const isGoSubResource = operationResource && resolved.owningResource !== operationResource && !resolved.isCrossResource && !GO_CROSS_RESOURCE_ENUM_OWNERS.has(resolved.owningResource);
116389
116418
  if (isGoSubResource) {
116390
- const subResourcePascal = toPascalCase$1(resolved.owningResource);
116419
+ const subResourcePascal = toPascalCase(resolved.owningResource);
116391
116420
  const constantName2 = `${subResourcePascal}${resolved.enumTypeName}${valuePascal}`;
116392
116421
  const alias2 = toGoEnumAlias(operationResource);
116393
116422
  const importPath2 = toGoEnumImportPath(operationResource);
@@ -116421,11 +116450,11 @@ function formatPythonV3Enum(resolved, value, operationResource) {
116421
116450
  return `chargebee.${resolved.enumTypeName}.${valueConstant}`;
116422
116451
  }
116423
116452
  if (operationResource && resolved.owningResource !== operationResource && !resolved.isCrossResource && !CROSS_RESOURCE_ENUM_OWNERS.has(resolved.owningResource)) {
116424
- const operationPascal = toPascalCase$1(operationResource);
116425
- const subResourcePascal = toPascalCase$1(resolved.owningResource);
116453
+ const operationPascal = toPascalCase(operationResource);
116454
+ const subResourcePascal = toPascalCase(resolved.owningResource);
116426
116455
  return `chargebee.${operationPascal}.${subResourcePascal}${resolved.enumTypeName}.${valueConstant}`;
116427
116456
  }
116428
- const resourcePascal = toPascalCase$1(resolved.owningResource);
116457
+ const resourcePascal = toPascalCase(resolved.owningResource);
116429
116458
  return `chargebee.${resourcePascal}.${resolved.enumTypeName}.${valueConstant}`;
116430
116459
  }
116431
116460
  function formatJavaV3Enum(resolved, value, operationResource, schema) {
@@ -116435,11 +116464,11 @@ function formatJavaV3Enum(resolved, value, operationResource, schema) {
116435
116464
  return `${enumTypeName}.${enumValue}`;
116436
116465
  }
116437
116466
  if (operationResource && resolved.owningResource !== operationResource && !resolved.isCrossResource && !CROSS_RESOURCE_ENUM_OWNERS.has(resolved.owningResource)) {
116438
- const operationPascal = toPascalCase$1(operationResource);
116439
- const subResourcePascal = toPascalCase$1(resolved.owningResource);
116467
+ const operationPascal = toPascalCase(operationResource);
116468
+ const subResourcePascal = toPascalCase(resolved.owningResource);
116440
116469
  return `${operationPascal}.${subResourcePascal}.${resolved.enumTypeName}.${enumValue}`;
116441
116470
  }
116442
- const resourcePascal = toPascalCase$1(resolved.owningResource);
116471
+ const resourcePascal = toPascalCase(resolved.owningResource);
116443
116472
  return `${resourcePascal}.${resolved.enumTypeName}.${enumValue}`;
116444
116473
  }
116445
116474
  const DEFAULT_OPTIONS$6 = {
@@ -116738,14 +116767,18 @@ const GO_SDK_PARAM_OVERRIDES = {
116738
116767
  // usage_event: properties is map[string]interface{}, not CreatePropertiesParams
116739
116768
  create_a_usage_event: {
116740
116769
  properties: "map"
116770
+ },
116771
+ // hosted_page events: event_data is additionalProperties (freeform), not EventsEventDataParams
116772
+ notify_an_event: {
116773
+ event_data: "map"
116741
116774
  }
116742
116775
  };
116743
116776
  function generateGo(ir, _options = DEFAULT_OPTIONS$6) {
116744
116777
  const { params, filters } = parseBracketNotation$5(ir.flatParams);
116745
116778
  const schemaLookup = buildSchemaLookup$1(ir.flatParams);
116746
116779
  const resource = toSnakeCase(ir.operation.resource).replace(/_/g, "");
116747
- const resourcePascal = toPascalCase$1(ir.operation.resource);
116748
- const method = toPascalCase$1(ir.operation.method);
116780
+ const resourcePascal = toPascalCase(ir.operation.resource);
116781
+ const method = toPascalCase(ir.operation.method);
116749
116782
  const pathParam = extractPathParam$3(ir);
116750
116783
  const returns = ir.operation.returns || [];
116751
116784
  const isListOp = ir.operation.isListOperation;
@@ -116880,7 +116913,7 @@ ${paramLines.join("\n")}
116880
116913
  lines.push(" for idx := 0; idx < len(res.List); idx++ {");
116881
116914
  if (returns.length > 0) {
116882
116915
  for (const ret of returns) {
116883
- const varName = toPascalCase$1(ret.name);
116916
+ const varName = toPascalCase(ret.name);
116884
116917
  lines.push(` ${varName} := res.List[idx].${varName}`);
116885
116918
  }
116886
116919
  } else {
@@ -116892,7 +116925,7 @@ ${paramLines.join("\n")}
116892
116925
  } else {
116893
116926
  if (returns.length > 0) {
116894
116927
  for (const ret of returns) {
116895
- const varName = toPascalCase$1(ret.name);
116928
+ const varName = toPascalCase(ret.name);
116896
116929
  lines.push(` ${varName} := res.${varName}`);
116897
116930
  }
116898
116931
  } else {
@@ -116911,11 +116944,11 @@ function formatParams(ir, method, resource, params, filters, schemaLookup, enumC
116911
116944
  const obj = value;
116912
116945
  if (GO_SDK_PARAM_OVERRIDES[operationId]?.[key2] === "map") {
116913
116946
  lines.push(
116914
- ` ${toPascalCase$1(key2)} : ${formatGoValue(value, 2, schemaLookup, key2, enumContext)},`
116947
+ ` ${toPascalCase(key2)} : ${formatGoValue(value, 2, schemaLookup, key2, enumContext)},`
116915
116948
  );
116916
116949
  } else if (obj.__json_map__) {
116917
116950
  lines.push(
116918
- ` ${toPascalCase$1(key2)} : ${formatGoValue(value, 2, schemaLookup, key2, enumContext)},`
116951
+ ` ${toPascalCase(key2)} : ${formatGoValue(value, 2, schemaLookup, key2, enumContext)},`
116919
116952
  );
116920
116953
  } else {
116921
116954
  const nestedLines = formatNestedObject$1(
@@ -116945,13 +116978,13 @@ function formatParams(ir, method, resource, params, filters, schemaLookup, enumC
116945
116978
  if (paramSchema?.isFilter && paramSchema?.sdkFilterName) {
116946
116979
  const filterValue = formatFilterValue(value, paramSchema.sdkFilterName);
116947
116980
  lines.push(
116948
- ` ${toPascalCase$1(key2)} : &filter.${paramSchema.sdkFilterName}{
116981
+ ` ${toPascalCase(key2)} : &filter.${paramSchema.sdkFilterName}{
116949
116982
  Is : ${filterValue},
116950
116983
  },`
116951
116984
  );
116952
116985
  } else {
116953
116986
  lines.push(
116954
- ` ${toPascalCase$1(key2)} : ${formatGoValue(value, 0, schemaLookup, key2, enumContext)},`
116987
+ ` ${toPascalCase(key2)} : ${formatGoValue(value, 0, schemaLookup, key2, enumContext)},`
116955
116988
  );
116956
116989
  }
116957
116990
  }
@@ -116976,7 +117009,7 @@ function formatNestedObject$1(ir, method, resource, name, obj, schemaLookup, enu
116976
117009
  fieldName = override.fieldName;
116977
117010
  paramsType = `${resource}.${override.paramsType}`;
116978
117011
  } else {
116979
- fieldName = toPascalCase$1(name);
117012
+ fieldName = toPascalCase(name);
116980
117013
  paramsType = `${resource}.${method}${fieldName}Params`;
116981
117014
  }
116982
117015
  const childLines = [];
@@ -116984,13 +117017,13 @@ function formatNestedObject$1(ir, method, resource, name, obj, schemaLookup, enu
116984
117017
  if (key2.startsWith("__filter__")) {
116985
117018
  const filterField = key2.slice("__filter__".length);
116986
117019
  const filterData = value;
116987
- const filterOp = toPascalCase$1(filterData.operator);
117020
+ const filterOp = toPascalCase(filterData.operator);
116988
117021
  const filterValue = formatFilterValue(
116989
117022
  filterData.value,
116990
117023
  filterData.filterType
116991
117024
  );
116992
117025
  childLines.push(
116993
- ` ${toPascalCase$1(filterField)} : &filter.${filterData.filterType}{
117026
+ ` ${toPascalCase(filterField)} : &filter.${filterData.filterType}{
116994
117027
  ${filterOp} : ${filterValue},
116995
117028
  },`
116996
117029
  );
@@ -116998,7 +117031,7 @@ function formatNestedObject$1(ir, method, resource, name, obj, schemaLookup, enu
116998
117031
  }
116999
117032
  const nestedKey = `${name}[${key2}]`;
117000
117033
  childLines.push(
117001
- ` ${toPascalCase$1(key2)} : ${formatGoValue(value, 0, schemaLookup, nestedKey, enumContext)},`
117034
+ ` ${toPascalCase(key2)} : ${formatGoValue(value, 0, schemaLookup, nestedKey, enumContext)},`
117002
117035
  );
117003
117036
  }
117004
117037
  return ` ${fieldName} : &${paramsType}{
@@ -117006,9 +117039,9 @@ ${childLines.join("\n")}
117006
117039
  },`;
117007
117040
  }
117008
117041
  function formatMultiArray$1(ir, method, resource, name, items, schemaLookup, enumContext) {
117009
- const fieldName = toPascalCase$1(name);
117042
+ const fieldName = toPascalCase(name);
117010
117043
  const singularName = pluralize.singular(name);
117011
- const singularPascal = toPascalCase$1(singularName);
117044
+ const singularPascal = toPascalCase(singularName);
117012
117045
  const paramsType = `${resource}.${method}${singularPascal}Params`;
117013
117046
  const isParentPeriods = name === "parent_periods" && (ir.operation.id === "create_a_differential_price" || ir.operation.id === "update_a_differential_price");
117014
117047
  const itemLines = [];
@@ -117030,14 +117063,14 @@ function formatMultiArray$1(ir, method, resource, name, items, schemaLookup, enu
117030
117063
  if (key2 === "period" || key2 === "period_unit") continue;
117031
117064
  const arrayKey = `${name}[${key2}][${i}]`;
117032
117065
  propLines.push(
117033
- ` ${toPascalCase$1(key2)} : ${formatGoValue(value, 0, schemaLookup, arrayKey, enumContext)},`
117066
+ ` ${toPascalCase(key2)} : ${formatGoValue(value, 0, schemaLookup, arrayKey, enumContext)},`
117034
117067
  );
117035
117068
  }
117036
117069
  } else {
117037
117070
  for (const [key2, value] of Object.entries(item)) {
117038
117071
  const arrayKey = `${name}[${key2}][${i}]`;
117039
117072
  propLines.push(
117040
- ` ${toPascalCase$1(key2)} : ${formatGoValue(value, 0, schemaLookup, arrayKey, enumContext)},`
117073
+ ` ${toPascalCase(key2)} : ${formatGoValue(value, 0, schemaLookup, arrayKey, enumContext)},`
117041
117074
  );
117042
117075
  }
117043
117076
  }
@@ -117074,8 +117107,8 @@ function formatFilterValue(value, filterType) {
117074
117107
  return `"${String(value).replace(/"/g, '\\"')}"`;
117075
117108
  }
117076
117109
  function formatFilter(name, operator, value, filterType, _schemaLookup) {
117077
- const fieldName = toPascalCase$1(name);
117078
- const filterOp = toPascalCase$1(operator);
117110
+ const fieldName = toPascalCase(name);
117111
+ const filterOp = toPascalCase(operator);
117079
117112
  const formattedValue = formatFilterValue(value, filterType);
117080
117113
  return ` ${fieldName} : &filter.${filterType}{
117081
117114
  ${filterOp} : ${formattedValue},
@@ -117217,7 +117250,7 @@ function formatJavaValue(value, schemaLookup, key2, resourcePascal, operationId,
117217
117250
  }
117218
117251
  }
117219
117252
  const fieldName = key2.split("[")[0].split(".").pop() || key2.split("[")[0] || key2;
117220
- const enumClass = schema2?.sdkEnumName || toPascalCase$1(fieldName);
117253
+ const enumClass = schema2?.sdkEnumName || toPascalCase(fieldName);
117221
117254
  const enumValue = formatEnumValue(value, "upperCase");
117222
117255
  if (schema2?.isGlobalEnum) {
117223
117256
  return `${enumClass}.${enumValue}`;
@@ -117241,6 +117274,38 @@ function formatJavaValue(value, schemaLookup, key2, resourcePascal, operationId,
117241
117274
  );
117242
117275
  return `List.of(${items.join(", ")})`;
117243
117276
  }
117277
+ if (typeof value === "object" && value !== null) {
117278
+ const entries = Object.entries(value);
117279
+ if (entries.length === 0) {
117280
+ return "Map.of()";
117281
+ }
117282
+ if (entries.length <= 10) {
117283
+ const pairs = entries.map(([k, v]) => {
117284
+ const formattedValue = formatJavaValue(
117285
+ v,
117286
+ schemaLookup,
117287
+ void 0,
117288
+ resourcePascal,
117289
+ operationId,
117290
+ resource
117291
+ );
117292
+ return `"${k}", ${formattedValue}`;
117293
+ }).join(", ");
117294
+ return `Map.of(${pairs})`;
117295
+ }
117296
+ const mapEntries = entries.map(([k, v]) => {
117297
+ const formattedValue = formatJavaValue(
117298
+ v,
117299
+ schemaLookup,
117300
+ void 0,
117301
+ resourcePascal,
117302
+ operationId,
117303
+ resource
117304
+ );
117305
+ return `Map.entry("${k}", ${formattedValue})`;
117306
+ }).join(", ");
117307
+ return `Map.ofEntries(${mapEntries})`;
117308
+ }
117244
117309
  return `"${String(value)}"`;
117245
117310
  }
117246
117311
  function formatTimestamp(value) {
@@ -117256,7 +117321,7 @@ function computeClassName(resourceKey, methodName) {
117256
117321
  const resourceNormalized = resourceKey.replace(/_/g, "").toLowerCase();
117257
117322
  const methodNormalized = methodName.replace(/_/g, "").toLowerCase();
117258
117323
  const hasOverlap = methodNormalized.includes(resourceNormalized) || resourceNormalized.includes(methodNormalized);
117259
- return hasOverlap ? toPascalCase$1(methodName) : `${toPascalCase$1(resourceKey)}${toPascalCase$1(methodName)}`;
117324
+ return hasOverlap ? toPascalCase(methodName) : `${toPascalCase(resourceKey)}${toPascalCase(methodName)}`;
117260
117325
  }
117261
117326
  function singularize(word) {
117262
117327
  return pluralize.singular(word);
@@ -117272,29 +117337,29 @@ function formatFilterMethodV3(filter, resourcePascal, operationMethodPascal, ope
117272
117337
  const sortDirection = parts2[parts2.length - 1]?.name || filter.filterOperator || "";
117273
117338
  const sortField = filter.value;
117274
117339
  if (!sortField || typeof sortField !== "string") {
117275
- return `.sortBy().${toCamelCase$1(sortDirection)}(${formatJavaValue(filter.value)})`;
117340
+ return `.sortBy().${toCamelCase(sortDirection)}(${formatJavaValue(filter.value)})`;
117276
117341
  }
117277
- const methodName = `sortBy${toPascalCase$1(String(sortField))}`;
117342
+ const methodName = `sortBy${toPascalCase(String(sortField))}`;
117278
117343
  const sortOrderValue = `SortOrder.${sortDirection.toUpperCase()}`;
117279
117344
  return `.${methodName}(${sortOrderValue})`;
117280
117345
  }
117281
117346
  const parts = parseKeyParts$1(filter.key);
117282
117347
  const operator = filter.filterOperator || parts[parts.length - 1]?.name || "";
117283
- const operatorCamel = toCamelCase$1(operator);
117348
+ const operatorCamel = toCamelCase(operator);
117284
117349
  let filterMethod;
117285
117350
  let enumFieldName;
117286
117351
  let nestedParentName;
117287
117352
  if (parts.length === 3) {
117288
117353
  const parent = parts[0].name;
117289
117354
  const child = parts[1].name;
117290
- filterMethod = toCamelCase$1(parent) + toPascalCase$1(child);
117355
+ filterMethod = toCamelCase(parent) + toPascalCase(child);
117291
117356
  enumFieldName = child;
117292
117357
  nestedParentName = parent;
117293
117358
  } else if (parts.length === 2) {
117294
- filterMethod = toCamelCase$1(parts[0].name);
117359
+ filterMethod = toCamelCase(parts[0].name);
117295
117360
  enumFieldName = parts[0].name;
117296
117361
  } else {
117297
- filterMethod = toCamelCase$1(filter.key.split("[")[0]);
117362
+ filterMethod = toCamelCase(filter.key.split("[")[0]);
117298
117363
  enumFieldName = filter.key.split("[")[0];
117299
117364
  }
117300
117365
  const isEnumFilter = filter.filterType === "EnumFilter";
@@ -117323,7 +117388,7 @@ function formatFilterMethodV3(filter, resourcePascal, operationMethodPascal, ope
117323
117388
  const isListOperation = operationMethodPascal === "List" || operationMethodPascal.toLowerCase().startsWith("list");
117324
117389
  let defaultEnumPrefix;
117325
117390
  if (nestedParentName) {
117326
- defaultEnumPrefix = toPascalCase$1(singularize(nestedParentName));
117391
+ defaultEnumPrefix = toPascalCase(singularize(nestedParentName));
117327
117392
  } else if (isListOperation) {
117328
117393
  defaultEnumPrefix = resourcePascal;
117329
117394
  } else {
@@ -117365,7 +117430,7 @@ function formatFilterMethodV3(filter, resourcePascal, operationMethodPascal, ope
117365
117430
  formattedValue = formatJavaValue(filter.value);
117366
117431
  }
117367
117432
  } else {
117368
- const enumClass = schema?.sdkEnumName || toPascalCase$1(enumFieldName);
117433
+ const enumClass = schema?.sdkEnumName || toPascalCase(enumFieldName);
117369
117434
  const arrayValue = parseArrayValue(filter.value);
117370
117435
  if (arrayValue && arrayValue.length > 0) {
117371
117436
  if (isKnownGlobalEnum) {
@@ -117387,7 +117452,7 @@ function formatFilterMethodV3(filter, resourcePascal, operationMethodPascal, ope
117387
117452
  }
117388
117453
  }
117389
117454
  } else if (isEnumField) {
117390
- const enumClass = schema?.sdkEnumName || toPascalCase$1(enumFieldName);
117455
+ const enumClass = schema?.sdkEnumName || toPascalCase(enumFieldName);
117391
117456
  const arrayValue = parseArrayValue(filter.value);
117392
117457
  if (arrayValue && arrayValue.length > 0) {
117393
117458
  if (schema?.isGlobalEnum) {
@@ -117424,7 +117489,17 @@ function formatFilterMethodV3(filter, resourcePascal, operationMethodPascal, ope
117424
117489
  formattedValue = formatJavaValue(filter.value);
117425
117490
  }
117426
117491
  } else {
117427
- formattedValue = formatJavaValue(filter.value);
117492
+ const isInOperator = operator === "in" || operator === "not_in";
117493
+ if (isInOperator) {
117494
+ const arrayValue = parseArrayValue(filter.value);
117495
+ if (arrayValue && arrayValue.length > 0) {
117496
+ formattedValue = arrayValue.map((v) => formatJavaValue(v)).join(", ");
117497
+ } else {
117498
+ formattedValue = formatJavaValue(filter.value);
117499
+ }
117500
+ } else {
117501
+ formattedValue = formatJavaValue(filter.value);
117502
+ }
117428
117503
  }
117429
117504
  return `.${filterMethod}().${operatorCamel}(${formattedValue})`;
117430
117505
  }
@@ -117468,9 +117543,10 @@ const DEFAULT_OPTIONS$5 = {
117468
117543
  };
117469
117544
  function generateJavaV3(ir, options = DEFAULT_OPTIONS$5) {
117470
117545
  const lines = [];
117471
- const resourcePascal = toPascalCase$1(ir.operation.resource);
117472
- const methodCamel = toCamelCase$1(ir.operation.method);
117473
- const methodPascal = toPascalCase$1(ir.operation.method);
117546
+ const resourcePascal = toPascalCase(ir.operation.resource);
117547
+ const methodCamel = toCamelCase(ir.operation.method);
117548
+ const methodPascal = toPascalCase(ir.operation.method);
117549
+ const isJsonInputOperation = ir.operation.isJsonInput === true;
117474
117550
  const { params, filters } = parseBracketNotation$4(ir.flatParams);
117475
117551
  const schemaLookup = buildSchemaLookup$1(ir.flatParams);
117476
117552
  const pathParam = getPathParam$1(ir);
@@ -117481,23 +117557,36 @@ function generateJavaV3(ir, options = DEFAULT_OPTIONS$5) {
117481
117557
  const schema = schemaLookup(param.key);
117482
117558
  return schema?.type === "array";
117483
117559
  });
117484
- const needsListImport = isListOperation || returns.some((r) => r.isArray) || hasArrayParams;
117485
- const needsTimestamp = hasTimestampParams$1(params, schemaLookup) || hasTimestampFilters(filters, schemaLookup);
117560
+ const hasBuilderParams = ir.operation.isJsonInput && detectBuilderPatternParams(ir, schemaLookup).length > 0;
117561
+ const needsListImport = isListOperation || returns.some((r) => r.isArray) || hasArrayParams || hasBuilderParams;
117562
+ const needsMapImport = hasBuilderParams;
117563
+ const needsTimestamp = hasTimestampParams$1(params, schemaLookup) || hasTimestampFilters(filters, schemaLookup) || hasBuilderParams;
117486
117564
  const needsSortOrder = filters.some(
117487
117565
  (f) => f.schema?.sdkFilterName === "SortFilter" || f.key.startsWith("sort_by[")
117488
117566
  );
117489
117567
  const needsJsonImports = ir.flatParams.some((param) => {
117490
117568
  if (param.filterOperator) return false;
117491
- if (typeof param.value !== "string") return false;
117492
- const trimmed = param.value.trim();
117493
117569
  const pSchema = schemaLookup(param.key);
117494
117570
  const schemaType = pSchema?.type;
117495
- const pIsMapType = pSchema?.type === "object" && pSchema?.additionalProperties === true && !pSchema?.properties;
117496
- if (pIsMapType) return false;
117571
+ const pIsSchemalessObject = pSchema?.type === "object" && pSchema?.additionalProperties === true && !pSchema?.properties;
117572
+ if (typeof param.value === "object" && param.value !== null && !Array.isArray(param.value)) {
117573
+ if (!isJsonInputOperation && pIsSchemalessObject) {
117574
+ return true;
117575
+ }
117576
+ return false;
117577
+ }
117578
+ if (typeof param.value !== "string") return false;
117579
+ const trimmed = param.value.trim();
117497
117580
  if (trimmed.startsWith("[") && trimmed.endsWith("]")) {
117581
+ if (isJsonInputOperation) {
117582
+ return false;
117583
+ }
117498
117584
  return schemaType === "array" || !schemaType;
117499
117585
  }
117500
117586
  if (trimmed.startsWith("{") && trimmed.endsWith("}")) {
117587
+ if (isJsonInputOperation && pIsSchemalessObject) {
117588
+ return false;
117589
+ }
117501
117590
  return schemaType === "object" || !schemaType;
117502
117591
  }
117503
117592
  return false;
@@ -117513,12 +117602,15 @@ function generateJavaV3(ir, options = DEFAULT_OPTIONS$5) {
117513
117602
  if (needsListImport) {
117514
117603
  lines.push("import java.util.List;");
117515
117604
  }
117605
+ if (needsMapImport) {
117606
+ lines.push("import java.util.Map;");
117607
+ }
117516
117608
  if (needsTimestamp) {
117517
117609
  lines.push("import java.sql.Timestamp;");
117518
117610
  }
117519
117611
  if (needsJsonImports) {
117520
- lines.push("import org.json.JSONArray;");
117521
- lines.push("import org.json.JSONObject;");
117612
+ lines.push("import com.chargebee.org.json.JSONArray;");
117613
+ lines.push("import com.chargebee.org.json.JSONObject;");
117522
117614
  }
117523
117615
  lines.push("");
117524
117616
  lines.push("public class Sample {");
@@ -117538,6 +117630,16 @@ function generateJavaV3(ir, options = DEFAULT_OPTIONS$5) {
117538
117630
  );
117539
117631
  }
117540
117632
  }
117633
+ const batchParamInfo = detectBuilderPatternParams(ir, schemaLookup);
117634
+ const batchPreDeclarations = generateBatchPreDeclarations(
117635
+ batchParamInfo,
117636
+ resourcePascal,
117637
+ methodPascal,
117638
+ ir.rawParams
117639
+ );
117640
+ for (const line of batchPreDeclarations) {
117641
+ lines.push(` ${line}`);
117642
+ }
117541
117643
  const resultType = isListOperation ? "ListResult" : "Result";
117542
117644
  const shouldCaptureResult = true;
117543
117645
  const resultPrefix = `${resultType} result = `;
@@ -117550,7 +117652,10 @@ function generateJavaV3(ir, options = DEFAULT_OPTIONS$5) {
117550
117652
  schemaLookup,
117551
117653
  ir.operation.id,
117552
117654
  ir.operation.resource,
117553
- ir.pathParams
117655
+ ir.pathParams,
117656
+ isJsonInputOperation,
117657
+ batchParamInfo
117658
+ // Pass batch info to skip inline generation
117554
117659
  );
117555
117660
  const hasOnlyFilters = params.size === 0 && filters.length > 0;
117556
117661
  if (paramLines.length === 0) {
@@ -117587,8 +117692,14 @@ function generateJavaV3(ir, options = DEFAULT_OPTIONS$5) {
117587
117692
  lines.push("}");
117588
117693
  return lines.join("\n");
117589
117694
  }
117590
- function buildParameterLines(params, filters, resourcePascal, methodPascal, schemaLookup, operationId, resource, pathParams) {
117695
+ function buildParameterLines(params, filters, resourcePascal, methodPascal, schemaLookup, operationId, resource, pathParams, isJsonInputOperation, batchParamInfo) {
117591
117696
  const lines = [];
117697
+ const batchParamNames = /* @__PURE__ */ new Set();
117698
+ if (batchParamInfo) {
117699
+ for (const info of batchParamInfo) {
117700
+ batchParamNames.add(info.name);
117701
+ }
117702
+ }
117592
117703
  const pathParamNames = /* @__PURE__ */ new Set();
117593
117704
  const pathParamValues = /* @__PURE__ */ new Set();
117594
117705
  if (pathParams) {
@@ -117599,6 +117710,11 @@ function buildParameterLines(params, filters, resourcePascal, methodPascal, sche
117599
117710
  }
117600
117711
  }
117601
117712
  for (const [name, param] of params.entries()) {
117713
+ if (batchParamNames.has(name)) {
117714
+ const methodName = toCamelCase(name);
117715
+ lines.push(`.${methodName}(${methodName})`);
117716
+ continue;
117717
+ }
117602
117718
  if (pathParamNames.has(name) && param.value !== void 0) {
117603
117719
  const valueStr = String(param.value);
117604
117720
  if (pathParamValues.has(valueStr)) {
@@ -117613,7 +117729,8 @@ function buildParameterLines(params, filters, resourcePascal, methodPascal, sche
117613
117729
  schemaLookup,
117614
117730
  resourcePascal,
117615
117731
  operationId,
117616
- resource
117732
+ resource,
117733
+ isJsonInputOperation
117617
117734
  )
117618
117735
  );
117619
117736
  continue;
@@ -117626,13 +117743,14 @@ function buildParameterLines(params, filters, resourcePascal, methodPascal, sche
117626
117743
  schemaLookup,
117627
117744
  resourcePascal,
117628
117745
  operationId,
117629
- resource
117746
+ resource,
117747
+ isJsonInputOperation
117630
117748
  )
117631
117749
  );
117632
117750
  continue;
117633
117751
  }
117634
117752
  if (param.value !== void 0) {
117635
- const methodName = toCamelCase$1(name);
117753
+ const methodName = toCamelCase(name);
117636
117754
  const value = formatValueV3(
117637
117755
  name,
117638
117756
  param.value,
@@ -117640,7 +117758,8 @@ function buildParameterLines(params, filters, resourcePascal, methodPascal, sche
117640
117758
  resourcePascal,
117641
117759
  void 0,
117642
117760
  operationId,
117643
- resource
117761
+ resource,
117762
+ isJsonInputOperation
117644
117763
  );
117645
117764
  lines.push(`.${methodName}(${value})`);
117646
117765
  }
@@ -117658,17 +117777,17 @@ function buildParameterLines(params, filters, resourcePascal, methodPascal, sche
117658
117777
  }
117659
117778
  return lines;
117660
117779
  }
117661
- function formatMultiArrayV3$1(name, arrayItems, schemaLookup, resourcePascal, operationId, resource) {
117780
+ function formatMultiArrayV3$1(name, arrayItems, schemaLookup, resourcePascal, operationId, resource, isJsonInputOperation) {
117662
117781
  const lines = [];
117663
117782
  const singularName = singularize(name);
117664
- const baseName = toCamelCase$1(singularName);
117783
+ const baseName = toCamelCase(singularName);
117665
117784
  const sortedIndices = [...arrayItems.keys()].sort((a, b) => a - b);
117666
117785
  for (const idx of sortedIndices) {
117667
117786
  const itemProps = arrayItems.get(idx);
117668
117787
  if (!itemProps) continue;
117669
117788
  for (const [propName, propParam] of itemProps.entries()) {
117670
117789
  if (propParam.value !== void 0) {
117671
- const methodName = `${baseName}${toPascalCase$1(propName)}`;
117790
+ const methodName = `${baseName}${toPascalCase(propName)}`;
117672
117791
  const arrayKey = `${name}[${propName}][${idx}]`;
117673
117792
  const value = formatValueV3(
117674
117793
  propName,
@@ -117677,7 +117796,8 @@ function formatMultiArrayV3$1(name, arrayItems, schemaLookup, resourcePascal, op
117677
117796
  resourcePascal,
117678
117797
  arrayKey,
117679
117798
  operationId,
117680
- resource
117799
+ resource,
117800
+ isJsonInputOperation
117681
117801
  );
117682
117802
  lines.push(`.${methodName}(${idx}, ${value})`);
117683
117803
  }
@@ -117685,12 +117805,12 @@ function formatMultiArrayV3$1(name, arrayItems, schemaLookup, resourcePascal, op
117685
117805
  }
117686
117806
  return lines;
117687
117807
  }
117688
- function formatNestedFlatV3(parentName, children, schemaLookup, resourcePascal, operationId, resource) {
117808
+ function formatNestedFlatV3(parentName, children, schemaLookup, resourcePascal, operationId, resource, isJsonInputOperation) {
117689
117809
  const lines = [];
117690
- const parentCamel = toCamelCase$1(parentName);
117810
+ const parentCamel = toCamelCase(parentName);
117691
117811
  for (const [childName, childParam] of children.entries()) {
117692
117812
  if (childParam.value !== void 0) {
117693
- const methodName = `${parentCamel}${toPascalCase$1(childName)}`;
117813
+ const methodName = `${parentCamel}${toPascalCase(childName)}`;
117694
117814
  const nestedKey = `${parentName}[${childName}]`;
117695
117815
  const value = formatValueV3(
117696
117816
  childName,
@@ -117699,49 +117819,85 @@ function formatNestedFlatV3(parentName, children, schemaLookup, resourcePascal,
117699
117819
  resourcePascal,
117700
117820
  nestedKey,
117701
117821
  operationId,
117702
- resource
117822
+ resource,
117823
+ isJsonInputOperation
117703
117824
  );
117704
117825
  lines.push(`.${methodName}(${value})`);
117705
117826
  }
117706
117827
  }
117707
117828
  return lines;
117708
117829
  }
117709
- function formatValueV3(_fieldName, value, schemaLookup, resourcePascal, key2, operationId, resource) {
117830
+ function formatValueV3(_fieldName, value, schemaLookup, resourcePascal, key2, operationId, resource, isJsonInputOperation) {
117710
117831
  const schemaKey = key2 || _fieldName;
117711
117832
  const schema = schemaLookup(schemaKey);
117712
- const isMapType = schema?.type === "object" && schema?.additionalProperties === true && !schema?.properties;
117833
+ const isSchemalessObject2 = schema?.type === "object" && schema?.additionalProperties === true && !schema?.properties;
117713
117834
  if (schema?.type === "boolean" && typeof value === "string") {
117714
117835
  if (value === "true" || value === "false") {
117715
117836
  value = value === "true";
117716
117837
  }
117717
117838
  }
117718
- if (isMapType) {
117839
+ if (isSchemalessObject2) {
117719
117840
  if (typeof value === "string") {
117720
117841
  const trimmed = value.trim();
117721
117842
  if (trimmed.startsWith("{") && trimmed.endsWith("}")) {
117722
- try {
117723
- const parsed = JSON.parse(trimmed);
117724
- if (typeof parsed === "object" && parsed !== null) {
117725
- return formatAsJavaHashMap(parsed);
117843
+ if (isJsonInputOperation) {
117844
+ try {
117845
+ const parsed = JSON.parse(trimmed);
117846
+ if (typeof parsed === "object" && parsed !== null) {
117847
+ return formatAsJavaHashMap(parsed);
117848
+ }
117849
+ } catch {
117726
117850
  }
117727
- } catch {
117851
+ } else {
117852
+ const escaped = trimmed.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
117853
+ return `new JSONObject("${escaped}")`;
117728
117854
  }
117729
117855
  }
117730
117856
  } else if (typeof value === "object" && value !== null && !Array.isArray(value)) {
117731
- return formatAsJavaHashMap(value);
117857
+ if (isJsonInputOperation) {
117858
+ return formatAsJavaHashMap(value);
117859
+ } else {
117860
+ const jsonStr = JSON.stringify(value).replace(/\\/g, "\\\\").replace(/"/g, '\\"');
117861
+ return `new JSONObject("${jsonStr}")`;
117862
+ }
117732
117863
  }
117733
117864
  }
117734
- if (typeof value === "string" && !isMapType) {
117865
+ if (typeof value === "string" && !isSchemalessObject2) {
117735
117866
  const trimmed = value.trim();
117736
117867
  const schemaType = schema?.type;
117737
117868
  if (trimmed.startsWith("[") && trimmed.endsWith("]")) {
117738
117869
  if (schemaType === "array" || !schemaType) {
117870
+ if (isJsonInputOperation) {
117871
+ try {
117872
+ const parsed = JSON.parse(trimmed);
117873
+ if (Array.isArray(parsed)) {
117874
+ const items = parsed.map((v) => {
117875
+ if (typeof v === "string") {
117876
+ const escaped2 = v.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
117877
+ return `"${escaped2}"`;
117878
+ }
117879
+ return String(v);
117880
+ }).join(", ");
117881
+ return `java.util.Arrays.asList(${items})`;
117882
+ }
117883
+ } catch {
117884
+ }
117885
+ }
117739
117886
  const escaped = value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
117740
117887
  return `new JSONArray("${escaped}")`;
117741
117888
  }
117742
117889
  }
117743
117890
  if (trimmed.startsWith("{") && trimmed.endsWith("}")) {
117744
117891
  if (schemaType === "object" || !schemaType) {
117892
+ if (isJsonInputOperation) {
117893
+ try {
117894
+ const parsed = JSON.parse(trimmed);
117895
+ if (typeof parsed === "object" && parsed !== null) {
117896
+ return formatAsJavaHashMap(parsed);
117897
+ }
117898
+ } catch {
117899
+ }
117900
+ }
117745
117901
  const escaped = value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
117746
117902
  return `new JSONObject("${escaped}")`;
117747
117903
  }
@@ -117776,9 +117932,9 @@ function buildResponseHandling$2(returns, isListOperation) {
117776
117932
  if (singularName.toLowerCase() === "list") {
117777
117933
  continue;
117778
117934
  }
117779
- const typeName = toPascalCase$1(singularName);
117780
- const varName = toCamelCase$1(singularName);
117781
- const getterName = toCamelCase$1(singularName);
117935
+ const typeName = toPascalCase(singularName);
117936
+ const varName = toCamelCase(singularName);
117937
+ const getterName = toCamelCase(singularName);
117782
117938
  lines.push(` ${typeName} ${varName} = entry.${getterName}();`);
117783
117939
  }
117784
117940
  lines.push(" }");
@@ -117788,9 +117944,9 @@ function buildResponseHandling$2(returns, isListOperation) {
117788
117944
  if (singularName.toLowerCase() === "list") {
117789
117945
  continue;
117790
117946
  }
117791
- const typeName = ret.isArray ? `List<${toPascalCase$1(singularName)}>` : toPascalCase$1(singularName);
117792
- const varName = toCamelCase$1(ret.name);
117793
- const getterName = toCamelCase$1(ret.name);
117947
+ const typeName = ret.isArray ? `List<${toPascalCase(singularName)}>` : toPascalCase(singularName);
117948
+ const varName = toCamelCase(ret.name);
117949
+ const getterName = toCamelCase(ret.name);
117794
117950
  lines.push(` ${typeName} ${varName} = result.${getterName}();`);
117795
117951
  }
117796
117952
  }
@@ -117872,6 +118028,102 @@ function formatHashMapValue(value) {
117872
118028
  }
117873
118029
  return `"${String(value)}"`;
117874
118030
  }
118031
+ function detectBuilderPatternParams(ir, schemaLookup) {
118032
+ const result = [];
118033
+ if (!ir.operation.isJsonInput) {
118034
+ return result;
118035
+ }
118036
+ const methodPascal = toPascalCase(ir.operation.method);
118037
+ for (const [key2, value] of Object.entries(ir.rawParams)) {
118038
+ if (!Array.isArray(value) || value.length === 0 || typeof value[0] !== "object") {
118039
+ continue;
118040
+ }
118041
+ const schema = schemaLookup(key2);
118042
+ const hasStructuredProperties = schema?.properties && Object.keys(schema.properties).length > 0;
118043
+ if (!hasStructuredProperties) {
118044
+ continue;
118045
+ }
118046
+ const singularName = singularize(toPascalCase(key2));
118047
+ const builderClassName = `${singularName}${methodPascal}InputParams`;
118048
+ const builderFactoryName = `${builderClassName}Builder`;
118049
+ const mapProperties = /* @__PURE__ */ new Set();
118050
+ if (schema?.properties) {
118051
+ for (const [propKey, propSchema] of Object.entries(schema.properties)) {
118052
+ const itemSchema = propSchema.items;
118053
+ if (itemSchema?.additionalProperties && !itemSchema.properties) {
118054
+ mapProperties.add(propKey);
118055
+ }
118056
+ }
118057
+ }
118058
+ result.push({
118059
+ name: key2,
118060
+ listVarName: toCamelCase(key2),
118061
+ builderClassName,
118062
+ builderFactoryName,
118063
+ items: value,
118064
+ mapProperties
118065
+ });
118066
+ }
118067
+ return result;
118068
+ }
118069
+ function generateBatchPreDeclarations(batchParams, resourcePascal, _methodPascal, _rawParams) {
118070
+ const lines = [];
118071
+ for (const param of batchParams) {
118072
+ lines.push(
118073
+ `List<${resourcePascal}.${param.builderClassName}> ${param.listVarName} = new java.util.ArrayList<>();`
118074
+ );
118075
+ for (let i = 0; i < param.items.length; i++) {
118076
+ const item = param.items[i];
118077
+ for (const mapProp of param.mapProperties) {
118078
+ if (item[mapProp] !== void 0) {
118079
+ const mapVarName = `${mapProp}${i + 1}`;
118080
+ const mapValue = item[mapProp];
118081
+ lines.push(
118082
+ `Map<String, Object> ${mapVarName} = new java.util.HashMap<String, Object>();`
118083
+ );
118084
+ for (const [k, v] of Object.entries(mapValue)) {
118085
+ lines.push(`${mapVarName}.put("${k}", ${formatHashMapValue(v)});`);
118086
+ }
118087
+ }
118088
+ }
118089
+ const itemVarName = `${toCamelCase(singularize(param.name))}${i}`;
118090
+ lines.push(
118091
+ `${resourcePascal}.${param.builderClassName} ${itemVarName} = new ${resourcePascal}.${param.builderFactoryName}()`
118092
+ );
118093
+ for (const [propKey, propValue] of Object.entries(item)) {
118094
+ const setterName = `set${toPascalCase(propKey)}`;
118095
+ let formattedValue;
118096
+ if (param.mapProperties.has(propKey)) {
118097
+ formattedValue = `${propKey}${i + 1}`;
118098
+ } else {
118099
+ const isTimestampField2 = propKey.includes("timestamp") || propKey.endsWith("_at");
118100
+ const numericValue = typeof propValue === "number" ? propValue : typeof propValue === "string" && /^\d+$/.test(propValue) ? Number(propValue) : null;
118101
+ if (numericValue !== null && isTimestampField2) {
118102
+ const isMillis = numericValue > 1e12;
118103
+ if (isMillis) {
118104
+ formattedValue = `new Timestamp(${numericValue}L)`;
118105
+ } else {
118106
+ formattedValue = `new Timestamp(${numericValue}L * 1000)`;
118107
+ }
118108
+ } else if (numericValue !== null) {
118109
+ formattedValue = `${numericValue}L`;
118110
+ } else if (typeof propValue === "string") {
118111
+ const escaped = propValue.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
118112
+ formattedValue = `"${escaped}"`;
118113
+ } else if (typeof propValue === "boolean") {
118114
+ formattedValue = String(propValue);
118115
+ } else {
118116
+ formattedValue = `"${String(propValue)}"`;
118117
+ }
118118
+ }
118119
+ lines.push(` .${setterName}(${formattedValue})`);
118120
+ }
118121
+ lines.push(" .build();");
118122
+ lines.push(`${param.listVarName}.add(${itemVarName});`);
118123
+ }
118124
+ }
118125
+ return lines;
118126
+ }
117875
118127
  const javaV3Generator = {
117876
118128
  lang: "java-v3",
117877
118129
  displayName: "Java v3",
@@ -117882,11 +118134,11 @@ const DEFAULT_OPTIONS$4 = {
117882
118134
  };
117883
118135
  function generateJavaV4(ir, options = DEFAULT_OPTIONS$4) {
117884
118136
  const lines = [];
117885
- const resourceCamel = toCamelCase$1(ir.operation.resource);
117886
- const resourcePascal = toPascalCase$1(ir.operation.resource);
118137
+ const resourceCamel = toCamelCase(ir.operation.resource);
118138
+ const resourcePascal = toPascalCase(ir.operation.resource);
117887
118139
  const methodForJavaV4 = ir.operation.methodSdk ?? ir.operation.method;
117888
- const methodCamel = toCamelCase$1(methodForJavaV4);
117889
- const methodPascal = toPascalCase$1(methodForJavaV4);
118140
+ const methodCamel = toCamelCase(methodForJavaV4);
118141
+ const methodPascal = toPascalCase(methodForJavaV4);
117890
118142
  const { params, filters } = parseBracketNotation$4(ir.flatParams);
117891
118143
  const nestedFilterGroups = groupNestedFilters(filters);
117892
118144
  const hasParams = params.size > 0 || filters.length > 0;
@@ -117902,9 +118154,20 @@ function generateJavaV4(ir, options = DEFAULT_OPTIONS$4) {
117902
118154
  const multiArrayParams = [...params.entries()].filter(
117903
118155
  ([, p2]) => p2.isArray && p2.arrayItems && p2.arrayItems.size > 0
117904
118156
  );
117905
- const needsListImport = multiArrayParams.length > 0 || isListOperation;
117906
- const needsTimestampImport = hasTimestampParams(ir.flatParams, schemaLookup);
117907
- const needsMapImport = hasMapParams(ir.flatParams, schemaLookup);
118157
+ const earlyBatchParamDetection = detectBuilderPatternParamsV4(
118158
+ ir,
118159
+ schemaLookup
118160
+ );
118161
+ const hasBatchParams = earlyBatchParamDetection.length > 0;
118162
+ const batchParamsNeedMaps = earlyBatchParamDetection.some(
118163
+ (p2) => p2.mapProperties.size > 0
118164
+ );
118165
+ const needsListImport = multiArrayParams.length > 0 || isListOperation || hasBatchParams;
118166
+ const batchParamsHaveTimestamps = earlyBatchParamDetection.some(
118167
+ (p2) => Object.values(p2.schemaProperties).some((s) => s?.format === "unix-time")
118168
+ );
118169
+ const needsTimestampImport = hasTimestampParams(ir.flatParams, schemaLookup) || batchParamsHaveTimestamps;
118170
+ const needsMapImport = hasMapParams(ir.flatParams, schemaLookup) || batchParamsNeedMaps;
117908
118171
  const hasArrayTypedSingleValues = ir.flatParams.some((param) => {
117909
118172
  const schema = schemaLookup(param.key);
117910
118173
  return schema?.type === "array" && typeof param.value === "string" && !Array.isArray(param.value);
@@ -117948,7 +118211,11 @@ function generateJavaV4(ir, options = DEFAULT_OPTIONS$4) {
117948
118211
  }
117949
118212
  }
117950
118213
  const returns = ir.operation.returns || [];
117951
- const shouldSkipDefaultResource = ir.operation.isJsonInput || ir.operation.isBatch;
118214
+ const methodNameLower = ir.operation.method.toLowerCase();
118215
+ const isCrudOperation = ["create", "update", "retrieve"].includes(
118216
+ methodNameLower
118217
+ );
118218
+ const shouldSkipDefaultResource = ir.operation.isJsonInput || ir.operation.isBatch || !isCrudOperation;
117952
118219
  const effectiveReturns = returns.length > 0 ? returns : shouldSkipDefaultResource ? [] : [
117953
118220
  {
117954
118221
  name: ir.operation.resource,
@@ -117964,9 +118231,9 @@ function generateJavaV4(ir, options = DEFAULT_OPTIONS$4) {
117964
118231
  if (singularName.toLowerCase() === "list") {
117965
118232
  continue;
117966
118233
  }
117967
- const modelClass = toPascalCase$1(singularName);
118234
+ const modelClass = toPascalCase(singularName);
117968
118235
  allImports.push(
117969
- `import com.chargebee.v4.models.${toCamelCase$1(singularName)}.${modelClass};`
118236
+ `import com.chargebee.v4.models.${toCamelCase(singularName)}.${modelClass};`
117970
118237
  );
117971
118238
  }
117972
118239
  allImports.push(
@@ -118005,6 +118272,20 @@ function generateJavaV4(ir, options = DEFAULT_OPTIONS$4) {
118005
118272
  );
118006
118273
  }
118007
118274
  lines.push(" .build();");
118275
+ const batchParamNames = /* @__PURE__ */ new Set();
118276
+ for (const info of earlyBatchParamDetection) {
118277
+ batchParamNames.add(info.name);
118278
+ }
118279
+ if (earlyBatchParamDetection.length > 0) {
118280
+ lines.push("");
118281
+ const batchLines = generateBatchPreDeclarationsV4(
118282
+ earlyBatchParamDetection,
118283
+ paramsClassName
118284
+ );
118285
+ for (const line of batchLines) {
118286
+ lines.push(` ${line}`);
118287
+ }
118288
+ }
118008
118289
  const nestedParams = [...params.entries()].filter(
118009
118290
  ([, p2]) => p2.children && p2.children.size > 0
118010
118291
  );
@@ -118048,19 +118329,30 @@ function generateJavaV4(ir, options = DEFAULT_OPTIONS$4) {
118048
118329
  ` ${paramsClassName} params = ${paramsClassName}.builder()`
118049
118330
  );
118050
118331
  for (const [name, param] of params.entries()) {
118332
+ if (batchParamNames.has(name)) {
118333
+ lines.push(
118334
+ ` .${toCamelCase(name)}(${toCamelCase(name)}List)`
118335
+ );
118336
+ continue;
118337
+ }
118051
118338
  if (param.children && param.children.size > 0) {
118052
118339
  lines.push(
118053
- ` .${toCamelCase$1(name)}(${toCamelCase$1(name)}Params)`
118340
+ ` .${toCamelCase(name)}(${toCamelCase(name)}Params)`
118054
118341
  );
118055
118342
  continue;
118056
118343
  }
118057
118344
  if (param.isArray && param.arrayItems && param.arrayItems.size > 0) {
118058
118345
  lines.push(
118059
- ` .${toCamelCase$1(name)}(${toCamelCase$1(name)}List)`
118346
+ ` .${toCamelCase(name)}(${toCamelCase(name)}List)`
118060
118347
  );
118061
118348
  continue;
118062
118349
  }
118063
118350
  if (param.value !== void 0) {
118351
+ if (name.startsWith("cf_")) {
118352
+ const escapedValue = String(param.value).replace(/\\/g, "\\\\").replace(/"/g, '\\"');
118353
+ lines.push(` .customField("${name}", "${escapedValue}")`);
118354
+ continue;
118355
+ }
118064
118356
  const paramSchema = schemaLookup(name);
118065
118357
  if (paramSchema?.isFilter === true) {
118066
118358
  const formattedValue = formatJavaValueV4(
@@ -118069,7 +118361,7 @@ function generateJavaV4(ir, options = DEFAULT_OPTIONS$4) {
118069
118361
  name,
118070
118362
  paramsClassName
118071
118363
  );
118072
- lines.push(` .${toCamelCase$1(name)}()`);
118364
+ lines.push(` .${toCamelCase(name)}()`);
118073
118365
  lines.push(` .is(${formattedValue})`);
118074
118366
  } else {
118075
118367
  const formattedValue = formatJavaValueV4(
@@ -118078,13 +118370,13 @@ function generateJavaV4(ir, options = DEFAULT_OPTIONS$4) {
118078
118370
  name,
118079
118371
  paramsClassName
118080
118372
  );
118081
- lines.push(` .${toCamelCase$1(name)}(${formattedValue})`);
118373
+ lines.push(` .${toCamelCase(name)}(${formattedValue})`);
118082
118374
  }
118083
118375
  }
118084
118376
  }
118085
118377
  for (const builderName of nestedFilterBuilderNames) {
118086
118378
  lines.push(
118087
- ` .${toCamelCase$1(builderName)}(${toCamelCase$1(builderName)})`
118379
+ ` .${toCamelCase(builderName)}(${toCamelCase(builderName)})`
118088
118380
  );
118089
118381
  }
118090
118382
  for (const filter of simpleFilters) {
@@ -118131,10 +118423,10 @@ function formatFilterMethodV4Style(filter, paramsClassName) {
118131
118423
  paramsClassName,
118132
118424
  filter.schema
118133
118425
  );
118134
- return [`.${toCamelCase$1(filter.key)}(${formattedValue2})`];
118426
+ return [`.${toCamelCase(filter.key)}(${formattedValue2})`];
118135
118427
  }
118136
118428
  const [, fieldName, operator] = match;
118137
- const fieldMethod = toCamelCase$1(fieldName);
118429
+ const fieldMethod = toCamelCase(fieldName);
118138
118430
  if (filter.filterType === "SortFilter" || fieldName === "sort_by") {
118139
118431
  const sortFieldMethod = String(filter.value);
118140
118432
  return [`.${fieldMethod}()`, `.${sortFieldMethod}()`, `.${operator}()`];
@@ -118153,7 +118445,7 @@ function formatFilterValueV4(value, filterType, fieldName, enumClassPrefix, sche
118153
118445
  return "null";
118154
118446
  }
118155
118447
  if (filterType === "EnumFilter" && enumClassPrefix && fieldName) {
118156
- const enumClass = schema?.sdkEnumName || toPascalCase$1(fieldName);
118448
+ const enumClass = schema?.sdkEnumName || toPascalCase(fieldName);
118157
118449
  if (typeof value === "string" && value.startsWith("[") && value.endsWith("]")) {
118158
118450
  try {
118159
118451
  const parsed = JSON.parse(value);
@@ -118233,8 +118525,8 @@ function formatFilterValueV4(value, filterType, fieldName, enumClassPrefix, sche
118233
118525
  }
118234
118526
  function buildNestedBuilder(name, param, paramsClassName, schemaLookup, _resourcePascal) {
118235
118527
  const lines = [];
118236
- const varName = `${toCamelCase$1(name)}Params`;
118237
- const builderClass = `${paramsClassName}.${toPascalCase$1(name)}Params`;
118528
+ const varName = `${toCamelCase(name)}Params`;
118529
+ const builderClass = `${paramsClassName}.${toPascalCase(name)}Params`;
118238
118530
  lines.push(` ${builderClass} ${varName} =`);
118239
118531
  lines.push(` ${builderClass}.builder()`);
118240
118532
  if (param.children) {
@@ -118242,7 +118534,7 @@ function buildNestedBuilder(name, param, paramsClassName, schemaLookup, _resourc
118242
118534
  if (childParam.value !== void 0) {
118243
118535
  const nestedKey = `${name}[${childName}]`;
118244
118536
  lines.push(
118245
- ` .${toCamelCase$1(childName)}(${formatJavaValueV4(childParam.value, schemaLookup, nestedKey, builderClass)})`
118537
+ ` .${toCamelCase(childName)}(${formatJavaValueV4(childParam.value, schemaLookup, nestedKey, builderClass)})`
118246
118538
  );
118247
118539
  }
118248
118540
  }
@@ -118252,8 +118544,8 @@ function buildNestedBuilder(name, param, paramsClassName, schemaLookup, _resourc
118252
118544
  }
118253
118545
  function buildMultiArrayBuilder(name, param, paramsClassName, schemaLookup, _resourcePascal) {
118254
118546
  const lines = [];
118255
- const varName = toCamelCase$1(name);
118256
- const itemClass = `${paramsClassName}.${toPascalCase$1(name)}Params`;
118547
+ const varName = toCamelCase(name);
118548
+ const itemClass = `${paramsClassName}.${toPascalCase(name)}Params`;
118257
118549
  if (!param.arrayItems) return lines;
118258
118550
  const sortedIndices = [...param.arrayItems.keys()].sort((a, b) => a - b);
118259
118551
  const itemVarNames = [];
@@ -118269,7 +118561,7 @@ function buildMultiArrayBuilder(name, param, paramsClassName, schemaLookup, _res
118269
118561
  if (propParam.value !== void 0) {
118270
118562
  const arrayKey = `${name}[${propName}][${idx}]`;
118271
118563
  lines.push(
118272
- ` .${toCamelCase$1(propName)}(${formatJavaValueV4(propParam.value, schemaLookup, arrayKey, itemClass)})`
118564
+ ` .${toCamelCase(propName)}(${formatJavaValueV4(propParam.value, schemaLookup, arrayKey, itemClass)})`
118273
118565
  );
118274
118566
  }
118275
118567
  }
@@ -118370,7 +118662,7 @@ function formatJavaValueV4(value, schemaLookup, key2, paramsClassName) {
118370
118662
  }
118371
118663
  if (isEnumValue$1(value, schema) || isEnumValueWithHyphenNormalization(value, schema)) {
118372
118664
  const enumFieldName = key2.split("[")[0].split(".").pop() || key2.split("[")[0] || key2;
118373
- const enumClass = schema?.sdkEnumName || toPascalCase$1(enumFieldName);
118665
+ const enumClass = schema?.sdkEnumName || toPascalCase(enumFieldName);
118374
118666
  const enumValue = formatEnumValue(value, "constantCase");
118375
118667
  return `${paramsClassName}.${enumClass}.${enumValue}`;
118376
118668
  }
@@ -118461,8 +118753,8 @@ function groupNestedFilters(filters) {
118461
118753
  }
118462
118754
  function buildNestedFilterBuilder(parentName, filters, paramsClassName) {
118463
118755
  const lines = [];
118464
- const varName = toCamelCase$1(parentName);
118465
- const builderClass = `${paramsClassName}.${toPascalCase$1(parentName)}Params`;
118756
+ const varName = toCamelCase(parentName);
118757
+ const builderClass = `${paramsClassName}.${toPascalCase(parentName)}Params`;
118466
118758
  const nestedParamsClassForEnum = builderClass;
118467
118759
  lines.push(` ${builderClass} ${varName} =`);
118468
118760
  lines.push(` ${builderClass}.builder()`);
@@ -118471,8 +118763,8 @@ function buildNestedFilterBuilder(parentName, filters, paramsClassName) {
118471
118763
  if (parts.length !== 3) continue;
118472
118764
  const fieldName = parts[1].name;
118473
118765
  const operator = parts[2].name;
118474
- const operatorCamel = toCamelCase$1(operator);
118475
- const fieldMethod = toCamelCase$1(fieldName);
118766
+ const operatorCamel = toCamelCase(operator);
118767
+ const fieldMethod = toCamelCase(fieldName);
118476
118768
  const formattedValue = formatFilterValueV4(
118477
118769
  filter.value,
118478
118770
  filter.filterType,
@@ -118490,20 +118782,122 @@ function buildResponseHandling$1(returns, isListOperation) {
118490
118782
  const lines = [];
118491
118783
  if (isListOperation) {
118492
118784
  lines.push(" response.getList().forEach((customer) -> {});");
118785
+ } else if (returns.length === 0) {
118786
+ lines.push(" System.out.println(response);");
118493
118787
  } else {
118494
118788
  for (const ret of returns) {
118495
118789
  const singularName = singularize(ret.name);
118496
118790
  if (singularName.toLowerCase() === "list") {
118497
118791
  continue;
118498
118792
  }
118499
- const typeName = ret.isArray ? `List<${toPascalCase$1(singularName)}>` : toPascalCase$1(singularName);
118500
- const varName = toCamelCase$1(ret.name);
118501
- const getterName = `get${toPascalCase$1(ret.name)}`;
118793
+ const typeName = ret.isArray ? `List<${toPascalCase(singularName)}>` : toPascalCase(singularName);
118794
+ const varName = toCamelCase(ret.name);
118795
+ const getterName = `get${toPascalCase(ret.name)}`;
118502
118796
  lines.push(` ${typeName} ${varName} = response.${getterName}();`);
118503
118797
  }
118504
118798
  }
118505
118799
  return lines;
118506
118800
  }
118801
+ function detectBuilderPatternParamsV4(ir, schemaLookup) {
118802
+ const result = [];
118803
+ if (!ir.operation.isJsonInput) {
118804
+ return result;
118805
+ }
118806
+ for (const [key2, value] of Object.entries(ir.rawParams)) {
118807
+ if (!Array.isArray(value) || value.length === 0 || typeof value[0] !== "object") {
118808
+ continue;
118809
+ }
118810
+ const schema = schemaLookup(key2);
118811
+ const hasStructuredProperties = schema?.properties && Object.keys(schema.properties).length > 0;
118812
+ if (!hasStructuredProperties || !schema?.properties) {
118813
+ continue;
118814
+ }
118815
+ const schemaProperties = {};
118816
+ const mapProperties = /* @__PURE__ */ new Set();
118817
+ for (const [propKey, propSchema] of Object.entries(schema.properties)) {
118818
+ if (propSchema.type === "array" && propSchema.items) {
118819
+ schemaProperties[propKey] = propSchema.items;
118820
+ if (propSchema.items.additionalProperties && !propSchema.items.properties) {
118821
+ mapProperties.add(propKey);
118822
+ }
118823
+ } else {
118824
+ schemaProperties[propKey] = propSchema;
118825
+ }
118826
+ }
118827
+ const nestedParamsClassName = `${toPascalCase(key2)}Params`;
118828
+ result.push({
118829
+ name: key2,
118830
+ listVarName: toCamelCase(key2),
118831
+ nestedParamsClassName,
118832
+ items: value,
118833
+ mapProperties,
118834
+ schemaProperties
118835
+ });
118836
+ }
118837
+ return result;
118838
+ }
118839
+ function generateBatchPreDeclarationsV4(batchParams, paramsClassName) {
118840
+ const lines = [];
118841
+ for (const param of batchParams) {
118842
+ const itemClass = `${paramsClassName}.${param.nestedParamsClassName}`;
118843
+ for (let i = 0; i < param.items.length; i++) {
118844
+ const item = param.items[i];
118845
+ for (const mapProp of param.mapProperties) {
118846
+ if (item[mapProp] !== void 0) {
118847
+ const mapVarName = `${mapProp}${i}`;
118848
+ const mapValue = item[mapProp];
118849
+ lines.push(
118850
+ `Map<String, Object> ${mapVarName} = new java.util.HashMap<String, Object>();`
118851
+ );
118852
+ for (const [k, v] of Object.entries(mapValue)) {
118853
+ lines.push(`${mapVarName}.put("${k}", ${formatMapValue(v)});`);
118854
+ }
118855
+ lines.push("");
118856
+ }
118857
+ }
118858
+ }
118859
+ const itemVarNames = [];
118860
+ for (let i = 0; i < param.items.length; i++) {
118861
+ const item = param.items[i];
118862
+ const itemVarName = `${singularize(toCamelCase(param.name))}${i}`;
118863
+ itemVarNames.push(itemVarName);
118864
+ lines.push(`${itemClass} ${itemVarName} =`);
118865
+ lines.push(` ${itemClass}.builder()`);
118866
+ for (const [propKey, propValue] of Object.entries(item)) {
118867
+ if (propValue === void 0 || propValue === null) continue;
118868
+ const methodName = toCamelCase(propKey);
118869
+ let formattedValue;
118870
+ if (param.mapProperties.has(propKey)) {
118871
+ formattedValue = `${propKey}${i}`;
118872
+ } else {
118873
+ const propSchema = param.schemaProperties[propKey];
118874
+ const isTimestamp = propSchema?.format === "unix-time";
118875
+ const numericValue = typeof propValue === "number" ? propValue : typeof propValue === "string" && /^\d+$/.test(propValue) ? Number(propValue) : null;
118876
+ if (numericValue !== null && isTimestamp) {
118877
+ formattedValue = formatTimestamp(numericValue);
118878
+ } else if (numericValue !== null) {
118879
+ const isLong = propSchema?.format === "int64" || propSchema?.isMoneyColumn || numericValue > 2147483647 || numericValue < -2147483648;
118880
+ formattedValue = isLong ? `${numericValue}L` : String(numericValue);
118881
+ } else if (typeof propValue === "string") {
118882
+ const escaped = propValue.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
118883
+ formattedValue = `"${escaped}"`;
118884
+ } else if (typeof propValue === "boolean") {
118885
+ formattedValue = String(propValue);
118886
+ } else {
118887
+ formattedValue = `"${String(propValue)}"`;
118888
+ }
118889
+ }
118890
+ lines.push(` .${methodName}(${formattedValue})`);
118891
+ }
118892
+ lines.push(" .build();");
118893
+ lines.push("");
118894
+ }
118895
+ lines.push(
118896
+ `List<${itemClass}> ${param.listVarName}List = List.of(${itemVarNames.join(", ")});`
118897
+ );
118898
+ }
118899
+ return lines;
118900
+ }
118507
118901
  const javaV4Generator = {
118508
118902
  lang: "java-v4",
118509
118903
  displayName: "Java v4",
@@ -118788,8 +119182,8 @@ function generateNodejs(ir, options = DEFAULT_OPTIONS$3) {
118788
119182
  keepFiltersFlat: sdkVersion === "v2"
118789
119183
  });
118790
119184
  const schemaLookup = buildSchemaLookup$1(ir.flatParams);
118791
- const resource = toCamelCase$1(ir.operation.resource);
118792
- const method = toCamelCase$1(ir.operation.method);
119185
+ const resource = toCamelCase(ir.operation.resource);
119186
+ const method = ir.operation.method;
118793
119187
  const pathParam = extractPathParam$2(ir);
118794
119188
  const returns = ir.operation.returns || [];
118795
119189
  const enumFormat = "lowerCase";
@@ -118884,7 +119278,7 @@ function generateV3Code$2(ir, resource, method, params, pathParam, returns, sche
118884
119278
  lines.push(" console.log(entry);");
118885
119279
  if (returns.length > 0) {
118886
119280
  for (const ret of returns) {
118887
- const varName = toSafeVarName(toCamelCase$1(ret.name));
119281
+ const varName = toSafeVarName(toCamelCase(ret.name));
118888
119282
  lines.push(` const ${varName} = entry.${ret.name};`);
118889
119283
  }
118890
119284
  } else {
@@ -118897,7 +119291,7 @@ function generateV3Code$2(ir, resource, method, params, pathParam, returns, sche
118897
119291
  lines.push(" console.log(result);");
118898
119292
  if (returns.length > 0) {
118899
119293
  for (const ret of returns) {
118900
- const varName = toSafeVarName(toCamelCase$1(ret.name));
119294
+ const varName = toSafeVarName(toCamelCase(ret.name));
118901
119295
  lines.push(` const ${varName} = result.${ret.name};`);
118902
119296
  }
118903
119297
  } else {
@@ -119115,7 +119509,7 @@ function buildSchemaLookup(flatParams, isV4) {
119115
119509
  schemaMap.set(param.key, param.schema);
119116
119510
  if (param.key.includes("[")) {
119117
119511
  const parts = parseBracketKey$1(param.key);
119118
- const rootKey = isV4 ? toSnakeCase(parts[0]) : toCamelCase$1(parts[0]);
119512
+ const rootKey = isV4 ? toSnakeCase(parts[0]) : toCamelCase(parts[0]);
119119
119513
  if (parts.length > 1) {
119120
119514
  const finalKey = parts[parts.length - 1];
119121
119515
  schemaMap.set(finalKey, param.schema);
@@ -119124,7 +119518,7 @@ function buildSchemaLookup(flatParams, isV4) {
119124
119518
  schemaMap.set(rootKey, param.schema);
119125
119519
  }
119126
119520
  } else {
119127
- const convertedKey = isV4 ? toSnakeCase(param.key) : toCamelCase$1(param.key);
119521
+ const convertedKey = isV4 ? toSnakeCase(param.key) : toCamelCase(param.key);
119128
119522
  schemaMap.set(convertedKey, param.schema);
119129
119523
  schemaMap.set(param.key, param.schema);
119130
119524
  }
@@ -119133,7 +119527,7 @@ function buildSchemaLookup(flatParams, isV4) {
119133
119527
  if (schemaMap.has(key2)) {
119134
119528
  return schemaMap.get(key2);
119135
119529
  }
119136
- const convertedKey = isV4 ? toSnakeCase(key2) : toCamelCase$1(key2);
119530
+ const convertedKey = isV4 ? toSnakeCase(key2) : toCamelCase(key2);
119137
119531
  if (schemaMap.has(convertedKey)) {
119138
119532
  return schemaMap.get(convertedKey);
119139
119533
  }
@@ -119199,6 +119593,10 @@ ${indent})`;
119199
119593
  if (typeof value === "object") {
119200
119594
  const entries = Object.entries(value);
119201
119595
  if (entries.length === 0) return isV4 ? "[]" : "array()";
119596
+ if (key2 && schemaLookup && isSchemalessObject(schemaLookup(key2))) {
119597
+ const jsonStr = JSON.stringify(value);
119598
+ return `'${jsonStr}'`;
119599
+ }
119202
119600
  const lines = entries.map(([k, v]) => {
119203
119601
  const formattedValue = formatPhpValue(
119204
119602
  v,
@@ -119221,16 +119619,38 @@ ${indent})`;
119221
119619
  }
119222
119620
  return String(value);
119223
119621
  }
119224
- function convertParamKeys(params, isV4) {
119622
+ function convertParamKeys(params, isV4, schemaLookup, parentKey) {
119225
119623
  const result = {};
119226
119624
  for (const [key2, value] of Object.entries(params)) {
119227
- const newKey = isV4 ? toSnakeCase(key2) : toCamelCase$1(key2);
119625
+ const newKey = isV4 ? toSnakeCase(key2) : toCamelCase(key2);
119626
+ const lookupKey = parentKey ? `${parentKey}[${key2}]` : key2;
119627
+ const schema = schemaLookup ? schemaLookup(lookupKey) : void 0;
119628
+ const isSchemaless = isSchemalessObject(schema);
119228
119629
  if (typeof value === "object" && value !== null && !Array.isArray(value)) {
119229
- result[newKey] = convertParamKeys(value, isV4);
119630
+ if (isSchemaless) {
119631
+ result[newKey] = value;
119632
+ } else {
119633
+ result[newKey] = convertParamKeys(
119634
+ value,
119635
+ isV4,
119636
+ schemaLookup,
119637
+ lookupKey
119638
+ );
119639
+ }
119230
119640
  } else if (Array.isArray(value)) {
119231
- result[newKey] = value.map((item) => {
119641
+ result[newKey] = value.map((item, index) => {
119232
119642
  if (typeof item === "object" && item !== null) {
119233
- return convertParamKeys(item, isV4);
119643
+ const itemLookupKey = `${lookupKey}[${index}]`;
119644
+ const itemSchema = schemaLookup ? schemaLookup(itemLookupKey) : void 0;
119645
+ if (isSchemalessObject(itemSchema)) {
119646
+ return item;
119647
+ }
119648
+ return convertParamKeys(
119649
+ item,
119650
+ isV4,
119651
+ schemaLookup,
119652
+ lookupKey
119653
+ );
119234
119654
  }
119235
119655
  return item;
119236
119656
  });
@@ -119243,11 +119663,11 @@ function convertParamKeys(params, isV4) {
119243
119663
  function generatePhp(ir, options = DEFAULT_OPTIONS$2) {
119244
119664
  const { sdkVersion = "v4" } = options;
119245
119665
  const isV4 = sdkVersion === "v4";
119246
- const rawParams = parseBracketNotation$2(ir.flatParams);
119247
- const params = convertParamKeys(rawParams, isV4);
119248
119666
  const schemaLookup = buildSchemaLookup(ir.flatParams, isV4);
119249
- const resource = toPascalCase$1(ir.operation.resource);
119250
- const method = toCamelCase$1(ir.operation.method);
119667
+ const rawParams = parseBracketNotation$2(ir.flatParams);
119668
+ const params = convertParamKeys(rawParams, isV4, schemaLookup);
119669
+ const resource = toPascalCase(ir.operation.resource);
119670
+ const method = toCamelCase(ir.operation.method);
119251
119671
  const pathParam = extractPathParam$1(ir);
119252
119672
  const returns = ir.operation.returns || [];
119253
119673
  if (isV4) {
@@ -119347,23 +119767,33 @@ function generateV3Code$1(ir, resource, method, params, pathParam, returns, sche
119347
119767
  ir.operation.resource,
119348
119768
  ir.operation.id
119349
119769
  );
119770
+ const singleReturn = returns.length === 1;
119771
+ const hasArrayReturn = returns.some((r) => r.isArray === true);
119772
+ const isV3ListResultWithArrayReturn = !isListOp && (singleReturn ? returns[0].isArray === true || returns[0].name === ir.operation.resource : hasArrayReturn);
119350
119773
  if (isListOp) {
119351
119774
  lines.push("foreach($all as $entry) {");
119352
119775
  if (returns.length > 0) {
119353
119776
  for (const ret of returns) {
119354
- const varName2 = toCamelCase$1(ret.name);
119777
+ const varName2 = toCamelCase(ret.name);
119355
119778
  lines.push(` $${varName2} = $entry->${varName2}();`);
119356
119779
  }
119357
119780
  } else {
119358
- const varName2 = toCamelCase$1(ir.operation.resource);
119781
+ const varName2 = toCamelCase(ir.operation.resource);
119359
119782
  lines.push(` $${varName2} = $entry->${varName2}();`);
119360
119783
  }
119361
119784
  lines.push("}");
119785
+ } else if (isV3ListResultWithArrayReturn) {
119786
+ lines.push("foreach($result as $entry) {");
119787
+ for (const ret of returns) {
119788
+ const entryMethod = toCamelCase(ret.dataType);
119789
+ lines.push(` $${entryMethod} = $entry->${entryMethod}();`);
119790
+ }
119791
+ lines.push("}");
119362
119792
  } else if (isV3ListResultRetrieve) {
119363
- const resourceMethod = toCamelCase$1(ir.operation.resource);
119793
+ const resourceMethod = toCamelCase(ir.operation.resource);
119364
119794
  if (returns.length > 0) {
119365
119795
  for (const ret of returns) {
119366
- const varName2 = toCamelCase$1(ret.name);
119796
+ const varName2 = toCamelCase(ret.name);
119367
119797
  lines.push(
119368
119798
  `$${varName2} = $result->count() > 0 ? $result[0]->${varName2}() : null;`
119369
119799
  );
@@ -119376,11 +119806,11 @@ function generateV3Code$1(ir, resource, method, params, pathParam, returns, sche
119376
119806
  } else {
119377
119807
  if (returns.length > 0) {
119378
119808
  for (const ret of returns) {
119379
- const varName2 = toCamelCase$1(ret.name);
119809
+ const varName2 = toCamelCase(ret.name);
119380
119810
  lines.push(`$${varName2} = $result->${varName2}();`);
119381
119811
  }
119382
119812
  } else {
119383
- const varName2 = toCamelCase$1(ir.operation.resource);
119813
+ const varName2 = toCamelCase(ir.operation.resource);
119384
119814
  lines.push(`$${varName2} = $result->${varName2}();`);
119385
119815
  }
119386
119816
  }
@@ -119407,7 +119837,7 @@ function generateV4Code(ir, _resource, method, params, pathParam, returns, schem
119407
119837
  lines.push("]);");
119408
119838
  const hasParams = Object.keys(params).length > 0;
119409
119839
  const paramsStr = hasParams ? formatPhpValue(params, true, 0, schemaLookup) : "";
119410
- const resourceVar = toCamelCase$1(ir.operation.resource);
119840
+ const resourceVar = toCamelCase(ir.operation.resource);
119411
119841
  const isListOp = ir.operation.isListOperation;
119412
119842
  const methodName = method === "list" ? "all" : method;
119413
119843
  let methodCall;
@@ -119429,11 +119859,11 @@ function generateV4Code(ir, _resource, method, params, pathParam, returns, schem
119429
119859
  lines.push("foreach($result->list as $entry) {");
119430
119860
  if (returns.length > 0) {
119431
119861
  for (const ret of returns) {
119432
- const varName = toCamelCase$1(ret.name);
119862
+ const varName = toCamelCase(ret.name);
119433
119863
  lines.push(` $${varName} = $entry->${ret.name};`);
119434
119864
  }
119435
119865
  } else {
119436
- const varName = toCamelCase$1(ir.operation.resource);
119866
+ const varName = toCamelCase(ir.operation.resource);
119437
119867
  lines.push(` $${varName} = $entry->${ir.operation.resource};`);
119438
119868
  }
119439
119869
  lines.push("}");
@@ -119441,24 +119871,24 @@ function generateV4Code(ir, _resource, method, params, pathParam, returns, schem
119441
119871
  const resourceProp = ir.operation.resource;
119442
119872
  if (returns.length > 0) {
119443
119873
  for (const ret of returns) {
119444
- const varName = toCamelCase$1(ret.name);
119874
+ const varName = toCamelCase(ret.name);
119445
119875
  lines.push(
119446
119876
  `$${varName} = !empty($result->list) ? $result->list[0]->${ret.name} : null;`
119447
119877
  );
119448
119878
  }
119449
119879
  } else {
119450
119880
  lines.push(
119451
- `$${toCamelCase$1(resourceProp)} = !empty($result->list) ? $result->list[0]->${resourceProp} : null;`
119881
+ `$${toCamelCase(resourceProp)} = !empty($result->list) ? $result->list[0]->${resourceProp} : null;`
119452
119882
  );
119453
119883
  }
119454
119884
  } else {
119455
119885
  if (returns.length > 0) {
119456
119886
  for (const ret of returns) {
119457
- const varName = toCamelCase$1(ret.name);
119887
+ const varName = toCamelCase(ret.name);
119458
119888
  lines.push(`$${varName} = $result->${ret.name};`);
119459
119889
  }
119460
119890
  } else {
119461
- const varName = toCamelCase$1(ir.operation.resource);
119891
+ const varName = toCamelCase(ir.operation.resource);
119462
119892
  lines.push(`$${varName} = $result->${ir.operation.resource};`);
119463
119893
  }
119464
119894
  }
@@ -119744,7 +120174,7 @@ function formatFilterV3(name, operator, value, schemaLookup, enumFormat, resourc
119744
120174
  if (resolved) {
119745
120175
  return formatPythonV3Enum(resolved, str, operationResource);
119746
120176
  }
119747
- const enumClassName = schema?.sdkEnumName ?? toPascalCase$1(name);
120177
+ const enumClassName = schema?.sdkEnumName ?? toPascalCase(name);
119748
120178
  const useTopLevelEnum = schema?.isGlobalEnum === true;
119749
120179
  const enumPrefix = useTopLevelEnum ? `chargebee.${enumClassName}` : `chargebee.${resourceClass}.${enumClassName}`;
119750
120180
  return `${enumPrefix}.${formatEnumValue(str, "constantCase")}`;
@@ -119803,7 +120233,7 @@ function generatePython(ir, options = DEFAULT_OPTIONS$1) {
119803
120233
  const { params, filters } = parseBracketNotation$1(ir.flatParams);
119804
120234
  const schemaLookup = buildSchemaLookup$1(ir.flatParams);
119805
120235
  const methodForGen = isV3 ? ir.operation.methodAbbreviated ?? ir.operation.method : PYTHON_V2_METHOD_OVERRIDES[ir.operation.id] ?? ir.operation.method;
119806
- const resourceClass = toPascalCase$1(ir.operation.resource);
120236
+ const resourceClass = toPascalCase(ir.operation.resource);
119807
120237
  const method = toSnakeCase(methodForGen);
119808
120238
  const pathParam = extractPathParam(ir);
119809
120239
  const returns = ir.operation.returns || [];
@@ -120098,7 +120528,7 @@ function generateV3Code(ir, resourceClass, method, params, filters, pathParam, r
120098
120528
  ir.operation.id,
120099
120529
  ir.operation.resource
120100
120530
  );
120101
- paramValue = resolved ? formatPythonV3Enum(resolved, value, ir.operation.resource) : `chargebee.${resourceClass}.${toPascalCase$1(key2)}.${formatEnumValue(value, "constantCase")}`;
120531
+ paramValue = resolved ? formatPythonV3Enum(resolved, value, ir.operation.resource) : `chargebee.${resourceClass}.${toPascalCase(key2)}.${formatEnumValue(value, "constantCase")}`;
120102
120532
  } else {
120103
120533
  paramValue = formatPyValue(value, 0, schemaLookup, key2, enumFormat);
120104
120534
  }
@@ -120121,7 +120551,7 @@ function generateV3Code(ir, resourceClass, method, params, filters, pathParam, r
120121
120551
  );
120122
120552
  }
120123
120553
  const hasParams = paramLines.length > 0;
120124
- const paramsClass = PYTHON_PARAMS_OVERRIDES.topLevel?.[ir.operation.id] ?? `${toPascalCase$1(method)}Params`;
120554
+ const paramsClass = PYTHON_PARAMS_OVERRIDES.topLevel?.[ir.operation.id] ?? `${toPascalCase(method)}Params`;
120125
120555
  const resultVar = isListOp ? "entries" : "response";
120126
120556
  let methodCall;
120127
120557
  if (pathParam && hasParams) {
@@ -120176,9 +120606,9 @@ function formatOnePyEnum(value, bracketKey, schema, operationId, resource) {
120176
120606
  resource
120177
120607
  );
120178
120608
  if (resolved) return formatPythonV3Enum(resolved, value, resource);
120179
- const resourceClass = toPascalCase$1(resource);
120609
+ const resourceClass = toPascalCase(resource);
120180
120610
  const fieldName = bracketKey.split("[").pop()?.replace("]", "") ?? bracketKey;
120181
- return `chargebee.${resourceClass}.${toPascalCase$1(fieldName)}.${formatEnumValue(value, "constantCase")}`;
120611
+ return `chargebee.${resourceClass}.${toPascalCase(fieldName)}.${formatEnumValue(value, "constantCase")}`;
120182
120612
  }
120183
120613
  function formatNestedObjectAsDictV3(name, obj, schemaLookup, enumFormat) {
120184
120614
  const childLines = [];
@@ -120198,8 +120628,8 @@ ${childLines.join(",\n")}
120198
120628
  }`;
120199
120629
  }
120200
120630
  function formatNestedObjectV3(ir, method, name, obj, schemaLookup, enumFormat) {
120201
- const resourceClass = toPascalCase$1(ir.operation.resource);
120202
- const paramsClass = PYTHON_PARAMS_OVERRIDES.nestedClass?.[ir.operation.id]?.[name] ?? `${toPascalCase$1(method)}${toPascalCase$1(name)}Params`;
120631
+ const resourceClass = toPascalCase(ir.operation.resource);
120632
+ const paramsClass = PYTHON_PARAMS_OVERRIDES.nestedClass?.[ir.operation.id]?.[name] ?? `${toPascalCase(method)}${toPascalCase(name)}Params`;
120203
120633
  const childLines = [];
120204
120634
  for (const [key2, value] of Object.entries(obj)) {
120205
120635
  if (key2.startsWith("__filter__")) {
@@ -120257,9 +120687,9 @@ ${childLines.join(",\n")}
120257
120687
  )`;
120258
120688
  }
120259
120689
  function formatMultiArrayV3(ir, method, name, items, schemaLookup, enumFormat) {
120260
- const resourceClass = toPascalCase$1(ir.operation.resource);
120690
+ const resourceClass = toPascalCase(ir.operation.resource);
120261
120691
  const singularName = pluralize.singular(name);
120262
- const paramsClass = `${toPascalCase$1(method)}${toPascalCase$1(singularName)}Params`;
120692
+ const paramsClass = `${toPascalCase(method)}${toPascalCase(singularName)}Params`;
120263
120693
  const paramIndent = " ";
120264
120694
  const lines = [` ${toSnakeCase(name)}=[`];
120265
120695
  for (let i = 0; i < items.length; i++) {
@@ -120331,7 +120761,7 @@ function generateRuby(ir, options = DEFAULT_OPTIONS) {
120331
120761
  lines.push(` :api_key => "${ir.apiKey}")`);
120332
120762
  const { params, filters } = parseBracketNotation(ir.flatParams);
120333
120763
  const schemaLookup = buildSchemaLookup$1(ir.flatParams);
120334
- const resourcePascal = RUBY_RESOURCE_OVERRIDES[ir.operation.resource] ?? toPascalCase$1(ir.operation.resource);
120764
+ const resourcePascal = RUBY_RESOURCE_OVERRIDES[ir.operation.resource] ?? toPascalCase(ir.operation.resource);
120335
120765
  const methodSnake = toSnakeCase(ir.operation.method);
120336
120766
  const pathParam = getPathParam(ir);
120337
120767
  const isListOperation = ir.operation.isListOperation;
@@ -120377,9 +120807,11 @@ function parseBracketNotation(flatParams) {
120377
120807
  rootParam.value = param.value;
120378
120808
  } else if (parts.length === 2) {
120379
120809
  const second = parts[1];
120380
- if (second.isIndex) {
120810
+ if (second.isIndex && second.index !== void 0) {
120381
120811
  rootParam.isArray = true;
120382
- rootParam.value = param.value;
120812
+ if (!rootParam.simpleArrayValues)
120813
+ rootParam.simpleArrayValues = /* @__PURE__ */ new Map();
120814
+ rootParam.simpleArrayValues.set(second.index, param.value);
120383
120815
  } else {
120384
120816
  if (!rootParam.children) rootParam.children = /* @__PURE__ */ new Map();
120385
120817
  rootParam.children.set(second.name, {
@@ -120482,8 +120914,20 @@ function buildParamLines(params, filters, schemaLookup) {
120482
120914
  continue;
120483
120915
  }
120484
120916
  if (param.isArray && (!param.arrayItems || param.arrayItems.size === 0)) {
120485
- const formattedValue2 = formatRubyValue(param.value, schemaLookup, name);
120486
- lines.push(` :${toSnakeCase(name)} => [${formattedValue2}]${comma}`);
120917
+ if (param.simpleArrayValues && param.simpleArrayValues.size > 0) {
120918
+ const simpleValues = param.simpleArrayValues;
120919
+ const sortedIndices = [...simpleValues.keys()].sort((a, b) => a - b);
120920
+ const formattedValues = sortedIndices.map((i) => {
120921
+ const v = simpleValues.get(i);
120922
+ return formatRubyValue(v, schemaLookup, `${name}[${i}]`);
120923
+ });
120924
+ lines.push(
120925
+ ` :${toSnakeCase(name)} => [${formattedValues.join(", ")}]${comma}`
120926
+ );
120927
+ } else {
120928
+ const formattedValue2 = formatRubyValue(param.value, schemaLookup, name);
120929
+ lines.push(` :${toSnakeCase(name)} => [${formattedValue2}]${comma}`);
120930
+ }
120487
120931
  continue;
120488
120932
  }
120489
120933
  if (param.children && param.children.size > 0) {
@@ -120739,6 +121183,7 @@ function expandDescriptor(minimal) {
120739
121183
  method: minimal.method,
120740
121184
  methodSdk: minimal.methodSdk,
120741
121185
  methodAbbreviated: minimal.methodAbbreviated,
121186
+ subDomain: minimal.subDomain,
120742
121187
  // Expand flags (default to false if not present)
120743
121188
  isListOperation: minimal.flags?.list ?? false,
120744
121189
  isJsonInput: minimal.flags?.json ?? false,
@@ -120944,7 +121389,8 @@ function buildIR(operation, params, options = {}) {
120944
121389
  const apiKey = options.apiKey ?? DEFAULT_API_KEY;
120945
121390
  const apiVersion = options.apiVersion ?? DEFAULT_API_VERSION;
120946
121391
  const domainName = options.domainName ?? "chargebee.com";
120947
- const baseUrl = options.baseUrl ?? `https://${site}.${domainName}/api/${apiVersion}`;
121392
+ const subDomain = operation.subDomain;
121393
+ const baseUrl = options.baseUrl ?? (subDomain ? `https://${site}.${subDomain}.${domainName}/api/${apiVersion}` : `https://${site}.${domainName}/api/${apiVersion}`);
120948
121394
  const { resolvedPath, pathParams } = resolvePathParams(
120949
121395
  operation.http.path,
120950
121396
  params
@@ -121356,6 +121802,267 @@ function formatValue(value, schema) {
121356
121802
  return String(value);
121357
121803
  }
121358
121804
  }
121805
+ class ValidationError extends Error {
121806
+ constructor(operation, issues) {
121807
+ const summary = issues.map((i) => `${i.path}: ${i.message}`).join("; ");
121808
+ super(`Validation failed for ${operation}: ${summary}`);
121809
+ this.operation = operation;
121810
+ this.issues = issues;
121811
+ if (Error.captureStackTrace) {
121812
+ Error.captureStackTrace(this, ValidationError);
121813
+ }
121814
+ }
121815
+ name = "ValidationError";
121816
+ }
121817
+ function validateParams(schema, params, options = {}) {
121818
+ const opts = {
121819
+ allowUnknown: options.allowUnknown ?? true,
121820
+ // LENIENT by default
121821
+ validateEnums: options.validateEnums ?? true,
121822
+ validateTypes: options.validateTypes ?? true,
121823
+ validateRequired: options.validateRequired ?? true
121824
+ };
121825
+ const issues = [];
121826
+ validateObject(schema, params, "", issues, opts);
121827
+ return issues;
121828
+ }
121829
+ function validateObject(schema, obj, basePath, issues, opts) {
121830
+ if (opts.validateRequired) {
121831
+ for (const requiredField of schema.required ?? []) {
121832
+ const value = obj[requiredField];
121833
+ if (value === void 0 || value === null) {
121834
+ const path = joinPath(basePath, requiredField);
121835
+ issues.push({
121836
+ path,
121837
+ message: `Required field "${requiredField}" is missing`,
121838
+ code: "required"
121839
+ });
121840
+ }
121841
+ }
121842
+ }
121843
+ for (const [key2, value] of Object.entries(obj)) {
121844
+ if (value === void 0) continue;
121845
+ const fieldPath = joinPath(basePath, key2);
121846
+ let propSchema = schema.properties?.[key2];
121847
+ if (!propSchema && key2.includes("[")) {
121848
+ const rootKey = key2.slice(0, key2.indexOf("["));
121849
+ propSchema = schema.properties?.[rootKey];
121850
+ if (propSchema) {
121851
+ continue;
121852
+ }
121853
+ }
121854
+ if (!propSchema) {
121855
+ if (!opts.allowUnknown) {
121856
+ issues.push({
121857
+ path: fieldPath,
121858
+ message: `Unknown field "${key2}"`,
121859
+ code: "unknown_field"
121860
+ });
121861
+ }
121862
+ continue;
121863
+ }
121864
+ if (value === null) continue;
121865
+ if (opts.validateTypes) {
121866
+ const typeIssue = validateType(fieldPath, value, propSchema);
121867
+ if (typeIssue) {
121868
+ issues.push(typeIssue);
121869
+ continue;
121870
+ }
121871
+ }
121872
+ if (opts.validateEnums && propSchema.enum) {
121873
+ const stringValue = String(value).toLowerCase();
121874
+ const lowerEnums = propSchema.enum.map((e) => e.toLowerCase());
121875
+ if (!lowerEnums.includes(stringValue)) {
121876
+ issues.push({
121877
+ path: fieldPath,
121878
+ message: `Invalid value "${String(value)}". Valid values: ${propSchema.enum.join(", ")}`,
121879
+ code: "enum"
121880
+ });
121881
+ }
121882
+ }
121883
+ if (propSchema.type === "object" && propSchema.properties && typeof value === "object" && !Array.isArray(value)) {
121884
+ validateObject(
121885
+ propSchema,
121886
+ value,
121887
+ fieldPath,
121888
+ issues,
121889
+ opts
121890
+ );
121891
+ }
121892
+ if (propSchema.type === "array" && Array.isArray(value)) {
121893
+ validateArray(propSchema, value, fieldPath, issues, opts);
121894
+ }
121895
+ if (propSchema.isFilter && typeof value === "object" && !Array.isArray(value)) {
121896
+ validateFilterParam(
121897
+ propSchema,
121898
+ value,
121899
+ fieldPath,
121900
+ issues,
121901
+ opts
121902
+ );
121903
+ }
121904
+ }
121905
+ }
121906
+ function validateArray(schema, arr, basePath, issues, opts) {
121907
+ const itemSchema = schema.items;
121908
+ if (!itemSchema) return;
121909
+ arr.forEach((item, index) => {
121910
+ const itemPath = `${basePath}[${index}]`;
121911
+ if (item === null || item === void 0) return;
121912
+ if (opts.validateTypes) {
121913
+ const typeIssue = validateType(itemPath, item, itemSchema);
121914
+ if (typeIssue) {
121915
+ issues.push(typeIssue);
121916
+ return;
121917
+ }
121918
+ }
121919
+ if (itemSchema.type === "object" && itemSchema.properties && typeof item === "object" && !Array.isArray(item)) {
121920
+ validateObject(
121921
+ itemSchema,
121922
+ item,
121923
+ itemPath,
121924
+ issues,
121925
+ opts
121926
+ );
121927
+ }
121928
+ });
121929
+ }
121930
+ function validateFilterParam(schema, filterValue, basePath, issues, opts) {
121931
+ const validOperators = /* @__PURE__ */ new Set([
121932
+ "is",
121933
+ "is_not",
121934
+ "in",
121935
+ "not_in",
121936
+ "gt",
121937
+ "gte",
121938
+ "lt",
121939
+ "lte",
121940
+ "between",
121941
+ "on",
121942
+ "before",
121943
+ "after",
121944
+ "starts_with",
121945
+ "is_present",
121946
+ "is_not_present"
121947
+ ]);
121948
+ for (const [operator, value] of Object.entries(filterValue)) {
121949
+ if (!validOperators.has(operator) && !opts.allowUnknown) {
121950
+ issues.push({
121951
+ path: `${basePath}[${operator}]`,
121952
+ message: `Unknown filter operator "${operator}"`,
121953
+ code: "unknown_field"
121954
+ });
121955
+ continue;
121956
+ }
121957
+ if (opts.validateEnums && schema.enum && schema.filterType === "enum") {
121958
+ const values = Array.isArray(value) ? value : [value];
121959
+ for (const v of values) {
121960
+ if (!schema.enum.includes(String(v))) {
121961
+ issues.push({
121962
+ path: `${basePath}[${operator}]`,
121963
+ message: `Invalid enum value "${v}". Valid values: ${schema.enum.join(", ")}`,
121964
+ code: "enum"
121965
+ });
121966
+ }
121967
+ }
121968
+ }
121969
+ }
121970
+ }
121971
+ function validateType(path, value, schema) {
121972
+ const actualType = getValueType(value);
121973
+ switch (schema.type) {
121974
+ case "string":
121975
+ if (actualType !== "string") {
121976
+ return {
121977
+ path,
121978
+ message: `Expected string, got ${actualType}`,
121979
+ code: "type"
121980
+ };
121981
+ }
121982
+ break;
121983
+ case "integer":
121984
+ case "number": {
121985
+ const numericValue = actualType === "string" ? Number(value) : value;
121986
+ if (actualType !== "number" && (actualType !== "string" || Number.isNaN(numericValue))) {
121987
+ return {
121988
+ path,
121989
+ message: `Expected number, got ${actualType}`,
121990
+ code: "type"
121991
+ };
121992
+ }
121993
+ if (schema.type === "integer" && !Number.isInteger(numericValue)) {
121994
+ return {
121995
+ path,
121996
+ message: `Expected integer, got decimal number`,
121997
+ code: "type"
121998
+ };
121999
+ }
122000
+ break;
122001
+ }
122002
+ case "boolean":
122003
+ if (actualType !== "boolean") {
122004
+ return {
122005
+ path,
122006
+ message: `Expected boolean, got ${actualType}`,
122007
+ code: "type"
122008
+ };
122009
+ }
122010
+ break;
122011
+ case "array":
122012
+ if (actualType !== "array") {
122013
+ return {
122014
+ path,
122015
+ message: `Expected array, got ${actualType}`,
122016
+ code: "type"
122017
+ };
122018
+ }
122019
+ break;
122020
+ case "object":
122021
+ if (actualType === "string") {
122022
+ try {
122023
+ const parsed = JSON.parse(value);
122024
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
122025
+ return {
122026
+ path,
122027
+ message: `Expected object, got ${actualType} (JSON parsed to non-object)`,
122028
+ code: "type"
122029
+ };
122030
+ }
122031
+ } catch {
122032
+ return {
122033
+ path,
122034
+ message: `Expected object, got ${actualType} (not valid JSON)`,
122035
+ code: "type"
122036
+ };
122037
+ }
122038
+ } else if (actualType !== "object") {
122039
+ return {
122040
+ path,
122041
+ message: `Expected object, got ${actualType}`,
122042
+ code: "type"
122043
+ };
122044
+ }
122045
+ break;
122046
+ }
122047
+ return null;
122048
+ }
122049
+ function getValueType(value) {
122050
+ if (value === null) return "null";
122051
+ if (Array.isArray(value)) return "array";
122052
+ return typeof value;
122053
+ }
122054
+ function joinPath(base, field) {
122055
+ return base ? `${base}.${field}` : field;
122056
+ }
122057
+ function assertValid(operationId, schema, params, options) {
122058
+ const issues = validateParams(schema, params, options);
122059
+ if (issues.length > 0) {
122060
+ throw new ValidationError(operationId, issues);
122061
+ }
122062
+ }
122063
+ function isValid(schema, params, options) {
122064
+ return validateParams(schema, params, options).length === 0;
122065
+ }
121359
122066
  class CodeGenerationError extends Error {
121360
122067
  constructor(operation, language, cause, message) {
121361
122068
  super(
@@ -121402,6 +122109,9 @@ async function generateFromSample(sample, config, language) {
121402
122109
  try {
121403
122110
  return generateWithIR(sample, config, language);
121404
122111
  } catch (error) {
122112
+ if (error instanceof ValidationError) {
122113
+ throw error;
122114
+ }
121405
122115
  if (error instanceof CodeGenerationError) {
121406
122116
  throw error;
121407
122117
  }
@@ -121436,6 +122146,16 @@ function generateWithIR(sample, config, language) {
121436
122146
  const actualParams = params.map ? params.map : params;
121437
122147
  const pathParams = extractPathParamsFromUri(sample.uri, descriptor2.http.path);
121438
122148
  const mergedParams = { ...pathParams, ...actualParams };
122149
+ const shouldValidate = config.validate ?? true;
122150
+ if (shouldValidate) {
122151
+ const validationOpts = typeof shouldValidate === "object" ? shouldValidate : { allowUnknown: false };
122152
+ const bodyParams = stripPathParams(
122153
+ mergedParams,
122154
+ descriptor2.http.path,
122155
+ descriptor2.params
122156
+ );
122157
+ assertValid(operationId, descriptor2.params, bodyParams, validationOpts);
122158
+ }
121439
122159
  const ir = buildIR(descriptor2, mergedParams, {
121440
122160
  site: config.site || "{site}",
121441
122161
  apiKey: config.apiKey || "{site_api_key}",
@@ -121481,6 +122201,27 @@ function getCombinedVersion(apiVersion, pcVersion) {
121481
122201
  }
121482
122202
  return "v2-pcv2";
121483
122203
  }
122204
+ function stripPathParams(params, pathTemplate, bodySchema) {
122205
+ const pathParamKeys = /* @__PURE__ */ new Set();
122206
+ const placeholderRegex = /\{([^}]+)\}/g;
122207
+ let match = placeholderRegex.exec(pathTemplate);
122208
+ while (match !== null) {
122209
+ const name = match[1];
122210
+ pathParamKeys.add(name);
122211
+ pathParamKeys.add(name.replace(/-/g, "_"));
122212
+ if (name.endsWith("-id") || name.endsWith("_id")) {
122213
+ pathParamKeys.add("id");
122214
+ }
122215
+ match = placeholderRegex.exec(pathTemplate);
122216
+ }
122217
+ const result = {};
122218
+ for (const [key2, value] of Object.entries(params)) {
122219
+ if (bodySchema.properties?.[key2] !== void 0 || !pathParamKeys.has(key2)) {
122220
+ result[key2] = value;
122221
+ }
122222
+ }
122223
+ return result;
122224
+ }
121484
122225
  export {
121485
122226
  AVAILABLE_LANGUAGE_IDS as A,
121486
122227
  CodeGenerationError as C,
@@ -121489,28 +122230,32 @@ export {
121489
122230
  LanguageNotSupportedError as L,
121490
122231
  OperationNotFoundError as O,
121491
122232
  TryInApiExplorer as T,
122233
+ ValidationError as V,
121492
122234
  getGenerator as a,
121493
122235
  getSupportedLanguages as b,
121494
122236
  getOperation as c,
121495
- buildIR as d,
122237
+ assertValid as d,
121496
122238
  expandDescriptor as e,
121497
- CodeSamples as f,
122239
+ buildIR as f,
121498
122240
  generateFromSample as g,
121499
- Carousel as h,
121500
- CodeBlock as i,
121501
- CodeSampleHeader as j,
121502
- LanguageSwitcher as k,
121503
- useSampleLoader as l,
121504
- AVAILABLE_LANGUAGES as m,
121505
- DEFAULT_THEME as n,
121506
- LANGUAGE_DISPLAY_NAMES as o,
122241
+ CodeSamples as h,
122242
+ Carousel as i,
122243
+ CodeBlock as j,
122244
+ CodeSampleHeader as k,
122245
+ LanguageSwitcher as l,
122246
+ useSampleLoader as m,
122247
+ AVAILABLE_LANGUAGES as n,
122248
+ DEFAULT_THEME as o,
121507
122249
  pluralize as p,
121508
- getOperationIds as q,
121509
- getOperations as r,
121510
- getOperationIdsForVersion as s,
121511
- hasGenerator as t,
122250
+ LANGUAGE_DISPLAY_NAMES as q,
122251
+ getOperationIds as r,
122252
+ getOperations as s,
122253
+ getOperationIdsForVersion as t,
121512
122254
  useLanguageSelection as u,
121513
- compressDescriptor as v,
121514
- formatValue as w
122255
+ hasGenerator as v,
122256
+ compressDescriptor as w,
122257
+ formatValue as x,
122258
+ isValid as y,
122259
+ validateParams as z
121515
122260
  };
121516
- //# sourceMappingURL=generate-from-sample-rMSyyork.js.map
122261
+ //# sourceMappingURL=generate-from-sample-DhbfCFUp.js.map