openapi/api.yaml in recurly-3.2.2 vs openapi/api.yaml in recurly-3.3.0

- old
+ new

@@ -141,10 +141,74 @@ seconds since the UNIX Epoch, at which the request count will be reset. ## Change Log ### v2019-10-10 + + Added support for item-backed AddOns: + * `PlanCreate` request: + * Added `add_ons.item_code`, when the `Catalog: Item Add-Ons` feature is enabled + * Added `add_ons.item_id`, when the `Catalog: Item Add-Ons` feature is enabled + * The following parameters are no longer acceptable if `item_code`/`item_id` is present: + * `add_ons.code` + * `add_ons.name` + * `add_ons.accounting_code` + * `add_ons.tax_code` + * `AddOnCreate` request: + * Added `item_code`, when the `Catalog: Item Add-Ons` feature is enabled + * Added `item_id`, when the `Catalog: Item Add-Ons` feature is enabled + * The following parameters are no longer acceptable if `item_code`/`item_id` is present: + * `code` + * `name` + * `accounting_code` + * `tax_code` + * `AddOnUpdate` request: + * The following parameters are no longer acceptable if an AddOn is item-backed: + * `name` + * `accounting_code` + * `tax_code` + * `AddOn` response format updates: + * Added `item`: + * Added `item.id` + * Added `item.object` + * Added `item.state` + * Added `item.name` + * Added `item.description` + * Added `external_sku` + * `Subscription` response format updates: + * Added `add_ons.add_on.item_id` + * Added `add_ons.add_on.external_sku` + + Support for `optional` in AddOn + * `AddOn` response format: + * Added `optional` + + Create convert trial endpoint for immediately converting trial subscription to fully active + * Added `PUT /sites/:site_id/subscriptions/:id/convert_trial`. + + Support `gateway_token` and `gateway_code` for Billing Infos + * `BillingInfoCreate` request format: + * Added `gateway_token` + * Added `gateway_code` + * `PaymentMethod` response format: + * Added `gateway_token` + * Added `gateway_code` + + Adding fields to the `Account` schema to view `Subscription` and `Invoice` statuses without making multiple requests: + * Subscription status fields: + * `has_live_subscription` + * `has_active_subscription` + * `has_future_subscription` + * `has_canceled_subscription` + * `has_paused_subscription` + * Invoice status fields: + * `has_past_due_invoice` + + Support `external_gift_card` origins for Line Items + * Changed LineItemCreate request format: + * Added `origin`. + Starting to add support for .pdf routes * Added `GET /sites/:site_id/invoices/{invoice_id}.pdf`. * Added BinaryFile schema Improving the ability to work with Custom Field Definitions. @@ -187,11 +251,12 @@ * `revenue_schedule_type` - can be used to override the default `revenue_schedule_type` on the `Item`. * `LineItem` response format updates * Added `item_code`. * Added `item_id`. - * `product_code` will be populated with `external_sku` of the `Item` when an `item_code` or `item_id` is passed in the request. + * Added `external_sku`. + * `product_code` will be populated with `item_code` of the `Item` when an `item_code` or `item_id` is passed in the request. Added support for Items in Purchases, when the Catalog feature is enabled * Changed PurchaseCreate request format: * Added `line_items.item_code`/`line_items.item_id`. * The following parameters are no longer acceptable if `line_items.item_code`/`line_items.item_id` is present @@ -207,11 +272,12 @@ * `line_items.revenue_schedule_type` - can be used to override the default `revenue_schedule_type` on the Item. * Changed Purchase response format: * Added `line_items.item_code`. * Added `line_items.item_id`. - * `line_items.product_code` will be populated with the `external_sku` of the Item when an `item_code` or `item_id` is passed in the request. + * Added `line_items.external_sku`. + * `line_items.product_code` will be populated with the `item_code` of the Item when an `item_code` or `item_id` is passed in the request. Starting to improve support for shipping: * Added `GET /sites/:site_id/shipping_methods/`. * Added `GET /sites/:site_id/shipping_methods/:id/`. * Changes Invoice and LineItem response formats: @@ -281,10 +347,14 @@ * Added `transaction_type`. * Added `three_d_secure_action_result_token_id`. * Changes the TransactionError response format: * Added `three_d_secure_action_token_id` to indicate an SCA flow is required to complete the transaction. + Support IBAN bank account fields + * Changes BillingInfo response format: + * Added `last_two` for IBAN bank account types. + ### v2018-08-09 Added support for Purchases * Added `POST /sites/:site_id/purchases` * Added `POST /sites/:site_id/purchases/preview` @@ -774,15 +844,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - sites = client.list_sites(limit=200).items() - for site in sites: - print(site.subdomain) - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time final Pager<Site> sites = client.listSites(params); @@ -795,23 +860,28 @@ var sites = client.ListSites(limit: 200); foreach(Site site in sites) { Console.WriteLine(site.Subdomain); } + - lang: Ruby + source: | + sites = @client.list_sites(limit: 200) + sites.each do |site| + puts "Site: #{site.subdomain}" + end - lang: Node.js source: | const sites = client.listSites({ limit: 200 }) for await (const site of sites.each()) { console.log(site.subdomain) } - - lang: Ruby + - lang: Python source: | - sites = @client.list_sites(limit: 200) - sites.each do |site| - puts "Site: #{site.subdomain}" - end + sites = client.list_sites(limit=200).items() + for site in sites: + print(site.subdomain) "/sites/{site_id}": get: operationId: get_site summary: Fetch a site tags: @@ -835,10 +905,11 @@ description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/accounts": get: tags: - account operationId: list_accounts @@ -878,15 +949,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - accounts = client.list_accounts(limit=200).items() - for account in accounts: - print(account.code) - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time Pager<Account> accounts = client.listAccounts(params); @@ -899,23 +965,28 @@ var accounts = client.ListAccounts(limit: 200); foreach(Account account in accounts) { Console.WriteLine(account.Code); } + - lang: Ruby + source: | + accounts = @client.list_accounts(limit: 200) + accounts.each do |account| + puts "Account: #{account.code}" + end - lang: Node.js source: | const accounts = client.listAccounts({ limit: 200 }) for await (const account of accounts.each()) { console.log(account.code) } - - lang: Ruby + - lang: Python source: | - accounts = @client.list_accounts(limit: 200) - accounts.each do |account| - puts "Account: #{account.code}" - end + accounts = client.list_accounts(limit=200).items() + for account in accounts: + print(account.code) post: tags: - account operationId: create_account summary: Create an account @@ -958,43 +1029,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - account_create = { - "code": account_code, - "first_name": "Benjamin", - "last_name": "Du Monde", - "acquisition": { - "campaign": "podcast-marketing", - "channel": "social_media", - "subchannel": "twitter", - "cost": {"currency": "USD", "amount": 0.50}, - }, - "shipping_addresses": [ - { - "nickname": "Home", - "street1": "1 Tchoupitoulas St", - "city": "New Orleans", - "region": "LA", - "country": "US", - "postal_code": "70115", - "first_name": "Aaron", - "last_name": "Du Monde", - } - ], - } - account = client.create_account(account_create) - print("Created Account %s" % account) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { AccountCreate accountReq = new AccountCreate(); Address address = new Address(); @@ -1051,38 +1089,10 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - - lang: Node.js - source: | - try { - const accountCreate = { - code: accountCode, - firstName: 'Benjamin', - lastName: 'Du Monde', - address: { - street1: '900 Camp St', - city: 'New Orleans', - region: 'LA', - postalCode: '70115', - country: 'US' - } - } - const account = await client.createAccount(accountCreate) - console.log('Created Account: ', account.code) - } catch (err) { - if (err instanceof recurly.errors.ValidationError) { - // If the request was not valid, you may want to tell your user - // why. You can find the invalid params and reasons in err.params - console.log('Failed validation', err.params) - } else { - // If we don't know what to do with the err, we should - // probably re-raise and let our web framework and logger handle it - console.log('Unknown Error: ', err) - } - } - lang: Ruby source: | begin account_create = { code: account_code, @@ -1115,10 +1125,71 @@ rescue Recurly::Errors::ValidationError => e # If the request was invalid, you may want to tell your user # why. You can find the invalid params and reasons in e.recurly_error.params puts "ValidationError: #{e.recurly_error.params}" end + - lang: Node.js + source: | + try { + const accountCreate = { + code: accountCode, + firstName: 'Benjamin', + lastName: 'Du Monde', + address: { + street1: '900 Camp St', + city: 'New Orleans', + region: 'LA', + postalCode: '70115', + country: 'US' + } + } + const account = await client.createAccount(accountCreate) + console.log('Created Account: ', account.code) + } catch (err) { + if (err instanceof recurly.errors.ValidationError) { + // If the request was not valid, you may want to tell your user + // why. You can find the invalid params and reasons in err.params + console.log('Failed validation', err.params) + } else { + // If we don't know what to do with the err, we should + // probably re-raise and let our web framework and logger handle it + console.log('Unknown Error: ', err) + } + } + - lang: Python + source: | + try: + account_create = { + "code": account_code, + "first_name": "Benjamin", + "last_name": "Du Monde", + "acquisition": { + "campaign": "podcast-marketing", + "channel": "social_media", + "subchannel": "twitter", + "cost": {"currency": "USD", "amount": 0.50}, + }, + "shipping_addresses": [ + { + "nickname": "Home", + "street1": "1 Tchoupitoulas St", + "city": "New Orleans", + "region": "LA", + "country": "US", + "postal_code": "70115", + "first_name": "Aaron", + "last_name": "Du Monde", + } + ], + } + account = client.create_account(account_create) + print("Created Account %s" % account) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/accounts/{account_id}": parameters: - "$ref": "#/components/parameters/site_id" - "$ref": "#/components/parameters/account_id" get: @@ -1138,19 +1209,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - account = client.get_account(account_id) - print("Got Account %s" % account) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { final Account account = client.getAccount(accountId); System.out.println("Fetched account: " + account.getCode()); @@ -1178,10 +1240,20 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + account = @client.get_account(account_id: account_id) + puts "Got Account #{account}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { const account = await client.getAccount(accountId) console.log('Fetched account: ', account.code) @@ -1194,20 +1266,19 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - account = @client.get_account(account_id: account_id) - puts "Got Account #{account}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + account = client.get_account(account_id) + print("Got Account %s" % account) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") put: tags: - account operationId: update_account summary: Modify an account @@ -1248,21 +1319,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - account_update = {"first_name": "Aaron", "last_name": "Du Monde"} - account = client.update_account(account_id, account_update) - print("Updated Account %s" % account) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { final AccountUpdate accountUpdate = new AccountUpdate(); accountUpdate.setFirstName("Aaron"); @@ -1301,10 +1361,27 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + account_update = { + first_name: "Aaron", + last_name: "Du Monde", + } + account = @client.update_account( + account_id: account_id, + body: account_update + ) + puts "Updated Account #{account}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { const accountUpdate = { firstName: 'Aaron', @@ -1321,27 +1398,21 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - account_update = { - first_name: "Aaron", - last_name: "Du Monde", - } - account = @client.update_account( - account_id: account_id, - body: account_update - ) - puts "Updated Account #{account}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + try: + account_update = {"first_name": "Aaron", "last_name": "Du Monde"} + account = client.update_account(account_id, account_update) + print("Updated Account %s" % account) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) delete: tags: - account operationId: deactivate_account summary: Deactivate an account @@ -1367,19 +1438,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - account = client.deactivate_account(account_id) - print("Deactivated Account %s" % account) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { Account account = client.deactivateAccount(accountId); System.out.println("deactivated account " + account.getCode()); @@ -1407,10 +1469,20 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + account = @client.deactivate_account(account_id: account_id) + puts "Deactivated Account #{account}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { const account = await client.deactivateAccount(accountId) console.log('Deleted account: ', account.code) @@ -1422,20 +1494,19 @@ } // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it throw err } - - lang: Ruby + - lang: Python source: | - begin - account = @client.deactivate_account(account_id: account_id) - puts "Deactivated Account #{account}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + account = client.deactivate_account(account_id) + print("Deactivated Account %s" % account) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/accounts/{account_id}/acquisition": parameters: - "$ref": "#/components/parameters/site_id" - "$ref": "#/components/parameters/account_id" get: @@ -1457,19 +1528,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - acquisition = client.get_account_acquisition(account_id) - print("Got AccountAcquisition %s" % acquisition) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { final AccountAcquisition acquisition = client.getAccountAcquisition(accountId); System.out.println("Fetched account acquisition " + acquisition.getId()); @@ -1497,10 +1559,20 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + @client.get_account_acquisition(account_id: account_id) + puts "Got AccountAcquisition" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { const acquisition = await client.getAccountAcquisition(accountId) console.log('Fetched account acquisition: ', acquisition.id) @@ -1513,20 +1585,19 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - @client.get_account_acquisition(account_id: account_id) - puts "Got AccountAcquisition" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + acquisition = client.get_account_acquisition(account_id) + print("Got AccountAcquisition %s" % acquisition) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") put: tags: - account - account_acquisition operationId: update_account_acquisition @@ -1561,26 +1632,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - acquisition_update = { - "campaign": "podcast-marketing", - "channel": "social_media", - "subchannel": "twitter", - "cost": {"currency": "USD", "amount": 0.50}, - } - acquisition = client.update_account_acquisition(account_id, acquisition_update) - print("Updated AccountAcquisition %s" % acquisition) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { final AccountAcquisitionUpdatable acqUpdate = new AccountAcquisitionUpdatable(); acqUpdate.setCampaign("big-event-campaign"); @@ -1640,10 +1695,26 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } + - lang: Python + source: | + try: + acquisition_update = { + "campaign": "podcast-marketing", + "channel": "social_media", + "subchannel": "twitter", + "cost": {"currency": "USD", "amount": 0.50}, + } + acquisition = client.update_account_acquisition(account_id, acquisition_update) + print("Updated AccountAcquisition %s" % acquisition) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) delete: tags: - account - account_acquisition operationId: remove_account_acquisition @@ -1656,19 +1727,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - client.remove_account_acquisition(account_id) - print("Removed AccountAcquisition for Account id=%s" % account_id) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { client.removeAccountAcquisition(accountId); System.out.println("Removed account acquisition from account " + accountId); @@ -1696,10 +1758,20 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + acquisition = @client.remove_account_acquisition(account_id: account_id) + puts "Removed AccountAcqusition #{acquisition}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { await client.removeAccountAcquisition(accountId) console.log('Removed account acquisition from account: ', accountId) @@ -1712,20 +1784,19 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - acquisition = @client.remove_account_acquisition(account_id: account_id) - puts "Removed AccountAcqusition #{acquisition}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + client.remove_account_acquisition(account_id) + print("Removed AccountAcquisition for Account id=%s" % account_id) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/accounts/{account_id}/reactivate": parameters: - "$ref": "#/components/parameters/site_id" - "$ref": "#/components/parameters/account_id" put: @@ -1759,19 +1830,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - account = client.reactivate_account(account_id) - print("Reactivated Account %s" % account) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { final Account account = client.reactivateAccount(accountId); System.out.println("Reactivated account: " + account.getCode()); @@ -1799,10 +1861,20 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + account = @client.reactivate_account(account_id: account_id) + puts "Reactivated account #{account}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { const account = await client.reactivateAccount(accountId) console.log('Reactivated account: ', account.code) @@ -1814,20 +1886,19 @@ } // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it throw err } - - lang: Ruby + - lang: Python source: | - begin - account = @client.reactivate_account(account_id: account_id) - puts "Reactivated account #{account}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + account = client.reactivate_account(account_id) + print("Reactivated Account %s" % account) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/accounts/{account_id}/balance": parameters: - "$ref": "#/components/parameters/site_id" - "$ref": "#/components/parameters/account_id" get: @@ -1853,19 +1924,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - balance = client.get_account_balance(account_id) - print("Got AccountBalance %s" % balance) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { final AccountBalance balance = client.getAccountBalance(accountId); System.out.println("Fetched account balance " + balance.getBalances()); @@ -1893,10 +1955,20 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + balance = @client.get_account_balance(account_id: account_id) + puts "Got AccountBalance #{balance}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { const balance = await client.getAccountBalance(accountId) console.log('Fetched account balance: ', balance.balances) @@ -1909,20 +1981,19 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - balance = @client.get_account_balance(account_id: account_id) - puts "Got AccountBalance #{balance}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + balance = client.get_account_balance(account_id) + print("Got AccountBalance %s" % balance) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/accounts/{account_id}/billing_info": get: tags: - account - billing_info @@ -1950,19 +2021,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - binfo = client.get_billing_info(account_id) - print("Got BillingInfo %s" % binfo) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { final BillingInfo billingInfo = client.getBillingInfo(accountId); System.out.println("Fetched billing info " + billingInfo.getId()); @@ -1990,10 +2052,20 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + billing = @client.get_billing_info(account_id: account_id) + puts "Got BillingInfo #{billing}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { const billingInfo = await client.getBillingInfo(accountId) console.log('Fetched Billing Info: ', billingInfo.id) @@ -2006,20 +2078,19 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - billing = @client.get_billing_info(account_id: account_id) - puts "Got BillingInfo #{billing}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + binfo = client.get_billing_info(account_id) + print("Got BillingInfo %s" % binfo) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") put: tags: - account - billing_info operationId: update_billing_info @@ -2032,10 +2103,17 @@ - first_name - last_name - number - month - year + + For tokenized payments you'll need the following required fields: + + - first_name + - last_name + - gateway_token + - gateway_code parameters: - "$ref": "#/components/parameters/site_id" - "$ref": "#/components/parameters/account_id" requestBody: content: @@ -2068,21 +2146,10 @@ content: application/json: schema: "$ref": "#/components/schemas/ErrorMayHaveTransaction" x-code-samples: - - lang: Python - source: | - try: - billing_update = {"first_name": "Aaron", "last_name": "Du Monde"} - billing = client.update_billing_info(account_id, billing_update) - print("Updated BillingInfo %s" % billing) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { final BillingInfoCreate billingUpdate = new BillingInfoCreate(); billingUpdate.setFirstName("Aaron"); @@ -2118,10 +2185,27 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + billing_update = { + first_name: "Aaron", + last_name: "Du Monde", + } + billing = @client.update_billing_info( + account_id: account_id, + body: billing_update + ) + puts "Updated BillingInfo #{billing}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { const billingInfoUpdate = { firstName: 'Aaron', @@ -2138,27 +2222,21 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - billing_update = { - first_name: "Aaron", - last_name: "Du Monde", - } - billing = @client.update_billing_info( - account_id: account_id, - body: billing_update - ) - puts "Updated BillingInfo #{billing}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + try: + billing_update = {"first_name": "Aaron", "last_name": "Du Monde"} + billing = client.update_billing_info(account_id, billing_update) + print("Updated BillingInfo %s" % billing) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) delete: tags: - account - billing_info operationId: remove_billing_info @@ -2178,19 +2256,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - client.remove_billing_info(account_id) - print("Removed BillingInfo for Account id=%s" % account_id) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { client.removeBillingInfo(accountId); System.out.println("Removed billing info from account " + accountId); @@ -2218,10 +2287,20 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + @client.remove_billing_info(account_id: account_id) + puts "Removed BillingInfo #{account_id}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { client.removeBillingInfo(accountId) console.log('Removed billing info from account: ', accountId) @@ -2234,20 +2313,19 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - @client.remove_billing_info(account_id: account_id) - puts "Removed BillingInfo #{account_id}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + client.remove_billing_info(account_id) + print("Removed BillingInfo for Account id=%s" % account_id) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/accounts/{account_id}/coupon_redemptions": get: tags: - account - coupon_redemption @@ -2278,15 +2356,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - redemptions = client.list_account_coupon_redemptions(account_id, limit=200).items() - for redemption in redemptions: - print(redemption.id) - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time final Pager<CouponRedemption> redemptions = client.listAccountCouponRedemptions(accountId, params); @@ -2301,10 +2374,15 @@ limit: 200 ) redemptions.each do |redemption| puts "CouponRedemption: #{redemption.id}" end + - lang: Python + source: | + redemptions = client.list_account_coupon_redemptions(account_id, limit=200).items() + for redemption in redemptions: + print(redemption.id) "/sites/{site_id}/accounts/{account_id}/coupon_redemptions/active": get: tags: - account - coupon_redemption @@ -2331,19 +2409,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - redemption = client.get_active_coupon_redemption(account_id) - print("Got Redemption %s" % redemption) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { final CouponRedemption redemption = client.getActiveCouponRedemption(accountId); System.out.println("Fetched coupon redemption " + redemption.getId()); @@ -2371,10 +2440,20 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + redemption = @client.get_active_coupon_redemption(account_id: account_id) + puts "Got CouponRedemption #{redemption}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { const redemption = await client.getActiveCouponRedemption(accountId) console.log('Fetched coupon redemption: ', redemption.id) @@ -2387,20 +2466,19 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - redemption = @client.get_active_coupon_redemption(account_id: account_id) - puts "Got CouponRedemption #{redemption}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + redemption = client.get_active_coupon_redemption(account_id) + print("Got Redemption %s" % redemption) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") post: tags: - account - coupon_redemption operationId: create_coupon_redemption @@ -2438,21 +2516,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - redemption_create = {"currency": "USD", "coupon_id": coupon_id} - redemption = client.create_coupon_redemption(account_id, redemption_create) - print("Created Redemption %s" % redemption) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { CouponRedemptionCreate coupRedCreate = new CouponRedemptionCreate(); coupRedCreate.setCouponId(couponId); @@ -2482,10 +2549,21 @@ rescue Recurly::Errors::ValidationError => e # If the request was invalid, you may want to tell your user # why. You can find the invalid params and reasons in e.recurly_error.params puts "ValidationError: #{e.recurly_error.params}" end + - lang: Python + source: | + try: + redemption_create = {"currency": "USD", "coupon_id": coupon_id} + redemption = client.create_coupon_redemption(account_id, redemption_create) + print("Created Redemption %s" % redemption) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) delete: tags: - account - coupon_redemption operationId: remove_coupon_redemption @@ -2511,19 +2589,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - client.remove_coupon_redemption(account_id) - print("Removed Redemption from Account id=%s" % account_id) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { final CouponRedemption redemption = client.removeCouponRedemption(accountId); System.out.println("Removed coupon redemption " + redemption.getId()); @@ -2543,10 +2612,19 @@ rescue Recurly::Errors::NotFoundError # If the resource was not found, you may want to alert the user or # just return nil puts "Resource Not Found" end + - lang: Python + source: | + try: + client.remove_coupon_redemption(account_id) + print("Removed Redemption from Account id=%s" % account_id) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/accounts/{account_id}/credit_payments": get: tags: - account - credit_payment @@ -2584,15 +2662,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - payments = client.list_account_credit_payments(account_id, limit=200).items() - for payment in payments: - print(payment.id) - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time Pager<CreditPayment> payments = client.listAccountCreditPayments(accountId, params); @@ -2605,26 +2678,31 @@ var payments = client.ListAccountCreditPayments(accountId, limit: 200); foreach(CreditPayment payment in payments) { Console.WriteLine(payment.Uuid); } - - lang: Node.js - source: | - const payments = client.listAccountCreditPayments(accountId, { limit: 200 }) - - for await (const payment of payments.each()) { - console.log(payment.uuid) - } - lang: Ruby source: | payments = @client.list_account_credit_payments( account_id: account_id, limit: 200 ) payments.each do |payment| puts "CreditPayment: #{payment.id}" end + - lang: Node.js + source: | + const payments = client.listAccountCreditPayments(accountId, { limit: 200 }) + + for await (const payment of payments.each()) { + console.log(payment.uuid) + } + - lang: Python + source: | + payments = client.list_account_credit_payments(account_id, limit=200).items() + for payment in payments: + print(payment.id) "/sites/{site_id}/accounts/{account_id}/invoices": get: tags: - invoice - account @@ -2664,15 +2742,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - invoices = client.list_account_invoices(account_id, limit=200).items() - for invoice in invoices: - print(invoice.number) - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time final Pager<Invoice> invoices = client.listAccountInvoices(accountId, params); @@ -2687,10 +2760,15 @@ limit: 200 ) invoices.each do |invoice| puts "Invoice: #{invoice.number}" end + - lang: Python + source: | + invoices = client.list_account_invoices(account_id, limit=200).items() + for invoice in invoices: + print(invoice.number) post: tags: - invoice - account operationId: create_invoice @@ -2735,21 +2813,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - invoice_create = {"currency": "USD", "collection_method": "automatic"} - invoice_collection = client.create_invoice(account_id, invoice_create) - print("Created InvoiceCollection %s" % invoice_collection) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { InvoiceCreate invoiceCreate = new InvoiceCreate(); invoiceCreate.setCurrency("USD"); @@ -2790,10 +2857,27 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + invoice_create = { + currency: 'USD', + collection_method: 'automatic' + } + collection = @client.create_invoice( + account_id: account_id, + body: invoice_create + ) + puts "Created InvoiceCollection #{collection}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { let invoiceCreate = { currency: 'USD', @@ -2812,27 +2896,21 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - invoice_create = { - currency: 'USD', - collection_method: 'automatic' - } - collection = @client.create_invoice( - account_id: account_id, - body: invoice_create - ) - puts "Created InvoiceCollection #{collection}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + try: + invoice_create = {"currency": "USD", "collection_method": "automatic"} + invoice_collection = client.create_invoice(account_id, invoice_create) + print("Created InvoiceCollection %s" % invoice_collection) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/accounts/{account_id}/invoices/preview": post: tags: - invoice - account @@ -2877,21 +2955,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - invoice_preview = {"currency": "USD", "collection_method": "automatic"} - invoice_collection = client.preview_invoice(account_id, invoice_preview) - print("Preview InvoiceCollection %s" % invoice_collection) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { InvoiceCreate invoiceCreate = new InvoiceCreate(); invoiceCreate.setCurrency("USD"); @@ -2932,10 +2999,27 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + invoice_preview = { + currency: "USD", + collection_method: "automatic" + } + collection = @client.create_invoice( + account_id: account_id, + body: invoice_preview + ) + puts "Created InvoiceCollection #{collection}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { const collection = await client.previewInvoice(accountId, { currency: "USD", @@ -2954,27 +3038,21 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - invoice_preview = { - currency: "USD", - collection_method: "automatic" - } - collection = @client.create_invoice( - account_id: account_id, - body: invoice_preview - ) - puts "Created InvoiceCollection #{collection}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + try: + invoice_preview = {"currency": "USD", "collection_method": "automatic"} + invoice_collection = client.preview_invoice(account_id, invoice_preview) + print("Preview InvoiceCollection %s" % invoice_collection) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/accounts/{account_id}/line_items": get: tags: - account - line_item @@ -3016,15 +3094,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - line_items = client.list_account_line_items(account_id, limit=200).items() - for line_item in line_items: - print(line_item.id) - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time final Pager<LineItem> lineItems = client.listAccountLineItems(accountId, params); @@ -3039,10 +3112,15 @@ limit: 200 ) line_items.each do |line_item| puts "LineItem: #{line_item.id}" end + - lang: Python + source: | + line_items = client.list_account_line_items(account_id, limit=200).items() + for line_item in line_items: + print(line_item.id) post: tags: - account - line_item operationId: create_line_item @@ -3080,25 +3158,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - line_item_create = { - "currency": "USD", - "unit_amount": 1000, - "type": "charge", # choose "credit" for a credit - } - line_item = client.create_line_item(account_id, line_item_create) - print("Created LineItem %s" % line_item) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { LineItemCreate lineItemCreate = new LineItemCreate(); lineItemCreate.setCurrency("USD"); @@ -3138,10 +3201,28 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + line_item_create = { + currency: 'USD', + unit_amount: 1_000, + type: :charge + } + line_item = @client.create_line_item( + account_id: account_id, + body: line_item_create + ) + puts "Created LineItem #{line_item}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { let lineItemReq = { currency: 'USD', @@ -3159,28 +3240,25 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - line_item_create = { - currency: 'USD', - unit_amount: 1_000, - type: :charge - } - line_item = @client.create_line_item( - account_id: account_id, - body: line_item_create - ) - puts "Created LineItem #{line_item}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + try: + line_item_create = { + "currency": "USD", + "unit_amount": 1000, + "type": "charge", # choose "credit" for a credit + } + line_item = client.create_line_item(account_id, line_item_create) + print("Created LineItem %s" % line_item) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/accounts/{account_id}/notes": get: tags: - account - note @@ -3208,15 +3286,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - line_items = client.list_account_line_items(account_id, limit=200).items() - for line_item in line_items: - print(line_item.id) - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time final Pager<AccountNote> notes = client.listAccountNotes(accountId, params); @@ -3229,23 +3302,28 @@ var notes = client.ListAccountNotes(accountId); foreach(AccountNote note in notes) { Console.WriteLine(note.Message); } + - lang: Ruby + source: | + account_notes = @client.list_account_notes(account_id: account_id, limit: 200) + account_notes.each do |note| + puts "AccountNote: #{note.message}" + end - lang: Node.js source: | const notes = client.listAccountNotes(accountId, { limit: 200 }) for await (const note of notes.each()) { console.log(note.message) } - - lang: Ruby + - lang: Python source: | - account_notes = @client.list_account_notes(account_id: account_id, limit: 200) - account_notes.each do |note| - puts "AccountNote: #{note.message}" - end + line_items = client.list_account_line_items(account_id, limit=200).items() + for line_item in line_items: + print(line_item.id) "/sites/{site_id}/accounts/{account_id}/notes/{account_note_id}": get: tags: - account - note @@ -3278,19 +3356,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - note = client.get_account_note(account_id, note_id) - print("Got AccountNote %s" % note) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { final AccountNote note = client.getAccountNote(accountId, accountNoteId); System.out.println("Fetched account note: " + note.getMessage()); @@ -3318,10 +3387,23 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + note = @client.get_account_note( + account_id: account_id, + account_note_id: note_id + ) + puts "Got AccountNote #{note}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { console.log(accountId) const note = await client.getAccountNote(accountId, accountNoteId) @@ -3335,23 +3417,19 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - note = @client.get_account_note( - account_id: account_id, - account_note_id: note_id - ) - puts "Got AccountNote #{note}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + note = client.get_account_note(account_id, note_id) + print("Got AccountNote %s" % note) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/accounts/{account_id}/shipping_addresses": get: tags: - account - shipping_address @@ -3384,15 +3462,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - shipping_addresses = client.list_shipping_addresses(account_id).items() - for shipping_address in shipping_addresses: - print(shipping_address.id) - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time final Pager<ShippingAddress> addresses = client.listShippingAddresses(accountId, params); @@ -3405,26 +3478,31 @@ var addresses = client.ListShippingAddresses(accountId); foreach(ShippingAddress address in addresses) { Console.WriteLine(address.Street1); } - - lang: Node.js - source: | - const addresses = client.listShippingAddresses(accountId, { limit: 200 }) - - for await (const address of addresses.each()) { - console.log(address.street1) - } - lang: Ruby source: | shipping_addresses = @client.list_shipping_addresses( account_id: account_id, limit: 200 ) shipping_addresses.each do |addr| puts "ShippingAddress: #{addr.nickname} - #{addr.street1}" end + - lang: Node.js + source: | + const addresses = client.listShippingAddresses(accountId, { limit: 200 }) + + for await (const address of addresses.each()) { + console.log(address.street1) + } + - lang: Python + source: | + shipping_addresses = client.list_shipping_addresses(account_id).items() + for shipping_address in shipping_addresses: + print(shipping_address.id) post: tags: - account - shipping_address operationId: create_shipping_address @@ -3462,28 +3540,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - shipping_addr_create = { - "first_name": "Aaron", - "last_name": "Du Monde", - "street1": "900 Camp St.", - "city": "New Orleans", - "postal_code": "70115", - "country": "US", - } - shad = client.create_shipping_address(account_id, shipping_addr_create) - print("Created ShippingAddress %s" % shad) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { ShippingAddressCreate shippingAddressCreate = new ShippingAddressCreate(); shippingAddressCreate.setFirstName("Aaron"); @@ -3555,10 +3615,28 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } + - lang: Python + source: | + try: + shipping_addr_create = { + "first_name": "Aaron", + "last_name": "Du Monde", + "street1": "900 Camp St.", + "city": "New Orleans", + "postal_code": "70115", + "country": "US", + } + shad = client.create_shipping_address(account_id, shipping_addr_create) + print("Created ShippingAddress %s" % shad) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/accounts/{account_id}/shipping_addresses/{shipping_address_id}": get: tags: - account - shipping_address @@ -3586,19 +3664,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - subscription = client.get_subscription(subscription_id) - print("Got Subscription %s" % subscription) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { final ShippingAddress address = client.getShippingAddress(accountId, shippingAddressId); System.out.println("Fetched shipping address " + address.getId()); @@ -3626,10 +3695,23 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + address = @client.get_shipping_address( + account_id: account_id, + shipping_address_id: shipping_address_id + ) + puts "Got ShippingAddress #{address}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { const address = await client.getShippingAddress(accountId, shippingAddressId) console.log('Fetched shipping address: ', address.street1) @@ -3642,23 +3724,19 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - address = @client.get_shipping_address( - account_id: account_id, - shipping_address_id: shipping_address_id - ) - puts "Got ShippingAddress #{address}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + subscription = client.get_subscription(subscription_id) + print("Got Subscription %s" % subscription) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") put: tags: - account - shipping_address operationId: update_shipping_address @@ -3703,27 +3781,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - address_update = { - "first_name": "Aaron", - "last_name": "Du Monde", - "postal_code": "70130", - } - address = client.update_shipping_address( - account_id, shipping_address_id, address_update - ) - print("Updated ShippingAddress %s" % address) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { final ShippingAddressUpdate shadUpdate = new ShippingAddressUpdate(); shadUpdate.setFirstName("Aaron"); @@ -3760,10 +3821,29 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + address_update = { + first_name: "Aaron", + last_name: "Du Monde", + postal_code: "70130" + } + address = @client.update_shipping_address( + account_id: account_id, + shipping_address_id: shipping_address_id, + body: address_update + ) + puts "Updated ShippingAddress #{address}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { const shadUpdate = { firstName: "Benjamin", @@ -3780,29 +3860,27 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - address_update = { - first_name: "Aaron", - last_name: "Du Monde", - postal_code: "70130" - } - address = @client.update_shipping_address( - account_id: account_id, - shipping_address_id: shipping_address_id, - body: address_update - ) - puts "Updated ShippingAddress #{address}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + try: + address_update = { + "first_name": "Aaron", + "last_name": "Du Monde", + "postal_code": "70130", + } + address = client.update_shipping_address( + account_id, shipping_address_id, address_update + ) + print("Updated ShippingAddress %s" % address) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) delete: tags: - account - shipping_address operationId: remove_shipping_address @@ -3819,19 +3897,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - client.remove_shipping_address(account_id, shipping_address_id) - print("Removed ShippingAddress %s" % shipping_address_id) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { client.removeShippingAddress(accountId, shippingAddressId); System.out.println("Removed shipping address " + shippingAddressId); @@ -3859,10 +3928,23 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + @client.remove_shipping_address( + account_id: account_id, + shipping_address_id: shipping_address_id + ) + puts "Removed ShippingAddress #{shipping_address_id}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { await client.removeShippingAddress(accountId, shippingAddress.id) console.log('Removed shipping address: ', shippingAddress.street1) @@ -3875,23 +3957,19 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - @client.remove_shipping_address( - account_id: account_id, - shipping_address_id: shipping_address_id - ) - puts "Removed ShippingAddress #{shipping_address_id}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + client.remove_shipping_address(account_id, shipping_address_id) + print("Removed ShippingAddress %s" % shipping_address_id) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/accounts/{account_id}/subscriptions": get: tags: - subscription - account @@ -4104,21 +4182,21 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - acquisitions = client.list_account_acquisition(limit=200).items() - for acquisition in acquisitions: - print(acquisition.id) - lang: Ruby source: | acquisitions = @client.list_account_acquisition(limit: 200) acquisitions.each do |acquisition| puts "AccountAcquisition: #{acquisition.cost}" end + - lang: Python + source: | + acquisitions = client.list_account_acquisition(limit=200).items() + for acquisition in acquisitions: + print(acquisition.id) "/sites/{site_id}/coupons": get: tags: - coupon operationId: list_coupons @@ -4155,15 +4233,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - coupons = client.list_coupons(limit=200).items() - for coupon in coupons: - print(coupon.code) - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time final Pager<Coupon> coupons = client.listCoupons(params); @@ -4176,23 +4249,28 @@ var coupons = client.ListCoupons(limit: 200); foreach(Coupon coupon in coupons) { Console.WriteLine(coupon.Code); } + - lang: Ruby + source: | + coupons = @client.list_coupons(limit: 200) + coupons.each do |coupon| + puts "coupon: #{coupon.code}" + end - lang: Node.js source: | const coupons = client.listCoupons({ limit: 200 }) for await (const coupon of coupons.each()) { console.log(coupon.code) } - - lang: Ruby + - lang: Python source: | - coupons = @client.list_coupons(limit: 200) - coupons.each do |coupon| - puts "coupon: #{coupon.code}" - end + coupons = client.list_coupons(limit=200).items() + for coupon in coupons: + print(coupon.code) post: tags: - coupon operationId: create_coupon summary: Create a new coupon @@ -4234,26 +4312,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - coupon_create = { - "name": "Promotional Coupon", - "code": coupon_code, - "discount_type": "fixed", - "currencies": [{"currency": "USD", "discount": 10000}], - } - coupon = client.create_coupon(coupon_create) - print("Created Coupon %s" % coupon) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { CouponCreate couponCreate = new CouponCreate(); @@ -4299,10 +4361,26 @@ rescue Recurly::Errors::ValidationError => e # If the request was invalid, you may want to tell your user # why. You can find the invalid params and reasons in e.recurly_error.params puts "ValidationError: #{e.recurly_error.params}" end + - lang: Python + source: | + try: + coupon_create = { + "name": "Promotional Coupon", + "code": coupon_code, + "discount_type": "fixed", + "currencies": [{"currency": "USD", "discount": 10000}], + } + coupon = client.create_coupon(coupon_create) + print("Created Coupon %s" % coupon) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/coupons/{coupon_id}": get: tags: - coupon operationId: get_coupon @@ -4328,19 +4406,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - coupon = client.get_coupon(coupon_id) - print("Got Coupon %s" % coupon) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { final Coupon coupon = client.getCoupon(couponId); System.out.println("Fetched coupon " + coupon.getCode()); @@ -4368,10 +4437,20 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + coupon = @client.get_coupon(coupon_id: coupon_id) + puts "Got Coupon #{coupon}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { const coupon = await client.getCoupon(couponId) console.log('Fetched coupon: ', coupon.code) @@ -4384,20 +4463,19 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - coupon = @client.get_coupon(coupon_id: coupon_id) - puts "Got Coupon #{coupon}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + coupon = client.get_coupon(coupon_id) + print("Got Coupon %s" % coupon) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") put: tags: - coupon operationId: update_coupon summary: Update an active coupon @@ -4439,10 +4517,11 @@ description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/coupons/{coupon_id}/generate": post: tags: - coupon - unique_coupon_code @@ -4482,10 +4561,11 @@ description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/coupons/{coupon_id}/unique_coupon_codes": get: tags: - coupon - unique_coupon_code @@ -4517,10 +4597,11 @@ description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/credit_payments": get: tags: - credit_payment operationId: list_credit_payments @@ -4572,23 +4653,23 @@ var payments = client.ListCreditPayments(limit: 200); foreach(CreditPayment payment in payments) { Console.WriteLine(payment.Uuid); } + - lang: Ruby + source: | + payments = @client.list_credit_payments(limit: 200) + payments.each do |payment| + puts "CreditPayment: #{payment.id}" + end - lang: Node.js source: | const payments = client.listCreditPayments({ limit: 200 }) for await (const payment of payments.each()) { console.log(payment.uuid) } - - lang: Ruby - source: | - payments = @client.list_credit_payments(limit: 200) - payments.each do |payment| - puts "CreditPayment: #{payment.id}" - end "/sites/{site_id}/credit_payments/{credit_payment_id}": get: tags: - credit_payment operationId: get_credit_payment @@ -4613,10 +4694,11 @@ description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/custom_field_definitions": get: tags: - custom_field_definition operationId: list_custom_field_definitions @@ -4662,15 +4744,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - custom_fields = client.list_custom_field_definitions(limit=200).items() - for custom_field in custom_fields: - print(custom_field.name) - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time final Pager<CustomFieldDefinition> fields = client.listCustomFieldDefinitions(params); @@ -4683,23 +4760,28 @@ var fields = client.ListCustomFieldDefinitions(limit: 200); foreach(CustomFieldDefinition def in fields) { Console.WriteLine(def.DisplayName); } + - lang: Ruby + source: | + custom_fields = @client.list_custom_field_definitions(limit: 200) + custom_fields.each do |field| + puts "CustomFieldDefinition: #{field.name}" + end - lang: Node.js source: | const definitions = client.listCustomFieldDefinitions({ limit: 200 }) for await (const definition of definitions.each()) { console.log(definition.displayName) } - - lang: Ruby + - lang: Python source: | - custom_fields = @client.list_custom_field_definitions(limit: 200) - custom_fields.each do |field| - puts "CustomFieldDefinition: #{field.name}" - end + custom_fields = client.list_custom_field_definitions(limit=200).items() + for custom_field in custom_fields: + print(custom_field.name) "/sites/{site_id}/custom_field_definitions/{custom_field_definition_id}": get: tags: - custom_field_definition operationId: get_custom_field_definition @@ -4812,10 +4894,45 @@ description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: + - lang: Java + source: | + QueryParams params = new QueryParams(); + params.setLimit(200); // Pull 200 records at a time + Pager<Item> items = client.listItems(params); + + for (Item item : items) { + System.out.println(item.getCode()); + } + - lang: ".NET" + source: | + var items = client.ListItems(limit: 200); + foreach(Item item in items) + { + Console.WriteLine(item.Code); + } + - lang: Ruby + source: | + items = @client.list_items(limit: 200) + items.each do |item| + puts "Item: #{item.code}" + end + - lang: Node.js + source: | + const items = client.listItems({ limit: 200 }) + + for await (const item of items.each()) { + console.log(item.code) + } + - lang: Python + source: | + items = client.list_items(limit=200).items() + for item in items: + print(item.code) post: tags: - item operationId: create_item summary: Create a new item @@ -4856,10 +4973,147 @@ description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: + - lang: Java + source: | + try { + ItemCreate itemReq = new ItemCreate(); + + itemReq.setCode(itemCode); + itemReq.setName("Item Name"); + itemReq.setDescription("Item Description"); + itemReq.setExternalSku("a35JE-44"); + itemReq.setAccountingCode("item-code-127"); + itemReq.setRevenueScheduleType("at_range_end"); + + List<CustomField> customFields = new ArrayList<>(); + CustomField customField = new CustomField(); + customField.setName("custom-field-1"); + customField.setValue("Custom Field 1 value"); + customFields.add(customField); + + itemReq.setCustomFields(customFields); + + + Item item = client.createItem(itemReq); + System.out.println("Created item " + item.getCode()); + } catch (ValidationException e) { + // If the request was not valid, you may want to tell your user + // why. You can find the invalid params and reasons in e.getError().getParams() + System.out.println("Failed validation: " + e.getError().getMessage()); + } catch (ApiException e) { + // Use ApiException to catch a generic error from the API + System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); + } + - lang: ".NET" + source: | + try + { + var itemReq = new ItemCreate() + { + Code = itemCode, + Name = "Item Name", + Description = "Item Description", + ExternalSku = "a35JE-44", + AccountingCode = "item-code-127", + RevenueScheduleType = "at_range_end", + CustomFields = new List<CustomField>() { + new CustomField() { + Name = "custom-field-1", + Value = "Custom Field 1 value" + } + } + }; + Item item = client.CreateItem(itemReq); + Console.WriteLine($"Created item {item.Code}"); + } + catch (Recurly.Errors.Validation ex) + { + // If the request was not valid, you may want to tell your user + // why. You can find the invalid params and reasons in ex.Error.Params + Console.WriteLine($"Failed validation: {ex.Error.Message}"); + } + catch (Recurly.Errors.ApiError ex) + { + // Use ApiError to catch a generic error from the API + Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); + } + - lang: Ruby + source: | + begin + item_create = { + code: item_code, + name: "Item Name", + description: "Item Description", + external_sku: "a35JE-44", + accounting_code: "item-code-127", + revenue_schedule_type: "at_range_end", + custom_fields: [{ + name: "custom-field-1", + value: "Custom Field 1 value" + }] + } + item = @client.create_item(body: item_create) + puts "Created Item #{item}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end + - lang: Node.js + source: | + try { + const itemCreate = { + code: itemCode, + name: "Item Name", + description: "Item Description", + external_sku: "a35JE-44", + accounting_code: "item-code-127", + revenue_schedule_type: "at_range_end", + custom_fields: [{ + name: "custom-field-1", + value: "Custom Field 1 value" + }] + } + const item = await client.createItem(itemCreate) + console.log('Created Item: ', item.code) + } catch (err) { + if (err instanceof recurly.errors.ValidationError) { + // If the request was not valid, you may want to tell your user + // why. You can find the invalid params and reasons in err.params + console.log('Failed validation', err.params) + } else { + // If we don't know what to do with the err, we should + // probably re-raise and let our web framework and logger handle it + console.log('Unknown Error: ', err) + } + } + - lang: Python + source: | + try: + item_create = { + "code": item_code, + "name": "Item Name", + "description": "Item Description", + "external_sku": "a35JE-44", + "accounting_code": "item-code-127", + "revenue_schedule_type": "at_range_end", + "custom_fields": [{ + "name": "custom-field-1", + "value": "Custom Field 1 value" + }] + } + item = client.create_item(item_create) + print("Created Item %s" % item) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/items/{item_id}": get: tags: - item operationId: get_item @@ -4884,10 +5138,77 @@ description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: + - lang: Java + source: | + try { + final Item item = client.getItem(itemId); + System.out.println("Fetched item: " + item.getCode()); + } catch (NotFoundException e) { + // If the resource was not found + // we may want to alert the user or just return null + System.out.println("Resource Not Found: " + e.getError().getMessage()); + } catch (ApiException e) { + // Use ApiException to catch a generic error from the API + System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); + } + - lang: ".NET" + source: | + try + { + Item item = client.GetItem(itemId); + Console.WriteLine($"Fetched item {item.Code}"); + } + catch (Recurly.Errors.NotFound ex) + { + // If the resource was not found + // we may want to alert the user or just return null + Console.WriteLine($"Resource Not Found: {ex.Error.Message}"); + } + catch (Recurly.Errors.ApiError ex) + { + // Use ApiError to catch a generic error from the API + Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); + } + - lang: Ruby + source: | + begin + item = @client.get_item(item_id: item_id) + puts "Got Item #{item}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end + - lang: Node.js + source: | + try { + const item = await client.getItem(itemId) + console.log('Fetched item: ', item.code) + } catch (err) { + if (err instanceof recurly.errors.NotFoundError) { + // If the request was not found, you may want to alert the user or + // just return null + console.log('Resource Not Found') + } else { + // If we don't know what to do with the err, we should + // probably re-raise and let our web framework and logger handle it + console.log('Unknown Error: ', err) + } + } + - lang: Python + source: | + try: + item = client.get_item(item_id) + print("Got Item %s" % item) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") put: tags: - item operationId: update_item summary: Update an active item @@ -4929,10 +5250,104 @@ description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: + - lang: Java + source: | + try { + final ItemUpdate itemUpdate = new ItemUpdate(); + itemUpdate.setName("New Item Name"); + itemUpdate.setDescription("New Item Description"); + + final Item item = client.updateItem(itemId, itemUpdate); + System.out.println("Updated item: " + item.getCode()); + System.out.println(item.getName()); + System.out.println(item.getDescription()); + } catch (ValidationException e) { + // If the request was not valid, you may want to tell your user + // why. You can find the invalid params and reasons in e.getError().getParams() + System.out.println("Failed validation: " + e.getError().getMessage()); + } catch (ApiException e) { + // Use ApiException to catch a generic error from the API + System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); + } + - lang: ".NET" + source: | + try + { + var itemReq = new ItemUpdate() { + Name = "New Item Name", + Description = "New Item Description", + }; + Item item = client.UpdateItem(itemId, itemReq); + Console.WriteLine(item.Name); + Console.WriteLine(item.Description); + } + catch (Recurly.Errors.Validation ex) + { + // If the request was not valid, you may want to tell your user + // why. You can find the invalid params and reasons in ex.Error.Params + Console.WriteLine($"Failed validation: {ex.Error.Message}"); + } + catch (Recurly.Errors.ApiError ex) + { + // Use ApiError to catch a generic error from the API + Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); + } + - lang: Ruby + source: | + begin + item_update = { + name: "New Item Name", + description: "New Item Description" + } + item = @client.update_item( + item_id: item_id, + body: item_update + ) + puts "Updated Item #{item}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end + - lang: Node.js + source: | + try { + const itemUpdate = { + name: 'New Item Name', + description: 'New Item Description' + } + const item = await client.updateItem(itemId, itemUpdate) + console.log('Updated item: ', item) + } catch (err) { + if (err instanceof recurly.errors.ValidationError) { + // If the request was not valid, you may want to tell your user + // why. You can find the invalid params and reasons in err.params + console.log('Failed validation', err.params) + } else { + // If we don't know what to do with the err, we should + // probably re-raise and let our web framework and logger handle it + console.log('Unknown Error: ', err) + } + } + - lang: Python + source: | + try: + item_update = { + "name": "New Item Name", + "description": "New Item Description", + } + item = client.update_item(item_id, item_update) + print("Updated Item %s" % item) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) delete: tags: - item operationId: deactivate_item summary: Deactivate an item @@ -4958,10 +5373,76 @@ description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: + - lang: Java + source: | + try { + Item item = client.deactivateItem(itemId); + System.out.println("deactivated item " + item.getCode()); + } catch (ValidationException e) { + // If the request was not valid, you may want to tell your user + // why. You can find the invalid params and reasons in e.getError().getParams() + System.out.println("Failed validation: " + e.getError().getMessage()); + } catch (ApiException e) { + // Use ApiException to catch a generic error from the API + System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); + } + - lang: ".NET" + source: | + try + { + Item item = client.DeactivateItem(itemId); + Console.WriteLine($"Deactivated item {item.Code}"); + } + catch (Recurly.Errors.Validation ex) + { + // If the request was not valid, you may want to tell your user + // why. You can find the invalid params and reasons in ex.Error.Params + Console.WriteLine($"Failed validation: {ex.Error.Message}"); + } + catch (Recurly.Errors.ApiError ex) + { + // Use ApiError to catch a generic error from the API + Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); + } + - lang: Ruby + source: | + begin + item = @client.deactivate_item(item_id: item_id) + puts "Deactivated Item #{item}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end + - lang: Node.js + source: | + try { + const item = await client.deactivateItem(itemId) + console.log('Deleted item: ', item.code) + } catch (err) { + if (err && err.type === 'not-found') { + // If the request was not found, you may want to alert the user or + // just return null + console.log('Resource Not Found') + } + // If we don't know what to do with the err, we should + // probably re-raise and let our web framework and logger handle it + throw err + } + - lang: Python + source: | + try: + item = client.deactivate_item(item_id) + print("Deactivated Item %s" % item) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/items/{item_id}/reactivate": parameters: - "$ref": "#/components/parameters/site_id" - "$ref": "#/components/parameters/item_id" put: @@ -4994,10 +5475,76 @@ description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: + - lang: Java + source: | + try { + final Item item = client.reactivateItem(itemId); + System.out.println("Reactivated item: " + item.getCode()); + } catch (ValidationException e) { + // If the request was not valid, you may want to tell your user + // why. You can find the invalid params and reasons in e.getError().getParams() + System.out.println("Failed validation: " + e.getError().getMessage()); + } catch (ApiException e) { + // Use ApiException to catch a generic error from the API + System.out.println("Unexpected Recurly Error: " + e.getError().getMessage()); + } + - lang: ".NET" + source: | + try + { + Item item = client.ReactivateItem(itemId); + Console.WriteLine($"Reactivated item {item.Code}"); + } + catch (Recurly.Errors.Validation ex) + { + // If the request was not valid, you may want to tell your user + // why. You can find the invalid params and reasons in ex.Error.Params + Console.WriteLine($"Failed validation: {ex.Error.Message}"); + } + catch (Recurly.Errors.ApiError ex) + { + // Use ApiError to catch a generic error from the API + Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); + } + - lang: Ruby + source: | + begin + item = @client.reactivate_item(item_id: item_id) + puts "Reactivated Item #{item}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end + - lang: Node.js + source: | + try { + const item = await client.reactivateItem(itemId) + console.log('Reactivated item: ', item.code) + } catch (err) { + if (err && err.type === 'not_found') { + // If the request was not found, you may want to alert the user or + // just return null + console.log('Resource Not Found') + } + // If we don't know what to do with the err, we should + // probably re-raise and let our web framework and logger handle it + throw err + } + - lang: Python + source: | + try: + item = client.reactivate_item(item_id) + print("Reactivated Item %s" % item) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/invoices": get: tags: - invoice operationId: list_invoices @@ -5035,15 +5582,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - invoices = client.list_invoices(limit=200).items() - for invoice in invoices: - print(invoice.number) - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time final Pager<Invoice> invoices = client.listInvoices(params); @@ -5056,23 +5598,28 @@ var invoices = client.ListInvoices(limit: 200); foreach(Invoice invoice in invoices) { Console.WriteLine(invoice.Number); } + - lang: Ruby + source: | + invoices = @client.list_invoices(limit: 200) + invoices.each do |invoice| + puts "Invoice: #{invoice.number}" + end - lang: Node.js source: | const invoices = client.listInvoices({ limit: 200 }) for await (const invoice of invoices.each()) { console.log(invoice.number) } - - lang: Ruby + - lang: Python source: | - invoices = @client.list_invoices(limit: 200) - invoices.each do |invoice| - puts "Invoice: #{invoice.number}" - end + invoices = client.list_invoices(limit=200).items() + for invoice in invoices: + print(invoice.number) "/sites/{site_id}/invoices/{invoice_id}": get: tags: - invoice operationId: get_invoice @@ -5098,19 +5645,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - invoice = client.get_invoice(invoice_id) - print("Got Invoice %s" % invoice) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { final Invoice invoice = client.getInvoice(invoiceId); System.out.println("Fetched invoice " + invoice.getNumber()); @@ -5138,10 +5676,20 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + invoice = @client.get_invoice(invoice_id: invoice_id) + puts "Got invoice #{invoice}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { const invoice = await client.getInvoice(invoiceId) console.log('Fetched Invoice: ', invoice.number) @@ -5154,20 +5702,19 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - invoice = @client.get_invoice(invoice_id: invoice_id) - puts "Got invoice #{invoice}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + invoice = client.get_invoice(invoice_id) + print("Got Invoice %s" % invoice) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") put: tags: - invoice operationId: put_invoice summary: Update an invoice @@ -5289,23 +5836,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - invoice = client.get_invoice_pdf(invoice_id) - print("Got Invoice %s" % invoice) - filename = "%s/pythoninvoice-%s.pdf" % (download_directory, invoice_id) - with open(filename, 'wb') as file: - file.write(invoice.data) - print("Saved Invoice PDF to %s" % filename) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { final BinaryFile invoice = client.getInvoicePdf(invoiceId); //System.out.println("Fetched invoice " + invoice.getData()); @@ -5343,10 +5877,23 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + invoice = @client.get_invoice_pdf(invoice_id: invoice_id) + puts "Got invoice #{invoice}" + filename = "#{download_directory}/rubyinvoice-#{invoice_id}.pdf" + IO.write(filename, invoice.data) + puts "Saved Invoice PDF to #{filename}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { const invoice = await client.getInvoicePdf(invoiceId) console.log('Fetched Invoice: ', invoice) @@ -5367,23 +5914,23 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - invoice = @client.get_invoice_pdf(invoice_id: invoice_id) - puts "Got invoice #{invoice}" - filename = "#{download_directory}/rubyinvoice-#{invoice_id}.pdf" - IO.write(filename, invoice.data) - puts "Saved Invoice PDF to #{filename}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + invoice = client.get_invoice_pdf(invoice_id) + print("Got Invoice %s" % invoice) + filename = "%s/pythoninvoice-%s.pdf" % (download_directory, invoice_id) + with open(filename, 'wb') as file: + file.write(invoice.data) + print("Saved Invoice PDF to %s" % filename) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/invoices/{invoice_id}/collect": put: tags: - invoice operationId: collect_invoice @@ -5455,10 +6002,20 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + invoice = @client.collect_invoice(invoice_id: invoice_id) + puts "Collected invoice #{invoice}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { const invoice = await client.collectInvoice(invoiceId) console.log('Collected invoice: ', invoice.number) @@ -5471,20 +6028,10 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby - source: | - begin - invoice = @client.collect_invoice(invoice_id: invoice_id) - puts "Collected invoice #{invoice}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end "/sites/{site_id}/invoices/{invoice_id}/mark_failed": put: tags: - invoice operationId: fail_invoice @@ -5551,10 +6098,20 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + invoice = @client.fail_invoice(invoice_id: invoice_id) + puts "Failed invoice #{invoice}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { const invoice = await client.failInvoice(invoiceId) console.log('Failed invoice: ', invoice.number) @@ -5567,20 +6124,10 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby - source: | - begin - invoice = @client.fail_invoice(invoice_id: invoice_id) - puts "Failed invoice #{invoice}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end "/sites/{site_id}/invoices/{invoice_id}/mark_successful": put: tags: - invoice operationId: mark_invoice_successful @@ -5616,20 +6163,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - invoice = client.mark_invoice_successful(invoice_id) - print("Marked Invoice successful %s" % invoice) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { final Invoice invoice = client.markInvoiceSuccessful(invoiceId); System.out.println("Marked invoice " + invoice.getNumber() + " successful"); @@ -5657,10 +6194,20 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + invoice = @client.mark_invoice_successful(invoice_id: invoice_id) + puts "Marked invoice sucessful #{invoice}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { const invoice = await client.markInvoiceSuccessful(invoiceId) console.log(`Marked invoice #${invoice.number} successful`) @@ -5674,20 +6221,20 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - invoice = @client.mark_invoice_successful(invoice_id: invoice_id) - puts "Marked invoice sucessful #{invoice}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + invoice = client.mark_invoice_successful(invoice_id) + print("Marked Invoice successful %s" % invoice) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/invoices/{invoice_id}/reopen": put: tags: - invoice operationId: reopen_invoice @@ -5751,10 +6298,20 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + invoice = @client.reopen_invoice(invoice_id: invoice_id) + puts "Reopened invoice #{invoice}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { const invoice = await client.reopenInvoice(invoiceId) console.log('Reopened invoice: ', invoice.number) @@ -5767,20 +6324,10 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby - source: | - begin - invoice = @client.reopen_invoice(invoice_id: invoice_id) - puts "Reopened invoice #{invoice}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end "/sites/{site_id}/invoices/{invoice_id}/void": put: tags: - invoice operationId: void_invoice @@ -5813,10 +6360,11 @@ description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/invoices/{invoice_id}/line_items": get: tags: - invoice - line_item @@ -5857,10 +6405,11 @@ description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/invoices/{invoice_id}/coupon_redemptions": get: tags: - invoice - coupon_redemption @@ -6011,21 +6560,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - invoice_refund = {"type": "amount", "amount": 100} - invoice = client.refund_invoice(invoice_id, invoice_refund) - print("Refunded Invoice %s" % invoice) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { final InvoiceRefund invoiceRefund = new InvoiceRefund(); invoiceRefund.setCreditCustomerNotes("Notes on credits"); @@ -6063,10 +6601,27 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + invoice_refund = { + type: "amount", + amount: 100, + } + invoice = @client.refund_invoice( + invoice_id: invoice_id, + body: invoice_refund + ) + puts "Refunded invoice #{invoice}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { const invoiceRefund = { creditCustomerNotes: "Notes on credits", @@ -6086,27 +6641,21 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - invoice_refund = { - type: "amount", - amount: 100, - } - invoice = @client.refund_invoice( - invoice_id: invoice_id, - body: invoice_refund - ) - puts "Refunded invoice #{invoice}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + try: + invoice_refund = {"type": "amount", "amount": 100} + invoice = client.refund_invoice(invoice_id, invoice_refund) + print("Refunded Invoice %s" % invoice) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/line_items": get: tags: - line_item operationId: list_line_items @@ -6146,15 +6695,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - line_items = client.list_line_items(limit=200).items() - for line_item in line_items: - print(line_item.id) - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time final Pager<LineItem> lineItems = client.listLineItems(params); @@ -6174,10 +6718,15 @@ const lineItems = client.listLineItems({ limit: 200 }) for await (const item of lineItems.each()) { console.log(`Item ${item.id} for ${item.amount}`) } + - lang: Python + source: | + line_items = client.list_line_items(limit=200).items() + for line_item in line_items: + print(line_item.id) "/sites/{site_id}/line_items/{line_item_id}": get: tags: - line_item operationId: get_line_item @@ -6203,19 +6752,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - line_item = client.get_line_item(line_item_id) - print("Got LineItem %s" % line_item) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { final LineItem lineItem = client.getLineItem(lineItemId); System.out.println("Fetched line item " + lineItem.getUuid()); @@ -6243,10 +6783,20 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + line_item = @client.get_line_item(line_item_id: line_item_id) + puts "Got LineItem #{line_item}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { const lineItem = await client.getLineItem(lineItemId) console.log('Fetched line item: ', lineItem.uuid) @@ -6259,20 +6809,19 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - line_item = @client.get_line_item(line_item_id: line_item_id) - puts "Got LineItem #{line_item}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + line_item = client.get_line_item(line_item_id) + print("Got LineItem %s" % line_item) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") delete: tags: - line_item operationId: remove_line_item summary: Delete an uninvoiced line item @@ -6299,19 +6848,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - client.remove_line_item(line_item_id) - print("Removed LineItem %s" % line_item_id) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { client.removeLineItem(lineItemId); System.out.println("Removed line item " + lineItemId); @@ -6339,10 +6879,22 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + @client.remove_line_item( + line_item_id: line_item_id + ) + puts "Removed LineItem #{line_item_id}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { await client.removeLineItem(lineItemId) console.log('Removed line item: ', lineItemId) @@ -6355,22 +6907,19 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - @client.remove_line_item( - line_item_id: line_item_id - ) - puts "Removed LineItem #{line_item_id}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + client.remove_line_item(line_item_id) + print("Removed LineItem %s" % line_item_id) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/plans": get: tags: - plan operationId: list_plans @@ -6408,15 +6957,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - plans = client.list_plans(limit=200).items() - for plan in plans: - print(plan.code) - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time final Pager<Plan> plans = client.listPlans(params); @@ -6429,23 +6973,28 @@ var plans = client.ListPlans(limit: 200); foreach(Plan plan in plans) { Console.WriteLine(plan.Code); } + - lang: Ruby + source: | + plans = @client.list_plans(limit: 200) + plans.each do |plan| + puts "Plan: #{plan.code}" + end - lang: Node.js source: | const plans = client.listPlans({ limit: 200 }) for await (const plan of plans.each()) { console.log(plan.code) } - - lang: Ruby + - lang: Python source: | - plans = @client.list_plans(limit: 200) - plans.each do |plan| - puts "Plan: #{plan.code}" - end + plans = client.list_plans(limit=200).items() + for plan in plans: + print(plan.code) post: tags: - plan operationId: create_plan summary: Create a plan @@ -6481,25 +7030,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - plan_create = { - "name": "Monthly Coffee Subscription", - "code": plan_code, - "currencies": [{"currency": "USD", "unit_amount": 10000}], - } - plan = client.create_plan(plan_create) - print("Created Plan %s" % plan) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { PlanCreate planCreate = new PlanCreate(); @@ -6551,36 +7085,10 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - - lang: Node.js - source: | - try { - const planCreate = { - name: 'Monthly Coffee Subscription', - code: planCode, - currencies: [ - { - currency: 'USD', - unitAmount: 10000 - } - ] - } - const plan = await client.createPlan(planCreate) - console.log('Created Plan: ', plan.code) - } catch (err) { - if (err instanceof recurly.errors.ValidationError) { - // If the request was not valid, you may want to tell your user - // why. You can find the invalid params and reasons in err.params - console.log('Failed validation', err.params) - } else { - // If we don't know what to do with the err, we should - // probably re-raise and let our web framework and logger handle it - console.log('Unknown Error: ', err) - } - } - lang: Ruby source: | begin plan_create = { code: plan_code, @@ -6604,10 +7112,51 @@ rescue Recurly::Errors::ValidationError => e # If the request was invalid, you may want to tell your user # why. You can find the invalid params and reasons in e.recurly_error.params puts "ValidationError: #{e.recurly_error.params}" end + - lang: Node.js + source: | + try { + const planCreate = { + name: 'Monthly Coffee Subscription', + code: planCode, + currencies: [ + { + currency: 'USD', + unitAmount: 10000 + } + ] + } + const plan = await client.createPlan(planCreate) + console.log('Created Plan: ', plan.code) + } catch (err) { + if (err instanceof recurly.errors.ValidationError) { + // If the request was not valid, you may want to tell your user + // why. You can find the invalid params and reasons in err.params + console.log('Failed validation', err.params) + } else { + // If we don't know what to do with the err, we should + // probably re-raise and let our web framework and logger handle it + console.log('Unknown Error: ', err) + } + } + - lang: Python + source: | + try: + plan_create = { + "name": "Monthly Coffee Subscription", + "code": plan_code, + "currencies": [{"currency": "USD", "unit_amount": 10000}], + } + plan = client.create_plan(plan_create) + print("Created Plan %s" % plan) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/plans/{plan_id}": get: tags: - plan operationId: get_plan @@ -6633,19 +7182,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - plan = client.get_plan(plan_id) - print("Got Plan %s" % plan) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { final Plan plan = client.getPlan(planId); System.out.println("Fetched plan " + plan.getCode()); @@ -6673,10 +7213,20 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + plan = @client.get_plan(plan_id: plan_id) + puts "Got plan #{plan}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { const plan = await client.getPlan(planId) console.log('Fetched plan: ', plan.code) @@ -6689,20 +7239,19 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - plan = @client.get_plan(plan_id: plan_id) - puts "Got plan #{plan}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + plan = client.get_plan(plan_id) + print("Got Plan %s" % plan) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") put: tags: - plan operationId: update_plan summary: Update a plan @@ -6907,15 +7456,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - add_ons = client.list_plan_add_ons(plan_id).items() - for add_on in add_ons: - print(add_on.code) - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time final Pager<AddOn> addOns = client.listPlanAddOns(planId, params); @@ -6930,10 +7474,15 @@ limit: 200 ) add_ons.each do |add_on| puts "AddOn: #{add_on.code}" end + - lang: Python + source: | + add_ons = client.list_plan_add_ons(plan_id).items() + for add_on in add_ons: + print(add_on.code) post: tags: - add-on - plan operationId: create_plan_add_on @@ -6971,26 +7520,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - add_on_create = { - "code": "coffee_grinder", - "name": "A quality grinder for your beans", - "default_quantity": 1, - "currencies": [{"currency": "USD", "unit_amount": 10000}], - } - add_on = client.create_plan_add_on(plan_id, add_on_create) - print("Created PlanAddOn %s" % add_on) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { AddOnCreate addOnCreate = new AddOnCreate(); @@ -7043,10 +7576,26 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Python + source: | + try: + add_on_create = { + "code": "coffee_grinder", + "name": "A quality grinder for your beans", + "default_quantity": 1, + "currencies": [{"currency": "USD", "unit_amount": 10000}], + } + add_on = client.create_plan_add_on(plan_id, add_on_create) + print("Created PlanAddOn %s" % add_on) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/plans/{plan_id}/add_ons/{add_on_id}": get: tags: - plan - add-on @@ -7074,19 +7623,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - shipping_addr = client.get_shipping_address(account_id, shipping_address_id) - print("Got ShippingAddress %s" % shipping_addr) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { final AddOn addOn = client.getPlanAddOn(planId, addOnId); System.out.println("Fetched add-on " + addOn.getCode()); @@ -7126,10 +7666,19 @@ rescue Recurly::Errors::NotFoundError # If the resource was not found, you may want to alert the user or # just return nil puts "Resource Not Found" end + - lang: Python + source: | + try: + shipping_addr = client.get_shipping_address(account_id, shipping_address_id) + print("Got ShippingAddress %s" % shipping_addr) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") put: tags: - plan - add-on operationId: update_plan_add_on @@ -7167,10 +7716,11 @@ description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] delete: tags: - plan - add-on operationId: remove_plan_add_on @@ -7190,10 +7740,11 @@ description: Incorrect site, plan, or add-on ID. content: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/add_ons": get: tags: - add-on operationId: list_add_ons @@ -7275,10 +7826,11 @@ description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/shipping_methods": get: tags: - shipping_method operationId: list_shipping_methods @@ -7314,10 +7866,11 @@ description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/shipping_methods/{id}": get: tags: - shipping_method operationId: get_shipping_method @@ -7348,10 +7901,11 @@ description: Unexpected error content: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/subscriptions": get: tags: - subscription operationId: list_subscriptions @@ -7389,15 +7943,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - subscriptions = client.list_subscriptions(limit=200).items() - for subscription in subscriptions: - print(subscription.uuid) - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time final Pager<Subscription> subscriptions = client.listSubscriptions(params); @@ -7410,23 +7959,28 @@ var subscriptions = client.ListSubscriptions(limit: 200); foreach(Subscription subscription in subscriptions) { Console.WriteLine(subscription.Uuid); } + - lang: Ruby + source: | + subscriptions = @client.list_subscriptions(limit: 200) + subscriptions.each do |subscription| + puts "Subscription: #{subscription.uuid}" + end - lang: Node.js source: | const subscriptions = client.listSubscriptions({ limit: 200 }) for await (const subscription of subscriptions.each()) { console.log(subscription.uuid) } - - lang: Ruby + - lang: Python source: | - subscriptions = @client.list_subscriptions(limit: 200) - subscriptions.each do |subscription| - puts "Subscription: #{subscription.uuid}" - end + subscriptions = client.list_subscriptions(limit=200).items() + for subscription in subscriptions: + print(subscription.uuid) post: tags: - subscription operationId: create_subscription summary: Create a new subscription @@ -7463,25 +8017,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - sub_create = { - "plan_code": plan_code, - "currency": "USD", - "account": {"code": account_code}, - } - sub = client.create_subscription(sub_create) - print("Created Subscription %s" % sub) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { SubscriptionCreate subscriptionCreate = new SubscriptionCreate(); AccountCreate accountCreate = new AccountCreate(); @@ -7526,10 +8065,31 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + subscription_create = { + plan_code: plan_code, + currency: "USD", + # This can be an existing account or + # a new acocunt + account: { + code: account_code, + } + } + subscription = @client.create_subscription( + body: subscription_create + ) + puts "Created Subscription #{subscription}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { let subscriptionReq = { planCode: planCode, @@ -7549,31 +8109,25 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - subscription_create = { - plan_code: plan_code, - currency: "USD", - # This can be an existing account or - # a new acocunt - account: { - code: account_code, + try: + sub_create = { + "plan_code": plan_code, + "currency": "USD", + "account": {"code": account_code}, } - } - subscription = @client.create_subscription( - body: subscription_create - ) - puts "Created Subscription #{subscription}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + sub = client.create_subscription(sub_create) + print("Created Subscription %s" % sub) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/subscriptions/{subscription_id}": get: tags: - subscription operationId: get_subscription @@ -7599,19 +8153,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - subscription = client.get_subscription(subscription_id) - print("Got Subscription %s" % subscription) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { final Subscription subscription = client.getSubscription(subscriptionId); System.out.println("Fetched Subscription: " + subscription.getUuid()); @@ -7639,10 +8184,22 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + subscription = @client.get_subscription( + subscription_id: subscription_id + ) + puts "Got Subscription #{subscription}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { const subscription = await client.getSubscription(subscriptionId) console.log('Fetched subscription: ', subscription.uuid) @@ -7655,22 +8212,19 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - subscription = @client.get_subscription( - subscription_id: subscription_id - ) - puts "Got Subscription #{subscription}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + subscription = client.get_subscription(subscription_id) + print("Got Subscription %s" % subscription) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") put: tags: - subscription operationId: modify_subscription summary: Modify a subscription @@ -7698,21 +8252,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - sub_update = {"customer_notes": "New Notes", "terms_and_conditions": "New TaC"} - subscription = client.modify_subscription(subscription_id, sub_update) - print("Modified Subscription %s" % subscription) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { final SubscriptionUpdate subUpdate = new SubscriptionUpdate(); subUpdate.setTermsAndConditions("Some new terms and conditions"); @@ -7748,10 +8291,27 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + subscription_update = { + customer_notes: "New Notes", + terms_and_conditions: "New ToC" + } + subscription = @client.modify_subscription( + subscription_id: subscription_id, + body: subscription_update + ) + puts "Modified Subscription #{subscription}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { const update = { termsAndConditions: "Some new terms and conditions", @@ -7769,27 +8329,21 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - subscription_update = { - customer_notes: "New Notes", - terms_and_conditions: "New ToC" - } - subscription = @client.modify_subscription( - subscription_id: subscription_id, - body: subscription_update - ) - puts "Modified Subscription #{subscription}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + try: + sub_update = {"customer_notes": "New Notes", "terms_and_conditions": "New TaC"} + subscription = client.modify_subscription(subscription_id, sub_update) + print("Modified Subscription %s" % subscription) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) delete: tags: - subscription operationId: terminate_subscription summary: Terminate a subscription @@ -7844,19 +8398,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - subscription = client.terminate_subscription(subscription_id) - print("Terminated Subscription %s" % subscription) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { QueryParams queryParams = new QueryParams(); queryParams.setRefund("none"); // "full" for a full refund, "partial" for prorated refund @@ -7886,10 +8431,22 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + subscription = @client.terminate_subscription( + subscription_id: subscription_id, + ) + puts "Terminated Subscription #{subscription}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { const subscription = await client.terminateSubscription(subscriptionId) console.log('Terminated subscription: ', subscription.uuid) @@ -7902,22 +8459,19 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - subscription = @client.terminate_subscription( - subscription_id: subscription_id, - ) - puts "Terminated Subscription #{subscription}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + subscription = client.terminate_subscription(subscription_id) + print("Terminated Subscription %s" % subscription) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/subscriptions/{subscription_id}/cancel": put: tags: - subscription operationId: cancel_subscription @@ -7961,19 +8515,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - subscription = client.cancel_subscription(subscription_id) - print("Canceled Subscription %s" % subscription) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { final Subscription subscription = client.cancelSubscription(subscriptionId); System.out.println("Canceled Subscription: " + subscription.getUuid()); @@ -8001,10 +8546,22 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + subscription = @client.cancel_subscription( + subscription_id: subscription_id + ) + puts "Canceled Subscription #{subscription}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { let expiredSub = await client.cancelSubscription(subscriptionId) console.log('Canceled Subscription: ', expiredSub.uuid) @@ -8017,22 +8574,19 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - subscription = @client.cancel_subscription( - subscription_id: subscription_id - ) - puts "Canceled Subscription #{subscription}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + subscription = client.cancel_subscription(subscription_id) + print("Canceled Subscription %s" % subscription) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/subscriptions/{subscription_id}/reactivate": put: tags: - subscription operationId: reactivate_subscription @@ -8100,10 +8654,22 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + subscription = @client.reactivate_subscription( + subscription_id: subscription_id + ) + puts "Reactivated Canceled Subscription #{subscription}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { const subscription = await client.reactivateSubscription(subscriptionId) console.log('Reactivated subscription: ', subscription.uuid) @@ -8117,22 +8683,10 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby - source: | - begin - subscription = @client.reactivate_subscription( - subscription_id: subscription_id - ) - puts "Reactivated Canceled Subscription #{subscription}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end "/sites/{site_id}/subscriptions/{subscription_id}/pause": put: tags: - subscription operationId: pause_subscription @@ -8177,21 +8731,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - sub_pause = {"remaining_pause_cycles": 10} - subscription = client.pause_subscription(subscription_id, sub_pause) - print("Paused Subscription %s" % subscription) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { final SubscriptionPause subPause = new SubscriptionPause(); subPause.setRemainingPauseCycles(10); @@ -8220,10 +8763,21 @@ rescue Recurly::Errors::NotFoundError # If the resource was not found, you may want to alert the user or # just return nil puts "Resource Not Found" end + - lang: Python + source: | + try: + sub_pause = {"remaining_pause_cycles": 10} + subscription = client.pause_subscription(subscription_id, sub_pause) + print("Paused Subscription %s" % subscription) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/subscriptions/{subscription_id}/resume": put: tags: - subscription operationId: resume_subscription @@ -8261,20 +8815,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - subscription = client.resume_subscription(subscription_id) - print("Resumed Subscription %s" % subscription) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Ruby source: | begin subscription = @client.resume_subscription( subscription_id: subscription_id @@ -8283,10 +8827,61 @@ rescue Recurly::Errors::NotFoundError # If the resource was not found, you may want to alert the user or # just return nil puts "Resource Not Found" end + - lang: Python + source: | + try: + subscription = client.resume_subscription(subscription_id) + print("Resumed Subscription %s" % subscription) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) + "/sites/{site_id}/subscriptions/{subscription_id}/convert_trial": + put: + tags: + - subscription + operationId: convert_trial + summary: Convert trial subscription + description: This will immediately convert a trial subscription to a fully active + paid subscription, creating and collecting an invoice for auto-collecting + subsriptions. If the invoice cannot be collected, the subscription will remain + in trial. The subscription must be in a trial. Active, paused, expired, cancelled, + or failed subscriptions cannot be converted. + parameters: + - "$ref": "#/components/parameters/site_id" + - "$ref": "#/components/parameters/subscription_id" + responses: + '200': + description: A subscription. + content: + application/json: + schema: + "$ref": "#/components/schemas/Subscription" + '404': + description: Incorrect site or subscription ID. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '422': + description: A validation error such as "Unable to convert active subscription", + or a transaction error if the invoice could not be collected. + content: + application/json: + schema: + "$ref": "#/components/schemas/ErrorMayHaveTransaction" + default: + description: Unexpected error. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/subscriptions/{subscription_id}/change": get: tags: - subscription - subscription_change @@ -8326,19 +8921,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - change = client.get_subscription_change(subscription_id) - print("Got SubscriptionChange %s" % change) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { final SubscriptionChange change = client.getSubscriptionChange(subscriptionId); System.out.println("Fetched Subscription change " + change.getId()); @@ -8366,10 +8952,22 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + change = @client.get_subscription_change( + subscription_id: subscription_id + ) + puts "Got SubscriptionChange #{change}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { const change = await client.getSubscriptionChange(subscriptionId) console.log('Fetched subscription change: ', change.id) @@ -8382,22 +8980,19 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - change = @client.get_subscription_change( - subscription_id: subscription_id - ) - puts "Got SubscriptionChange #{change}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + change = client.get_subscription_change(subscription_id) + print("Got SubscriptionChange %s" % change) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") post: tags: - subscription - subscription_change operationId: create_subscription_change @@ -8437,21 +9032,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - sub_change_create = {"plan_code": new_plan_code, "timeframe": "now"} - change = client.create_subscription_change(subscription_id, sub_change_create) - print("Created SubscriptionChange %s" % change) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { SubscriptionChangeCreate changeCreate = new SubscriptionChangeCreate(); @@ -8489,10 +9073,27 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + change_create = { + timeframe: "now", + plan_code: new_plan_code + } + change = @client.create_subscription_change( + subscription_id: subscription_id, + body: change_create + ) + puts "Created SubscriptionChange #{change}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { const subscriptionChangeCreate = { planCode: newPlanCode, @@ -8510,27 +9111,21 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - change_create = { - timeframe: "now", - plan_code: new_plan_code - } - change = @client.create_subscription_change( - subscription_id: subscription_id, - body: change_create - ) - puts "Created SubscriptionChange #{change}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + try: + sub_change_create = {"plan_code": new_plan_code, "timeframe": "now"} + change = client.create_subscription_change(subscription_id, sub_change_create) + print("Created SubscriptionChange %s" % change) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) delete: tags: - subscription - subscription_change operationId: remove_subscription_change @@ -8554,19 +9149,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - client.remove_subscription_change(subscription_id) - print("Removed SubscriptionChange from Subscription id=%s" % subscription_id) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { client.removeSubscriptionChange(subscriptionId); System.out.println("Removed Subscription change from " + subscriptionId); @@ -8594,10 +9180,22 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + @client.remove_subscription_change( + subscription_id: subscription_id + ) + puts "Removed SubscriptionChange #{subscription_id}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { await client.removeSubscriptionChange(subscriptionId) console.log('Removed subscription change: ', subscriptionId) @@ -8610,22 +9208,19 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - @client.remove_subscription_change( - subscription_id: subscription_id - ) - puts "Removed SubscriptionChange #{subscription_id}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + client.remove_subscription_change(subscription_id) + print("Removed SubscriptionChange from Subscription id=%s" % subscription_id) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/subscriptions/{subscription_id}/invoices": get: tags: - invoice - subscription @@ -8665,15 +9260,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - invoices = client.list_subscription_invoices(subscription_id).items() - for invoice in invoices: - print(invoice.number) - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time final Pager<Invoice> invoices = client.listSubscriptionInvoices(subscriptionId, params); @@ -8688,10 +9278,15 @@ limit: 200 ) invoices.each do |invoice| puts "Invoice: #{invoice.number}" end + - lang: Python + source: | + invoices = client.list_subscription_invoices(subscription_id).items() + for invoice in invoices: + print(invoice.number) "/sites/{site_id}/subscriptions/{subscription_id}/line_items": get: tags: - subscription operationId: list_subscription_line_items @@ -8732,15 +9327,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - line_items = client.list_subscription_line_items(subscription_id).items() - for line_item in line_items: - print(line_item.id) - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time final Pager<LineItem> lineItems = client.listSubscriptionLineItems(subscriptionId, params); @@ -8755,10 +9345,15 @@ limit: 200 ) line_items.each do |line_item| puts "LineItem: #{line_item.id}" end + - lang: Python + source: | + line_items = client.list_subscription_line_items(subscription_id).items() + for line_item in line_items: + print(line_item.id) "/sites/{site_id}/subscriptions/{subscription_id}/coupon_redemptions": get: tags: - subscription - coupon_redemption @@ -8789,15 +9384,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - redemptions = client.list_subscription_coupon_redemptions(subscription_id).items() - for redemption in redemptions: - print(redemption.uuid) - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time final Pager<CouponRedemption> redemptions = client.listSubscriptionCouponRedemptions(subscriptionId, params); @@ -8812,10 +9402,15 @@ limit: 200 ) coupon_redemptions.each do |redemption| puts "CouponRedemption: #{redemption.id}" end + - lang: Python + source: | + redemptions = client.list_subscription_coupon_redemptions(subscription_id).items() + for redemption in redemptions: + print(redemption.uuid) "/sites/{site_id}/transactions": get: tags: - transaction operationId: list_transactions @@ -8854,15 +9449,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - transactions = client.list_transactions(limit=200).items() - for transaction in transactions: - print(transaction.uuid) - lang: Java source: | QueryParams params = new QueryParams(); params.setLimit(200); // Pull 200 records at a time final Pager<Transaction> transactions = client.listTransactions(params); @@ -8875,23 +9465,28 @@ var transactions = client.ListTransactions(limit: 200); foreach(Transaction transaction in transactions) { Console.WriteLine(transaction.Uuid); } + - lang: Ruby + source: | + transactions = @client.list_transactions(limit: 200) + transactions.each do |transaction| + puts "Transaction: #{transaction.uuid}" + end - lang: Node.js source: | const transactions = client.listTransactions({ limit: 200 }) for await (const transaction of transactions.each()) { console.log(transaction.uuid) } - - lang: Ruby + - lang: Python source: | - transactions = @client.list_transactions(limit: 200) - transactions.each do |transaction| - puts "Transaction: #{transaction.uuid}" - end + transactions = client.list_transactions(limit=200).items() + for transaction in transactions: + print(transaction.uuid) "/sites/{site_id}/transactions/{transaction_id}": get: tags: - transaction operationId: get_transaction @@ -8948,10 +9543,20 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + transaction = @client.get_transaction(transaction_id: transaction_id) + puts "Got Transaction #{transaction}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { const transaction = await client.getTransaction(transactionId) console.log('Fetched transaction: ', transaction.uuid) @@ -8964,20 +9569,10 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby - source: | - begin - transaction = @client.get_transaction(transaction_id: transaction_id) - puts "Got Transaction #{transaction}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end "/sites/{site_id}/unique_coupon_codes/{unique_coupon_code_id}": parameters: - "$ref": "#/components/parameters/site_id" - "$ref": "#/components/parameters/unique_coupon_code_id" get: @@ -9002,10 +9597,11 @@ description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] delete: tags: - unique_coupon_code operationId: deactivate_unique_coupon_code summary: Deactivate a unique coupon code @@ -9034,10 +9630,11 @@ description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/unique_coupon_codes/{unique_coupon_code_id}/restore": parameters: - "$ref": "#/components/parameters/site_id" - "$ref": "#/components/parameters/unique_coupon_code_id" put: @@ -9068,10 +9665,11 @@ description: Unexpected error. content: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/purchases": post: tags: - purchase operationId: create_purchase @@ -9111,31 +9709,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - purchase = { - "currency": "USD", - "account": { - "code": account_code, - "first_name": "Benjamin", - "last_name": "Du Monde", - "billing_info": {"token_id": rjs_token_id}, - }, - "subscriptions": [{"plan_code": plan_code}], - } - invoice_collection = client.create_purchase(purchase) - print("Created Charge Invoice %s" % invoice_collection.charge_invoice) - print("Created Credit Invoices %s" % invoice_collection.credit_invoices) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { PurchaseCreate purchase = new PurchaseCreate(); purchase.setCurrency("USD"); @@ -9202,10 +9779,37 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + purchase = { + currency: "USD", + account: { + code: account_code, + first_name: "Benjamin", + last_name: "Du Monde", + billing_info: { + token_id: rjs_token_id + }, + }, + subscriptions: [ + { plan_code: plan_code } + ] + } + invoice_collection = @client.create_purchase( + body: purchase + ) + puts "Created Charge Invoice #{invoice_collection.charge_invoice}" + puts "Created Credit Invoices #{invoice_collection.credit_invoices}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { let purchaseReq = { currency: 'USD', @@ -9233,37 +9837,31 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - purchase = { - currency: "USD", - account: { - code: account_code, - first_name: "Benjamin", - last_name: "Du Monde", - billing_info: { - token_id: rjs_token_id - }, - }, - subscriptions: [ - { plan_code: plan_code } - ] - } - invoice_collection = @client.create_purchase( - body: purchase - ) - puts "Created Charge Invoice #{invoice_collection.charge_invoice}" - puts "Created Credit Invoices #{invoice_collection.credit_invoices}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + try: + purchase = { + "currency": "USD", + "account": { + "code": account_code, + "first_name": "Benjamin", + "last_name": "Du Monde", + "billing_info": {"token_id": rjs_token_id}, + }, + "subscriptions": [{"plan_code": plan_code}], + } + invoice_collection = client.create_purchase(purchase) + print("Created Charge Invoice %s" % invoice_collection.charge_invoice) + print("Created Credit Invoices %s" % invoice_collection.credit_invoices) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/purchases/preview": post: tags: - purchase operationId: preview_purchase @@ -9303,31 +9901,10 @@ content: application/json: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - purchase = { - "currency": "USD", - "account": { - "code": account_code, - "first_name": "Benjamin", - "last_name": "Du Monde", - "billing_info": {"token_id": rjs_token_id}, - }, - "subscriptions": [{"plan_code": plan_code}], - } - invoice_collection = client.preview_purchase(purchase) - print("Preview Charge Invoice %s" % invoice_collection.charge_invoice) - print("Preview Credit Invoices %s" % invoice_collection.credit_invoices) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: ".NET" source: | try { var purchaseReq = new PurchaseCreate() @@ -9360,10 +9937,37 @@ catch (Recurly.Errors.ApiError ex) { // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + purchase = { + currency: "USD", + account: { + code: account_code, + first_name: "Benjamin", + last_name: "Du Monde", + billing_info: { + token_id: rjs_token_id + }, + }, + subscriptions: [ + { plan_code: plan_code } + ] + } + invoice_collection = @client.preview_purchase( + body: purchase + ) + puts "Preview Charge Invoice #{invoice_collection.charge_invoice}" + puts "Preview Credit Invoices #{invoice_collection.credit_invoices}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { let purchaseReq = { currency: 'USD', @@ -9391,37 +9995,31 @@ // If we don't know what to do with the err, we should // probably re-raise and let our web framework and logger handle it console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - purchase = { - currency: "USD", - account: { - code: account_code, - first_name: "Benjamin", - last_name: "Du Monde", - billing_info: { - token_id: rjs_token_id - }, - }, - subscriptions: [ - { plan_code: plan_code } - ] - } - invoice_collection = @client.preview_purchase( - body: purchase - ) - puts "Preview Charge Invoice #{invoice_collection.charge_invoice}" - puts "Preview Credit Invoices #{invoice_collection.credit_invoices}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + try: + purchase = { + "currency": "USD", + "account": { + "code": account_code, + "first_name": "Benjamin", + "last_name": "Du Monde", + "billing_info": {"token_id": rjs_token_id}, + }, + "subscriptions": [{"plan_code": plan_code}], + } + invoice_collection = client.preview_purchase(purchase) + print("Preview Charge Invoice %s" % invoice_collection.charge_invoice) + print("Preview Credit Invoices %s" % invoice_collection.credit_invoices) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) servers: - url: https://v3.recurly.com components: parameters: site_id: @@ -10111,10 +10709,29 @@ shipping_addresses: type: array description: The shipping addresses on the account. items: "$ref": "#/components/schemas/ShippingAddress" + has_live_subscription: + type: boolean + description: Indicates if the account has a subscription that is either + active, canceled, future, or paused. + has_active_subscription: + type: boolean + description: Indicates if the account has an active subscription. + has_future_subscription: + type: boolean + description: Indicates if the account has a future subscription. + has_canceled_subscription: + type: boolean + description: Indicates if the account has a canceled subscription. + has_paused_subscription: + type: boolean + description: Indicates if the account has a paused subscription. + has_past_due_invoice: + type: boolean + description: Indicates if the account has a past due invoice. created_at: type: string format: date-time description: When the account was created. readOnly: true @@ -10527,10 +11144,22 @@ name: type: string title: Name description: Describes your add-on and will appear in subscribers' invoices. maxLength: 255 + item_id: + type: string + title: Item ID + maxLength: 13 + readOnly: true + external_sku: + type: string + title: External SKU + description: Optional, stock keeping unit to link the item to other inventory + systems. + maxLength: 50 + readOnly: true accounting_code: type: string title: Accounting code description: Accounting code for invoice line items for this add-on. If no value is provided, it defaults to add-on's code. @@ -10596,16 +11225,34 @@ default_quantity: type: integer title: Default quantity description: Default quantity for the hosted pages. default: 1 + optional: + type: boolean + title: Optional + description: Whether the add-on is optional for the customer to include + in their purchase on the hosted payment page. If false, the add-on will + be included when a subscription is created through the Recurly UI. However, + the add-on will not be included when a subscription is created through + the API. currencies: type: array title: Add-on pricing items: "$ref": "#/components/schemas/AddOnPricing" minItems: 1 + item: + "$ref": "#/components/schemas/ItemMini" + readOnly: true + external_sku: + type: string + title: External SKU + description: Optional, stock keeping unit to link the item to other inventory + systems. + maxLength: 50 + readOnly: true created_at: type: string format: date-time title: Created at readOnly: true @@ -10626,30 +11273,49 @@ AddOnCreate: type: object title: Add-on description: Full add-on details. properties: + item_code: + type: string + title: Item Code + description: 'Unique code to identify an item, when the `Catalog: Item Add-Ons` + feature is enabled. If `item_id` and `item_code` are both present, `item_id` + will be used.' + pattern: "/^[a-z0-9_+-]+$/" + maxLength: 50 + item_id: + type: string + title: Item ID + description: 'Available when the `Catalog: Item Add-Ons` feature is enabled. + If `item_id` and `item_code` are both present, `item_id` will be used.' + maxLength: 13 code: type: string title: Add-on code - description: The unique identifier for the add-on within its plan. + description: The unique identifier for the add-on within its plan. If `item_code`/`item_id` + is part of the request then `code` must be absent. If `item_code`/`item_id` + is not present `code` is required. maxLength: 50 name: type: string title: Name description: Describes your add-on and will appear in subscribers' invoices. + If `item_code`/`item_id` is part of the request then `code` must be absent. + If `item_code`/`item_id` is not present `code` is required. maxLength: 255 plan_id: type: string title: Plan ID maxLength: 13 readOnly: true accounting_code: type: string title: Accounting code description: Accounting code for invoice line items for this add-on. If - no value is provided, it defaults to add-on's code. + no value is provided, it defaults to add-on's code. If `item_code`/`item_id` + is part of the request then `code` must be absent. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 display_quantity: type: boolean title: Display quantity? @@ -10666,18 +11332,23 @@ title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's EU VAT tax feature to determine taxation rules. If you have your own AvaTax or Vertex account configured, use their tax codes to assign specific tax rules. If you are using Recurly's EU VAT feature, you can use values of - `unknown`, `physical`, or `digital`. + `unknown`, `physical`, or `digital`. If `item_code`/`item_id` is part + of the request then `code` must be absent. maxLength: 50 currencies: type: array title: Add-on pricing items: "$ref": "#/components/schemas/AddOnPricing" minItems: 1 + description: If `item_code`/`item_id` is part of the request and the item + has a default currency then `currencies` is optional. If the item does + not have a default currency, then `currencies` is required. If `item_code`/`item_id` + is not present `currencies` is required. required: - code - name - currencies AddOnUpdate: @@ -10691,32 +11362,36 @@ maxLength: 13 readOnly: true code: type: string title: Add-on code - description: The unique identifier for the add-on within its plan. + description: The unique identifier for the add-on within its plan. If an + `Item` is associated to the `AddOn` then `code` must be absent. maxLength: 50 name: type: string title: Name description: Describes your add-on and will appear in subscribers' invoices. + If an `Item` is associated to the `AddOn` then `name` must be absent. maxLength: 255 accounting_code: type: string title: Accounting code description: Accounting code for invoice line items for this add-on. If - no value is provided, it defaults to add-on's code. + no value is provided, it defaults to add-on's code. If an `Item` is associated + to the `AddOn` then `accounting code` must be absent. pattern: "/^[a-z0-9_+-]+$/" maxLength: 20 tax_code: type: string title: Tax code description: Optional field used by Avalara, Vertex, and Recurly's EU VAT tax feature to determine taxation rules. If you have your own AvaTax or Vertex account configured, use their tax codes to assign specific tax rules. If you are using Recurly's EU VAT feature, you can use values of - `unknown`, `physical`, or `digital`. + `unknown`, `physical`, or `digital`. If an `Item` is associated to the + `AddOn` then `tax code` must be absent. maxLength: 50 display_quantity: type: boolean title: Display quantity? description: Determines if the quantity field is displayed on the hosted @@ -10861,10 +11536,20 @@ type: string title: IP address description: "*STRONGLY RECOMMENDED* Customer's IP address when updating their billing information." maxLength: 20 + gateway_token: + type: string + title: A token used in place of a credit card in order to perform transactions. + Must be used in conjunction with `gateway_code`. + maxLength: 50 + gateway_code: + type: string + title: An identifier for a specific payment gateway. Must be used in conjunction + with `gateway_token`. + maxLength: 12 amazon_billing_agreement_id: type: string title: Amazon billing agreement ID paypal_billing_agreement_id: type: string @@ -11588,10 +12273,48 @@ title: Deleted at description: Definitions are initially soft deleted, and once all the values are removed from the accouts or subscriptions, will be hard deleted an no longer visible. readOnly: true + ItemMini: + type: object + title: Item mini details + description: Just the important parts. + properties: + id: + type: string + title: Item ID + maxLength: 13 + readOnly: true + object: + type: string + title: Object type + readOnly: true + code: + type: string + title: Item code + description: Unique code to identify the item. + pattern: "/^[a-z0-9_+-]+$/" + maxLength: 50 + state: + type: string + title: State + description: The current state of the item. + readOnly: true + enum: + - active + - inactive + name: + type: string + title: Name + description: This name describes your item and will appear on the invoice + when it's purchased on a one time basis. + maxLength: 255 + description: + type: string + title: Description + description: Optional, description. Item: type: object description: Full item details. properties: id: @@ -12288,10 +13011,16 @@ item_id: type: string title: Item ID description: Available when the Catalog feature is enabled. maxLength: 13 + external_sku: + type: string + title: External SKU + description: Optional Stock Keeping Unit assigned to an item, when the Catalog + feature is enabled. + maxLength: 50 revenue_schedule_type: type: string title: Revenue schedule type enum: - never @@ -12657,10 +13386,19 @@ item. This can be used to later reporting on product purchases. For Vertex tax calculations, this field will be used as the Vertex `product` field. If `item_code`/`item_id` is part of the request then `product_code` must be absent. maxLength: 50 + origin: + type: string + title: Origin + description: Only allowed if the Gift Cards feature is enabled on your site + and `type` is `credit`. Can only have a value of `external_gift_card`. + Set this value in order to track gift card credits from external gift + cards (like InComm). It also skips billing information requirements. + enum: + - external_gift_card start_date: type: string format: date-time title: Start date description: If an end date is present, this is value indicates the beginning @@ -14707,10 +15445,13 @@ account: "$ref": "#/components/schemas/AccountPurchase" collection_method: type: string title: Collection method + description: Must be set to manual in order to preview a purchase for an + Account that does not have payment information associated with the Billing + Info. enum: - automatic - manual default: automatic po_number: @@ -14823,10 +15564,12 @@ - wire_transfer - money_order - check - amazon_billing_agreement - paypal_billing_agreement + - gateway_token + - iban_bank_account - other card_type: type: string description: Visa, MasterCard, American Express, Discover, JCB, etc. enum: @@ -14849,18 +15592,31 @@ last_four: type: string description: Credit card number's last four digits. Will refer to bank account if payment method is ACH. maxLength: 4 + last_two: + type: string + description: The IBAN bank account's last two digits. + maxLength: 2 exp_month: type: integer description: Expiration month. maxLength: 2 exp_year: type: integer description: Expiration year. maxLength: 4 + gateway_token: + type: string + description: A token used in place of a credit card in order to perform + transactions. + maxLength: 50 + gateway_code: + type: string + description: An identifier for a specific payment gateway. + maxLength: 13 billing_agreement_id: type: string description: Billing Agreement identifier. Only present for Amazon or Paypal payment methods. account_type: @@ -14897,9 +15653,10 @@ - unauthorized - unavailable_in_api_version - unknown_api_version - validation - missing_feature + - rate_limited message: type: string title: Message params: type: array