diff --git a/site/specs/messaging.yml b/site/specs/messaging.yml index 6f00b55dd..4b418a374 100644 --- a/site/specs/messaging.yml +++ b/site/specs/messaging.yml @@ -83,29 +83,34 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.messaging.models.Media; - - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.MediaApi; + + public class Example { public static void main(String[] args) { - BandwidthClient client = new BandwidthClient.Builder() - .messagingBasicAuthCredentials(USERNAME, PASSWORD) - .build(); + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + MediaApi apiInstance = new MediaApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String continuationToken = "1XEi2tsFtLo1JbtLwETnM1ZJ+PqAa8w6ENvC5QKvwyrCDYII663Gy5M4s40owR1tjkuWUif6qbWvFtQJR5/ipqbUnfAqL254LKNlPy6tATCzioKSuHuOqgzloDkSwRtX0LtcL2otHS69hK343m+SjdL+vlj71tT39"; // String | Continuation token used to retrieve subsequent media. try { - CompletableFuture>> completableFuture = client.getMessagingClient().getAPIController().listMediaAsync(ACCOUNT_ID, null); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + List result = apiInstance.listMedia(accountId, continuationToken); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MediaApi#listMedia"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -496,32 +501,36 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.utilities.FileWrapper; - - import java.io.File; - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.MediaApi; + + public class Example { public static void main(String[] args) { - BandwidthClient client = new BandwidthClient.Builder() - .messagingBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - String mediaId = "media-id-123"; - FileWrapper fileWrapper = new FileWrapper(new File("/path/to/file")); - + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + MediaApi apiInstance = new MediaApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String mediaId = "14762070468292kw2fuqty55yp2b2/0/bw.png"; // String | Media ID to retrieve. + File body = new File("/path/to/file"); // File | + String contentType = "audio/wav"; // String | The media type of the entity-body. + String cacheControl = "no-cache"; // String | General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. try { - CompletableFuture> completableFuture = client.getMessagingClient().getAPIController().uploadMediaAsync(ACCOUNT_ID, mediaId, fileWrapper, "content/type", "no-cache"); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + apiInstance.uploadMedia(accountId, mediaId, body, contentType, cacheControl); + } catch (ApiException e) { + System.err.println("Exception when calling MediaApi#uploadMedia"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -740,32 +749,34 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.messaging.models.BandwidthMessage; - import com.bandwidth.messaging.models.MessageRequest; - - import java.util.concurrent.CompletableFuture; - import java.util.concurrent.ExecutionException; - import java.util.Collections; - - public class Sample { - public static final String USERNAME = "api-username"; - public static final String PASSWORD = "api-password"; - public static final String ACCOUNT_ID = "12345"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.MediaApi; + + public class Example { public static void main(String[] args) { - String mediaId = "media-id-123"; + ApiClient defaultClient = Configuration.getDefaultApiClient(); - BandwidthClient client = new BandwidthClient.Builder() - .messagingBasicAuthCredentials(USERNAME, PASSWORD) - .build(); + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + MediaApi apiInstance = new MediaApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String mediaId = "14762070468292kw2fuqty55yp2b2/0/bw.png"; // String | Media ID to retrieve. try { - CompletableFuture> completableFuture = client.getMessagingClient().getAPIController().deleteMediaAsync(ACCOUNT_ID, mediaId); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + File result = apiInstance.getMedia(accountId, mediaId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MediaApi#getMedia"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -947,30 +958,48 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.messaging.models.BandwidthMessagesList; - - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.MessagesApi; + + public class Example { public static void main(String[] args) { - String bandwidthNumber = "+15554443333"; - - BandwidthClient client = new BandwidthClient.Builder() - .messagingBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + MessagesApi apiInstance = new MessagesApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String messageId = "9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6"; // String | The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. + String sourceTn = "%2B15554443333"; // String | The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). + String destinationTn = "%2B15554443333"; // String | The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). + MessageStatusEnum messageStatus = MessageStatusEnum.fromValue("RECEIVED"); // MessageStatusEnum | The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. + ListMessageDirectionEnum messageDirection = ListMessageDirectionEnum.fromValue("INBOUND"); // ListMessageDirectionEnum | The direction of the message. One of INBOUND OUTBOUND. + String carrierName = "Verizon"; // String | The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). + MessageTypeEnum messageType = MessageTypeEnum.fromValue("sms"); // MessageTypeEnum | The type of message. Either sms or mms. + Integer errorCode = 9902; // Integer | The error code of the message. + String fromDateTime = "2022-09-14T18:20:16.000Z"; // String | The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. + String toDateTime = "2022-09-14T18:20:16.000Z"; // String | The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. + String campaignId = "CJEUMDK"; // String | The campaign ID of the message. + String sort = "sourceTn:desc"; // String | The field and direction to sort by combined with a colon. Direction is either asc or desc. + String pageToken = "gdEewhcJLQRB5"; // String | A base64 encoded value used for pagination of results. + Integer limit = 50; // Integer | The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. + Boolean limitTotalCount = true; // Boolean | When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. try { - CompletableFuture> completableFuture = client.getMessagingClient().getAPIController().getMessagesAsync(ACCOUNT_ID, null, bandwidthNumber, null, null, null, null, null, null, null); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + MessagesList result = apiInstance.listMessages(accountId, messageId, sourceTn, destinationTn, messageStatus, messageDirection, carrierName, messageType, errorCode, fromDateTime, toDateTime, campaignId, sort, pageToken, limit, limitTotalCount); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MessagesApi#listMessages"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -1171,40 +1200,33 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.messaging.models.BandwidthMessage; - import com.bandwidth.messaging.models.MessageRequest; - - import java.util.concurrent.CompletableFuture; - import java.util.concurrent.ExecutionException; - import java.util.Collections; - - public class Sample { - public static final String USERNAME = "api-username"; - public static final String PASSWORD = "api-password"; - public static final String ACCOUNT_ID = "12345"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.MessagesApi; + + public class Example { public static void main(String[] args) { - String messagingApplicationId = "1234-asdf"; - String to = "+15553334444"; - String from = "+15554443333"; - - BandwidthClient client = new BandwidthClient.Builder() - .messagingBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - MessageRequest request = new MessageRequest(); - request.setApplicationId(messagingApplicationId); - request.setTo(Collections.singletonList(to)); - request.setFrom(from); - request.setText("Hello world"); - + ApiClient defaultClient = Configuration.getDefaultApiClient(); + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + MessagesApi apiInstance = new MessagesApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + MessageRequest messageRequest = new MessageRequest(); // MessageRequest | try { - CompletableFuture> completableFuture = client.getMessagingClient().getAPIController().createMessageAsync(ACCOUNT_ID, request); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + Message result = apiInstance.createMessage(accountId, messageRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MessagesApi#createMessage"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } diff --git a/site/specs/multi-factor-auth.yml b/site/specs/multi-factor-auth.yml index 41bde6562..2d9691a36 100644 --- a/site/specs/multi-factor-auth.yml +++ b/site/specs/multi-factor-auth.yml @@ -101,52 +101,35 @@ paths: } } - lang: Java - source: > - import com.bandwidth.BandwidthClient; - - import com.bandwidth.http.response.ApiResponse; - - import - com.bandwidth.multifactorauth.models.TwoFactorCodeRequestSchema; - - import com.bandwidth.multifactorauth.models.TwoFactorVoiceResponse; - - - 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 final String APPLICATION_ID = "1234-qwer"; - + source: | + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.MfaApi; + + public class Example { public static void main(String[] args) { - BandwidthClient client = new BandwidthClient.Builder() - .multiFactorAuthBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - String to = "+15553334444"; - String from = "+15554443333"; - String scope = "sample"; - int digits = 6; - String message = "Your temporary {NAME} {SCOPE} code is {CODE}"; - - TwoFactorCodeRequestSchema request = new TwoFactorCodeRequestSchema(); - request.setApplicationId(APPLICATION_ID); - request.setTo(to); - request.setFrom(from); - request.setScope(scope); - request.setDigits(digits); - request.setMessage(message); + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + MfaApi apiInstance = new MfaApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + CodeRequest codeRequest = new CodeRequest(); // CodeRequest | MFA code request body. try { - CompletableFuture> completableFuture = client.getMultiFactorAuthClient().getMFAController().createVoiceTwoFactorAsync(ACCOUNT_ID, request); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + VoiceCodeResponse result = apiInstance.generateVoiceCode(accountId, codeRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MfaApi#generateVoiceCode"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -402,53 +385,35 @@ paths: } } - lang: Java - source: > - import com.bandwidth.BandwidthClient; - - import com.bandwidth.http.response.ApiResponse; - - import - com.bandwidth.multifactorauth.models.TwoFactorCodeRequestSchema; - - import - com.bandwidth.multifactorauth.models.TwoFactorMessagingResponse; - - - 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 final String APPLICATION_ID = "1234-asdf"; - + source: | + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.MfaApi; + + public class Example { public static void main(String[] args) { - BandwidthClient client = new BandwidthClient.Builder() - .multiFactorAuthBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - String to = "+15553334444"; - String from = "+15554443333"; - String scope = "sample"; - int digits = 6; - String message = "Your temporary {NAME} {SCOPE} code is {CODE}"; - - TwoFactorCodeRequestSchema request = new TwoFactorCodeRequestSchema(); - request.setApplicationId(APPLICATION_ID); - request.setTo(to); - request.setFrom(from); - request.setScope(scope); - request.setDigits(digits); - request.setMessage(message); + ApiClient defaultClient = Configuration.getDefaultApiClient(); + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + MfaApi apiInstance = new MfaApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + CodeRequest codeRequest = new CodeRequest(); // CodeRequest | MFA code request body. try { - CompletableFuture> completableFuture = client.getMultiFactorAuthClient().getMFAController().createMessagingTwoFactorAsync(ACCOUNT_ID, request); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + MessagingCodeResponse result = apiInstance.generateMessagingCode(accountId, codeRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MfaApi#generateMessagingCode"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -701,51 +666,35 @@ paths: } } - lang: Java - source: > - import com.bandwidth.BandwidthClient; - - import com.bandwidth.http.response.ApiResponse; - - import - com.bandwidth.multifactorauth.models.TwoFactorVerifyCodeResponse; - - import - com.bandwidth.multifactorauth.models.TwoFactorVerifyRequestSchema; - - - 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 final String APPLICATION_ID = "1234-qwer"; - + source: | + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.MfaApi; + + public class Example { public static void main(String[] args) { - BandwidthClient client = new BandwidthClient.Builder() - .multiFactorAuthBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - String to = "+15553334444"; - String scope = "sample"; - String code = "159193"; - int expirationTimeInMinutes = 3; - - TwoFactorVerifyRequestSchema request = new TwoFactorVerifyRequestSchema(); - request.setApplicationId(APPLICATION_ID); - request.setTo(to); - request.setScope(scope); - request.setCode(code); - request.setExpirationTimeInMinutes(expirationTimeInMinutes); + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + MfaApi apiInstance = new MfaApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + VerifyCodeRequest verifyCodeRequest = new VerifyCodeRequest(); // VerifyCodeRequest | MFA code verify request body. try { - CompletableFuture> completableFuture = client.getMultiFactorAuthClient().getMFAController().createVerifyTwoFactorAsync(ACCOUNT_ID, request); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + VerifyCodeResponse result = apiInstance.verifyCode(accountId, verifyCodeRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MfaApi#verifyCode"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } diff --git a/site/specs/phone-number-lookup.yml b/site/specs/phone-number-lookup.yml index e55f420de..1ce596b32 100644 --- a/site/specs/phone-number-lookup.yml +++ b/site/specs/phone-number-lookup.yml @@ -99,36 +99,34 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.phonenumberlookup.models.OrderRequest; - import com.bandwidth.phonenumberlookup.models.OrderResponse; - - import java.util.concurrent.CompletableFuture; - import java.util.concurrent.ExecutionException; - import java.util.ArrayList; - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.PhoneNumberLookupApi; + + public class Example { public static void main(String[] args) { - BandwidthClient client = new BandwidthClient.Builder() - .phoneNumberLookupBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - List numbers = new ArrayList<>(); - numbers.add("+15553334444"); + ApiClient defaultClient = Configuration.getDefaultApiClient(); - OrderRequest request = new OrderRequest(numbers); + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + PhoneNumberLookupApi apiInstance = new PhoneNumberLookupApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + LookupRequest lookupRequest = new LookupRequest(); // LookupRequest | Phone number lookup request. try { - CompletableFuture> completableFuture = client.getPhoneNumberLookupClient().getAPIController().createLookupRequestAsync(ACCOUNT_ID, request); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + CreateLookupResponse result = apiInstance.createLookup(accountId, lookupRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PhoneNumberLookupApi#createLookup"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -303,30 +301,34 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.phonenumberlookup.models.OrderStatus; - - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.PhoneNumberLookupApi; + + public class Example { public static void main(String[] args) { - BandwidthClient client = new BandwidthClient.Builder() - .phoneNumberLookupBasicAuthCredentials(USERNAME, PASSWORD) - .build(); + ApiClient defaultClient = Configuration.getDefaultApiClient(); - String requestId = "8a358296-e188-4a3a-b974-8e4d12001dd8"; + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + PhoneNumberLookupApi apiInstance = new PhoneNumberLookupApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String requestId = "004223a0-8b17-41b1-bf81-20732adf5590"; // String | The phone number lookup request ID from Bandwidth. try { - CompletableFuture> completableFuture = client.getPhoneNumberLookupClient().getAPIController().getLookupRequestStatusAsync(ACCOUNT_ID, requestId); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + LookupStatus result = apiInstance.getLookupStatus(accountId, requestId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PhoneNumberLookupApi#getLookupStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } diff --git a/site/specs/voice.yml b/site/specs/voice.yml index 3a1972755..88702b30f 100644 --- a/site/specs/voice.yml +++ b/site/specs/voice.yml @@ -145,41 +145,34 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.voice.models.CreateCallRequest; - import com.bandwidth.voice.models.CreateCallResponse; - - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.CallsApi; + + public class Example { public static void main(String[] args) { - String voiceApplicationId = "1234-qwer"; - String to = "+15553334444"; - String from = "+15554443333"; - String baseUrl = "https://sample.com"; - String answerUrl = baseUrl.concat("/callbacks/answer"); - BandwidthClient client = new BandwidthClient.Builder() - .voiceBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - CreateCallRequest request = new CreateCallRequest(); - request.setApplicationId(voiceApplicationId); - request.setTo(to); - request.setFrom(from); - request.setAnswerUrl(answerUrl); + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + CallsApi apiInstance = new CallsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + CreateCall createCall = new CreateCall(); // CreateCall | JSON object containing information to create an outbound call try { - CompletableFuture> completableFuture = client.getVoiceClient().getAPIController().createCallAsync(ACCOUNT_ID, request); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + CreateCallResponse result = apiInstance.createCall(accountId, createCall); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CallsApi#createCall"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -460,31 +453,34 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.voice.models.CallState; - - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.CallsApi; + + public class Example { public static void main(String[] args) { - // Call id is returned after successfully creating a call. - String callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d"; + ApiClient defaultClient = Configuration.getDefaultApiClient(); - BandwidthClient client = new BandwidthClient.Builder() - .voiceBasicAuthCredentials(USERNAME, PASSWORD) - .build(); + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + CallsApi apiInstance = new CallsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. try { - CompletableFuture> completableFuture = client.getVoiceClient().getAPIController().getCallAsync(ACCOUNT_ID, callId); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + CallState result = apiInstance.getCallState(accountId, callId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CallsApi#getCallState"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -684,34 +680,34 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.voice.models.ModifyCallRequest; - import com.bandwidth.voice.models.StateEnum; - - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.CallsApi; + + public class Example { public static void main(String[] args) { - String callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d"; - - BandwidthClient client = new BandwidthClient.Builder() - .voiceBasicAuthCredentials(USERNAME, PASSWORD) - .build(); + ApiClient defaultClient = Configuration.getDefaultApiClient(); - ModifyCallRequest request = new ModifyCallRequest(); - request.setState(StateEnum.COMPLETED); + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + CallsApi apiInstance = new CallsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. + UpdateCall updateCall = new UpdateCall(); // UpdateCall | JSON object containing information to redirect an existing call to a new BXML document try { - CompletableFuture> completableFuture = client.getVoiceClient().getAPIController().modifyCallAsync(ACCOUNT_ID, callId, request); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + apiInstance.updateCall(accountId, callId, updateCall); + } catch (ApiException e) { + System.err.println("Exception when calling CallsApi#updateCall"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -873,6 +869,42 @@ paths: '500': $ref: '#/components/responses/voiceInternalServerError' x-codeSamples: + - lang: Java + source: | + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.CallsApi; + + public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + CallsApi apiInstance = new CallsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. + String body = + + This is a test sentence. + ; // String | + try { + apiInstance.updateCallBxml(accountId, callId, body); + } catch (ApiException e) { + System.err.println("Exception when calling CallsApi#updateCallBxml"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } + } - lang: Ruby source: | require 'bandwidth-sdk' @@ -975,29 +1007,38 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.voice.models.ConferenceState; - - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.ConferencesApi; + + public class Example { public static void main(String[] args) { - BandwidthClient client = new BandwidthClient.Builder() - .voiceBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + ConferencesApi apiInstance = new ConferencesApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String name = "my-custom-name"; // String | Filter results by the `name` field. + String minCreatedTime = "2022-06-21T19:13:21Z"; // String | Filter results to conferences which have a `createdTime` after or at `minCreatedTime` (in ISO8601 format). + String maxCreatedTime = "2022-06-21T19:13:21Z"; // String | Filter results to conferences which have a `createdTime` before or at `maxCreatedTime` (in ISO8601 format). + Integer pageSize = 1000; // Integer | Specifies the max number of conferences that will be returned. + String pageToken = "pageToken_example"; // String | Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description. try { - CompletableFuture>> completableFuture = client.getVoiceClient().getAPIController().getConferencesAsync(ACCOUNT_ID, null, null, null, null, null); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + List result = apiInstance.listConferences(accountId, name, minCreatedTime, maxCreatedTime, pageSize, pageToken); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ConferencesApi#listConferences"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -1172,31 +1213,34 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.voice.models.ConferenceState; - - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.ConferencesApi; + + public class Example { public static void main(String[] args) { - // Conference id is returned after successfully creating a conference. - String conferenceId = "conf-95ac8d8d-28e06798-2afe-434c-b0f4-666a79cd47f8"; + ApiClient defaultClient = Configuration.getDefaultApiClient(); - BandwidthClient client = new BandwidthClient.Builder() - .voiceBasicAuthCredentials(USERNAME, PASSWORD) - .build(); + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + ConferencesApi apiInstance = new ConferencesApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9"; // String | Programmable Voice API Conference ID. try { - CompletableFuture> completableFuture = client.getVoiceClient().getAPIController().getConferenceAsync(ACCOUNT_ID, conferenceId); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + Conference result = apiInstance.getConference(accountId, conferenceId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ConferencesApi#getConference"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -1399,33 +1443,35 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.voice.models.*; - - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.ConferencesApi; + + public class Example { public static void main(String[] args) { - String conferenceId = "conf-95ac8d8d-28e06798-2afe-434c-b0f4-666a79cd47f8"; - - BandwidthClient client = new BandwidthClient.Builder() - .voiceBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - ModifyConferenceRequest request = new ModifyConferenceRequest(); - request.setStatus(StatusEnum.COMPLETED); - + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + ConferencesApi apiInstance = new ConferencesApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9"; // String | Programmable Voice API Conference ID. + UpdateConference updateConference = new UpdateConference(); // UpdateConference | try { - CompletableFuture> completableFuture = client.getVoiceClient().getAPIController().modifyConferenceAsync(ACCOUNT_ID, conferenceId, request); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + apiInstance.updateConference(accountId, conferenceId, updateConference); + } catch (ApiException e) { + System.err.println("Exception when calling ConferencesApi#updateConference"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -1594,6 +1640,42 @@ paths: '500': $ref: '#/components/responses/voiceInternalServerError' x-codeSamples: + - lang: Java + source: | + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.ConferencesApi; + + public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + ConferencesApi apiInstance = new ConferencesApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9"; // String | Programmable Voice API Conference ID. + String body = + + + ; // String | + try { + apiInstance.updateConferenceBxml(accountId, conferenceId, body); + } catch (ApiException e) { + System.err.println("Exception when calling ConferencesApi#updateConferenceBxml"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } + } - lang: Ruby source: | require 'bandwidth-sdk' @@ -1689,31 +1771,35 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.voice.models.ConferenceMemberState; - - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.ConferencesApi; + + public class Example { public static void main(String[] args) { - String conferenceId = "conf-95ac8d8d-28e06798-2afe-434c-b0f4-666a79cd47f8"; - String memberId = "c-95ac8d8d-b81437f5-4586-4d5b-9b46-29f8b3fe0aaf"; + ApiClient defaultClient = Configuration.getDefaultApiClient(); - BandwidthClient client = new BandwidthClient.Builder() - .voiceBasicAuthCredentials(USERNAME, PASSWORD) - .build(); + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + ConferencesApi apiInstance = new ConferencesApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9"; // String | Programmable Voice API Conference ID. + String memberId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Conference Member ID. try { - CompletableFuture> completableFuture = client.getVoiceClient().getAPIController().getConferenceMemberAsync(ACCOUNT_ID, conferenceId, memberId); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + ConferenceMember result = apiInstance.getConferenceMember(accountId, conferenceId, memberId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ConferencesApi#getConferenceMember"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -2164,31 +2250,35 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.voice.models.ConferenceRecordingMetadata; - - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.ConferencesApi; + + public class Example { public static void main(String[] args) { - String conferenceId = "conf-95ac8d8d-28e06798-2afe-434c-b0f4-666a79cd47f8"; + ApiClient defaultClient = Configuration.getDefaultApiClient(); - BandwidthClient client = new BandwidthClient.Builder() - .voiceBasicAuthCredentials(USERNAME, PASSWORD) - .build(); + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + ConferencesApi apiInstance = new ConferencesApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9"; // String | Programmable Voice API Conference ID. + String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Recording ID. try { - CompletableFuture>> completableFuture = client.getVoiceClient().getAPIController().getConferenceRecordingsAsync(ACCOUNT_ID, conferenceId); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + ConferenceRecordingMetadata result = apiInstance.getConferenceRecording(accountId, conferenceId, recordingId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ConferencesApi#getConferenceRecording"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -2378,31 +2468,36 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.voice.models.CallRecordingMetadata; - - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.ConferencesApi; + + public class Example { public static void main(String[] args) { - String conferenceId = "conf-95ac8d8d-28e06798-2afe-434c-b0f4-666a79cd47f8"; - String recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41"; - - BandwidthClient client = new BandwidthClient.Builder() - .voiceBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + ConferencesApi apiInstance = new ConferencesApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9"; // String | Programmable Voice API Conference ID. + String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Recording ID. try { - CompletableFuture> completableFuture = client.getVoiceClient().getAPIController().getConferenceRecordingAsync(ACCOUNT_ID, conferenceId, recordingId); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + ConferenceRecordingMetadata result = apiInstance.getConferenceRecording(accountId, conferenceId, recordingId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ConferencesApi#getConferenceRecording"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -2595,33 +2690,35 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.voice.models.DynamicResponse; - - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.ConferencesApi; + + public class Example { public static void main(String[] args) { - // Conference id is returned after successfully creating a conference. - String conferenceId = "conf-95ac8d8d-28e06798-2afe-434c-b0f4-666a79cd47f8"; - // Recording id is returned after retrieving a recording from the call. - String recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41"; + ApiClient defaultClient = Configuration.getDefaultApiClient(); - BandwidthClient client = new BandwidthClient.Builder() - .voiceBasicAuthCredentials(USERNAME, PASSWORD) - .build(); + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + ConferencesApi apiInstance = new ConferencesApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9"; // String | Programmable Voice API Conference ID. + String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Recording ID. try { - CompletableFuture> completableFuture = client.getVoiceClient().getAPIController().getDownloadConferenceRecordingAsync(ACCOUNT_ID, conferenceId, recordingId); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + File result = apiInstance.downloadConferenceRecording(accountId, conferenceId, recordingId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ConferencesApi#downloadConferenceRecording"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -2815,29 +2912,38 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.voice.models.*; - - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.RecordingsApi; + + public class Example { public static void main(String[] args) { - BandwidthClient client = new BandwidthClient.Builder() - .voiceBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + RecordingsApi apiInstance = new RecordingsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String to = "%2b19195551234"; // String | Filter results by the `to` field. + String from = "%2b19195554321"; // String | Filter results by the `from` field. + String minStartTime = "2022-06-21T19:13:21Z"; // String | Filter results to recordings which have a `startTime` after or including `minStartTime` (in ISO8601 format). + String maxStartTime = "2022-06-21T19:13:21Z"; // String | Filter results to recordings which have a `startTime` before `maxStartTime` (in ISO8601 format). try { - CompletableFuture>> completableFuture = client.getVoiceClient().getAPIController().getQueryCallRecordingsAsync(ACCOUNT_ID, null, null, null, null); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + List result = apiInstance.listAccountCallRecordings(accountId, to, from, minStartTime, maxStartTime); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling RecordingsApi#listAccountCallRecordings"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -3024,33 +3130,35 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.voice.models.*; - - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.RecordingsApi; + + public class Example { public static void main(String[] args) { - String callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d"; - - BandwidthClient client = new BandwidthClient.Builder() - .voiceBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - ModifyCallRecordingRequest recordingRequest = new ModifyCallRecordingRequest(); - recordingRequest.setState(State1Enum.PAUSED); - + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + RecordingsApi apiInstance = new RecordingsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. + UpdateCallRecording updateCallRecording = new UpdateCallRecording(); // UpdateCallRecording | try { - CompletableFuture> completableFuture = client.getVoiceClient().getAPIController().modifyCallRecordingStateAsync(ACCOUNT_ID, callId, recordingRequest); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + apiInstance.updateCallRecordingState(accountId, callId, updateCallRecording); + } catch (ApiException e) { + System.err.println("Exception when calling RecordingsApi#updateCallRecordingState"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -3256,32 +3364,35 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.voice.models.CallRecordingMetadata; - - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.RecordingsApi; + + public class Example { public static void main(String[] args) { - // Call id is returned after successfully creating a call. - String callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d"; + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); - BandwidthClient client = new BandwidthClient.Builder() - .voiceBasicAuthCredentials(USERNAME, PASSWORD) - .build(); + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + RecordingsApi apiInstance = new RecordingsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. try { - CompletableFuture>> completableFuture = client.getVoiceClient().getAPIController().getCallRecordingsAsync(ACCOUNT_ID, callId); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + List result = apiInstance.listCallRecordings(accountId, callId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling RecordingsApi#listCallRecordings"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -3464,33 +3575,35 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.voice.models.CallRecordingMetadata; - - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.RecordingsApi; + + public class Example { public static void main(String[] args) { - // Call id is returned after successfully creating a call. - String callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d"; - // Recording id is returned after retrieving a recording from the call. - String recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41"; + ApiClient defaultClient = Configuration.getDefaultApiClient(); - BandwidthClient client = new BandwidthClient.Builder() - .voiceBasicAuthCredentials(USERNAME, PASSWORD) - .build(); + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + RecordingsApi apiInstance = new RecordingsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. + String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Recording ID. try { - CompletableFuture> completableFuture = client.getVoiceClient().getAPIController().getCallRecordingAsync(ACCOUNT_ID, callId, recordingId); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + CallRecordingMetadata result = apiInstance.getCallRecording(accountId, callId, recordingId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling RecordingsApi#getCallRecording"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -3680,32 +3793,34 @@ paths: } - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.RecordingsApi; + + public class Example { public static void main(String[] args) { - // Call id is returned after successfully creating a call. - String callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d"; - // Recording id is returned after retrieving a recording from the call. - String recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41"; + ApiClient defaultClient = Configuration.getDefaultApiClient(); - BandwidthClient client = new BandwidthClient.Builder() - .voiceBasicAuthCredentials(USERNAME, PASSWORD) - .build(); + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + RecordingsApi apiInstance = new RecordingsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. + String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Recording ID. try { - CompletableFuture> completableFuture = client.getVoiceClient().getAPIController().deleteRecordingAsync(ACCOUNT_ID, callId, recordingId); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + apiInstance.deleteRecording(accountId, callId, recordingId); + } catch (ApiException e) { + System.err.println("Exception when calling RecordingsApi#deleteRecording"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -3886,33 +4001,36 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.voice.models.DynamicResponse; - - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.RecordingsApi; + + public class Example { public static void main(String[] args) { - // Call id is returned after successfully creating a call. - String callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d"; - // Recording id is returned after retrieving a recording from the call. - String recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41"; - - BandwidthClient client = new BandwidthClient.Builder() - .voiceBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + RecordingsApi apiInstance = new RecordingsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. + String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Recording ID. try { - CompletableFuture> completableFuture = client.getVoiceClient().getAPIController().getDownloadCallRecordingAsync(ACCOUNT_ID, callId, recordingId); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + File result = apiInstance.downloadCallRecording(accountId, callId, recordingId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling RecordingsApi#downloadCallRecording"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -4090,32 +4208,34 @@ paths: } - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.RecordingsApi; + + public class Example { public static void main(String[] args) { - // Call id is returned after successfully creating a call. - String callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d"; - // Recording id is returned after retrieving a recording from the call. - String recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41"; + ApiClient defaultClient = Configuration.getDefaultApiClient(); - BandwidthClient client = new BandwidthClient.Builder() - .voiceBasicAuthCredentials(USERNAME, PASSWORD) - .build(); + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + RecordingsApi apiInstance = new RecordingsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. + String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Recording ID. try { - CompletableFuture> completableFuture = client.getVoiceClient().getAPIController().deleteRecordingMediaAsync(ACCOUNT_ID, callId, recordingId); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + apiInstance.deleteRecordingMedia(accountId, callId, recordingId); + } catch (ApiException e) { + System.err.println("Exception when calling RecordingsApi#deleteRecordingMedia"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -4310,33 +4430,35 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.voice.models.TranscriptionResponse; - - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.RecordingsApi; + + public class Example { public static void main(String[] args) { - // Call id is returned after successfully creating a call. - String callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d"; - // Recording id is returned after retrieving a recording from the call. - String recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41"; + ApiClient defaultClient = Configuration.getDefaultApiClient(); - BandwidthClient client = new BandwidthClient.Builder() - .voiceBasicAuthCredentials(USERNAME, PASSWORD) - .build(); + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + RecordingsApi apiInstance = new RecordingsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. + String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Recording ID. try { - CompletableFuture> completableFuture = client.getVoiceClient().getAPIController().getCallTranscriptionAsync(ACCOUNT_ID, callId, recordingId); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + TranscriptionList result = apiInstance.getCallTranscription(accountId, callId, recordingId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling RecordingsApi#getCallTranscription"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -4543,34 +4665,35 @@ paths: } - lang: Java source: | - import com.bandwidth.BandwidthClient; - import com.bandwidth.http.response.ApiResponse; - import com.bandwidth.voice.models.*; - - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.RecordingsApi; + + public class Example { public static void main(String[] args) { - String callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d"; - String recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41"; - - BandwidthClient client = new BandwidthClient.Builder() - .voiceBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - TranscribeRecordingRequest request = new TranscribeRecordingRequest(); - request.setCallbackUrl("https://sample.com/callbacks/transcribe"); - + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + RecordingsApi apiInstance = new RecordingsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. + String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Recording ID. + TranscribeRecording transcribeRecording = new TranscribeRecording(); // TranscribeRecording | try { - CompletableFuture> completableFuture = client.getVoiceClient().getAPIController().createTranscribeCallRecordingAsync(ACCOUNT_ID, callId, recordingId, request); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + apiInstance.transcribeCallRecording(accountId, callId, recordingId, transcribeRecording); + } catch (ApiException e) { + System.err.println("Exception when calling RecordingsApi#transcribeCallRecording"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } } @@ -4780,32 +4903,34 @@ paths: } - 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"; - + import com.bandwidth.sdk.ApiClient; + import com.bandwidth.sdk.ApiException; + import com.bandwidth.sdk.Configuration; + import com.bandwidth.sdk.auth.*; + import com.bandwidth.sdk.models.*; + import com.bandwidth.sdk.api.RecordingsApi; + + public class Example { public static void main(String[] args) { - // Call id is returned after successfully creating a call. - String callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d"; - // Recording id is returned after retrieving a recording from the call. - String recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41"; + ApiClient defaultClient = Configuration.getDefaultApiClient(); - BandwidthClient client = new BandwidthClient.Builder() - .voiceBasicAuthCredentials(USERNAME, PASSWORD) - .build(); + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + RecordingsApi apiInstance = new RecordingsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. + String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Recording ID. try { - CompletableFuture> completableFuture = client.getVoiceClient().getAPIController().deleteCallTranscriptionAsync(ACCOUNT_ID, callId, recordingId); - System.out.println(completableFuture.get().getResult()); - } catch (InterruptedException | ExecutionException e) { - System.out.println(e.getMessage()); + apiInstance.deleteCallTranscription(accountId, callId, recordingId); + } catch (ApiException e) { + System.err.println("Exception when calling RecordingsApi#deleteCallTranscription"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); } } }