From 909e0ff99c683903b0995180fb18759dc0e1f62a Mon Sep 17 00:00:00 2001 From: KBbitsP <75751774+KBbitsP@users.noreply.github.com> Date: Sun, 29 Oct 2023 15:00:19 +0530 Subject: [PATCH 1/2] Python Snippets for Catalog.md Python Snippets for Catalog.md --- source/includes/_catalog.md | 102 ++++++++++++++++++++---------------- 1 file changed, 57 insertions(+), 45 deletions(-) diff --git a/source/includes/_catalog.md b/source/includes/_catalog.md index 7cb29cee..d335de81 100644 --- a/source/includes/_catalog.md +++ b/source/includes/_catalog.md @@ -100,13 +100,14 @@ KillBillClient::Model::Catalog.upload_tenant_catalog(catalog_file_xml, ``` ```python -catalogApi = killbill.api.CatalogApi() +catalogApi = killbill.CatalogApi() + xml_catalog = open("../resources/SpyCarBasic.xml", "r+").read() catalogApi.upload_catalog_xml(xml_catalog, - created_by, - api_key, - api_secret) + created_by='demo', + reason='reason', + comment='comment') ``` **Request Body** @@ -169,9 +170,9 @@ KillBillClient::Model::Catalog.get_tenant_catalog_xml(requested_date, ``` ```python -catalogApi = killbill.api.CatalogApi() +catalogApi = killbill.CatalogApi() -catalogApi.get_catalog_xml(api_key, api_secret) +catalogXml = catalogApi.get_catalog_xml() ``` > Example Response: @@ -446,9 +447,9 @@ KillBillClient::Model::Catalog.get_tenant_catalog_json.(requested_date, ``` ```python -catalogApi = killbill.api.CatalogApi() +catalogApi = killbill.CatalogApi() -catalogApi.get_catalog_json(api_key, api_secret) +catalogJson = catalogApi.get_catalog_json() ``` > Example Response: @@ -657,9 +658,9 @@ KillBillClient::Model::Catalog.get_tenant_catalog_versions(options) ``` ```python -catalogApi = killbill.api.CatalogApi() +catalogApi = killbill.CatalogApi() -catalogApi.get_catalog_versions(api_key, api_secret) +catalogVersions = catalogApi.get_catalog_versions() ``` > Example Response: @@ -714,9 +715,9 @@ KillBillClient::Model::Catalog.available_base_plans(options) ``` ```python -catalogApi = killbill.api.CatalogApi() +catalogApi = killbill.CatalogApi() -catalogApi.get_available_base_plans(api_key, api_secret) +availableBasePlans = catalogApi.get_available_base_plans() ``` > Example Response: @@ -808,11 +809,9 @@ KillBillClient::Model::Catalog.available_addons(base_product_name, ``` ```python -catalogApi = killbill.api.CatalogApi() +catalogApi = killbill.CatalogApi() -catalogApi.get_available_addons(api_key, - api_secret, - base_product_name='Basic') +availableAddOnPlans = catalogApi.get_available_addons(base_product_name='Basic') ``` > Example Response: @@ -882,9 +881,11 @@ KillBillClient::Model::Catalog.delete_catalog(user, ``` ```python -catalogApi = killbill.api.CatalogApi() +catalogApi = killbill.CatalogApi() -catalogApi.delete_catalog(created_by, api_key, api_secret) +catalogApi.delete_catalog(created_by='demo', + reason='reason', + comment='comment') ``` **Query Parameters** @@ -941,7 +942,14 @@ TODO ``` ```python -TODO +catalogApi = killbill.CatalogApi() + +xml_catalog = open("H:/killbill/catalog.xml", "r+").read() + +catalogValidationErrors = catalogApi.validate_catalog_xml(xml_catalog, + created_by='demo', + reason='reason', + comment='comment') ``` > Example Response: @@ -1004,11 +1012,11 @@ KillBillClient::Model::Catalog.get_catalog_phase(subscription_id, ``` ```python -catalogApi = killbill.api.CatalogApi() +catalogApi = killbill.CatalogApi() -catalogApi.get_phase_for_subscription_and_date(api_key, - api_secret, - subscription_id=subscription_id) +subscriptionId = 'ad924bca-00f4-4287-82c2-e2932a5f7371' + +phaseAndDuration = catalogApi.get_phase_for_subscription_and_date(subscription_id=subscriptionId) ``` > Example Response: @@ -1070,11 +1078,11 @@ KillBillClient::Model::Catalog.get_catalog_plan(subscription_id, ``` ```python -catalogApi = killbill.api.CatalogApi() +catalogApi = killbill.CatalogApi() + +subscriptionId = 'ad924bca-00f4-4287-82c2-e2932a5f7371' -catalogApi.get_plan_for_subscription_and_date(api_key, - api_secret, - subscription_id=subscription_id) +plan = catalogApi.get_plan_for_subscription_and_date(subscription_id=subscriptionId) ``` > Example Response: @@ -1162,11 +1170,11 @@ KillBillClient::Model::Catalog.get_catalog_price_list(subscription_id, ``` ```python -catalogApi = killbill.api.CatalogApi() +catalogApi = killbill.CatalogApi() -catalogApi.get_price_list_for_subscription_and_date(api_key, - api_secret, - subscription_id=subscription_id) +subscriptionId = 'ad924bca-00f4-4287-82c2-e2932a5f7371' + +priceList = catalogApi.get_price_list_for_subscription_and_date(subscription_id=subscriptionId) ``` > Example Response: @@ -1224,11 +1232,11 @@ KillBillClient::Model::Catalog.get_catalog_product(subscription_id, ``` ```python -catalogApi = killbill.api.CatalogApi() +catalogApi = killbill.CatalogApi() + +subscriptionId = 'ad924bca-00f4-4287-82c2-e2932a5f7371' -catalogApi.get_product_for_subscription_and_date(api_key, - api_secret, - subscription_id=subscription_id) +product = catalogApi.get_product_for_subscription_and_date(subscription_id=subscriptionId) ``` > Example Response: @@ -1341,17 +1349,21 @@ KillBillClient::Model::Catalog.add_tenant_catalog_simple_plan(simple_plan, options) ``` ```python -catalogApi = killbill.api.CatalogApi() -body = SimplePlan(plan_id='basic-annual', - product_name='Basic', - product_category='BASE', - currency='USD', - amount=10000.00, - billing_period='ANNUAL', - trial_length=0, - trial_time_unit='UNLIMITED') +catalogApi = killbill.CatalogApi() + +body = killbill.SimplePlan(plan_id='basic-annual', + product_name='Basic', + product_category='BASE', + currency='USD', + amount=10000.00, + billing_period='ANNUAL', + trial_length=0, + trial_time_unit='UNLIMITED') -catalogApi.add_simple_plan(body, created_by, api_key, api_secret) +catalogApi.add_simple_plan(body, + created_by='demo', + reason='reason', + comment='comment') ``` **Request Body** From 79b14cd37c642850b91371d704bd66777365548c Mon Sep 17 00:00:00 2001 From: KBbitsP <75751774+KBbitsP@users.noreply.github.com> Date: Tue, 31 Oct 2023 22:47:25 +0530 Subject: [PATCH 2/2] Update _catalog.md --- source/includes/_catalog.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/source/includes/_catalog.md b/source/includes/_catalog.md index d335de81..74d73ad0 100644 --- a/source/includes/_catalog.md +++ b/source/includes/_catalog.md @@ -172,7 +172,7 @@ KillBillClient::Model::Catalog.get_tenant_catalog_xml(requested_date, ```python catalogApi = killbill.CatalogApi() -catalogXml = catalogApi.get_catalog_xml() +catalog_xml = catalogApi.get_catalog_xml() ``` > Example Response: @@ -449,7 +449,7 @@ KillBillClient::Model::Catalog.get_tenant_catalog_json.(requested_date, ```python catalogApi = killbill.CatalogApi() -catalogJson = catalogApi.get_catalog_json() +catalog_json = catalogApi.get_catalog_json() ``` > Example Response: @@ -660,7 +660,7 @@ KillBillClient::Model::Catalog.get_tenant_catalog_versions(options) ```python catalogApi = killbill.CatalogApi() -catalogVersions = catalogApi.get_catalog_versions() +catalog_versions = catalogApi.get_catalog_versions() ``` > Example Response: @@ -717,7 +717,7 @@ KillBillClient::Model::Catalog.available_base_plans(options) ```python catalogApi = killbill.CatalogApi() -availableBasePlans = catalogApi.get_available_base_plans() +available_base_plans = catalogApi.get_available_base_plans() ``` > Example Response: @@ -811,7 +811,7 @@ KillBillClient::Model::Catalog.available_addons(base_product_name, ```python catalogApi = killbill.CatalogApi() -availableAddOnPlans = catalogApi.get_available_addons(base_product_name='Basic') +available_add_on_plans = catalogApi.get_available_addons(base_product_name='Basic') ``` > Example Response: @@ -946,10 +946,10 @@ catalogApi = killbill.CatalogApi() xml_catalog = open("H:/killbill/catalog.xml", "r+").read() -catalogValidationErrors = catalogApi.validate_catalog_xml(xml_catalog, - created_by='demo', - reason='reason', - comment='comment') +catalog_validation_errors = catalogApi.validate_catalog_xml(xml_catalog, + created_by='demo', + reason='reason', + comment='comment') ``` > Example Response: @@ -1014,9 +1014,9 @@ KillBillClient::Model::Catalog.get_catalog_phase(subscription_id, ```python catalogApi = killbill.CatalogApi() -subscriptionId = 'ad924bca-00f4-4287-82c2-e2932a5f7371' +subscription_id = 'ad924bca-00f4-4287-82c2-e2932a5f7371' -phaseAndDuration = catalogApi.get_phase_for_subscription_and_date(subscription_id=subscriptionId) +phase = catalogApi.get_phase_for_subscription_and_date(subscription_id=subscription_id) ``` > Example Response: @@ -1080,9 +1080,9 @@ KillBillClient::Model::Catalog.get_catalog_plan(subscription_id, ```python catalogApi = killbill.CatalogApi() -subscriptionId = 'ad924bca-00f4-4287-82c2-e2932a5f7371' +subscription_id = 'ad924bca-00f4-4287-82c2-e2932a5f7371' -plan = catalogApi.get_plan_for_subscription_and_date(subscription_id=subscriptionId) +plan = catalogApi.get_plan_for_subscription_and_date(subscription_id=subscription_id) ``` > Example Response: @@ -1172,9 +1172,9 @@ KillBillClient::Model::Catalog.get_catalog_price_list(subscription_id, ```python catalogApi = killbill.CatalogApi() -subscriptionId = 'ad924bca-00f4-4287-82c2-e2932a5f7371' +subscription_id = 'ad924bca-00f4-4287-82c2-e2932a5f7371' -priceList = catalogApi.get_price_list_for_subscription_and_date(subscription_id=subscriptionId) +price_list = catalogApi.get_price_list_for_subscription_and_date(subscription_id=subscription_id) ``` > Example Response: @@ -1234,9 +1234,9 @@ KillBillClient::Model::Catalog.get_catalog_product(subscription_id, ```python catalogApi = killbill.CatalogApi() -subscriptionId = 'ad924bca-00f4-4287-82c2-e2932a5f7371' +subscription_id = 'ad924bca-00f4-4287-82c2-e2932a5f7371' -product = catalogApi.get_product_for_subscription_and_date(subscription_id=subscriptionId) +product = catalogApi.get_product_for_subscription_and_date(subscription_id=subscription_id) ``` > Example Response: