Class APIController
- java.lang.Object
-
- com.bandwidth.controllers.BaseController
-
- com.bandwidth.messaging.controllers.APIController
-
public final class APIController extends BaseController
This class lists all the endpoints of the groups.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.bandwidth.controllers.BaseController
BaseController.RequestExecutor, BaseController.RequestSupplier, BaseController.ResponseHandler<T>
-
-
Field Summary
-
Fields inherited from class com.bandwidth.controllers.BaseController
authManagers, config, httpCallback, userAgent
-
-
Constructor Summary
Constructors Constructor Description APIController(Configuration config, HttpClient httpClient, Map<String,AuthManager> authManagers)
Initializes the controller.APIController(Configuration config, HttpClient httpClient, Map<String,AuthManager> authManagers, HttpCallback httpCallback)
Initializes the controller with HTTPCallback.
-
Method Summary
-
Methods inherited from class com.bandwidth.controllers.BaseController
getClientInstance, getHttpCallback, makeHttpCallAsync, validateResponse
-
-
-
-
Constructor Detail
-
APIController
public APIController(Configuration config, HttpClient httpClient, Map<String,AuthManager> authManagers)
Initializes the controller.- Parameters:
config
- Configurations added in client.httpClient
- Send HTTP requests and read the responses.authManagers
- Apply authorization to requests.
-
APIController
public APIController(Configuration config, HttpClient httpClient, Map<String,AuthManager> authManagers, HttpCallback httpCallback)
Initializes the controller with HTTPCallback.- Parameters:
config
- Configurations added in client.httpClient
- Send HTTP requests and read the responses.authManagers
- Apply authorization to requests.httpCallback
- Callback to be called before and after the HTTP call.
-
-
Method Detail
-
listMedia
public ApiResponse<List<Media>> listMedia(String accountId, String continuationToken) throws ApiException, IOException
listMedia.- Parameters:
accountId
- Required parameter: User's account IDcontinuationToken
- Optional parameter: Continuation token used to retrieve subsequent media.- Returns:
- Returns the List of Media wrapped in ApiResponse response from the API call
- Throws:
ApiException
- Represents error response from the server.IOException
- Signals that an I/O exception of some sort has occurred.
-
listMediaAsync
public CompletableFuture<ApiResponse<List<Media>>> listMediaAsync(String accountId, String continuationToken)
listMedia.- Parameters:
accountId
- Required parameter: User's account IDcontinuationToken
- Optional parameter: Continuation token used to retrieve subsequent media.- Returns:
- Returns the List of Media wrapped in ApiResponse response from the API call
-
getMedia
public ApiResponse<InputStream> getMedia(String accountId, String mediaId) throws ApiException, IOException
getMedia.- Parameters:
accountId
- Required parameter: User's account IDmediaId
- Required parameter: Media ID to retrieve- Returns:
- Returns the InputStream wrapped in ApiResponse response from the API call
- Throws:
ApiException
- Represents error response from the server.IOException
- Signals that an I/O exception of some sort has occurred.
-
getMediaAsync
public CompletableFuture<ApiResponse<InputStream>> getMediaAsync(String accountId, String mediaId)
getMedia.- Parameters:
accountId
- Required parameter: User's account IDmediaId
- Required parameter: Media ID to retrieve- Returns:
- Returns the InputStream wrapped in ApiResponse response from the API call
-
uploadMedia
public ApiResponse<Void> uploadMedia(String accountId, String mediaId, FileWrapper body, String contentType, String cacheControl) throws ApiException, IOException
uploadMedia.- Parameters:
accountId
- Required parameter: User's account IDmediaId
- Required parameter: The user supplied custom media IDbody
- Required parameter: Example:contentType
- Optional parameter: The media type of the entity-bodycacheControl
- Optional parameter: General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain.- Throws:
ApiException
- Represents error response from the server.IOException
- Signals that an I/O exception of some sort has occurred.
-
uploadMediaAsync
public CompletableFuture<ApiResponse<Void>> uploadMediaAsync(String accountId, String mediaId, FileWrapper body, String contentType, String cacheControl)
uploadMedia.- Parameters:
accountId
- Required parameter: User's account IDmediaId
- Required parameter: The user supplied custom media IDbody
- Required parameter: Example:contentType
- Optional parameter: The media type of the entity-bodycacheControl
- Optional parameter: General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain.- Returns:
- Returns the Void wrapped in ApiResponse response from the API call
-
deleteMedia
public ApiResponse<Void> deleteMedia(String accountId, String mediaId) throws ApiException, IOException
deleteMedia.- Parameters:
accountId
- Required parameter: User's account IDmediaId
- Required parameter: The media ID to delete- Throws:
ApiException
- Represents error response from the server.IOException
- Signals that an I/O exception of some sort has occurred.
-
deleteMediaAsync
public CompletableFuture<ApiResponse<Void>> deleteMediaAsync(String accountId, String mediaId)
deleteMedia.- Parameters:
accountId
- Required parameter: User's account IDmediaId
- Required parameter: The media ID to delete- Returns:
- Returns the Void wrapped in ApiResponse response from the API call
-
getMessages
public ApiResponse<BandwidthMessagesList> getMessages(String accountId, String messageId, String sourceTn, String destinationTn, String messageStatus, Integer errorCode, String fromDateTime, String toDateTime, String pageToken, Integer limit) throws ApiException, IOException
getMessages.- Parameters:
accountId
- Required parameter: User's account IDmessageId
- Optional parameter: The ID of the message to search for. Special characters need to be encoded using URL encodingsourceTn
- Optional parameter: The phone number that sent the messagedestinationTn
- Optional parameter: The phone number that received the messagemessageStatus
- Optional parameter: The status of the message. One of RECEIVED, QUEUED, SENDING, SENT, FAILED, DELIVERED, ACCEPTED, UNDELIVEREDerrorCode
- Optional parameter: The error code of the messagefromDateTime
- Optional parameter: 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.toDateTime
- Optional parameter: 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.pageToken
- Optional parameter: A base64 encoded value used for pagination of resultslimit
- Optional parameter: The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000- Returns:
- Returns the BandwidthMessagesList wrapped in ApiResponse response from the API call
- Throws:
ApiException
- Represents error response from the server.IOException
- Signals that an I/O exception of some sort has occurred.
-
getMessagesAsync
public CompletableFuture<ApiResponse<BandwidthMessagesList>> getMessagesAsync(String accountId, String messageId, String sourceTn, String destinationTn, String messageStatus, Integer errorCode, String fromDateTime, String toDateTime, String pageToken, Integer limit)
getMessages.- Parameters:
accountId
- Required parameter: User's account IDmessageId
- Optional parameter: The ID of the message to search for. Special characters need to be encoded using URL encodingsourceTn
- Optional parameter: The phone number that sent the messagedestinationTn
- Optional parameter: The phone number that received the messagemessageStatus
- Optional parameter: The status of the message. One of RECEIVED, QUEUED, SENDING, SENT, FAILED, DELIVERED, ACCEPTED, UNDELIVEREDerrorCode
- Optional parameter: The error code of the messagefromDateTime
- Optional parameter: 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.toDateTime
- Optional parameter: 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.pageToken
- Optional parameter: A base64 encoded value used for pagination of resultslimit
- Optional parameter: The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000- Returns:
- Returns the BandwidthMessagesList wrapped in ApiResponse response from the API call
-
createMessage
public ApiResponse<BandwidthMessage> createMessage(String accountId, MessageRequest body) throws ApiException, IOException
createMessage.- Parameters:
accountId
- Required parameter: User's account IDbody
- Required parameter: Example:- Returns:
- Returns the BandwidthMessage wrapped in ApiResponse response from the API call
- Throws:
ApiException
- Represents error response from the server.IOException
- Signals that an I/O exception of some sort has occurred.
-
createMessageAsync
public CompletableFuture<ApiResponse<BandwidthMessage>> createMessageAsync(String accountId, MessageRequest body)
createMessage.- Parameters:
accountId
- Required parameter: User's account IDbody
- Required parameter: Example:- Returns:
- Returns the BandwidthMessage wrapped in ApiResponse response from the API call
-
-