From 24b1247c3e40690c57c7fdfdd712be624a7b12fb Mon Sep 17 00:00:00 2001 From: Muthiah Muralidharan Date: Wed, 4 Nov 2026 11:29:30 +0530 Subject: [PATCH 1/6] fix(cli): confirm live-site writes instead of blocking them Write operations on live sites now ask for a yes/no confirmation in a terminal instead of being refused outright. -y/--yes skips the prompt. Without a terminal or in --json mode, an unconfirmed write is still refused with exit code 6. Test sites, reads, read-only POSTs and --code-sample are unchanged. Co-authored-by: Cursor --- AGENTS.md | 4 +- README.md | 2 +- src/commands/auth.ts | 6 +- src/commands/generated/addon.ts | 25 ++- src/commands/generated/address.ts | 5 +- src/commands/generated/alert.ts | 15 +- src/commands/generated/attached_item.ts | 15 +- src/commands/generated/business_entity.ts | 5 +- src/commands/generated/business_rule.ts | 40 ++-- src/commands/generated/business_ruleset.ts | 35 ++-- src/commands/generated/card.ts | 20 +- src/commands/generated/comment.ts | 10 +- src/commands/generated/coupon.ts | 35 ++-- src/commands/generated/coupon_code.ts | 10 +- src/commands/generated/coupon_set.ts | 25 ++- src/commands/generated/credit_note.ts | 60 +++--- src/commands/generated/credit_unit.ts | 20 +- src/commands/generated/currency.ts | 20 +- src/commands/generated/customer.ts | 110 ++++++----- src/commands/generated/differential_price.ts | 15 +- src/commands/generated/entitlement.ts | 5 +- .../generated/entitlement_override.ts | 5 +- src/commands/generated/feature.ts | 30 +-- src/commands/generated/gift.ts | 25 ++- src/commands/generated/hosted_page.ts | 10 +- src/commands/generated/in_app_subscription.ts | 15 +- src/commands/generated/invoice.ts | 175 +++++++++++------- src/commands/generated/item.ts | 15 +- src/commands/generated/item_entitlement.ts | 10 +- src/commands/generated/item_family.ts | 15 +- src/commands/generated/item_price.ts | 15 +- src/commands/generated/ledger_operation.ts | 25 ++- src/commands/generated/metered_feature.ts | 20 +- src/commands/generated/non_subscription.ts | 5 +- src/commands/generated/offer_event.ts | 5 +- src/commands/generated/offer_fulfillment.ts | 10 +- .../generated/omnichannel_subscription.ts | 5 +- src/commands/generated/order.ts | 45 +++-- src/commands/generated/payment_intent.ts | 10 +- .../generated/payment_schedule_scheme.ts | 10 +- src/commands/generated/payment_source.ts | 70 ++++--- src/commands/generated/payment_voucher.ts | 5 +- src/commands/generated/personalized_offer.ts | 5 +- src/commands/generated/plan.ts | 25 ++- src/commands/generated/portal_session.ts | 10 +- src/commands/generated/price_variant.ts | 15 +- .../generated/pricing_page_session.ts | 10 +- src/commands/generated/promotional_credit.ts | 15 +- src/commands/generated/promotional_grant.ts | 5 +- src/commands/generated/purchase.ts | 10 +- src/commands/generated/quote.ts | 105 ++++++----- src/commands/generated/ramp.ts | 15 +- src/commands/generated/recorded_purchase.ts | 5 +- src/commands/generated/subscription.ts | 150 +++++++++------ .../generated/subscription_entitlement.ts | 5 +- src/commands/generated/time_machine.ts | 10 +- src/commands/generated/transaction.ts | 30 +-- src/commands/generated/unbilled_charge.ts | 25 ++- src/commands/generated/usage.ts | 15 +- src/commands/generated/usage_event.ts | 10 +- src/commands/generated/usage_file.ts | 5 +- .../generated/virtual_bank_account.ts | 20 +- src/commands/generated/webhook_endpoint.ts | 15 +- src/commands/help.ts | 2 +- src/lib/api/sdk.ts | 38 +++- src/lib/api/write-gate.ts | 56 ++++-- src/lib/skills/content/SKILL.md | 10 +- src/lib/skills/content/references/commands.md | 10 +- .../skills/content/references/workflows.md | 2 +- src/tests/cli/commands.test.ts | 2 +- src/tests/integration/help.test.ts | 2 +- .../integration/live-site-write-gate.test.ts | 113 ++++++++++- src/tests/integration/profiles.test.ts | 6 +- src/tests/unit/lib/api/sdk.coverage.test.ts | 4 +- src/tests/unit/lib/api/write-gate.test.ts | 68 ++++--- src/tests/unit/lib/ui/color.test.ts | 5 +- src/tools/generate.ts | 12 +- 77 files changed, 1162 insertions(+), 680 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 55d88bc..27396c9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -111,7 +111,7 @@ Do not introduce additional credential storage paths without an explicit require Generated API commands enforce two protections: -- **Write gate:** Write operations are blocked on live sites. +- **Write gate:** Write operations on live sites require confirmation: an interactive yes/no prompt, or `-y/--yes`. Without a terminal (or in `--json` mode) and without `--yes`, the write is refused with exit code 6. Test sites, reads, and non-mutating POSTs (estimates, exports, hosted-page URLs) never prompt. - **Catalog gate:** Product Catalog-specific operations are blocked when they do not match the configured site's catalog version. For `--code-sample`, the **write gate does not apply** because no API request is executed. The **catalog gate still applies** so generated code matches the site's Product Catalog version. @@ -146,7 +146,7 @@ Run live tests with: bun run test:live ``` -Never permit successful writes on live Chargebee sites in automated tests. Live-site customer-create tests must assert the CLI write gate refuses the operation; use a dedicated validation site and read-only key. Successful remote writes are limited to customer creation and cleanup deletion on test sites. +Never permit successful writes on live Chargebee sites in automated tests, and never pass `--yes` to a live-site write in live tests. Live-site customer-create tests must assert the CLI write gate refuses the unconfirmed operation; use a dedicated validation site and read-only key. Successful remote writes are limited to customer creation and cleanup deletion on test sites. Shared test helpers belong in `src/lib/test-support/` and must never be imported by production entry points or commands. diff --git a/README.md b/README.md index 5011c29..b8f1078 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ export CHARGEBEE_API_KEY=test_xxxxxxxxxxxx Create API keys from **Settings → Configure Chargebee → API Keys** in the Chargebee Dashboard. -> Write operations are blocked on live sites. Use a test site when building or testing integrations. +> Write operations on live sites ask for confirmation before they run. In scripts, CI, or `--json` mode, add `--yes` to confirm; without it the command exits with code `6`. Use a test site when building or testing integrations. ## Quick Example diff --git a/src/commands/auth.ts b/src/commands/auth.ts index a5dbf56..a8a696b 100644 --- a/src/commands/auth.ts +++ b/src/commands/auth.ts @@ -239,9 +239,9 @@ ${sectionTitle("EXAMPLES")} chargebee auth add Connect a site interactively chargebee auth add --profile staging Save credentials as staging -Writes are blocked on live sites: a site whose name doesn't end in -test, -unless its API key starts with test_. Prefer CHARGEBEE_API_KEY over --api-key -so the secret is not stored in shell history. +Writes on live sites ask for confirmation (or need --yes): a site whose name +doesn't end in -test, unless its API key starts with test_. Prefer +CHARGEBEE_API_KEY over --api-key so the secret is not stored in shell history. --region (${REGIONS.join(" | ")}) records where the site is hosted and is used to reach the regional webhook tunnel for \`chargebee listen\`. API requests are diff --git a/src/commands/generated/addon.ts b/src/commands/generated/addon.ts index f43a706..f70aaa4 100644 --- a/src/commands/generated/addon.ts +++ b/src/commands/generated/addon.ts @@ -23,13 +23,14 @@ export function registerAddon(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs addon copy\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "copy_an_addon", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "addon copy"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "copy_an_addon", method: "POST", uri: "/addons/copy", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "addon copy", opts.yes === true); try { const client = await getClient(); const result = await (client as any).addon.copy(params); @@ -44,13 +45,14 @@ export function registerAddon(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs addon create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "create_an_addon", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "addon create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "create_an_addon", method: "POST", uri: "/addons", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "addon create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).addon.create(params); @@ -66,15 +68,16 @@ export function registerAddon(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs addon delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "delete_an_addon", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "addon delete"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "delete_an_addon", method: "POST", uri: "/addons/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "addon-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'addon-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "addon delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).addon.delete(resource.id, params); @@ -136,15 +139,16 @@ export function registerAddon(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs addon unarchive\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "unarchive_an_addon", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "addon unarchive"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "unarchive_an_addon", method: "POST", uri: "/addons/{id}/unarchive", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "addon-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'addon-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "addon unarchive", opts.yes === true); try { const client = await getClient(); const result = await (client as any).addon.unarchive(resource.id, params); @@ -160,15 +164,16 @@ export function registerAddon(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs addon update\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "update_an_addon", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "addon update"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "update_an_addon", method: "POST", uri: "/addons/{id}", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "addon-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'addon-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "addon update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).addon.update(resource.id, params); diff --git a/src/commands/generated/address.ts b/src/commands/generated/address.ts index fcc04b3..9232176 100644 --- a/src/commands/generated/address.ts +++ b/src/commands/generated/address.ts @@ -41,12 +41,13 @@ export function registerAddress(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs address update\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_an_address", opIdV1: "update_an_address", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_an_address", opIdV1: "update_an_address", method: "POST", uri: "/addresses", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "address update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).address.update(params); diff --git a/src/commands/generated/alert.ts b/src/commands/generated/alert.ts index 4816281..14f85cf 100644 --- a/src/commands/generated/alert.ts +++ b/src/commands/generated/alert.ts @@ -47,13 +47,14 @@ export function registerAlert(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs alert create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_an_alert", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "alert create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_an_alert", opIdV1: "", method: "POST", uri: "/alerts", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "alert create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).alert.create(params); @@ -69,15 +70,16 @@ export function registerAlert(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs alert delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_an_alert", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "alert delete"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_an_alert", opIdV1: "", method: "POST", uri: "/alerts/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "alert-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'alert-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "alert delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).alert.delete(resource.id, params); @@ -139,15 +141,16 @@ export function registerAlert(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs alert update\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_an_alert", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "alert update"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_an_alert", opIdV1: "", method: "POST", uri: "/alerts/{id}", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "alert-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'alert-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "alert update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).alert.update(resource.id, params); diff --git a/src/commands/generated/attached_item.ts b/src/commands/generated/attached_item.ts index f31b019..113805f 100644 --- a/src/commands/generated/attached_item.ts +++ b/src/commands/generated/attached_item.ts @@ -25,15 +25,16 @@ export function registerAttachedItem(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs attached-item create\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_an_attached_item", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "attached-item create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_an_attached_item", opIdV1: "", method: "POST", uri: "/items/{id}/attached_items", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "item-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'item-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "attached-item create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).attachedItem.create(resource.id, params); @@ -49,15 +50,16 @@ export function registerAttachedItem(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs attached-item delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_an_attached_item", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "attached-item delete"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_an_attached_item", opIdV1: "", method: "POST", uri: "/attached_items/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "attached-item-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'attached-item-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "attached-item delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).attachedItem.delete(resource.id, params); @@ -122,15 +124,16 @@ export function registerAttachedItem(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs attached-item update\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_an_attached_item", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "attached-item update"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_an_attached_item", opIdV1: "", method: "POST", uri: "/attached_items/{id}", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "attached-item-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'attached-item-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "attached-item update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).attachedItem.update(resource.id, params); diff --git a/src/commands/generated/business_entity.ts b/src/commands/generated/business_entity.ts index a3789bb..349683a 100644 --- a/src/commands/generated/business_entity.ts +++ b/src/commands/generated/business_entity.ts @@ -23,13 +23,14 @@ export function registerBusinessEntity(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs business-entity create-transfers\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "transfer_resources_to_another_business_entity", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "business-entity create-transfers"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "transfer_resources_to_another_business_entity", opIdV1: "", method: "POST", uri: "/business_entities/transfers", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "business-entity create-transfers", opts.yes === true); try { const client = await getClient(); const result = await (client as any).businessEntity.createTransfers(params); diff --git a/src/commands/generated/business_rule.ts b/src/commands/generated/business_rule.ts index 23e7432..ad61830 100644 --- a/src/commands/generated/business_rule.ts +++ b/src/commands/generated/business_rule.ts @@ -25,15 +25,16 @@ export function registerBusinessRule(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs business-rule activate-rule\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "activate_a_business_rule", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "business-rule activate-rule"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "activate_a_business_rule", opIdV1: "", method: "POST", uri: "/business_rules/{id}/activate", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "business-rule-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'business-rule-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "business-rule activate-rule", opts.yes === true); try { const client = await getClient(); const result = await (client as any).businessRule.activateRule(resource.id, params); @@ -48,13 +49,14 @@ export function registerBusinessRule(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs business-rule apply-rules\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "apply_business_rules", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "business-rule apply-rules"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "apply_business_rules", opIdV1: "", method: "POST", uri: "/business_rules/apply_rules", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "business-rule apply-rules", opts.yes === true); try { const client = await getClient(); const result = await (client as any).businessRule.applyRules(params); @@ -69,13 +71,14 @@ export function registerBusinessRule(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs business-rule create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_business_rule", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "business-rule create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_business_rule", opIdV1: "", method: "POST", uri: "/business_rules", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "business-rule create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).businessRule.create(params); @@ -91,15 +94,16 @@ export function registerBusinessRule(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs business-rule deactivate-rule\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "deactivate_a_business_rule", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "business-rule deactivate-rule"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "deactivate_a_business_rule", opIdV1: "", method: "POST", uri: "/business_rules/{id}/deactivate", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "business-rule-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'business-rule-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "business-rule deactivate-rule", opts.yes === true); try { const client = await getClient(); const result = await (client as any).businessRule.deactivateRule(resource.id, params); @@ -115,15 +119,16 @@ export function registerBusinessRule(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs business-rule delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_a_business_rule", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "business-rule delete"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_a_business_rule", opIdV1: "", method: "POST", uri: "/business_rules/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "business-rule-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'business-rule-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "business-rule delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).businessRule.delete(resource.id, params); @@ -139,15 +144,16 @@ export function registerBusinessRule(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs business-rule delete-draft\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_a_business_rule_draft", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "business-rule delete-draft"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_a_business_rule_draft", opIdV1: "", method: "POST", uri: "/business_rules/{id}/delete_draft", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "business-rule-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'business-rule-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "business-rule delete-draft", opts.yes === true); try { const client = await getClient(); const result = await (client as any).businessRule.deleteDraft(resource.id, params); @@ -186,15 +192,16 @@ export function registerBusinessRule(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs business-rule release-rule\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "release_a_business_rule", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "business-rule release-rule"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "release_a_business_rule", opIdV1: "", method: "POST", uri: "/business_rules/{id}/release", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "business-rule-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'business-rule-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "business-rule release-rule", opts.yes === true); try { const client = await getClient(); const result = await (client as any).businessRule.releaseRule(resource.id, params); @@ -256,15 +263,16 @@ export function registerBusinessRule(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs business-rule update-draft\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_a_business_rule_draft", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "business-rule update-draft"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_a_business_rule_draft", opIdV1: "", method: "POST", uri: "/business_rules/{id}/draft", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "business-rule-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'business-rule-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "business-rule update-draft", opts.yes === true); try { const client = await getClient(); const result = await (client as any).businessRule.updateDraft(resource.id, params); diff --git a/src/commands/generated/business_ruleset.ts b/src/commands/generated/business_ruleset.ts index 8a2c202..79c1ee3 100644 --- a/src/commands/generated/business_ruleset.ts +++ b/src/commands/generated/business_ruleset.ts @@ -25,15 +25,16 @@ export function registerBusinessRuleset(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs business-ruleset activate\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "activate_a_business_ruleset", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "business-ruleset activate"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "activate_a_business_ruleset", opIdV1: "", method: "POST", uri: "/business_rulesets/{id}/activate", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "business-ruleset-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'business-ruleset-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "business-ruleset activate", opts.yes === true); try { const client = await getClient(); const result = await (client as any).businessRuleset.activate(resource.id, params); @@ -49,15 +50,16 @@ export function registerBusinessRuleset(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs business-ruleset add-rules\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "add_business_rules_to_a_ruleset", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "business-ruleset add-rules"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "add_business_rules_to_a_ruleset", opIdV1: "", method: "POST", uri: "/business_rulesets/{id}/add_rules", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "business-ruleset-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'business-ruleset-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "business-ruleset add-rules", opts.yes === true); try { const client = await getClient(); const result = await (client as any).businessRuleset.addRules(resource.id, params); @@ -72,13 +74,14 @@ export function registerBusinessRuleset(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs business-ruleset create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_business_ruleset", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "business-ruleset create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_business_ruleset", opIdV1: "", method: "POST", uri: "/business_rulesets", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "business-ruleset create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).businessRuleset.create(params); @@ -94,15 +97,16 @@ export function registerBusinessRuleset(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs business-ruleset deactivate\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "deactivate_a_business_ruleset", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "business-ruleset deactivate"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "deactivate_a_business_ruleset", opIdV1: "", method: "POST", uri: "/business_rulesets/{id}/deactivate", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "business-ruleset-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'business-ruleset-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "business-ruleset deactivate", opts.yes === true); try { const client = await getClient(); const result = await (client as any).businessRuleset.deactivate(resource.id, params); @@ -118,15 +122,16 @@ export function registerBusinessRuleset(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs business-ruleset delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_a_business_ruleset", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "business-ruleset delete"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_a_business_ruleset", opIdV1: "", method: "POST", uri: "/business_rulesets/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "business-ruleset-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'business-ruleset-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "business-ruleset delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).businessRuleset.delete(resource.id, params); @@ -188,15 +193,16 @@ export function registerBusinessRuleset(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs business-ruleset remove-rules\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "remove_business_rules_from_a_ruleset", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "business-ruleset remove-rules"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "remove_business_rules_from_a_ruleset", opIdV1: "", method: "POST", uri: "/business_rulesets/{id}/remove_rules", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "business-ruleset-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'business-ruleset-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "business-ruleset remove-rules", opts.yes === true); try { const client = await getClient(); const result = await (client as any).businessRuleset.removeRules(resource.id, params); @@ -235,15 +241,16 @@ export function registerBusinessRuleset(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs business-ruleset update\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_a_business_ruleset", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "business-ruleset update"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_a_business_ruleset", opIdV1: "", method: "POST", uri: "/business_rulesets/{id}", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "business-ruleset-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'business-ruleset-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "business-ruleset update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).businessRuleset.update(resource.id, params); diff --git a/src/commands/generated/card.ts b/src/commands/generated/card.ts index 1736ac6..0da6e9a 100644 --- a/src/commands/generated/card.ts +++ b/src/commands/generated/card.ts @@ -23,14 +23,15 @@ export function registerCard(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs card copy-card-for-customer\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "copy_card", opIdV1: "copy_card", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "copy_card", opIdV1: "copy_card", method: "POST", uri: "/customers/{id}/copy_card", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "card copy-card-for-customer", opts.yes === true); try { const client = await getClient(); const result = await (client as any).card.copyCardForCustomer(resource.id, params); @@ -46,14 +47,15 @@ export function registerCard(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs card delete-card-for-customer\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_card_for_a_customer", opIdV1: "delete_card_for_a_customer", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_card_for_a_customer", opIdV1: "delete_card_for_a_customer", method: "POST", uri: "/customers/{id}/delete_card", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "card delete-card-for-customer", opts.yes === true); try { const client = await getClient(); const result = await (client as any).card.deleteCardForCustomer(resource.id, params); @@ -91,14 +93,15 @@ export function registerCard(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs card switch-gateway-for-customer\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "switch_gateway", opIdV1: "switch_gateway", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "switch_gateway", opIdV1: "switch_gateway", method: "POST", uri: "/customers/{id}/switch_gateway", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "card switch-gateway-for-customer", opts.yes === true); try { const client = await getClient(); const result = await (client as any).card.switchGatewayForCustomer(resource.id, params); @@ -114,14 +117,15 @@ export function registerCard(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs card update-card-for-customer\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_card_for_a_customer", opIdV1: "update_card_for_a_customer", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_card_for_a_customer", opIdV1: "update_card_for_a_customer", method: "POST", uri: "/customers/{id}/credit_card", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "card update-card-for-customer", opts.yes === true); try { const client = await getClient(); const result = await (client as any).card.updateCardForCustomer(resource.id, params); diff --git a/src/commands/generated/comment.ts b/src/commands/generated/comment.ts index 6452d62..222cb84 100644 --- a/src/commands/generated/comment.ts +++ b/src/commands/generated/comment.ts @@ -23,12 +23,13 @@ export function registerComment(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs comment create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_comment", opIdV1: "create_a_comment", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_comment", opIdV1: "create_a_comment", method: "POST", uri: "/comments", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "comment create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).comment.create(params); @@ -44,14 +45,15 @@ export function registerComment(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs comment delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_a_comment", opIdV1: "delete_a_comment", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_a_comment", opIdV1: "delete_a_comment", method: "POST", uri: "/comments/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "comment-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'comment-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "comment delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).comment.delete(resource.id, params); diff --git a/src/commands/generated/coupon.ts b/src/commands/generated/coupon.ts index aac1d70..ccd49a2 100644 --- a/src/commands/generated/coupon.ts +++ b/src/commands/generated/coupon.ts @@ -23,12 +23,13 @@ export function registerCoupon(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs coupon copy\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "copy_a_coupon", opIdV1: "copy_a_coupon", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "copy_a_coupon", opIdV1: "copy_a_coupon", method: "POST", uri: "/coupons/copy", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "coupon copy", opts.yes === true); try { const client = await getClient(); const result = await (client as any).coupon.copy(params); @@ -43,13 +44,14 @@ export function registerCoupon(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs coupon create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "create_a_coupon", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "coupon create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "create_a_coupon", method: "POST", uri: "/coupons", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "coupon create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).coupon.create(params); @@ -64,13 +66,14 @@ export function registerCoupon(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs coupon create-for-items\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_coupon_for_items", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "coupon create-for-items"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_coupon_for_items", opIdV1: "", method: "POST", uri: "/coupons/create_for_items", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "coupon create-for-items", opts.yes === true); try { const client = await getClient(); const result = await (client as any).coupon.createForItems(params); @@ -86,14 +89,15 @@ export function registerCoupon(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs coupon delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_a_coupon", opIdV1: "delete_a_coupon", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_a_coupon", opIdV1: "delete_a_coupon", method: "POST", uri: "/coupons/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "coupon-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'coupon-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "coupon delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).coupon.delete(resource.id, params); @@ -153,14 +157,15 @@ export function registerCoupon(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs coupon unarchive\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "unarchive_a_coupon", opIdV1: "unarchive_a_coupon", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "unarchive_a_coupon", opIdV1: "unarchive_a_coupon", method: "POST", uri: "/coupons/{id}/unarchive", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "coupon-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'coupon-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "coupon unarchive", opts.yes === true); try { const client = await getClient(); const result = await (client as any).coupon.unarchive(resource.id, params); @@ -176,15 +181,16 @@ export function registerCoupon(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs coupon update\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "update_a_coupon", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "coupon update"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "update_a_coupon", method: "POST", uri: "/coupons/{id}", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "coupon-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'coupon-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "coupon update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).coupon.update(resource.id, params); @@ -200,15 +206,16 @@ export function registerCoupon(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs coupon update-for-items\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_a_coupon_for_items", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "coupon update-for-items"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_a_coupon_for_items", opIdV1: "", method: "POST", uri: "/coupons/{id}/update_for_items", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "coupon-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'coupon-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "coupon update-for-items", opts.yes === true); try { const client = await getClient(); const result = await (client as any).coupon.updateForItems(resource.id, params); diff --git a/src/commands/generated/coupon_code.ts b/src/commands/generated/coupon_code.ts index 0a63d0e..09ef4e5 100644 --- a/src/commands/generated/coupon_code.ts +++ b/src/commands/generated/coupon_code.ts @@ -25,14 +25,15 @@ export function registerCouponCode(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs coupon-code archive\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "archive_a_coupon_code", opIdV1: "archive_a_coupon_code", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "archive_a_coupon_code", opIdV1: "archive_a_coupon_code", method: "POST", uri: "/coupon_codes/{id}/archive", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "coupon-code-code", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'coupon-code-code'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "coupon-code archive", opts.yes === true); try { const client = await getClient(); const result = await (client as any).couponCode.archive(resource.id, params); @@ -47,12 +48,13 @@ export function registerCouponCode(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs coupon-code create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "", method: "POST", uri: "/coupon_codes", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "coupon-code create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).couponCode.create(params); diff --git a/src/commands/generated/coupon_set.ts b/src/commands/generated/coupon_set.ts index 1676836..4474fdc 100644 --- a/src/commands/generated/coupon_set.ts +++ b/src/commands/generated/coupon_set.ts @@ -25,14 +25,15 @@ export function registerCouponSet(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs coupon-set add-coupon-codes\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "add_coupon_codes_to_coupon_set", opIdV1: "add_coupon_codes_to_coupon_set", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "add_coupon_codes_to_coupon_set", opIdV1: "add_coupon_codes_to_coupon_set", method: "POST", uri: "/coupon_sets/{id}/add_coupon_codes", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "coupon-set-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'coupon-set-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "coupon-set add-coupon-codes", opts.yes === true); try { const client = await getClient(); const result = await (client as any).couponSet.addCouponCodes(resource.id, params); @@ -47,12 +48,13 @@ export function registerCouponSet(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs coupon-set create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_coupon_set", opIdV1: "create_a_coupon_set", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_coupon_set", opIdV1: "create_a_coupon_set", method: "POST", uri: "/coupon_sets", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "coupon-set create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).couponSet.create(params); @@ -68,14 +70,15 @@ export function registerCouponSet(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs coupon-set delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_a_coupon_set", opIdV1: "delete_a_coupon_set", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_a_coupon_set", opIdV1: "delete_a_coupon_set", method: "POST", uri: "/coupon_sets/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "coupon-set-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'coupon-set-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "coupon-set delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).couponSet.delete(resource.id, params); @@ -91,14 +94,15 @@ export function registerCouponSet(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs coupon-set delete-unused-coupon-codes\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_unused_coupon_codes", opIdV1: "delete_unused_coupon_codes", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_unused_coupon_codes", opIdV1: "delete_unused_coupon_codes", method: "POST", uri: "/coupon_sets/{id}/delete_unused_coupon_codes", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "coupon-set-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'coupon-set-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "coupon-set delete-unused-coupon-codes", opts.yes === true); try { const client = await getClient(); const result = await (client as any).couponSet.deleteUnusedCouponCodes(resource.id, params); @@ -158,14 +162,15 @@ export function registerCouponSet(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs coupon-set update\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_a_coupon_set", opIdV1: "update_a_coupon_set", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_a_coupon_set", opIdV1: "update_a_coupon_set", method: "POST", uri: "/coupon_sets/{id}/update", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "coupon-set-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'coupon-set-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "coupon-set update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).couponSet.update(resource.id, params); diff --git a/src/commands/generated/credit_note.ts b/src/commands/generated/credit_note.ts index 0d005e9..a30a09d 100644 --- a/src/commands/generated/credit_note.ts +++ b/src/commands/generated/credit_note.ts @@ -24,12 +24,13 @@ export function registerCreditNote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs credit-note create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_credit_note", opIdV1: "create_credit_note", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_credit_note", opIdV1: "create_credit_note", method: "POST", uri: "/credit_notes", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "credit-note create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).creditNote.create(params); @@ -67,14 +68,15 @@ export function registerCreditNote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs credit-note delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_a_credit_note", opIdV1: "delete_a_credit_note", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_a_credit_note", opIdV1: "delete_a_credit_note", method: "POST", uri: "/credit_notes/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "credit-note-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'credit-note-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "credit-note delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).creditNote.delete(resource.id, params); @@ -111,12 +113,13 @@ export function registerCreditNote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs credit-note import-credit-note\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "import_credit_note", opIdV1: "import_credit_note", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "import_credit_note", opIdV1: "import_credit_note", method: "POST", uri: "/credit_notes/import_credit_note", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "credit-note import-credit-note", opts.yes === true); try { const client = await getClient(); const result = await (client as any).creditNote.importCreditNote(params); @@ -154,14 +157,15 @@ export function registerCreditNote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs credit-note pdf\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "retrieve_credit_note_as_pdf", opIdV1: "retrieve_credit_note_as_pdf", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "retrieve_credit_note_as_pdf", opIdV1: "retrieve_credit_note_as_pdf", method: "POST", uri: "/credit_notes/{id}/pdf", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "credit-note-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'credit-note-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "credit-note pdf", opts.yes === true); try { const client = await getClient(); const result = await (client as any).creditNote.pdf(resource.id, params); @@ -177,14 +181,15 @@ export function registerCreditNote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs credit-note record-refund\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "record_refund_for_a_credit_note", opIdV1: "record_refund_for_a_credit_note", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "record_refund_for_a_credit_note", opIdV1: "record_refund_for_a_credit_note", method: "POST", uri: "/credit_notes/{id}/record_refund", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "credit-note-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'credit-note-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "credit-note record-refund", opts.yes === true); try { const client = await getClient(); const result = await (client as any).creditNote.recordRefund(resource.id, params); @@ -200,14 +205,15 @@ export function registerCreditNote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs credit-note refund\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "refund_a_credit_note", opIdV1: "refund_a_credit_note", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "refund_a_credit_note", opIdV1: "refund_a_credit_note", method: "POST", uri: "/credit_notes/{id}/refund", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "credit-note-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'credit-note-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "credit-note refund", opts.yes === true); try { const client = await getClient(); const result = await (client as any).creditNote.refund(resource.id, params); @@ -223,14 +229,15 @@ export function registerCreditNote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs credit-note remove-tax-withheld-refund\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "remove_tax_withheld_refunds_from_a_credit_note", opIdV1: "remove_tax_withheld_refunds_from_a_credit_note", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "remove_tax_withheld_refunds_from_a_credit_note", opIdV1: "remove_tax_withheld_refunds_from_a_credit_note", method: "POST", uri: "/credit_notes/{id}/remove_tax_withheld_refund", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "credit-note-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'credit-note-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "credit-note remove-tax-withheld-refund", opts.yes === true); try { const client = await getClient(); const result = await (client as any).creditNote.removeTaxWithheldRefund(resource.id, params); @@ -246,14 +253,15 @@ export function registerCreditNote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs credit-note resend-einvoice\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "resend_failed_einvoice_in_credit_notes", opIdV1: "resend_failed_einvoice_in_credit_notes", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "resend_failed_einvoice_in_credit_notes", opIdV1: "resend_failed_einvoice_in_credit_notes", method: "POST", uri: "/credit_notes/{id}/resend_einvoice", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "credit-note-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'credit-note-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "credit-note resend-einvoice", opts.yes === true); try { const client = await getClient(); const result = await (client as any).creditNote.resendEinvoice(resource.id, params); @@ -291,14 +299,15 @@ export function registerCreditNote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs credit-note send-einvoice\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "send_an_einvoice_for_credit_notes", opIdV1: "send_an_einvoice_for_credit_notes", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "send_an_einvoice_for_credit_notes", opIdV1: "send_an_einvoice_for_credit_notes", method: "POST", uri: "/credit_notes/{id}/send_einvoice", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "credit-note-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'credit-note-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "credit-note send-einvoice", opts.yes === true); try { const client = await getClient(); const result = await (client as any).creditNote.sendEinvoice(resource.id, params); @@ -314,14 +323,15 @@ export function registerCreditNote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs credit-note send-email\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "send_credit_note_email", opIdV1: "send_credit_note_email", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "send_credit_note_email", opIdV1: "send_credit_note_email", method: "POST", uri: "/credit_notes/{id}/send_email", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "credit-note-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'credit-note-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "credit-note send-email", opts.yes === true); try { const client = await getClient(); const result = await (client as any).creditNote.sendEmail(resource.id, params); @@ -337,14 +347,15 @@ export function registerCreditNote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs credit-note update\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_credit_note_details", opIdV1: "update_credit_note_details", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_credit_note_details", opIdV1: "update_credit_note_details", method: "POST", uri: "/credit_notes/{id}/update", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "credit-note-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'credit-note-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "credit-note update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).creditNote.update(resource.id, params); @@ -360,14 +371,15 @@ export function registerCreditNote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs credit-note void-credit-note\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "void_a_credit_note", opIdV1: "void_a_credit_note", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "void_a_credit_note", opIdV1: "void_a_credit_note", method: "POST", uri: "/credit_notes/{id}/void", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "credit-note-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'credit-note-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "credit-note void-credit-note", opts.yes === true); try { const client = await getClient(); const result = await (client as any).creditNote.voidCreditNote(resource.id, params); diff --git a/src/commands/generated/credit_unit.ts b/src/commands/generated/credit_unit.ts index bb437b2..7c54a10 100644 --- a/src/commands/generated/credit_unit.ts +++ b/src/commands/generated/credit_unit.ts @@ -25,15 +25,16 @@ export function registerCreditUnit(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs credit-unit archive\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "archive_a_credit_unit", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "credit-unit archive"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "archive_a_credit_unit", opIdV1: "", method: "POST", uri: "/credit_units/{id}/archive_command", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "credit-unit-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'credit-unit-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "credit-unit archive", opts.yes === true); try { const client = await getClient(); const result = await (client as any).creditUnit.archive(resource.id, params); @@ -48,13 +49,14 @@ export function registerCreditUnit(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs credit-unit create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_credit_unit", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "credit-unit create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_credit_unit", opIdV1: "", method: "POST", uri: "/credit_units", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "credit-unit create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).creditUnit.create(params); @@ -93,15 +95,16 @@ export function registerCreditUnit(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs credit-unit reactivate\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "reactivate_a_credit_unit", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "credit-unit reactivate"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "reactivate_a_credit_unit", opIdV1: "", method: "POST", uri: "/credit_units/{id}/reactivate_command", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "credit-unit-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'credit-unit-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "credit-unit reactivate", opts.yes === true); try { const client = await getClient(); const result = await (client as any).creditUnit.reactivate(resource.id, params); @@ -117,15 +120,16 @@ export function registerCreditUnit(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs credit-unit update\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_a_credit_unit", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "credit-unit update"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_a_credit_unit", opIdV1: "", method: "POST", uri: "/credit_units/{id}", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "credit-unit-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'credit-unit-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "credit-unit update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).creditUnit.update(resource.id, params); diff --git a/src/commands/generated/currency.ts b/src/commands/generated/currency.ts index e7b8676..eba52e6 100644 --- a/src/commands/generated/currency.ts +++ b/src/commands/generated/currency.ts @@ -24,14 +24,15 @@ export function registerCurrency(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs currency add-schedule\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "add_schedule", opIdV1: "add_schedule", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "add_schedule", opIdV1: "add_schedule", method: "POST", uri: "/currencies/{id}/add_schedule", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "site-currency-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'site-currency-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "currency add-schedule", opts.yes === true); try { const client = await getClient(); const result = await (client as any).currency.addSchedule(resource.id, params); @@ -46,12 +47,13 @@ export function registerCurrency(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs currency create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "add_a_new_currency", opIdV1: "add_a_new_currency", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "add_a_new_currency", opIdV1: "add_a_new_currency", method: "POST", uri: "/currencies", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "currency create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).currency.create(params); @@ -89,14 +91,15 @@ export function registerCurrency(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs currency remove-schedule\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "remove_schedule", opIdV1: "remove_schedule", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "remove_schedule", opIdV1: "remove_schedule", method: "POST", uri: "/currencies/{id}/remove_schedule", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "site-currency-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'site-currency-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "currency remove-schedule", opts.yes === true); try { const client = await getClient(); const result = await (client as any).currency.removeSchedule(resource.id, params); @@ -134,14 +137,15 @@ export function registerCurrency(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs currency update\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_a_currency", opIdV1: "update_a_currency", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_a_currency", opIdV1: "update_a_currency", method: "POST", uri: "/currencies/{id}", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "site-currency-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'site-currency-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "currency update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).currency.update(resource.id, params); diff --git a/src/commands/generated/customer.ts b/src/commands/generated/customer.ts index 0bc7c67..005b8f2 100644 --- a/src/commands/generated/customer.ts +++ b/src/commands/generated/customer.ts @@ -24,14 +24,15 @@ export function registerCustomer(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs customer add-contact\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "add_contacts_to_a_customer", opIdV1: "add_contacts_to_a_customer", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "add_contacts_to_a_customer", opIdV1: "add_contacts_to_a_customer", method: "POST", uri: "/customers/{id}/add_contact", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "customer add-contact", opts.yes === true); try { const client = await getClient(); const result = await (client as any).customer.addContact(resource.id, params); @@ -47,14 +48,15 @@ export function registerCustomer(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs customer add-promotional-credits\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "", method: "POST", uri: "/customers/{id}/add_promotional_credits", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: undefined, pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "customer add-promotional-credits", opts.yes === true); try { const client = await getClient(); const result = await (client as any).customer.addPromotionalCredits(resource.id, params); @@ -70,14 +72,15 @@ export function registerCustomer(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs customer assign-payment-role\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "assign_payment_role", opIdV1: "assign_payment_role", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "assign_payment_role", opIdV1: "assign_payment_role", method: "POST", uri: "/customers/{id}/assign_payment_role", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "customer assign-payment-role", opts.yes === true); try { const client = await getClient(); const result = await (client as any).customer.assignPaymentRole(resource.id, params); @@ -93,14 +96,15 @@ export function registerCustomer(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs customer change-billing-date\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "change_billing_date", opIdV1: "change_billing_date", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "change_billing_date", opIdV1: "change_billing_date", method: "POST", uri: "/customers/{id}/change_billing_date", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "customer change-billing-date", opts.yes === true); try { const client = await getClient(); const result = await (client as any).customer.changeBillingDate(resource.id, params); @@ -116,14 +120,15 @@ export function registerCustomer(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs customer clear-personal-data\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "clear_personal_data_of_a_customer", opIdV1: "clear_personal_data_of_a_customer", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "clear_personal_data_of_a_customer", opIdV1: "clear_personal_data_of_a_customer", method: "POST", uri: "/customers/{id}/clear_personal_data", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "customer clear-personal-data", opts.yes === true); try { const client = await getClient(); const result = await (client as any).customer.clearPersonalData(resource.id, params); @@ -139,14 +144,15 @@ export function registerCustomer(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs customer collect-payment\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "collect_payment_for_customer", opIdV1: "collect_payment_for_customer", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "collect_payment_for_customer", opIdV1: "collect_payment_for_customer", method: "POST", uri: "/customers/{id}/collect_payment", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "customer collect-payment", opts.yes === true); try { const client = await getClient(); const result = await (client as any).customer.collectPayment(resource.id, params); @@ -183,12 +189,13 @@ export function registerCustomer(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs customer create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_customer", opIdV1: "create_a_customer", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_customer", opIdV1: "create_a_customer", method: "POST", uri: "/customers", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "customer create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).customer.create(params); @@ -204,14 +211,15 @@ export function registerCustomer(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs customer deduct-promotional-credits\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "", method: "POST", uri: "/customers/{id}/deduct_promotional_credits", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: undefined, pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "customer deduct-promotional-credits", opts.yes === true); try { const client = await getClient(); const result = await (client as any).customer.deductPromotionalCredits(resource.id, params); @@ -227,14 +235,15 @@ export function registerCustomer(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs customer delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_a_customer", opIdV1: "delete_a_customer", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_a_customer", opIdV1: "delete_a_customer", method: "POST", uri: "/customers/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "customer delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).customer.delete(resource.id, params); @@ -250,14 +259,15 @@ export function registerCustomer(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs customer delete-contact\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_contacts_for_a_customer", opIdV1: "delete_contacts_for_a_customer", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_contacts_for_a_customer", opIdV1: "delete_contacts_for_a_customer", method: "POST", uri: "/customers/{id}/delete_contact", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "customer delete-contact", opts.yes === true); try { const client = await getClient(); const result = await (client as any).customer.deleteContact(resource.id, params); @@ -273,14 +283,15 @@ export function registerCustomer(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs customer delete-relationship\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delink_a_customer", opIdV1: "delink_a_customer", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delink_a_customer", opIdV1: "delink_a_customer", method: "POST", uri: "/customers/{id}/delete_relationship", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "customer delete-relationship", opts.yes === true); try { const client = await getClient(); const result = await (client as any).customer.deleteRelationship(resource.id, params); @@ -361,12 +372,13 @@ export function registerCustomer(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs customer merge\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "merge_customers", opIdV1: "merge_customers", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "merge_customers", opIdV1: "merge_customers", method: "POST", uri: "/customers/merge", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "customer merge", opts.yes === true); try { const client = await getClient(); const result = await (client as any).customer.merge(params); @@ -381,12 +393,13 @@ export function registerCustomer(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs customer move\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "move_a_customer", opIdV1: "move_a_customer", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "move_a_customer", opIdV1: "move_a_customer", method: "POST", uri: "/customers/move", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "customer move", opts.yes === true); try { const client = await getClient(); const result = await (client as any).customer.move(params); @@ -402,14 +415,15 @@ export function registerCustomer(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs customer record-excess-payment\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "record_an_excess_payment_for_a_customer", opIdV1: "record_an_excess_payment_for_a_customer", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "record_an_excess_payment_for_a_customer", opIdV1: "record_an_excess_payment_for_a_customer", method: "POST", uri: "/customers/{id}/record_excess_payment", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "customer record-excess-payment", opts.yes === true); try { const client = await getClient(); const result = await (client as any).customer.recordExcessPayment(resource.id, params); @@ -425,14 +439,15 @@ export function registerCustomer(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs customer relationships\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "link_a_customer", opIdV1: "link_a_customer", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "link_a_customer", opIdV1: "link_a_customer", method: "POST", uri: "/customers/{id}/relationships", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "customer relationships", opts.yes === true); try { const client = await getClient(); const result = await (client as any).customer.relationships(resource.id, params); @@ -470,14 +485,15 @@ export function registerCustomer(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs customer send-payment-request\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "send_payment_request_email", opIdV1: "send_payment_request_email", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "send_payment_request_email", opIdV1: "send_payment_request_email", method: "POST", uri: "/customers/{id}/send_payment_request", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "customer send-payment-request", opts.yes === true); try { const client = await getClient(); const result = await (client as any).customer.sendPaymentRequest(resource.id, params); @@ -493,14 +509,15 @@ export function registerCustomer(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs customer set-promotional-credits\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "", method: "POST", uri: "/customers/{id}/set_promotional_credits", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: undefined, pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "customer set-promotional-credits", opts.yes === true); try { const client = await getClient(); const result = await (client as any).customer.setPromotionalCredits(resource.id, params); @@ -516,14 +533,15 @@ export function registerCustomer(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs customer update\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_a_customer", opIdV1: "update_a_customer", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_a_customer", opIdV1: "update_a_customer", method: "POST", uri: "/customers/{id}", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "customer update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).customer.update(resource.id, params); @@ -539,14 +557,15 @@ export function registerCustomer(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs customer update-billing-info\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_billing_info_for_a_customer", opIdV1: "update_billing_info_for_a_customer", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_billing_info_for_a_customer", opIdV1: "update_billing_info_for_a_customer", method: "POST", uri: "/customers/{id}/update_billing_info", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "customer update-billing-info", opts.yes === true); try { const client = await getClient(); const result = await (client as any).customer.updateBillingInfo(resource.id, params); @@ -562,14 +581,15 @@ export function registerCustomer(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs customer update-contact\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_contacts_for_a_customer", opIdV1: "update_contacts_for_a_customer", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_contacts_for_a_customer", opIdV1: "update_contacts_for_a_customer", method: "POST", uri: "/customers/{id}/update_contact", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "customer update-contact", opts.yes === true); try { const client = await getClient(); const result = await (client as any).customer.updateContact(resource.id, params); @@ -585,14 +605,15 @@ export function registerCustomer(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs customer update-hierarchy-settings\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_hierarchy_access_settings_for_a_customer", opIdV1: "update_hierarchy_access_settings_for_a_customer", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_hierarchy_access_settings_for_a_customer", opIdV1: "update_hierarchy_access_settings_for_a_customer", method: "POST", uri: "/customers/{id}/update_hierarchy_settings", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "customer update-hierarchy-settings", opts.yes === true); try { const client = await getClient(); const result = await (client as any).customer.updateHierarchySettings(resource.id, params); @@ -608,14 +629,15 @@ export function registerCustomer(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs customer update-payment-method\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_payment_method_for_a_customer", opIdV1: "update_payment_method_for_a_customer", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_payment_method_for_a_customer", opIdV1: "update_payment_method_for_a_customer", method: "POST", uri: "/customers/{id}/update_payment_method", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "customer update-payment-method", opts.yes === true); try { const client = await getClient(); const result = await (client as any).customer.updatePaymentMethod(resource.id, params); diff --git a/src/commands/generated/differential_price.ts b/src/commands/generated/differential_price.ts index 0f4cac6..59fe680 100644 --- a/src/commands/generated/differential_price.ts +++ b/src/commands/generated/differential_price.ts @@ -25,15 +25,16 @@ export function registerDifferentialPrice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs differential-price create\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_differential_price", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "differential-price create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_differential_price", opIdV1: "", method: "POST", uri: "/item_prices/{id}/differential_prices", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "item-price-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'item-price-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "differential-price create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).differentialPrice.create(resource.id, params); @@ -49,15 +50,16 @@ export function registerDifferentialPrice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs differential-price delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_a_differential_price", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "differential-price delete"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_a_differential_price", opIdV1: "", method: "POST", uri: "/differential_prices/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "differential-price-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'differential-price-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "differential-price delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).differentialPrice.delete(resource.id, params); @@ -119,15 +121,16 @@ export function registerDifferentialPrice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs differential-price update\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_a_differential_price", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "differential-price update"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_a_differential_price", opIdV1: "", method: "POST", uri: "/differential_prices/{id}", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "differential-price-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'differential-price-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "differential-price update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).differentialPrice.update(resource.id, params); diff --git a/src/commands/generated/entitlement.ts b/src/commands/generated/entitlement.ts index d9d45c8..efa0032 100644 --- a/src/commands/generated/entitlement.ts +++ b/src/commands/generated/entitlement.ts @@ -23,13 +23,14 @@ export function registerEntitlement(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs entitlement create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "upsert_or_remove_entitlements_for_a_feature", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "entitlement create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "upsert_or_remove_entitlements_for_a_feature", opIdV1: "", method: "POST", uri: "/entitlements", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "entitlement create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).entitlement.create(params); diff --git a/src/commands/generated/entitlement_override.ts b/src/commands/generated/entitlement_override.ts index ae4dc64..c09f5a4 100644 --- a/src/commands/generated/entitlement_override.ts +++ b/src/commands/generated/entitlement_override.ts @@ -24,15 +24,16 @@ export function registerEntitlementOverride(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs entitlement-override add-entitlement-override-for-subscription\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "upsert_or_remove_entitlement_overrides_for_a_subscription", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "entitlement-override add-entitlement-override-for-subscription"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "upsert_or_remove_entitlement_overrides_for_a_subscription", opIdV1: "", method: "POST", uri: "/subscriptions/{id}/entitlement_overrides", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "entitlement-override add-entitlement-override-for-subscription", opts.yes === true); try { const client = await getClient(); const result = await (client as any).entitlementOverride.addEntitlementOverrideForSubscription(resource.id, params); diff --git a/src/commands/generated/feature.ts b/src/commands/generated/feature.ts index e18378d..23cf514 100644 --- a/src/commands/generated/feature.ts +++ b/src/commands/generated/feature.ts @@ -24,15 +24,16 @@ export function registerFeature(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs feature activate\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "activate_a_feature", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "feature activate"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "activate_a_feature", opIdV1: "", method: "POST", uri: "/features/{id}/activate_command", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "feature-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'feature-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "feature activate", opts.yes === true); try { const client = await getClient(); const result = await (client as any).feature.activate(resource.id, params); @@ -48,15 +49,16 @@ export function registerFeature(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs feature archive\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "archive_a_feature", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "feature archive"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "archive_a_feature", opIdV1: "", method: "POST", uri: "/features/{id}/archive_command", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "feature-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'feature-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "feature archive", opts.yes === true); try { const client = await getClient(); const result = await (client as any).feature.archive(resource.id, params); @@ -71,13 +73,14 @@ export function registerFeature(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs feature create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_feature", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "feature create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_feature", opIdV1: "", method: "POST", uri: "/features", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "feature create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).feature.create(params); @@ -93,15 +96,16 @@ export function registerFeature(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs feature delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_a_feature", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "feature delete"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_a_feature", opIdV1: "", method: "POST", uri: "/features/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "feature-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'feature-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "feature delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).feature.delete(resource.id, params); @@ -140,15 +144,16 @@ export function registerFeature(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs feature reactivate\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "reactivate_a_feature", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "feature reactivate"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "reactivate_a_feature", opIdV1: "", method: "POST", uri: "/features/{id}/reactivate_command", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "feature-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'feature-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "feature reactivate", opts.yes === true); try { const client = await getClient(); const result = await (client as any).feature.reactivate(resource.id, params); @@ -187,15 +192,16 @@ export function registerFeature(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs feature update\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_a_feature", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "feature update"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_a_feature", opIdV1: "", method: "POST", uri: "/features/{id}", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "feature-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'feature-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "feature update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).feature.update(resource.id, params); diff --git a/src/commands/generated/gift.ts b/src/commands/generated/gift.ts index adc4cc0..18765c3 100644 --- a/src/commands/generated/gift.ts +++ b/src/commands/generated/gift.ts @@ -24,14 +24,15 @@ export function registerGift(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs gift cancel\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "cancel_a_gift", opIdV1: "cancel_a_gift", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "cancel_a_gift", opIdV1: "cancel_a_gift", method: "POST", uri: "/gifts/{id}/cancel", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "gift-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'gift-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "gift cancel", opts.yes === true); try { const client = await getClient(); const result = await (client as any).gift.cancel(resource.id, params); @@ -47,14 +48,15 @@ export function registerGift(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs gift claim\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "claim_a_gift", opIdV1: "claim_a_gift", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "claim_a_gift", opIdV1: "claim_a_gift", method: "POST", uri: "/gifts/{id}/claim", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "gift-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'gift-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "gift claim", opts.yes === true); try { const client = await getClient(); const result = await (client as any).gift.claim(resource.id, params); @@ -69,13 +71,14 @@ export function registerGift(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs gift create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "create_a_gift", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "gift create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "create_a_gift", method: "POST", uri: "/gifts", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "gift create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).gift.create(params); @@ -90,13 +93,14 @@ export function registerGift(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs gift create-for-items\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_gift_subscription_for_items", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "gift create-for-items"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_gift_subscription_for_items", opIdV1: "", method: "POST", uri: "/gifts/create_for_items", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "gift create-for-items", opts.yes === true); try { const client = await getClient(); const result = await (client as any).gift.createForItems(params); @@ -156,14 +160,15 @@ export function registerGift(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs gift update-gift\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_a_gift", opIdV1: "update_a_gift", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_a_gift", opIdV1: "update_a_gift", method: "POST", uri: "/gifts/{id}/update_gift", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "gift-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'gift-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "gift update-gift", opts.yes === true); try { const client = await getClient(); const result = await (client as any).gift.updateGift(resource.id, params); diff --git a/src/commands/generated/hosted_page.ts b/src/commands/generated/hosted_page.ts index 03d2bfd..2c6c5d2 100644 --- a/src/commands/generated/hosted_page.ts +++ b/src/commands/generated/hosted_page.ts @@ -44,14 +44,15 @@ export function registerHostedPage(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs hosted-page acknowledge\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "acknowledge_a_hosted_page", opIdV1: "acknowledge_a_hosted_page", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "acknowledge_a_hosted_page", opIdV1: "acknowledge_a_hosted_page", method: "POST", uri: "/hosted_pages/{id}/acknowledge", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "hosted-page-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'hosted-page-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "hosted-page acknowledge", opts.yes === true); try { const client = await getClient(); const result = await (client as any).hostedPage.acknowledge(resource.id, params); @@ -264,12 +265,13 @@ export function registerHostedPage(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs hosted-page events\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "notify_an_event", opIdV1: "notify_an_event", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "notify_an_event", opIdV1: "notify_an_event", method: "POST", uri: "/hosted_pages/events", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "hosted-page events", opts.yes === true); try { const client = await getClient(); const result = await (client as any).hostedPage.events(params); diff --git a/src/commands/generated/in_app_subscription.ts b/src/commands/generated/in_app_subscription.ts index 9250305..d50d56d 100644 --- a/src/commands/generated/in_app_subscription.ts +++ b/src/commands/generated/in_app_subscription.ts @@ -22,14 +22,15 @@ export function registerInAppSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs in-app-subscription import-receipt\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "import_receipt", opIdV1: "import_receipt", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "import_receipt", opIdV1: "import_receipt", method: "POST", uri: "/in_app_subscriptions/{id}/import_receipt", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "in-app-subscription-app-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'in-app-subscription-app-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "in-app-subscription import-receipt", opts.yes === true); try { const client = await getClient(); const result = await (client as any).inAppSubscription.importReceipt(resource.id, params); @@ -45,14 +46,15 @@ export function registerInAppSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs in-app-subscription import-subscription\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "import_subscription_without_receipt", opIdV1: "import_subscription_without_receipt", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "import_subscription_without_receipt", opIdV1: "import_subscription_without_receipt", method: "POST", uri: "/in_app_subscriptions/{id}/import_subscription", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "in-app-subscription-app-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'in-app-subscription-app-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "in-app-subscription import-subscription", opts.yes === true); try { const client = await getClient(); const result = await (client as any).inAppSubscription.importSubscription(resource.id, params); @@ -68,14 +70,15 @@ export function registerInAppSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs in-app-subscription process-receipt\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "process_purchase_command", opIdV1: "process_purchase_command", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "process_purchase_command", opIdV1: "process_purchase_command", method: "POST", uri: "/in_app_subscriptions/{id}/process_purchase_command", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "in-app-subscription-app-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'in-app-subscription-app-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "in-app-subscription process-receipt", opts.yes === true); try { const client = await getClient(); const result = await (client as any).inAppSubscription.processReceipt(resource.id, params); diff --git a/src/commands/generated/invoice.ts b/src/commands/generated/invoice.ts index 1178f72..a1f5179 100644 --- a/src/commands/generated/invoice.ts +++ b/src/commands/generated/invoice.ts @@ -24,15 +24,16 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice add-addon-charge\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "add_non-recurring_addon_to_a_pending_invoice", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "invoice add-addon-charge"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "add_non-recurring_addon_to_a_pending_invoice", method: "POST", uri: "/invoices/{id}/add_addon_charge", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice add-addon-charge", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.addAddonCharge(resource.id, params); @@ -48,14 +49,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice add-charge\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "add_one-time_charge_to_a_pending_invoice", opIdV1: "add_one-time_charge_to_a_pending_invoice", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "add_one-time_charge_to_a_pending_invoice", opIdV1: "add_one-time_charge_to_a_pending_invoice", method: "POST", uri: "/invoices/{id}/add_charge", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice add-charge", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.addCharge(resource.id, params); @@ -71,15 +73,16 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice add-charge-item\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "add_a_charge-item_to_a_pending_invoice", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "invoice add-charge-item"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "add_a_charge-item_to_a_pending_invoice", opIdV1: "", method: "POST", uri: "/invoices/{id}/add_charge_item", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice add-charge-item", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.addChargeItem(resource.id, params); @@ -95,14 +98,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice apply-credits\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "apply_credits_for_an_invoice", opIdV1: "apply_credits_for_an_invoice", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "apply_credits_for_an_invoice", opIdV1: "apply_credits_for_an_invoice", method: "POST", uri: "/invoices/{id}/apply_credits", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice apply-credits", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.applyCredits(resource.id, params); @@ -118,14 +122,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice apply-payments\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "apply_payments_for_an_invoice", opIdV1: "apply_payments_for_an_invoice", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "apply_payments_for_an_invoice", opIdV1: "apply_payments_for_an_invoice", method: "POST", uri: "/invoices/{id}/apply_payments", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice apply-payments", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.applyPayments(resource.id, params); @@ -141,15 +146,16 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice apply-payment-schedule-scheme\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "apply_payment_schedule_scheme_to_an_invoice", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "invoice apply-payment-schedule-scheme"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "apply_payment_schedule_scheme_to_an_invoice", opIdV1: "", method: "POST", uri: "/invoices/{id}/apply_payment_schedule_scheme", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice apply-payment-schedule-scheme", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.applyPaymentScheduleScheme(resource.id, params); @@ -164,13 +170,14 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice charge\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "create_invoice_for_a_one-time_charge", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "invoice charge"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "create_invoice_for_a_one-time_charge", method: "POST", uri: "/invoices/charge", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice charge", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.charge(params); @@ -185,13 +192,14 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice charge-addon\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "create_invoice_for_a_non-recurring_addon", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "invoice charge-addon"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "create_invoice_for_a_non-recurring_addon", method: "POST", uri: "/invoices/charge_addon", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice charge-addon", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.chargeAddon(params); @@ -207,14 +215,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice close\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "close_a_pending_invoice", opIdV1: "close_a_pending_invoice", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "close_a_pending_invoice", opIdV1: "close_a_pending_invoice", method: "POST", uri: "/invoices/{id}/close", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice close", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.close(resource.id, params); @@ -230,14 +239,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice collect-payment\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "collect_payment_for_an_invoice", opIdV1: "collect_payment_for_an_invoice", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "collect_payment_for_an_invoice", opIdV1: "collect_payment_for_an_invoice", method: "POST", uri: "/invoices/{id}/collect_payment", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice collect-payment", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.collectPayment(resource.id, params); @@ -252,13 +262,14 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "create_an_invoice", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "invoice create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "create_an_invoice", method: "POST", uri: "/invoices", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.create(params); @@ -273,12 +284,13 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice create-for-charge-item\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "", method: "POST", uri: "/invoices/create_for_charge_item", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice create-for-charge-item", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.createForChargeItem(params); @@ -293,13 +305,14 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice create-for-charge-items-and-charges\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_invoice_for_items_and_one-time_charges", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "invoice create-for-charge-items-and-charges"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_invoice_for_items_and_one-time_charges", opIdV1: "", method: "POST", uri: "/invoices/create_for_charge_items_and_charges", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice create-for-charge-items-and-charges", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.createForChargeItemsAndCharges(params); @@ -315,14 +328,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_an_invoice", opIdV1: "delete_an_invoice", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_an_invoice", opIdV1: "delete_an_invoice", method: "POST", uri: "/invoices/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.delete(resource.id, params); @@ -338,14 +352,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice delete-line-items\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_line_items", opIdV1: "delete_line_items", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_line_items", opIdV1: "delete_line_items", method: "POST", uri: "/invoices/{id}/delete_line_items", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice delete-line-items", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.deleteLineItems(resource.id, params); @@ -382,12 +397,13 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice import-invoice\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "import_invoice", opIdV1: "import_invoice", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "import_invoice", opIdV1: "import_invoice", method: "POST", uri: "/invoices/import_invoice", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice import-invoice", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.importInvoice(params); @@ -488,14 +504,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice pause-dunning\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "pause_dunning_for_invoice", opIdV1: "pause_dunning_for_invoice", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "pause_dunning_for_invoice", opIdV1: "pause_dunning_for_invoice", method: "POST", uri: "/invoices/{id}/pause_dunning", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice pause-dunning", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.pauseDunning(resource.id, params); @@ -534,14 +551,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice pdf\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "retrieve_invoice_as_pdf", opIdV1: "retrieve_invoice_as_pdf", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "retrieve_invoice_as_pdf", opIdV1: "retrieve_invoice_as_pdf", method: "POST", uri: "/invoices/{id}/pdf", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice pdf", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.pdf(resource.id, params); @@ -557,14 +575,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice record-payment\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "record_an_invoice_payment", opIdV1: "record_an_invoice_payment", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "record_an_invoice_payment", opIdV1: "record_an_invoice_payment", method: "POST", uri: "/invoices/{id}/record_payment", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice record-payment", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.recordPayment(resource.id, params); @@ -580,14 +599,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice record-refund\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "record_refund_for_an_invoice", opIdV1: "record_refund_for_an_invoice", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "record_refund_for_an_invoice", opIdV1: "record_refund_for_an_invoice", method: "POST", uri: "/invoices/{id}/record_refund", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice record-refund", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.recordRefund(resource.id, params); @@ -603,14 +623,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice record-tax-withheld\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "record_tax_withheld_for_an_invoice", opIdV1: "record_tax_withheld_for_an_invoice", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "record_tax_withheld_for_an_invoice", opIdV1: "record_tax_withheld_for_an_invoice", method: "POST", uri: "/invoices/{id}/record_tax_withheld", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice record-tax-withheld", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.recordTaxWithheld(resource.id, params); @@ -626,14 +647,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice refund\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "refund_an_invoice", opIdV1: "refund_an_invoice", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "refund_an_invoice", opIdV1: "refund_an_invoice", method: "POST", uri: "/invoices/{id}/refund", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice refund", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.refund(resource.id, params); @@ -649,14 +671,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice remove-credit-note\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "remove_credit_note_from_an_invoice", opIdV1: "remove_credit_note_from_an_invoice", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "remove_credit_note_from_an_invoice", opIdV1: "remove_credit_note_from_an_invoice", method: "POST", uri: "/invoices/{id}/remove_credit_note", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice remove-credit-note", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.removeCreditNote(resource.id, params); @@ -672,14 +695,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice remove-payment\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "remove_payment_from_an_invoice", opIdV1: "remove_payment_from_an_invoice", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "remove_payment_from_an_invoice", opIdV1: "remove_payment_from_an_invoice", method: "POST", uri: "/invoices/{id}/remove_payment", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice remove-payment", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.removePayment(resource.id, params); @@ -695,14 +719,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice remove-tax-withheld\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "remove_tax_withheld_for_an_invoice", opIdV1: "remove_tax_withheld_for_an_invoice", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "remove_tax_withheld_for_an_invoice", opIdV1: "remove_tax_withheld_for_an_invoice", method: "POST", uri: "/invoices/{id}/remove_tax_withheld", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice remove-tax-withheld", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.removeTaxWithheld(resource.id, params); @@ -718,14 +743,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice resend-einvoice\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "resend_failed_einvoice_in_invoices", opIdV1: "resend_failed_einvoice_in_invoices", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "resend_failed_einvoice_in_invoices", opIdV1: "resend_failed_einvoice_in_invoices", method: "POST", uri: "/invoices/{id}/resend_einvoice", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice resend-einvoice", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.resendEinvoice(resource.id, params); @@ -741,14 +767,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice resume-dunning\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "resume_dunning_for_invoice", opIdV1: "resume_dunning_for_invoice", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "resume_dunning_for_invoice", opIdV1: "resume_dunning_for_invoice", method: "POST", uri: "/invoices/{id}/resume_dunning", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice resume-dunning", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.resumeDunning(resource.id, params); @@ -786,14 +813,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice send-einvoice\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "send_an_einvoice_for_invoices", opIdV1: "send_an_einvoice_for_invoices", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "send_an_einvoice_for_invoices", opIdV1: "send_an_einvoice_for_invoices", method: "POST", uri: "/invoices/{id}/send_einvoice", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice send-einvoice", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.sendEinvoice(resource.id, params); @@ -809,14 +837,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice send-email\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "send_invoice_email", opIdV1: "send_invoice_email", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "send_invoice_email", opIdV1: "send_invoice_email", method: "POST", uri: "/invoices/{id}/send_email", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice send-email", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.sendEmail(resource.id, params); @@ -832,14 +861,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice stop-dunning\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "stop_dunning_for_invoice", opIdV1: "stop_dunning_for_invoice", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "stop_dunning_for_invoice", opIdV1: "stop_dunning_for_invoice", method: "POST", uri: "/invoices/{id}/stop_dunning", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice stop-dunning", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.stopDunning(resource.id, params); @@ -855,14 +885,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice sync-usages\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "sync_usages", opIdV1: "sync_usages", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "sync_usages", opIdV1: "sync_usages", method: "POST", uri: "/invoices/{id}/sync_usages", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice sync-usages", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.syncUsages(resource.id, params); @@ -878,14 +909,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice update-details\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_invoice_details", opIdV1: "update_invoice_details", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_invoice_details", opIdV1: "update_invoice_details", method: "POST", uri: "/invoices/{id}/update_details", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice update-details", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.updateDetails(resource.id, params); @@ -901,14 +933,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice void-before-capture\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "void_authorizations_before_capture", opIdV1: "void_authorizations_before_capture", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "void_authorizations_before_capture", opIdV1: "void_authorizations_before_capture", method: "POST", uri: "/invoices/{id}/void_before_capture", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice void-before-capture", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.voidBeforeCapture(resource.id, params); @@ -924,14 +957,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice void-invoice\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "void_an_invoice", opIdV1: "void_an_invoice", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "void_an_invoice", opIdV1: "void_an_invoice", method: "POST", uri: "/invoices/{id}/void", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice void-invoice", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.voidInvoice(resource.id, params); @@ -947,14 +981,15 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice write-off\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "write_off_an_invoice", opIdV1: "write_off_an_invoice", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "write_off_an_invoice", opIdV1: "write_off_an_invoice", method: "POST", uri: "/invoices/{id}/write_off", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "invoice write-off", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.writeOff(resource.id, params); diff --git a/src/commands/generated/item.ts b/src/commands/generated/item.ts index f3d87d7..0c28115 100644 --- a/src/commands/generated/item.ts +++ b/src/commands/generated/item.ts @@ -23,13 +23,14 @@ export function registerItem(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs item create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_an_item", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "item create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_an_item", opIdV1: "", method: "POST", uri: "/items", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "item create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).item.create(params); @@ -45,15 +46,16 @@ export function registerItem(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs item delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_an_item", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "item delete"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_an_item", opIdV1: "", method: "POST", uri: "/items/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "item-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'item-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "item delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).item.delete(resource.id, params); @@ -115,15 +117,16 @@ export function registerItem(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs item update\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_an_item", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "item update"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_an_item", opIdV1: "", method: "POST", uri: "/items/{id}", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "item-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'item-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "item update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).item.update(resource.id, params); diff --git a/src/commands/generated/item_entitlement.ts b/src/commands/generated/item_entitlement.ts index 6cb7e87..5186700 100644 --- a/src/commands/generated/item_entitlement.ts +++ b/src/commands/generated/item_entitlement.ts @@ -24,15 +24,16 @@ export function registerItemEntitlement(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs item-entitlement add-item-entitlements\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "upsert_or_remove_item_entitlements_for_a_feature", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "item-entitlement add-item-entitlements"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "upsert_or_remove_item_entitlements_for_a_feature", opIdV1: "", method: "POST", uri: "/features/{id}/item_entitlements", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "feature-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'feature-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "item-entitlement add-item-entitlements", opts.yes === true); try { const client = await getClient(); const result = await (client as any).itemEntitlement.addItemEntitlements(resource.id, params); @@ -94,15 +95,16 @@ export function registerItemEntitlement(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs item-entitlement upsert-or-remove-item-entitlements-for-item\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "upsert_or_remove_item_entitlements_for_an_item", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "item-entitlement upsert-or-remove-item-entitlements-for-item"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "upsert_or_remove_item_entitlements_for_an_item", opIdV1: "", method: "POST", uri: "/items/{id}/item_entitlements", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "item-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'item-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "item-entitlement upsert-or-remove-item-entitlements-for-item", opts.yes === true); try { const client = await getClient(); const result = await (client as any).itemEntitlement.upsertOrRemoveItemEntitlementsForItem(resource.id, params); diff --git a/src/commands/generated/item_family.ts b/src/commands/generated/item_family.ts index e8e7a37..9d430a8 100644 --- a/src/commands/generated/item_family.ts +++ b/src/commands/generated/item_family.ts @@ -24,13 +24,14 @@ export function registerItemFamily(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs item-family create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_an_item_family", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "item-family create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_an_item_family", opIdV1: "", method: "POST", uri: "/item_families", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "item-family create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).itemFamily.create(params); @@ -46,15 +47,16 @@ export function registerItemFamily(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs item-family delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_an_item_family", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "item-family delete"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_an_item_family", opIdV1: "", method: "POST", uri: "/item_families/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "item-family-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'item-family-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "item-family delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).itemFamily.delete(resource.id, params); @@ -116,15 +118,16 @@ export function registerItemFamily(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs item-family update\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_an_item_family", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "item-family update"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_an_item_family", opIdV1: "", method: "POST", uri: "/item_families/{id}", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "item-family-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'item-family-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "item-family update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).itemFamily.update(resource.id, params); diff --git a/src/commands/generated/item_price.ts b/src/commands/generated/item_price.ts index 978ad37..46c52b0 100644 --- a/src/commands/generated/item_price.ts +++ b/src/commands/generated/item_price.ts @@ -24,13 +24,14 @@ export function registerItemPrice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs item-price create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_an_item_price", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "item-price create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_an_item_price", opIdV1: "", method: "POST", uri: "/item_prices", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "item-price create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).itemPrice.create(params); @@ -46,15 +47,16 @@ export function registerItemPrice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs item-price delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_an_item_price", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "item-price delete"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_an_item_price", opIdV1: "", method: "POST", uri: "/item_prices/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "item-price-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'item-price-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "item-price delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).itemPrice.delete(resource.id, params); @@ -162,15 +164,16 @@ export function registerItemPrice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs item-price update\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_an_item_price", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "item-price update"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_an_item_price", opIdV1: "", method: "POST", uri: "/item_prices/{id}", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "item-price-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'item-price-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "item-price update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).itemPrice.update(resource.id, params); diff --git a/src/commands/generated/ledger_operation.ts b/src/commands/generated/ledger_operation.ts index a71d5bf..b7c6171 100644 --- a/src/commands/generated/ledger_operation.ts +++ b/src/commands/generated/ledger_operation.ts @@ -23,13 +23,14 @@ export function registerLedgerOperation(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs ledger-operation allocate\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: true, opIdV2: "allocate", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "ledger-operation allocate"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "allocate", opIdV1: "", method: "POST", uri: "/ledger_operations/allocate", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "ledger-operation allocate", opts.yes === true); try { const client = await getClient(); const result = await (client as any).ledgerOperation.allocate(params); @@ -44,13 +45,14 @@ export function registerLedgerOperation(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs ledger-operation authorize\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: true, opIdV2: "authorize", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "ledger-operation authorize"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "authorize", opIdV1: "", method: "POST", uri: "/ledger_operations/authorize", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "ledger-operation authorize", opts.yes === true); try { const client = await getClient(); const result = await (client as any).ledgerOperation.authorize(params); @@ -65,13 +67,14 @@ export function registerLedgerOperation(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs ledger-operation capture\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: true, opIdV2: "capture", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "ledger-operation capture"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "capture", opIdV1: "", method: "POST", uri: "/ledger_operations/capture", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "ledger-operation capture", opts.yes === true); try { const client = await getClient(); const result = await (client as any).ledgerOperation.capture(params); @@ -86,13 +89,14 @@ export function registerLedgerOperation(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs ledger-operation capture-authorization\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: true, opIdV2: "capture_authorization", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "ledger-operation capture-authorization"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "capture_authorization", opIdV1: "", method: "POST", uri: "/ledger_operations/capture_authorization", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "ledger-operation capture-authorization", opts.yes === true); try { const client = await getClient(); const result = await (client as any).ledgerOperation.captureAuthorization(params); @@ -127,13 +131,14 @@ export function registerLedgerOperation(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs ledger-operation release-authorization\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: true, opIdV2: "release_authorization", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "ledger-operation release-authorization"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "release_authorization", opIdV1: "", method: "POST", uri: "/ledger_operations/release_authorization", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "ledger-operation release-authorization", opts.yes === true); try { const client = await getClient(); const result = await (client as any).ledgerOperation.releaseAuthorization(params); diff --git a/src/commands/generated/metered_feature.ts b/src/commands/generated/metered_feature.ts index 59bfce8..f494d85 100644 --- a/src/commands/generated/metered_feature.ts +++ b/src/commands/generated/metered_feature.ts @@ -22,15 +22,16 @@ export function registerMeteredFeature(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs metered-feature archive\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "archive_a_metered_feature", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "metered-feature archive"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "archive_a_metered_feature", opIdV1: "", method: "POST", uri: "/metered_features/{id}/archive_command", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "metered-feature-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'metered-feature-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "metered-feature archive", opts.yes === true); try { const client = await getClient(); const result = await (client as any).meteredFeature.archive(resource.id, params); @@ -45,13 +46,14 @@ export function registerMeteredFeature(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs metered-feature create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_metered_feature", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "metered-feature create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_metered_feature", opIdV1: "", method: "POST", uri: "/metered_features", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "metered-feature create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).meteredFeature.create(params); @@ -67,15 +69,16 @@ export function registerMeteredFeature(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs metered-feature delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_a_metered_feature", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "metered-feature delete"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_a_metered_feature", opIdV1: "", method: "POST", uri: "/metered_features/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "metered-feature-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'metered-feature-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "metered-feature delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).meteredFeature.delete(resource.id, params); @@ -91,15 +94,16 @@ export function registerMeteredFeature(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs metered-feature reactivate\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "reactivate_a_metered_feature", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "metered-feature reactivate"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "reactivate_a_metered_feature", opIdV1: "", method: "POST", uri: "/metered_features/{id}/reactivate_command", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "metered-feature-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'metered-feature-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "metered-feature reactivate", opts.yes === true); try { const client = await getClient(); const result = await (client as any).meteredFeature.reactivate(resource.id, params); diff --git a/src/commands/generated/non_subscription.ts b/src/commands/generated/non_subscription.ts index 20f576e..a38e3c8 100644 --- a/src/commands/generated/non_subscription.ts +++ b/src/commands/generated/non_subscription.ts @@ -22,14 +22,15 @@ export function registerNonSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs non-subscription process-receipt\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "", method: "POST", uri: "/non_subscriptions/{id}/one_time_purchase", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "non-subscription-app-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'non-subscription-app-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "non-subscription process-receipt", opts.yes === true); try { const client = await getClient(); const result = await (client as any).nonSubscription.processReceipt(resource.id, params); diff --git a/src/commands/generated/offer_event.ts b/src/commands/generated/offer_event.ts index 6d92597..1b10fc0 100644 --- a/src/commands/generated/offer_event.ts +++ b/src/commands/generated/offer_event.ts @@ -21,12 +21,13 @@ export function registerOfferEvent(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs offer-event offer-events\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: true, opIdV2: "create_an_offer_event", opIdV1: "create_an_offer_event", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_an_offer_event", opIdV1: "create_an_offer_event", method: "POST", uri: "/offer_events", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "offer-event offer-events", opts.yes === true); try { const client = await getClient(); const result = await (client as any).offerEvent.offerEvents(params); diff --git a/src/commands/generated/offer_fulfillment.ts b/src/commands/generated/offer_fulfillment.ts index e0b317f..e6e315a 100644 --- a/src/commands/generated/offer_fulfillment.ts +++ b/src/commands/generated/offer_fulfillment.ts @@ -23,12 +23,13 @@ export function registerOfferFulfillment(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs offer-fulfillment offer-fulfillments\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: true, opIdV2: "create_an_offer_fulfillment", opIdV1: "create_an_offer_fulfillment", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_an_offer_fulfillment", opIdV1: "create_an_offer_fulfillment", method: "POST", uri: "/offer_fulfillments", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "offer-fulfillment offer-fulfillments", opts.yes === true); try { const client = await getClient(); const result = await (client as any).offerFulfillment.offerFulfillments(params); @@ -66,14 +67,15 @@ export function registerOfferFulfillment(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs offer-fulfillment offer-fulfillments-update\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: true, opIdV2: "update_an_offer_fulfillment", opIdV1: "update_an_offer_fulfillment", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_an_offer_fulfillment", opIdV1: "update_an_offer_fulfillment", method: "POST", uri: "/offer_fulfillments/{id}", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "offer-fulfillment-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'offer-fulfillment-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "offer-fulfillment offer-fulfillments-update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).offerFulfillment.offerFulfillmentsUpdate(resource.id, params); diff --git a/src/commands/generated/omnichannel_subscription.ts b/src/commands/generated/omnichannel_subscription.ts index b20ad7f..0945b37 100644 --- a/src/commands/generated/omnichannel_subscription.ts +++ b/src/commands/generated/omnichannel_subscription.ts @@ -48,15 +48,16 @@ export function registerOmnichannelSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs omnichannel-subscription move\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "move_an_omnichannel_subscription", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "omnichannel-subscription move"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "move_an_omnichannel_subscription", opIdV1: "", method: "POST", uri: "/omnichannel_subscriptions/{id}/move", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "omnichannel-subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'omnichannel-subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "omnichannel-subscription move", opts.yes === true); try { const client = await getClient(); const result = await (client as any).omnichannelSubscription.move(resource.id, params); diff --git a/src/commands/generated/order.ts b/src/commands/generated/order.ts index d4ba734..2060221 100644 --- a/src/commands/generated/order.ts +++ b/src/commands/generated/order.ts @@ -24,14 +24,15 @@ export function registerOrder(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs order assign-order-number\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "assign_order_number", opIdV1: "assign_order_number", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "assign_order_number", opIdV1: "assign_order_number", method: "POST", uri: "/orders/{id}/assign_order_number", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "order-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'order-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "order assign-order-number", opts.yes === true); try { const client = await getClient(); const result = await (client as any).order.assignOrderNumber(resource.id, params); @@ -47,14 +48,15 @@ export function registerOrder(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs order cancel\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "cancel_an_order", opIdV1: "cancel_an_order", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "cancel_an_order", opIdV1: "cancel_an_order", method: "POST", uri: "/orders/{id}/cancel", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "order-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'order-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "order cancel", opts.yes === true); try { const client = await getClient(); const result = await (client as any).order.cancel(resource.id, params); @@ -69,12 +71,13 @@ export function registerOrder(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs order create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_an_order", opIdV1: "create_an_order", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_an_order", opIdV1: "create_an_order", method: "POST", uri: "/orders", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "order create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).order.create(params); @@ -90,14 +93,15 @@ export function registerOrder(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs order create-refundable-credit-note\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_refundable_credit_note", opIdV1: "create_a_refundable_credit_note", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_refundable_credit_note", opIdV1: "create_a_refundable_credit_note", method: "POST", uri: "/orders/{id}/create_refundable_credit_note", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "order-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'order-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "order create-refundable-credit-note", opts.yes === true); try { const client = await getClient(); const result = await (client as any).order.createRefundableCreditNote(resource.id, params); @@ -113,14 +117,15 @@ export function registerOrder(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs order delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_an_imported_order", opIdV1: "delete_an_imported_order", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_an_imported_order", opIdV1: "delete_an_imported_order", method: "POST", uri: "/orders/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "order-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'order-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "order delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).order.delete(resource.id, params); @@ -135,12 +140,13 @@ export function registerOrder(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs order import-order\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "import_an_order", opIdV1: "import_an_order", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "import_an_order", opIdV1: "import_an_order", method: "POST", uri: "/orders/import_order", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "order import-order", opts.yes === true); try { const client = await getClient(); const result = await (client as any).order.importOrder(params); @@ -200,14 +206,15 @@ export function registerOrder(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs order reopen\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "reopen_a_cancelled_order", opIdV1: "reopen_a_cancelled_order", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "reopen_a_cancelled_order", opIdV1: "reopen_a_cancelled_order", method: "POST", uri: "/orders/{id}/reopen", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "order-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'order-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "order reopen", opts.yes === true); try { const client = await getClient(); const result = await (client as any).order.reopen(resource.id, params); @@ -223,14 +230,15 @@ export function registerOrder(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs order resend\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "resend_an_order", opIdV1: "resend_an_order", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "resend_an_order", opIdV1: "resend_an_order", method: "POST", uri: "/orders/{id}/resend", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "order-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'order-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "order resend", opts.yes === true); try { const client = await getClient(); const result = await (client as any).order.resend(resource.id, params); @@ -268,14 +276,15 @@ export function registerOrder(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs order update\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_an_order", opIdV1: "update_an_order", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_an_order", opIdV1: "update_an_order", method: "POST", uri: "/orders/{id}", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "order-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'order-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "order update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).order.update(resource.id, params); diff --git a/src/commands/generated/payment_intent.ts b/src/commands/generated/payment_intent.ts index 91d0704..a702a81 100644 --- a/src/commands/generated/payment_intent.ts +++ b/src/commands/generated/payment_intent.ts @@ -23,12 +23,13 @@ export function registerPaymentIntent(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs payment-intent create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_payment_intent", opIdV1: "create_a_payment_intent", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_payment_intent", opIdV1: "create_a_payment_intent", method: "POST", uri: "/payment_intents", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "payment-intent create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).paymentIntent.create(params); @@ -66,14 +67,15 @@ export function registerPaymentIntent(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs payment-intent update\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_a_payment_intent", opIdV1: "update_a_payment_intent", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_a_payment_intent", opIdV1: "update_a_payment_intent", method: "POST", uri: "/payment_intents/{id}", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "payment-intent-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'payment-intent-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "payment-intent update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).paymentIntent.update(resource.id, params); diff --git a/src/commands/generated/payment_schedule_scheme.ts b/src/commands/generated/payment_schedule_scheme.ts index 3a4ac63..ee8c7cd 100644 --- a/src/commands/generated/payment_schedule_scheme.ts +++ b/src/commands/generated/payment_schedule_scheme.ts @@ -24,13 +24,14 @@ export function registerPaymentScheduleScheme(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs payment-schedule-scheme create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_payment_schedule_scheme", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "payment-schedule-scheme create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_payment_schedule_scheme", opIdV1: "", method: "POST", uri: "/payment_schedule_schemes", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "payment-schedule-scheme create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).paymentScheduleScheme.create(params); @@ -46,15 +47,16 @@ export function registerPaymentScheduleScheme(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs payment-schedule-scheme delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_a_payment_schedule_scheme", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "payment-schedule-scheme delete"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_a_payment_schedule_scheme", opIdV1: "", method: "POST", uri: "/payment_schedule_schemes/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "payment-schedule-scheme-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'payment-schedule-scheme-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "payment-schedule-scheme delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).paymentScheduleScheme.delete(resource.id, params); diff --git a/src/commands/generated/payment_source.ts b/src/commands/generated/payment_source.ts index 3b34087..5622e7d 100644 --- a/src/commands/generated/payment_source.ts +++ b/src/commands/generated/payment_source.ts @@ -24,12 +24,13 @@ export function registerPaymentSource(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs payment-source create-bank-account\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_bank_account_payment_source", opIdV1: "create_a_bank_account_payment_source", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_bank_account_payment_source", opIdV1: "create_a_bank_account_payment_source", method: "POST", uri: "/payment_sources/create_bank_account", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "payment-source create-bank-account", opts.yes === true); try { const client = await getClient(); const result = await (client as any).paymentSource.createBankAccount(params); @@ -44,12 +45,13 @@ export function registerPaymentSource(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs payment-source create-card\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_card_payment_source", opIdV1: "create_a_card_payment_source", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_card_payment_source", opIdV1: "create_a_card_payment_source", method: "POST", uri: "/payment_sources/create_card", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "payment-source create-card", opts.yes === true); try { const client = await getClient(); const result = await (client as any).paymentSource.createCard(params); @@ -64,12 +66,13 @@ export function registerPaymentSource(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs payment-source create-using-payment-intent\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_using_payment_intent", opIdV1: "create_using_payment_intent", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_using_payment_intent", opIdV1: "create_using_payment_intent", method: "POST", uri: "/payment_sources/create_using_payment_intent", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "payment-source create-using-payment-intent", opts.yes === true); try { const client = await getClient(); const result = await (client as any).paymentSource.createUsingPaymentIntent(params); @@ -84,12 +87,13 @@ export function registerPaymentSource(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs payment-source create-using-permanent-token\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_using_permanent_token", opIdV1: "create_using_permanent_token", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_using_permanent_token", opIdV1: "create_using_permanent_token", method: "POST", uri: "/payment_sources/create_using_permanent_token", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "payment-source create-using-permanent-token", opts.yes === true); try { const client = await getClient(); const result = await (client as any).paymentSource.createUsingPermanentToken(params); @@ -104,12 +108,13 @@ export function registerPaymentSource(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs payment-source create-using-temp-token\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_using_gateway_temporary_token", opIdV1: "create_using_gateway_temporary_token", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_using_gateway_temporary_token", opIdV1: "create_using_gateway_temporary_token", method: "POST", uri: "/payment_sources/create_using_temp_token", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "payment-source create-using-temp-token", opts.yes === true); try { const client = await getClient(); const result = await (client as any).paymentSource.createUsingTempToken(params); @@ -124,12 +129,13 @@ export function registerPaymentSource(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs payment-source create-using-token\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_using_chargebee_token", opIdV1: "create_using_chargebee_token", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_using_chargebee_token", opIdV1: "create_using_chargebee_token", method: "POST", uri: "/payment_sources/create_using_token", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "payment-source create-using-token", opts.yes === true); try { const client = await getClient(); const result = await (client as any).paymentSource.createUsingToken(params); @@ -144,12 +150,13 @@ export function registerPaymentSource(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs payment-source create-voucher-payment-source\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_voucher_payment_method", opIdV1: "create_a_voucher_payment_method", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_voucher_payment_method", opIdV1: "create_a_voucher_payment_method", method: "POST", uri: "/payment_sources/create_voucher_payment_source", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "payment-source create-voucher-payment-source", opts.yes === true); try { const client = await getClient(); const result = await (client as any).paymentSource.createVoucherPaymentSource(params); @@ -165,14 +172,15 @@ export function registerPaymentSource(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs payment-source delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_a_payment_source", opIdV1: "delete_a_payment_source", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_a_payment_source", opIdV1: "delete_a_payment_source", method: "POST", uri: "/payment_sources/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "cust-payment-source-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'cust-payment-source-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "payment-source delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).paymentSource.delete(resource.id, params); @@ -188,14 +196,15 @@ export function registerPaymentSource(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs payment-source delete-local\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "local_delete_a_payment_source", opIdV1: "local_delete_a_payment_source", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "local_delete_a_payment_source", opIdV1: "local_delete_a_payment_source", method: "POST", uri: "/payment_sources/{id}/delete_local", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "cust-payment-source-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'cust-payment-source-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "payment-source delete-local", opts.yes === true); try { const client = await getClient(); const result = await (client as any).paymentSource.deleteLocal(resource.id, params); @@ -211,14 +220,15 @@ export function registerPaymentSource(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs payment-source export-payment-source\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "export_payment_source", opIdV1: "export_payment_source", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "export_payment_source", opIdV1: "export_payment_source", method: "POST", uri: "/payment_sources/{id}/export_payment_source", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "cust-payment-source-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'cust-payment-source-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "payment-source export-payment-source", opts.yes === true); try { const client = await getClient(); const result = await (client as any).paymentSource.exportPaymentSource(resource.id, params); @@ -300,14 +310,15 @@ export function registerPaymentSource(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs payment-source switch-gateway-account\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "switch_gateway_account", opIdV1: "switch_gateway_account", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "switch_gateway_account", opIdV1: "switch_gateway_account", method: "POST", uri: "/payment_sources/{id}/switch_gateway_account", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "cust-payment-source-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'cust-payment-source-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "payment-source switch-gateway-account", opts.yes === true); try { const client = await getClient(); const result = await (client as any).paymentSource.switchGatewayAccount(resource.id, params); @@ -323,14 +334,15 @@ export function registerPaymentSource(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs payment-source update-bank-account\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_a_bank_account_payment_source", opIdV1: "update_a_bank_account_payment_source", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_a_bank_account_payment_source", opIdV1: "update_a_bank_account_payment_source", method: "POST", uri: "/payment_sources/{id}/update_bank_account", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "cust-payment-source-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'cust-payment-source-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "payment-source update-bank-account", opts.yes === true); try { const client = await getClient(); const result = await (client as any).paymentSource.updateBankAccount(resource.id, params); @@ -346,14 +358,15 @@ export function registerPaymentSource(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs payment-source update-card\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_a_card_payment_source", opIdV1: "update_a_card_payment_source", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_a_card_payment_source", opIdV1: "update_a_card_payment_source", method: "POST", uri: "/payment_sources/{id}/update_card", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "cust-payment-source-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'cust-payment-source-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "payment-source update-card", opts.yes === true); try { const client = await getClient(); const result = await (client as any).paymentSource.updateCard(resource.id, params); @@ -369,14 +382,15 @@ export function registerPaymentSource(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs payment-source verify-bank-account\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "verify_bank_account_payment_source", opIdV1: "verify_bank_account_payment_source", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "verify_bank_account_payment_source", opIdV1: "verify_bank_account_payment_source", method: "POST", uri: "/payment_sources/{id}/verify_bank_account", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "cust-payment-source-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'cust-payment-source-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "payment-source verify-bank-account", opts.yes === true); try { const client = await getClient(); const result = await (client as any).paymentSource.verifyBankAccount(resource.id, params); diff --git a/src/commands/generated/payment_voucher.ts b/src/commands/generated/payment_voucher.ts index d9d33b9..1449b37 100644 --- a/src/commands/generated/payment_voucher.ts +++ b/src/commands/generated/payment_voucher.ts @@ -23,12 +23,13 @@ export function registerPaymentVoucher(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs payment-voucher create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_voucher_for_the_customer_to_initiate_payment", opIdV1: "create_a_voucher_for_the_customer_to_initiate_payment", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_voucher_for_the_customer_to_initiate_payment", opIdV1: "create_a_voucher_for_the_customer_to_initiate_payment", method: "POST", uri: "/payment_vouchers", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "payment-voucher create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).paymentVoucher.create(params); diff --git a/src/commands/generated/personalized_offer.ts b/src/commands/generated/personalized_offer.ts index f97f4d2..75585ec 100644 --- a/src/commands/generated/personalized_offer.ts +++ b/src/commands/generated/personalized_offer.ts @@ -21,12 +21,13 @@ export function registerPersonalizedOffer(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs personalized-offer personalized-offers\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: true, opIdV2: "list_personalized_offers", opIdV1: "list_personalized_offers", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "list_personalized_offers", opIdV1: "list_personalized_offers", method: "POST", uri: "/personalized_offers", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "personalized-offer personalized-offers", opts.yes === true); try { const client = await getClient(); const result = await (client as any).personalizedOffer.personalizedOffers(params); diff --git a/src/commands/generated/plan.ts b/src/commands/generated/plan.ts index 2e0f325..f583f8c 100644 --- a/src/commands/generated/plan.ts +++ b/src/commands/generated/plan.ts @@ -23,13 +23,14 @@ export function registerPlan(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs plan copy\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "copy_a_plan", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "plan copy"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "copy_a_plan", method: "POST", uri: "/plans/copy", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "plan copy", opts.yes === true); try { const client = await getClient(); const result = await (client as any).plan.copy(params); @@ -44,13 +45,14 @@ export function registerPlan(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs plan create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "create_a_plan", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "plan create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "create_a_plan", method: "POST", uri: "/plans", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "plan create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).plan.create(params); @@ -66,15 +68,16 @@ export function registerPlan(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs plan delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "delete_a_plan", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "plan delete"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "delete_a_plan", method: "POST", uri: "/plans/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "plan-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'plan-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "plan delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).plan.delete(resource.id, params); @@ -136,15 +139,16 @@ export function registerPlan(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs plan unarchive\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "unarchive_a_plan", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "plan unarchive"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "unarchive_a_plan", method: "POST", uri: "/plans/{id}/unarchive", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "plan-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'plan-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "plan unarchive", opts.yes === true); try { const client = await getClient(); const result = await (client as any).plan.unarchive(resource.id, params); @@ -160,15 +164,16 @@ export function registerPlan(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs plan update\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "update_a_plan", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "plan update"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "update_a_plan", method: "POST", uri: "/plans/{id}", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "plan-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'plan-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "plan update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).plan.update(resource.id, params); diff --git a/src/commands/generated/portal_session.ts b/src/commands/generated/portal_session.ts index 45ee557..4ea394a 100644 --- a/src/commands/generated/portal_session.ts +++ b/src/commands/generated/portal_session.ts @@ -24,14 +24,15 @@ export function registerPortalSession(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs portal-session activate\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "activate_a_portal_session", opIdV1: "activate_a_portal_session", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "activate_a_portal_session", opIdV1: "activate_a_portal_session", method: "POST", uri: "/portal_sessions/{id}/activate", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "portal-session-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'portal-session-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "portal-session activate", opts.yes === true); try { const client = await getClient(); const result = await (client as any).portalSession.activate(resource.id, params); @@ -66,14 +67,15 @@ export function registerPortalSession(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs portal-session logout\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "logout_a_portal_session", opIdV1: "logout_a_portal_session", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "logout_a_portal_session", opIdV1: "logout_a_portal_session", method: "POST", uri: "/portal_sessions/{id}/logout", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "portal-session-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'portal-session-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "portal-session logout", opts.yes === true); try { const client = await getClient(); const result = await (client as any).portalSession.logout(resource.id, params); diff --git a/src/commands/generated/price_variant.ts b/src/commands/generated/price_variant.ts index f0c912c..57e55c4 100644 --- a/src/commands/generated/price_variant.ts +++ b/src/commands/generated/price_variant.ts @@ -24,13 +24,14 @@ export function registerPriceVariant(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs price-variant create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_price_variant", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "price-variant create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_price_variant", opIdV1: "", method: "POST", uri: "/price_variants", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "price-variant create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).priceVariant.create(params); @@ -46,15 +47,16 @@ export function registerPriceVariant(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs price-variant delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_a_price_variant", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "price-variant delete"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_a_price_variant", opIdV1: "", method: "POST", uri: "/price_variants/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "price-variant-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'price-variant-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "price-variant delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).priceVariant.delete(resource.id, params); @@ -116,15 +118,16 @@ export function registerPriceVariant(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs price-variant update\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_a_price_variant", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "price-variant update"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_a_price_variant", opIdV1: "", method: "POST", uri: "/price_variants/{id}", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "price-variant-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'price-variant-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "price-variant update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).priceVariant.update(resource.id, params); diff --git a/src/commands/generated/pricing_page_session.ts b/src/commands/generated/pricing_page_session.ts index 3cfec67..d801b54 100644 --- a/src/commands/generated/pricing_page_session.ts +++ b/src/commands/generated/pricing_page_session.ts @@ -21,13 +21,14 @@ export function registerPricingPageSession(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs pricing-page-session create-for-existing-subscription\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_pricing_page_for_existing_subscription", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "pricing-page-session create-for-existing-subscription"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_pricing_page_for_existing_subscription", opIdV1: "", method: "POST", uri: "/pricing_page_sessions/create_for_existing_subscription", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "pricing-page-session create-for-existing-subscription", opts.yes === true); try { const client = await getClient(); const result = await (client as any).pricingPageSession.createForExistingSubscription(params); @@ -42,13 +43,14 @@ export function registerPricingPageSession(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs pricing-page-session create-for-new-subscription\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_pricing_page_for_new_subscription", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "pricing-page-session create-for-new-subscription"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_pricing_page_for_new_subscription", opIdV1: "", method: "POST", uri: "/pricing_page_sessions/create_for_new_subscription", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "pricing-page-session create-for-new-subscription", opts.yes === true); try { const client = await getClient(); const result = await (client as any).pricingPageSession.createForNewSubscription(params); diff --git a/src/commands/generated/promotional_credit.ts b/src/commands/generated/promotional_credit.ts index 02bde80..b77758e 100644 --- a/src/commands/generated/promotional_credit.ts +++ b/src/commands/generated/promotional_credit.ts @@ -24,12 +24,13 @@ export function registerPromotionalCredit(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs promotional-credit add\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "add_promotional_credits", opIdV1: "add_promotional_credits", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "add_promotional_credits", opIdV1: "add_promotional_credits", method: "POST", uri: "/promotional_credits/add", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "promotional-credit add", opts.yes === true); try { const client = await getClient(); const result = await (client as any).promotionalCredit.add(params); @@ -44,12 +45,13 @@ export function registerPromotionalCredit(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs promotional-credit deduct\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "deduct_promotional_credits", opIdV1: "deduct_promotional_credits", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "deduct_promotional_credits", opIdV1: "deduct_promotional_credits", method: "POST", uri: "/promotional_credits/deduct", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "promotional-credit deduct", opts.yes === true); try { const client = await getClient(); const result = await (client as any).promotionalCredit.deduct(params); @@ -108,12 +110,13 @@ export function registerPromotionalCredit(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs promotional-credit set\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "set_promotional_credits", opIdV1: "set_promotional_credits", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "set_promotional_credits", opIdV1: "set_promotional_credits", method: "POST", uri: "/promotional_credits/set", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "promotional-credit set", opts.yes === true); try { const client = await getClient(); const result = await (client as any).promotionalCredit.set(params); diff --git a/src/commands/generated/promotional_grant.ts b/src/commands/generated/promotional_grant.ts index ea8ec8f..9732136 100644 --- a/src/commands/generated/promotional_grant.ts +++ b/src/commands/generated/promotional_grant.ts @@ -21,13 +21,14 @@ export function registerPromotionalGrant(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs promotional-grant promotional-grants\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: true, opIdV2: "create_promotional_grant", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "promotional-grant promotional-grants"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_promotional_grant", opIdV1: "", method: "POST", uri: "/promotional_grants", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "promotional-grant promotional-grants", opts.yes === true); try { const client = await getClient(); const result = await (client as any).promotionalGrant.promotionalGrants(params); diff --git a/src/commands/generated/purchase.ts b/src/commands/generated/purchase.ts index 88e5d41..9d9a3b6 100644 --- a/src/commands/generated/purchase.ts +++ b/src/commands/generated/purchase.ts @@ -20,13 +20,14 @@ export function registerPurchase(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs purchase create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_purchase", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "purchase create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_purchase", opIdV1: "", method: "POST", uri: "/purchases", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "purchase create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).purchase.create(params); @@ -41,13 +42,14 @@ export function registerPurchase(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs purchase estimate\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "estimates_for_purchase", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "purchase estimate"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "estimates_for_purchase", opIdV1: "", method: "POST", uri: "/purchases/estimate", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "purchase estimate", opts.yes === true); try { const client = await getClient(); const result = await (client as any).purchase.estimate(params); diff --git a/src/commands/generated/quote.ts b/src/commands/generated/quote.ts index 668fefa..a72b557 100644 --- a/src/commands/generated/quote.ts +++ b/src/commands/generated/quote.ts @@ -24,14 +24,15 @@ export function registerQuote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs quote convert\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "convert_a_quote", opIdV1: "convert_a_quote", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "convert_a_quote", opIdV1: "convert_a_quote", method: "POST", uri: "/quotes/{id}/convert", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "quote-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'quote-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "quote convert", opts.yes === true); try { const client = await getClient(); const result = await (client as any).quote.convert(resource.id, params); @@ -46,13 +47,14 @@ export function registerQuote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs quote create-for-charge-items-and-charges\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_quote_for_charge_and_charge_items", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "quote create-for-charge-items-and-charges"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_quote_for_charge_and_charge_items", opIdV1: "", method: "POST", uri: "/quotes/create_for_charge_items_and_charges", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "quote create-for-charge-items-and-charges", opts.yes === true); try { const client = await getClient(); const result = await (client as any).quote.createForChargeItemsAndCharges(params); @@ -67,13 +69,14 @@ export function registerQuote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs quote create-for-onetime-charges\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "create_quote_for_one-time_charges", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "quote create-for-onetime-charges"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "create_quote_for_one-time_charges", method: "POST", uri: "/quotes/create_for_onetime_charges", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "quote create-for-onetime-charges", opts.yes === true); try { const client = await getClient(); const result = await (client as any).quote.createForOnetimeCharges(params); @@ -89,14 +92,15 @@ export function registerQuote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs quote create-signature\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "", method: "POST", uri: "/quotes/{id}/create_signature", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: undefined, pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "quote create-signature", opts.yes === true); try { const client = await getClient(); const result = await (client as any).quote.createSignature(resource.id, params); @@ -112,15 +116,16 @@ export function registerQuote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs quote create-sub-for-customer-quote\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "create_quote_for_a_new_subscription", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "quote create-sub-for-customer-quote"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "create_quote_for_a_new_subscription", method: "POST", uri: "/customers/{id}/create_subscription_quote", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "quote create-sub-for-customer-quote", opts.yes === true); try { const client = await getClient(); const result = await (client as any).quote.createSubForCustomerQuote(resource.id, params); @@ -136,15 +141,16 @@ export function registerQuote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs quote create-sub-items-for-customer-quote\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_quote_for_a_new_subscription_items", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "quote create-sub-items-for-customer-quote"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_quote_for_a_new_subscription_items", opIdV1: "", method: "POST", uri: "/customers/{id}/create_subscription_quote_for_items", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "quote create-sub-items-for-customer-quote", opts.yes === true); try { const client = await getClient(); const result = await (client as any).quote.createSubItemsForCustomerQuote(resource.id, params); @@ -160,14 +166,15 @@ export function registerQuote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs quote delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_a_quote", opIdV1: "delete_a_quote", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_a_quote", opIdV1: "delete_a_quote", method: "POST", uri: "/quotes/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "quote-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'quote-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "quote delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).quote.delete(resource.id, params); @@ -183,15 +190,16 @@ export function registerQuote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs quote edit-create-sub-customer-quote-for-items\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "edit_create_subscription_quote_for_items", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "quote edit-create-sub-customer-quote-for-items"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "edit_create_subscription_quote_for_items", opIdV1: "", method: "POST", uri: "/quotes/{id}/edit_create_subscription_quote_for_items", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "quote-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'quote-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "quote edit-create-sub-customer-quote-for-items", opts.yes === true); try { const client = await getClient(); const result = await (client as any).quote.editCreateSubCustomerQuoteForItems(resource.id, params); @@ -207,15 +215,16 @@ export function registerQuote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs quote edit-create-sub-for-customer-quote\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "edit_quote_for_a_new_subscription", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "quote edit-create-sub-for-customer-quote"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "edit_quote_for_a_new_subscription", method: "POST", uri: "/quotes/{id}/edit_create_subscription_quote", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "quote-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'quote-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "quote edit-create-sub-for-customer-quote", opts.yes === true); try { const client = await getClient(); const result = await (client as any).quote.editCreateSubForCustomerQuote(resource.id, params); @@ -231,15 +240,16 @@ export function registerQuote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs quote edit-for-charge-items-and-charges\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "edit_quote_for_charge_items_and_charges", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "quote edit-for-charge-items-and-charges"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "edit_quote_for_charge_items_and_charges", opIdV1: "", method: "POST", uri: "/quotes/{id}/edit_for_charge_items_and_charges", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "quote-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'quote-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "quote edit-for-charge-items-and-charges", opts.yes === true); try { const client = await getClient(); const result = await (client as any).quote.editForChargeItemsAndCharges(resource.id, params); @@ -255,15 +265,16 @@ export function registerQuote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs quote edit-one-time-quote\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "edit_quote_for_one-time_charges", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "quote edit-one-time-quote"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "edit_quote_for_one-time_charges", method: "POST", uri: "/quotes/{id}/edit_one_time_quote", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "quote-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'quote-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "quote edit-one-time-quote", opts.yes === true); try { const client = await getClient(); const result = await (client as any).quote.editOneTimeQuote(resource.id, params); @@ -279,15 +290,16 @@ export function registerQuote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs quote edit-update-subscription-quote\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "edit_quote_for_updating_a_subscription", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "quote edit-update-subscription-quote"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "edit_quote_for_updating_a_subscription", method: "POST", uri: "/quotes/{id}/edit_update_subscription_quote", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "quote-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'quote-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "quote edit-update-subscription-quote", opts.yes === true); try { const client = await getClient(); const result = await (client as any).quote.editUpdateSubscriptionQuote(resource.id, params); @@ -303,15 +315,16 @@ export function registerQuote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs quote edit-update-subscription-quote-for-items\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "edit_update_subscription_quote_for_items", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "quote edit-update-subscription-quote-for-items"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "edit_update_subscription_quote_for_items", opIdV1: "", method: "POST", uri: "/quotes/{id}/edit_update_subscription_quote_for_items", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "quote-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'quote-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "quote edit-update-subscription-quote-for-items", opts.yes === true); try { const client = await getClient(); const result = await (client as any).quote.editUpdateSubscriptionQuoteForItems(resource.id, params); @@ -327,14 +340,15 @@ export function registerQuote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs quote extend-expiry-date\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "extend_expiry_date", opIdV1: "extend_expiry_date", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "extend_expiry_date", opIdV1: "extend_expiry_date", method: "POST", uri: "/quotes/{id}/extend_expiry_date", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "quote-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'quote-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "quote extend-expiry-date", opts.yes === true); try { const client = await getClient(); const result = await (client as any).quote.extendExpiryDate(resource.id, params); @@ -372,14 +386,15 @@ export function registerQuote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs quote pdf\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "retrieve_quote_as_pdf", opIdV1: "retrieve_quote_as_pdf", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "retrieve_quote_as_pdf", opIdV1: "retrieve_quote_as_pdf", method: "POST", uri: "/quotes/{id}/pdf", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "quote-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'quote-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "quote pdf", opts.yes === true); try { const client = await getClient(); const result = await (client as any).quote.pdf(resource.id, params); @@ -417,14 +432,15 @@ export function registerQuote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs quote refresh-signature-link\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "", method: "POST", uri: "/quotes/{id}/refresh_signature_link", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: undefined, pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "quote refresh-signature-link", opts.yes === true); try { const client = await getClient(); const result = await (client as any).quote.refreshSignatureLink(resource.id, params); @@ -506,14 +522,15 @@ export function registerQuote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs quote update-signature\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "", method: "POST", uri: "/quotes/{id}/update_signature", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: undefined, pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "quote update-signature", opts.yes === true); try { const client = await getClient(); const result = await (client as any).quote.updateSignature(resource.id, params); @@ -529,14 +546,15 @@ export function registerQuote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs quote update-signature-status\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "", method: "POST", uri: "/quotes/{id}/update_signature_status", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: undefined, pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "quote update-signature-status", opts.yes === true); try { const client = await getClient(); const result = await (client as any).quote.updateSignatureStatus(resource.id, params); @@ -552,14 +570,15 @@ export function registerQuote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs quote update-status\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_quote_status", opIdV1: "update_quote_status", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_quote_status", opIdV1: "update_quote_status", method: "POST", uri: "/quotes/{id}/update_status", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "quote-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'quote-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "quote update-status", opts.yes === true); try { const client = await getClient(); const result = await (client as any).quote.updateStatus(resource.id, params); @@ -574,13 +593,14 @@ export function registerQuote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs quote update-subscription-quote\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "create_quote_for_updating_a_subscription", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "quote update-subscription-quote"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "create_quote_for_updating_a_subscription", method: "POST", uri: "/quotes/update_subscription_quote", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "quote update-subscription-quote", opts.yes === true); try { const client = await getClient(); const result = await (client as any).quote.updateSubscriptionQuote(params); @@ -595,13 +615,14 @@ export function registerQuote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs quote update-subscription-quote-for-items\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_quote_for_update_subscription_items", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "quote update-subscription-quote-for-items"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_quote_for_update_subscription_items", opIdV1: "", method: "POST", uri: "/quotes/update_subscription_quote_for_items", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "quote update-subscription-quote-for-items", opts.yes === true); try { const client = await getClient(); const result = await (client as any).quote.updateSubscriptionQuoteForItems(params); diff --git a/src/commands/generated/ramp.ts b/src/commands/generated/ramp.ts index 4dc8339..c052e31 100644 --- a/src/commands/generated/ramp.ts +++ b/src/commands/generated/ramp.ts @@ -24,15 +24,16 @@ export function registerRamp(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs ramp create-for-subscription\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_ramp", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "ramp create-for-subscription"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_ramp", opIdV1: "", method: "POST", uri: "/subscriptions/{id}/create_ramp", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "ramp create-for-subscription", opts.yes === true); try { const client = await getClient(); const result = await (client as any).ramp.createForSubscription(resource.id, params); @@ -48,15 +49,16 @@ export function registerRamp(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs ramp delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_a_ramp", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "ramp delete"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_a_ramp", opIdV1: "", method: "POST", uri: "/ramps/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "ramp-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'ramp-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "ramp delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).ramp.delete(resource.id, params); @@ -118,15 +120,16 @@ export function registerRamp(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs ramp update\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_a_subscription_ramp", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "ramp update"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_a_subscription_ramp", opIdV1: "", method: "POST", uri: "/ramps/{id}/update", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "ramp-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'ramp-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "ramp update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).ramp.update(resource.id, params); diff --git a/src/commands/generated/recorded_purchase.ts b/src/commands/generated/recorded_purchase.ts index 01e821b..2dcaf5c 100644 --- a/src/commands/generated/recorded_purchase.ts +++ b/src/commands/generated/recorded_purchase.ts @@ -23,13 +23,14 @@ export function registerRecordedPurchase(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs recorded-purchase create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "record_a_purchase", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "recorded-purchase create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "record_a_purchase", opIdV1: "", method: "POST", uri: "/recorded_purchases", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "recorded-purchase create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).recordedPurchase.create(params); diff --git a/src/commands/generated/subscription.ts b/src/commands/generated/subscription.ts index 9d17971..3e845fb 100644 --- a/src/commands/generated/subscription.ts +++ b/src/commands/generated/subscription.ts @@ -24,14 +24,15 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription add-charge-at-term-end\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "add_charge_at_term_end", opIdV1: "add_charge_at_term_end", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "add_charge_at_term_end", opIdV1: "add_charge_at_term_end", method: "POST", uri: "/subscriptions/{id}/add_charge_at_term_end", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription add-charge-at-term-end", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.addChargeAtTermEnd(resource.id, params); @@ -47,15 +48,16 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription cancel\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "cancel_a_subscription", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "subscription cancel"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "cancel_a_subscription", method: "POST", uri: "/subscriptions/{id}/cancel", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription cancel", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.cancel(resource.id, params); @@ -71,15 +73,16 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription cancel-for-items\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "cancel_subscription_for_items", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "subscription cancel-for-items"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "cancel_subscription_for_items", opIdV1: "", method: "POST", uri: "/subscriptions/{id}/cancel_for_items", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription cancel-for-items", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.cancelForItems(resource.id, params); @@ -95,14 +98,15 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription change-term-end\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "change_term_end", opIdV1: "change_term_end", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "change_term_end", opIdV1: "change_term_end", method: "POST", uri: "/subscriptions/{id}/change_term_end", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription change-term-end", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.changeTermEnd(resource.id, params); @@ -118,15 +122,16 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription charge-addon-at-term-end\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "charge_addon_at_term_end", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "subscription charge-addon-at-term-end"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "charge_addon_at_term_end", method: "POST", uri: "/subscriptions/{id}/charge_addon_at_term_end", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription charge-addon-at-term-end", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.chargeAddonAtTermEnd(resource.id, params); @@ -142,14 +147,15 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription charge-future-renewals\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "charge_future_renewals", opIdV1: "charge_future_renewals", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "charge_future_renewals", opIdV1: "charge_future_renewals", method: "POST", uri: "/subscriptions/{id}/charge_future_renewals", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription charge-future-renewals", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.chargeFutureRenewals(resource.id, params); @@ -186,13 +192,14 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "create_a_subscription", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "subscription create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "create_a_subscription", method: "POST", uri: "/subscriptions", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.create(params); @@ -208,15 +215,16 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription create-for-customer\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "create_subscription_for_customer", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "subscription create-for-customer"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "create_subscription_for_customer", method: "POST", uri: "/customers/{id}/subscriptions", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription create-for-customer", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.createForCustomer(resource.id, params); @@ -232,15 +240,16 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription create-with-items\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_subscription_for_items", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "subscription create-with-items"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_subscription_for_items", opIdV1: "", method: "POST", uri: "/customers/{id}/subscription_for_items", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription create-with-items", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.createWithItems(resource.id, params); @@ -256,14 +265,15 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_a_subscription", opIdV1: "delete_a_subscription", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_a_subscription", opIdV1: "delete_a_subscription", method: "POST", uri: "/subscriptions/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.delete(resource.id, params); @@ -279,14 +289,15 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription edit-advance-invoice-schedule\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "edit_advance_invoice_schedule", opIdV1: "edit_advance_invoice_schedule", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "edit_advance_invoice_schedule", opIdV1: "edit_advance_invoice_schedule", method: "POST", uri: "/subscriptions/{id}/edit_advance_invoice_schedule", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription edit-advance-invoice-schedule", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.editAdvanceInvoiceSchedule(resource.id, params); @@ -302,14 +313,15 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription import-contract-term\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "import_contract_term", opIdV1: "import_contract_term", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "import_contract_term", opIdV1: "import_contract_term", method: "POST", uri: "/subscriptions/{id}/import_contract_term", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription import-contract-term", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.importContractTerm(resource.id, params); @@ -325,15 +337,16 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription import-for-customer\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "import_subscription_for_customer", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "subscription import-for-customer"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "import_subscription_for_customer", method: "POST", uri: "/customers/{id}/import_subscription", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription import-for-customer", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.importForCustomer(resource.id, params); @@ -349,15 +362,16 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription import-for-items\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "import_subscription_for_items", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "subscription import-for-items"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "import_subscription_for_items", opIdV1: "", method: "POST", uri: "/customers/{id}/import_for_items", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "customer-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'customer-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription import-for-items", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.importForItems(resource.id, params); @@ -372,13 +386,14 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription import-subscription\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "import_a_subscription", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "subscription import-subscription"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "import_a_subscription", method: "POST", uri: "/subscriptions/import_subscription", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription import-subscription", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.importSubscription(params); @@ -394,14 +409,15 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription import-unbilled-charges\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "import_unbilled_charges", opIdV1: "import_unbilled_charges", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "import_unbilled_charges", opIdV1: "import_unbilled_charges", method: "POST", uri: "/subscriptions/{id}/import_unbilled_charges", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription import-unbilled-charges", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.importUnbilledCharges(resource.id, params); @@ -462,14 +478,15 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription move\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "move_a_subscription", opIdV1: "move_a_subscription", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "move_a_subscription", opIdV1: "move_a_subscription", method: "POST", uri: "/subscriptions/{id}/move", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription move", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.move(resource.id, params); @@ -485,14 +502,15 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription override-billing-profile\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "override_billing_profile", opIdV1: "override_billing_profile", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "override_billing_profile", opIdV1: "override_billing_profile", method: "POST", uri: "/subscriptions/{id}/override_billing_profile", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription override-billing-profile", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.overrideBillingProfile(resource.id, params); @@ -508,14 +526,15 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription pause\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "pause_a_subscription", opIdV1: "pause_a_subscription", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "pause_a_subscription", opIdV1: "pause_a_subscription", method: "POST", uri: "/subscriptions/{id}/pause", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription pause", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.pause(resource.id, params); @@ -531,14 +550,15 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription reactivate\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "reactivate_a_subscription", opIdV1: "reactivate_a_subscription", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "reactivate_a_subscription", opIdV1: "reactivate_a_subscription", method: "POST", uri: "/subscriptions/{id}/reactivate", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription reactivate", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.reactivate(resource.id, params); @@ -554,14 +574,15 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription regenerate-invoice\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "regenerate_an_invoice", opIdV1: "regenerate_an_invoice", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "regenerate_an_invoice", opIdV1: "regenerate_an_invoice", method: "POST", uri: "/subscriptions/{id}/regenerate_invoice", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription regenerate-invoice", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.regenerateInvoice(resource.id, params); @@ -577,14 +598,15 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription remove-advance-invoice-schedule\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "remove_an_advance_invoice_schedules", opIdV1: "remove_an_advance_invoice_schedules", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "remove_an_advance_invoice_schedules", opIdV1: "remove_an_advance_invoice_schedules", method: "POST", uri: "/subscriptions/{id}/remove_advance_invoice_schedule", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription remove-advance-invoice-schedule", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.removeAdvanceInvoiceSchedule(resource.id, params); @@ -600,14 +622,15 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription remove-coupons\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "remove_coupons", opIdV1: "remove_coupons", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "remove_coupons", opIdV1: "remove_coupons", method: "POST", uri: "/subscriptions/{id}/remove_coupons", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription remove-coupons", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.removeCoupons(resource.id, params); @@ -623,14 +646,15 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription remove-scheduled-cancellation\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "remove_scheduled_cancellation", opIdV1: "remove_scheduled_cancellation", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "remove_scheduled_cancellation", opIdV1: "remove_scheduled_cancellation", method: "POST", uri: "/subscriptions/{id}/remove_scheduled_cancellation", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription remove-scheduled-cancellation", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.removeScheduledCancellation(resource.id, params); @@ -646,14 +670,15 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription remove-scheduled-changes\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "remove_scheduled_changes", opIdV1: "remove_scheduled_changes", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "remove_scheduled_changes", opIdV1: "remove_scheduled_changes", method: "POST", uri: "/subscriptions/{id}/remove_scheduled_changes", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription remove-scheduled-changes", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.removeScheduledChanges(resource.id, params); @@ -669,14 +694,15 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription remove-scheduled-pause\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "remove_scheduled_pause", opIdV1: "remove_scheduled_pause", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "remove_scheduled_pause", opIdV1: "remove_scheduled_pause", method: "POST", uri: "/subscriptions/{id}/remove_scheduled_pause", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription remove-scheduled-pause", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.removeScheduledPause(resource.id, params); @@ -692,14 +718,15 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription remove-scheduled-resumption\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "remove_scheduled_resumption", opIdV1: "remove_scheduled_resumption", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "remove_scheduled_resumption", opIdV1: "remove_scheduled_resumption", method: "POST", uri: "/subscriptions/{id}/remove_scheduled_resumption", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription remove-scheduled-resumption", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.removeScheduledResumption(resource.id, params); @@ -715,14 +742,15 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription resume\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "resume_a_subscription", opIdV1: "resume_a_subscription", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "resume_a_subscription", opIdV1: "resume_a_subscription", method: "POST", uri: "/subscriptions/{id}/resume", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription resume", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.resume(resource.id, params); @@ -826,15 +854,16 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription update\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "update_a_subscription", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "subscription update"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "update_a_subscription", method: "POST", uri: "/subscriptions/{id}", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.update(resource.id, params); @@ -850,15 +879,16 @@ export function registerSubscription(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription update-for-items\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_subscription_for_items", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "subscription update-for-items"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_subscription_for_items", opIdV1: "", method: "POST", uri: "/subscriptions/{id}/update_for_items", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription update-for-items", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscription.updateForItems(resource.id, params); diff --git a/src/commands/generated/subscription_entitlement.ts b/src/commands/generated/subscription_entitlement.ts index ec7c2be..52516a5 100644 --- a/src/commands/generated/subscription_entitlement.ts +++ b/src/commands/generated/subscription_entitlement.ts @@ -24,15 +24,16 @@ export function registerSubscriptionEntitlement(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs subscription-entitlement set-subscription-entitlement-availability\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "enable_or_disable_subscription_entitlements", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "subscription-entitlement set-subscription-entitlement-availability"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "enable_or_disable_subscription_entitlements", opIdV1: "", method: "POST", uri: "/subscriptions/{id}/subscription_entitlements/set_availability", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "subscription-entitlement set-subscription-entitlement-availability", opts.yes === true); try { const client = await getClient(); const result = await (client as any).subscriptionEntitlement.setSubscriptionEntitlementAvailability(resource.id, params); diff --git a/src/commands/generated/time_machine.ts b/src/commands/generated/time_machine.ts index 4c76008..0ee6718 100644 --- a/src/commands/generated/time_machine.ts +++ b/src/commands/generated/time_machine.ts @@ -46,14 +46,15 @@ export function registerTimeMachine(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs time-machine start-afresh\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "start_afresh", opIdV1: "start_afresh", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "start_afresh", opIdV1: "start_afresh", method: "POST", uri: "/time_machines/{id}/start_afresh", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "time-machine-name", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'time-machine-name'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "time-machine start-afresh", opts.yes === true); try { const client = await getClient(); const result = await (client as any).timeMachine.startAfresh(resource.id, params); @@ -69,14 +70,15 @@ export function registerTimeMachine(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs time-machine travel-forward\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "travel_forward", opIdV1: "travel_forward", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "travel_forward", opIdV1: "travel_forward", method: "POST", uri: "/time_machines/{id}/travel_forward", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "time-machine-name", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'time-machine-name'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "time-machine travel-forward", opts.yes === true); try { const client = await getClient(); const result = await (client as any).timeMachine.travelForward(resource.id, params); diff --git a/src/commands/generated/transaction.ts b/src/commands/generated/transaction.ts index b491fb5..4f28d38 100644 --- a/src/commands/generated/transaction.ts +++ b/src/commands/generated/transaction.ts @@ -23,12 +23,13 @@ export function registerTransaction(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs transaction create-authorization\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_an_authorization_payment", opIdV1: "create_an_authorization_payment", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_an_authorization_payment", opIdV1: "create_an_authorization_payment", method: "POST", uri: "/transactions/create_authorization", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "transaction create-authorization", opts.yes === true); try { const client = await getClient(); const result = await (client as any).transaction.createAuthorization(params); @@ -44,14 +45,15 @@ export function registerTransaction(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs transaction delete-offline-transaction\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_an_offline_transaction", opIdV1: "delete_an_offline_transaction", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_an_offline_transaction", opIdV1: "delete_an_offline_transaction", method: "POST", uri: "/transactions/{id}/delete_offline_transaction", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "transaction-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'transaction-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "transaction delete-offline-transaction", opts.yes === true); try { const client = await getClient(); const result = await (client as any).transaction.deleteOfflineTransaction(resource.id, params); @@ -111,14 +113,15 @@ export function registerTransaction(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs transaction reconcile\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "reconcile_transaction", opIdV1: "reconcile_transaction", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "reconcile_transaction", opIdV1: "reconcile_transaction", method: "POST", uri: "/transactions/{id}/reconcile", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "transaction-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'transaction-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "transaction reconcile", opts.yes === true); try { const client = await getClient(); const result = await (client as any).transaction.reconcile(resource.id, params); @@ -134,14 +137,15 @@ export function registerTransaction(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs transaction record-refund\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "record_an_offline_refund", opIdV1: "record_an_offline_refund", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "record_an_offline_refund", opIdV1: "record_an_offline_refund", method: "POST", uri: "/transactions/{id}/record_refund", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "transaction-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'transaction-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "transaction record-refund", opts.yes === true); try { const client = await getClient(); const result = await (client as any).transaction.recordRefund(resource.id, params); @@ -157,14 +161,15 @@ export function registerTransaction(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs transaction refund\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "refund_a_payment", opIdV1: "refund_a_payment", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "refund_a_payment", opIdV1: "refund_a_payment", method: "POST", uri: "/transactions/{id}/refund", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "transaction-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'transaction-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "transaction refund", opts.yes === true); try { const client = await getClient(); const result = await (client as any).transaction.refund(resource.id, params); @@ -246,14 +251,15 @@ export function registerTransaction(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs transaction void-transaction\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "void_an_authorization_transaction", opIdV1: "void_an_authorization_transaction", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "void_an_authorization_transaction", opIdV1: "void_an_authorization_transaction", method: "POST", uri: "/transactions/{id}/void", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "transaction-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'transaction-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "transaction void-transaction", opts.yes === true); try { const client = await getClient(); const result = await (client as any).transaction.voidTransaction(resource.id, params); diff --git a/src/commands/generated/unbilled_charge.ts b/src/commands/generated/unbilled_charge.ts index e5bf485..04abcd9 100644 --- a/src/commands/generated/unbilled_charge.ts +++ b/src/commands/generated/unbilled_charge.ts @@ -24,13 +24,14 @@ export function registerUnbilledCharge(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs unbilled-charge create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_unbilled_charges_for_item_subscription", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "unbilled-charge create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_unbilled_charges_for_item_subscription", opIdV1: "", method: "POST", uri: "/unbilled_charges", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "unbilled-charge create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).unbilledCharge.create(params); @@ -45,13 +46,14 @@ export function registerUnbilledCharge(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs unbilled-charge create-unbilled-charge\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "", opIdV1: "create_unbilled_charges_for_a_subscription", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc1", "unbilled-charge create-unbilled-charge"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "", opIdV1: "create_unbilled_charges_for_a_subscription", method: "POST", uri: "/unbilled_charges/create", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "unbilled-charge create-unbilled-charge", opts.yes === true); try { const client = await getClient(); const result = await (client as any).unbilledCharge.createUnbilledCharge(params); @@ -67,14 +69,15 @@ export function registerUnbilledCharge(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs unbilled-charge delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_an_unbilled_charge", opIdV1: "delete_an_unbilled_charge", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_an_unbilled_charge", opIdV1: "delete_an_unbilled_charge", method: "POST", uri: "/unbilled_charges/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "unbilled-charge-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'unbilled-charge-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "unbilled-charge delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).unbilledCharge.delete(resource.id, params); @@ -89,12 +92,13 @@ export function registerUnbilledCharge(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs unbilled-charge invoice-now-estimate\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_an_estimate_for_unbilled_charges", opIdV1: "create_an_estimate_for_unbilled_charges", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_an_estimate_for_unbilled_charges", opIdV1: "create_an_estimate_for_unbilled_charges", method: "POST", uri: "/unbilled_charges/invoice_now_estimate", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "unbilled-charge invoice-now-estimate", opts.yes === true); try { const client = await getClient(); const result = await (client as any).unbilledCharge.invoiceNowEstimate(params); @@ -109,12 +113,13 @@ export function registerUnbilledCharge(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs unbilled-charge invoice-unbilled-charges\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_an_invoice_for_unbilled_charges", opIdV1: "create_an_invoice_for_unbilled_charges", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_an_invoice_for_unbilled_charges", opIdV1: "create_an_invoice_for_unbilled_charges", method: "POST", uri: "/unbilled_charges/invoice_unbilled_charges", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "unbilled-charge invoice-unbilled-charges", opts.yes === true); try { const client = await getClient(); const result = await (client as any).unbilledCharge.invoiceUnbilledCharges(params); diff --git a/src/commands/generated/usage.ts b/src/commands/generated/usage.ts index f777aa1..fbca5e7 100644 --- a/src/commands/generated/usage.ts +++ b/src/commands/generated/usage.ts @@ -24,15 +24,16 @@ export function registerUsage(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs usage create\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_usage", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "usage create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_usage", opIdV1: "", method: "POST", uri: "/subscriptions/{id}/usages", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "usage create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).usage.create(resource.id, params); @@ -48,15 +49,16 @@ export function registerUsage(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs usage delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_a_usage", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "usage delete"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_a_usage", opIdV1: "", method: "POST", uri: "/subscriptions/{id}/delete_usage", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "subscription-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'subscription-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "usage delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).usage.delete(resource.id, params); @@ -94,13 +96,14 @@ export function registerUsage(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs usage pdf\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "retrieve_usages_for_an_invoice_as_pdf", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "usage pdf"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "retrieve_usages_for_an_invoice_as_pdf", opIdV1: "", method: "POST", uri: "/usages/pdf", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "usage pdf", opts.yes === true); try { const client = await getClient(); const result = await (client as any).usage.pdf(params); diff --git a/src/commands/generated/usage_event.ts b/src/commands/generated/usage_event.ts index 6a445dd..d93a301 100644 --- a/src/commands/generated/usage_event.ts +++ b/src/commands/generated/usage_event.ts @@ -21,13 +21,14 @@ export function registerUsageEvent(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs usage-event batch-ingest\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: true, opIdV2: "ingest_usages_in_batch", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "usage-event batch-ingest"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "ingest_usages_in_batch", opIdV1: "", method: "POST", uri: "/batch/usage_events", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "usage-event batch-ingest", opts.yes === true); try { const client = await getClient(); const result = await (client as any).usageEvent.batchIngest(params); @@ -42,13 +43,14 @@ export function registerUsageEvent(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs usage-event create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: true, opIdV2: "create_a_usage_event", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "usage-event create"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_usage_event", opIdV1: "", method: "POST", uri: "/usage_events", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "usage-event create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).usageEvent.create(params); diff --git a/src/commands/generated/usage_file.ts b/src/commands/generated/usage_file.ts index d95fd05..9c7cab9 100644 --- a/src/commands/generated/usage_file.ts +++ b/src/commands/generated/usage_file.ts @@ -46,13 +46,14 @@ export function registerUsageFile(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs usage-file upload-url\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "get_usages_file_upload_url", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "usage-file upload-url"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "get_usages_file_upload_url", opIdV1: "", method: "POST", uri: "/usage_files/upload_url", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "usage-file upload-url", opts.yes === true); try { const client = await getClient(); const result = await (client as any).usageFile.uploadUrl(params); diff --git a/src/commands/generated/virtual_bank_account.ts b/src/commands/generated/virtual_bank_account.ts index d6b7375..b61c7a4 100644 --- a/src/commands/generated/virtual_bank_account.ts +++ b/src/commands/generated/virtual_bank_account.ts @@ -24,12 +24,13 @@ export function registerVirtualBankAccount(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs virtual-bank-account create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_virtual_bank_account", opIdV1: "create_a_virtual_bank_account", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_virtual_bank_account", opIdV1: "create_a_virtual_bank_account", method: "POST", uri: "/virtual_bank_accounts", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "virtual-bank-account create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).virtualBankAccount.create(params); @@ -44,12 +45,13 @@ export function registerVirtualBankAccount(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs virtual-bank-account create-using-permanent-token\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_virtual_bank_account_using_permanent_token", opIdV1: "create_a_virtual_bank_account_using_permanent_token", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_virtual_bank_account_using_permanent_token", opIdV1: "create_a_virtual_bank_account_using_permanent_token", method: "POST", uri: "/virtual_bank_accounts/create_using_permanent_token", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "virtual-bank-account create-using-permanent-token", opts.yes === true); try { const client = await getClient(); const result = await (client as any).virtualBankAccount.createUsingPermanentToken(params); @@ -65,14 +67,15 @@ export function registerVirtualBankAccount(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs virtual-bank-account delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_a_virtual_bank_account", opIdV1: "delete_a_virtual_bank_account", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_a_virtual_bank_account", opIdV1: "delete_a_virtual_bank_account", method: "POST", uri: "/virtual_bank_accounts/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "virtual-bank-account-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'virtual-bank-account-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "virtual-bank-account delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).virtualBankAccount.delete(resource.id, params); @@ -88,14 +91,15 @@ export function registerVirtualBankAccount(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs virtual-bank-account delete-local\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "local_delete_a_virtual_bank_account", opIdV1: "local_delete_a_virtual_bank_account", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "local_delete_a_virtual_bank_account", opIdV1: "local_delete_a_virtual_bank_account", method: "POST", uri: "/virtual_bank_accounts/{id}/delete_local", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "virtual-bank-account-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'virtual-bank-account-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "virtual-bank-account delete-local", opts.yes === true); try { const client = await getClient(); const result = await (client as any).virtualBankAccount.deleteLocal(resource.id, params); diff --git a/src/commands/generated/webhook_endpoint.ts b/src/commands/generated/webhook_endpoint.ts index 4242723..1ba922a 100644 --- a/src/commands/generated/webhook_endpoint.ts +++ b/src/commands/generated/webhook_endpoint.ts @@ -24,12 +24,13 @@ export function registerWebhookEndpoint(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs webhook-endpoint create\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "create_a_webhook_endpoint", opIdV1: "create_a_webhook_endpoint", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "create_a_webhook_endpoint", opIdV1: "create_a_webhook_endpoint", method: "POST", uri: "/webhook_endpoints", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "webhook-endpoint create", opts.yes === true); try { const client = await getClient(); const result = await (client as any).webhookEndpoint.create(params); @@ -45,14 +46,15 @@ export function registerWebhookEndpoint(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs webhook-endpoint delete\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "delete_a_webhook_endpoint", opIdV1: "delete_a_webhook_endpoint", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "delete_a_webhook_endpoint", opIdV1: "delete_a_webhook_endpoint", method: "POST", uri: "/webhook_endpoints/{id}/delete", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "webhook-endpoint-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'webhook-endpoint-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "webhook-endpoint delete", opts.yes === true); try { const client = await getClient(); const result = await (client as any).webhookEndpoint.delete(resource.id, params); @@ -112,14 +114,15 @@ export function registerWebhookEndpoint(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) + .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs webhook-endpoint update\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "update_a_webhook_endpoint", opIdV1: "update_a_webhook_endpoint", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "update_a_webhook_endpoint", opIdV1: "update_a_webhook_endpoint", method: "POST", uri: "/webhook_endpoints/{id}", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "webhook-endpoint-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'webhook-endpoint-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "webhook-endpoint update", opts.yes === true); try { const client = await getClient(); const result = await (client as any).webhookEndpoint.update(resource.id, params); diff --git a/src/commands/help.ts b/src/commands/help.ts index 29604e9..8dd2b69 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -80,7 +80,7 @@ export function renderHelp(program: Command, _version: string): string { lines.push(` ${"CLI source".padEnd(nameW)} https://github.com/chargebee/cli`); lines.push(""); - lines.push("Write operations are blocked on live sites; use a test site to change data."); + lines.push("Write operations on live sites ask for confirmation; scripts pass --yes."); lines.push('Run "chargebee --help" for details.'); return lines.join("\n"); diff --git a/src/lib/api/sdk.ts b/src/lib/api/sdk.ts index 3b9bd74..7c697e3 100644 --- a/src/lib/api/sdk.ts +++ b/src/lib/api/sdk.ts @@ -11,7 +11,14 @@ import { type ApiHost, } from "../config/host.js"; import { DEFAULT_REGION, parseRegion, type Region } from "../config/region.js"; -import { blockedWriteMessage, isWriteMethod, shouldBlockWrite } from "./write-gate.js"; +import { + isWriteMethod, + liveWriteDecision, + liveWriteNotice, + liveWritePrompt, + unconfirmedWriteMessage, +} from "./write-gate.js"; +import { canPrompt, confirm, isCancel } from "../prompts.js"; import { blockedCatalogMessage, shouldBlockCatalog, type CatalogTag } from "./catalog-gate.js"; import { markUnconfigured, recordTelemetryError } from "../telemetry/error.js"; import { maybeWarnUnproxiedNode } from "./proxy.js"; @@ -373,8 +380,11 @@ export async function ensureCatalogAllowed(opCatalog: CatalogTag, commandName: s exitCommand(EXIT_CODES.REFUSED, "catalog_refused"); } -/** Block writes on live sites. Unresolved credentials fail open so the API error surfaces. */ -export async function ensureWriteAllowed(method: string): Promise { +/** + * Require confirmation (prompt or `--yes`) for writes on live sites. + * Unresolved credentials fail open so the API error surfaces. + */ +export async function ensureWriteAllowed(method: string, commandName: string, yes = false): Promise { if (!isWriteMethod(method)) return; let site: string; @@ -385,11 +395,25 @@ export async function ensureWriteAllowed(method: string): Promise { return; // let the real call produce the configuration error } - if (!shouldBlockWrite({ method, site, apiKey })) return; + const decision = liveWriteDecision({ method, site, apiKey, yes, canPrompt: canPrompt() }); + if (decision === "allow") return; + + if (decision === "refuse") { + recordTelemetryError("write_blocked"); + diagnostic(unconfirmedWriteMessage(site, commandName)); + exitCommand(EXIT_CODES.REFUSED, "live_write_refused"); + } + + if (decision === "confirm") { + const ok = await confirm({ message: liveWritePrompt(site, commandName), initialValue: false }); + if (isCancel(ok) || !ok) { + recordTelemetryError("write_declined"); + diagnostic(` Cancelled. Nothing was changed on live site "${site}".`); + exitCommand(EXIT_CODES.REFUSED, "live_write_declined"); + } + } - recordTelemetryError("write_blocked"); - diagnostic(blockedWriteMessage(site)); - exitCommand(EXIT_CODES.REFUSED, "live_write_refused"); + diagnostic(liveWriteNotice(site)); } /** diff --git a/src/lib/api/write-gate.ts b/src/lib/api/write-gate.ts index 6194195..8073a52 100644 --- a/src/lib/api/write-gate.ts +++ b/src/lib/api/write-gate.ts @@ -1,8 +1,9 @@ /** - * Pure logic for the live-site read-only safety gate. + * Pure logic for the live-site write confirmation gate. * - * Live (production) sites are read-only: only read operations (GET) are - * permitted. This is a hard restriction with no override flag for now. + * Write operations on live (production) sites need explicit confirmation: an + * interactive yes/no prompt, or `--yes`. Without a terminal and without + * `--yes` the write is refused. * * Kept separate from `sdk.ts` (which imports the Chargebee SDK and is a common * mock target in tests) so this logic can be unit-tested in isolation. @@ -34,7 +35,7 @@ export function siteMode(site: string, apiKey?: string): "test" | "live" { return isLiveSite(site, apiKey) ? "live" : "test"; } -/** HTTP methods that mutate data. Live sites permit only reads (GET). */ +/** HTTP methods that mutate data. Live sites need confirmation for these. */ export function isWriteMethod(method: string): boolean { return method.toUpperCase() !== "GET"; } @@ -73,7 +74,7 @@ function hasReadOnlyActionPrefix(action: string): boolean { * `sdkName`/`sdkAction` pair used to call the SDK client) is read-only despite * using a non-GET HTTP method — e.g. `estimate.createSubscription`, * `portalSession.create`. Used by the generator to decide whether an - * operation needs the live-site write gate at all. + * operation needs the live-site write confirmation at all. */ export function isReadOnlyOperation(operationKey?: string): boolean { if (!operationKey) return false; @@ -89,21 +90,42 @@ export function isReadOnlyOperation(operationKey?: string): boolean { } /** - * Pure decision: should this operation be blocked? - * - * Live (production) sites are read-only — any write method is blocked. There is - * intentionally no override; this is a hard restriction for now. + * How a write should proceed: + * - `allow`: not a write, or not a live site — run without ceremony. + * - `allow_live`: live-site write confirmed up front with `--yes`. + * - `confirm`: live-site write that must be confirmed at an interactive prompt. + * - `refuse`: live-site write with no `--yes` and no way to prompt. */ -export function shouldBlockWrite(opts: { method: string; site: string; apiKey?: string }): boolean { - if (!isWriteMethod(opts.method)) return false; - return isLiveSite(opts.site, opts.apiKey); +export type WriteDecision = "allow" | "allow_live" | "confirm" | "refuse"; + +export function liveWriteDecision(opts: { + method: string; + site: string; + apiKey?: string; + yes: boolean; + canPrompt: boolean; +}): WriteDecision { + if (!isWriteMethod(opts.method) || !isLiveSite(opts.site, opts.apiKey)) return "allow"; + if (opts.yes) return "allow_live"; + return opts.canPrompt ? "confirm" : "refuse"; +} + +/** The question asked before a write on a live site. */ +export function liveWritePrompt(site: string, commandName: string): string { + return `Run "${commandName}" on LIVE site "${site}"? This changes production data.`; +} + +/** The stderr notice printed when a confirmed write runs on a live site. */ +export function liveWriteNotice(site: string): string { + return `${paint("33", "⚠")} Writing to live site "${site}".`; } -/** The message shown when a write is blocked on a live site. */ -export function blockedWriteMessage(site: string): string { +/** The message shown when a live-site write cannot be confirmed. */ +export function unconfirmedWriteMessage(site: string, commandName: string): string { return ( - `${paint("31", "✗")} Refusing to run a write operation on live site "${site}".\n\n` + - " Live (production) sites are read-only — only read operations (list, retrieve) are allowed.\n" + - ' Use a test site (name ending in "-test", or a test_ API key) to create, update, or delete data.\n' + `${paint("31", "✗")} Refusing to run a write operation on live site "${site}" without confirmation.\n\n` + + ` "${commandName}" changes data on a live (production) site.\n` + + " Re-run with --yes to confirm, or run it in a terminal to answer the prompt.\n" + + ' To experiment safely, use a test site (name ending in "-test", or a test_ API key).\n' ); } diff --git a/src/lib/skills/content/SKILL.md b/src/lib/skills/content/SKILL.md index fc19b31..9943e9b 100644 --- a/src/lib/skills/content/SKILL.md +++ b/src/lib/skills/content/SKILL.md @@ -39,7 +39,7 @@ chargebee auth status Check the connected site's Product Catalog when the operation is catalog-specific. -Use a **test site for writes**. Live sites are read-only. +Prefer a **test site for writes**. Writes on a live site need confirmation (see Live-site safety). ### 3. Execute @@ -68,9 +68,11 @@ For important changes, retrieve the resource afterward or inspect the command re ### Live-site safety -Write operations are blocked on live sites. Never attempt to bypass this protection. +Write operations on live (production) sites change real billing data and need confirmation. In a terminal the CLI asks yes/no; without one (as when an agent runs it) the command is refused with exit code `6` unless `--yes` is passed. -Use a test site for create, update, and delete operations. +- Use a test site for create, update, and delete operations unless the user explicitly asks to change the live site. +- Never add `--yes` to a write on a live site on your own. Before running it, tell the user the site and the exact command, and get their explicit confirmation for that write. +- If a live-site write is refused, report the refusal and ask the user; do not retry with `--yes` automatically. ### Product Catalog @@ -78,7 +80,7 @@ Chargebee supports Product Catalog 1.0 and 2.0. Catalog-specific operations are Do not bypass a catalog mismatch. -`--code-sample` follows the same catalog gate. The write gate does not apply because code generation does not execute an API request. +`--code-sample` follows the same catalog gate. The live-site write confirmation does not apply because code generation does not execute an API request. ### Code Samples diff --git a/src/lib/skills/content/references/commands.md b/src/lib/skills/content/references/commands.md index 95930f0..ea5eb82 100644 --- a/src/lib/skills/content/references/commands.md +++ b/src/lib/skills/content/references/commands.md @@ -223,14 +223,20 @@ chargebee customer create --code-sample list ### Live Sites -Create, update, and delete operations are blocked on live sites. +Create, update, delete, and other write operations on live sites need confirmation. A site is considered live unless: - the site name ends in `-test`, or - the API key starts with `test_` -Reads and explicitly allowed non-mutating operations can run on live sites. There is no write override. +On a live site: + +- In a terminal, the CLI asks `Run "" on LIVE site ""?` (default No). +- `-y` / `--yes` skips the prompt and runs the write. +- Without a terminal, in `--json` mode, or with a stdin JSON body, a write without `--yes` is refused with exit code `6` (`live_write_refused`). Declining the prompt also exits `6` (`live_write_declined`). + +Reads and explicitly allowed non-mutating operations (estimates, exports, hosted-page URLs) run on live sites without confirmation. Only pass `--yes` on a live site when the user has explicitly confirmed that write. ### Product Catalog diff --git a/src/lib/skills/content/references/workflows.md b/src/lib/skills/content/references/workflows.md index 062b6ac..db110b8 100644 --- a/src/lib/skills/content/references/workflows.md +++ b/src/lib/skills/content/references/workflows.md @@ -240,7 +240,7 @@ If a project skill path resolves to a global installation, it is global only: pr | Not configured | Run `chargebee auth add` or set both authentication environment variables. | | Invalid API key | Verify the key belongs to the configured site. | | Catalog mismatch | Check `chargebee auth status` and use the operation for that catalog. | -| Live-site write blocked | Switch to a test site. | +| Live-site write refused | Ask the user whether to change the live site; add `--yes` only after they confirm, otherwise use a test site. | | Unknown command/resource | Run `chargebee resources` or `chargebee --help`. | | Code sample unavailable | Use `chargebee docs ` for the API reference and construct the request from the documented parameters. | | Webhook listen blocked | Use a test site. | diff --git a/src/tests/cli/commands.test.ts b/src/tests/cli/commands.test.ts index 4c31eb9..1040546 100644 --- a/src/tests/cli/commands.test.ts +++ b/src/tests/cli/commands.test.ts @@ -38,7 +38,7 @@ describe("artifact command inventory", () => { } }); -it("blocks LIVE customer creation with the CLI's write-gate exit code", async () => { +it("refuses unconfirmed LIVE customer creation with the CLI's write-gate exit code", async () => { const result = await spawnCli(["customer", "create", "-d", "id=cb-gate-must-not-exist"], { extraEnv: { CHARGEBEE_SITE: "cb-gate-validation", CHARGEBEE_API_KEY: "live_synthetic_invalid" }, }); diff --git a/src/tests/integration/help.test.ts b/src/tests/integration/help.test.ts index c24c1dd..80c5dc0 100644 --- a/src/tests/integration/help.test.ts +++ b/src/tests/integration/help.test.ts @@ -130,7 +130,7 @@ describe("root help IA", () => { it("shows runnable examples and the live-site write gate", async () => { const { stdout } = await runCli(["--help"]); - expect(stdout).toContain("Write operations are blocked on live sites"); + expect(stdout).toContain("Write operations on live sites ask for confirmation"); expect(stdout).toContain('Run "chargebee --help" for details.'); const examples = stdout.split("\nEXAMPLES\n")[1]?.split("\n\n")[0]?.split("\n") ?? []; expect(examples.length).toBeGreaterThanOrEqual(3); diff --git a/src/tests/integration/live-site-write-gate.test.ts b/src/tests/integration/live-site-write-gate.test.ts index e551d28..503862f 100644 --- a/src/tests/integration/live-site-write-gate.test.ts +++ b/src/tests/integration/live-site-write-gate.test.ts @@ -1,26 +1,33 @@ /** - * Isolated CLI tests: the live-site write gate as emitted into the generated - * commands. A live site refuses mutating operations before any SDK client is - * constructed, still runs reads, and still runs the non-GET operations that - * only compute or generate URLs (estimates, exports). A test site runs writes. + * Isolated CLI tests: the live-site write confirmation as emitted into the + * generated commands. A live site refuses unconfirmed mutating operations before + * any SDK client is constructed, runs them once confirmed at the prompt or with + * --yes, still runs reads, and still runs the non-GET operations that only + * compute or generate URLs (estimates, exports). A test site runs writes. */ import { afterEach, beforeEach, describe, expect, it } from "bun:test"; import { mkdtempSync, rmSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; +import { __resetPromptsForTest, __setPromptsForTest } from "../../lib/prompts.js"; import { createEnvPatcher, installFakeClient, uninstallFakeClient, runCli, + setStdinIsTTY, + setStdoutIsTTY, type ClientConstruction, } from "../../lib/test-support/_helpers.js"; const REFUSAL = "Refusing to run a write operation on live site"; +const NOTICE = 'Writing to live site "acme"'; let configDir: string; let constructions: ClientConstruction[]; +let restoreTTY: Array<() => void>; +let prompts: string[]; const env = createEnvPatcher(); function useSite(site: string, apiKey: string): void { @@ -28,28 +35,45 @@ function useSite(site: string, apiKey: string): void { env.set("CHARGEBEE_API_KEY", apiKey); } +function useTerminal(answer: unknown): void { + restoreTTY.push(setStdinIsTTY(true), setStdoutIsTTY(true)); + const cancelled = Symbol("cancel"); + __setPromptsForTest({ + confirm: async ({ message }: { message: string }) => { + prompts.push(message); + return answer === "cancel" ? cancelled : answer; + }, + isCancel: (v) => v === cancelled, + }); +} + beforeEach(() => { configDir = mkdtempSync(join(tmpdir(), "cb-live-gate-")); env.set("CHARGEBEE_CONFIG_DIR", configDir); env.set("CHARGEBEE_ENV", undefined); env.set("CHARGEBEE_HOST", undefined); constructions = []; + prompts = []; + restoreTTY = [setStdinIsTTY(false), setStdoutIsTTY(false)]; installFakeClient({ constructions }); }); afterEach(() => { uninstallFakeClient(); + __resetPromptsForTest(); + for (const restore of restoreTTY.reverse()) restore(); env.restore(); rmSync(configDir, { recursive: true, force: true }); }); -describe("live site", () => { +describe("live site without a terminal", () => { beforeEach(() => useSite("acme", "live_key")); - it("refuses a plain write before constructing a client", async () => { + it("refuses an unconfirmed write before constructing a client", async () => { const result = await runCli(["customer", "create", "-d", "first_name=Ada"]); expect(result.exitCode).toBe(6); expect(result.stderr).toContain(REFUSAL); + expect(result.stderr).toContain("--yes"); expect(constructions).toHaveLength(0); }); @@ -60,6 +84,32 @@ describe("live site", () => { expect(constructions).toHaveLength(0); }); + it("runs a write confirmed with --yes", async () => { + const result = await runCli(["customer", "create", "-d", "first_name=Ada", "--yes"]); + expect(result.exitCode).toBe(0); + expect(result.stdout).toContain("cus_new_acme"); + expect(result.stderr).toContain(NOTICE); + }); + + it("accepts -y as the short form of --yes", async () => { + const result = await runCli(["customer", "create", "-y", "-d", "first_name=Ada"]); + expect(result.exitCode).toBe(0); + expect(result.stdout).toContain("cus_new_acme"); + }); + + it("refuses an unconfirmed write in --json mode with a structured error", async () => { + const result = await runCli(["--json", "customer", "create", "-d", "first_name=Ada"]); + expect(result.exitCode).toBe(6); + expect(JSON.parse(result.stderr).error.code).toBe("live_write_refused"); + expect(constructions).toHaveLength(0); + }); + + it("runs a write confirmed with --yes in --json mode", async () => { + const result = await runCli(["--json", "customer", "create", "-d", "first_name=Ada", "--yes"]); + expect(result.exitCode).toBe(0); + expect(result.stdout).toContain("cus_new_acme"); + }); + it("runs a GET read", async () => { const result = await runCli(["customer", "retrieve", "cus_1"]); expect(result.exitCode).toBe(0); @@ -86,6 +136,49 @@ describe("live site", () => { }); }); +describe("live site in a terminal", () => { + beforeEach(() => useSite("acme", "live_key")); + + it("runs the write after the user confirms", async () => { + useTerminal(true); + const result = await runCli(["customer", "create", "-d", "first_name=Ada"]); + expect(prompts).toEqual(['Run "customer create" on LIVE site "acme"? This changes production data.']); + expect(result.exitCode).toBe(0); + expect(result.stdout).toContain("cus_new_acme"); + expect(result.stderr).toContain(NOTICE); + }); + + it("refuses the write when the user declines", async () => { + useTerminal(false); + const result = await runCli(["customer", "update", "cus_1", "-d", "first_name=Ada"]); + expect(prompts).toHaveLength(1); + expect(result.exitCode).toBe(6); + expect(result.stderr).toContain('Nothing was changed on live site "acme"'); + expect(constructions).toHaveLength(0); + }); + + it("refuses the write when the prompt is cancelled", async () => { + useTerminal("cancel"); + const result = await runCli(["customer", "delete", "cus_1"]); + expect(result.exitCode).toBe(6); + expect(constructions).toHaveLength(0); + }); + + it("skips the prompt with --yes", async () => { + useTerminal(false); + const result = await runCli(["customer", "create", "-d", "first_name=Ada", "--yes"]); + expect(prompts).toHaveLength(0); + expect(result.exitCode).toBe(0); + }); + + it("does not prompt for reads", async () => { + useTerminal(false); + const result = await runCli(["customer", "retrieve", "cus_1"]); + expect(prompts).toHaveLength(0); + expect(result.exitCode).toBe(0); + }); +}); + describe("test site", () => { beforeEach(() => useSite("acme-test", "live_key")); @@ -93,5 +186,13 @@ describe("test site", () => { const result = await runCli(["customer", "create", "-d", "first_name=Ada"]); expect(result.exitCode).toBe(0); expect(result.stdout).toContain("cus_new_acme-test"); + expect(result.stderr).not.toContain("Writing to live site"); + }); + + it("never prompts in a terminal", async () => { + useTerminal(false); + const result = await runCli(["customer", "create", "-d", "first_name=Ada"]); + expect(prompts).toHaveLength(0); + expect(result.exitCode).toBe(0); }); }); diff --git a/src/tests/integration/profiles.test.ts b/src/tests/integration/profiles.test.ts index 1093842..def479a 100644 --- a/src/tests/integration/profiles.test.ts +++ b/src/tests/integration/profiles.test.ts @@ -5,7 +5,7 @@ * live Chargebee site and skips without `CB_TEST_*`), this suite runs the real * Commander program in-process against a fake SDK client. It therefore runs on * every PR — including forks — and closes the "skipped = unverified" gap for the - * credential-resolution flow and the read-only / catalog gates. + * credential-resolution flow and the live-site write / catalog gates. * * The fake client (see `src/lib/test-support/_helpers.ts`) records the resolved site/apiKey for each * call and returns canned responses whose ids embed the site, so we can assert @@ -405,8 +405,8 @@ describe("site name validation (host allowlist)", () => { }); }); -describe("read-only write gate", () => { - it("blocks a write on a live site", async () => { +describe("live-site write gate", () => { + it("refuses an unconfirmed write on a live site", async () => { await configureProfile("live", SITE_LIVE, KEY_LIVE); const { stderr, exitCode } = await runCli([ "customer", diff --git a/src/tests/unit/lib/api/sdk.coverage.test.ts b/src/tests/unit/lib/api/sdk.coverage.test.ts index 746942a..6958adc 100644 --- a/src/tests/unit/lib/api/sdk.coverage.test.ts +++ b/src/tests/unit/lib/api/sdk.coverage.test.ts @@ -117,11 +117,11 @@ describe("sdk coverage gaps", () => { }); it("ensureWriteAllowed is a no-op for GET", async () => { - await ensureWriteAllowed("GET"); + await ensureWriteAllowed("GET", "customer list"); }); it("ensureWriteAllowed fails open when nothing is configured", async () => { - await ensureWriteAllowed("POST"); + await ensureWriteAllowed("POST", "customer create"); }); it("ensureCatalogAllowed fails open when catalog metadata cannot be read", async () => { diff --git a/src/tests/unit/lib/api/write-gate.test.ts b/src/tests/unit/lib/api/write-gate.test.ts index 5630a04..82843cb 100644 --- a/src/tests/unit/lib/api/write-gate.test.ts +++ b/src/tests/unit/lib/api/write-gate.test.ts @@ -1,12 +1,14 @@ import { describe, expect, it } from "bun:test"; import { - blockedWriteMessage, isLiveSite, isReadOnlyOperation, isWriteMethod, - shouldBlockWrite, + liveWriteDecision, + liveWriteNotice, + liveWritePrompt, siteMode, + unconfirmedWriteMessage, } from "../../../../lib/api/write-gate.js"; describe("isLiveSite", () => { @@ -53,28 +55,35 @@ describe("isWriteMethod", () => { }); }); -describe("shouldBlockWrite", () => { - it("never blocks reads", () => { - expect(shouldBlockWrite({ method: "GET", site: "acme" })).toBe(false); +describe("liveWriteDecision", () => { + const decide = (o: { method?: string; site?: string; apiKey?: string; yes?: boolean; canPrompt?: boolean }) => + liveWriteDecision({ method: "POST", site: "acme", yes: false, canPrompt: false, ...o }); + + it("allows reads on any site, with or without a terminal", () => { + expect(decide({ method: "GET" })).toBe("allow"); + expect(decide({ method: "GET", canPrompt: true })).toBe("allow"); }); - it("never blocks writes on test sites", () => { - expect(shouldBlockWrite({ method: "POST", site: "acme-test" })).toBe(false); + it("allows writes on test sites without confirmation", () => { + expect(decide({ site: "acme-test" })).toBe("allow"); + expect(decide({ site: "acme-test", apiKey: "live_x" })).toBe("allow"); + expect(decide({ site: "acme", apiKey: "test_x" })).toBe("allow"); + expect(decide({ site: "acme-test", yes: true })).toBe("allow"); }); - it("always blocks writes on live sites (hard cap, no override)", () => { - expect(shouldBlockWrite({ method: "POST", site: "acme" })).toBe(true); - expect(shouldBlockWrite({ method: "DELETE", site: "acme" })).toBe(true); - expect(shouldBlockWrite({ method: "PUT", site: "acme" })).toBe(true); + it("asks for confirmation on a live site when a prompt is possible", () => { + expect(decide({ canPrompt: true })).toBe("confirm"); + expect(decide({ method: "DELETE", canPrompt: true })).toBe("confirm"); }); - it("respects key-prefix override (test_ key on a live-named site)", () => { - expect(shouldBlockWrite({ method: "POST", site: "acme", apiKey: "test_x" })).toBe(false); + it("refuses a live-site write that cannot be confirmed", () => { + expect(decide({})).toBe("refuse"); + expect(decide({ method: "PUT" })).toBe("refuse"); }); - it("blocks writes on a -test-named site only when the name says test", () => { - // -test name → test → allowed regardless of key. - expect(shouldBlockWrite({ method: "POST", site: "acme-test", apiKey: "live_x" })).toBe(false); + it("runs a live-site write confirmed with --yes, prompt or not", () => { + expect(decide({ yes: true })).toBe("allow_live"); + expect(decide({ yes: true, canPrompt: true })).toBe("allow_live"); }); }); @@ -135,18 +144,29 @@ describe("generated write gate emission (resource+action allowlist)", () => { expect(isGated("POST", "estimate.createSubscription")).toBe(false); }); - it("customer create stays gated (blocked on live, allowed on test site)", () => { + it("customer create stays gated (confirmed on live, allowed on test site)", () => { expect(isGated("POST", "customer.create")).toBe(true); - expect(shouldBlockWrite({ method: "POST", site: "acme" })).toBe(true); - expect(shouldBlockWrite({ method: "POST", site: "acme-test" })).toBe(false); + expect(liveWriteDecision({ method: "POST", site: "acme", yes: false, canPrompt: false })).toBe("refuse"); + expect(liveWriteDecision({ method: "POST", site: "acme-test", yes: false, canPrompt: false })).toBe("allow"); }); }); -describe("blockedWriteMessage", () => { - it("names the site and explains the restriction", () => { - const msg = blockedWriteMessage("acme"); - expect(msg).toContain('live site "acme"'); - expect(msg).toContain("read-only"); +describe("live-site write messages", () => { + it("refusal names the site and command and explains --yes", () => { + const msg = unconfirmedWriteMessage("acme", "customer create"); + expect(msg).toContain('Refusing to run a write operation on live site "acme"'); + expect(msg).toContain('"customer create"'); + expect(msg).toContain("--yes"); expect(msg).toContain("name ending in \"-test\", or a test_ API key"); }); + + it("prompt names the site and command", () => { + expect(liveWritePrompt("acme", "customer create")).toBe( + 'Run "customer create" on LIVE site "acme"? This changes production data.', + ); + }); + + it("notice names the site", () => { + expect(liveWriteNotice("acme")).toContain('Writing to live site "acme"'); + }); }); diff --git a/src/tests/unit/lib/ui/color.test.ts b/src/tests/unit/lib/ui/color.test.ts index 85494e8..8e83579 100644 --- a/src/tests/unit/lib/ui/color.test.ts +++ b/src/tests/unit/lib/ui/color.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; import { colorEnabled, paint } from "../../../../lib/ui/color.js"; -import { blockedWriteMessage } from "../../../../lib/api/write-gate.js"; +import { liveWriteNotice, unconfirmedWriteMessage } from "../../../../lib/api/write-gate.js"; const tty: Parameters[0] = { stdoutIsTTY: true, @@ -45,7 +45,8 @@ describe("colorEnabled", () => { const prev = process.env.NO_COLOR; process.env.NO_COLOR = "1"; try { - expect(blockedWriteMessage("acme")).not.toContain("\x1b"); + expect(unconfirmedWriteMessage("acme", "customer create")).not.toContain("\x1b"); + expect(liveWriteNotice("acme")).not.toContain("\x1b"); expect(paint("31", "x")).toBe("x"); } finally { if (prev === undefined) delete process.env.NO_COLOR; diff --git a/src/tools/generate.ts b/src/tools/generate.ts index 984fc4e..a6302a4 100644 --- a/src/tools/generate.ts +++ b/src/tools/generate.ts @@ -506,7 +506,10 @@ function generateResourceFile(r: Resource): string { const isWrite = op.method.toUpperCase() !== "GET" && !isReadOnlyOperation(`${r.sdkName}.${op.sdkAction}`); const list = isListOp(op.cliCommand); - const optsType = `{ data?: string[]; codeSample?: string; pcVersion?: string }`; + const optsType = isWrite + ? `{ data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }` + : `{ data?: string[]; codeSample?: string; pcVersion?: string }`; + const writeCheck = ` await ensureWriteAllowed("${op.method}", "${r.cliName} ${op.cliCommand}", opts.yes === true);`; const dataHelp = list ? "Parameters as key=value. List filters require an operator suffix (id[is]=…). Bare keys: limit, offset, include_deleted." : "Request parameters in key=value format; repeat for multiple fields"; @@ -531,6 +534,9 @@ function generateResourceFile(r: Resource): string { L.push(` .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)")`); // Preserve the existing override for scripts without foregrounding it in help. L.push(` .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp())`); + if (isWrite) { + L.push(` .option("-y, --yes", "Skip the confirmation prompt for writes on a live site")`); + } if (list) { L.push(` .addHelpText("after", "${listHelp}")`); } @@ -555,7 +561,7 @@ function generateResourceFile(r: Resource): string { } L.push(` if (!resource.id) command.error(${JSON.stringify(`error: missing required argument '${argument.name}'`)});`); L.push(` assertResourceId(resource.id, command);`); - if (isWrite) L.push(` await ensureWriteAllowed("${op.method}");`); + if (isWrite) L.push(writeCheck); L.push(` try {`); L.push(` const client = await getClient();`); L.push(` const result = await (client as any).${r.sdkName}.${op.sdkAction}(resource.id, ${sdkParams});`); @@ -571,7 +577,7 @@ function generateResourceFile(r: Resource): string { L.push(` if (fromStdin) warnBareJsonFilters(params, "${r.cliName}");`); L.push(` else warnBareListFilters(opts.data ?? [], "${r.cliName}");`); } - if (isWrite) L.push(` await ensureWriteAllowed("${op.method}");`); + if (isWrite) L.push(writeCheck); L.push(` try {`); L.push(` const client = await getClient();`); L.push(` const result = await (client as any).${r.sdkName}.${op.sdkAction}(${sdkParams});`); From 4acf7e9e6ed24a4ddbacb3d136a1c0334a721bd0 Mon Sep 17 00:00:00 2001 From: Muthiah Muralidharan Date: Wed, 4 Nov 2026 11:49:54 +0530 Subject: [PATCH 2/6] chore(codegen): regenerate commands from latest OpenAPI spec Co-authored-by: Cursor --- src/commands/generated/.openapi-source-sha | 2 +- src/commands/generated/dispute.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/commands/generated/.openapi-source-sha b/src/commands/generated/.openapi-source-sha index dcf540b..2fd86fe 100644 --- a/src/commands/generated/.openapi-source-sha +++ b/src/commands/generated/.openapi-source-sha @@ -1 +1 @@ -62be342fa9029a5a4a80826fb63b8d1ca6dfd8c5 +480b6b1a9a3a38b42ea8d8ea476c5f579b2eb0ae diff --git a/src/commands/generated/dispute.ts b/src/commands/generated/dispute.ts index 728260d..1e9b407 100644 --- a/src/commands/generated/dispute.ts +++ b/src/commands/generated/dispute.ts @@ -19,7 +19,7 @@ export function registerDispute(parent: Command): void { cmd .command("list") .argument("[json]", "'-' reads a JSON object from stdin.") - .description("List disputes") + .description("List Disputes") .option("-d, --data ", "Parameters as key=value. List filters require an operator suffix (id[is]=…). Bare keys: limit, offset, include_deleted.") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) @@ -40,9 +40,9 @@ export function registerDispute(parent: Command): void { cmd .command("retrieve") - .argument("[dispute-id]", "Dispute identifier.") + .argument("[dispute-id]", "Uniquely identifies the dispute.") .argument("[json]", "'-' reads a JSON object from stdin.") - .description("Retrieve a dispute") + .description("Retrieve A Dispute") .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) From d6659c6902f4aca9b25199bcf1659db780215461 Mon Sep 17 00:00:00 2001 From: Muthiah Muralidharan Date: Wed, 4 Nov 2026 12:33:37 +0530 Subject: [PATCH 3/6] fix(cli): treat CI runners as non-interactive for live-site writes Co-authored-by: Cursor --- AGENTS.md | 2 +- src/lib/api/sdk.ts | 5 ++++- src/lib/skills/content/references/commands.md | 2 +- .../integration/live-site-write-gate.test.ts | 21 ++++++++++++++++++- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 27396c9..8550df4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -111,7 +111,7 @@ Do not introduce additional credential storage paths without an explicit require Generated API commands enforce two protections: -- **Write gate:** Write operations on live sites require confirmation: an interactive yes/no prompt, or `-y/--yes`. Without a terminal (or in `--json` mode) and without `--yes`, the write is refused with exit code 6. Test sites, reads, and non-mutating POSTs (estimates, exports, hosted-page URLs) never prompt. +- **Write gate:** Write operations on live sites require confirmation: an interactive yes/no prompt, or `-y/--yes`. Without a terminal (or on a CI runner, or in `--json` mode) and without `--yes`, the write is refused with exit code 6. Test sites, reads, and non-mutating POSTs (estimates, exports, hosted-page URLs) never prompt. - **Catalog gate:** Product Catalog-specific operations are blocked when they do not match the configured site's catalog version. For `--code-sample`, the **write gate does not apply** because no API request is executed. The **catalog gate still applies** so generated code matches the site's Product Catalog version. diff --git a/src/lib/api/sdk.ts b/src/lib/api/sdk.ts index 7c697e3..bdd49fc 100644 --- a/src/lib/api/sdk.ts +++ b/src/lib/api/sdk.ts @@ -19,6 +19,7 @@ import { unconfirmedWriteMessage, } from "./write-gate.js"; import { canPrompt, confirm, isCancel } from "../prompts.js"; +import { detectIsCi } from "../telemetry/metadata.js"; import { blockedCatalogMessage, shouldBlockCatalog, type CatalogTag } from "./catalog-gate.js"; import { markUnconfigured, recordTelemetryError } from "../telemetry/error.js"; import { maybeWarnUnproxiedNode } from "./proxy.js"; @@ -395,7 +396,9 @@ export async function ensureWriteAllowed(method: string, commandName: string, ye return; // let the real call produce the configuration error } - const decision = liveWriteDecision({ method, site, apiKey, yes, canPrompt: canPrompt() }); + // CI runners can allocate pseudo-terminals; nobody is there to answer the prompt. + const interactive = canPrompt() && !detectIsCi(); + const decision = liveWriteDecision({ method, site, apiKey, yes, canPrompt: interactive }); if (decision === "allow") return; if (decision === "refuse") { diff --git a/src/lib/skills/content/references/commands.md b/src/lib/skills/content/references/commands.md index ea5eb82..cb4aad6 100644 --- a/src/lib/skills/content/references/commands.md +++ b/src/lib/skills/content/references/commands.md @@ -234,7 +234,7 @@ On a live site: - In a terminal, the CLI asks `Run "" on LIVE site ""?` (default No). - `-y` / `--yes` skips the prompt and runs the write. -- Without a terminal, in `--json` mode, or with a stdin JSON body, a write without `--yes` is refused with exit code `6` (`live_write_refused`). Declining the prompt also exits `6` (`live_write_declined`). +- Without a terminal, on a CI runner, in `--json` mode, or with a stdin JSON body, a write without `--yes` is refused with exit code `6` (`live_write_refused`). Declining the prompt also exits `6` (`live_write_declined`). Reads and explicitly allowed non-mutating operations (estimates, exports, hosted-page URLs) run on live sites without confirmation. Only pass `--yes` on a live site when the user has explicitly confirmed that write. diff --git a/src/tests/integration/live-site-write-gate.test.ts b/src/tests/integration/live-site-write-gate.test.ts index 503862f..601e285 100644 --- a/src/tests/integration/live-site-write-gate.test.ts +++ b/src/tests/integration/live-site-write-gate.test.ts @@ -12,6 +12,7 @@ import { join } from "node:path"; import { __resetPromptsForTest, __setPromptsForTest } from "../../lib/prompts.js"; import { + clearCiEnv, createEnvPatcher, installFakeClient, uninstallFakeClient, @@ -36,7 +37,7 @@ function useSite(site: string, apiKey: string): void { } function useTerminal(answer: unknown): void { - restoreTTY.push(setStdinIsTTY(true), setStdoutIsTTY(true)); + restoreTTY.push(setStdinIsTTY(true), setStdoutIsTTY(true), clearCiEnv()); const cancelled = Symbol("cancel"); __setPromptsForTest({ confirm: async ({ message }: { message: string }) => { @@ -171,6 +172,24 @@ describe("live site in a terminal", () => { expect(result.exitCode).toBe(0); }); + it("refuses instead of prompting when a CI runner allocates a terminal", async () => { + useTerminal(true); + env.set("CI", "true"); + const result = await runCli(["customer", "create", "-d", "first_name=Ada"]); + expect(prompts).toHaveLength(0); + expect(result.exitCode).toBe(6); + expect(result.stderr).toContain(REFUSAL); + expect(constructions).toHaveLength(0); + }); + + it("runs a write confirmed with --yes on a CI runner with a terminal", async () => { + useTerminal(false); + env.set("CI", "true"); + const result = await runCli(["customer", "create", "-d", "first_name=Ada", "--yes"]); + expect(prompts).toHaveLength(0); + expect(result.exitCode).toBe(0); + }); + it("does not prompt for reads", async () => { useTerminal(false); const result = await runCli(["customer", "retrieve", "cus_1"]); From 5c99351b9c721904733182d689ef324ffe71ead8 Mon Sep 17 00:00:00 2001 From: Muthiah Muralidharan Date: Wed, 4 Nov 2026 14:41:33 +0530 Subject: [PATCH 4/6] fix(cli): exempt PDF download-URL retrieval from the live-site write gate Co-authored-by: Cursor --- AGENTS.md | 2 +- src/commands/generated/credit_note.ts | 4 +--- src/commands/generated/invoice.ts | 4 +--- src/commands/generated/quote.ts | 4 +--- src/commands/generated/usage.ts | 4 +--- src/lib/api/write-gate.ts | 8 +++++++- src/lib/skills/content/references/commands.md | 2 +- src/lib/test-support/_helpers.ts | 3 +++ src/tests/integration/live-site-write-gate.test.ts | 11 ++++++++++- src/tests/unit/lib/api/write-gate.test.ts | 11 +++++++++++ 10 files changed, 37 insertions(+), 16 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 8550df4..5b64ec4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -111,7 +111,7 @@ Do not introduce additional credential storage paths without an explicit require Generated API commands enforce two protections: -- **Write gate:** Write operations on live sites require confirmation: an interactive yes/no prompt, or `-y/--yes`. Without a terminal (or on a CI runner, or in `--json` mode) and without `--yes`, the write is refused with exit code 6. Test sites, reads, and non-mutating POSTs (estimates, exports, hosted-page URLs) never prompt. +- **Write gate:** Write operations on live sites require confirmation: an interactive yes/no prompt, or `-y/--yes`. Without a terminal (or on a CI runner, or in `--json` mode) and without `--yes`, the write is refused with exit code 6. Test sites, reads, and non-mutating POSTs (estimates, exports, hosted-page URLs, PDF downloads) never prompt. - **Catalog gate:** Product Catalog-specific operations are blocked when they do not match the configured site's catalog version. For `--code-sample`, the **write gate does not apply** because no API request is executed. The **catalog gate still applies** so generated code matches the site's Product Catalog version. diff --git a/src/commands/generated/credit_note.ts b/src/commands/generated/credit_note.ts index a30a09d..9968a21 100644 --- a/src/commands/generated/credit_note.ts +++ b/src/commands/generated/credit_note.ts @@ -157,15 +157,13 @@ export function registerCreditNote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) - .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs credit-note pdf\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "retrieve_credit_note_as_pdf", opIdV1: "retrieve_credit_note_as_pdf", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "retrieve_credit_note_as_pdf", opIdV1: "retrieve_credit_note_as_pdf", method: "POST", uri: "/credit_notes/{id}/pdf", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "credit-note-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'credit-note-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST", "credit-note pdf", opts.yes === true); try { const client = await getClient(); const result = await (client as any).creditNote.pdf(resource.id, params); diff --git a/src/commands/generated/invoice.ts b/src/commands/generated/invoice.ts index a1f5179..73ef1cb 100644 --- a/src/commands/generated/invoice.ts +++ b/src/commands/generated/invoice.ts @@ -551,15 +551,13 @@ export function registerInvoice(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) - .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs invoice pdf\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "retrieve_invoice_as_pdf", opIdV1: "retrieve_invoice_as_pdf", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "retrieve_invoice_as_pdf", opIdV1: "retrieve_invoice_as_pdf", method: "POST", uri: "/invoices/{id}/pdf", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "invoice-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'invoice-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST", "invoice pdf", opts.yes === true); try { const client = await getClient(); const result = await (client as any).invoice.pdf(resource.id, params); diff --git a/src/commands/generated/quote.ts b/src/commands/generated/quote.ts index a72b557..657b7b8 100644 --- a/src/commands/generated/quote.ts +++ b/src/commands/generated/quote.ts @@ -386,15 +386,13 @@ export function registerQuote(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) - .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs quote pdf\n") - .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { + .action(async (id: string | undefined, json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { const resource = takeResourceId(id, json, command); const params = await loadOperationParams(opts.data ?? [], resource.fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "retrieve_quote_as_pdf", opIdV1: "retrieve_quote_as_pdf", pcVersionFlag: opts.pcVersion }); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "retrieve_quote_as_pdf", opIdV1: "retrieve_quote_as_pdf", method: "POST", uri: "/quotes/{id}/pdf", dataFlags: opts.data ?? [], params, resourceId: resource.id, pathParamName: "quote-id", pcVersionFlag: opts.pcVersion }); if (!resource.id) command.error("error: missing required argument 'quote-id'"); assertResourceId(resource.id, command); - await ensureWriteAllowed("POST", "quote pdf", opts.yes === true); try { const client = await getClient(); const result = await (client as any).quote.pdf(resource.id, params); diff --git a/src/commands/generated/usage.ts b/src/commands/generated/usage.ts index fbca5e7..3e8a052 100644 --- a/src/commands/generated/usage.ts +++ b/src/commands/generated/usage.ts @@ -96,14 +96,12 @@ export function registerUsage(parent: Command): void { .option("-d, --data ", "Request parameters in key=value format; repeat for multiple fields") .option("-s, --code-sample ", "Generate code sample (curl, python, nodejs, go, ruby, java, php, dotnet, list)") .addOption(new Option("--pc-version ", "Product catalog version for the code sample (v1 or v2)").hideHelp()) - .option("-y, --yes", "Skip the confirmation prompt for writes on a live site") .addHelpText("after", "\n\u001b[1mDOCUMENTATION\u001b[0m\n chargebee docs usage pdf\n") - .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string; yes?: boolean }, command: Command) => { + .action(async (json: string | undefined, opts: { data?: string[]; codeSample?: string; pcVersion?: string }, command: Command) => { const fromStdin = readJsonMarker(json, command); const params = await loadOperationParams(opts.data ?? [], fromStdin, command, { method: "POST", jsonInput: false, opIdV2: "retrieve_usages_for_an_invoice_as_pdf", opIdV1: "", pcVersionFlag: opts.pcVersion }); if (opts.codeSample !== "list") await ensureCatalogAllowed("pc2", "usage pdf"); if (opts.codeSample) return handleCodeSample({ lang: opts.codeSample, opIdV2: "retrieve_usages_for_an_invoice_as_pdf", opIdV1: "", method: "POST", uri: "/usages/pdf", dataFlags: opts.data ?? [], params, pcVersionFlag: opts.pcVersion }); - await ensureWriteAllowed("POST", "usage pdf", opts.yes === true); try { const client = await getClient(); const result = await (client as any).usage.pdf(params); diff --git a/src/lib/api/write-gate.ts b/src/lib/api/write-gate.ts index 8073a52..d5edbfa 100644 --- a/src/lib/api/write-gate.ts +++ b/src/lib/api/write-gate.ts @@ -55,7 +55,13 @@ const READ_ONLY_RESOURCES = new Set(["estimate", "export", "hostedPage"]); const MUTATING_OPERATIONS = new Set(["hostedPage.acknowledge", "hostedPage.events"]); /** Individual `resource.action` operations that are read-only despite their method. */ -const READ_ONLY_OPERATIONS = new Set(["portalSession.create"]); +const READ_ONLY_OPERATIONS = new Set([ + "portalSession.create", + "invoice.pdf", + "quote.pdf", + "creditNote.pdf", + "usage.pdf", +]); /** Action-name verbs (camelCase word boundary) that are read-only regardless of resource. */ const READ_ONLY_ACTION_PREFIXES = ["retrieve", "list", "preview", "calculate", "check", "validate"]; diff --git a/src/lib/skills/content/references/commands.md b/src/lib/skills/content/references/commands.md index cb4aad6..194bd19 100644 --- a/src/lib/skills/content/references/commands.md +++ b/src/lib/skills/content/references/commands.md @@ -236,7 +236,7 @@ On a live site: - `-y` / `--yes` skips the prompt and runs the write. - Without a terminal, on a CI runner, in `--json` mode, or with a stdin JSON body, a write without `--yes` is refused with exit code `6` (`live_write_refused`). Declining the prompt also exits `6` (`live_write_declined`). -Reads and explicitly allowed non-mutating operations (estimates, exports, hosted-page URLs) run on live sites without confirmation. Only pass `--yes` on a live site when the user has explicitly confirmed that write. +Reads and explicitly allowed non-mutating operations (estimates, exports, hosted-page URLs, PDF downloads) run on live sites without confirmation. Only pass `--yes` on a live site when the user has explicitly confirmed that write. ### Product Catalog diff --git a/src/lib/test-support/_helpers.ts b/src/lib/test-support/_helpers.ts index 90f230c..b931b8d 100644 --- a/src/lib/test-support/_helpers.ts +++ b/src/lib/test-support/_helpers.ts @@ -86,6 +86,9 @@ export function installFakeClient(opts: FakeClientOptions): void { export: { customers: async () => sdkResult({ export: { id: `exp_${site}` } }), }, + invoice: { + pdf: async () => sdkResult({ download: { download_url: `https://example.com/${site}.pdf` } }), + }, plan: { list: async () => sdkResult({ list: [{ plan: { id: `plan_${site}` } }] }), }, diff --git a/src/tests/integration/live-site-write-gate.test.ts b/src/tests/integration/live-site-write-gate.test.ts index 601e285..a7bb223 100644 --- a/src/tests/integration/live-site-write-gate.test.ts +++ b/src/tests/integration/live-site-write-gate.test.ts @@ -62,8 +62,10 @@ beforeEach(() => { afterEach(() => { uninstallFakeClient(); __resetPromptsForTest(); - for (const restore of restoreTTY.reverse()) restore(); + // env.set() snapshots CI after clearCiEnv() removed it; undo env first so + // clearCiEnv()'s restore puts the original CI value back last. env.restore(); + for (const restore of restoreTTY.reverse()) restore(); rmSync(configDir, { recursive: true, force: true }); }); @@ -129,6 +131,13 @@ describe("live site without a terminal", () => { expect(result.stdout).toContain("est_acme"); }); + it("runs a POST PDF download-URL retrieval", async () => { + const result = await runCli(["invoice", "pdf", "inv_1"]); + expect(result.exitCode).toBe(0); + expect(result.stderr).not.toContain(REFUSAL); + expect(result.stdout).toContain("acme.pdf"); + }); + it("runs a POST export", async () => { const result = await runCli(["export", "customers"]); expect(result.exitCode).toBe(0); diff --git a/src/tests/unit/lib/api/write-gate.test.ts b/src/tests/unit/lib/api/write-gate.test.ts index 82843cb..ad4fea8 100644 --- a/src/tests/unit/lib/api/write-gate.test.ts +++ b/src/tests/unit/lib/api/write-gate.test.ts @@ -110,6 +110,17 @@ describe("isReadOnlyOperation", () => { expect(isReadOnlyOperation("portalSession.logout")).toBe(false); }); + it("allows PDF download-URL retrieval despite its POST method", () => { + for (const key of ["invoice.pdf", "quote.pdf", "creditNote.pdf", "usage.pdf"]) { + expect(isReadOnlyOperation(key)).toBe(true); + } + }); + + it("keeps POSTs with side effects gated even when their names read like lookups", () => { + expect(isReadOnlyOperation("paymentSource.exportPaymentSource")).toBe(false); + expect(isReadOnlyOperation("usageFile.uploadUrl")).toBe(false); + }); + it("allows actions whose name starts with a read-only verb", () => { expect(isReadOnlyOperation("inAppSubscription.retrieveStoreSubs")).toBe(true); expect(isReadOnlyOperation("quote.retrieveSignedPdf")).toBe(true); From 45f75730f7ca72516484fb857c4e27ff2038934e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 29 Oct 2026 13:52:23 +0000 Subject: [PATCH 5/6] ci: bump the actions group across 1 directory with 4 updates Bumps the actions group with 4 updates in the / directory: [actions/setup-node](https://github.com/actions/setup-node), [actions/upload-artifact](https://github.com/actions/upload-artifact), [actions/create-github-app-token](https://github.com/actions/create-github-app-token) and [actions/download-artifact](https://github.com/actions/download-artifact). Updates `actions/setup-node` from 7.0.0 to 7.1.0 - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/820762786026740c76f36085b0efc47a31fe5020...949feb2413d6458794dcd2491c4babbbce0c15c1) Updates `actions/upload-artifact` from 7.0.1 to 7.0.2 - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/043fb46d1a93c77aae656e7c1c64a875d1fc6a0a...cf430e030ddbb5b0abf93d22962f4752f3646cd9) Updates `actions/create-github-app-token` from 2.2.2 to 3.3.0 - [Release notes](https://github.com/actions/create-github-app-token/releases) - [Changelog](https://github.com/actions/create-github-app-token/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/create-github-app-token/compare/fee1f7d63c2ff003460e3d139729b119787bc349...64ab729a6294000f5aa4a4bc0b73d1f32bc45510) Updates `actions/download-artifact` from 8.0.1 to 8.0.2 - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c...9000827ccba6bdab643e8b6fd33ac0654aef8333) --- updated-dependencies: - dependency-name: actions/create-github-app-token dependency-version: 3.3.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: actions/download-artifact dependency-version: 8.0.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: actions/setup-node dependency-version: 7.1.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: actions/upload-artifact dependency-version: 7.0.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 4 ++-- .github/workflows/install-smoke.yml | 2 +- .github/workflows/live-tests.yml | 2 +- .github/workflows/reconcile-openapi.yml | 2 +- .github/workflows/release-please.yml | 12 ++++++------ 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f13e42..312750e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,7 +78,7 @@ jobs: with: bun-version: "1.4.2" - - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: ${{ matrix.node }} @@ -139,7 +139,7 @@ jobs: VERSION: ${{ github.ref_name }} - name: Upload artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: ${{ matrix.outfile }} path: dist/${{ matrix.outfile }} diff --git a/.github/workflows/install-smoke.yml b/.github/workflows/install-smoke.yml index 31a631c..7538bbd 100644 --- a/.github/workflows/install-smoke.yml +++ b/.github/workflows/install-smoke.yml @@ -105,7 +105,7 @@ jobs: with: persist-credentials: false - - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: ${{ matrix.node }} diff --git a/.github/workflows/live-tests.yml b/.github/workflows/live-tests.yml index ba52176..bb7c9c8 100644 --- a/.github/workflows/live-tests.yml +++ b/.github/workflows/live-tests.yml @@ -56,7 +56,7 @@ jobs: - run: bun install --frozen-lockfile - - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: "22" diff --git a/.github/workflows/reconcile-openapi.yml b/.github/workflows/reconcile-openapi.yml index 8d4baf2..3f572dd 100644 --- a/.github/workflows/reconcile-openapi.yml +++ b/.github/workflows/reconcile-openapi.yml @@ -166,7 +166,7 @@ jobs: - name: Create pull-request token if: steps.changes.outputs.changed == 'true' id: app-token - uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2 + uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 with: app-id: ${{ secrets.CB_SDK_BOT_APP_ID }} private-key: ${{ secrets.CB_SDK_BOT_PEM_KEY }} diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index d21c7e8..06b9648 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -69,7 +69,7 @@ jobs: - name: Create release PR approval token if: steps.rp.outputs.release_created != 'true' id: release-approval-token - uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2 + uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 with: app-id: ${{ secrets.CB_SDK_BOT_APP_ID }} private-key: ${{ secrets.CB_SDK_BOT_PEM_KEY }} @@ -186,7 +186,7 @@ jobs: VERSION: ${{ needs.release-please.outputs.tag_name }} - name: Upload artifact - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: ${{ matrix.outfile }} path: dist/${{ matrix.outfile }} @@ -202,7 +202,7 @@ jobs: with: persist-credentials: false - - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: path: dist/ merge-multiple: true @@ -235,7 +235,7 @@ jobs: with: persist-credentials: false - - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: "22.23.2" registry-url: "https://registry.npmjs.org" @@ -309,7 +309,7 @@ jobs: with: persist-credentials: false - - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: "22.23.2" registry-url: "https://registry.npmjs.org" @@ -421,7 +421,7 @@ jobs: with: persist-credentials: false - - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: ${{ matrix.node }} registry-url: "https://registry.npmjs.org" From 6ac0ef76217086eb1f1d597cdbd3bbe4f7c317ac Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:30:21 +0000 Subject: [PATCH 6/6] build: bump @types/bun Bumps the dev-dependencies group with 1 update in the / directory: [@types/bun](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/bun). Updates `@types/bun` from 1.4.2 to 1.4.4 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/bun) --- updated-dependencies: - dependency-name: "@types/bun" dependency-version: 1.4.3 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: dev-dependencies ... Signed-off-by: dependabot[bot] --- bun.lock | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bun.lock b/bun.lock index ddd40d9..223fc17 100644 --- a/bun.lock +++ b/bun.lock @@ -7,7 +7,7 @@ "devDependencies": { "@chargebee/code-sample-generator": "1.1.1", "@clack/prompts": "^1.8.1", - "@types/bun": "1.4.2", + "@types/bun": "1.4.4", "chargebee": "^3.34.0", "commander": "^15.0.0", "typescript": "^7.0.2", @@ -35,7 +35,7 @@ "@shikijs/vscode-textmate": ["@shikijs/vscode-textmate@10.0.2", "", {}, "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg=="], - "@types/bun": ["@types/bun@1.4.2", "", { "dependencies": { "bun-types": "1.4.2" } }, "sha512-GimotNn7+ZV0uVArItBbriZsR1oNf0+WTzPkdcFrzShI7k2norL0uzEaJT8T33dWr7O/c9ZDuAFQrctKCi72oQ=="], + "@types/bun": ["@types/bun@1.4.4", "", { "dependencies": { "bun-types": "1.4.4" } }, "sha512-9wkRDXUXK124pEnAutE6n/l18j+i9GC5IAHK8TmX/2nlySETmky0OU6yL5U8pW1AoKh++AN9auDCr647BfurjQ=="], "@types/hast": ["@types/hast@3.0.4", "", { "dependencies": { "@types/unist": "*" } }, "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ=="], @@ -87,7 +87,7 @@ "@ungap/structured-clone": ["@ungap/structured-clone@1.3.0", "", {}, "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g=="], - "bun-types": ["bun-types@1.4.2", "", { "dependencies": { "@types/node": "*" } }, "sha512-bxV1FgK7yBIzjRe5zBozIM4Bem11ZJcCXSrjWRG3YWLt8yFDePu4cLjpebO8OvPeIE9trbyPF4fuj3Cia4Fj3w=="], + "bun-types": ["bun-types@1.4.4", "", { "dependencies": { "@types/node": "*", "undici-types": "*" } }, "sha512-yjrJh5oGX7mMPKGd19YXyIjmEuj4G4zNC30bs7PM9Az7NQ3ndF3j6hbeRdvJTRQEhJ/FYQwW0a2moweEi2hMxQ=="], "ccount": ["ccount@2.0.1", "", {}, "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg=="], diff --git a/package.json b/package.json index d5fcbb0..a55c1c4 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "devDependencies": { "@chargebee/code-sample-generator": "1.1.1", "@clack/prompts": "^1.8.1", - "@types/bun": "1.4.2", + "@types/bun": "1.4.4", "chargebee": "^3.34.0", "commander": "^15.0.0", "typescript": "^7.0.2"