Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
SWI-3654 (#1167)
Browse files Browse the repository at this point in the history
* Add Code Snippets to Spec Files

* Add Code Snippets to Spec Files

* Add Code Snippets to Spec Files

* Add Code Snippets to Spec Files

* Add Code Snippets to Spec Files

* Add Code Snippets to Spec Files

* Add Code Snippets to Spec Files

* Add Code Snippets to Spec Files

* Add Code Snippets to Spec Files

* Add Code Snippets to Spec Files

* Add Code Snippets to Spec Files

* Add Code Snippets to Spec Files

* Add Code Snippets to Spec Files

* Add Code Snippets to Spec Files

* Add Code Snippets to Spec Files

* Add Code Snippets to Spec Files

* Add Code Snippets to Spec Files
  • Loading branch information
DX-Bandwidth authored Oct 3, 2023
1 parent 17560ac commit 7fad2d7
Show file tree
Hide file tree
Showing 5 changed files with 3,826 additions and 3,043 deletions.
67 changes: 40 additions & 27 deletions site/specs/messaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ paths:
import com.bandwidth.sdk.ApiException;
import com.bandwidth.sdk.Configuration;
import com.bandwidth.sdk.auth.*;
import com.bandwidth.sdk.models.*;
import com.bandwidth.sdk.model.*;
import com.bandwidth.sdk.api.MediaApi;
public class Example {
import java.util.List;
public class Sample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
Expand Down Expand Up @@ -280,30 +282,37 @@ paths:
}
- lang: Java
source: |
import com.bandwidth.BandwidthClient;
import com.bandwidth.http.response.ApiResponse;
import com.bandwidth.sdk.ApiClient;
import com.bandwidth.sdk.ApiException;
import com.bandwidth.sdk.Configuration;
import com.bandwidth.sdk.auth.*;
import com.bandwidth.sdk.model.*;
import com.bandwidth.sdk.api.MediaApi;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.io.InputStream;
import java.io.File;
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 mediaId = "media-id-123";
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://localhost");
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<ApiResponse<InputStream>> completableFuture = client.getMessagingClient().getAPIController().getMediaAsync(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();
}
}
}
Expand Down Expand Up @@ -505,10 +514,12 @@ paths:
import com.bandwidth.sdk.ApiException;
import com.bandwidth.sdk.Configuration;
import com.bandwidth.sdk.auth.*;
import com.bandwidth.sdk.models.*;
import com.bandwidth.sdk.model.*;
import com.bandwidth.sdk.api.MediaApi;
public class Example {
import java.io.File;
public class Sample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
Expand Down Expand Up @@ -753,10 +764,12 @@ paths:
import com.bandwidth.sdk.ApiException;
import com.bandwidth.sdk.Configuration;
import com.bandwidth.sdk.auth.*;
import com.bandwidth.sdk.models.*;
import com.bandwidth.sdk.model.*;
import com.bandwidth.sdk.api.MediaApi;
public class Example {
import java.io.File;
public class Sample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
Expand Down Expand Up @@ -962,10 +975,10 @@ paths:
import com.bandwidth.sdk.ApiException;
import com.bandwidth.sdk.Configuration;
import com.bandwidth.sdk.auth.*;
import com.bandwidth.sdk.models.*;
import com.bandwidth.sdk.model.*;
import com.bandwidth.sdk.api.MessagesApi;
public class Example {
public class Sample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
Expand Down Expand Up @@ -1204,10 +1217,10 @@ paths:
import com.bandwidth.sdk.ApiException;
import com.bandwidth.sdk.Configuration;
import com.bandwidth.sdk.auth.*;
import com.bandwidth.sdk.models.*;
import com.bandwidth.sdk.model.*;
import com.bandwidth.sdk.api.MessagesApi;
public class Example {
public class Sample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: Basic
Expand Down
12 changes: 6 additions & 6 deletions site/specs/multi-factor-auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ paths:
import com.bandwidth.sdk.ApiException;
import com.bandwidth.sdk.Configuration;
import com.bandwidth.sdk.auth.*;
import com.bandwidth.sdk.models.*;
import com.bandwidth.sdk.model.*;
import com.bandwidth.sdk.api.MfaApi;
public class Example {
public class Sample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
Expand Down Expand Up @@ -390,10 +390,10 @@ paths:
import com.bandwidth.sdk.ApiException;
import com.bandwidth.sdk.Configuration;
import com.bandwidth.sdk.auth.*;
import com.bandwidth.sdk.models.*;
import com.bandwidth.sdk.model.*;
import com.bandwidth.sdk.api.MfaApi;
public class Example {
public class Sample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
Expand Down Expand Up @@ -671,10 +671,10 @@ paths:
import com.bandwidth.sdk.ApiException;
import com.bandwidth.sdk.Configuration;
import com.bandwidth.sdk.auth.*;
import com.bandwidth.sdk.models.*;
import com.bandwidth.sdk.model.*;
import com.bandwidth.sdk.api.MfaApi;
public class Example {
public class Sample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
Expand Down
Loading

0 comments on commit 7fad2d7

Please sign in to comment.