From 91ebb590eb5bb4c9ae98c5eb6b7cd9a6db4c7dd1 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Tue, 29 Aug 2023 11:03:41 -0400 Subject: [PATCH 01/20] SWI-3361 Update Ruby Code Snippets --- site/migration-guides/ruby/intro.md | 4 +- site/migration-guides/ruby/v11.mdx | 254 ++++++++++++++-------------- 2 files changed, 129 insertions(+), 129 deletions(-) diff --git a/site/migration-guides/ruby/intro.md b/site/migration-guides/ruby/intro.md index 8ac9b8412..3e44b5fa2 100644 --- a/site/migration-guides/ruby/intro.md +++ b/site/migration-guides/ruby/intro.md @@ -11,9 +11,9 @@ pagination_prev: null See our releases on [GitHub](https://github.com/Bandwidth/ruby-sdk/releases) for more detailed changelogs -## [v11-beta](/migration-guides/ruby/v10->v11-beta/) +## [v11](/migration-guides/ruby/v10->v11/) ### What's Changed * Generated an entirely new SDK using the open-source [OpenAPI Generator Library](https://openapi-generator.tech/) -* Rewrote the [BXML library](/migration-guides/ruby/v10->v11-beta#bxml/) +* Rewrote the [BXML library](/migration-guides/ruby/v10->v11#bxml/) diff --git a/site/migration-guides/ruby/v11.mdx b/site/migration-guides/ruby/v11.mdx index 81e6894b8..26b6d4afc 100644 --- a/site/migration-guides/ruby/v11.mdx +++ b/site/migration-guides/ruby/v11.mdx @@ -1,9 +1,9 @@ --- -id: v11-beta -title: v10 -> v11-beta -slug: /ruby/v10->v11-beta -description: Ruby v10 to v15 Migration Guide -sidebar_label: v10 -> v11-beta +id: v11 +title: v10 -> v11 +slug: /ruby/v10->v11 +description: Ruby v10 to v11 Migration Guide +sidebar_label: v10 -> v11 hide_title: false image: '@site/static/img/bw-icon.svg' pagination_next: null @@ -14,7 +14,7 @@ import TabItem from '@theme/TabItem'; ## Client Initialization - + ```ruby @@ -40,7 +40,7 @@ account_id = '9900000' ``` - + ```ruby require 'bandwidth-sdk' @@ -57,7 +57,7 @@ account_id = '9900000' ### Custom URLs - + ```ruby @@ -70,7 +70,7 @@ bandwidth_client = Bandwidth::Client.new( ``` - + ```ruby # Currently Unsupported @@ -83,7 +83,7 @@ bandwidth_client = Bandwidth::Client.new( ### Create Message - + ```ruby @@ -113,7 +113,7 @@ end ``` - + ```ruby api_instance = Bandwidth::MessagesApi.new @@ -133,7 +133,7 @@ end ### List Messages - + ```ruby @@ -157,7 +157,7 @@ end ``` - + ```ruby api_instance = Bandwidth::MessagesApi.new @@ -193,7 +193,7 @@ end ### List Media - + ```ruby @@ -219,7 +219,7 @@ end ``` - + ```ruby api_instance = Bandwidth::MediaApi.new @@ -241,7 +241,7 @@ end ### Get Media - + ```ruby @@ -267,7 +267,7 @@ end ``` - + ```ruby api_instance = Bandwidth::MediaApi.new @@ -287,7 +287,7 @@ end ### Upload Media - + ```ruby @@ -320,7 +320,7 @@ end ``` - + ```ruby api_instance = Bandwidth::MediaApi.new @@ -344,7 +344,7 @@ end ### Delete Media - + ```ruby @@ -367,7 +367,7 @@ end ``` - + ```ruby api_instance = Bandwidth::MediaApi.new @@ -388,7 +388,7 @@ end ### Imports - + ```ruby @@ -398,7 +398,7 @@ include Bandwidth::Voice ``` - + ```ruby require 'bandwidth-sdk' @@ -415,7 +415,7 @@ Hangup.new # Only works if the include statement above is present ### Response - + ```ruby @@ -428,7 +428,7 @@ puts response.to_bxml() ``` - + ```ruby hangup = Bandwidth::Bxml::Hangup.new @@ -442,7 +442,7 @@ puts response.to_bxml() ### Bridge - + ```ruby @@ -454,7 +454,7 @@ bridge = Bandwidth::Voice::Bridge.new({ ``` - + ```ruby bridge_attributes = { @@ -481,7 +481,7 @@ bridge = Bandwidth::Bxml::Bridge.new('bridge_call_id', bridge_attributes) ### Conference - + ```ruby @@ -491,7 +491,7 @@ conference = Bandwidth::Voice::Conference.new({ ``` - + ```ruby conference_attributes = { @@ -518,7 +518,7 @@ conference = Bandwidth::Bxml::Conference.new('conference_name', conference_attri ### Forward - + ```ruby @@ -529,7 +529,7 @@ forward = Bandwidth::Voice::Forward.new({ ``` - + ```ruby forward_attributes = { @@ -549,7 +549,7 @@ forward = Bandwidth::Bxml::Forward.new(forward_attributes) ### Gather - + ```ruby @@ -567,7 +567,7 @@ gather = Bandwidth::Voice::Gather.new({ ``` - + ```ruby gather_attributes = { @@ -598,7 +598,7 @@ gather = Bandwidth::Bxml::Gather.new([play_audio, speak_sentence], gather_attrib ### Hangup - + ```ruby @@ -606,7 +606,7 @@ hangup = Bandwidth::Voice::Hangup.new() ``` - + ```ruby hangup = Bandwidth::Bxml::Hangup.new @@ -617,7 +617,7 @@ hangup = Bandwidth::Bxml::Hangup.new ### Pause - + ```ruby @@ -627,7 +627,7 @@ pause = Bandwidth::Voice::Pause.new({ ``` - + ```ruby pause = Bandwidth::Bxml::Pause.new({duration: 5}) @@ -638,7 +638,7 @@ pause = Bandwidth::Bxml::Pause.new({duration: 5}) ### Pause Recording - + ```ruby @@ -646,7 +646,7 @@ pause_recording = Bandwidth::Voice::PauseRecording.new() ``` - + ```ruby pause_recording = Bandwidth::Bxml::PauseRecording.new @@ -657,7 +657,7 @@ pause_recording = Bandwidth::Bxml::PauseRecording.new ### Play Audio - + ```ruby @@ -667,7 +667,7 @@ play_audio_ = Bandwidth::Voice::PlayAudio.new({ ``` - + ```ruby play_audio_attributes = { @@ -683,7 +683,7 @@ play_audio = Bandwidth::Bxml::PlayAudio.new('https://audio.url/audio1.wav', play ### Record - + ```ruby @@ -695,7 +695,7 @@ record = Bandwidth::Voice::Record.new({ ``` - + ```ruby record_attributes = { @@ -727,7 +727,7 @@ record = Bandwidth::Bxml::Record.new(record_attributes) ### Redirect - + ```ruby @@ -737,7 +737,7 @@ redirect = Bandwidth::Voice::Redirect.new({ ``` - + ```ruby redirect_attributes = { @@ -760,7 +760,7 @@ redirect = Bandwidth::Bxml::Redirect.new(redirect_attributes) ### Resume Recording - + ```ruby @@ -768,7 +768,7 @@ resume_recording = Bandwidth::Voice::ResumeRecording.new() ``` - + ```ruby resume_recording = Bandwidth::Bxml::ResumeRecording.new @@ -779,7 +779,7 @@ resume_recording = Bandwidth::Bxml::ResumeRecording.new ### Ring - + ```ruby @@ -790,7 +790,7 @@ ring = Bandwidth::Voice::Ring.new({ ``` - + ```ruby ring_attributes = { @@ -806,7 +806,7 @@ ring = Bandwidth::Bxml::Ring.new(ring_attributes) ### Send DTMF - + ```ruby @@ -816,7 +816,7 @@ send_dtmf = Bandwidth::Voice::SendDtmf.new({ ``` - + ```ruby send_dtmf_attributes = { @@ -832,7 +832,7 @@ send_dtmf = Bandwidth::Bxml::SendDtmf.new('1234', send_dtmf_attributes) ### Speak Sentence - + ```ruby @@ -843,7 +843,7 @@ speak_sentence = Bandwidth::Voice::SpeakSentence.new({ ``` - + ```ruby speak_sentence_attributes = { @@ -860,7 +860,7 @@ speak_sentence = Bandwidth::Bxml::SpeakSentence.new('speak this sentence', speak ### Start Gather - + ```ruby @@ -870,7 +870,7 @@ start_gather = Bandwidth::Voice::StartGather.new({ ``` - + ```ruby start_gather_attributes = { @@ -889,7 +889,7 @@ start_gather = Bandwidth::Bxml::StartGather.new(start_gather_attributes) ### Start Recording - + ```ruby @@ -900,7 +900,7 @@ start_recording = Bandwidth::Voice::StartRecording.new({ ``` - + ```ruby start_recording_attributes = { @@ -924,7 +924,7 @@ start_recording = Bandwidth::Bxml::StartRecording.new(start_recording_attributes ### Start Stream - + ```ruby @@ -943,7 +943,7 @@ start_stream = Bandwidth::Voice::StartStream.new({ ``` - + ```ruby start_stream_attributes = { @@ -966,7 +966,7 @@ start_stream = Bandwidth::Bxml::StartStream.new([stream_param], start_stream_att ### Stop Gather - + ```ruby @@ -974,7 +974,7 @@ stop_gather = Bandwidth::Voice::StopGather.new() ``` - + ```ruby stop_gather = Bandwidth::Bxml::StopGather.new @@ -985,7 +985,7 @@ stop_gather = Bandwidth::Bxml::StopGather.new ### Stop Recording - + ```ruby @@ -993,7 +993,7 @@ stop_recording = Bandwidth::Voice::StopRecording.new() ``` - + ```ruby stop_recording = Bandwidth::Bxml::StopRecording.new @@ -1004,7 +1004,7 @@ stop_recording = Bandwidth::Bxml::StopRecording.new ### Stop Stream - + ```ruby @@ -1014,7 +1014,7 @@ stop_stream = Bandwidth::Voice::StopStream.new({ ``` - + ```ruby stop_stream = Bandwidth::Bxml::StopStream.new({name: 'stop_stream_name'}) @@ -1025,7 +1025,7 @@ stop_stream = Bandwidth::Bxml::StopStream.new({name: 'stop_stream_name'}) ### Tag - + ```ruby @@ -1035,7 +1035,7 @@ tag = Bandwidth::Voice::Tag.new({ ``` - + ```ruby tag = Bandwidth::Bxml::Tag.new('tag_value') @@ -1046,7 +1046,7 @@ tag = Bandwidth::Bxml::Tag.new('tag_value') ### Transfer - + ```ruby @@ -1061,7 +1061,7 @@ transfer = Bandwidth::Voice::Transfer.new({ ``` - + ```ruby transfer_attributes = { @@ -1093,7 +1093,7 @@ transfer = Bandwidth::Bxml::Transfer.new([phone_number, sip_uri], transfer_attri ### Create Call - + ```ruby @@ -1124,7 +1124,7 @@ end ``` - + ```ruby api_instance = Bandwidth::CallsApi.new @@ -1144,7 +1144,7 @@ end ### Get Call Information - + ```ruby @@ -1173,7 +1173,7 @@ end ``` - + ```ruby api_instance = Bandwidth::CallsApi.new @@ -1193,7 +1193,7 @@ end ### Update Call - + ```ruby @@ -1223,7 +1223,7 @@ end ``` - + ```ruby api_instance = Bandwidth::CallsApi.new @@ -1243,7 +1243,7 @@ end ### Replace Call BXML - + ```ruby @@ -1251,7 +1251,7 @@ end ``` - + ```ruby api_instance = Bandwidth::CallsApi.new @@ -1276,7 +1276,7 @@ end ### List Conferences - + ```ruby @@ -1303,7 +1303,7 @@ end ``` - + ```ruby api_instance = Bandwidth::ConferencesApi.new @@ -1329,7 +1329,7 @@ end ### Get Conference Information - + ```ruby @@ -1357,7 +1357,7 @@ end ``` - + ```ruby api_instance = Bandwidth::ConferencesApi.new @@ -1377,7 +1377,7 @@ end ### Update Conference - + ```ruby @@ -1406,7 +1406,7 @@ end ``` - + ```ruby api_instance = Bandwidth::ConferencesApi.new @@ -1426,7 +1426,7 @@ end ### Update Conference BXML - + ```ruby @@ -1434,7 +1434,7 @@ end ``` - + ```ruby api_instance = Bandwidth::ConferencesApi.new @@ -1457,7 +1457,7 @@ end ### Get Conference Member - + ```ruby @@ -1485,7 +1485,7 @@ end ``` - + ```ruby api_instance = Bandwidth::ConferencesApi.new @@ -1506,7 +1506,7 @@ end ### Update Conference Member - + ```ruby @@ -1536,7 +1536,7 @@ end ``` - + ```ruby api_instance = Bandwidth::ConferencesApi.new @@ -1557,7 +1557,7 @@ end ### List Conference Recordings - + ```ruby @@ -1586,7 +1586,7 @@ end ``` - + ```ruby api_instance = Bandwidth::ConferencesApi.new @@ -1606,7 +1606,7 @@ end ### Get Conference Recording Information - + ```ruby @@ -1634,7 +1634,7 @@ end ``` - + ```ruby api_instance = Bandwidth::ConferencesApi.new @@ -1655,7 +1655,7 @@ end ### Download Conference Recording - + ```ruby @@ -1687,7 +1687,7 @@ end ``` - + ```ruby api_instance = Bandwidth::ConferencesApi.new @@ -1710,7 +1710,7 @@ end ### List Account Call Recordings - + ```ruby @@ -1737,7 +1737,7 @@ end ``` - + ```ruby api_instance = Bandwidth::RecordingsApi.new @@ -1762,7 +1762,7 @@ end ### Update Recording - + ```ruby @@ -1791,7 +1791,7 @@ end ``` - + ```ruby api_instance = Bandwidth::RecordingsApi.new @@ -1811,7 +1811,7 @@ end ### List Call Recordings - + ```ruby @@ -1840,7 +1840,7 @@ end ``` - + ```ruby api_instance = Bandwidth::RecordingsApi.new @@ -1860,7 +1860,7 @@ end ### Get Call Recording - + ```ruby @@ -1888,7 +1888,7 @@ end ``` - + ```ruby api_instance = Bandwidth::RecordingsApi.new @@ -1909,7 +1909,7 @@ end ### Delete Recording - + ```ruby @@ -1936,7 +1936,7 @@ end ``` - + ```ruby api_instance = Bandwidth::RecordingsApi.new @@ -1956,7 +1956,7 @@ end ### Download Recording - + ```ruby @@ -1988,7 +1988,7 @@ end ``` - + ```ruby api_instance = Bandwidth::RecordingsApi.new @@ -2009,7 +2009,7 @@ end ### Delete Recording Media - + ```ruby @@ -2036,7 +2036,7 @@ end ``` - + ```ruby api_instance = Bandwidth::RecordingsApi.new @@ -2056,7 +2056,7 @@ end ### Get Transcription - + ```ruby @@ -2084,7 +2084,7 @@ end ``` - + ```ruby api_instance = Bandwidth::RecordingsApi.new @@ -2105,7 +2105,7 @@ end ### Create Transcription Request - + ```ruby @@ -2135,7 +2135,7 @@ end ``` - + ```ruby api_instance = Bandwidth::RecordingsApi.new @@ -2156,7 +2156,7 @@ end ### Delete Transcription - + ```ruby @@ -2183,7 +2183,7 @@ end ``` - + ```ruby api_instance = Bandwidth::RecordingsApi.new @@ -2205,7 +2205,7 @@ end ### Get Account Statistics - + ```ruby @@ -2213,7 +2213,7 @@ end ``` - + ```ruby api_instance = Bandwidth::StatisticsApi.new @@ -2234,7 +2234,7 @@ end ### Create Lookup - + ```ruby @@ -2266,7 +2266,7 @@ end ``` - + ```ruby api_instance = Bandwidth::PhoneNumberLookupApi.new @@ -2286,7 +2286,7 @@ end ### Get Lookup Request Status - + ```ruby @@ -2317,7 +2317,7 @@ end ``` - + ```ruby api_instance = Bandwidth::PhoneNumberLookupApi.new @@ -2339,7 +2339,7 @@ end ### Voice MFA Code - + ```ruby @@ -2370,7 +2370,7 @@ end ``` - + ```ruby api_instance = Bandwidth::MFAApi.new @@ -2390,7 +2390,7 @@ end ### Messaging MFA Code - + ```ruby @@ -2421,7 +2421,7 @@ end ``` - + ```ruby api_instance = Bandwidth::MFAApi.new @@ -2441,7 +2441,7 @@ end ### Verify MFA Code - + ```ruby @@ -2472,7 +2472,7 @@ end ``` - + ```ruby api_instance = Bandwidth::MFAApi.new From 3bc4af54f6333ed52d826b0fd9ba7beb89fcb303 Mon Sep 17 00:00:00 2001 From: DX-Bandwidth Date: Tue, 29 Aug 2023 19:19:29 +0000 Subject: [PATCH 02/20] Add Code Snippets to Spec Files --- site/specs/messaging.yml | 171 +++++++++++++++++++-------------------- 1 file changed, 82 insertions(+), 89 deletions(-) diff --git a/site/specs/messaging.yml b/site/specs/messaging.yml index de4129a53..550d38cde 100644 --- a/site/specs/messaging.yml +++ b/site/specs/messaging.yml @@ -185,26 +185,26 @@ paths: except APIException as e: print(e.response_code) - lang: Ruby - source: | - require 'bandwidth' + source: |+ + require 'bandwidth-sdk' - include Bandwidth - include Bandwidth::Messaging + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - bandwidth_client = Bandwidth::Client.new( - messaging_basic_auth_user_name: "api-username", - messaging_basic_auth_password: "api-password" - ) - messaging_client = bandwidth_client.messaging_client.client + api_instance = Bandwidth::MediaApi.new + account_id = "12345" begin - media = messaging_client.list_media("12345") - media.data.each { |item| + result = api_instance.list_media(account_id, opts) + result.data.each { |item| puts item.media_name } - rescue APIException => e - puts e.response_code + rescue Bandwidth::ApiError => e + puts "Error when calling MediaApi->list_media: #{e}" end + /users/{accountId}/media/{mediaId}: get: summary: Get Media @@ -387,24 +387,23 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::Messaging + require 'bandwidth-sdk' + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - bandwidth_client = Bandwidth::Client.new( - messaging_basic_auth_user_name: "api-username", - messaging_basic_auth_password: "api-password" - ) - messaging_client = bandwidth_client.messaging_client.client + api_instance = Bandwidth::MediaApi.new + account_id = "12345" + media_id = ENV['MEDIA_ID'] begin - downloaded_media = messaging_client.get_media("12345", ENV['MEDIA_ID']) - f = File.open("file_to_write", "wb") - f.puts(downloaded_media.data) - f.close() - rescue APIException => e - puts e.response_code + result = api_instance.get_media(account_id, media_id) + f = File.open('file_to_write', 'wb') + f.puts(result.data) + f.close + rescue Bandwidth::ApiError => e + puts "Error when calling MediaApi->get_media: #{e}" end put: summary: Upload Media @@ -646,31 +645,26 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' + require 'bandwidth-sdk' - include Bandwidth - include Bandwidth::Messaging + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - bandwidth_client = Bandwidth::Client.new( - messaging_basic_auth_user_name: "api-username", - messaging_basic_auth_password: "api-password" - ) - messaging_client = bandwidth_client.messaging_client.client + api_instance = Bandwidth::MediaApi.new + account_id = "12345" + media_id = ENV['MEDIA_ID'] + body = '12345' + opts = { + content_type: 'application/octet-stream', + cache_control: 'no-cache' + } begin - #f = File.open("some_file", "rb") - #file_content = f.read - file_content = "12345" - messaging_client.upload_media( - "12345", - ENV['MEDIA_ID'], - file_content, - :content_type => "application/octet-stream", - :cache_control => "no-cache" - ) - f.close() - rescue APIException => e - puts e.response_code + api_instance.upload_media(account_id, media_id, body, opts) + rescue Bandwidth::ApiError => e + puts "Error when calling MediaApi->upload_media: #{e}" end delete: summary: Delete Media @@ -856,21 +850,21 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' + require 'bandwidth-sdk' - include Bandwidth - include Bandwidth::Messaging + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - bandwidth_client = Bandwidth::Client.new( - messaging_basic_auth_user_name: "api-username", - messaging_basic_auth_password: "api-password" - ) - messaging_client = bandwidth_client.messaging_client.client + api_instance = Bandwidth::MediaApi.new + account_id = "12345" + media_id = ENV['MEDIA_ID'] begin - messaging_client.delete_media("12345", ENV['MEDIA_ID']) - rescue APIException => e - puts e.response_code + api_instance.delete_media(account_id, media_id) + rescue Bandwidth::ApiError => e + puts "Error when calling MediaApi->delete_media: #{e}" end /users/{accountId}/messages: get: @@ -1059,22 +1053,21 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' + require 'bandwidth-sdk' - include Bandwidth - include Bandwidth::Messaging + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - bandwidth_client = Bandwidth::Client.new( - messaging_basic_auth_user_name: "api-username", - messaging_basic_auth_password: "api-password" - ) - messaging_client = bandwidth_client.messaging_client.client + api_instance = Bandwidth::MessagesApi.new + account_id = "12345" begin - result = messaging_client.get_messages("12345", :source_tn => "+15554443333") - puts result.data.total_count - rescue APIException => e - puts e.response_code + result = api_instance.list_messages(account_id, opts) + p result.data.total_count + rescue Bandwidth::ApiError => e + p "Error when calling MessagesApi->list_messages: #{e}" end post: summary: Create Message @@ -1336,28 +1329,28 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' + require 'bandwidth-sdk' - include Bandwidth - include Bandwidth::Messaging + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - bandwidth_client = Bandwidth::Client.new( - messaging_basic_auth_user_name: "api-username", - messaging_basic_auth_password: "api-password" + api_instance = Bandwidth::MessagesApi.new + account_id = "12345" + message_request = Bandwidth::MessageRequest.new( + { + application_id: "1234-asdf", + to: ["+15553334444"], + from: "+15554443333" + } ) - messaging_client = bandwidth_client.messaging_client.client - body = MessageRequest.new - body.application_id = "1234-asdf" - body.to = ["+15553334444"] - body.from = "+15554443333" - body.text = 'Hey, check this out!' - body.tag = '{"test": "message"}' begin - result = messaging_client.create_message("12345", body) - puts 'messageId: ' + result.data.id - rescue APIException => e - puts e.response_code + result = api_instance.create_message(account_id, message_request) + p "messageId: #{result.data.id}" + rescue Bandwidth::ApiError => e + p "Error when calling MessagesApi->create_message: #{e}" end components: parameters: From 4cbf8315a34da3ca0734ebd6dc8646e914741084 Mon Sep 17 00:00:00 2001 From: DX-Bandwidth Date: Tue, 29 Aug 2023 19:32:33 +0000 Subject: [PATCH 03/20] Add Code Snippets to Spec Files --- site/specs/messaging.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/specs/messaging.yml b/site/specs/messaging.yml index 550d38cde..c5f1d264d 100644 --- a/site/specs/messaging.yml +++ b/site/specs/messaging.yml @@ -197,7 +197,7 @@ paths: account_id = "12345" begin - result = api_instance.list_media(account_id, opts) + result = api_instance.list_media(account_id) result.data.each { |item| puts item.media_name } @@ -1064,7 +1064,7 @@ paths: account_id = "12345" begin - result = api_instance.list_messages(account_id, opts) + result = api_instance.list_messages(account_id) p result.data.total_count rescue Bandwidth::ApiError => e p "Error when calling MessagesApi->list_messages: #{e}" From e760d0babaa94f098b2b4e01e02e063f317f2a4c Mon Sep 17 00:00:00 2001 From: DX-Bandwidth Date: Tue, 29 Aug 2023 19:56:01 +0000 Subject: [PATCH 04/20] Add Code Snippets to Spec Files --- site/specs/multi-factor-auth.yml | 113 +++++++++++++++++++------------ 1 file changed, 70 insertions(+), 43 deletions(-) diff --git a/site/specs/multi-factor-auth.yml b/site/specs/multi-factor-auth.yml index 27cace8f2..068d8cea0 100644 --- a/site/specs/multi-factor-auth.yml +++ b/site/specs/multi-factor-auth.yml @@ -291,29 +291,30 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' + require 'bandwidth-sdk' - include Bandwidth - include Bandwidth::MultiFactorAuth + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - bandwidth_client = Bandwidth::Client.new( - multi_factor_auth_basic_auth_user_name: "api-username", - multi_factor_auth_basic_auth_password: "api-password" + api_instance = Bandwidth::MFAApi.new + account_id = "12345" + code_request = Bandwidth::CodeRequest.new( + { + to: "+15553334444", + from: "+15554443333", + application_id: "1234-qwer", + message: 'Your temporary {NAME} {SCOPE} code is {CODE}', + digits: 6 + } ) - auth_client = bandwidth_client.multi_factor_auth_client.mfa - body = TwoFactorCodeRequestSchema.new - body.application_id = "1234-qwer" - body.to = "+15553334444" - body.from = "+15554443333" - body.digits = 6 - body.scope = "scope" - body.message = "Your temporary {NAME} {SCOPE} code is {CODE}" begin - result = auth_client.create_voice_two_factor("12345", body) - puts 'callId: ' + result.data.call_id - rescue APIException => e - puts e.response_code + result = api_instance.generate_voice_code(account_id, code_request) + p "callId: #{result.data.call_id}" + rescue Bandwidth::ApiError => e + puts "Error when calling MFAApi->generate_voice_code: #{e}" end /accounts/{accountId}/code/messaging: post: @@ -591,29 +592,30 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' + require 'bandwidth-sdk' - include Bandwidth - include Bandwidth::MultiFactorAuth + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - bandwidth_client = Bandwidth::Client.new( - multi_factor_auth_basic_auth_user_name: "api-username", - multi_factor_auth_basic_auth_password: "api-password" + api_instance = Bandwidth::MFAApi.new + account_id = "12345" + code_request = Bandwidth::CodeRequest.new( + { + to: "+15553334444", + from: "+15554443333", + application_id: "1234-asdf", + message: 'Your temporary {NAME} {SCOPE} code is {CODE}', + digits: 6 + } ) - auth_client = bandwidth_client.multi_factor_auth_client.mfa - body = TwoFactorCodeRequestSchema.new - body.application_id = "1234-asdf" - body.to = "+15553334444" - body.from = "+15554443333" - body.digits = 6 - body.scope = "scope" - body.message = "Your temporary {NAME} {SCOPE} code is {CODE}" begin - result = auth_client.create_messaging_two_factor("12345", body) - puts 'messageId: ' + result.data.message_id - rescue APIException => e - puts e.response_code + result = api_instance.generate_messaging_code(account_id, code_request) + p "messageId: #{result.data.message_id}" + rescue Bandwidth::ApiError => e + puts "Error when calling MFAApi->generate_messaging_code: #{e}" end /accounts/{accountId}/code/verify: post: @@ -912,22 +914,47 @@ paths: include Bandwidth::MultiFactorAuth bandwidth_client = Bandwidth::Client.new( - multi_factor_auth_basic_auth_user_name: "api-username", - multi_factor_auth_basic_auth_password: "api-password" + multi_factor_auth_basic_auth_user_name: "api-username", + multi_factor_auth_basic_auth_password: "api-password" ) auth_client = bandwidth_client.multi_factor_auth_client.mfa body = TwoFactorVerifyRequestSchema.new body.application_id = "1234-qwer" body.to = "+15553334444" - body.scope = "scope" - body.code = "123456" + body.scope = 'scope' + body.code = '123456' body.expiration_time_in_minutes = 3 begin - result = auth_client.create_verify_two_factor("12345", body) - puts 'valid?: ' + result.data.valid + result = auth_client.create_verify_two_factor("12345", body) + puts "valid?: #{result.data.valid}" rescue APIException => e - puts e.response_code + puts e.response_code + end + + + require 'bandwidth-sdk' + + Bandwidth.configure do |config| + config.username = ENV['BW_USERNAME'] + config.password = ENV['BW_PASSWORD'] + end + + api_instance = Bandwidth::MFAApi.new + account_id = ENV['BW_ACCOUNT_ID'] + verify_code_request = Bandwidth::VerifyCodeRequest.new( + { + to: ENV['USER_NUMBER'], + expiration_time_in_minutes: 3, + code: '123456' + } + ) + + begin + result = api_instance.verify_code(account_id, verify_code_request) + p "valid?: #{result.data.valid}" + rescue Bandwidth::ApiError => e + puts "Error when calling MFAApi->verify_code: #{e}" end components: schemas: From 24d03f92cf7a93b1b966d5ef35e9484001a1cfc4 Mon Sep 17 00:00:00 2001 From: DX-Bandwidth Date: Tue, 29 Aug 2023 20:48:14 +0000 Subject: [PATCH 05/20] Add Code Snippets to Spec Files --- site/specs/phone-number-lookup.yml | 80 ++++++++++-------------------- 1 file changed, 26 insertions(+), 54 deletions(-) diff --git a/site/specs/phone-number-lookup.yml b/site/specs/phone-number-lookup.yml index 8f1ee46f9..b308b5daa 100644 --- a/site/specs/phone-number-lookup.yml +++ b/site/specs/phone-number-lookup.yml @@ -213,40 +213,28 @@ paths: print(e.response_code) - lang: Ruby source: > - require 'bandwidth' - - include Bandwidth + require 'bandwidth-sdk' - include Bandwidth::Voice - - - BW_USERNAME = "api-username" - - BW_PASSWORD = "api-password" - - BW_ACCOUNT_ID = "12345" - - - bandwidth_client = Bandwidth::Client.new( - phone_number_lookup_basic_auth_user_name: BW_USERNAME, - phone_number_lookup_basic_auth_password: BW_PASSWORD - ) + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - phone_number_lookup_client = - bandwidth_client.phone_number_lookup_client.client + api_instance = Bandwidth::PhoneNumberLookupApi.new - body = OrderRequest.new + account_id = "12345" - body.tns = ["+15554443333"] + lookup_request = Bandwidth::LookupRequest.new({tns: + ["+15554443333"]}) begin - result = phone_number_lookup_client.create_lookup_request(BW_ACCOUNT_ID, body) - puts result.data.request_id - rescue APIException => e - puts e.response_code + result = api_instance.create_lookup(account_id, lookup_request) + p result.data.request_id + rescue Bandwidth::ApiError => e + puts "Error when calling PhoneNumberLookupApi->create_lookup: #{e}" end /accounts/{accountId}/tnlookup/{requestId}: get: @@ -415,39 +403,23 @@ paths: except APIException as e: print(e.response_code) - lang: Ruby - source: > - require 'bandwidth' - - include Bandwidth - - include Bandwidth::Voice - - - BW_USERNAME = "api-username" - - BW_PASSWORD = "api-password" - - BW_ACCOUNT_ID = "12345" - - - bandwidth_client = Bandwidth::Client.new( - phone_number_lookup_basic_auth_user_name: BW_USERNAME, - phone_number_lookup_basic_auth_password: BW_PASSWORD - ) - - - phone_number_lookup_client = - bandwidth_client.phone_number_lookup_client.client - + source: | + require 'bandwidth-sdk' - request_id = "1234-abcd" + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end + api_instance = Bandwidth::PhoneNumberLookupApi.new + account_id = "12345" + request_id = ENV['LOOKUP_REQUEST_ID'] begin - result = phone_number_lookup_client.get_lookup_request_status(BW_ACCOUNT_ID, request_id) - puts result.data.status - rescue APIException => e - puts e.response_code + result = api_instance.get_lookup_status(account_id, request_id) + p result.data.status + rescue Bandwidth::ApiError => e + puts "Error when calling PhoneNumberLookupApi->get_lookup_status: #{e}" end components: schemas: From 587e7083015e43994898504b797c122d4f8ea561 Mon Sep 17 00:00:00 2001 From: DX-Bandwidth Date: Tue, 29 Aug 2023 21:06:34 +0000 Subject: [PATCH 06/20] Add Code Snippets to Spec Files --- site/specs/messaging.yml | 4 ++-- site/specs/multi-factor-auth.yml | 33 ++++---------------------------- 2 files changed, 6 insertions(+), 31 deletions(-) diff --git a/site/specs/messaging.yml b/site/specs/messaging.yml index c5f1d264d..930d3833d 100644 --- a/site/specs/messaging.yml +++ b/site/specs/messaging.yml @@ -198,9 +198,9 @@ paths: begin result = api_instance.list_media(account_id) - result.data.each { |item| + result.each do |item| puts item.media_name - } + end rescue Bandwidth::ApiError => e puts "Error when calling MediaApi->list_media: #{e}" end diff --git a/site/specs/multi-factor-auth.yml b/site/specs/multi-factor-auth.yml index 068d8cea0..6af878565 100644 --- a/site/specs/multi-factor-auth.yml +++ b/site/specs/multi-factor-auth.yml @@ -908,43 +908,18 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::MultiFactorAuth - - bandwidth_client = Bandwidth::Client.new( - multi_factor_auth_basic_auth_user_name: "api-username", - multi_factor_auth_basic_auth_password: "api-password" - ) - auth_client = bandwidth_client.multi_factor_auth_client.mfa - - body = TwoFactorVerifyRequestSchema.new - body.application_id = "1234-qwer" - body.to = "+15553334444" - body.scope = 'scope' - body.code = '123456' - body.expiration_time_in_minutes = 3 - begin - result = auth_client.create_verify_two_factor("12345", body) - puts "valid?: #{result.data.valid}" - rescue APIException => e - puts e.response_code - end - - require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = ENV['BW_USERNAME'] - config.password = ENV['BW_PASSWORD'] + config.username = "api-username" + config.password = "api-password" end api_instance = Bandwidth::MFAApi.new - account_id = ENV['BW_ACCOUNT_ID'] + account_id = "12345" verify_code_request = Bandwidth::VerifyCodeRequest.new( { - to: ENV['USER_NUMBER'], + to: "+15553334444", expiration_time_in_minutes: 3, code: '123456' } From 10054469b5a0076db7a8bd6d93f93db9f20e333d Mon Sep 17 00:00:00 2001 From: DX-Bandwidth Date: Tue, 29 Aug 2023 21:22:57 +0000 Subject: [PATCH 07/20] Add Code Snippets to Spec Files --- site/specs/messaging.yml | 2 +- site/specs/phone-number-lookup.yml | 4 +- site/specs/voice.yml | 354 +++++++++++++---------------- 3 files changed, 159 insertions(+), 201 deletions(-) diff --git a/site/specs/messaging.yml b/site/specs/messaging.yml index 930d3833d..d0953d155 100644 --- a/site/specs/messaging.yml +++ b/site/specs/messaging.yml @@ -1065,7 +1065,7 @@ paths: begin result = api_instance.list_messages(account_id) - p result.data.total_count + p result.total_count rescue Bandwidth::ApiError => e p "Error when calling MessagesApi->list_messages: #{e}" end diff --git a/site/specs/phone-number-lookup.yml b/site/specs/phone-number-lookup.yml index b308b5daa..814b1d4b4 100644 --- a/site/specs/phone-number-lookup.yml +++ b/site/specs/phone-number-lookup.yml @@ -232,7 +232,7 @@ paths: begin result = api_instance.create_lookup(account_id, lookup_request) - p result.data.request_id + p result.request_id rescue Bandwidth::ApiError => e puts "Error when calling PhoneNumberLookupApi->create_lookup: #{e}" end @@ -417,7 +417,7 @@ paths: begin result = api_instance.get_lookup_status(account_id, request_id) - p result.data.status + p result.status rescue Bandwidth::ApiError => e puts "Error when calling PhoneNumberLookupApi->get_lookup_status: #{e}" end diff --git a/site/specs/voice.yml b/site/specs/voice.yml index 7292ea8ff..441f5f4b1 100644 --- a/site/specs/voice.yml +++ b/site/specs/voice.yml @@ -310,29 +310,29 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' + require 'bandwidth-sdk' - include Bandwidth - include Bandwidth::Voice + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - bandwidth_client = Bandwidth::Client.new( - voice_basic_auth_user_name: "api-username", - voice_basic_auth_password: "api-password" + api_instance = Bandwidth::CallsApi.new + account_id = "12345" + create_call = Bandwidth::CreateCall.new( + { + to: "+15553334444", + from: "+15554443333", + application_id: "1234-qwer"], + answer_url: ENV['BASE_CALLBACK_URL'] + } ) - voice_client = bandwidth_client.voice_client.client - - body = CreateCallRequest.new - body.from = "+15554443333" - body.to = "+15553334444" - body.answer_url = "http://www.myapp.com/hello" - body.application_id = "7fc9698a-b04a-468b-9e8f-91238c0d0086" - begin - result = voice_client.create_call("12345", body) - puts result.data.call_id - rescue APIException => e - puts e.response_code + result = api_instance.create_call(account_id, create_call) + p result.call_id + rescue Bandwidth::ApiError => e + puts "Error when calling CallsApi->create_call: #{e}" end /accounts/{accountId}/calls/{callId}: get: @@ -525,26 +525,22 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::Voice + require 'bandwidth-sdk' - bandwidth_client = Bandwidth::Client.new( - voice_basic_auth_user_name: "api-username", - voice_basic_auth_password: "api-password" - ) - - voice_client = bandwidth_client.voice_client.client + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - call_id = "c-1234" + api_instance = Bandwidth::CallsApi.new + account_id = "12345" + call_id = ENV['CALL_ID'] begin - #result = voice_client.get_call("12345", call_id) - #puts result.data.state - puts "Method broke" - rescue APIException => e - puts e.response_code + result = api_instance.get_call_state(account_id, call_id) + p result.state + rescue Bandwidth::ApiError => e + puts "Error when calling CallsApi->get_call_state: #{e}" end post: tags: @@ -1234,25 +1230,22 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::Voice - - bandwidth_client = Bandwidth::Client.new( - voice_basic_auth_user_name: "api-username", - voice_basic_auth_password: "api-password" - ) + require 'bandwidth-sdk' - voice_client = bandwidth_client.voice_client.client + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - conference_id = "conf-1234" + api_instance = Bandwidth::ConferencesApi.new + account_id = "12345" + conference_id = ENV['CONFERENCE_ID'] begin - response = voice_client.get_conference("12345", conference_id) - print(response.data.name) - rescue APIException => e - puts e.response_code + result = api_instance.get_conference(account_id, conference_id) + p result.name + rescue Bandwidth::ApiError => e + puts "Error when calling ConferencesApi->get_conference: #{e}" end post: tags: @@ -1740,26 +1733,23 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::Voice + require 'bandwidth-sdk' - bandwidth_client = Bandwidth::Client.new( - voice_basic_auth_user_name: "api-username", - voice_basic_auth_password: "api-password" - ) - - voice_client = bandwidth_client.voice_client.client + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - conference_id = "conf-1234" - member_id = "m-1234" + api_instance = Bandwidth::ConferencesApi.new + account_id = "12345" + conference_id = ENV['CONFERENCE_ID'] + member_id = ENV['MEMBER_ID'] begin - response = voice_client.get_conference_member("12345", conference_id, member_id) - puts response.data.member_url - rescue APIException => e - puts e.response_code + result = api_instance.get_conference_member(account_id, conference_id, member_id) + p result.member_url + rescue Bandwidth::ApiError => e + puts "Error when calling ConferencesApi->get_conference_member: #{e}" end put: tags: @@ -2442,26 +2432,23 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' + require 'bandwidth-sdk' - include Bandwidth - include Bandwidth::Voice - - bandwidth_client = Bandwidth::Client.new( - voice_basic_auth_user_name: "api-username", - voice_basic_auth_password: "api-password" - ) + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - voice_client = bandwidth_client.voice_client.client - - conference_id = "conf-1234" - recording_id = "r-1234" + api_instance = Bandwidth::ConferencesApi.new + account_id = "12345" + conference_id = ENV['CONFERENCE_ID'] + recording_id = ENV['RECORDING_ID'] begin - response = voice_client.get_conference_recording("12345", conference_id, recording_id) - puts response.body.application_id - rescue APIException => e - puts e.response_code + result = api_instance.get_conference_recording(account_id, conference_id, recording_id) + p result.application_id + rescue Bandwidth::ApiError => e + puts "Error when calling ConferencesApi->get_conference_recording: #{e}" end /accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media: get: @@ -2659,30 +2646,23 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::Voice - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" + require 'bandwidth-sdk' - bandwidth_client = Bandwidth::Client.new( - voice_basic_auth_user_name: BW_USERNAME, - voice_basic_auth_password: BW_PASSWORD - ) + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - voice_client = bandwidth_client.voice_client.client - - conference_id = "conf-1234" - recording_id = "r-1234" + api_instance = Bandwidth::ConferencesApi.new + account_id = "12345" + conference_id = ENV['CONFERENCE_ID'] + recording_id = ENV['RECORDING_ID'] begin - result = voice_client.get_download_conference_recording(BW_ACCOUNT_ID, conference_id, recording_id) - downloaded_recording = result.data - rescue APIException => e - puts e.response_code + result = api_instance.download_conference_recording(account_id, conference_id, recording_id) + p result + rescue Bandwidth::ApiError => e + puts "Error when calling ConferencesApi->download_conference_recording: #{e}" end /accounts/{accountId}/recordings: get: @@ -3532,26 +3512,23 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::Voice - - bandwidth_client = Bandwidth::Client.new( - voice_basic_auth_user_name: "api-username", - voice_basic_auth_password: "api-password" - ) + require 'bandwidth-sdk' - voice_client = bandwidth_client.voice_client.client + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - call_id = "c-1234" - recording_id = "r-1234" + api_instance = Bandwidth::RecordingsApi.new + account_id = "12345" + call_id = ENV['CALL_ID'] + recording_id = ENV['RECORDING_ID'] begin - response = voice_client.get_call_recording("12345", call_id, recording_id) - puts response.data.application_id - rescue APIException => e - puts e.response_code + result = api_instance.get_call_recording(account_id, call_id, recording_id) + p result.application_id + rescue Bandwidth::ApiError => e + puts "Error when calling RecordingsApi->get_call_recording: #{e}" end delete: tags: @@ -3749,25 +3726,22 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::Voice + require 'bandwidth-sdk' - bandwidth_client = Bandwidth::Client.new( - voice_basic_auth_user_name: "api-username", - voice_basic_auth_password: "api-password" - ) - - voice_client = bandwidth_client.voice_client.client + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - call_id = "c-1234" - recording_id = "r-1234" + api_instance = Bandwidth::RecordingsApi.new + account_id = "12345" + call_id = ENV['CALL_ID'] + recording_id = ENV['RECORDING_ID'] begin - voice_client.delete_recording("12345", call_id, recording_id) - rescue APIException => e - puts e.response_code + api_instance.delete_recording(account_id, call_id, recording_id) + rescue Bandwidth::ApiError => e + puts "Error when calling RecordingsApi->delete_recording: #{e}" end /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media: get: @@ -3956,30 +3930,23 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::Voice - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" - - bandwidth_client = Bandwidth::Client.new( - voice_basic_auth_user_name: BW_USERNAME, - voice_basic_auth_password: BW_PASSWORD - ) + require 'bandwidth-sdk' - voice_client = bandwidth_client.voice_client.client + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - call_id = "c-1234" - recording_id = "r-1234" + api_instance = Bandwidth::RecordingsApi.new + account_id = "12345" + call_id = ENV['CALL_ID'] + recording_id = ENV['RECORDING_ID'] begin - result = voice_client.get_download_call_recording(BW_ACCOUNT_ID, call_id, recording_id) - downloaded_recording = result.data - rescue APIException => e - puts e.response_code + result = api_instance.download_call_recording(account_id, call_id, recording_id) + p result + rescue Bandwidth::ApiError => e + puts "Error when calling RecordingsApi->download_call_recording: #{e}" end delete: tags: @@ -4169,25 +4136,22 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::Voice + require 'bandwidth-sdk' - bandwidth_client = Bandwidth::Client.new( - voice_basic_auth_user_name: "api-username", - voice_basic_auth_password: "api-password" - ) + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - voice_client = bandwidth_client.voice_client.client - - call_id = "c-1234" - recording_id = "r-1234" + api_instance = Bandwidth::RecordingsApi.new + account_id = "12345" + call_id = ENV['CALL_ID'] + recording_id = ENV['RECORDING_ID'] begin - voice_client.delete_recording_media("12345", call_id, recording_id) - rescue APIException => e - print(e.response_code) + api_instance.delete_recording_media(account_id, call_id, recording_id) + rescue Bandwidth::ApiError => e + puts "Error when calling RecordingsApi->delete_recording_media: #{e}" end /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription: get: @@ -4394,26 +4358,23 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::Voice + require 'bandwidth-sdk' - bandwidth_client = Bandwidth::Client.new( - voice_basic_auth_user_name: "api-username", - voice_basic_auth_password: "api-password" - ) - - voice_client = bandwidth_client.voice_client.client + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - call_id = "c-1234" - recording_id = "r-1234" + api_instance = Bandwidth::RecordingsApi.new + account_id = "12345" + call_id = ENV['CALL_ID'] + recording_id = ENV['RECORDING_ID'] begin - response = voice_client.get_call_transcription("12345", call_id, recording_id) - puts response.data.transcripts - rescue APIException => e - puts e.response_code + result = api_instance.get_call_transcription(account_id, call_id, recording_id) + p result.transcripts + rescue Bandwidth::ApiError => e + puts "Error when calling RecordingsApi->get_call_transcription: #{e}" end post: tags: @@ -4870,25 +4831,22 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::Voice + require 'bandwidth-sdk' - bandwidth_client = Bandwidth::Client.new( - voice_basic_auth_user_name: "api-username", - voice_basic_auth_password: "api-password" - ) - - voice_client = bandwidth_client.voice_client.client + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - call_id = "c-1234" - recording_id = "r-1234" + api_instance = Bandwidth::RecordingsApi.new + account_id = "12345" + call_id = ENV['CALL_ID'] + recording_id = ENV['RECORDING_ID'] begin - voice_client.delete_call_transcription("12345", call_id, recording_id) - rescue APIException => e - puts e.response_code + api_instance.delete_call_transcription(account_id, call_id, recording_id) + rescue Bandwidth::ApiError => e + puts "Error when calling RecordingsApi->delete_call_transcription: #{e}" end /accounts/{accountId}/statistics: get: From fe4905f8d3ac3aab9cae9f7ebabd50aa0388be42 Mon Sep 17 00:00:00 2001 From: DX-Bandwidth Date: Tue, 29 Aug 2023 21:28:29 +0000 Subject: [PATCH 08/20] Add Code Snippets to Spec Files --- site/specs/messaging.yml | 6 +++--- site/specs/multi-factor-auth.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/site/specs/messaging.yml b/site/specs/messaging.yml index d0953d155..8ce250c87 100644 --- a/site/specs/messaging.yml +++ b/site/specs/messaging.yml @@ -400,7 +400,7 @@ paths: begin result = api_instance.get_media(account_id, media_id) f = File.open('file_to_write', 'wb') - f.puts(result.data) + f.puts(result) f.close rescue Bandwidth::ApiError => e puts "Error when calling MediaApi->get_media: #{e}" @@ -1346,9 +1346,9 @@ paths: } ) + result = api_instance.create_message(account_id, message_request) begin - result = api_instance.create_message(account_id, message_request) - p "messageId: #{result.data.id}" + p "messageId: #{result.id}" rescue Bandwidth::ApiError => e p "Error when calling MessagesApi->create_message: #{e}" end diff --git a/site/specs/multi-factor-auth.yml b/site/specs/multi-factor-auth.yml index 6af878565..c5d2027b4 100644 --- a/site/specs/multi-factor-auth.yml +++ b/site/specs/multi-factor-auth.yml @@ -312,7 +312,7 @@ paths: begin result = api_instance.generate_voice_code(account_id, code_request) - p "callId: #{result.data.call_id}" + p "callId: #{result.call_id}" rescue Bandwidth::ApiError => e puts "Error when calling MFAApi->generate_voice_code: #{e}" end @@ -613,7 +613,7 @@ paths: begin result = api_instance.generate_messaging_code(account_id, code_request) - p "messageId: #{result.data.message_id}" + p "messageId: #{result.message_id}" rescue Bandwidth::ApiError => e puts "Error when calling MFAApi->generate_messaging_code: #{e}" end @@ -927,7 +927,7 @@ paths: begin result = api_instance.verify_code(account_id, verify_code_request) - p "valid?: #{result.data.valid}" + p "valid?: #{result.valid}" rescue Bandwidth::ApiError => e puts "Error when calling MFAApi->verify_code: #{e}" end From cb26a2b8ff5c23a73e051fc04ef41d47fe4c889e Mon Sep 17 00:00:00 2001 From: DX-Bandwidth Date: Tue, 29 Aug 2023 21:31:45 +0000 Subject: [PATCH 09/20] Add Code Snippets to Spec Files --- site/specs/messaging.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/site/specs/messaging.yml b/site/specs/messaging.yml index 8ce250c87..b9aab5f67 100644 --- a/site/specs/messaging.yml +++ b/site/specs/messaging.yml @@ -1342,7 +1342,8 @@ paths: { application_id: "1234-asdf", to: ["+15553334444"], - from: "+15554443333" + from: "+15554443333", + text: 'Hello world!' } ) From 947d0707c028ab799dd46830f1177d31f0c6baa8 Mon Sep 17 00:00:00 2001 From: DX-Bandwidth Date: Tue, 29 Aug 2023 21:33:35 +0000 Subject: [PATCH 10/20] Add Code Snippets to Spec Files --- site/specs/messaging.yml | 2 +- site/specs/voice.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/site/specs/messaging.yml b/site/specs/messaging.yml index b9aab5f67..c32addf36 100644 --- a/site/specs/messaging.yml +++ b/site/specs/messaging.yml @@ -1347,8 +1347,8 @@ paths: } ) - result = api_instance.create_message(account_id, message_request) begin + result = api_instance.create_message(account_id, message_request) p "messageId: #{result.id}" rescue Bandwidth::ApiError => e p "Error when calling MessagesApi->create_message: #{e}" diff --git a/site/specs/voice.yml b/site/specs/voice.yml index 441f5f4b1..41340814f 100644 --- a/site/specs/voice.yml +++ b/site/specs/voice.yml @@ -323,7 +323,7 @@ paths: { to: "+15553334444", from: "+15554443333", - application_id: "1234-qwer"], + application_id: "1234-qwer", answer_url: ENV['BASE_CALLBACK_URL'] } ) From 58f1994166ccbcd127586c9ee3f8a10e47bac04e Mon Sep 17 00:00:00 2001 From: DX-Bandwidth Date: Wed, 30 Aug 2023 20:12:21 +0000 Subject: [PATCH 11/20] Add Code Snippets to Spec Files --- site/specs/messaging.yml | 3 +- site/specs/multi-factor-auth.yml | 4 +- site/specs/numbers.yml | 81 +- site/specs/numbers_v2.yml | 457 ++++--- site/specs/phone-number-lookup.yml | 4 +- site/specs/voice.yml | 274 ++-- site/specs/webrtc.yml | 2019 ---------------------------- 7 files changed, 471 insertions(+), 2371 deletions(-) diff --git a/site/specs/messaging.yml b/site/specs/messaging.yml index c32addf36..9a7a5ce90 100644 --- a/site/specs/messaging.yml +++ b/site/specs/messaging.yml @@ -185,7 +185,7 @@ paths: except APIException as e: print(e.response_code) - lang: Ruby - source: |+ + source: | require 'bandwidth-sdk' Bandwidth.configure do |config| @@ -204,7 +204,6 @@ paths: rescue Bandwidth::ApiError => e puts "Error when calling MediaApi->list_media: #{e}" end - /users/{accountId}/media/{mediaId}: get: summary: Get Media diff --git a/site/specs/multi-factor-auth.yml b/site/specs/multi-factor-auth.yml index c5d2027b4..4520b66f1 100644 --- a/site/specs/multi-factor-auth.yml +++ b/site/specs/multi-factor-auth.yml @@ -302,7 +302,7 @@ paths: account_id = "12345" code_request = Bandwidth::CodeRequest.new( { - to: "+15553334444", + to: "+15553334444", from: "+15554443333", application_id: "1234-qwer", message: 'Your temporary {NAME} {SCOPE} code is {CODE}', @@ -919,7 +919,7 @@ paths: account_id = "12345" verify_code_request = Bandwidth::VerifyCodeRequest.new( { - to: "+15553334444", + to: "+15553334444", expiration_time_in_minutes: 3, code: '123456' } diff --git a/site/specs/numbers.yml b/site/specs/numbers.yml index 6e8c45881..4470f3680 100644 --- a/site/specs/numbers.yml +++ b/site/specs/numbers.yml @@ -1262,6 +1262,24 @@ components: name: sipPeerId schema: type: integer + SipPeerTnsPageQueryParam: + description: The number of the paged results to be displayed. + example: 4 + in: query + name: page + required: false + schema: + default: 1 + type: integer + SipPeerTnsSizeQueryParam: + description: The quantity of results displayed for each page. + example: 200 + in: query + name: size + required: false + schema: + default: 5000 + type: integer SiteIdPathParam: description: Site ID of the Sip Peer example: '407' @@ -4156,6 +4174,17 @@ components: years. format: int64 type: integer + NumberFormat: + default: LEGACY + description: >- + Specifies whether numbers should be formatted in e164 format, or use + legacy formatting. If Legacy is chosen, numbers with country code + '+1' will be formatted as 10-digit and all other numbers will use + e164 formatting. Can be omitted and defaults to LEGACY. + enum: + - LEGACY + - E164 + type: string Status: type: string URL: @@ -25759,48 +25788,6 @@ paths: summary: List Import to Account orders tags: - Import Tn to Account - post: - description: > - Import a large number of previously ported or otherwise acquired numbers - into the account - operationId: CreateImportToAccountOrder - parameters: - - $ref: '#/components/parameters/AccountIdPathParam' - requestBody: - content: - application/xml: - examples: - example: - value: "\n\n\t\n\t\t10D\n\t\t\n\t\t\t4158714244\n\t\t\t6105330709\n\t\t\n\t\tNOCHARGE\n\t\tAvailable\n\t\t\n\t\t\tProtected\n\t\t\n\t\tLevel 3\n\t\tTestId1234\n\t\t2\n\t\n\t1\n\t12345\n\t" - schema: - $ref: '#/components/schemas/ImportToAccountOrderRequest' - responses: - '201': - content: - application/xml: - examples: - example: - value: "\n\n\t\n\t\tc5986599-3a7c-4eed-a5c4-9121c17d54ab\n\t\t2014-04-01T21:54:18.796Z\n\t\t\n\t\t\tSJM00001\n\t\t\t2\n\t\t\tNOCHARGE\n\t\t\t10D\n\t\t\tAvailable\n\t\t\t\n\t\t\t\tProtected\n\t\t\t\n\t\t\t\n\t\t\t\t4158714245\n\t\t\t\t6105330710\n\t\t\t\n\t\t\tLevel 3\n\t\t\n\t\t743\n\t\t12345\n\t\n\t" - schema: - $ref: '#/components/schemas/ImportToAccountNumberOrderResponse' - description: >- - The order has been created and an order ID will be specified in the - payload and in the header. - '400': - content: - application/xml: - examples: - example: - value: "\n\n\t \n\t\t \n\t\t\t 7309\n\t\t\t The site id was not supplied or is invalid.\n\t\t \n\t\t \n\t\t\t 7312\n\t\t\t The sippeer id is invalid.\n\t\t \n\t \n " - schema: - $ref: '#/components/schemas/ImportToAccountNumberOrderErrorResponse' - description: >- - The order failed; one of the input parameters is invalid. The error - text and an error code will be provided in the ErrorList - element.

- summary: Import to Account order - tags: - - Import Tn to Account /accounts/{accountId}/importToAccount/batches: get: description: >- @@ -38640,6 +38627,8 @@ paths: parameters: - $ref: '#/components/parameters/AccountIdPathParam' - $ref: '#/components/parameters/SiteIdPathParam' + - $ref: '#/components/parameters/SipPeerTnsPageQueryParam' + - $ref: '#/components/parameters/SipPeerTnsSizeQueryParam' - description: ID of the Sip Peer to retrieve TNs information example: '500017' in: path @@ -39031,6 +39020,7 @@ paths: iris + LEGACY @@ -39053,6 +39043,7 @@ paths: iris + LEGACY @@ -39186,6 +39177,7 @@ paths: LS0tLS1CRUdJTiBDRVJUSU [...] kQgQ0VSVElGSUNBVEUtLS0tLQ0K + LEGACY eventEmailSubscription: @@ -39215,6 +39207,7 @@ paths: LS0tLS1CRUdJTiBDRVJUSU [...] kQgQ0VSVElGSUNBVEUtLS0tLQ0K + LEGACY orderEmailSubscription: @@ -39342,6 +39335,7 @@ paths: http://customer.com:8087/path/BandwidthHandler 4283455101 200 OK + LEGACY @@ -39373,6 +39367,7 @@ paths: http://customer.com:8087/path/BandwidthHandler 4283455101 200 OK + LEGACY @@ -39438,6 +39433,7 @@ paths: LS0tLS1CRUdJTiBDRVJUSU [...] kQgQ0VSVElGSUNBVEUtLS0tLQ0K + LEGACY eventEmailSubscription: @@ -39467,6 +39463,7 @@ paths: LS0tLS1CRUdJTiBDRVJUSU [...] kQgQ0VSVElGSUNBVEUtLS0tLQ0K + LEGACY orderEmailSubscription: diff --git a/site/specs/numbers_v2.yml b/site/specs/numbers_v2.yml index 701f55faa..cd3bb396a 100644 --- a/site/specs/numbers_v2.yml +++ b/site/specs/numbers_v2.yml @@ -1196,6 +1196,24 @@ components: name: sipPeerId schema: type: integer + SipPeerTnsPageQueryParam: + description: The number of the paged results to be displayed. + example: 4 + in: query + name: page + required: false + schema: + default: 1 + type: integer + SipPeerTnsSizeQueryParam: + description: The quantity of results displayed for each page. + example: 200 + in: query + name: size + required: false + schema: + default: 5000 + type: integer SiteIdPathParam: description: Site ID of the Sip Peer example: '407' @@ -1257,6 +1275,37 @@ components: required: true schema: type: string + areaCodeQueryParameter: + description: Area code of a phone number + example: '07' + in: query + name: areaCode + required: false + schema: + type: string + countryCodeA3QueryParameter: + description: 3-letter, ISO 3166 country code + example: GBR + in: query + name: Country Code + required: true + schema: + type: string + phoneNumberTypeQueryParameter: + description: Phone number type + example: MOBILE + in: query + name: phoneNumberType + required: false + schema: + enum: + - GEOGRAPHIC + - SHARED_COST + - TOLL_FREE + - NATIONAL + - SPECIAL + - MOBILE + type: string shortCodeCountryPathParam: description: The short code number country. example: USA @@ -1396,6 +1445,21 @@ components: associated with the order, the state of the order, and a list of the successfully imported Telephone Numbers, and descriptions of any encountered errors. + badRequestLosingInvlaidCountryCodeCarriersResponse: + content: + application/json: + examples: + example: + description: example + value: + data: null + errors: + code: 7673 + description: '''%s'' is not a valid countryCodeA3 value' + links: null + schema: + $ref: '#/components/schemas/portingLosingCarriersResponseSchema' + description: Error returned when the country code is invalid bulkRateCenterGetResponse404Error: content: application/xml: @@ -1447,6 +1511,44 @@ components: description: >- Successful response which starts the bulk upsert for provided rate centers. + listOfLosingCarriersResponse: + content: + application/json: + examples: + example: + value: + data: + losingCarriers: + - name: Losing Carrier 1 + - name: Losing Carrier 2 + - name: Losing Carrier 3 + - name: Losing Carrier 4 + errors: null + links: + - href: /portingLosingCarriers + method: GET + rel: self + schema: + $ref: '#/components/schemas/portingLosingCarriersResponseSchema' + description: A list of available carriers that can port out a phone number + noUpstreamServicesLosingCarriersResponse: + content: + application/json: + examples: + example: + summary: example + value: + data: null + errors: + code: 7678 + description: >- + We received an error while attempting to retrieve the losing + carriers for your request. Please try this request again + later. + links: null + schema: + $ref: '#/components/schemas/portingLosingCarriersResponseSchema' + description: Error returned when upstream services are unavailable rateCenter401Error: content: application/json: @@ -4026,6 +4128,17 @@ components: years. format: int64 type: integer + NumberFormat: + default: E164 + description: >- + Specifies whether numbers should be formatted in e164 format, or use + legacy formatting. If Legacy is chosen, numbers with country code + '+1' will be formatted as 10-digit and all other numbers will use + e164 formatting. Can be omitted and defaults to E164. + enum: + - LEGACY + - E164 + type: string Status: type: string URL: @@ -14337,6 +14450,56 @@ components: name: OrderCreateDate type: object type: object + portingLosingCarriersResponseSchema: + description: List of losing carriers for porting + properties: + data: + nullable: true + properties: + losingCarriers: + items: + properties: + name: + description: The name of the carrier + example: Losing Carrier 1 + type: string + type: object + type: array + type: object + errors: + items: + properties: + code: + description: An error code identifying the error + type: string + description: + description: A description of the error + type: string + meta: + description: Additional information regarding the error + type: object + type: object + nullable: true + type: array + links: + items: + properties: + href: + description: The API endpoint URL + example: /porting/losingCarriers + type: string + method: + description: The HTTP method used to make the request + example: GET + type: string + rel: + description: The relationship of the endpoint to the request + example: self + type: string + type: object + nullable: true + type: array + type: object shortCode: description: Short code registration. properties: @@ -15290,116 +15453,6 @@ paths: summary: Retrieve account tags: - Account - /accounts/{accountId}/addresses: - get: - description: GET is used to retrieve all addresses. - operationId: GetAllAddresses - parameters: - - $ref: '#/components/parameters/AccountIdPathParam' - - description: >- - Search criterion for address by its locationid. Cannot be combined - with type. Always returns E911 addresses. - example: 47950147-9c58-407c-bcc4-e88743b20db5 - in: query - name: e911locationid - required: false - schema: - type: string - - description: Search criterion for addresses by their type. - example: e911 - in: query - name: type - required: true - schema: - type: string - - description: >- - An ID of the first element in a page. This value will indicate the - first value, not the page number, of the initial entry in the page - being requested.
It can be an id of address. The initial page is - tagged with the ID `1`. - example: '3' - in: query - name: page - required: false - schema: - default: '1' - type: string - - description: The number of items to include in a page. - example: 5000 - in: query - name: size - required: false - schema: - default: 500 - type: integer - - description: The text to search simultaneously through e911locationIds. - example: name - in: query - name: suggestions - required: false - schema: - type: string - responses: - '200': - content: - application/xml: - examples: - example: - value: |- - - - 1 - - Link=<http://admin.localhost:8080/api/accounts/8000259/addresses?type=e911&page=1&size=500>;rel="first"; - Link=<http://localhost:8080/api/accounts/8000259/addresses?type=E911&page=501&size=500>;rel="next"; - - -
- 207 - - - Elmastar - AlternateStar - - - Carpinteriaaly - NY - 93019 - - - United States - E911 - 2 - VALID -
-
-
- schema: - $ref: '#/components/schemas/AddressesResponseWrapper' - description: >- - OK - the addresses retrieval request will return a list of all - addresses having specified type. - '404': - content: - application/xml: - examples: - example: - value: |- - - - - The resource does not exist - - - schema: - $ref: '#/components/schemas/AddressesResponseNotFound' - description: >- - Not Found - if the account specified does not exist or is locked or - there are no addresses for specified search criteria it will result - in a not found. - summary: Retrieve all addresses - tags: - - Addresses /accounts/{accountId}/aeuis: get: description: GET is used to retrieve all Alternate end user identifiers. @@ -20908,6 +20961,116 @@ paths: summary: Fetch DLDA order history tags: - DLDA + /accounts/{accountId}/e911Addresses: + get: + description: GET is used to retrieve all addresses. + operationId: GetAllAddresses + parameters: + - $ref: '#/components/parameters/AccountIdPathParam' + - description: >- + Search criterion for address by its locationid. Cannot be combined + with type. Always returns E911 addresses. + example: 47950147-9c58-407c-bcc4-e88743b20db5 + in: query + name: e911locationid + required: false + schema: + type: string + - description: Search criterion for addresses by their type. + example: e911 + in: query + name: type + required: true + schema: + type: string + - description: >- + An ID of the first element in a page. This value will indicate the + first value, not the page number, of the initial entry in the page + being requested.
It can be an id of address. The initial page is + tagged with the ID `1`. + example: '3' + in: query + name: page + required: false + schema: + default: '1' + type: string + - description: The number of items to include in a page. + example: 5000 + in: query + name: size + required: false + schema: + default: 500 + type: integer + - description: The text to search simultaneously through e911locationIds. + example: name + in: query + name: suggestions + required: false + schema: + type: string + responses: + '200': + content: + application/xml: + examples: + example: + value: |- + + + 1 + + Link=<http://admin.localhost:8080/api/accounts/8000259/addresses?type=e911&page=1&size=500>;rel="first"; + Link=<http://localhost:8080/api/accounts/8000259/addresses?type=E911&page=501&size=500>;rel="next"; + + +
+ 207 + + + Elmastar + AlternateStar + + + Carpinteriaaly + NY + 93019 + + + United States + E911 + 2 + VALID +
+
+
+ schema: + $ref: '#/components/schemas/AddressesResponseWrapper' + description: >- + OK - the addresses retrieval request will return a list of all + addresses having specified type. + '404': + content: + application/xml: + examples: + example: + value: |- + + + + The resource does not exist + + + schema: + $ref: '#/components/schemas/AddressesResponseNotFound' + description: >- + Not Found - if the account specified does not exist or is locked or + there are no addresses for specified search criteria it will result + in a not found. + summary: Retrieve all addresses + tags: + - Addresses /accounts/{accountId}/e911s: get: description: >- @@ -25566,48 +25729,6 @@ paths: summary: List Import to Account orders tags: - Import Tn to Account - post: - description: > - Import a large number of previously ported or otherwise acquired numbers - into the account - operationId: CreateImportToAccountOrder - parameters: - - $ref: '#/components/parameters/AccountIdPathParam' - requestBody: - content: - application/xml: - examples: - example: - value: "\n\n\t\n\t\t10D\n\t\t\n\t\t\t+14158714244\n\t\t\t+16105330709\n\t\t\n\t\tNOCHARGE\n\t\tAvailable\n\t\t\n\t\t\tProtected\n\t\t\n\t\tLevel 3\n\t\tTestId1234\n\t\t2\n\t\n\t1\n\t12345\n\t" - schema: - $ref: '#/components/schemas/ImportToAccountOrderRequest' - responses: - '201': - content: - application/xml: - examples: - example: - value: "\n\n\t\n\t\tc5986599-3a7c-4eed-a5c4-9121c17d54ab\n\t\t2014-04-01T21:54:18.796Z\n\t\t\n\t\t\tSJM00001\n\t\t\t2\n\t\t\tNOCHARGE\n\t\t\t10D\n\t\t\tAvailable\n\t\t\t\n\t\t\t\tProtected\n\t\t\t\n\t\t\t\n\t\t\t\t+14158714245\n\t\t\t\t+16105330710\n\t\t\t\n\t\t\tLevel 3\n\t\t\n\t\t743\n\t\t12345\n\t\n\t" - schema: - $ref: '#/components/schemas/ImportToAccountNumberOrderResponse' - description: >- - The order has been created and an order ID will be specified in the - payload and in the header. - '400': - content: - application/xml: - examples: - example: - value: "\n\n\t \n\t\t \n\t\t\t 7309\n\t\t\t The site id was not supplied or is invalid.\n\t\t \n\t\t \n\t\t\t 7312\n\t\t\t The sippeer id is invalid.\n\t\t \n\t \n " - schema: - $ref: '#/components/schemas/ImportToAccountNumberOrderErrorResponse' - description: >- - The order failed; one of the input parameters is invalid. The error - text and an error code will be provided in the ErrorList - element.

- summary: Import to Account order - tags: - - Import Tn to Account /accounts/{accountId}/importToAccount/batches: get: description: >- @@ -38340,6 +38461,8 @@ paths: parameters: - $ref: '#/components/parameters/AccountIdPathParam' - $ref: '#/components/parameters/SiteIdPathParam' + - $ref: '#/components/parameters/SipPeerTnsPageQueryParam' + - $ref: '#/components/parameters/SipPeerTnsSizeQueryParam' - description: ID of the Sip Peer to retrieve TNs information example: '500017' in: path @@ -38731,6 +38854,7 @@ paths: iris + E164 @@ -38753,6 +38877,7 @@ paths: iris + E164 @@ -38886,6 +39011,7 @@ paths: LS0tLS1CRUdJTiBDRVJUSU [...] kQgQ0VSVElGSUNBVEUtLS0tLQ0K + E164 eventEmailSubscription: @@ -38915,6 +39041,7 @@ paths: LS0tLS1CRUdJTiBDRVJUSU [...] kQgQ0VSVElGSUNBVEUtLS0tLQ0K + E164 orderEmailSubscription: @@ -39042,6 +39169,7 @@ paths: http://customer.com:8087/path/BandwidthHandler +14283455101 200 OK + E164 @@ -39073,6 +39201,7 @@ paths: http://customer.com:8087/path/BandwidthHandler +14283455101 200 OK + E164 @@ -39138,6 +39267,7 @@ paths: LS0tLS1CRUdJTiBDRVJUSU [...] kQgQ0VSVElGSUNBVEUtLS0tLQ0K + E164 eventEmailSubscription: @@ -39167,6 +39297,7 @@ paths: LS0tLS1CRUdJTiBDRVJUSU [...] kQgQ0VSVElGSUNBVEUtLS0tLQ0K + E164 orderEmailSubscription: @@ -42556,6 +42687,28 @@ paths: summary: Retrieve Covered Rate Centers tags: - Rate Centers + /porting/losingCarriers: + get: + description: > +

List losing carriers that a non-NANPA number can be ported from, + given a countryCodeA3 and optional areaCode and phoneNumberType + values.

+ operationId: portingLosingCarriers + parameters: + - $ref: '#/components/parameters/countryCodeA3QueryParameter' + - $ref: '#/components/parameters/phoneNumberTypeQueryParameter' + - $ref: '#/components/parameters/areaCodeQueryParameter' + responses: + '200': + $ref: '#/components/responses/listOfLosingCarriersResponse' + '400': + $ref: >- + #/components/responses/badRequestLosingInvlaidCountryCodeCarriersResponse + '502': + $ref: '#/components/responses/noUpstreamServicesLosingCarriersResponse' + summary: List losing carriers for porting non-NANPA telephone numbers + tags: + - Porting /rateCenters: get: description: >- diff --git a/site/specs/phone-number-lookup.yml b/site/specs/phone-number-lookup.yml index 814b1d4b4..96baee210 100644 --- a/site/specs/phone-number-lookup.yml +++ b/site/specs/phone-number-lookup.yml @@ -226,8 +226,8 @@ paths: account_id = "12345" - lookup_request = Bandwidth::LookupRequest.new({tns: - ["+15554443333"]}) + lookup_request = Bandwidth::LookupRequest.new({ tns: + ["+15554443333"] }) begin diff --git a/site/specs/voice.yml b/site/specs/voice.yml index 41340814f..b7eacca58 100644 --- a/site/specs/voice.yml +++ b/site/specs/voice.yml @@ -776,28 +776,22 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::Voice - - bandwidth_client = Bandwidth::Client.new( - voice_basic_auth_user_name: "api-username", - voice_basic_auth_password: "api-password" - ) - - voice_client = bandwidth_client.voice_client.client + require 'bandwidth-sdk' - body = ModifyCallRequest.new - body.redirect_url = "http://www.myapp.com/new" - body.state = "active" + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - call_id = "c-1234" + api_instance = Bandwidth::CallsApi.new + account_id = "12345" + call_id = ENV['CALL_ID'] + update_call = Bandwidth::UpdateCall.new begin - voice_client.modify_call("12345", call_id, body) - rescue APIException => e - puts e.response_code + api_instance.update_call(account_id, call_id, update_call) + rescue Bandwidth::ApiError => e + puts "Error when calling CallsApi->update_call: #{e}" end /accounts/{accountId}/calls/{callId}/bxml: put: @@ -1018,25 +1012,25 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::Voice + require 'bandwidth-sdk' - bandwidth_client = Bandwidth::Client.new( - voice_basic_auth_user_name: "api-username", - voice_basic_auth_password: "api-password" - ) + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - voice_client = bandwidth_client.voice_client.client + api_instance = Bandwidth::ConferencesApi.new + account_id = "12345" + opts = { + min_created_time: '2022-06-21T19:13:21Z', + page_size: 500 + } begin - response = voice_client.get_conferences("12345") - if response.data.length > 0 - puts response.data[0].id - end - rescue APIException => e - puts e.response_code + result = api_instance.list_conferences(account_id, opts) + p result[0].id if response.length.positive? + rescue Bandwidth::ApiError => e + puts "Error when calling ConferencesApi->list_conferences: #{e}" end /accounts/{accountId}/conferences/{conferenceId}: get: @@ -1482,27 +1476,22 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::Voice - - bandwidth_client = Bandwidth::Client.new( - voice_basic_auth_user_name: "api-username", - voice_basic_auth_password: "api-password" - ) - - voice_client = bandwidth_client.voice_client.client + require 'bandwidth-sdk' - body = ModifyConferenceRequest.new - body.status = StatusEnum::ACTIVE + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - conference_id = "conf-1234" + api_instance = Bandwidth::ConferencesApi.new + account_id = "12345" + conference_id = ENV['CONFERENCE_ID'] + update_conference = Bandwidth::UpdateConference.new begin - voice_client.modify_conference("12345", conference_id, body) - rescue APIException => e - puts e.response_code + api_instance.update_conference(account_id, conference_id, update_conference) + rescue Bandwidth::ApiError => e + puts "Error when calling ConferencesApi->update_conference: #{e}" end /accounts/{accountId}/conferences/{conferenceId}/bxml: put: @@ -1992,28 +1981,23 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::Voice - - bandwidth_client = Bandwidth::Client.new( - voice_basic_auth_user_name: "api-username", - voice_basic_auth_password: "api-password" - ) - - voice_client = bandwidth_client.voice_client.client + require 'bandwidth-sdk' - body = ConferenceMemberState.new - body.mute = true + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - conference_id = "conf-1234" - call_id = "c-1234" + api_instance = Bandwidth::ConferencesApi.new + account_id = "12345" + conference_id = ENV['CONFERENCE_ID'] + member_id = ENV['MEMBER_ID'] + update_conference_member = Bandwidth::UpdateConferenceMember.new begin - voice_client.modify_conference_member("12345", conference_id, call_id, body) - rescue APIException => e - puts e.response_code + api_instance.update_conference_member(account_id, conference_id, member_id, update_conference_member) + rescue Bandwidth::ApiError => e + puts "Error when calling ConferencesApi->update_conference_member: #{e}" end /accounts/{accountId}/conferences/{conferenceId}/recordings: get: @@ -2212,27 +2196,22 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::Voice - - bandwidth_client = Bandwidth::Client.new( - voice_basic_auth_user_name: "api-username", - voice_basic_auth_password: "api-password" - ) + require 'bandwidth-sdk' - voice_client = bandwidth_client.voice_client.client + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - conference_id = "conf-1234" + api_instance = Bandwidth::ConferencesApi.new + account_id = "12345" + conference_id = ENV['CONFERENCE_ID'] begin - response = voice_client.get_conference_recordings("12345", conference_id) - if response.data.length > 0 - puts response.body[0].name - end - rescue APIException => e - puts e.response_code + result = api_instance.list_conference_recordings(account_id, conference_id) + p result[0].name if response.length.positive? + rescue Bandwidth::ApiError => e + puts "Error when calling ConferencesApi->list_conference_recordings: #{e}" end /accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}: get: @@ -2850,25 +2829,25 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::Voice + require 'bandwidth-sdk' - bandwidth_client = Bandwidth::Client.new( - voice_basic_auth_user_name: "api-username", - voice_basic_auth_password: "api-password" - ) + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - voice_client = bandwidth_client.voice_client.client + api_instance = Bandwidth::RecordingsApi.new + account_id = "12345" + opts = { + to: '%2b19195551234', + from: '%2b19195554321' + } begin - result = voice_client.get_query_call_recordings("12345") - if result.data.length > 0 - puts result.data[0].recording_id - end - rescue APIException => e - puts e.response_code + result = api_instance.list_account_call_recordings(account_id, opts) + p result[0].recording_id if result.length.positive? + rescue Bandwidth::ApiError => e + puts "Error when calling RecordingsApi->list_account_call_recordings: #{e}" end /accounts/{accountId}/calls/{callId}/recording: put: @@ -3086,28 +3065,30 @@ paths: except APIException as e: print(e.response_code) - lang: Ruby - source: | - require 'bandwidth' + source: > + require 'bandwidth-sdk' - include Bandwidth - include Bandwidth::Voice - bandwidth_client = Bandwidth::Client.new( - voice_basic_auth_user_name: "api-username", - voice_basic_auth_password: "api-password" - ) + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - voice_client = bandwidth_client.voice_client.client - body = ModifyCallRecordingRequest.new - body.state = "paused" + api_instance = Bandwidth::RecordingsApi.new + + account_id = "12345" + + call_id = ENV['CALL_ID'] + + update_call_recording = Bandwidth::UpdateCallRecording.new({ state: + Bandwidth::RecordingStateEnum::PAUSED }) - call_id = "c-1234" begin - voice_client.modify_call_recording_state("12345", call_id, body) - rescue APIException => e - puts e.response_code + api_instance.update_call_recording_state(account_id, call_id, update_call_recording) + rescue Bandwidth::ApiError => e + puts "Error when calling RecordingsApi->update_call_recording_state: #{e}" end /accounts/{accountId}/calls/{callId}/recordings: get: @@ -3299,27 +3280,22 @@ paths: print(e.response_code) - lang: Ruby source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::Voice - - bandwidth_client = Bandwidth::Client.new( - voice_basic_auth_user_name: "api-username", - voice_basic_auth_password: "api-password" - ) + require 'bandwidth-sdk' - voice_client = bandwidth_client.voice_client.client + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - call_id = "c-1234" + api_instance = Bandwidth::RecordingsApi.new + account_id = "12345" + call_id = ENV['CALL_ID'] begin - response = voice_client.get_call_recordings("12345", call_id) - if response.data.length > 0 - puts response.data[0].media_url - end - rescue APIException => e - puts e.response_code + result = api_instance.list_call_recordings(account_id, call_id) + p result[0].media_url if response.length.positive? + rescue Bandwidth::ApiError => e + puts "Error when calling RecordingsApi->list_call_recordings: #{e}" end /accounts/{accountId}/calls/{callId}/recordings/{recordingId}: get: @@ -4612,31 +4588,25 @@ paths: except APIException as e: print(e.response_code) - lang: Ruby - source: |+ - require 'bandwidth' - - include Bandwidth - include Bandwidth::Voice - - bandwidth_client = Bandwidth::Client.new( - voice_basic_auth_user_name: "api-username", - voice_basic_auth_password: "api-password" - ) - - voice_client = bandwidth_client.voice_client.client + source: | + require 'bandwidth-sdk' - call_id = "c-1234" - recording_id = "r-1234" + Bandwidth.configure do |config| + config.username = "api-username" + config.password = "api-password" + end - body = TranscribeRecordingRequest.new - body.callback_url = "https://callback-url.com" + api_instance = Bandwidth::RecordingsApi.new + account_id = "12345" + call_id = ENV['CALL_ID'] + recording_id = ENV['RECORDING_ID'] + transcribe_recording = Bandwidth::TranscribeRecording.new begin - voice_client.create_transcribe_call_recording("12345", call_id, recording_id, body) - rescue APIException => e - puts e.response_code + api_instance.transcribe_call_recording(account_id, call_id, recording_id, transcribe_recording) + rescue Bandwidth::ApiError => e + puts "Error when calling RecordingsApi->transcribe_call_recording: #{e}" end - delete: tags: - Recordings diff --git a/site/specs/webrtc.yml b/site/specs/webrtc.yml index 9be38445f..a18eb766c 100644 --- a/site/specs/webrtc.yml +++ b/site/specs/webrtc.yml @@ -39,175 +39,6 @@ paths: $ref: '#/components/responses/webrtcForbiddenError' '500': $ref: '#/components/responses/webrtcInternalServerError' - x-codeSamples: - - lang: cURL - source: > - curl - 'https://api.webrtc.bandwidth.com/v1/accounts/12345/participants' \ - -X POST \ - -H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \ - -H 'Content-Type: application/json' \ - -d '{ - "callbackUrl": "https://example.com/callback", - "publishPermissions": [ - "VIDEO", - "AUDIO" - ], - "tag": "participant1", - "deviceApiVersion": "V3" - }' - - lang: C# - source: "\uFEFFusing System;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\nusing Bandwidth.Standard;\nusing Bandwidth.Standard.Exceptions;\nusing Bandwidth.Standard.WebRtc.Models;\n\nclass Program\n{\n static async Task Main(string[] args)\n {\n var username = \"api-username\";\n var password = \"api-pasword\";\n var accountId = \"12345\";\n\n var client = new BandwidthClient.Builder()\n .WebRtcBasicAuthCredentials(username, password)\n .Build();\n\n var participant = new Participant()\n {\n PublishPermissions = new List() { PublishPermissionEnum.AUDIO, PublishPermissionEnum.VIDEO }\n };\n\n try\n {\n var response = await client.WebRtc.APIController.CreateParticipantAsync(accountId, participant);\n Console.WriteLine(response.Data);\n }\n catch (ApiException e)\n {\n Console.WriteLine(e.Message);\n }\n }\n}\n" - - lang: Java - source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.webrtc.models.AccountsParticipantsResponse; - import com.bandwidth.webrtc.models.Participant; - import com.bandwidth.webrtc.models.PublishPermissionEnum; - - import java.util.concurrent.CompletableFuture; - import java.util.concurrent.ExecutionException; - import java.util.Arrays; - import java.util.List; - - public class Sample { - public static final String USERNAME = "api-username"; - public static final String PASSWORD = "api-password"; - public static final String ACCOUNT_ID = "12345"; - - public static void main(String[] args) { - BandwidthClient client = new BandwidthClient.Builder() - .webRtcBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - Participant participant = new Participant(); - List publishPermissions = Arrays.asList(PublishPermissionEnum.AUDIO, PublishPermissionEnum.VIDEO); - participant.setPublishPermissions(publishPermissions); - - try { - CompletableFuture> completableFuture = client.getWebRtcClient().getAPIController().createParticipantAsync(ACCOUNT_ID, participant); - } catch (Exception ex) { - System.out.println(ex.getMessage()); - } - } - } - - lang: Node.js - source: | - import { Client, ApiController } from '@bandwidth/webrtc'; - - const BW_USERNAME = "api-username"; - const BW_PASSWORD = "api-password"; - const BW_ACCOUNT_ID = "12345"; - - const client = new Client({ - basicAuthUserName: BW_USERNAME, - basicAuthPassword: BW_PASSWORD - }); - - const controller = new ApiController(client); - - const accountId = BW_ACCOUNT_ID; - - const createParticipant = async function() { - try { - const response = await controller.createParticipant(accountId, { - callbackUrl: "http://www.myapp.com/new", - publishPermissions: ["AUDIO"] - }) - console.log(response.body); - } catch(error) { - console.error(error); - } - } - - createParticipant(); - - lang: PHP - source: | - $BW_USERNAME, - 'webRtcBasicAuthPassword' => $BW_PASSWORD, - ) - ); - $client = new BandwidthLib\BandwidthClient($config); - - $webRtcClient = $client->getWebRtc()->getClient(); - - $body = new BandwidthLib\WebRtc\Models\Participant(); - $body->publishPermissions = array("AUDIO", "VIDEO"); - $body->deviceApiVersion = "V3"; - - try { - $response = $webRtcClient->createParticipant($BW_ACCOUNT_ID, $body); - print_r($response->getResult()->participant->id); - } catch (BandwidthLib\APIException $e) { - print_r($e->getResponseCode()); - } - - lang: Python - source: | - from bandwidth.bandwidth_client import BandwidthClient - from bandwidth.exceptions.api_exception import APIException - from bandwidth.webrtc.models.participant import Participant - - import os - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" - - bandwidth_client = BandwidthClient( - web_rtc_basic_auth_user_name=BW_USERNAME, - web_rtc_basic_auth_password=BW_PASSWORD - ) - - web_rtc_client = bandwidth_client.web_rtc_client.client - - body = Participant() - body.publish_permissions = ["AUDIO", "VIDEO"] - body.device_api_version = "V3" - - try: - response = web_rtc_client.create_participant(BW_ACCOUNT_ID, body) - print(response.body.participant.id) - except APIException as e: - print(e.response_code) - - lang: Ruby - source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::WebRtc - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" - - bandwidth_client = Bandwidth::Client.new( - web_rtc_basic_auth_user_name: BW_USERNAME, - web_rtc_basic_auth_password: BW_PASSWORD - ) - - web_rtc_client = bandwidth_client.web_rtc_client.client - - body = Participant.new - body.publish_permissions = ["AUDIO", "VIDEO"] - body.device_api_version = "V3" - - begin - response = web_rtc_client.create_participant(BW_ACCOUNT_ID, :body => body) - puts response.data.participant.id - rescue APIException => e - puts e.response_code - end /accounts/{accountId}/participants/{participantId}: get: tags: @@ -231,182 +62,6 @@ paths: $ref: '#/components/responses/webrtcNotFoundError' '500': $ref: '#/components/responses/webrtcInternalServerError' - x-codeSamples: - - lang: cURL - source: > - curl - 'https://api.webrtc.bandwidth.com/v1/accounts/12345/participants/320e2af6-13ec-498d-8b51-daba52c37853' - \ - -H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' - - lang: C# - source: |- - using System; - using System.Threading.Tasks; - using Bandwidth.Standard; - using Bandwidth.Standard.Exceptions; - using Bandwidth.Standard.WebRtc.Models; - - class Program - { - static async Task Main(string[] args) - { - var username = "api-username"; - var password = "api-pasword"; - var accountId = "12345"; - - var participantId = "320e2af6-13ec-498d-8b51-daba52c37853"; - - var client = new BandwidthClient.Builder() - .WebRtcBasicAuthCredentials(username, password) - .Build(); - - try - { - var response = await client.WebRtc.APIController.GetParticipantAsync(accountId, participantId); - Console.WriteLine(response.Data); - } - catch (ApiException e) - { - Console.WriteLine(e.Message); - } - } - } - - lang: Java - source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.webrtc.models.Participant; - - import java.util.concurrent.CompletableFuture; - import java.util.concurrent.ExecutionException; - - public class Sample { - public static final String USERNAME = "api-username"; - public static final String PASSWORD = "api-password"; - public static final String ACCOUNT_ID = "12345"; - - public static void main(String[] args) { - String participantId = "568749d5-04d5-483d-adf5-deac7dd3d521"; - - BandwidthClient client = new BandwidthClient.Builder() - .webRtcBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - try { - CompletableFuture> completableFuture = client.getWebRtcClient().getAPIController().getParticipantAsync(ACCOUNT_ID, participantId); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); - } - } - } - - lang: Node.js - source: | - import { Client, ApiController } from '@bandwidth/webrtc'; - - const BW_USERNAME = "api-username"; - const BW_PASSWORD = "api-password"; - const BW_ACCOUNT_ID = "12345"; - - const client = new Client({ - basicAuthUserName: BW_USERNAME, - basicAuthPassword: BW_PASSWORD - }); - - const controller = new ApiController(client); - - const accountId = BW_ACCOUNT_ID; - const participantId = "320e2af6-13ec-498d-8b51-daba52c37853" - - const getParticipant = async function() { - try { - const response = await controller.getParticipant(accountId, participantId) - console.log(response.body); - } catch(error) { - console.error(error); - } - } - - getParticipant(); - - lang: PHP - source: | - $BW_USERNAME, - 'webRtcBasicAuthPassword' => $BW_PASSWORD, - ) - ); - $client = new BandwidthLib\BandwidthClient($config); - - $webRtcClient = $client->getWebRtc()->getClient(); - - $participantId = "1234-qwer"; - - try { - $response = $webRtcClient->getParticipant($BW_ACCOUNT_ID, $participantId); - print_r($response->getResult()->id); - } catch (BandwidthLib\APIException $e) { - print_r($e->getResponseCode()); - } - - lang: Python - source: | - from bandwidth.bandwidth_client import BandwidthClient - from bandwidth.exceptions.api_exception import APIException - - import os - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" - - bandwidth_client = BandwidthClient( - web_rtc_basic_auth_user_name=BW_USERNAME, - web_rtc_basic_auth_password=BW_PASSWORD - ) - - web_rtc_client = bandwidth_client.web_rtc_client.client - - participant_id = "1234-abcd" - - try: - response = web_rtc_client.get_participant(BW_ACCOUNT_ID, participant_id) - print(response.body.id) - except APIException as e: - print(e.response_code) - - lang: Ruby - source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::WebRtc - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" - - bandwidth_client = Bandwidth::Client.new( - web_rtc_basic_auth_user_name: BW_USERNAME, - web_rtc_basic_auth_password: BW_PASSWORD - ) - - web_rtc_client = bandwidth_client.web_rtc_client.client - - participant_id = "1234-abcd" - - begin - response = web_rtc_client.get_participant(BW_ACCOUNT_ID, participant_id) - puts response.data.id - rescue APIException => e - puts e.response_code - end delete: tags: - Participants @@ -429,177 +84,6 @@ paths: $ref: '#/components/responses/webrtcNotFoundError' '500': $ref: '#/components/responses/webrtcInternalServerError' - x-codeSamples: - - lang: cURL - source: > - curl - 'https://api.webrtc.bandwidth.com/v1/accounts/12345/participants/320e2af6-13ec-498d-8b51-daba52c37853' - \ - -X DELETE \ - -H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' - - lang: C# - source: | - using System; - using System.Threading.Tasks; - using Bandwidth.Standard; - using Bandwidth.Standard.Exceptions; - using Bandwidth.Standard.WebRtc.Models; - - class Program - { - static async Task Main(string[] args) - { - var username = "api-username"; - var password = "api-pasword"; - var accountId = "12345"; - - var participantId = "320e2af6-13ec-498d-8b51-daba52c37853"; - - var client = new BandwidthClient.Builder() - .WebRtcBasicAuthCredentials(username, password) - .Build(); - - try - { - await client.WebRtc.APIController.DeleteParticipantAsync(accountId, participantId); - } - catch (ApiException e) - { - Console.WriteLine(e.Message); - } - } - } - - lang: Java - source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - - import java.util.concurrent.CompletableFuture; - import java.util.concurrent.ExecutionException; - - public class Sample { - public static final String USERNAME = "api-username"; - public static final String PASSWORD = "api-password"; - public static final String ACCOUNT_ID = "12345"; - - public static void main(String[] args) { - BandwidthClient client = new BandwidthClient.Builder() - .webRtcBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - String participantId = "568749d5-04d5-483d-adf5-deac7dd3d521"; - - try { - CompletableFuture> completableFuture = client.getWebRtcClient().getAPIController().deleteParticipantAsync(ACCOUNT_ID, participantId); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); - } - } - } - - lang: Node.js - source: | - import { Client, ApiController } from '@bandwidth/webrtc'; - - const BW_USERNAME = "api-username"; - const BW_PASSWORD = "api-password"; - const BW_ACCOUNT_ID = "12345"; - - const client = new Client({ - basicAuthUserName: BW_USERNAME, - basicAuthPassword: BW_PASSWORD - }); - - const controller = new ApiController(client); - - const accountId = BW_ACCOUNT_ID; - const participantId = "320e2af6-13ec-498d-8b51-daba52c37853" - - const deleteParticipant = async function() { - try { - const response = await controller.deleteParticipant(accountId, participantId) - console.log(response.body); - } catch(error) { - console.error(error); - } - } - - deleteParticipant(); - - lang: PHP - source: | - $BW_USERNAME, - 'webRtcBasicAuthPassword' => $BW_PASSWORD, - ) - ); - $client = new BandwidthLib\BandwidthClient($config); - - $webRtcClient = $client->getWebRtc()->getClient(); - - $participantId = "1234-abcd"; - - try { - $webRtcClient->deleteParticipant($BW_ACCOUNT_ID, $participantId); - } catch (BandwidthLib\APIException $e) { - print_r($e->getResponseCode()); - } - - lang: Python - source: | - from bandwidth.bandwidth_client import BandwidthClient - from bandwidth.exceptions.api_exception import APIException - - import os - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" - - bandwidth_client = BandwidthClient( - web_rtc_basic_auth_user_name=BW_USERNAME, - web_rtc_basic_auth_password=BW_PASSWORD - ) - web_rtc_client = bandwidth_client.web_rtc_client.client - - participant_id = "1234-abcd" - - try: - web_rtc_client.delete_participant(BW_ACCOUNT_ID, participant_id) - except APIException as e: - print(e.response_code) - - lang: Ruby - source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::WebRtc - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" - - bandwidth_client = Bandwidth::Client.new( - web_rtc_basic_auth_user_name: BW_USERNAME, - web_rtc_basic_auth_password: BW_PASSWORD - ) - - web_rtc_client = bandwidth_client.web_rtc_client.client - - participant_id = "1234-abcd" - - begin - web_rtc_client.delete_participant(BW_ACCOUNT_ID, participant_id) - rescue APIException => e - puts e.response_code - end /accounts/{accountId}/sessions: post: tags: @@ -624,193 +108,6 @@ paths: $ref: '#/components/responses/webrtcForbiddenError' '500': $ref: '#/components/responses/webrtcInternalServerError' - x-codeSamples: - - lang: cURL - source: | - curl 'https://api.webrtc.bandwidth.com/v1/accounts/12345/sessions' \ - -X POST \ - -H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \ - -H 'Content-Type: application/json' \ - -d '{ - "tag": "session1" - }' - - lang: C# - source: |- - using System; - using System.Threading.Tasks; - using Bandwidth.Standard; - using Bandwidth.Standard.Exceptions; - using Bandwidth.Standard.WebRtc.Models; - - class Program - { - static async Task Main(string[] args) - { - var username = "api-username"; - var password = "api-pasword"; - var accountId = "12345"; - - var client = new BandwidthClient.Builder() - .WebRtcBasicAuthCredentials(username, password) - .Build(); - - var session = new Session() - { - Tag = "new-session" - }; - - try - { - var response = await client.WebRtc.APIController.CreateSessionAsync(accountId, session); - Console.WriteLine(response.Data); - } - catch (ApiException e) - { - Console.WriteLine(e.Message); - } - } - } - - lang: Java - source: | - import java.util.concurrent.CompletableFuture; - import java.util.concurrent.ExecutionException; - - import com.bandwidth.*; - import com.bandwidth.webrtc.models.*; - import com.bandwidth.http.response.ApiResponse; - - public class Sample { - public static final String USERNAME = "api-username"; - public static final String PASSWORD = "api-password"; - public static final String ACCOUNT_ID = "12345"; - - public static void main(String[] args) { - BandwidthClient client = new BandwidthClient.Builder() - .webRtcBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - Session session = new Session(); - session.setTag("new-session"); - - try { - CompletableFuture> completableFuture = client.getWebRtcClient().getAPIController().createSessionAsync(ACCOUNT_ID, session); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); - } - } - } - - lang: Node.js - source: | - import { Client, ApiController } from '@bandwidth/webrtc'; - - const BW_USERNAME = "api-username"; - const BW_PASSWORD = "api-password"; - const BW_ACCOUNT_ID = "12345"; - - const client = new Client({ - basicAuthUserName: BW_USERNAME, - basicAuthPassword: BW_PASSWORD - }); - - const controller = new ApiController(client); - - const accountId = BW_ACCOUNT_ID; - - const createSession = async function() { - try { - const response = await controller.createSession(accountId, { - tag: '{"SessionName": "my_session"}' - }) - console.log(response.body); - } catch(error) { - console.error(error); - } - } - - createSession(); - - lang: PHP - source: | - $BW_USERNAME, - 'webRtcBasicAuthPassword' => $BW_PASSWORD, - ) - ); - $client = new BandwidthLib\BandwidthClient($config); - - $webRtcClient = $client->getWebRtc()->getClient(); - - $body = new BandwidthLib\WebRtc\Models\Session(); - $body->tag = "tag"; - - try { - $response = $webRtcClient->createSession($BW_ACCOUNT_ID, $body); - print_r($response->getResult()->id); - } catch (BandwidthLib\APIException $e) { - print_r($e->getResponseCode()); - } - - lang: Python - source: | - from bandwidth.bandwidth_client import BandwidthClient - from bandwidth.exceptions.api_exception import APIException - from bandwidth.webrtc.models.session import Session - - import os - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" - - bandwidth_client = BandwidthClient( - web_rtc_basic_auth_user_name=BW_USERNAME, - web_rtc_basic_auth_password=BW_PASSWORD - ) - web_rtc_client = bandwidth_client.web_rtc_client.client - - body = Session() - body.tag = "tag" - - try: - response = web_rtc_client.create_session(BW_ACCOUNT_ID, body) - print(response.body.id) - except APIException as e: - print(e.response_code) - - lang: Ruby - source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::WebRtc - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" - - bandwidth_client = Bandwidth::Client.new( - web_rtc_basic_auth_user_name: BW_USERNAME, - web_rtc_basic_auth_password: BW_PASSWORD - ) - - web_rtc_client = bandwidth_client.web_rtc_client.client - - body = Session.new - body.tag = "tag" - - begin - response = web_rtc_client.create_session(BW_ACCOUNT_ID, :body => body) - puts response.data.id - rescue APIException => e - puts e.response_code - end /accounts/{accountId}/sessions/{sessionId}: get: tags: @@ -834,182 +131,6 @@ paths: $ref: '#/components/responses/webrtcNotFoundError' '500': $ref: '#/components/responses/webrtcInternalServerError' - x-codeSamples: - - lang: cURL - source: > - curl - 'https://api.webrtc.bandwidth.com/v1/accounts/12345/sessions/75c21163-e110-41bc-bd76-1bb428ec85d5' - \ - -H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' - - lang: C# - source: | - using System; - using System.Threading.Tasks; - using Bandwidth.Standard; - using Bandwidth.Standard.Exceptions; - using Bandwidth.Standard.WebRtc.Models; - - class Program - { - static async Task Main(string[] args) - { - var username = "api-username"; - var password = "api-pasword"; - var accountId = "12345"; - - var sessionId = "75c21163-e110-41bc-bd76-1bb428ec85d5"; // Returned via WebRTC's create session request. - - var client = new BandwidthClient.Builder() - .WebRtcBasicAuthCredentials(username, password) - .Build(); - - try - { - var response = await client.WebRtc.APIController.GetSessionAsync(accountId, sessionId); - Console.WriteLine(response.Data); - } - catch (ApiException e) - { - Console.WriteLine(e.Message); - } - } - } - - lang: Java - source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.webrtc.models.Session; - - import java.util.concurrent.CompletableFuture; - import java.util.concurrent.ExecutionException; - - public class Sample { - public static final String USERNAME = "api-username"; - public static final String PASSWORD = "api-password"; - public static final String ACCOUNT_ID = "12345"; - - public static void main(String[] args) { - String sessionId = "75c21163-e110-41bc-bd76-1bb428ec85d5"; - - BandwidthClient client = new BandwidthClient.Builder() - .webRtcBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - try { - CompletableFuture> completableFuture = client.getWebRtcClient().getAPIController().getSessionAsync(ACCOUNT_ID, sessionId); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); - } - } - } - - lang: Node.js - source: | - import { Client, ApiController } from '@bandwidth/webrtc'; - - const BW_USERNAME = "api-username"; - const BW_PASSWORD = "api-password"; - const BW_ACCOUNT_ID = "12345"; - - const client = new Client({ - basicAuthUserName: BW_USERNAME, - basicAuthPassword: BW_PASSWORD - }); - - const controller = new ApiController(client); - - const accountId = BW_ACCOUNT_ID; - const sessionId = "75c21163-e110-41bc-bd76-1bb428ec85d5" - - const getSession = async function() { - try { - const response = await controller.getSession(accountId, sessionId) - console.log(response.body); - } catch(error) { - console.error(error); - } - } - - getSession(); - - lang: PHP - source: | - $BW_USERNAME, - 'webRtcBasicAuthPassword' => $BW_PASSWORD, - ) - ); - $client = new BandwidthLib\BandwidthClient($config); - - $webRtcClient = $client->getWebRtc()->getClient(); - - $sessionId = "1234-qwer"; - - try { - $response = $webRtcClient->getSession($BW_ACCOUNT_ID, $sessionId); - print_r($response->getResult()->id); - } catch (BandwidthLib\APIException $e) { - print_r($e->getResponseCode()); - } - - lang: Python - source: | - from bandwidth.bandwidth_client import BandwidthClient - from bandwidth.exceptions.api_exception import APIException - - import os - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" - - bandwidth_client = BandwidthClient( - web_rtc_basic_auth_user_name=BW_USERNAME, - web_rtc_basic_auth_password=BW_PASSWORD - ) - - web_rtc_client = bandwidth_client.web_rtc_client.client - - session_id = "1234-abcd" - - try: - response = web_rtc_client.get_session(BW_ACCOUNT_ID, session_id) - print(response.body.id) - except APIException as e: - print(e.response_code) - - lang: Ruby - source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::WebRtc - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" - - bandwidth_client = Bandwidth::Client.new( - web_rtc_basic_auth_user_name: BW_USERNAME, - web_rtc_basic_auth_password: BW_PASSWORD - ) - - web_rtc_client = bandwidth_client.web_rtc_client.client - - session_id = "1234-abcd" - - begin - response = web_rtc_client.get_session(BW_ACCOUNT_ID, session_id) - print(response.data.id) - rescue APIException => e - print(e.response_code) - end delete: tags: - Sessions @@ -1032,178 +153,6 @@ paths: $ref: '#/components/responses/webrtcNotFoundError' '500': $ref: '#/components/responses/webrtcInternalServerError' - x-codeSamples: - - lang: cURL - source: > - curl - 'https://api.webrtc.bandwidth.com/v1/accounts/12345/sessions/75c21163-e110-41bc-bd76-1bb428ec85d5' - \ - -X DELETE \ - -H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' - - lang: C# - source: | - using System; - using System.Threading.Tasks; - using Bandwidth.Standard; - using Bandwidth.Standard.Exceptions; - using Bandwidth.Standard.WebRtc.Models; - - class Program - { - static async Task Main(string[] args) - { - var username = "api-username"; - var password = "api-pasword"; - var accountId = "12345"; - - var sessionId = "75c21163-e110-41bc-bd76-1bb428ec85d5"; // Returned via WebRTC's create session request. - - var client = new BandwidthClient.Builder() - .WebRtcBasicAuthCredentials(username, password) - .Build(); - - try - { - await client.WebRtc.APIController.DeleteSessionAsync(accountId, sessionId); - } - catch (ApiException e) - { - Console.WriteLine(e.Message); - } - } - } - - lang: Java - source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - - import java.util.concurrent.CompletableFuture; - import java.util.concurrent.ExecutionException; - - public class Sample { - public static final String USERNAME = "api-username"; - public static final String PASSWORD = "api-password"; - public static final String ACCOUNT_ID = "12345"; - - public static void main(String[] args) { - BandwidthClient client = new BandwidthClient.Builder() - .webRtcBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - String sessionId = "75c21163-e110-41bc-bd76-1bb428ec85d5"; - - try { - CompletableFuture> completableFuture = client.getWebRtcClient().getAPIController().deleteSessionAsync(ACCOUNT_ID, sessionId); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); - } - } - } - - lang: Node.js - source: | - import { Client, ApiController } from '@bandwidth/webrtc'; - - const BW_USERNAME = "api-username"; - const BW_PASSWORD = "api-password"; - const BW_ACCOUNT_ID = "12345"; - - const client = new Client({ - basicAuthUserName: BW_USERNAME, - basicAuthPassword: BW_PASSWORD - }); - - const controller = new ApiController(client); - - const accountId = BW_ACCOUNT_ID; - const sessionId = "75c21163-e110-41bc-bd76-1bb428ec85d5" - - const deleteSession = async function() { - try { - const response = await controller.deleteSession(accountId, sessionId) - console.log(response.body); - } catch(error) { - console.error(error); - } - } - - deleteSession(); - - lang: PHP - source: |+ - $BW_USERNAME, - 'webRtcBasicAuthPassword' => $BW_PASSWORD, - ) - ); - $client = new BandwidthLib\BandwidthClient($config); - - $webRtcClient = $client->getWebRtc()->getClient(); - - $sessionId = "1234-qwer"; - - try { - $webRtcClient->deleteSession($BW_ACCOUNT_ID, $sessionId); - } catch (BandwidthLib\APIException $e) { - print_r($e->getResponseCode()); - } - - - lang: Python - source: | - from bandwidth.bandwidth_client import BandwidthClient - from bandwidth.exceptions.api_exception import APIException - - import os - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" - - bandwidth_client = BandwidthClient( - web_rtc_basic_auth_user_name=BW_USERNAME, - web_rtc_basic_auth_password=BW_PASSWORD - ) - web_rtc_client = bandwidth_client.web_rtc_client.client - - session_id = "1234-abcd" - - try: - web_rtc_client.delete_session(BW_ACCOUNT_ID, session_id) - except APIException as e: - print(e.response_code) - - lang: Ruby - source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::WebRtc - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" - - bandwidth_client = Bandwidth::Client.new( - web_rtc_basic_auth_user_name: BW_USERNAME, - web_rtc_basic_auth_password: BW_PASSWORD - ) - - web_rtc_client = bandwidth_client.web_rtc_client.client - - session_id = "1234-abcd" - - begin - web_rtc_client.delete_session(BW_ACCOUNT_ID, session_id) - rescue APIException => e - puts e.response_code - end /accounts/{accountId}/sessions/{sessionId}/participants: get: tags: @@ -1229,183 +178,6 @@ paths: $ref: '#/components/responses/webrtcNotFoundError' '500': $ref: '#/components/responses/webrtcInternalServerError' - x-codeSamples: - - lang: cURL - source: > - curl - 'https://api.webrtc.bandwidth.com/v1/accounts/12345/sessions/75c21163-e110-41bc-bd76-1bb428ec85d5/participants' - \ - -H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' - - lang: C# - source: | - using System; - using System.Threading.Tasks; - using Bandwidth.Standard; - using Bandwidth.Standard.Exceptions; - using Bandwidth.Standard.WebRtc.Models; - - class Program - { - static async Task Main(string[] args) - { - var username = "api-username"; - var password = "api-pasword"; - var accountId = "12345"; - - var sessionId = "75c21163-e110-41bc-bd76-1bb428ec85d5"; // Returned via WebRTC's create session request. - - var client = new BandwidthClient.Builder() - .WebRtcBasicAuthCredentials(username, password) - .Build(); - - try - { - var response = await client.WebRtc.APIController.ListSessionParticipantsAsync(accountId, sessionId); - Console.WriteLine(response.Data); - } - catch (ApiException e) - { - Console.WriteLine(e.Message); - } - } - } - - lang: Java - source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.webrtc.models.Participant; - - import java.util.concurrent.CompletableFuture; - import java.util.concurrent.ExecutionException; - import java.util.List; - - public class Sample { - public static final String USERNAME = "api-username"; - public static final String PASSWORD = "api-password"; - public static final String ACCOUNT_ID = "12345"; - - public static void main(String[] args) { - String sessionId = "75c21163-e110-41bc-bd76-1bb428ec85d5"; - - BandwidthClient client = new BandwidthClient.Builder() - .webRtcBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - try { - CompletableFuture>> completableFuture = client.getWebRtcClient().getAPIController().listSessionParticipantsAsync(ACCOUNT_ID, sessionId); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); - } - } - } - - lang: Node.js - source: | - import { Client, ApiController } from '@bandwidth/webrtc'; - - const BW_USERNAME = "api-username"; - const BW_PASSWORD = "api-password"; - const BW_ACCOUNT_ID = "12345"; - - const client = new Client({ - basicAuthUserName: BW_USERNAME, - basicAuthPassword: BW_PASSWORD - }); - - const controller = new ApiController(client); - - const accountId = BW_ACCOUNT_ID; - const sessionId = "75c21163-e110-41bc-bd76-1bb428ec85d5" - - const listSessionParticipants = async function() { - try { - const response = await controller.listSessionParticipants(accountId, sessionId) - console.log(response.body); - } catch(error) { - console.error(error); - } - } - - listSessionParticipants(); - - lang: PHP - source: | - $BW_USERNAME, - 'webRtcBasicAuthPassword' => $BW_PASSWORD, - ) - ); - $client = new BandwidthLib\BandwidthClient($config); - - $webRtcClient = $client->getWebRtc()->getClient(); - - $sessionId = "1234-qwer"; - - try { - $response = $webRtcClient->listSessionParticipants($BW_ACCOUNT_ID, $sessionId); - print_r($response->getResult()); - } catch (BandwidthLib\APIException $e) { - print_r($e->getResponseCode()); - } - - lang: Python - source: | - from bandwidth.bandwidth_client import BandwidthClient - from bandwidth.exceptions.api_exception import APIException - - import os - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" - - bandwidth_client = BandwidthClient( - web_rtc_basic_auth_user_name=BW_USERNAME, - web_rtc_basic_auth_password=BW_PASSWORD - ) - - web_rtc_client = bandwidth_client.web_rtc_client.client - - session_id = "1234-abcd" - - try: - response = web_rtc_client.list_session_participants(BW_ACCOUNT_ID, session_id) - print(response.body) - except APIException as e: - print(e.response_code) - - lang: Ruby - source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::WebRtc - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" - - bandwidth_client = Bandwidth::Client.new( - web_rtc_basic_auth_user_name: BW_USERNAME, - web_rtc_basic_auth_password: BW_PASSWORD - ) - - web_rtc_client = bandwidth_client.web_rtc_client.client - - session_id = "1234-abcd" - - begin - response = web_rtc_client.list_session_participants(BW_ACCOUNT_ID, session_id) - puts response.end - rescue APIException => e - puts e.response_code - end /accounts/{accountId}/sessions/{sessionId}/participants/{participantId}: put: tags: @@ -1437,219 +209,6 @@ paths: $ref: '#/components/responses/webrtcConflictError' '500': $ref: '#/components/responses/webrtcInternalServerError' - x-codeSamples: - - lang: cURL - source: > - curl - 'https://api.webrtc.bandwidth.com/v1/accounts/12345/sessions/75c21163-e110-41bc-bd76-1bb428ec85d5/participants/568749d5-04d5-483d-adf5-deac7dd3d521' - \ - -X PUT \ - -H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \ - -H 'Content-Type: application/json' \ - -d '{ - "sessionId": "d8886aad-b956-4e1b-b2f4-d7c9f8162772", - "participants": [ - { - "participantId": "568749d5-04d5-483d-adf5-deac7dd3d521" - }, - { - "participantId": "0275e47f-dd21-4cf0-a1e1-dfdc719e73a7" - } - ] - }' - - lang: C# - source: | - using System; - using System.Threading.Tasks; - using System.Collections.Generic; - using Bandwidth.Standard; - using Bandwidth.Standard.Exceptions; - using Bandwidth.Standard.WebRtc.Models; - - class Program - { - static async Task Main(string[] args) - { - var username = "api-username"; - var password = "api-pasword"; - var accountId = "12345"; - - var sessionId = "75c21163-e110-41bc-bd76-1bb428ec85d5"; // Returned via WebRTC's create session request. - var participantId = "568749d5-04d5-483d-adf5-deac7dd3d521"; // Returned via WebRTC's create participant request. - - var client = new BandwidthClient.Builder() - .WebRtcBasicAuthCredentials(username, password) - .Build(); - - var subscriptions = new Subscriptions() - { - SessionId = sessionId - }; - - try - { - await client.WebRtc.APIController.AddParticipantToSessionAsync(accountId, sessionId, participantId, subscriptions); - } - catch (ApiException e) - { - Console.WriteLine(e.Message); - } - } - } - - lang: Java - source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.webrtc.models.Subscriptions; - import com.bandwidth.webrtc.models.ParticipantSubscription; - - import java.util.ArrayList; - import java.util.List; - - import java.util.concurrent.CompletableFuture; - import java.util.concurrent.ExecutionException; - - public class Sample { - public static final String USERNAME = "api-username"; - public static final String PASSWORD = "api-password"; - public static final String ACCOUNT_ID = "12345"; - - public static void main(String[] args) { - String sessionId = "75c21163-e110-41bc-bd76-1bb428ec85d5"; // Returned via WebRTC's create session request. - String participantId = "568749d5-04d5-483d-adf5-deac7dd3d521"; // Returned via WebRTC's create participant request. - - BandwidthClient client = new BandwidthClient.Builder() - .webRtcBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - Subscriptions subscriptions = new Subscriptions(); - subscriptions.setSessionId(sessionId); - - try { - CompletableFuture> completableFuture = client.getWebRtcClient().getAPIController().addParticipantToSessionAsync(ACCOUNT_ID, sessionId, participantId, subscriptions); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); - } - } - } - - lang: Node.js - source: | - import { Client, ApiController } from '@bandwidth/webrtc'; - - const BW_USERNAME = "api-username"; - const BW_PASSWORD = "api-password"; - const BW_ACCOUNT_ID = "12345"; - - const client = new Client({ - basicAuthUserName: BW_USERNAME, - basicAuthPassword: BW_PASSWORD - }); - - const controller = new ApiController(client); - - const accountId = BW_ACCOUNT_ID; - const sessionId = "75c21163-e110-41bc-bd76-1bb428ec85d5" - const participantId = "320e2af6-13ec-498d-8b51-daba52c37853" - const subscriptions = { - sessionId: sessionId - }; - - const addParticipantToSession = async function() { - try { - const response = await controller.addParticipantToSession(accountId, sessionId, participantId, subscriptions) - console.log(response.body); - } catch(error) { - console.error(error); - } - } - - addParticipantToSession(); - - lang: PHP - source: | - $BW_USERNAME, - 'webRtcBasicAuthPassword' => $BW_PASSWORD, - ) - ); - $client = new BandwidthLib\BandwidthClient($config); - - $webRtcClient = $client->getWebRtc()->getClient(); - - $sessionId = "1234-abcd"; - $participantId = "4321-dcba"; - - $body = new BandwidthLib\WebRtc\Models\Subscriptions(); - $body->sessionId = $sessionId; - - try { - $webRtcClient->addParticipantToSession($BW_ACCOUNT_ID, $sessionId, $participantId, $body); - } catch (BandwidthLib\APIException $e) { - print_r($e->getResponseCode()); - } - - lang: Python - source: | - from bandwidth.bandwidth_client import BandwidthClient - from bandwidth.exceptions.api_exception import APIException - - import os - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" - - bandwidth_client = BandwidthClient( - web_rtc_basic_auth_user_name=BW_USERNAME, - web_rtc_basic_auth_password=BW_PASSWORD - ) - web_rtc_client = bandwidth_client.web_rtc_client.client - - session_id = "1234-abcd" - participant_id = "4321-dcba" - subscriptions = {'sessionId': session_id} - - try: - web_rtc_client.add_participant_to_session(BW_ACCOUNT_ID, session_id, participant_id, subscriptions) - except APIException as e: - print(e.response_code) - - lang: Ruby - source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::WebRtc - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" - - bandwidth_client = Bandwidth::Client.new( - web_rtc_basic_auth_user_name: BW_USERNAME, - web_rtc_basic_auth_password: BW_PASSWORD - ) - - web_rtc_client = bandwidth_client.web_rtc_client.client - - session_id = "1234-abcd" - participant_id = "4321-dcba" - - body = Subscriptions.new - body.session_id = session_id - - begin - web_rtc_client.add_participant_to_session(BW_ACCOUNT_ID, session_id, participant_id, body: body) - rescue APIException => e - puts e.response_code - end delete: tags: - Sessions @@ -1675,184 +234,6 @@ paths: $ref: '#/components/responses/webrtcNotFoundError' '500': $ref: '#/components/responses/webrtcInternalServerError' - x-codeSamples: - - lang: cURL - source: > - curl - 'https://api.webrtc.bandwidth.com/v1/accounts/12345/sessions/75c21163-e110-41bc-bd76-1bb428ec85d5/participants/568749d5-04d5-483d-adf5-deac7dd3d521' - \ - -X DELETE \ - -H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' - - lang: C# - source: |- - using System; - using System.Threading.Tasks; - using Bandwidth.Standard; - using Bandwidth.Standard.Exceptions; - using Bandwidth.Standard.WebRtc.Models; - - class Program - { - static async Task Main(string[] args) - { - var username = "api-username"; - var password = "api-pasword"; - var accountId = "12345"; - - var sessionId = "75c21163-e110-41bc-bd76-1bb428ec85d5"; // Returned via WebRTC's create session request. - var participantId = "568749d5-04d5-483d-adf5-deac7dd3d521"; // Returned via WebRTC's create participant request. - - var client = new BandwidthClient.Builder() - .WebRtcBasicAuthCredentials(username, password) - .Build(); - - try - { - await client.WebRtc.APIController.RemoveParticipantFromSessionAsync(accountId, sessionId, participantId); - } - catch (ApiException e) - { - Console.WriteLine(e.Message); - } - } - } - - lang: Java - source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - - import java.util.concurrent.CompletableFuture; - import java.util.concurrent.ExecutionException; - - public class Sample { - public static final String USERNAME = "api-username"; - public static final String PASSWORD = "api-password"; - public static final String ACCOUNT_ID = "12345"; - - public static void main(String[] args) { - String sessionId = "75c21163-e110-41bc-bd76-1bb428ec85d5"; - String participantId = "568749d5-04d5-483d-adf5-deac7dd3d521"; - - BandwidthClient client = new BandwidthClient.Builder() - .webRtcBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - try { - CompletableFuture> completableFuture = client.getWebRtcClient().getAPIController().removeParticipantFromSessionAsync(ACCOUNT_ID, sessionId, participantId); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); - } - } - } - - lang: Node.js - source: | - import { Client, ApiController } from '@bandwidth/webrtc'; - - const BW_USERNAME = "api-username"; - const BW_PASSWORD = "api-password"; - const BW_ACCOUNT_ID = "12345"; - - const client = new Client({ - basicAuthUserName: BW_USERNAME, - basicAuthPassword: BW_PASSWORD - }); - - const controller = new ApiController(client); - - const accountId = BW_ACCOUNT_ID; - const sessionId = "75c21163-e110-41bc-bd76-1bb428ec85d5" - const participantId = "320e2af6-13ec-498d-8b51-daba52c37853" - - const removeParticipantFromSession = async function() { - try { - const response = await controller.removeParticipantFromSession(accountId, sessionId, participantId) - console.log(response.body); - } catch(error) { - console.error(error); - } - } - - removeParticipantFromSession(); - - lang: PHP - source: | - $BW_USERNAME, - 'webRtcBasicAuthPassword' => $BW_PASSWORD, - ) - ); - $client = new BandwidthLib\BandwidthClient($config); - - $webRtcClient = $client->getWebRtc()->getClient(); - - $sessionId = "1234-abcd"; - $participantId = "4321-dcba"; - - try { - $webRtcClient->removeParticipantFromSession($BW_ACCOUNT_ID, $sessionId, $participantId); - } catch (BandwidthLib\APIException $e) { - print_r($e->getResponseCode()); - } - - lang: Python - source: | - from bandwidth.bandwidth_client import BandwidthClient - from bandwidth.exceptions.api_exception import APIException - - import os - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" - - bandwidth_client = BandwidthClient( - web_rtc_basic_auth_user_name=BW_USERNAME, - web_rtc_basic_auth_password=BW_PASSWORD - ) - - web_rtc_client = bandwidth_client.web_rtc_client.client - - session_id = "1234-abcd" - participant_id = "4312-dbca" - - try: - web_rtc_client.remove_participant_from_session(BW_ACCOUNT_ID, session_id, participant_id) - except APIException as e: - print(e.response_code) - - lang: Ruby - source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::WebRtc - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" - - bandwidth_client = Bandwidth::Client.new( - web_rtc_basic_auth_user_name: BW_USERNAME, - web_rtc_basic_auth_password: BW_PASSWORD - ) - - web_rtc_client = bandwidth_client.web_rtc_client.client - - session_id = "1234-abcd" - participant_id = "4312-dbca" - - begin - web_rtc_client.remove_participant_from_session(BW_ACCOUNT_ID, session_id, participant_id) - rescue APIException => e - puts e.response_code - end /accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions: get: tags: @@ -1879,188 +260,6 @@ paths: $ref: '#/components/responses/webrtcNotFoundError' '500': $ref: '#/components/responses/webrtcInternalServerError' - x-codeSamples: - - lang: cURL - source: > - curl - 'https://api.webrtc.bandwidth.com/v1/accounts/12345/sessions/75c21163-e110-41bc-bd76-1bb428ec85d5/participants/568749d5-04d5-483d-adf5-deac7dd3d521/subscriptions' - \ - -H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' - - lang: C# - source: | - using System; - using System.Threading.Tasks; - using Bandwidth.Standard; - using Bandwidth.Standard.Exceptions; - using Bandwidth.Standard.WebRtc.Models; - - class Program - { - static async Task Main(string[] args) - { - var username = "api-username"; - var password = "api-pasword"; - var accountId = "12345"; - - var sessionId = "75c21163-e110-41bc-bd76-1bb428ec85d5"; // Returned via WebRTC's create session request. - var participantId = "568749d5-04d5-483d-adf5-deac7dd3d521"; // Returned via WebRTC's create participant request. - - var client = new BandwidthClient.Builder() - .WebRtcBasicAuthCredentials(username, password) - .Build(); - - try - { - var response = await client.WebRtc.APIController.GetParticipantSubscriptionsAsync(accountId, sessionId, participantId); - Console.WriteLine(response.Data); - } - catch (ApiException e) - { - Console.WriteLine(e.Message); - } - } - } - - lang: Java - source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.webrtc.models.Subscriptions; - - import java.util.concurrent.CompletableFuture; - import java.util.concurrent.ExecutionException; - - public class Sample { - public static final String USERNAME = "api-username"; - public static final String PASSWORD = "api-password"; - public static final String ACCOUNT_ID = "12345"; - - public static void main(String[] args) { - String sessionId = "75c21163-e110-41bc-bd76-1bb428ec85d5"; - String participantId = "568749d5-04d5-483d-adf5-deac7dd3d521"; - - BandwidthClient client = new BandwidthClient.Builder() - .webRtcBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - try { - CompletableFuture> completableFuture = client.getWebRtcClient().getAPIController().getParticipantSubscriptionsAsync(ACCOUNT_ID, sessionId, participantId); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); - } - } - } - - lang: Node.js - source: | - import { Client, ApiController } from '@bandwidth/webrtc'; - - const BW_USERNAME = "api-username"; - const BW_PASSWORD = "api-password"; - const BW_ACCOUNT_ID = "12345"; - - const client = new Client({ - basicAuthUserName: BW_USERNAME, - basicAuthPassword: BW_PASSWORD - }); - - const controller = new ApiController(client); - - const accountId = BW_ACCOUNT_ID; - const sessionId = "75c21163-e110-41bc-bd76-1bb428ec85d5" - const participantId = "320e2af6-13ec-498d-8b51-daba52c37853" - - const getParticipantSubscriptions = async function() { - try { - const response = await controller.getParticipantSubscriptions(accountId, sessionId, participantId) - console.log(response.body); - } catch(error) { - console.error(error); - } - } - - getParticipantSubscriptions(); - - lang: PHP - source: | - $BW_USERNAME, - 'webRtcBasicAuthPassword' => $BW_PASSWORD, - ) - ); - $client = new BandwidthLib\BandwidthClient($config); - - $webRtcClient = $client->getWebRtc()->getClient(); - - $participantId = "1234-abcd"; - $sessionId = "4321-dcba"; - - try { - $response = $webRtcClient->getParticipantSubscriptions($BW_ACCOUNT_ID, $sessionId, $participantId); - print_r($response->getResult()); - } catch (BandwidthLib\APIException $e) { - print_r($e->getResponseCode()); - } - - lang: Python - source: | - from bandwidth.bandwidth_client import BandwidthClient - from bandwidth.exceptions.api_exception import APIException - - import os - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" - - bandwidth_client = BandwidthClient( - web_rtc_basic_auth_user_name=BW_USERNAME, - web_rtc_basic_auth_password=BW_PASSWORD - ) - - web_rtc_client = bandwidth_client.web_rtc_client.client - - participant_id = "1234-abcd" - session_id = "4321-dcba" - - try: - response = web_rtc_client.get_participant_subscriptions(BW_ACCOUNT_ID, session_id, participant_id) - print(response.body) - except APIException as e: - print(e.response_code) - - lang: Ruby - source: | - require 'bandwidth' - - include Bandwidth - include Bandwidth::WebRtc - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" - - bandwidth_client = Bandwidth::Client.new( - web_rtc_basic_auth_user_name: BW_USERNAME, - web_rtc_basic_auth_password: BW_PASSWORD - ) - - web_rtc_client = bandwidth_client.web_rtc_client.client - - participant_id = "1234-abcd" - session_id = "4321-dcba" - - begin - response = web_rtc_client.get_participant_subscriptions(BW_ACCOUNT_ID, session_id, participant_id) - puts response.data - rescue APIException => e - puts e.response_code - end put: tags: - Sessions @@ -2096,224 +295,6 @@ paths: $ref: '#/components/responses/webrtcNotFoundError' '500': $ref: '#/components/responses/webrtcInternalServerError' - x-codeSamples: - - lang: cURL - source: > - curl - 'https://api.webrtc.bandwidth.com/v1/accounts/12345/sessions/75c21163-e110-41bc-bd76-1bb428ec85d5/participants/568749d5-04d5-483d-adf5-deac7dd3d521/subscriptions' - \ - -X PUT \ - -H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \ - -H 'Content-Type: application/json' \ - -d '{ - "sessionId": "d8886aad-b956-4e1b-b2f4-d7c9f8162772", - "participants": [ - { - "participantId": "568749d5-04d5-483d-adf5-deac7dd3d521" - }, - { - "participantId": "0275e47f-dd21-4cf0-a1e1-dfdc719e73a7" - } - ] - }' - - lang: C# - source: | - using System; - using System.Threading.Tasks; - using Bandwidth.Standard; - using Bandwidth.Standard.Exceptions; - using Bandwidth.Standard.WebRtc.Models; - - class Program - { - static async Task Main(string[] args) - { - var username = "api-username"; - var password = "api-pasword"; - var accountId = "12345"; - - var sessionId = "75c21163-e110-41bc-bd76-1bb428ec85d5"; // Returned via WebRTC's create session request. - var participantId = "568749d5-04d5-483d-adf5-deac7dd3d521"; // Returned via WebRTC's create participant request. - - var client = new BandwidthClient.Builder() - .WebRtcBasicAuthCredentials(username, password) - .Build(); - - var subscriptions = new Subscriptions() - { - SessionId = sessionId - }; - - try - { - await client.WebRtc.APIController.UpdateParticipantSubscriptionsAsync(accountId, sessionId, participantId, subscriptions); - } - catch (ApiException e) - { - Console.WriteLine(e.Message); - } - } - } - - lang: Java - source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.webrtc.models.Subscriptions; - - import java.util.concurrent.CompletableFuture; - import java.util.concurrent.ExecutionException; - - public class Sample { - public static final String USERNAME = "api-username"; - public static final String PASSWORD = "api-password"; - public static final String ACCOUNT_ID = "12345"; - - public static void main(String[] args) { - String sessionId = "75c21163-e110-41bc-bd76-1bb428ec85d5"; - String participantId = "568749d5-04d5-483d-adf5-deac7dd3d521"; - - BandwidthClient client = new BandwidthClient.Builder() - .webRtcBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - Subscriptions subscriptions = new Subscriptions(); - subscriptions.setSessionId(sessionId); - - try { - CompletableFuture> completableFuture = client.getWebRtcClient().getAPIController().updateParticipantSubscriptionsAsync(ACCOUNT_ID, sessionId, participantId, subscriptions); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); - } - } - } - - lang: Node.js - source: | - import { Client, ApiController } from '@bandwidth/webrtc'; - - const BW_USERNAME = "api-username"; - const BW_PASSWORD = "api-password"; - const BW_ACCOUNT_ID = "12345"; - - const client = new Client({ - basicAuthUserName: BW_USERNAME, - basicAuthPassword: BW_PASSWORD - }); - - const controller = new ApiController(client); - - const accountId = BW_ACCOUNT_ID; - const sessionId = "75c21163-e110-41bc-bd76-1bb428ec85d5" - const participantId = "320e2af6-13ec-498d-8b51-daba52c37853" - const body = { "sessionId": "75c21163-e110-41bc-bd76-1bb428ec85d5", - "participants": [{ - "participantId": "568749d5-04d5-483d-adf5-deac7dd3d521" - }, { - "participantId": "0275e47f-dd21-4cf0-a1e1-dfdc719e73a7" - }] - } - - const updateParticipantSubscriptions = async function() { - try { - const response = await controller.updateParticipantSubscriptions(accountId, sessionId, participantId, body) - console.log(response.body); - } catch(error) { - console.error(error); - } - } - - updateParticipantSubscriptions(); - - lang: PHP - source: | - $BW_USERNAME, - 'webRtcBasicAuthPassword' => $BW_PASSWORD, - ) - ); - $client = new BandwidthLib\BandwidthClient($config); - - $webRtcClient = $client->getWebRtc()->getClient(); - - $body = new BandwidthLib\WebRtc\Models\Subscriptions(); - $body->sessionId = "1234-abcd"; - - $sessionId = "1234-abcd"; - $participantId = "4321-dcba"; - - try { - $webRtcClient->updateParticipantSubscriptions($BW_ACCOUNT_ID, $sessionId, $participantId, $body); - } catch (BandwidthLib\APIException $e) { - print_r($e->getResponseCode()); - } - - lang: Python - source: | - from bandwidth.bandwidth_client import BandwidthClient - from bandwidth.exceptions.api_exception import APIException - from bandwidth.webrtc.models.subscriptions import Subscriptions - - import os - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" - - bandwidth_client = BandwidthClient( - web_rtc_basic_auth_user_name=BW_USERNAME, - web_rtc_basic_auth_password=BW_PASSWORD - ) - - web_rtc_client = bandwidth_client.web_rtc_client.client - - body = Subscriptions() - body.session_id = "1234-abcd" - - session_id = "1234-abcd" - participant_id = "4321-dcba" - - try: - web_rtc_client.update_participant_subscriptions(BW_ACCOUNT_ID, session_id, participant_id, body) - except APIException as e: - print(e.response_code) - - lang: Ruby - source: |+ - require 'bandwidth' - - include Bandwidth - include Bandwidth::WebRtc - - BW_USERNAME = "api-username" - BW_PASSWORD = "api-password" - BW_ACCOUNT_ID = "12345" - - bandwidth_client = Bandwidth::Client.new( - web_rtc_basic_auth_user_name: BW_USERNAME, - web_rtc_basic_auth_password: BW_PASSWORD - ) - - web_rtc_client = bandwidth_client.web_rtc_client.client - - body = Subscriptions.new - body.session_id = "1234-abcd" - - session_id = "1234-abcd" - participant_id = "4321-dcba" - - begin - web_rtc_client.update_participant_subscriptions(BW_ACCOUNT_ID, session_id, participant_id, :body => body) - #NOTE: This is currently improperly defined - rescue APIException => e - puts e.response_code - end - components: schemas: publishPermissionsEnum: From 0ea9893a5adb94a3cd1dd045a9e87aabff740576 Mon Sep 17 00:00:00 2001 From: DX-Bandwidth Date: Wed, 30 Aug 2023 20:16:39 +0000 Subject: [PATCH 12/20] Add Code Snippets to Spec Files --- site/specs/voice.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/specs/voice.yml b/site/specs/voice.yml index b7eacca58..9f29f8428 100644 --- a/site/specs/voice.yml +++ b/site/specs/voice.yml @@ -2209,7 +2209,7 @@ paths: begin result = api_instance.list_conference_recordings(account_id, conference_id) - p result[0].name if response.length.positive? + p result[0].name if result.length.positive? rescue Bandwidth::ApiError => e puts "Error when calling ConferencesApi->list_conference_recordings: #{e}" end @@ -3293,7 +3293,7 @@ paths: begin result = api_instance.list_call_recordings(account_id, call_id) - p result[0].media_url if response.length.positive? + p result[0].media_url if result.length.positive? rescue Bandwidth::ApiError => e puts "Error when calling RecordingsApi->list_call_recordings: #{e}" end From a204ebcc90fcafd005e524e146a3fd43317b2e2f Mon Sep 17 00:00:00 2001 From: ckoegel Date: Wed, 30 Aug 2023 16:17:01 -0400 Subject: [PATCH 13/20] update sidebar --- site/sidebarsMigrationGuides.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/sidebarsMigrationGuides.js b/site/sidebarsMigrationGuides.js index ab3171f18..5fec2d3b9 100644 --- a/site/sidebarsMigrationGuides.js +++ b/site/sidebarsMigrationGuides.js @@ -26,7 +26,7 @@ module.exports = { label: "Ruby", items: [ "ruby/ruby-migration-guides", - "ruby/v11-beta" + "ruby/v11" ] } ], From 2003e30d7f33e0ae0e0c47128c174f3a0b033306 Mon Sep 17 00:00:00 2001 From: DX-Bandwidth Date: Wed, 30 Aug 2023 20:19:46 +0000 Subject: [PATCH 14/20] Add Code Snippets to Spec Files --- site/specs/voice.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/specs/voice.yml b/site/specs/voice.yml index 9f29f8428..bd066b3de 100644 --- a/site/specs/voice.yml +++ b/site/specs/voice.yml @@ -1028,7 +1028,7 @@ paths: begin result = api_instance.list_conferences(account_id, opts) - p result[0].id if response.length.positive? + p result[0].id if result.length.positive? rescue Bandwidth::ApiError => e puts "Error when calling ConferencesApi->list_conferences: #{e}" end From 0a1d92db2a80107b758585bf43c434f439ad2f39 Mon Sep 17 00:00:00 2001 From: DX-Bandwidth Date: Wed, 30 Aug 2023 20:46:34 +0000 Subject: [PATCH 15/20] Add Code Snippets to Spec Files --- site/specs/messaging.yml | 6 +-- site/specs/phone-number-lookup.yml | 2 +- site/specs/voice.yml | 60 +++++++++++++++--------------- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/site/specs/messaging.yml b/site/specs/messaging.yml index 9a7a5ce90..2d1c6993e 100644 --- a/site/specs/messaging.yml +++ b/site/specs/messaging.yml @@ -394,7 +394,7 @@ paths: api_instance = Bandwidth::MediaApi.new account_id = "12345" - media_id = ENV['MEDIA_ID'] + media_id = 14762070468292kw2fuqty55yp2b2/0/bw.png begin result = api_instance.get_media(account_id, media_id) @@ -653,7 +653,7 @@ paths: api_instance = Bandwidth::MediaApi.new account_id = "12345" - media_id = ENV['MEDIA_ID'] + media_id = 14762070468292kw2fuqty55yp2b2/0/bw.png body = '12345' opts = { content_type: 'application/octet-stream', @@ -858,7 +858,7 @@ paths: api_instance = Bandwidth::MediaApi.new account_id = "12345" - media_id = ENV['MEDIA_ID'] + media_id = 14762070468292kw2fuqty55yp2b2/0/bw.png begin api_instance.delete_media(account_id, media_id) diff --git a/site/specs/phone-number-lookup.yml b/site/specs/phone-number-lookup.yml index 96baee210..1e7be978a 100644 --- a/site/specs/phone-number-lookup.yml +++ b/site/specs/phone-number-lookup.yml @@ -413,7 +413,7 @@ paths: api_instance = Bandwidth::PhoneNumberLookupApi.new account_id = "12345" - request_id = ENV['LOOKUP_REQUEST_ID'] + request_id = 004223a0-8b17-41b1-bf81-20732adf5590 begin result = api_instance.get_lookup_status(account_id, request_id) diff --git a/site/specs/voice.yml b/site/specs/voice.yml index bd066b3de..96a292684 100644 --- a/site/specs/voice.yml +++ b/site/specs/voice.yml @@ -324,7 +324,7 @@ paths: to: "+15553334444", from: "+15554443333", application_id: "1234-qwer", - answer_url: ENV['BASE_CALLBACK_URL'] + answer_url: https://sample.com } ) @@ -534,7 +534,7 @@ paths: api_instance = Bandwidth::CallsApi.new account_id = "12345" - call_id = ENV['CALL_ID'] + call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 begin result = api_instance.get_call_state(account_id, call_id) @@ -785,7 +785,7 @@ paths: api_instance = Bandwidth::CallsApi.new account_id = "12345" - call_id = ENV['CALL_ID'] + call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 update_call = Bandwidth::UpdateCall.new begin @@ -1233,7 +1233,7 @@ paths: api_instance = Bandwidth::ConferencesApi.new account_id = "12345" - conference_id = ENV['CONFERENCE_ID'] + conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 begin result = api_instance.get_conference(account_id, conference_id) @@ -1485,7 +1485,7 @@ paths: api_instance = Bandwidth::ConferencesApi.new account_id = "12345" - conference_id = ENV['CONFERENCE_ID'] + conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 update_conference = Bandwidth::UpdateConference.new begin @@ -1731,8 +1731,8 @@ paths: api_instance = Bandwidth::ConferencesApi.new account_id = "12345" - conference_id = ENV['CONFERENCE_ID'] - member_id = ENV['MEMBER_ID'] + conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + member_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 begin result = api_instance.get_conference_member(account_id, conference_id, member_id) @@ -1990,8 +1990,8 @@ paths: api_instance = Bandwidth::ConferencesApi.new account_id = "12345" - conference_id = ENV['CONFERENCE_ID'] - member_id = ENV['MEMBER_ID'] + conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + member_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 update_conference_member = Bandwidth::UpdateConferenceMember.new begin @@ -2205,7 +2205,7 @@ paths: api_instance = Bandwidth::ConferencesApi.new account_id = "12345" - conference_id = ENV['CONFERENCE_ID'] + conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 begin result = api_instance.list_conference_recordings(account_id, conference_id) @@ -2420,8 +2420,8 @@ paths: api_instance = Bandwidth::ConferencesApi.new account_id = "12345" - conference_id = ENV['CONFERENCE_ID'] - recording_id = ENV['RECORDING_ID'] + conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 begin result = api_instance.get_conference_recording(account_id, conference_id, recording_id) @@ -2634,8 +2634,8 @@ paths: api_instance = Bandwidth::ConferencesApi.new account_id = "12345" - conference_id = ENV['CONFERENCE_ID'] - recording_id = ENV['RECORDING_ID'] + conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 begin result = api_instance.download_conference_recording(account_id, conference_id, recording_id) @@ -3079,7 +3079,7 @@ paths: account_id = "12345" - call_id = ENV['CALL_ID'] + call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 update_call_recording = Bandwidth::UpdateCallRecording.new({ state: Bandwidth::RecordingStateEnum::PAUSED }) @@ -3289,7 +3289,7 @@ paths: api_instance = Bandwidth::RecordingsApi.new account_id = "12345" - call_id = ENV['CALL_ID'] + call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 begin result = api_instance.list_call_recordings(account_id, call_id) @@ -3497,8 +3497,8 @@ paths: api_instance = Bandwidth::RecordingsApi.new account_id = "12345" - call_id = ENV['CALL_ID'] - recording_id = ENV['RECORDING_ID'] + call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 begin result = api_instance.get_call_recording(account_id, call_id, recording_id) @@ -3711,8 +3711,8 @@ paths: api_instance = Bandwidth::RecordingsApi.new account_id = "12345" - call_id = ENV['CALL_ID'] - recording_id = ENV['RECORDING_ID'] + call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 begin api_instance.delete_recording(account_id, call_id, recording_id) @@ -3915,8 +3915,8 @@ paths: api_instance = Bandwidth::RecordingsApi.new account_id = "12345" - call_id = ENV['CALL_ID'] - recording_id = ENV['RECORDING_ID'] + call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 begin result = api_instance.download_call_recording(account_id, call_id, recording_id) @@ -4121,8 +4121,8 @@ paths: api_instance = Bandwidth::RecordingsApi.new account_id = "12345" - call_id = ENV['CALL_ID'] - recording_id = ENV['RECORDING_ID'] + call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 begin api_instance.delete_recording_media(account_id, call_id, recording_id) @@ -4343,8 +4343,8 @@ paths: api_instance = Bandwidth::RecordingsApi.new account_id = "12345" - call_id = ENV['CALL_ID'] - recording_id = ENV['RECORDING_ID'] + call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 begin result = api_instance.get_call_transcription(account_id, call_id, recording_id) @@ -4598,8 +4598,8 @@ paths: api_instance = Bandwidth::RecordingsApi.new account_id = "12345" - call_id = ENV['CALL_ID'] - recording_id = ENV['RECORDING_ID'] + call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 transcribe_recording = Bandwidth::TranscribeRecording.new begin @@ -4810,8 +4810,8 @@ paths: api_instance = Bandwidth::RecordingsApi.new account_id = "12345" - call_id = ENV['CALL_ID'] - recording_id = ENV['RECORDING_ID'] + call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 begin api_instance.delete_call_transcription(account_id, call_id, recording_id) From 4fb71a4bc354dfa8afbc7c5bc92053b5acff3780 Mon Sep 17 00:00:00 2001 From: DX-Bandwidth Date: Wed, 30 Aug 2023 21:12:40 +0000 Subject: [PATCH 16/20] Add Code Snippets to Spec Files --- site/specs/messaging.yml | 48 ++++---- site/specs/multi-factor-auth.yml | 32 ++--- site/specs/phone-number-lookup.yml | 16 +-- site/specs/voice.yml | 192 ++++++++++++++--------------- 4 files changed, 144 insertions(+), 144 deletions(-) diff --git a/site/specs/messaging.yml b/site/specs/messaging.yml index 2d1c6993e..5b4886c12 100644 --- a/site/specs/messaging.yml +++ b/site/specs/messaging.yml @@ -189,12 +189,12 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::MediaApi.new - account_id = "12345" + account_id = '12345' begin result = api_instance.list_media(account_id) @@ -388,13 +388,13 @@ paths: source: | require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::MediaApi.new - account_id = "12345" - media_id = 14762070468292kw2fuqty55yp2b2/0/bw.png + account_id = '12345' + media_id = '14762070468292kw2fuqty55yp2b2/0/bw.png' begin result = api_instance.get_media(account_id, media_id) @@ -647,13 +647,13 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::MediaApi.new - account_id = "12345" - media_id = 14762070468292kw2fuqty55yp2b2/0/bw.png + account_id = '12345' + media_id = '14762070468292kw2fuqty55yp2b2/0/bw.png' body = '12345' opts = { content_type: 'application/octet-stream', @@ -852,13 +852,13 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::MediaApi.new - account_id = "12345" - media_id = 14762070468292kw2fuqty55yp2b2/0/bw.png + account_id = '12345' + media_id = '14762070468292kw2fuqty55yp2b2/0/bw.png' begin api_instance.delete_media(account_id, media_id) @@ -1055,12 +1055,12 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::MessagesApi.new - account_id = "12345" + account_id = '12345' begin result = api_instance.list_messages(account_id) @@ -1331,17 +1331,17 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::MessagesApi.new - account_id = "12345" + account_id = '12345' message_request = Bandwidth::MessageRequest.new( { - application_id: "1234-asdf", - to: ["+15553334444"], - from: "+15554443333", + application_id: '1234-asdf', + to: ['+15553334444'], + from: '+15554443333', text: 'Hello world!' } ) diff --git a/site/specs/multi-factor-auth.yml b/site/specs/multi-factor-auth.yml index 4520b66f1..d5e5a4410 100644 --- a/site/specs/multi-factor-auth.yml +++ b/site/specs/multi-factor-auth.yml @@ -294,17 +294,17 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::MFAApi.new - account_id = "12345" + account_id = '12345' code_request = Bandwidth::CodeRequest.new( { - to: "+15553334444", - from: "+15554443333", - application_id: "1234-qwer", + to: '+15553334444', + from: '+15554443333', + application_id: '1234-qwer', message: 'Your temporary {NAME} {SCOPE} code is {CODE}', digits: 6 } @@ -595,17 +595,17 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::MFAApi.new - account_id = "12345" + account_id = '12345' code_request = Bandwidth::CodeRequest.new( { - to: "+15553334444", - from: "+15554443333", - application_id: "1234-asdf", + to: '+15553334444', + from: '+15554443333', + application_id: '1234-asdf', message: 'Your temporary {NAME} {SCOPE} code is {CODE}', digits: 6 } @@ -911,15 +911,15 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::MFAApi.new - account_id = "12345" + account_id = '12345' verify_code_request = Bandwidth::VerifyCodeRequest.new( { - to: "+15553334444", + to: '+15553334444', expiration_time_in_minutes: 3, code: '123456' } diff --git a/site/specs/phone-number-lookup.yml b/site/specs/phone-number-lookup.yml index 1e7be978a..50db91714 100644 --- a/site/specs/phone-number-lookup.yml +++ b/site/specs/phone-number-lookup.yml @@ -217,17 +217,17 @@ paths: Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::PhoneNumberLookupApi.new - account_id = "12345" + account_id = '12345' lookup_request = Bandwidth::LookupRequest.new({ tns: - ["+15554443333"] }) + ['+15554443333'] }) begin @@ -407,13 +407,13 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::PhoneNumberLookupApi.new - account_id = "12345" - request_id = 004223a0-8b17-41b1-bf81-20732adf5590 + account_id = '12345' + request_id = '004223a0-8b17-41b1-bf81-20732adf5590' begin result = api_instance.get_lookup_status(account_id, request_id) diff --git a/site/specs/voice.yml b/site/specs/voice.yml index 96a292684..ab0a4e528 100644 --- a/site/specs/voice.yml +++ b/site/specs/voice.yml @@ -313,18 +313,18 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::CallsApi.new - account_id = "12345" + account_id = '12345' create_call = Bandwidth::CreateCall.new( { - to: "+15553334444", - from: "+15554443333", - application_id: "1234-qwer", - answer_url: https://sample.com + to: '+15553334444', + from: '+15554443333', + application_id: '1234-qwer', + answer_url: 'https://sample.com' } ) @@ -528,13 +528,13 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::CallsApi.new - account_id = "12345" - call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + account_id = '12345' + call_id = 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' begin result = api_instance.get_call_state(account_id, call_id) @@ -779,13 +779,13 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::CallsApi.new - account_id = "12345" - call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + account_id = '12345' + call_id = 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' update_call = Bandwidth::UpdateCall.new begin @@ -1015,12 +1015,12 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::ConferencesApi.new - account_id = "12345" + account_id = '12345' opts = { min_created_time: '2022-06-21T19:13:21Z', page_size: 500 @@ -1227,13 +1227,13 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::ConferencesApi.new - account_id = "12345" - conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + account_id = '12345' + conference_id = 'conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9' begin result = api_instance.get_conference(account_id, conference_id) @@ -1479,13 +1479,13 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::ConferencesApi.new - account_id = "12345" - conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + account_id = '12345' + conference_id = 'conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9' update_conference = Bandwidth::UpdateConference.new begin @@ -1725,14 +1725,14 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::ConferencesApi.new - account_id = "12345" - conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 - member_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + account_id = '12345' + conference_id = 'conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9' + member_id = 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' begin result = api_instance.get_conference_member(account_id, conference_id, member_id) @@ -1984,14 +1984,14 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::ConferencesApi.new - account_id = "12345" - conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 - member_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + account_id = '12345' + conference_id = 'conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9' + member_id = 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' update_conference_member = Bandwidth::UpdateConferenceMember.new begin @@ -2199,13 +2199,13 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::ConferencesApi.new - account_id = "12345" - conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + account_id = '12345' + conference_id = 'conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9' begin result = api_instance.list_conference_recordings(account_id, conference_id) @@ -2414,14 +2414,14 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::ConferencesApi.new - account_id = "12345" - conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 - recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + account_id = '12345' + conference_id = 'conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9' + recording_id = 'r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' begin result = api_instance.get_conference_recording(account_id, conference_id, recording_id) @@ -2628,14 +2628,14 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::ConferencesApi.new - account_id = "12345" - conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 - recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + account_id = '12345' + conference_id = 'conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9' + recording_id = 'r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' begin result = api_instance.download_conference_recording(account_id, conference_id, recording_id) @@ -2832,12 +2832,12 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::RecordingsApi.new - account_id = "12345" + account_id = '12345' opts = { to: '%2b19195551234', from: '%2b19195554321' @@ -3070,16 +3070,16 @@ paths: Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::RecordingsApi.new - account_id = "12345" + account_id = '12345' - call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + call_id = 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' update_call_recording = Bandwidth::UpdateCallRecording.new({ state: Bandwidth::RecordingStateEnum::PAUSED }) @@ -3283,13 +3283,13 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::RecordingsApi.new - account_id = "12345" - call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + account_id = '12345' + call_id = 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' begin result = api_instance.list_call_recordings(account_id, call_id) @@ -3491,14 +3491,14 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::RecordingsApi.new - account_id = "12345" - call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 - recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + account_id = '12345' + call_id = 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' + recording_id = 'r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' begin result = api_instance.get_call_recording(account_id, call_id, recording_id) @@ -3705,14 +3705,14 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::RecordingsApi.new - account_id = "12345" - call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 - recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + account_id = '12345' + call_id = 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' + recording_id = 'r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' begin api_instance.delete_recording(account_id, call_id, recording_id) @@ -3909,14 +3909,14 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::RecordingsApi.new - account_id = "12345" - call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 - recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + account_id = '12345' + call_id = 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' + recording_id = 'r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' begin result = api_instance.download_call_recording(account_id, call_id, recording_id) @@ -4115,14 +4115,14 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::RecordingsApi.new - account_id = "12345" - call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 - recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + account_id = '12345' + call_id = 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' + recording_id = 'r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' begin api_instance.delete_recording_media(account_id, call_id, recording_id) @@ -4337,14 +4337,14 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::RecordingsApi.new - account_id = "12345" - call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 - recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + account_id = '12345' + call_id = 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' + recording_id = 'r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' begin result = api_instance.get_call_transcription(account_id, call_id, recording_id) @@ -4592,14 +4592,14 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::RecordingsApi.new - account_id = "12345" - call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 - recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + account_id = '12345' + call_id = 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' + recording_id = 'r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' transcribe_recording = Bandwidth::TranscribeRecording.new begin @@ -4804,14 +4804,14 @@ paths: require 'bandwidth-sdk' Bandwidth.configure do |config| - config.username = "api-username" - config.password = "api-password" + config.username = 'api-username' + config.password = 'api-password' end api_instance = Bandwidth::RecordingsApi.new - account_id = "12345" - call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 - recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + account_id = '12345' + call_id = 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' + recording_id = 'r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' begin api_instance.delete_call_transcription(account_id, call_id, recording_id) From 16d466a69105df8512091d4b18856eb8f7cb5a0d Mon Sep 17 00:00:00 2001 From: DX-Bandwidth Date: Wed, 30 Aug 2023 21:14:24 +0000 Subject: [PATCH 17/20] Add Code Snippets to Spec Files --- site/specs/messaging.yml | 12 ++++----- site/specs/multi-factor-auth.yml | 6 ++--- site/specs/phone-number-lookup.yml | 4 +-- site/specs/voice.yml | 42 +++++++++++++++--------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/site/specs/messaging.yml b/site/specs/messaging.yml index 5b4886c12..6f00b55dd 100644 --- a/site/specs/messaging.yml +++ b/site/specs/messaging.yml @@ -199,10 +199,10 @@ paths: begin result = api_instance.list_media(account_id) result.each do |item| - puts item.media_name + p item.media_name end rescue Bandwidth::ApiError => e - puts "Error when calling MediaApi->list_media: #{e}" + p "Error when calling MediaApi->list_media: #{e}" end /users/{accountId}/media/{mediaId}: get: @@ -399,10 +399,10 @@ paths: begin result = api_instance.get_media(account_id, media_id) f = File.open('file_to_write', 'wb') - f.puts(result) + f.p(result) f.close rescue Bandwidth::ApiError => e - puts "Error when calling MediaApi->get_media: #{e}" + p "Error when calling MediaApi->get_media: #{e}" end put: summary: Upload Media @@ -663,7 +663,7 @@ paths: begin api_instance.upload_media(account_id, media_id, body, opts) rescue Bandwidth::ApiError => e - puts "Error when calling MediaApi->upload_media: #{e}" + p "Error when calling MediaApi->upload_media: #{e}" end delete: summary: Delete Media @@ -863,7 +863,7 @@ paths: begin api_instance.delete_media(account_id, media_id) rescue Bandwidth::ApiError => e - puts "Error when calling MediaApi->delete_media: #{e}" + p "Error when calling MediaApi->delete_media: #{e}" end /users/{accountId}/messages: get: diff --git a/site/specs/multi-factor-auth.yml b/site/specs/multi-factor-auth.yml index d5e5a4410..41bde6562 100644 --- a/site/specs/multi-factor-auth.yml +++ b/site/specs/multi-factor-auth.yml @@ -314,7 +314,7 @@ paths: result = api_instance.generate_voice_code(account_id, code_request) p "callId: #{result.call_id}" rescue Bandwidth::ApiError => e - puts "Error when calling MFAApi->generate_voice_code: #{e}" + p "Error when calling MFAApi->generate_voice_code: #{e}" end /accounts/{accountId}/code/messaging: post: @@ -615,7 +615,7 @@ paths: result = api_instance.generate_messaging_code(account_id, code_request) p "messageId: #{result.message_id}" rescue Bandwidth::ApiError => e - puts "Error when calling MFAApi->generate_messaging_code: #{e}" + p "Error when calling MFAApi->generate_messaging_code: #{e}" end /accounts/{accountId}/code/verify: post: @@ -929,7 +929,7 @@ paths: result = api_instance.verify_code(account_id, verify_code_request) p "valid?: #{result.valid}" rescue Bandwidth::ApiError => e - puts "Error when calling MFAApi->verify_code: #{e}" + p "Error when calling MFAApi->verify_code: #{e}" end components: schemas: diff --git a/site/specs/phone-number-lookup.yml b/site/specs/phone-number-lookup.yml index 50db91714..e55f420de 100644 --- a/site/specs/phone-number-lookup.yml +++ b/site/specs/phone-number-lookup.yml @@ -234,7 +234,7 @@ paths: result = api_instance.create_lookup(account_id, lookup_request) p result.request_id rescue Bandwidth::ApiError => e - puts "Error when calling PhoneNumberLookupApi->create_lookup: #{e}" + p "Error when calling PhoneNumberLookupApi->create_lookup: #{e}" end /accounts/{accountId}/tnlookup/{requestId}: get: @@ -419,7 +419,7 @@ paths: result = api_instance.get_lookup_status(account_id, request_id) p result.status rescue Bandwidth::ApiError => e - puts "Error when calling PhoneNumberLookupApi->get_lookup_status: #{e}" + p "Error when calling PhoneNumberLookupApi->get_lookup_status: #{e}" end components: schemas: diff --git a/site/specs/voice.yml b/site/specs/voice.yml index ab0a4e528..6455bfeee 100644 --- a/site/specs/voice.yml +++ b/site/specs/voice.yml @@ -332,7 +332,7 @@ paths: result = api_instance.create_call(account_id, create_call) p result.call_id rescue Bandwidth::ApiError => e - puts "Error when calling CallsApi->create_call: #{e}" + p "Error when calling CallsApi->create_call: #{e}" end /accounts/{accountId}/calls/{callId}: get: @@ -540,7 +540,7 @@ paths: result = api_instance.get_call_state(account_id, call_id) p result.state rescue Bandwidth::ApiError => e - puts "Error when calling CallsApi->get_call_state: #{e}" + p "Error when calling CallsApi->get_call_state: #{e}" end post: tags: @@ -791,7 +791,7 @@ paths: begin api_instance.update_call(account_id, call_id, update_call) rescue Bandwidth::ApiError => e - puts "Error when calling CallsApi->update_call: #{e}" + p "Error when calling CallsApi->update_call: #{e}" end /accounts/{accountId}/calls/{callId}/bxml: put: @@ -1030,7 +1030,7 @@ paths: result = api_instance.list_conferences(account_id, opts) p result[0].id if result.length.positive? rescue Bandwidth::ApiError => e - puts "Error when calling ConferencesApi->list_conferences: #{e}" + p "Error when calling ConferencesApi->list_conferences: #{e}" end /accounts/{accountId}/conferences/{conferenceId}: get: @@ -1239,7 +1239,7 @@ paths: result = api_instance.get_conference(account_id, conference_id) p result.name rescue Bandwidth::ApiError => e - puts "Error when calling ConferencesApi->get_conference: #{e}" + p "Error when calling ConferencesApi->get_conference: #{e}" end post: tags: @@ -1491,7 +1491,7 @@ paths: begin api_instance.update_conference(account_id, conference_id, update_conference) rescue Bandwidth::ApiError => e - puts "Error when calling ConferencesApi->update_conference: #{e}" + p "Error when calling ConferencesApi->update_conference: #{e}" end /accounts/{accountId}/conferences/{conferenceId}/bxml: put: @@ -1738,7 +1738,7 @@ paths: result = api_instance.get_conference_member(account_id, conference_id, member_id) p result.member_url rescue Bandwidth::ApiError => e - puts "Error when calling ConferencesApi->get_conference_member: #{e}" + p "Error when calling ConferencesApi->get_conference_member: #{e}" end put: tags: @@ -1997,7 +1997,7 @@ paths: begin api_instance.update_conference_member(account_id, conference_id, member_id, update_conference_member) rescue Bandwidth::ApiError => e - puts "Error when calling ConferencesApi->update_conference_member: #{e}" + p "Error when calling ConferencesApi->update_conference_member: #{e}" end /accounts/{accountId}/conferences/{conferenceId}/recordings: get: @@ -2211,7 +2211,7 @@ paths: result = api_instance.list_conference_recordings(account_id, conference_id) p result[0].name if result.length.positive? rescue Bandwidth::ApiError => e - puts "Error when calling ConferencesApi->list_conference_recordings: #{e}" + p "Error when calling ConferencesApi->list_conference_recordings: #{e}" end /accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}: get: @@ -2427,7 +2427,7 @@ paths: result = api_instance.get_conference_recording(account_id, conference_id, recording_id) p result.application_id rescue Bandwidth::ApiError => e - puts "Error when calling ConferencesApi->get_conference_recording: #{e}" + p "Error when calling ConferencesApi->get_conference_recording: #{e}" end /accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media: get: @@ -2641,7 +2641,7 @@ paths: result = api_instance.download_conference_recording(account_id, conference_id, recording_id) p result rescue Bandwidth::ApiError => e - puts "Error when calling ConferencesApi->download_conference_recording: #{e}" + p "Error when calling ConferencesApi->download_conference_recording: #{e}" end /accounts/{accountId}/recordings: get: @@ -2847,7 +2847,7 @@ paths: result = api_instance.list_account_call_recordings(account_id, opts) p result[0].recording_id if result.length.positive? rescue Bandwidth::ApiError => e - puts "Error when calling RecordingsApi->list_account_call_recordings: #{e}" + p "Error when calling RecordingsApi->list_account_call_recordings: #{e}" end /accounts/{accountId}/calls/{callId}/recording: put: @@ -3088,7 +3088,7 @@ paths: begin api_instance.update_call_recording_state(account_id, call_id, update_call_recording) rescue Bandwidth::ApiError => e - puts "Error when calling RecordingsApi->update_call_recording_state: #{e}" + p "Error when calling RecordingsApi->update_call_recording_state: #{e}" end /accounts/{accountId}/calls/{callId}/recordings: get: @@ -3295,7 +3295,7 @@ paths: result = api_instance.list_call_recordings(account_id, call_id) p result[0].media_url if result.length.positive? rescue Bandwidth::ApiError => e - puts "Error when calling RecordingsApi->list_call_recordings: #{e}" + p "Error when calling RecordingsApi->list_call_recordings: #{e}" end /accounts/{accountId}/calls/{callId}/recordings/{recordingId}: get: @@ -3504,7 +3504,7 @@ paths: result = api_instance.get_call_recording(account_id, call_id, recording_id) p result.application_id rescue Bandwidth::ApiError => e - puts "Error when calling RecordingsApi->get_call_recording: #{e}" + p "Error when calling RecordingsApi->get_call_recording: #{e}" end delete: tags: @@ -3717,7 +3717,7 @@ paths: begin api_instance.delete_recording(account_id, call_id, recording_id) rescue Bandwidth::ApiError => e - puts "Error when calling RecordingsApi->delete_recording: #{e}" + p "Error when calling RecordingsApi->delete_recording: #{e}" end /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media: get: @@ -3922,7 +3922,7 @@ paths: result = api_instance.download_call_recording(account_id, call_id, recording_id) p result rescue Bandwidth::ApiError => e - puts "Error when calling RecordingsApi->download_call_recording: #{e}" + p "Error when calling RecordingsApi->download_call_recording: #{e}" end delete: tags: @@ -4127,7 +4127,7 @@ paths: begin api_instance.delete_recording_media(account_id, call_id, recording_id) rescue Bandwidth::ApiError => e - puts "Error when calling RecordingsApi->delete_recording_media: #{e}" + p "Error when calling RecordingsApi->delete_recording_media: #{e}" end /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription: get: @@ -4350,7 +4350,7 @@ paths: result = api_instance.get_call_transcription(account_id, call_id, recording_id) p result.transcripts rescue Bandwidth::ApiError => e - puts "Error when calling RecordingsApi->get_call_transcription: #{e}" + p "Error when calling RecordingsApi->get_call_transcription: #{e}" end post: tags: @@ -4605,7 +4605,7 @@ paths: begin api_instance.transcribe_call_recording(account_id, call_id, recording_id, transcribe_recording) rescue Bandwidth::ApiError => e - puts "Error when calling RecordingsApi->transcribe_call_recording: #{e}" + p "Error when calling RecordingsApi->transcribe_call_recording: #{e}" end delete: tags: @@ -4816,7 +4816,7 @@ paths: begin api_instance.delete_call_transcription(account_id, call_id, recording_id) rescue Bandwidth::ApiError => e - puts "Error when calling RecordingsApi->delete_call_transcription: #{e}" + p "Error when calling RecordingsApi->delete_call_transcription: #{e}" end /accounts/{accountId}/statistics: get: From 40a55ba248ca3beb23d5302355663c8495ad6f6d Mon Sep 17 00:00:00 2001 From: DX-Bandwidth Date: Thu, 31 Aug 2023 13:20:55 +0000 Subject: [PATCH 18/20] Add Code Snippets to Spec Files --- site/specs/voice.yml | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/site/specs/voice.yml b/site/specs/voice.yml index 6455bfeee..ca697ef5e 100644 --- a/site/specs/voice.yml +++ b/site/specs/voice.yml @@ -826,6 +826,29 @@ paths: $ref: '#/components/responses/voiceTooManyRequestsError' '500': $ref: '#/components/responses/voiceInternalServerError' + x-codeSamples: + - lang: Ruby + source: | + require 'bandwidth-sdk' + + Bandwidth.configure do |config| + config.username = 'api-username' + config.password = 'api-password' + end + + api_instance = Bandwidth::CallsApi.new + account_id = '12345' + call_id = 'c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' + body = ' + + This is a test sentence. + ' + + begin + api_instance.update_call_bxml(account_id, call_id, body) + rescue Bandwidth::ApiError => e + p "Error when calling CallsApi->update_call_bxml: #{e}" + end /accounts/{accountId}/conferences: get: tags: @@ -1524,6 +1547,29 @@ paths: $ref: '#/components/responses/voiceTooManyRequestsError' '500': $ref: '#/components/responses/voiceInternalServerError' + x-codeSamples: + - lang: Ruby + source: | + require 'bandwidth-sdk' + + Bandwidth.configure do |config| + config.username = 'api-username' + config.password = 'api-password' + end + + api_instance = Bandwidth::ConferencesApi.new + account_id = '12345' + conference_id = 'conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9' + body = ' + + + ' + + begin + api_instance.update_conference_bxml(account_id, conference_id, body) + rescue Bandwidth::ApiError => e + p "Error when calling ConferencesApi->update_conference_bxml: #{e}" + end /accounts/{accountId}/conferences/{conferenceId}/members/{memberId}: get: tags: From 29e6c32c3160f28ad4f6d0f5c8d3c82deb06df33 Mon Sep 17 00:00:00 2001 From: DX-Bandwidth Date: Thu, 31 Aug 2023 13:25:54 +0000 Subject: [PATCH 19/20] Add Code Snippets to Spec Files --- site/specs/voice.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/specs/voice.yml b/site/specs/voice.yml index ca697ef5e..e94ffbacf 100644 --- a/site/specs/voice.yml +++ b/site/specs/voice.yml @@ -1557,7 +1557,7 @@ paths: config.password = 'api-password' end - api_instance = Bandwidth::ConferencesApi.new + api_instance = Bandwidth::ConferencesApi.new() account_id = '12345' conference_id = 'conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9' body = ' From 19f4f0af7b4dc253b0464d70775ea4316cdc1781 Mon Sep 17 00:00:00 2001 From: DX-Bandwidth Date: Thu, 31 Aug 2023 13:31:02 +0000 Subject: [PATCH 20/20] Add Code Snippets to Spec Files --- site/specs/voice.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/specs/voice.yml b/site/specs/voice.yml index e94ffbacf..ca697ef5e 100644 --- a/site/specs/voice.yml +++ b/site/specs/voice.yml @@ -1557,7 +1557,7 @@ paths: config.password = 'api-password' end - api_instance = Bandwidth::ConferencesApi.new() + api_instance = Bandwidth::ConferencesApi.new account_id = '12345' conference_id = 'conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9' body = '