diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index f732b9de..79c5fb00 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -45,16 +45,32 @@ docs/CreateAsyncBulkLookupResponse.md docs/CreateAsyncBulkLookupResponseData.md docs/CreateCall.md docs/CreateCallResponse.md +docs/CreateEndpointRequestBase.md +docs/CreateEndpointResponse.md +docs/CreateEndpointResponseData.md docs/CreateMessageRequestError.md docs/CreateMultiChannelMessageResponse.md docs/CreateSyncLookupResponse.md docs/CreateSyncLookupResponseData.md +docs/CreateWebRtcConnectionRequest.md docs/DeactivationEventEnum.md +docs/Device.md +docs/DeviceStatusEnum.md docs/DisconnectCallback.md docs/Diversion.md docs/DtmfCallback.md +docs/Endpoint.md +docs/EndpointDirectionEnum.md +docs/EndpointEvent.md +docs/EndpointEventTypeEnum.md +docs/EndpointResponse.md +docs/EndpointStatusEnum.md +docs/EndpointTypeEnum.md +docs/Endpoints.md +docs/EndpointsApi.md docs/Error.md docs/ErrorObject.md +docs/ErrorResponse.md docs/ErrorSource.md docs/FailureWebhook.md docs/FieldError.md @@ -72,6 +88,7 @@ docs/LineTypeEnum.md docs/Link.md docs/LinkSchema.md docs/LinksObject.md +docs/ListEndpointsResponse.md docs/ListMessageDirectionEnum.md docs/ListMessageItem.md docs/LookupErrorResponse.md @@ -119,6 +136,7 @@ docs/MultiChannelMessageContent.md docs/MultiChannelMessageRequest.md docs/MultiChannelMessageResponseData.md docs/OptInWorkflow.md +docs/Page.md docs/PageInfo.md docs/PhoneNumberLookupApi.md docs/PriorityEnum.md @@ -149,6 +167,8 @@ docs/RecordingTranscriptions.md docs/RecordingsApi.md docs/RedirectCallback.md docs/RedirectMethodEnum.md +docs/SipConnectionMetadata.md +docs/SipCredentials.md docs/SmsMessageContent.md docs/StandaloneCardOrientationEnum.md docs/StatisticsApi.md @@ -215,6 +235,7 @@ src/main/java/com/bandwidth/sdk/ServerVariable.java src/main/java/com/bandwidth/sdk/StringUtil.java src/main/java/com/bandwidth/sdk/api/CallsApi.java src/main/java/com/bandwidth/sdk/api/ConferencesApi.java +src/main/java/com/bandwidth/sdk/api/EndpointsApi.java src/main/java/com/bandwidth/sdk/api/MediaApi.java src/main/java/com/bandwidth/sdk/api/MessagesApi.java src/main/java/com/bandwidth/sdk/api/MfaApi.java @@ -273,16 +294,31 @@ src/main/java/com/bandwidth/sdk/model/CreateAsyncBulkLookupResponse.java src/main/java/com/bandwidth/sdk/model/CreateAsyncBulkLookupResponseData.java src/main/java/com/bandwidth/sdk/model/CreateCall.java src/main/java/com/bandwidth/sdk/model/CreateCallResponse.java +src/main/java/com/bandwidth/sdk/model/CreateEndpointRequestBase.java +src/main/java/com/bandwidth/sdk/model/CreateEndpointResponse.java +src/main/java/com/bandwidth/sdk/model/CreateEndpointResponseData.java src/main/java/com/bandwidth/sdk/model/CreateMessageRequestError.java src/main/java/com/bandwidth/sdk/model/CreateMultiChannelMessageResponse.java src/main/java/com/bandwidth/sdk/model/CreateSyncLookupResponse.java src/main/java/com/bandwidth/sdk/model/CreateSyncLookupResponseData.java +src/main/java/com/bandwidth/sdk/model/CreateWebRtcConnectionRequest.java src/main/java/com/bandwidth/sdk/model/DeactivationEventEnum.java +src/main/java/com/bandwidth/sdk/model/Device.java +src/main/java/com/bandwidth/sdk/model/DeviceStatusEnum.java src/main/java/com/bandwidth/sdk/model/DisconnectCallback.java src/main/java/com/bandwidth/sdk/model/Diversion.java src/main/java/com/bandwidth/sdk/model/DtmfCallback.java +src/main/java/com/bandwidth/sdk/model/Endpoint.java +src/main/java/com/bandwidth/sdk/model/EndpointDirectionEnum.java +src/main/java/com/bandwidth/sdk/model/EndpointEvent.java +src/main/java/com/bandwidth/sdk/model/EndpointEventTypeEnum.java +src/main/java/com/bandwidth/sdk/model/EndpointResponse.java +src/main/java/com/bandwidth/sdk/model/EndpointStatusEnum.java +src/main/java/com/bandwidth/sdk/model/EndpointTypeEnum.java +src/main/java/com/bandwidth/sdk/model/Endpoints.java src/main/java/com/bandwidth/sdk/model/Error.java src/main/java/com/bandwidth/sdk/model/ErrorObject.java +src/main/java/com/bandwidth/sdk/model/ErrorResponse.java src/main/java/com/bandwidth/sdk/model/ErrorSource.java src/main/java/com/bandwidth/sdk/model/FailureWebhook.java src/main/java/com/bandwidth/sdk/model/FieldError.java @@ -300,6 +336,7 @@ src/main/java/com/bandwidth/sdk/model/LineTypeEnum.java src/main/java/com/bandwidth/sdk/model/Link.java src/main/java/com/bandwidth/sdk/model/LinkSchema.java src/main/java/com/bandwidth/sdk/model/LinksObject.java +src/main/java/com/bandwidth/sdk/model/ListEndpointsResponse.java src/main/java/com/bandwidth/sdk/model/ListMessageDirectionEnum.java src/main/java/com/bandwidth/sdk/model/ListMessageItem.java src/main/java/com/bandwidth/sdk/model/LookupErrorResponse.java @@ -342,6 +379,7 @@ src/main/java/com/bandwidth/sdk/model/MultiChannelMessageContent.java src/main/java/com/bandwidth/sdk/model/MultiChannelMessageRequest.java src/main/java/com/bandwidth/sdk/model/MultiChannelMessageResponseData.java src/main/java/com/bandwidth/sdk/model/OptInWorkflow.java +src/main/java/com/bandwidth/sdk/model/Page.java src/main/java/com/bandwidth/sdk/model/PageInfo.java src/main/java/com/bandwidth/sdk/model/PriorityEnum.java src/main/java/com/bandwidth/sdk/model/ProductTypeEnum.java @@ -370,6 +408,8 @@ src/main/java/com/bandwidth/sdk/model/RecordingTranscriptionMetadata.java src/main/java/com/bandwidth/sdk/model/RecordingTranscriptions.java src/main/java/com/bandwidth/sdk/model/RedirectCallback.java src/main/java/com/bandwidth/sdk/model/RedirectMethodEnum.java +src/main/java/com/bandwidth/sdk/model/SipConnectionMetadata.java +src/main/java/com/bandwidth/sdk/model/SipCredentials.java src/main/java/com/bandwidth/sdk/model/SmsMessageContent.java src/main/java/com/bandwidth/sdk/model/StandaloneCardOrientationEnum.java src/main/java/com/bandwidth/sdk/model/StatusCallback.java diff --git a/README.md b/README.md index 119e7021..cbb8cf37 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,11 @@ Class | Method | HTTP request | Description *ConferencesApi* | [**updateConference**](docs/ConferencesApi.md#updateConference) | **POST** /accounts/{accountId}/conferences/{conferenceId} | Update Conference *ConferencesApi* | [**updateConferenceBxml**](docs/ConferencesApi.md#updateConferenceBxml) | **PUT** /accounts/{accountId}/conferences/{conferenceId}/bxml | Update Conference BXML *ConferencesApi* | [**updateConferenceMember**](docs/ConferencesApi.md#updateConferenceMember) | **PUT** /accounts/{accountId}/conferences/{conferenceId}/members/{memberId} | Update Conference Member +*EndpointsApi* | [**createEndpoint**](docs/EndpointsApi.md#createEndpoint) | **POST** /accounts/{accountId}/endpoints | Create Endpoint +*EndpointsApi* | [**deleteEndpoint**](docs/EndpointsApi.md#deleteEndpoint) | **DELETE** /accounts/{accountId}/endpoints/{endpointId} | Delete Endpoint +*EndpointsApi* | [**getEndpoint**](docs/EndpointsApi.md#getEndpoint) | **GET** /accounts/{accountId}/endpoints/{endpointId} | Get Endpoint +*EndpointsApi* | [**listEndpoints**](docs/EndpointsApi.md#listEndpoints) | **GET** /accounts/{accountId}/endpoints | List Endpoints +*EndpointsApi* | [**updateEndpointBxml**](docs/EndpointsApi.md#updateEndpointBxml) | **PUT** /accounts/{accountId}/endpoints/{endpointId}/bxml | Update Endpoint BXML *MediaApi* | [**deleteMedia**](docs/MediaApi.md#deleteMedia) | **DELETE** /users/{accountId}/media/{mediaId} | Delete Media *MediaApi* | [**getMedia**](docs/MediaApi.md#getMedia) | **GET** /users/{accountId}/media/{mediaId} | Get Media *MediaApi* | [**listMedia**](docs/MediaApi.md#listMedia) | **GET** /users/{accountId}/media | List Media @@ -223,16 +228,31 @@ Class | Method | HTTP request | Description - [CreateAsyncBulkLookupResponseData](docs/CreateAsyncBulkLookupResponseData.md) - [CreateCall](docs/CreateCall.md) - [CreateCallResponse](docs/CreateCallResponse.md) + - [CreateEndpointRequestBase](docs/CreateEndpointRequestBase.md) + - [CreateEndpointResponse](docs/CreateEndpointResponse.md) + - [CreateEndpointResponseData](docs/CreateEndpointResponseData.md) - [CreateMessageRequestError](docs/CreateMessageRequestError.md) - [CreateMultiChannelMessageResponse](docs/CreateMultiChannelMessageResponse.md) - [CreateSyncLookupResponse](docs/CreateSyncLookupResponse.md) - [CreateSyncLookupResponseData](docs/CreateSyncLookupResponseData.md) + - [CreateWebRtcConnectionRequest](docs/CreateWebRtcConnectionRequest.md) - [DeactivationEventEnum](docs/DeactivationEventEnum.md) + - [Device](docs/Device.md) + - [DeviceStatusEnum](docs/DeviceStatusEnum.md) - [DisconnectCallback](docs/DisconnectCallback.md) - [Diversion](docs/Diversion.md) - [DtmfCallback](docs/DtmfCallback.md) + - [Endpoint](docs/Endpoint.md) + - [EndpointDirectionEnum](docs/EndpointDirectionEnum.md) + - [EndpointEvent](docs/EndpointEvent.md) + - [EndpointEventTypeEnum](docs/EndpointEventTypeEnum.md) + - [EndpointResponse](docs/EndpointResponse.md) + - [EndpointStatusEnum](docs/EndpointStatusEnum.md) + - [EndpointTypeEnum](docs/EndpointTypeEnum.md) + - [Endpoints](docs/Endpoints.md) - [Error](docs/Error.md) - [ErrorObject](docs/ErrorObject.md) + - [ErrorResponse](docs/ErrorResponse.md) - [ErrorSource](docs/ErrorSource.md) - [FailureWebhook](docs/FailureWebhook.md) - [FieldError](docs/FieldError.md) @@ -250,6 +270,7 @@ Class | Method | HTTP request | Description - [Link](docs/Link.md) - [LinkSchema](docs/LinkSchema.md) - [LinksObject](docs/LinksObject.md) + - [ListEndpointsResponse](docs/ListEndpointsResponse.md) - [ListMessageDirectionEnum](docs/ListMessageDirectionEnum.md) - [ListMessageItem](docs/ListMessageItem.md) - [LookupErrorResponse](docs/LookupErrorResponse.md) @@ -293,6 +314,7 @@ Class | Method | HTTP request | Description - [MultiChannelMessageRequest](docs/MultiChannelMessageRequest.md) - [MultiChannelMessageResponseData](docs/MultiChannelMessageResponseData.md) - [OptInWorkflow](docs/OptInWorkflow.md) + - [Page](docs/Page.md) - [PageInfo](docs/PageInfo.md) - [PriorityEnum](docs/PriorityEnum.md) - [ProductTypeEnum](docs/ProductTypeEnum.md) @@ -321,6 +343,8 @@ Class | Method | HTTP request | Description - [RecordingTranscriptions](docs/RecordingTranscriptions.md) - [RedirectCallback](docs/RedirectCallback.md) - [RedirectMethodEnum](docs/RedirectMethodEnum.md) + - [SipConnectionMetadata](docs/SipConnectionMetadata.md) + - [SipCredentials](docs/SipCredentials.md) - [SmsMessageContent](docs/SmsMessageContent.md) - [StandaloneCardOrientationEnum](docs/StandaloneCardOrientationEnum.md) - [StatusCallback](docs/StatusCallback.md) diff --git a/api/openapi.yaml b/api/openapi.yaml index 5aa7b0b3..5d919cdb 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -24,6 +24,7 @@ tags: - name: MFA - name: Phone Number Lookup - name: Toll-Free Verification +- name: Endpoints paths: /users/{accountId}/media: get: @@ -5833,6 +5834,594 @@ paths: servers: - description: Production url: https://api.bandwidth.com/api/v2 + /accounts/{accountId}/endpoints: + get: + description: Returns a list of endpoints associated with the specified account. + operationId: listEndpoints + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: The type of endpoint. + explode: true + in: query + name: type + required: false + schema: + $ref: "#/components/schemas/endpointTypeEnum" + style: form + - description: The status of the endpoint. + explode: true + in: query + name: status + required: false + schema: + $ref: "#/components/schemas/endpointStatusEnum" + style: form + - description: The cursor to use for pagination. This is the value of the `next` + link in the previous response. + explode: true + in: query + name: afterCursor + required: false + schema: + example: TWF5IHRoZSBmb3JjZSBiZSB3aXRoIHlvdQ== + type: string + style: form + - description: The maximum number of endpoints to return in the response. + explode: true + in: query + name: limit + required: false + schema: + default: 100 + example: 2 + maximum: 1000 + minimum: 1 + type: integer + style: form + responses: + "200": + content: + application/json: + examples: + listEndpointsResponseExample: + $ref: "#/components/examples/listEndpointsResponseExample" + schema: + $ref: "#/components/schemas/listEndpointsResponse" + description: OK + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: "#/components/examples/badRequestErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: "#/components/examples/unauthorizedErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: "#/components/examples/forbiddenErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: "#/components/examples/notFoundErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Not Found + "405": + content: + application/json: + examples: + methodNotAllowedErrorExample: + $ref: "#/components/examples/methodNotAllowedErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Method Not Allowed + "415": + content: + application/json: + examples: + unsuppotedMediaTypeErrorExample: + $ref: "#/components/examples/unsupportedMediaTypeErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: "#/components/examples/tooManyRequestsErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Too Many Requests + "500": + content: + application/json: + examples: + serviceUnavailableErrorExample: + $ref: "#/components/examples/serviceUnavailableErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Service Unavailable + summary: List Endpoints + tags: + - Endpoints + x-badges: + - name: Beta + color: "#076EA8" + x-accepts: + - application/json + post: + callbacks: + endpointEventCallback: + $ref: "#/components/callbacks/endpointEvent" + description: Creates a new Endpoint for the specified account. + operationId: createEndpoint + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + requestBody: + $ref: "#/components/requestBodies/createEndpointRequest" + responses: + "201": + content: + application/json: + examples: + createEndpointResponseExample: + $ref: "#/components/examples/createEndpointResponseExample" + schema: + $ref: "#/components/schemas/createEndpointResponse" + description: Created + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: "#/components/examples/badRequestErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: "#/components/examples/unauthorizedErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: "#/components/examples/forbiddenErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: "#/components/examples/notFoundErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Not Found + "405": + content: + application/json: + examples: + methodNotAllowedErrorExample: + $ref: "#/components/examples/methodNotAllowedErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Method Not Allowed + "415": + content: + application/json: + examples: + unsuppotedMediaTypeErrorExample: + $ref: "#/components/examples/unsupportedMediaTypeErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: "#/components/examples/tooManyRequestsErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Too Many Requests + "500": + content: + application/json: + examples: + serviceUnavailableErrorExample: + $ref: "#/components/examples/serviceUnavailableErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Service Unavailable + summary: Create Endpoint + tags: + - Endpoints + x-badges: + - name: Beta + color: "#076EA8" + x-content-type: application/json + x-accepts: + - application/json + servers: + - description: Production + url: https://api.bandwidth.com/v2 + /accounts/{accountId}/endpoints/{endpointId}: + delete: + description: "Deletes the specified endpoint. If the endpoint is actively streaming\ + \ media, the media stream will be terminated." + operationId: deleteEndpoint + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: BRTC Endpoint ID. + explode: false + in: path + name: endpointId + required: true + schema: + example: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + style: simple + responses: + "204": + description: No Content + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: "#/components/examples/badRequestErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: "#/components/examples/unauthorizedErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: "#/components/examples/forbiddenErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: "#/components/examples/notFoundErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Not Found + "405": + content: + application/json: + examples: + methodNotAllowedErrorExample: + $ref: "#/components/examples/methodNotAllowedErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Method Not Allowed + "415": + content: + application/json: + examples: + unsuppotedMediaTypeErrorExample: + $ref: "#/components/examples/unsupportedMediaTypeErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: "#/components/examples/tooManyRequestsErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Too Many Requests + "500": + content: + application/json: + examples: + serviceUnavailableErrorExample: + $ref: "#/components/examples/serviceUnavailableErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Service Unavailable + summary: Delete Endpoint + tags: + - Endpoints + x-badges: + - name: Beta + color: "#076EA8" + x-accepts: + - application/json + get: + description: Returns information about the specified endpoint. + operationId: getEndpoint + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: BRTC Endpoint ID. + explode: false + in: path + name: endpointId + required: true + schema: + example: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + style: simple + responses: + "200": + content: + application/json: + examples: + getEndpointResponseExample: + $ref: "#/components/examples/getEndpointResponseExample" + schema: + $ref: "#/components/schemas/endpointResponse" + description: OK + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: "#/components/examples/badRequestErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: "#/components/examples/unauthorizedErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: "#/components/examples/forbiddenErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: "#/components/examples/notFoundErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Not Found + "405": + content: + application/json: + examples: + methodNotAllowedErrorExample: + $ref: "#/components/examples/methodNotAllowedErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Method Not Allowed + "415": + content: + application/json: + examples: + unsuppotedMediaTypeErrorExample: + $ref: "#/components/examples/unsupportedMediaTypeErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: "#/components/examples/tooManyRequestsErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Too Many Requests + "500": + content: + application/json: + examples: + serviceUnavailableErrorExample: + $ref: "#/components/examples/serviceUnavailableErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Service Unavailable + summary: Get Endpoint + tags: + - Endpoints + x-badges: + - name: Beta + color: "#076EA8" + x-accepts: + - application/json + servers: + - description: Production + url: https://api.bandwidth.com/v2 + /accounts/{accountId}/endpoints/{endpointId}/bxml: + put: + description: Updates the BXML for the specified endpoint. + operationId: updateEndpointBxml + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: BRTC Endpoint ID. + explode: false + in: path + name: endpointId + required: true + schema: + example: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + style: simple + requestBody: + $ref: "#/components/requestBodies/updateEndpointBxmlRequest" + responses: + "204": + description: No Content + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: "#/components/examples/badRequestErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: "#/components/examples/unauthorizedErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: "#/components/examples/forbiddenErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: "#/components/examples/notFoundErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Not Found + "405": + content: + application/json: + examples: + methodNotAllowedErrorExample: + $ref: "#/components/examples/methodNotAllowedErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Method Not Allowed + "415": + content: + application/json: + examples: + unsuppotedMediaTypeErrorExample: + $ref: "#/components/examples/unsupportedMediaTypeErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: "#/components/examples/tooManyRequestsErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Too Many Requests + "500": + content: + application/json: + examples: + serviceUnavailableErrorExample: + $ref: "#/components/examples/serviceUnavailableErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Service Unavailable + summary: Update Endpoint BXML + tags: + - Endpoints + x-badges: + - name: Beta + color: "#076EA8" + x-content-type: application/xml + x-accepts: + - application/json + servers: + - description: Production + url: https://api.bandwidth.com/v2 components: callbacks: inboundCallback: @@ -5848,15 +6437,13 @@ components: $ref: "#/components/examples/mmsMessageReceivedCallbackExample" schema: $ref: "#/components/schemas/inboundCallback" - description: "

This Inbound Message Webhook is an envelope containing\ - \ either a received (MO) message to your \nmessage-enabled Bandwidth\ - \ telephone number or a multichannel client's response to a suggestion\ - \ response \nor location request. \n

The payload type will be one\ - \ of message-received, suggestion-response,\ - \ or location-request-response.\n

Note that suggestion-response\ - \ and location-request-response callback types are pertinent\ - \ only for RBM messages sent from the /messages/multiChannel\ - \ endpoint.\n

Please visit Webhooks

" + description: |- +

This Inbound Message Webhook is an envelope containing either a received (MO) message to your + message-enabled Bandwidth telephone number or a multichannel client's response to a suggestion response + or location request. +

The payload type will be one of message-received, suggestion-response, or location-request-response. +

Note that suggestion-response and location-request-response callback types are pertinent only for RBM messages sent from the /messages/multiChannel endpoint. +

Please visit Webhooks

required: true responses: "200": @@ -5990,6 +6577,20 @@ components: $ref: "#/components/schemas/tfvError" description: Service Unavailable summary: TFV status updates sent to customer's webhook URL. + endpointEvent: + '{request.body#/eventCallbackUrl}': + post: + requestBody: + content: + application/json: + examples: + endpointDisconnectedEventExample: + $ref: "#/components/examples/endpointDisconnectedEventExample" + schema: + $ref: "#/components/schemas/endpointEvent" + responses: + "204": + description: Event was successfully received. examples: smsMessageReceivedCallbackExample: summary: An example of a sms message-received callback body. @@ -6408,6 +7009,200 @@ components: type: unexpected-error description: Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time. + listEndpointsResponseExample: + summary: List Endpoints Paginated Response + value: + links: + - href: https://api.bandwidth.com/v2/accounts/5500123/endpoints?type=SIP&status=CONNECTED&limit=2 + rel: self + method: GET + - href: https://api.bandwidth.com/v2/accounts/5500123/endpoints?type=SIP&status=CONNECTED&limit=2&afterCursor=TWF5IHRoZSBmb3JjZSBiZSB3aXRoIHlvdQ== + rel: next + method: GET + page: + pageSize: 2 + totalElements: 10 + totalPages: 5 + pageNumber: 0 + data: + - endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: WEBRTC + status: CONNECTED + creationTimestamp: 2021-01-01T00:00:00Z + expirationTimestamp: 2021-01-02T00:00:00Z + tag: my-tag + - endpointId: e-2cb0-4a07-b215-b22865662d85-15ac29a2-1331029c + type: WEBRTC + status: CONNECTED + creationTimestamp: 2021-01-01T00:00:00Z + expirationTimestamp: 2021-01-02T00:00:00Z + tag: my-tag + errors: [] + createEndpointResponseExample: + summary: Create Endpoint Response + value: + links: + - href: https://api.bandwidth.com/v2/accounts/5500123/endpoints/e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + rel: endpoint + method: GET + data: + endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + token: xxxxx.yyyyy.zzzzz + type: WEBRTC + status: CONNECTED + creationTimestamp: 2021-01-01T00:00:00Z + expirationTimestamp: 2021-01-02T00:00:00Z + devices: [] + tag: my-tag + errors: [] + getEndpointResponseExample: + summary: Get Endpoint Response + value: + links: + - href: https://api.bandwidth.com/v2/accounts/5500123/endpoints/e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + rel: self + method: GET + data: + endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: WEBRTC + status: CONNECTED + creationTimestamp: 2021-01-01T00:00:00Z + expirationTimestamp: 2021-01-02T00:00:00Z + devices: [] + tag: my-tag + errors: [] + createSipEndpointRequestExample: + summary: SIP Endpoint Example + value: + type: SIP + connectionMetadata: + ipAddress: 0.0.0.0 + port: 3000 + credentials: + username: username + password: '********' + uuiHeader: 123456;encoding=jwt + direction: INBOUND + eventCallbackUrl: https://myEventCallbackUrl.com/callbacks/bandwidth + eventFallbackUrl: https://fallback.myEventCallbackUrl.com/callbacks/bandwidth + tag: "{\"myTag\": \"myTagValue\"}" + createWeRtcEndpointExample: + summary: WebRTC Endpoint Example + value: + type: WEBRTC + direction: BIDIRECTIONAL + eventCallbackUrl: https://myEventCallbackUrl.com/callbacks/bandwidth + eventFallbackUrl: https://fallback.myEventCallbackUrl.com/callbacks/bandwidth + tag: "{\"myTag\": \"myTagValue\"}" + updateEndpointBxmlRequestExample: + summary: Update Endpoint BXML Request Example + value: + endpointDisconnectedEventExample: + summary: Endpoint Disconnected Event + value: + endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: WEBRTC + status: DISCONNECTED + creationTimestamp: 2021-01-01T00:00:00Z + expirationTimestamp: 2021-01-02T00:00:00Z + eventTime: 2021-01-01T00:00:00Z + eventType: DEVICE_DISCONNECTED + tag: my-tag + badRequestErrorExample: + summary: Bad Request Error Example + value: + links: [] + data: null + errors: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: invalid_parameter + description: accountId must not contain any characters other than numbers. + code: "400" + source: + parameter: accountId + unauthorizedErrorExample: + summary: Unauthorized Error Example + value: + links: [] + data: null + errors: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: unauthorized + description: The provided credentials are not authorized to access this + resource. + code: "401" + source: + header: Authorization + forbiddenErrorExample: + summary: Forbidden Error Example + value: + links: [] + data: null + errors: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: forbidden + description: The provided credentials are not authorized to access this + resource. + code: "403" + source: + header: Authorization + notFoundErrorExample: + summary: Not Found Error Example + value: + links: [] + data: null + errors: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: resource_not_found + description: The requested resource was not found. + code: "404" + source: + reference: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + methodNotAllowedErrorExample: + summary: Method Not Allowed Error Example + value: + links: [] + data: null + errors: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: method_not_allowed + description: The requested method is not allowed on this resource. + code: "405" + source: + parameter: accountId + unsupportedMediaTypeErrorExample: + summary: Unsupported Media Type Error Example + value: + links: [] + data: null + errors: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: unsupported_media_type + description: The provided media type is not supported. + code: "415" + source: + header: Content-Type + tooManyRequestsErrorExample: + summary: Too Many Requests Error Example + value: + links: [] + data: null + errors: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: too_many_requests + description: The client has sent too many requests in a given amount of + time. + code: "429" + serviceUnavailableErrorExample: + summary: Service Unavailable Error Example + value: + links: [] + data: null + errors: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: service_unavailable + description: The service is currently unavailable. + code: "500" parameters: accountId: description: Your Bandwidth Account ID. @@ -6989,6 +7784,58 @@ components: schema: type: string style: simple + endpointId: + description: BRTC Endpoint ID. + explode: false + in: path + name: endpointId + required: true + schema: + example: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + style: simple + endpointType: + description: The type of endpoint. + explode: true + in: query + name: type + required: false + schema: + $ref: "#/components/schemas/endpointTypeEnum" + style: form + endpointStatus: + description: The status of the endpoint. + explode: true + in: query + name: status + required: false + schema: + $ref: "#/components/schemas/endpointStatusEnum" + style: form + afterCursor: + description: The cursor to use for pagination. This is the value of the `next` + link in the previous response. + explode: true + in: query + name: afterCursor + required: false + schema: + example: TWF5IHRoZSBmb3JjZSBiZSB3aXRoIHlvdQ== + type: string + style: form + limit1: + description: The maximum number of endpoints to return in the response. + explode: true + in: query + name: limit + required: false + schema: + default: 100 + example: 2 + maximum: 1000 + minimum: 1 + type: integer + style: form requestBodies: createMessageRequest: content: @@ -7342,6 +8189,27 @@ components: description: Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. required: true + createEndpointRequest: + content: + application/json: + examples: + createWebRtcEndpointRequestExample: + $ref: "#/components/examples/createWeRtcEndpointExample" + schema: + $ref: "#/components/schemas/createEndpointRequest" + required: true + updateEndpointBxmlRequest: + content: + application/xml: + examples: + updateEndpointBxmlRequestExample: + $ref: "#/components/examples/updateEndpointBxmlRequestExample" + schema: + description: |- + The BXML document to update the endpoint with. This BXML document will be executed against the endpoint when it is updated. + For more information, please refer to our [BXML documentation](/docs/voice/bxml/). + type: string + required: true responses: createMessageResponse: content: @@ -7980,37 +8848,136 @@ components: description: Method is not allowed. type: Method Not Allowed schema: - $ref: "#/components/schemas/tfvError" + $ref: "#/components/schemas/tfvError" + description: Method Not Allowed + tfvTooManyRequestsResponse: + content: + application/json: + example: + description: Throttling error. Too many requests. + type: Too Many Requests + schema: + $ref: "#/components/schemas/tfvError" + description: Too Many Requests + tfvServerErrorResponse: + content: + application/json: + example: + description: Internal Server Error. + type: Internal Server Error + schema: + $ref: "#/components/schemas/tfvError" + description: Internal Server Error + tfvServiceUnavailableResponse: + content: + application/json: + example: + description: Service Unavailable Error. + type: Service Unavailable + schema: + $ref: "#/components/schemas/tfvError" + description: Service Unavailable + verifyPutResponse: + description: Accepted + listEndpointsResponse: + content: + application/json: + examples: + listEndpointsResponseExample: + $ref: "#/components/examples/listEndpointsResponseExample" + schema: + $ref: "#/components/schemas/listEndpointsResponse" + description: OK + createEndpointResponse: + content: + application/json: + examples: + createEndpointResponseExample: + $ref: "#/components/examples/createEndpointResponseExample" + schema: + $ref: "#/components/schemas/createEndpointResponse" + description: Created + getEndpointResponse: + content: + application/json: + examples: + getEndpointResponseExample: + $ref: "#/components/examples/getEndpointResponseExample" + schema: + $ref: "#/components/schemas/endpointResponse" + description: OK + badRequestErrorResponse: + content: + application/json: + examples: + badRequestErrorExample: + $ref: "#/components/examples/badRequestErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Bad Request + unauthorizedErrorResponse: + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: "#/components/examples/unauthorizedErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Unauthorized + forbiddenErrorResponse: + content: + application/json: + examples: + forbiddenErrorExample: + $ref: "#/components/examples/forbiddenErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Forbidden + notFoundErrorResponse: + content: + application/json: + examples: + notFoundErrorExample: + $ref: "#/components/examples/notFoundErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Not Found + methodNotAllowedErrorResponse: + content: + application/json: + examples: + methodNotAllowedErrorExample: + $ref: "#/components/examples/methodNotAllowedErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" description: Method Not Allowed - tfvTooManyRequestsResponse: + unsupportedMediaTypeErrorResponse: content: application/json: - example: - description: Throttling error. Too many requests. - type: Too Many Requests + examples: + unsuppotedMediaTypeErrorExample: + $ref: "#/components/examples/unsupportedMediaTypeErrorExample" schema: - $ref: "#/components/schemas/tfvError" - description: Too Many Requests - tfvServerErrorResponse: + $ref: "#/components/schemas/errorResponse" + description: Unsupported Media Type + tooManyRequestsErrorResponse: content: application/json: - example: - description: Internal Server Error. - type: Internal Server Error + examples: + tooManyRequestsErrorExample: + $ref: "#/components/examples/tooManyRequestsErrorExample" schema: - $ref: "#/components/schemas/tfvError" - description: Internal Server Error - tfvServiceUnavailableResponse: + $ref: "#/components/schemas/errorResponse" + description: Too Many Requests + serviceUnavailableErrorResponse: content: application/json: - example: - description: Service Unavailable Error. - type: Service Unavailable + examples: + serviceUnavailableErrorExample: + $ref: "#/components/examples/serviceUnavailableErrorExample" schema: - $ref: "#/components/schemas/tfvError" + $ref: "#/components/schemas/errorResponse" description: Service Unavailable - verifyPutResponse: - description: Accepted schemas: applicationId: description: The ID of the Application your from number or senderId is associated @@ -8394,9 +9361,10 @@ components: format: date-time type: string carrierName: - description: "The name of the Authorized Message Provider (AMP) that handled\ - \ this message. \nIn the US, this is the carrier that the message was sent\ - \ to.\nThis field is present only when this account feature has been enabled." + description: |- + The name of the Authorized Message Provider (AMP) that handled this message. + In the US, this is the carrier that the message was sent to. + This field is present only when this account feature has been enabled. example: AT&T type: string message: @@ -8503,13 +9471,9 @@ components: type: array uniqueItems: true from: - description: "Either an alphanumeric sender ID or the sender's Bandwidth\ - \ phone number in E.164 format, which must be hosted within Bandwidth\ - \ and linked to the account that is generating the message. \nAlphanumeric\ - \ Sender IDs can contain up to 11 characters, upper-case letters A-Z,\ - \ lower-case letters a-z, numbers 0-9, space, hyphen -, plus +, underscore\ - \ _ and ampersand &. Alphanumeric Sender IDs must contain at least one\ - \ letter." + description: |- + Either an alphanumeric sender ID or the sender's Bandwidth phone number in E.164 format, which must be hosted within Bandwidth and linked to the account that is generating the message. + Alphanumeric Sender IDs can contain up to 11 characters, upper-case letters A-Z, lower-case letters a-z, numbers 0-9, space, hyphen -, plus +, underscore _ and ampersand &. Alphanumeric Sender IDs must contain at least one letter. example: "+15551113333" type: string text: @@ -8739,6 +9703,9 @@ components: type: array type: object link: + example: + rel: rel + href: href properties: rel: type: string @@ -9038,20 +10005,21 @@ components: example: REPLY type: string rbmOpenUrlEnum: - description: "Specifies how the URL should be opened on a mobile device.\n-\ - \ `BROWSER` Opens the URL in the device's default browser. If application\ - \ is not set or the device doesn’t support WebView, this option is used by\ - \ default. \n- `WEBVIEW` Opens the URL in an in-app WebView." + description: |- + Specifies how the URL should be opened on a mobile device. + - `BROWSER` Opens the URL in the device's default browser. If application is not set or the device doesn’t support WebView, this option is used by default. + - `WEBVIEW` Opens the URL in an in-app WebView. enum: - BROWSER - WEBVIEW example: WEBVIEW type: string rbmWebViewEnum: - description: "Defines the layout of the WebView on a mobile device. It must\ - \ be defined when application is set to `WEBVIEW`\n- `FULL` WebView takes\ - \ the full screen. \n- `HALF` WebView takes half of the screen.\n- `TALL`\ - \ WebView takes three-quarters of the screen." + description: |- + Defines the layout of the WebView on a mobile device. It must be defined when application is set to `WEBVIEW` + - `FULL` WebView takes the full screen. + - `HALF` WebView takes half of the screen. + - `TALL` WebView takes three-quarters of the screen. enum: - FULL - HALF @@ -9614,10 +10582,10 @@ components: example: 4405 type: integer carrierName: - description: "The name of the Authorized Message Provider (AMP) that handled\ - \ this message. \nIn the US, this is the carrier that the message was\ - \ sent to.\nThis field is present only when this account feature has been\ - \ enabled." + description: |- + The name of the Authorized Message Provider (AMP) that handled this message. + In the US, this is the carrier that the message was sent to. + This field is present only when this account feature has been enabled. example: AT&T type: string required: @@ -9637,9 +10605,9 @@ components: type: $ref: "#/components/schemas/inboundCallbackTypeEnum" to: - description: "The destination phone number the message was sent to. \nFor\ - \ inbound callbacks, this is the Bandwidth number or alphanumeric identifier\ - \ that received the message.\n" + description: | + The destination phone number the message was sent to. + For inbound callbacks, this is the Bandwidth number or alphanumeric identifier that received the message. example: "+15552223333" type: string description: @@ -9649,10 +10617,10 @@ components: message: $ref: "#/components/schemas/inboundCallbackMessage" carrierName: - description: "The name of the Authorized Message Provider (AMP) that handled\ - \ this message. \nIn the US, this is the carrier that the message was\ - \ sent to.\nThis field is present only when this account feature has been\ - \ enabled." + description: |- + The name of the Authorized Message Provider (AMP) that handled this message. + In the US, this is the carrier that the message was sent to. + This field is present only when this account feature has been enabled. example: AT&T type: string required: @@ -9677,13 +10645,11 @@ components: example: message-delivered type: string inboundCallbackTypeEnum: - description: "The possible inbound callback types originating from MO messages\ - \ or multichannel message client responses:\n- `message-received` indicates\ - \ an MO message from a Bandwidth user's client to a Bandwidth number.\n- `request-location-response`\ - \ indicates a response to a location request sent by the Bandwidth user's\ - \ client after receiving an RBM message. \n- `suggestion-response` indicates\ - \ a response to a suggestion sent by the Bandwidth user's client after receiving\ - \ an RBM message." + description: |- + The possible inbound callback types originating from MO messages or multichannel message client responses: + - `message-received` indicates an MO message from a Bandwidth user's client to a Bandwidth number. + - `request-location-response` indicates a response to a location request sent by the Bandwidth user's client after receiving an RBM message. + - `suggestion-response` indicates a response to a suggestion sent by the Bandwidth user's client after receiving an RBM message. enum: - message-received - request-location-response @@ -9901,10 +10867,10 @@ components: nullable: true type: boolean displayName: - description: "The caller display name to use when the call is created. \n\ - May not exceed 256 characters nor contain control characters such as new\ - \ lines.\nIf `privacy` is true, only the following values are valid: `Restricted`,\ - \ `Anonymous`, `Private`, or `Unavailable`." + description: |- + The caller display name to use when the call is created. + May not exceed 256 characters nor contain control characters such as new lines. + If `privacy` is true, only the following values are valid: `Restricted`, `Anonymous`, `Private`, or `Unavailable`. example: John Doe maxLength: 256 nullable: true @@ -10869,9 +11835,9 @@ components: nullable: true type: number machineSpeechEndThreshold: - description: "When an answering machine is detected, the amount of silence\ - \ (in seconds) before assuming the message has finished playing. \nIf\ - \ not provided it will default to the speechEndThreshold value." + description: |- + When an answering machine is detected, the amount of silence (in seconds) before assuming the message has finished playing. + If not provided it will default to the speechEndThreshold value. example: 5 format: double nullable: true @@ -13641,18 +14607,18 @@ components: latestMessageDeliveryStatus: $ref: "#/components/schemas/latestMessageDeliveryStatusEnum" initialMessageDeliveryStatusDate: - description: "[DNI-Only](#section/DNI-Only). The date the phone number entered\ - \ the status described in `latestMessageDeliveryStatus`. \nThink of this\ - \ as the \"start time\" for that status.\nValue resets every time the\ - \ `latestMessageDeliveryStatus` changes." + description: |- + [DNI-Only](#section/DNI-Only). The date the phone number entered the status described in `latestMessageDeliveryStatus`. + Think of this as the "start time" for that status. + Value resets every time the `latestMessageDeliveryStatus` changes. example: 2025-06-20 format: date type: string latestMessageDeliveryStatusDate: - description: "[DNI-Only](#section/DNI-Only). The date bandwidth last received\ - \ delivery status information for this phone number. \nUse this field\ - \ to understand how up-to-date the `latestMessageDeliveryStatus` is.\n\ - Value resets every time the `latestMessageDeliveryStatus` changes." + description: |- + [DNI-Only](#section/DNI-Only). The date bandwidth last received delivery status information for this phone number. + Use this field to understand how up-to-date the `latestMessageDeliveryStatus` is. + Value resets every time the `latestMessageDeliveryStatus` changes. example: 2025-06-21 format: date type: string @@ -14911,6 +15877,474 @@ components: minLength: 0 nullable: true type: string + endpointId: + description: The unique ID of the endpoint. + example: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + endpointStatusEnum: + enum: + - CONNECTED + - DISCONNECTED + type: string + deviceStatusEnum: + enum: + - CONNECTED + - DISCONNECTED + type: string + endpointTypeEnum: + enum: + - WEBRTC + type: string + endpointDirectionEnum: + enum: + - INBOUND + - OUTBOUND + - BIDIRECTIONAL + type: string + sipCredentials: + properties: + username: + description: The username for the SIP connection. + example: username + type: string + password: + description: The password for the SIP connection. + example: password + type: string + type: object + sipConnectionMetadata: + properties: + ipAddress: + description: The IP address of the SIP connection. + example: 192.168.0.0 + format: ipv4 + type: string + port: + description: The port of the SIP connection. + example: 5060 + type: integer + credentials: + $ref: "#/components/schemas/sipCredentials" + uuiHeader: + description: The User-to-User Information header for the SIP connection. + example: my-uui-header + type: string + title: SIP Connection + type: object + webRtcConnectionMetadata: + title: WebRTC Connection + type: object + endpointToken: + description: The json web token specific to the endpoint. Used to authenticate + the client with the media gateway. + example: xxxxx.yyyyy.zzzzz + type: string + endpointTag: + description: A tag for the endpoint. + example: my-tag + maximum: 1024 + type: string + device: + example: + creationTimestamp: 2021-01-01T00:00:00Z + deviceId: d-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + deviceName: David's iPhone + status: CONNECTED + properties: + deviceId: + description: The unique ID of the device. + example: d-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + deviceName: + description: The name of the device. + example: David's iPhone + maximum: 1024 + type: string + status: + $ref: "#/components/schemas/deviceStatusEnum" + creationTimestamp: + description: The time the device was created. In ISO-8601 format. + example: 2021-01-01T00:00:00Z + format: date-time + type: string + required: + - creationTimestamp + - deviceId + - status + type: object + endpoints: + example: + endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + creationTimestamp: 2021-01-01T00:00:00Z + expirationTimestamp: 2021-01-02T00:00:00Z + tag: my-tag + type: WEBRTC + status: CONNECTED + properties: + endpointId: + description: The unique ID of the endpoint. + example: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + type: + $ref: "#/components/schemas/endpointTypeEnum" + status: + $ref: "#/components/schemas/endpointStatusEnum" + creationTimestamp: + description: The time the endpoint was created. In ISO-8601 format. + example: 2021-01-01T00:00:00Z + format: date-time + type: string + expirationTimestamp: + description: The time the endpoint token will expire. In ISO-8601 format. + Tokens last 24 hours. + example: 2021-01-02T00:00:00Z + format: date-time + type: string + tag: + description: A tag for the endpoint. + example: my-tag + maximum: 1024 + type: string + required: + - creationTimestamp + - endpointId + - expirationTimestamp + - status + - type + type: object + endpoint: + allOf: + - $ref: "#/components/schemas/endpoints" + - properties: + devices: + items: + $ref: "#/components/schemas/device" + type: array + type: object + example: + devices: + - creationTimestamp: 2021-01-01T00:00:00Z + deviceId: d-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + deviceName: David's iPhone + status: CONNECTED + - creationTimestamp: 2021-01-01T00:00:00Z + deviceId: d-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + deviceName: David's iPhone + status: CONNECTED + endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + creationTimestamp: 2021-01-01T00:00:00Z + expirationTimestamp: 2021-01-02T00:00:00Z + tag: my-tag + type: WEBRTC + status: CONNECTED + type: object + createWebRtcConnectionRequest: + allOf: + - $ref: "#/components/schemas/createEndpointRequestBase" + - properties: + connectionMetadata: + $ref: "#/components/schemas/webRtcConnectionMetadata" + type: object + createEndpointRequestBase: + properties: + type: + $ref: "#/components/schemas/endpointTypeEnum" + direction: + $ref: "#/components/schemas/endpointDirectionEnum" + eventCallbackUrl: + description: The URL to send event callbacks to. + example: https://myapp.com/callback + format: uri + type: string + eventFallbackUrl: + description: The URL to send event fallbacks to. + example: https://fallback.myapp.com/callback + format: uri + type: string + tag: + description: A tag for the endpoint. + example: my-tag + maximum: 1024 + type: string + required: + - direction + - type + type: object + createEndpointRequest: + $ref: "#/components/schemas/createWebRtcConnectionRequest" + createEndpointResponseData: + allOf: + - $ref: "#/components/schemas/endpoint" + - properties: + token: + $ref: "#/components/schemas/endpointToken" + required: + - token + type: object + example: + devices: + - creationTimestamp: 2021-01-01T00:00:00Z + deviceId: d-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + deviceName: David's iPhone + status: CONNECTED + - creationTimestamp: 2021-01-01T00:00:00Z + deviceId: d-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + deviceName: David's iPhone + status: CONNECTED + endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + creationTimestamp: 2021-01-01T00:00:00Z + expirationTimestamp: 2021-01-02T00:00:00Z + tag: my-tag + type: WEBRTC + status: CONNECTED + token: xxxxx.yyyyy.zzzzz + endpointEventTypeEnum: + enum: + - DEVICE_CONNECTED + - DEVICE_DISCONNECTED + type: string + endpointEvent: + allOf: + - $ref: "#/components/schemas/endpoints" + - properties: + eventTime: + description: The time the event occurred. In ISO-8601 format. + example: 2021-01-01T00:00:00Z + format: date-time + type: string + eventType: + $ref: "#/components/schemas/endpointEventTypeEnum" + device: + $ref: "#/components/schemas/device" + required: + - eventTime + - eventType + type: object + description: An event that occurred on an endpoint. + page: + example: + pageNumber: 0 + totalPages: 10 + pageSize: 10 + totalElements: 100 + properties: + pageSize: + description: The number of items per page. + example: 10 + minimum: 0 + type: integer + totalElements: + description: The total number of items. + example: 100 + minimum: 0 + type: integer + totalPages: + description: The total number of pages. + example: 10 + minimum: 0 + type: integer + pageNumber: + description: The current page number. + example: 0 + minimum: 0 + type: integer + required: + - pageSize + type: object + listEndpointsResponse: + example: + data: + - endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + creationTimestamp: 2021-01-01T00:00:00Z + expirationTimestamp: 2021-01-02T00:00:00Z + tag: my-tag + type: WEBRTC + status: CONNECTED + - endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + creationTimestamp: 2021-01-01T00:00:00Z + expirationTimestamp: 2021-01-02T00:00:00Z + tag: my-tag + type: WEBRTC + status: CONNECTED + links: + - rel: rel + href: href + - rel: rel + href: href + page: + pageNumber: 0 + totalPages: 10 + pageSize: 10 + totalElements: 100 + errors: + - code: 0 + telephoneNumbers: + - telephoneNumber: telephoneNumber + - telephoneNumber: telephoneNumber + description: description + - code: 0 + telephoneNumbers: + - telephoneNumber: telephoneNumber + - telephoneNumber: telephoneNumber + description: description + properties: + links: + items: + $ref: "#/components/schemas/link" + type: array + page: + $ref: "#/components/schemas/page" + data: + items: + $ref: "#/components/schemas/endpoints" + type: array + errors: + items: + $ref: "#/components/schemas/error" + type: array + required: + - data + - errors + - links + type: object + endpointResponse: + example: + data: + devices: + - creationTimestamp: 2021-01-01T00:00:00Z + deviceId: d-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + deviceName: David's iPhone + status: CONNECTED + - creationTimestamp: 2021-01-01T00:00:00Z + deviceId: d-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + deviceName: David's iPhone + status: CONNECTED + endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + creationTimestamp: 2021-01-01T00:00:00Z + expirationTimestamp: 2021-01-02T00:00:00Z + tag: my-tag + type: WEBRTC + status: CONNECTED + links: + - rel: rel + href: href + - rel: rel + href: href + errors: + - code: 0 + telephoneNumbers: + - telephoneNumber: telephoneNumber + - telephoneNumber: telephoneNumber + description: description + - code: 0 + telephoneNumbers: + - telephoneNumber: telephoneNumber + - telephoneNumber: telephoneNumber + description: description + properties: + links: + items: + $ref: "#/components/schemas/link" + type: array + data: + $ref: "#/components/schemas/endpoint" + errors: + items: + $ref: "#/components/schemas/error" + type: array + required: + - data + - errors + - links + type: object + createEndpointResponse: + example: + data: + devices: + - creationTimestamp: 2021-01-01T00:00:00Z + deviceId: d-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + deviceName: David's iPhone + status: CONNECTED + - creationTimestamp: 2021-01-01T00:00:00Z + deviceId: d-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + deviceName: David's iPhone + status: CONNECTED + endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + creationTimestamp: 2021-01-01T00:00:00Z + expirationTimestamp: 2021-01-02T00:00:00Z + tag: my-tag + type: WEBRTC + status: CONNECTED + token: xxxxx.yyyyy.zzzzz + links: + - rel: rel + href: href + - rel: rel + href: href + errors: + - code: 0 + telephoneNumbers: + - telephoneNumber: telephoneNumber + - telephoneNumber: telephoneNumber + description: description + - code: 0 + telephoneNumbers: + - telephoneNumber: telephoneNumber + - telephoneNumber: telephoneNumber + description: description + properties: + links: + items: + $ref: "#/components/schemas/link" + type: array + data: + $ref: "#/components/schemas/createEndpointResponseData" + errors: + items: + $ref: "#/components/schemas/error" + type: array + required: + - data + - errors + - links + type: object + errorResponse: + example: + data: "{}" + links: + - rel: rel + href: href + - rel: rel + href: href + errors: + - code: 0 + telephoneNumbers: + - telephoneNumber: telephoneNumber + - telephoneNumber: telephoneNumber + description: description + - code: 0 + telephoneNumbers: + - telephoneNumber: telephoneNumber + - telephoneNumber: telephoneNumber + description: description + properties: + links: + items: + $ref: "#/components/schemas/link" + type: array + data: + additionalProperties: false + nullable: true + type: object + errors: + items: + $ref: "#/components/schemas/error" + type: array + required: + - data + - errors + - links + type: object rbmCardContent_media: allOf: - $ref: "#/components/schemas/rbmMessageContentFile" diff --git a/bandwidth.yml b/bandwidth.yml index 4948dd1d..bff363f2 100644 --- a/bandwidth.yml +++ b/bandwidth.yml @@ -22,6 +22,7 @@ tags: - name: MFA - name: Phone Number Lookup - name: Toll-Free Verification + - name: Endpoints paths: /users/{accountId}/media: get: @@ -1690,6 +1691,180 @@ paths: '503': $ref: '#/components/responses/tfvServiceUnavailableResponse' servers: *ref_4 + /accounts/{accountId}/endpoints: + get: + tags: + - Endpoints + summary: List Endpoints + description: Returns a list of endpoints associated with the specified account. + operationId: listEndpoints + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/endpointType' + - $ref: '#/components/parameters/endpointStatus' + - $ref: '#/components/parameters/afterCursor' + - $ref: '#/components/parameters/limit1' + responses: + '200': + $ref: '#/components/responses/listEndpointsResponse' + '400': + $ref: '#/components/responses/badRequestErrorResponse' + '401': + $ref: '#/components/responses/unauthorizedErrorResponse' + '403': + $ref: '#/components/responses/forbiddenErrorResponse' + '404': + $ref: '#/components/responses/notFoundErrorResponse' + '405': + $ref: '#/components/responses/methodNotAllowedErrorResponse' + '415': + $ref: '#/components/responses/unsupportedMediaTypeErrorResponse' + '429': + $ref: '#/components/responses/tooManyRequestsErrorResponse' + '500': + $ref: '#/components/responses/serviceUnavailableErrorResponse' + x-badges: + - name: Beta + color: '#076EA8' + post: + tags: + - Endpoints + summary: Create Endpoint + description: Creates a new Endpoint for the specified account. + operationId: createEndpoint + parameters: + - $ref: '#/components/parameters/accountId' + requestBody: + $ref: '#/components/requestBodies/createEndpointRequest' + responses: + '201': + $ref: '#/components/responses/createEndpointResponse' + '400': + $ref: '#/components/responses/badRequestErrorResponse' + '401': + $ref: '#/components/responses/unauthorizedErrorResponse' + '403': + $ref: '#/components/responses/forbiddenErrorResponse' + '404': + $ref: '#/components/responses/notFoundErrorResponse' + '405': + $ref: '#/components/responses/methodNotAllowedErrorResponse' + '415': + $ref: '#/components/responses/unsupportedMediaTypeErrorResponse' + '429': + $ref: '#/components/responses/tooManyRequestsErrorResponse' + '500': + $ref: '#/components/responses/serviceUnavailableErrorResponse' + callbacks: + endpointEventCallback: + $ref: '#/components/callbacks/endpointEvent' + x-badges: + - name: Beta + color: '#076EA8' + servers: &ref_5 + - url: https://api.bandwidth.com/v2 + description: Production + /accounts/{accountId}/endpoints/{endpointId}: + get: + tags: + - Endpoints + summary: Get Endpoint + description: Returns information about the specified endpoint. + operationId: getEndpoint + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/endpointId' + responses: + '200': + $ref: '#/components/responses/getEndpointResponse' + '400': + $ref: '#/components/responses/badRequestErrorResponse' + '401': + $ref: '#/components/responses/unauthorizedErrorResponse' + '403': + $ref: '#/components/responses/forbiddenErrorResponse' + '404': + $ref: '#/components/responses/notFoundErrorResponse' + '405': + $ref: '#/components/responses/methodNotAllowedErrorResponse' + '415': + $ref: '#/components/responses/unsupportedMediaTypeErrorResponse' + '429': + $ref: '#/components/responses/tooManyRequestsErrorResponse' + '500': + $ref: '#/components/responses/serviceUnavailableErrorResponse' + x-badges: + - name: Beta + color: '#076EA8' + delete: + tags: + - Endpoints + summary: Delete Endpoint + description: >- + Deletes the specified endpoint. If the endpoint is actively streaming + media, the media stream will be terminated. + operationId: deleteEndpoint + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/endpointId' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/badRequestErrorResponse' + '401': + $ref: '#/components/responses/unauthorizedErrorResponse' + '403': + $ref: '#/components/responses/forbiddenErrorResponse' + '404': + $ref: '#/components/responses/notFoundErrorResponse' + '405': + $ref: '#/components/responses/methodNotAllowedErrorResponse' + '415': + $ref: '#/components/responses/unsupportedMediaTypeErrorResponse' + '429': + $ref: '#/components/responses/tooManyRequestsErrorResponse' + '500': + $ref: '#/components/responses/serviceUnavailableErrorResponse' + x-badges: + - name: Beta + color: '#076EA8' + servers: *ref_5 + /accounts/{accountId}/endpoints/{endpointId}/bxml: + put: + tags: + - Endpoints + summary: Update Endpoint BXML + description: Updates the BXML for the specified endpoint. + operationId: updateEndpointBxml + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/endpointId' + requestBody: + $ref: '#/components/requestBodies/updateEndpointBxmlRequest' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/badRequestErrorResponse' + '401': + $ref: '#/components/responses/unauthorizedErrorResponse' + '403': + $ref: '#/components/responses/forbiddenErrorResponse' + '404': + $ref: '#/components/responses/notFoundErrorResponse' + '405': + $ref: '#/components/responses/methodNotAllowedErrorResponse' + '415': + $ref: '#/components/responses/unsupportedMediaTypeErrorResponse' + '429': + $ref: '#/components/responses/tooManyRequestsErrorResponse' + '500': + $ref: '#/components/responses/serviceUnavailableErrorResponse' + x-badges: + - name: Beta + color: '#076EA8' + servers: *ref_5 components: schemas: applicationId: @@ -1984,7 +2159,7 @@ components: type: string description: >- The name of the Authorized Message Provider (AMP) that handled this - message. + message. In the US, this is the carrier that the message was sent to. @@ -2071,7 +2246,7 @@ components: description: >- Either an alphanumeric sender ID or the sender's Bandwidth phone number in E.164 format, which must be hosted within Bandwidth and - linked to the account that is generating the message. + linked to the account that is generating the message. Alphanumeric Sender IDs can contain up to 11 characters, upper-case letters A-Z, lower-case letters a-z, numbers 0-9, space, hyphen -, @@ -2395,7 +2570,7 @@ components: - `BROWSER` Opens the URL in the device's default browser. If application is not set or the device doesn’t support WebView, this - option is used by default. + option is used by default. - `WEBVIEW` Opens the URL in an in-app WebView. enum: @@ -2408,7 +2583,7 @@ components: Defines the layout of the WebView on a mobile device. It must be defined when application is set to `WEBVIEW` - - `FULL` WebView takes the full screen. + - `FULL` WebView takes the full screen. - `HALF` WebView takes half of the screen. @@ -2809,7 +2984,7 @@ components: to: type: string description: > - The destination phone number the message was sent to. + The destination phone number the message was sent to. For inbound callbacks, this is the Bandwidth number or alphanumeric identifier that received the message. @@ -2860,7 +3035,7 @@ components: client to a Bandwidth number. - `request-location-response` indicates a response to a location request - sent by the Bandwidth user's client after receiving an RBM message. + sent by the Bandwidth user's client after receiving an RBM message. - `suggestion-response` indicates a response to a suggestion sent by the Bandwidth user's client after receiving an RBM message. @@ -3099,7 +3274,7 @@ components: nullable: true type: string description: >- - The caller display name to use when the call is created. + The caller display name to use when the call is created. May not exceed 256 characters nor contain control characters such as new lines. @@ -4036,7 +4211,7 @@ components: format: double description: >- When an answering machine is detected, the amount of silence (in - seconds) before assuming the message has finished playing. + seconds) before assuming the message has finished playing. If not provided it will default to the speechEndThreshold value. example: 5 @@ -5739,7 +5914,7 @@ components: format: date description: >- [DNI-Only](#section/DNI-Only). The date the phone number entered the - status described in `latestMessageDeliveryStatus`. + status described in `latestMessageDeliveryStatus`. Think of this as the "start time" for that status. @@ -5750,7 +5925,7 @@ components: format: date description: >- [DNI-Only](#section/DNI-Only). The date bandwidth last received - delivery status information for this phone number. + delivery status information for this phone number. Use this field to understand how up-to-date the `latestMessageDeliveryStatus` is. @@ -6611,6 +6786,303 @@ components: nullable: true example: >- cv.user123|sess456|mno|tfree|read_write|X7yZ9aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVw + endpointId: + type: string + description: The unique ID of the endpoint. + example: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + endpointStatusEnum: + type: string + enum: + - CONNECTED + - DISCONNECTED + deviceStatusEnum: + type: string + enum: + - CONNECTED + - DISCONNECTED + endpointTypeEnum: + type: string + enum: + - WEBRTC + endpointDirectionEnum: + type: string + enum: + - INBOUND + - OUTBOUND + - BIDIRECTIONAL + sipCredentials: + type: object + properties: + username: + type: string + description: The username for the SIP connection. + example: username + password: + type: string + description: The password for the SIP connection. + example: password + sipConnectionMetadata: + title: SIP Connection + type: object + properties: + ipAddress: + type: string + format: ipv4 + description: The IP address of the SIP connection. + example: 192.168.0.0 + port: + type: integer + description: The port of the SIP connection. + example: 5060 + credentials: + $ref: '#/components/schemas/sipCredentials' + uuiHeader: + type: string + description: The User-to-User Information header for the SIP connection. + example: my-uui-header + webRtcConnectionMetadata: + title: WebRTC Connection + type: object + endpointToken: + type: string + description: >- + The json web token specific to the endpoint. Used to authenticate the + client with the media gateway. + example: xxxxx.yyyyy.zzzzz + endpointTag: + type: string + description: A tag for the endpoint. + example: my-tag + maximum: 1024 + device: + type: object + properties: + deviceId: + type: string + description: The unique ID of the device. + example: d-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + deviceName: + type: string + description: The name of the device. + maximum: 1024 + example: David's iPhone + status: + $ref: '#/components/schemas/deviceStatusEnum' + creationTimestamp: + type: string + format: date-time + description: The time the device was created. In ISO-8601 format. + example: '2021-01-01T00:00:00Z' + required: + - deviceId + - status + - creationTimestamp + endpoints: + type: object + properties: + endpointId: + $ref: '#/components/schemas/endpointId' + type: + $ref: '#/components/schemas/endpointTypeEnum' + status: + $ref: '#/components/schemas/endpointStatusEnum' + creationTimestamp: + type: string + format: date-time + description: The time the endpoint was created. In ISO-8601 format. + example: '2021-01-01T00:00:00Z' + expirationTimestamp: + type: string + format: date-time + description: >- + The time the endpoint token will expire. In ISO-8601 format. Tokens + last 24 hours. + example: '2021-01-02T00:00:00Z' + tag: + $ref: '#/components/schemas/endpointTag' + required: + - endpointId + - type + - status + - creationTimestamp + - expirationTimestamp + endpoint: + type: object + allOf: + - $ref: '#/components/schemas/endpoints' + - type: object + properties: + devices: + type: array + items: + $ref: '#/components/schemas/device' + createWebRtcConnectionRequest: + allOf: + - $ref: '#/components/schemas/createEndpointRequestBase' + - type: object + properties: + connectionMetadata: + $ref: '#/components/schemas/webRtcConnectionMetadata' + createEndpointRequestBase: + type: object + properties: + type: + $ref: '#/components/schemas/endpointTypeEnum' + direction: + $ref: '#/components/schemas/endpointDirectionEnum' + eventCallbackUrl: + type: string + format: uri + description: The URL to send event callbacks to. + example: https://myapp.com/callback + eventFallbackUrl: + type: string + format: uri + description: The URL to send event fallbacks to. + example: https://fallback.myapp.com/callback + tag: + $ref: '#/components/schemas/endpointTag' + required: + - type + - direction + createEndpointRequest: + oneOf: + - $ref: '#/components/schemas/createWebRtcConnectionRequest' + discriminator: + propertyName: type + mapping: + WEBRTC: '#/components/schemas/createWebRtcConnectionRequest' + createEndpointResponseData: + allOf: + - $ref: '#/components/schemas/endpoint' + - type: object + properties: + token: + $ref: '#/components/schemas/endpointToken' + required: + - token + endpointEventTypeEnum: + type: string + enum: + - DEVICE_CONNECTED + - DEVICE_DISCONNECTED + endpointEvent: + description: An event that occurred on an endpoint. + allOf: + - $ref: '#/components/schemas/endpoints' + - type: object + properties: + eventTime: + type: string + format: date-time + description: The time the event occurred. In ISO-8601 format. + example: '2021-01-01T00:00:00Z' + eventType: + $ref: '#/components/schemas/endpointEventTypeEnum' + device: + $ref: '#/components/schemas/device' + required: + - eventType + - eventTime + page: + type: object + properties: + pageSize: + type: integer + description: The number of items per page. + minimum: 0 + example: 10 + totalElements: + type: integer + description: The total number of items. + minimum: 0 + example: 100 + totalPages: + type: integer + description: The total number of pages. + minimum: 0 + example: 10 + pageNumber: + type: integer + description: The current page number. + minimum: 0 + example: 0 + required: + - pageSize + listEndpointsResponse: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/link' + page: + $ref: '#/components/schemas/page' + data: + type: array + items: + $ref: '#/components/schemas/endpoints' + errors: + type: array + items: + $ref: '#/components/schemas/error' + required: + - links + - data + - errors + endpointResponse: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/link' + data: + $ref: '#/components/schemas/endpoint' + errors: + type: array + items: + $ref: '#/components/schemas/error' + required: + - links + - data + - errors + createEndpointResponse: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/link' + data: + $ref: '#/components/schemas/createEndpointResponseData' + errors: + type: array + items: + $ref: '#/components/schemas/error' + required: + - links + - data + - errors + errorResponse: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/link' + data: + type: object + nullable: true + additionalProperties: false + errors: + type: array + items: + $ref: '#/components/schemas/error' + required: + - links + - data + - errors responses: createMessageResponse: description: Accepted @@ -7281,6 +7753,105 @@ components: type: Service Unavailable verifyPutResponse: description: Accepted + listEndpointsResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/listEndpointsResponse' + examples: + listEndpointsResponseExample: + $ref: '#/components/examples/listEndpointsResponseExample' + createEndpointResponse: + description: Created + content: + application/json: + schema: + $ref: '#/components/schemas/createEndpointResponse' + examples: + createEndpointResponseExample: + $ref: '#/components/examples/createEndpointResponseExample' + getEndpointResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/endpointResponse' + examples: + getEndpointResponseExample: + $ref: '#/components/examples/getEndpointResponseExample' + badRequestErrorResponse: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/errorResponse' + examples: + badRequestErrorExample: + $ref: '#/components/examples/badRequestErrorExample' + unauthorizedErrorResponse: + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/errorResponse' + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/unauthorizedErrorExample' + forbiddenErrorResponse: + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/errorResponse' + examples: + forbiddenErrorExample: + $ref: '#/components/examples/forbiddenErrorExample' + notFoundErrorResponse: + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/errorResponse' + examples: + notFoundErrorExample: + $ref: '#/components/examples/notFoundErrorExample' + methodNotAllowedErrorResponse: + description: Method Not Allowed + content: + application/json: + schema: + $ref: '#/components/schemas/errorResponse' + examples: + methodNotAllowedErrorExample: + $ref: '#/components/examples/methodNotAllowedErrorExample' + unsupportedMediaTypeErrorResponse: + description: Unsupported Media Type + content: + application/json: + schema: + $ref: '#/components/schemas/errorResponse' + examples: + unsuppotedMediaTypeErrorExample: + $ref: '#/components/examples/unsupportedMediaTypeErrorExample' + tooManyRequestsErrorResponse: + description: Too Many Requests + content: + application/json: + schema: + $ref: '#/components/schemas/errorResponse' + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/tooManyRequestsErrorExample' + serviceUnavailableErrorResponse: + description: Service Unavailable + content: + application/json: + schema: + $ref: '#/components/schemas/errorResponse' + examples: + serviceUnavailableErrorExample: + $ref: '#/components/examples/serviceUnavailableErrorExample' parameters: accountId: in: path @@ -7780,6 +8351,45 @@ components: type: string description: Webhook subscription ID example: 7bt57JcsVYJrN9K1OcV1Nu + endpointId: + name: endpointId + in: path + required: true + schema: + type: string + example: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + description: BRTC Endpoint ID. + endpointType: + name: type + in: query + schema: + $ref: '#/components/schemas/endpointTypeEnum' + description: The type of endpoint. + endpointStatus: + name: status + in: query + schema: + $ref: '#/components/schemas/endpointStatusEnum' + description: The status of the endpoint. + afterCursor: + name: afterCursor + in: query + schema: + type: string + example: TWF5IHRoZSBmb3JjZSBiZSB3aXRoIHlvdQ== + description: >- + The cursor to use for pagination. This is the value of the `next` link + in the previous response. + limit1: + name: limit + in: query + schema: + type: integer + minimum: 1 + maximum: 1000 + default: 100 + example: 2 + description: The maximum number of endpoints to return in the response. examples: smsMessageReceivedCallbackExample: summary: An example of a sms message-received callback body. @@ -8204,6 +8814,205 @@ components: Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time. + listEndpointsResponseExample: + summary: List Endpoints Paginated Response + value: + links: + - href: >- + https://api.bandwidth.com/v2/accounts/5500123/endpoints?type=SIP&status=CONNECTED&limit=2 + rel: self + method: GET + - href: >- + https://api.bandwidth.com/v2/accounts/5500123/endpoints?type=SIP&status=CONNECTED&limit=2&afterCursor=TWF5IHRoZSBmb3JjZSBiZSB3aXRoIHlvdQ== + rel: next + method: GET + page: + pageSize: 2 + totalElements: 10 + totalPages: 5 + pageNumber: 0 + data: + - endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: WEBRTC + status: CONNECTED + creationTimestamp: '2021-01-01T00:00:00Z' + expirationTimestamp: '2021-01-02T00:00:00Z' + tag: my-tag + - endpointId: e-2cb0-4a07-b215-b22865662d85-15ac29a2-1331029c + type: WEBRTC + status: CONNECTED + creationTimestamp: '2021-01-01T00:00:00Z' + expirationTimestamp: '2021-01-02T00:00:00Z' + tag: my-tag + errors: [] + createEndpointResponseExample: + summary: Create Endpoint Response + value: + links: + - href: >- + https://api.bandwidth.com/v2/accounts/5500123/endpoints/e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + rel: endpoint + method: GET + data: + endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + token: xxxxx.yyyyy.zzzzz + type: WEBRTC + status: CONNECTED + creationTimestamp: '2021-01-01T00:00:00Z' + expirationTimestamp: '2021-01-02T00:00:00Z' + devices: [] + tag: my-tag + errors: [] + getEndpointResponseExample: + summary: Get Endpoint Response + value: + links: + - href: >- + https://api.bandwidth.com/v2/accounts/5500123/endpoints/e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + rel: self + method: GET + data: + endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: WEBRTC + status: CONNECTED + creationTimestamp: '2021-01-01T00:00:00Z' + expirationTimestamp: '2021-01-02T00:00:00Z' + devices: [] + tag: my-tag + errors: [] + createSipEndpointRequestExample: + summary: SIP Endpoint Example + value: + type: SIP + connectionMetadata: + ipAddress: 0.0.0.0 + port: 3000 + credentials: + username: username + password: '********' + uuiHeader: 123456;encoding=jwt + direction: INBOUND + eventCallbackUrl: https://myEventCallbackUrl.com/callbacks/bandwidth + eventFallbackUrl: https://fallback.myEventCallbackUrl.com/callbacks/bandwidth + tag: '{"myTag": "myTagValue"}' + createWeRtcEndpointExample: + summary: WebRTC Endpoint Example + value: + type: WEBRTC + direction: BIDIRECTIONAL + eventCallbackUrl: https://myEventCallbackUrl.com/callbacks/bandwidth + eventFallbackUrl: https://fallback.myEventCallbackUrl.com/callbacks/bandwidth + tag: '{"myTag": "myTagValue"}' + updateEndpointBxmlRequestExample: + summary: Update Endpoint BXML Request Example + value: + endpointDisconnectedEventExample: + summary: Endpoint Disconnected Event + value: + endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: WEBRTC + status: DISCONNECTED + creationTimestamp: '2021-01-01T00:00:00Z' + expirationTimestamp: '2021-01-02T00:00:00Z' + eventTime: '2021-01-01T00:00:00Z' + eventType: DEVICE_DISCONNECTED + tag: my-tag + badRequestErrorExample: + summary: Bad Request Error Example + value: + links: [] + data: null + errors: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: invalid_parameter + description: accountId must not contain any characters other than numbers. + code: '400' + source: + parameter: accountId + unauthorizedErrorExample: + summary: Unauthorized Error Example + value: + links: [] + data: null + errors: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: unauthorized + description: >- + The provided credentials are not authorized to access this + resource. + code: '401' + source: + header: Authorization + forbiddenErrorExample: + summary: Forbidden Error Example + value: + links: [] + data: null + errors: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: forbidden + description: >- + The provided credentials are not authorized to access this + resource. + code: '403' + source: + header: Authorization + notFoundErrorExample: + summary: Not Found Error Example + value: + links: [] + data: null + errors: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: resource_not_found + description: The requested resource was not found. + code: '404' + source: + reference: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + methodNotAllowedErrorExample: + summary: Method Not Allowed Error Example + value: + links: [] + data: null + errors: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: method_not_allowed + description: The requested method is not allowed on this resource. + code: '405' + source: + parameter: accountId + unsupportedMediaTypeErrorExample: + summary: Unsupported Media Type Error Example + value: + links: [] + data: null + errors: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: unsupported_media_type + description: The provided media type is not supported. + code: '415' + source: + header: Content-Type + tooManyRequestsErrorExample: + summary: Too Many Requests Error Example + value: + links: [] + data: null + errors: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: too_many_requests + description: The client has sent too many requests in a given amount of time. + code: '429' + serviceUnavailableErrorExample: + summary: Service Unavailable Error Example + value: + links: [] + data: null + errors: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: service_unavailable + description: The service is currently unavailable. + code: '500' requestBodies: createMessageRequest: content: @@ -8559,6 +9368,30 @@ components: application/json: schema: $ref: '#/components/schemas/webhookSubscriptionRequestSchema' + createEndpointRequest: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/createEndpointRequest' + examples: + createWebRtcEndpointRequestExample: + $ref: '#/components/examples/createWeRtcEndpointExample' + updateEndpointBxmlRequest: + required: true + content: + application/xml: + schema: + type: string + description: >- + The BXML document to update the endpoint with. This BXML document + will be executed against the endpoint when it is updated. + + For more information, please refer to our [BXML + documentation](/docs/voice/bxml/). + examples: + updateEndpointBxmlRequestExample: + $ref: '#/components/examples/updateEndpointBxmlRequestExample' securitySchemes: Basic: type: http @@ -8585,12 +9418,12 @@ components: required: true description: >-

This Inbound Message Webhook is an envelope containing either a - received (MO) message to your + received (MO) message to your message-enabled Bandwidth telephone number or a multichannel - client's response to a suggestion response + client's response to a suggestion response - or location request. + or location request.

The payload type will be one of message-received, suggestion-response, or @@ -8692,3 +9525,17 @@ components: $ref: '#/components/responses/tfvServerErrorResponse' '503': $ref: '#/components/responses/tfvServiceUnavailableResponse' + endpointEvent: + '{request.body#/eventCallbackUrl}': + post: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/endpointEvent' + examples: + endpointDisconnectedEventExample: + $ref: '#/components/examples/endpointDisconnectedEventExample' + responses: + '204': + description: Event was successfully received. diff --git a/docs/Callback.md b/docs/Callback.md index 56428470..9d38bdd5 100644 --- a/docs/Callback.md +++ b/docs/Callback.md @@ -11,11 +11,11 @@ Callbacks are divided into two types based on direction of the related message: |**time** | **OffsetDateTime** | | | |**eventTime** | **OffsetDateTime** | Represents the time at which the message was read, for `message-read` callbacks. | [optional] | |**type** | **InboundCallbackTypeEnum** | | | -|**to** | **String** | The destination phone number the message was sent to. For inbound callbacks, this is the Bandwidth number or alphanumeric identifier that received the message. | | +|**to** | **String** | The destination phone number the message was sent to. For inbound callbacks, this is the Bandwidth number or alphanumeric identifier that received the message. | | |**description** | **String** | A detailed description of the event described by the callback. | | |**message** | [**InboundCallbackMessage**](InboundCallbackMessage.md) | | | |**errorCode** | **Integer** | Optional error code, applicable only when type is `message-failed`. | [optional] | -|**carrierName** | **String** | The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled. | [optional] | +|**carrierName** | **String** | The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled. | [optional] | diff --git a/docs/CreateCall.md b/docs/CreateCall.md index 109c9170..7937060a 100644 --- a/docs/CreateCall.md +++ b/docs/CreateCall.md @@ -10,7 +10,7 @@ |**to** | **String** | The destination to call (must be an E.164 formatted number (e.g. `+15555551212`) or a SIP URI (e.g. `sip:user@server.example`)). | | |**from** | **String** | A Bandwidth phone number on your account the call should come from (must be in E.164 format, like `+15555551212`) even if `privacy` is set to true. | | |**privacy** | **Boolean** | Hide the calling number. The `displayName` field can be used to customize the displayed name. | [optional] | -|**displayName** | **String** | The caller display name to use when the call is created. May not exceed 256 characters nor contain control characters such as new lines. If `privacy` is true, only the following values are valid: `Restricted`, `Anonymous`, `Private`, or `Unavailable`. | [optional] | +|**displayName** | **String** | The caller display name to use when the call is created. May not exceed 256 characters nor contain control characters such as new lines. If `privacy` is true, only the following values are valid: `Restricted`, `Anonymous`, `Private`, or `Unavailable`. | [optional] | |**uui** | **String** | A comma-separated list of 'User-To-User' headers to be sent in the INVITE when calling a SIP URI. Each value must end with an 'encoding' parameter as described in <a href='https://tools.ietf.org/html/rfc7433'>RFC 7433</a>. Only 'jwt', 'base64' and 'hex' encodings are allowed. The entire value cannot exceed 350 characters, including parameters and separators. | [optional] | |**applicationId** | **String** | The id of the application associated with the `from` number. | | |**answerUrl** | **URI** | The full URL to send the <a href='/docs/voice/webhooks/answer'>Answer</a> event to when the called party answers. This endpoint should return the first <a href='/docs/voice/bxml'>BXML document</a> to be executed in the call. Must use `https` if specifying `username` and `password`. | | diff --git a/docs/CreateEndpointRequestBase.md b/docs/CreateEndpointRequestBase.md new file mode 100644 index 00000000..63c36223 --- /dev/null +++ b/docs/CreateEndpointRequestBase.md @@ -0,0 +1,17 @@ + + +# CreateEndpointRequestBase + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**type** | **EndpointTypeEnum** | | | +|**direction** | **EndpointDirectionEnum** | | | +|**eventCallbackUrl** | **URI** | The URL to send event callbacks to. | [optional] | +|**eventFallbackUrl** | **URI** | The URL to send event fallbacks to. | [optional] | +|**tag** | **String** | A tag for the endpoint. | [optional] | + + + diff --git a/docs/CreateEndpointResponse.md b/docs/CreateEndpointResponse.md new file mode 100644 index 00000000..3c481b31 --- /dev/null +++ b/docs/CreateEndpointResponse.md @@ -0,0 +1,15 @@ + + +# CreateEndpointResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**links** | [**List<Link>**](Link.md) | | | +|**data** | [**CreateEndpointResponseData**](CreateEndpointResponseData.md) | | | +|**errors** | [**List<Error>**](Error.md) | | | + + + diff --git a/docs/CreateEndpointResponseData.md b/docs/CreateEndpointResponseData.md new file mode 100644 index 00000000..2e1911fc --- /dev/null +++ b/docs/CreateEndpointResponseData.md @@ -0,0 +1,20 @@ + + +# CreateEndpointResponseData + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**endpointId** | **String** | The unique ID of the endpoint. | | +|**type** | **EndpointTypeEnum** | | | +|**status** | **EndpointStatusEnum** | | | +|**creationTimestamp** | **OffsetDateTime** | The time the endpoint was created. In ISO-8601 format. | | +|**expirationTimestamp** | **OffsetDateTime** | The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. | | +|**tag** | **String** | A tag for the endpoint. | [optional] | +|**devices** | [**List<Device>**](Device.md) | | [optional] | +|**token** | **String** | The json web token specific to the endpoint. Used to authenticate the client with the media gateway. | | + + + diff --git a/docs/CreateEndpointResponseObject.md b/docs/CreateEndpointResponseObject.md new file mode 100644 index 00000000..4506e590 --- /dev/null +++ b/docs/CreateEndpointResponseObject.md @@ -0,0 +1,20 @@ + + +# CreateEndpointResponseObject + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**endpointId** | **String** | The unique ID of the endpoint. | | +|**type** | **EndpointTypeEnum** | | | +|**status** | **EndpointStatusEnum** | | | +|**creationTimestamp** | **OffsetDateTime** | The time the endpoint was created. In ISO-8601 format. | | +|**expirationTimestamp** | **OffsetDateTime** | The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. | | +|**tag** | **String** | A tag for the endpoint. | [optional] | +|**devices** | [**List<Device>**](Device.md) | | [optional] | +|**token** | **String** | The json web token specific to the endpoint. Used to authenticate the client with the media gateway. | | + + + diff --git a/docs/CreateWebRtcConnectionRequest.md b/docs/CreateWebRtcConnectionRequest.md new file mode 100644 index 00000000..70c3da9e --- /dev/null +++ b/docs/CreateWebRtcConnectionRequest.md @@ -0,0 +1,18 @@ + + +# CreateWebRtcConnectionRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**type** | **EndpointTypeEnum** | | | +|**direction** | **EndpointDirectionEnum** | | | +|**eventCallbackUrl** | **URI** | The URL to send event callbacks to. | [optional] | +|**eventFallbackUrl** | **URI** | The URL to send event fallbacks to. | [optional] | +|**tag** | **String** | A tag for the endpoint. | [optional] | +|**connectionMetadata** | **Object** | | [optional] | + + + diff --git a/docs/Device.md b/docs/Device.md new file mode 100644 index 00000000..f3480867 --- /dev/null +++ b/docs/Device.md @@ -0,0 +1,16 @@ + + +# Device + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**deviceId** | **String** | The unique ID of the device. | | +|**deviceName** | **String** | The name of the device. | [optional] | +|**status** | **DeviceStatusEnum** | | | +|**creationTimestamp** | **OffsetDateTime** | The time the device was created. In ISO-8601 format. | | + + + diff --git a/docs/DeviceStatusEnum.md b/docs/DeviceStatusEnum.md new file mode 100644 index 00000000..555f3745 --- /dev/null +++ b/docs/DeviceStatusEnum.md @@ -0,0 +1,13 @@ + + +# DeviceStatusEnum + +## Enum + + +* `CONNECTED` (value: `"CONNECTED"`) + +* `DISCONNECTED` (value: `"DISCONNECTED"`) + + + diff --git a/docs/Endpoint.md b/docs/Endpoint.md new file mode 100644 index 00000000..645088d7 --- /dev/null +++ b/docs/Endpoint.md @@ -0,0 +1,19 @@ + + +# Endpoint + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**endpointId** | **String** | The unique ID of the endpoint. | | +|**type** | **EndpointTypeEnum** | | | +|**status** | **EndpointStatusEnum** | | | +|**creationTimestamp** | **OffsetDateTime** | The time the endpoint was created. In ISO-8601 format. | | +|**expirationTimestamp** | **OffsetDateTime** | The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. | | +|**tag** | **String** | A tag for the endpoint. | [optional] | +|**devices** | [**List<Device>**](Device.md) | | [optional] | + + + diff --git a/docs/EndpointDirectionEnum.md b/docs/EndpointDirectionEnum.md new file mode 100644 index 00000000..1e74e06e --- /dev/null +++ b/docs/EndpointDirectionEnum.md @@ -0,0 +1,15 @@ + + +# EndpointDirectionEnum + +## Enum + + +* `INBOUND` (value: `"INBOUND"`) + +* `OUTBOUND` (value: `"OUTBOUND"`) + +* `BIDIRECTIONAL` (value: `"BIDIRECTIONAL"`) + + + diff --git a/docs/EndpointEvent.md b/docs/EndpointEvent.md new file mode 100644 index 00000000..5c844cb0 --- /dev/null +++ b/docs/EndpointEvent.md @@ -0,0 +1,22 @@ + + +# EndpointEvent + +An event that occurred on an endpoint. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**endpointId** | **String** | The unique ID of the endpoint. | | +|**type** | **EndpointTypeEnum** | | | +|**status** | **EndpointStatusEnum** | | | +|**creationTimestamp** | **OffsetDateTime** | The time the endpoint was created. In ISO-8601 format. | | +|**expirationTimestamp** | **OffsetDateTime** | The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. | | +|**tag** | **String** | A tag for the endpoint. | [optional] | +|**eventTime** | **OffsetDateTime** | The time the event occurred. In ISO-8601 format. | | +|**eventType** | **EndpointEventTypeEnum** | | | +|**device** | [**Device**](Device.md) | | [optional] | + + + diff --git a/docs/EndpointEventTypeEnum.md b/docs/EndpointEventTypeEnum.md new file mode 100644 index 00000000..c2aedec7 --- /dev/null +++ b/docs/EndpointEventTypeEnum.md @@ -0,0 +1,13 @@ + + +# EndpointEventTypeEnum + +## Enum + + +* `DEVICE_CONNECTED` (value: `"DEVICE_CONNECTED"`) + +* `DEVICE_DISCONNECTED` (value: `"DEVICE_DISCONNECTED"`) + + + diff --git a/docs/EndpointResponse.md b/docs/EndpointResponse.md new file mode 100644 index 00000000..2240efed --- /dev/null +++ b/docs/EndpointResponse.md @@ -0,0 +1,15 @@ + + +# EndpointResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**links** | [**List<Link>**](Link.md) | | | +|**data** | [**Endpoint**](Endpoint.md) | | | +|**errors** | [**List<Error>**](Error.md) | | | + + + diff --git a/docs/EndpointStatusEnum.md b/docs/EndpointStatusEnum.md new file mode 100644 index 00000000..49744c9a --- /dev/null +++ b/docs/EndpointStatusEnum.md @@ -0,0 +1,13 @@ + + +# EndpointStatusEnum + +## Enum + + +* `CONNECTED` (value: `"CONNECTED"`) + +* `DISCONNECTED` (value: `"DISCONNECTED"`) + + + diff --git a/docs/EndpointTypeEnum.md b/docs/EndpointTypeEnum.md new file mode 100644 index 00000000..f4753aaa --- /dev/null +++ b/docs/EndpointTypeEnum.md @@ -0,0 +1,11 @@ + + +# EndpointTypeEnum + +## Enum + + +* `WEBRTC` (value: `"WEBRTC"`) + + + diff --git a/docs/Endpoints.md b/docs/Endpoints.md new file mode 100644 index 00000000..9f50cf22 --- /dev/null +++ b/docs/Endpoints.md @@ -0,0 +1,18 @@ + + +# Endpoints + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**endpointId** | **String** | The unique ID of the endpoint. | | +|**type** | **EndpointTypeEnum** | | | +|**status** | **EndpointStatusEnum** | | | +|**creationTimestamp** | **OffsetDateTime** | The time the endpoint was created. In ISO-8601 format. | | +|**expirationTimestamp** | **OffsetDateTime** | The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. | | +|**tag** | **String** | A tag for the endpoint. | [optional] | + + + diff --git a/docs/EndpointsApi.md b/docs/EndpointsApi.md new file mode 100644 index 00000000..41586cc2 --- /dev/null +++ b/docs/EndpointsApi.md @@ -0,0 +1,429 @@ +# EndpointsApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createEndpoint**](EndpointsApi.md#createEndpoint) | **POST** /accounts/{accountId}/endpoints | Create Endpoint | +| [**deleteEndpoint**](EndpointsApi.md#deleteEndpoint) | **DELETE** /accounts/{accountId}/endpoints/{endpointId} | Delete Endpoint | +| [**getEndpoint**](EndpointsApi.md#getEndpoint) | **GET** /accounts/{accountId}/endpoints/{endpointId} | Get Endpoint | +| [**listEndpoints**](EndpointsApi.md#listEndpoints) | **GET** /accounts/{accountId}/endpoints | List Endpoints | +| [**updateEndpointBxml**](EndpointsApi.md#updateEndpointBxml) | **PUT** /accounts/{accountId}/endpoints/{endpointId}/bxml | Update Endpoint BXML | + + + +# **createEndpoint** +> CreateEndpointResponse createEndpoint(accountId, body) + +Create Endpoint + +Creates a new Endpoint for the specified account. + +### Example +```java +// Import classes: +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.EndpointsApi; + +public class Example { + public static void main(String[] args) { + 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"); + + // Configure OAuth2 access token for authorization: OAuth2 + OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2"); + OAuth2.setAccessToken("YOUR ACCESS TOKEN"); + + EndpointsApi apiInstance = new EndpointsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + CreateWebRtcConnectionRequest body = new CreateWebRtcConnectionRequest(); // CreateWebRtcConnectionRequest | + try { + CreateEndpointResponse result = apiInstance.createEndpoint(accountId, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling EndpointsApi#createEndpoint"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **body** | **CreateWebRtcConnectionRequest**| | | + +### Return type + +[**CreateEndpointResponse**](CreateEndpointResponse.md) + +### Authorization + +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | - | +| **500** | Service Unavailable | - | + + +# **deleteEndpoint** +> deleteEndpoint(accountId, endpointId) + +Delete Endpoint + +Deletes the specified endpoint. If the endpoint is actively streaming media, the media stream will be terminated. + +### Example +```java +// Import classes: +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.EndpointsApi; + +public class Example { + public static void main(String[] args) { + 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"); + + // Configure OAuth2 access token for authorization: OAuth2 + OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2"); + OAuth2.setAccessToken("YOUR ACCESS TOKEN"); + + EndpointsApi apiInstance = new EndpointsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String endpointId = "e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | BRTC Endpoint ID. + try { + apiInstance.deleteEndpoint(accountId, endpointId); + } catch (ApiException e) { + System.err.println("Exception when calling EndpointsApi#deleteEndpoint"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **endpointId** | **String**| BRTC Endpoint ID. | | + +### Return type + +null (empty response body) + +### Authorization + +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | No Content | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | - | +| **500** | Service Unavailable | - | + + +# **getEndpoint** +> EndpointResponse getEndpoint(accountId, endpointId) + +Get Endpoint + +Returns information about the specified endpoint. + +### Example +```java +// Import classes: +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.EndpointsApi; + +public class Example { + public static void main(String[] args) { + 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"); + + // Configure OAuth2 access token for authorization: OAuth2 + OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2"); + OAuth2.setAccessToken("YOUR ACCESS TOKEN"); + + EndpointsApi apiInstance = new EndpointsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String endpointId = "e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | BRTC Endpoint ID. + try { + EndpointResponse result = apiInstance.getEndpoint(accountId, endpointId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling EndpointsApi#getEndpoint"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **endpointId** | **String**| BRTC Endpoint ID. | | + +### Return type + +[**EndpointResponse**](EndpointResponse.md) + +### Authorization + +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | - | +| **500** | Service Unavailable | - | + + +# **listEndpoints** +> ListEndpointsResponse listEndpoints(accountId, type, status, afterCursor, limit) + +List Endpoints + +Returns a list of endpoints associated with the specified account. + +### Example +```java +// Import classes: +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.EndpointsApi; + +public class Example { + public static void main(String[] args) { + 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"); + + // Configure OAuth2 access token for authorization: OAuth2 + OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2"); + OAuth2.setAccessToken("YOUR ACCESS TOKEN"); + + EndpointsApi apiInstance = new EndpointsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + EndpointTypeEnum type = EndpointTypeEnum.fromValue("WEBRTC"); // EndpointTypeEnum | The type of endpoint. + EndpointStatusEnum status = EndpointStatusEnum.fromValue("CONNECTED"); // EndpointStatusEnum | The status of the endpoint. + String afterCursor = "TWF5IHRoZSBmb3JjZSBiZSB3aXRoIHlvdQ=="; // String | The cursor to use for pagination. This is the value of the `next` link in the previous response. + Integer limit = 100; // Integer | The maximum number of endpoints to return in the response. + try { + ListEndpointsResponse result = apiInstance.listEndpoints(accountId, type, status, afterCursor, limit); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling EndpointsApi#listEndpoints"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **type** | [**EndpointTypeEnum**](.md)| The type of endpoint. | [optional] [enum: WEBRTC] | +| **status** | [**EndpointStatusEnum**](.md)| The status of the endpoint. | [optional] [enum: CONNECTED, DISCONNECTED] | +| **afterCursor** | **String**| The cursor to use for pagination. This is the value of the `next` link in the previous response. | [optional] | +| **limit** | **Integer**| The maximum number of endpoints to return in the response. | [optional] [default to 100] | + +### Return type + +[**ListEndpointsResponse**](ListEndpointsResponse.md) + +### Authorization + +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | - | +| **500** | Service Unavailable | - | + + +# **updateEndpointBxml** +> updateEndpointBxml(accountId, endpointId, body) + +Update Endpoint BXML + +Updates the BXML for the specified endpoint. + +### Example +```java +// Import classes: +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.EndpointsApi; + +public class Example { + public static void main(String[] args) { + 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"); + + // Configure OAuth2 access token for authorization: OAuth2 + OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2"); + OAuth2.setAccessToken("YOUR ACCESS TOKEN"); + + EndpointsApi apiInstance = new EndpointsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String endpointId = "e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | BRTC Endpoint ID. + String body = "body_example"; // String | + try { + apiInstance.updateEndpointBxml(accountId, endpointId, body); + } catch (ApiException e) { + System.err.println("Exception when calling EndpointsApi#updateEndpointBxml"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **endpointId** | **String**| BRTC Endpoint ID. | | +| **body** | **String**| | | + +### Return type + +null (empty response body) + +### Authorization + +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/xml + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | No Content | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | - | +| **500** | Service Unavailable | - | + diff --git a/docs/ErrorResponse.md b/docs/ErrorResponse.md new file mode 100644 index 00000000..a5409868 --- /dev/null +++ b/docs/ErrorResponse.md @@ -0,0 +1,15 @@ + + +# ErrorResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**links** | [**List<Link>**](Link.md) | | | +|**data** | **Object** | | | +|**errors** | [**List<Error>**](Error.md) | | | + + + diff --git a/docs/InboundCallback.md b/docs/InboundCallback.md index 5a1993cb..520e3f24 100644 --- a/docs/InboundCallback.md +++ b/docs/InboundCallback.md @@ -10,10 +10,10 @@ Represents an inbound callback. |------------ | ------------- | ------------- | -------------| |**time** | **OffsetDateTime** | | | |**type** | **InboundCallbackTypeEnum** | | | -|**to** | **String** | The destination phone number the message was sent to. For inbound callbacks, this is the Bandwidth number or alphanumeric identifier that received the message. | | +|**to** | **String** | The destination phone number the message was sent to. For inbound callbacks, this is the Bandwidth number or alphanumeric identifier that received the message. | | |**description** | **String** | A detailed description of the event described by the callback. | | |**message** | [**InboundCallbackMessage**](InboundCallbackMessage.md) | | | -|**carrierName** | **String** | The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled. | [optional] | +|**carrierName** | **String** | The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled. | [optional] | diff --git a/docs/ListEndpointsResponse.md b/docs/ListEndpointsResponse.md new file mode 100644 index 00000000..2ab178bf --- /dev/null +++ b/docs/ListEndpointsResponse.md @@ -0,0 +1,16 @@ + + +# ListEndpointsResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**links** | [**List<Link>**](Link.md) | | | +|**page** | [**Page**](Page.md) | | [optional] | +|**data** | [**List<Endpoints>**](Endpoints.md) | | | +|**errors** | [**List<Error>**](Error.md) | | | + + + diff --git a/docs/LookupResult.md b/docs/LookupResult.md index 21e16602..d8353faa 100644 --- a/docs/LookupResult.md +++ b/docs/LookupResult.md @@ -17,8 +17,8 @@ Carrier information results for the specified telephone number. |**deactivationDate** | **String** | [DNI-Only](#section/DNI-Only). The datetime the carrier reported a deactivation event. | [optional] | |**deactivationEvent** | **DeactivationEventEnum** | | [optional] | |**latestMessageDeliveryStatus** | **LatestMessageDeliveryStatusEnum** | | [optional] | -|**initialMessageDeliveryStatusDate** | **LocalDate** | [DNI-Only](#section/DNI-Only). The date the phone number entered the status described in `latestMessageDeliveryStatus`. Think of this as the \"start time\" for that status. Value resets every time the `latestMessageDeliveryStatus` changes. | [optional] | -|**latestMessageDeliveryStatusDate** | **LocalDate** | [DNI-Only](#section/DNI-Only). The date bandwidth last received delivery status information for this phone number. Use this field to understand how up-to-date the `latestMessageDeliveryStatus` is. Value resets every time the `latestMessageDeliveryStatus` changes. | [optional] | +|**initialMessageDeliveryStatusDate** | **LocalDate** | [DNI-Only](#section/DNI-Only). The date the phone number entered the status described in `latestMessageDeliveryStatus`. Think of this as the \"start time\" for that status. Value resets every time the `latestMessageDeliveryStatus` changes. | [optional] | +|**latestMessageDeliveryStatusDate** | **LocalDate** | [DNI-Only](#section/DNI-Only). The date bandwidth last received delivery status information for this phone number. Use this field to understand how up-to-date the `latestMessageDeliveryStatus` is. Value resets every time the `latestMessageDeliveryStatus` changes. | [optional] | diff --git a/docs/MachineDetectionConfiguration.md b/docs/MachineDetectionConfiguration.md index a3f6de4c..f3aeba26 100644 --- a/docs/MachineDetectionConfiguration.md +++ b/docs/MachineDetectionConfiguration.md @@ -13,7 +13,7 @@ The machine detection request used to perform + Response Details + Status Code Description Response Headers + 201 Created - + 400 Bad Request - + 401 Unauthorized - + 403 Forbidden - + 404 Not Found - + 405 Method Not Allowed - + 415 Unsupported Media Type - + 429 Too Many Requests - + 500 Service Unavailable - + + */ + public okhttp3.Call createEndpointCall(@javax.annotation.Nonnull String accountId, @javax.annotation.Nonnull CreateWebRtcConnectionRequest body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://api.bandwidth.com/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/endpoints" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic", "OAuth2" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createEndpointValidateBeforeCall(@javax.annotation.Nonnull String accountId, @javax.annotation.Nonnull CreateWebRtcConnectionRequest body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling createEndpoint(Async)"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling createEndpoint(Async)"); + } + + return createEndpointCall(accountId, body, _callback); + + } + + /** + * Create Endpoint + * Creates a new Endpoint for the specified account. + * @param accountId Your Bandwidth Account ID. (required) + * @param body (required) + * @return CreateEndpointResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests -
500 Service Unavailable -
+ */ + public CreateEndpointResponse createEndpoint(@javax.annotation.Nonnull String accountId, @javax.annotation.Nonnull CreateWebRtcConnectionRequest body) throws ApiException { + ApiResponse localVarResp = createEndpointWithHttpInfo(accountId, body); + return localVarResp.getData(); + } + + /** + * Create Endpoint + * Creates a new Endpoint for the specified account. + * @param accountId Your Bandwidth Account ID. (required) + * @param body (required) + * @return ApiResponse<CreateEndpointResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests -
500 Service Unavailable -
+ */ + public ApiResponse createEndpointWithHttpInfo(@javax.annotation.Nonnull String accountId, @javax.annotation.Nonnull CreateWebRtcConnectionRequest body) throws ApiException { + okhttp3.Call localVarCall = createEndpointValidateBeforeCall(accountId, body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Endpoint (asynchronously) + * Creates a new Endpoint for the specified account. + * @param accountId Your Bandwidth Account ID. (required) + * @param body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests -
500 Service Unavailable -
+ */ + public okhttp3.Call createEndpointAsync(@javax.annotation.Nonnull String accountId, @javax.annotation.Nonnull CreateWebRtcConnectionRequest body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createEndpointValidateBeforeCall(accountId, body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for deleteEndpoint + * @param accountId Your Bandwidth Account ID. (required) + * @param endpointId BRTC Endpoint ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests -
500 Service Unavailable -
+ */ + public okhttp3.Call deleteEndpointCall(@javax.annotation.Nonnull String accountId, @javax.annotation.Nonnull String endpointId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://api.bandwidth.com/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/endpoints/{endpointId}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "endpointId" + "}", localVarApiClient.escapeString(endpointId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic", "OAuth2" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteEndpointValidateBeforeCall(@javax.annotation.Nonnull String accountId, @javax.annotation.Nonnull String endpointId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling deleteEndpoint(Async)"); + } + + // verify the required parameter 'endpointId' is set + if (endpointId == null) { + throw new ApiException("Missing the required parameter 'endpointId' when calling deleteEndpoint(Async)"); + } + + return deleteEndpointCall(accountId, endpointId, _callback); + + } + + /** + * Delete Endpoint + * Deletes the specified endpoint. If the endpoint is actively streaming media, the media stream will be terminated. + * @param accountId Your Bandwidth Account ID. (required) + * @param endpointId BRTC Endpoint ID. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests -
500 Service Unavailable -
+ */ + public void deleteEndpoint(@javax.annotation.Nonnull String accountId, @javax.annotation.Nonnull String endpointId) throws ApiException { + deleteEndpointWithHttpInfo(accountId, endpointId); + } + + /** + * Delete Endpoint + * Deletes the specified endpoint. If the endpoint is actively streaming media, the media stream will be terminated. + * @param accountId Your Bandwidth Account ID. (required) + * @param endpointId BRTC Endpoint ID. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests -
500 Service Unavailable -
+ */ + public ApiResponse deleteEndpointWithHttpInfo(@javax.annotation.Nonnull String accountId, @javax.annotation.Nonnull String endpointId) throws ApiException { + okhttp3.Call localVarCall = deleteEndpointValidateBeforeCall(accountId, endpointId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete Endpoint (asynchronously) + * Deletes the specified endpoint. If the endpoint is actively streaming media, the media stream will be terminated. + * @param accountId Your Bandwidth Account ID. (required) + * @param endpointId BRTC Endpoint ID. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests -
500 Service Unavailable -
+ */ + public okhttp3.Call deleteEndpointAsync(@javax.annotation.Nonnull String accountId, @javax.annotation.Nonnull String endpointId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteEndpointValidateBeforeCall(accountId, endpointId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getEndpoint + * @param accountId Your Bandwidth Account ID. (required) + * @param endpointId BRTC Endpoint ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests -
500 Service Unavailable -
+ */ + public okhttp3.Call getEndpointCall(@javax.annotation.Nonnull String accountId, @javax.annotation.Nonnull String endpointId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://api.bandwidth.com/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/endpoints/{endpointId}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "endpointId" + "}", localVarApiClient.escapeString(endpointId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic", "OAuth2" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getEndpointValidateBeforeCall(@javax.annotation.Nonnull String accountId, @javax.annotation.Nonnull String endpointId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling getEndpoint(Async)"); + } + + // verify the required parameter 'endpointId' is set + if (endpointId == null) { + throw new ApiException("Missing the required parameter 'endpointId' when calling getEndpoint(Async)"); + } + + return getEndpointCall(accountId, endpointId, _callback); + + } + + /** + * Get Endpoint + * Returns information about the specified endpoint. + * @param accountId Your Bandwidth Account ID. (required) + * @param endpointId BRTC Endpoint ID. (required) + * @return EndpointResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests -
500 Service Unavailable -
+ */ + public EndpointResponse getEndpoint(@javax.annotation.Nonnull String accountId, @javax.annotation.Nonnull String endpointId) throws ApiException { + ApiResponse localVarResp = getEndpointWithHttpInfo(accountId, endpointId); + return localVarResp.getData(); + } + + /** + * Get Endpoint + * Returns information about the specified endpoint. + * @param accountId Your Bandwidth Account ID. (required) + * @param endpointId BRTC Endpoint ID. (required) + * @return ApiResponse<EndpointResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests -
500 Service Unavailable -
+ */ + public ApiResponse getEndpointWithHttpInfo(@javax.annotation.Nonnull String accountId, @javax.annotation.Nonnull String endpointId) throws ApiException { + okhttp3.Call localVarCall = getEndpointValidateBeforeCall(accountId, endpointId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Endpoint (asynchronously) + * Returns information about the specified endpoint. + * @param accountId Your Bandwidth Account ID. (required) + * @param endpointId BRTC Endpoint ID. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests -
500 Service Unavailable -
+ */ + public okhttp3.Call getEndpointAsync(@javax.annotation.Nonnull String accountId, @javax.annotation.Nonnull String endpointId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getEndpointValidateBeforeCall(accountId, endpointId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for listEndpoints + * @param accountId Your Bandwidth Account ID. (required) + * @param type The type of endpoint. (optional) + * @param status The status of the endpoint. (optional) + * @param afterCursor The cursor to use for pagination. This is the value of the `next` link in the previous response. (optional) + * @param limit The maximum number of endpoints to return in the response. (optional, default to 100) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests -
500 Service Unavailable -
+ */ + public okhttp3.Call listEndpointsCall(@javax.annotation.Nonnull String accountId, @javax.annotation.Nullable EndpointTypeEnum type, @javax.annotation.Nullable EndpointStatusEnum status, @javax.annotation.Nullable String afterCursor, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://api.bandwidth.com/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/endpoints" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (type != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("type", type)); + } + + if (status != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("status", status)); + } + + if (afterCursor != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("afterCursor", afterCursor)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic", "OAuth2" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listEndpointsValidateBeforeCall(@javax.annotation.Nonnull String accountId, @javax.annotation.Nullable EndpointTypeEnum type, @javax.annotation.Nullable EndpointStatusEnum status, @javax.annotation.Nullable String afterCursor, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling listEndpoints(Async)"); + } + + return listEndpointsCall(accountId, type, status, afterCursor, limit, _callback); + + } + + /** + * List Endpoints + * Returns a list of endpoints associated with the specified account. + * @param accountId Your Bandwidth Account ID. (required) + * @param type The type of endpoint. (optional) + * @param status The status of the endpoint. (optional) + * @param afterCursor The cursor to use for pagination. This is the value of the `next` link in the previous response. (optional) + * @param limit The maximum number of endpoints to return in the response. (optional, default to 100) + * @return ListEndpointsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests -
500 Service Unavailable -
+ */ + public ListEndpointsResponse listEndpoints(@javax.annotation.Nonnull String accountId, @javax.annotation.Nullable EndpointTypeEnum type, @javax.annotation.Nullable EndpointStatusEnum status, @javax.annotation.Nullable String afterCursor, @javax.annotation.Nullable Integer limit) throws ApiException { + ApiResponse localVarResp = listEndpointsWithHttpInfo(accountId, type, status, afterCursor, limit); + return localVarResp.getData(); + } + + /** + * List Endpoints + * Returns a list of endpoints associated with the specified account. + * @param accountId Your Bandwidth Account ID. (required) + * @param type The type of endpoint. (optional) + * @param status The status of the endpoint. (optional) + * @param afterCursor The cursor to use for pagination. This is the value of the `next` link in the previous response. (optional) + * @param limit The maximum number of endpoints to return in the response. (optional, default to 100) + * @return ApiResponse<ListEndpointsResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests -
500 Service Unavailable -
+ */ + public ApiResponse listEndpointsWithHttpInfo(@javax.annotation.Nonnull String accountId, @javax.annotation.Nullable EndpointTypeEnum type, @javax.annotation.Nullable EndpointStatusEnum status, @javax.annotation.Nullable String afterCursor, @javax.annotation.Nullable Integer limit) throws ApiException { + okhttp3.Call localVarCall = listEndpointsValidateBeforeCall(accountId, type, status, afterCursor, limit, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List Endpoints (asynchronously) + * Returns a list of endpoints associated with the specified account. + * @param accountId Your Bandwidth Account ID. (required) + * @param type The type of endpoint. (optional) + * @param status The status of the endpoint. (optional) + * @param afterCursor The cursor to use for pagination. This is the value of the `next` link in the previous response. (optional) + * @param limit The maximum number of endpoints to return in the response. (optional, default to 100) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests -
500 Service Unavailable -
+ */ + public okhttp3.Call listEndpointsAsync(@javax.annotation.Nonnull String accountId, @javax.annotation.Nullable EndpointTypeEnum type, @javax.annotation.Nullable EndpointStatusEnum status, @javax.annotation.Nullable String afterCursor, @javax.annotation.Nullable Integer limit, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = listEndpointsValidateBeforeCall(accountId, type, status, afterCursor, limit, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updateEndpointBxml + * @param accountId Your Bandwidth Account ID. (required) + * @param endpointId BRTC Endpoint ID. (required) + * @param body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests -
500 Service Unavailable -
+ */ + public okhttp3.Call updateEndpointBxmlCall(@javax.annotation.Nonnull String accountId, @javax.annotation.Nonnull String endpointId, @javax.annotation.Nonnull String body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://api.bandwidth.com/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/endpoints/{endpointId}/bxml" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "endpointId" + "}", localVarApiClient.escapeString(endpointId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic", "OAuth2" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateEndpointBxmlValidateBeforeCall(@javax.annotation.Nonnull String accountId, @javax.annotation.Nonnull String endpointId, @javax.annotation.Nonnull String body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling updateEndpointBxml(Async)"); + } + + // verify the required parameter 'endpointId' is set + if (endpointId == null) { + throw new ApiException("Missing the required parameter 'endpointId' when calling updateEndpointBxml(Async)"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling updateEndpointBxml(Async)"); + } + + return updateEndpointBxmlCall(accountId, endpointId, body, _callback); + + } + + /** + * Update Endpoint BXML + * Updates the BXML for the specified endpoint. + * @param accountId Your Bandwidth Account ID. (required) + * @param endpointId BRTC Endpoint ID. (required) + * @param body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests -
500 Service Unavailable -
+ */ + public void updateEndpointBxml(@javax.annotation.Nonnull String accountId, @javax.annotation.Nonnull String endpointId, @javax.annotation.Nonnull String body) throws ApiException { + updateEndpointBxmlWithHttpInfo(accountId, endpointId, body); + } + + /** + * Update Endpoint BXML + * Updates the BXML for the specified endpoint. + * @param accountId Your Bandwidth Account ID. (required) + * @param endpointId BRTC Endpoint ID. (required) + * @param body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests -
500 Service Unavailable -
+ */ + public ApiResponse updateEndpointBxmlWithHttpInfo(@javax.annotation.Nonnull String accountId, @javax.annotation.Nonnull String endpointId, @javax.annotation.Nonnull String body) throws ApiException { + okhttp3.Call localVarCall = updateEndpointBxmlValidateBeforeCall(accountId, endpointId, body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update Endpoint BXML (asynchronously) + * Updates the BXML for the specified endpoint. + * @param accountId Your Bandwidth Account ID. (required) + * @param endpointId BRTC Endpoint ID. (required) + * @param body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests -
500 Service Unavailable -
+ */ + public okhttp3.Call updateEndpointBxmlAsync(@javax.annotation.Nonnull String accountId, @javax.annotation.Nonnull String endpointId, @javax.annotation.Nonnull String body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateEndpointBxmlValidateBeforeCall(accountId, endpointId, body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/CreateCall.java b/src/main/java/com/bandwidth/sdk/model/CreateCall.java index 02905aa3..71a13117 100644 --- a/src/main/java/com/bandwidth/sdk/model/CreateCall.java +++ b/src/main/java/com/bandwidth/sdk/model/CreateCall.java @@ -227,7 +227,7 @@ public CreateCall displayName(@javax.annotation.Nullable String displayName) { } /** - * The caller display name to use when the call is created. May not exceed 256 characters nor contain control characters such as new lines. If `privacy` is true, only the following values are valid: `Restricted`, `Anonymous`, `Private`, or `Unavailable`. + * The caller display name to use when the call is created. May not exceed 256 characters nor contain control characters such as new lines. If `privacy` is true, only the following values are valid: `Restricted`, `Anonymous`, `Private`, or `Unavailable`. * @return displayName */ @javax.annotation.Nullable diff --git a/src/main/java/com/bandwidth/sdk/model/CreateEndpointRequestBase.java b/src/main/java/com/bandwidth/sdk/model/CreateEndpointRequestBase.java new file mode 100644 index 00000000..ad5a33fc --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/CreateEndpointRequestBase.java @@ -0,0 +1,412 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import java.util.Locale; +import com.bandwidth.sdk.model.EndpointDirectionEnum; +import com.bandwidth.sdk.model.EndpointTypeEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import com.bandwidth.sdk.JSON; + +/** + * CreateEndpointRequestBase + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0") +public class CreateEndpointRequestBase { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private EndpointTypeEnum type; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + @javax.annotation.Nonnull + private EndpointDirectionEnum direction; + + public static final String SERIALIZED_NAME_EVENT_CALLBACK_URL = "eventCallbackUrl"; + @SerializedName(SERIALIZED_NAME_EVENT_CALLBACK_URL) + @javax.annotation.Nullable + private URI eventCallbackUrl; + + public static final String SERIALIZED_NAME_EVENT_FALLBACK_URL = "eventFallbackUrl"; + @SerializedName(SERIALIZED_NAME_EVENT_FALLBACK_URL) + @javax.annotation.Nullable + private URI eventFallbackUrl; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + @javax.annotation.Nullable + private String tag; + + public CreateEndpointRequestBase() { + } + + public CreateEndpointRequestBase type(@javax.annotation.Nonnull EndpointTypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public EndpointTypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull EndpointTypeEnum type) { + this.type = type; + } + + + public CreateEndpointRequestBase direction(@javax.annotation.Nonnull EndpointDirectionEnum direction) { + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + */ + @javax.annotation.Nonnull + public EndpointDirectionEnum getDirection() { + return direction; + } + + public void setDirection(@javax.annotation.Nonnull EndpointDirectionEnum direction) { + this.direction = direction; + } + + + public CreateEndpointRequestBase eventCallbackUrl(@javax.annotation.Nullable URI eventCallbackUrl) { + this.eventCallbackUrl = eventCallbackUrl; + return this; + } + + /** + * The URL to send event callbacks to. + * @return eventCallbackUrl + */ + @javax.annotation.Nullable + public URI getEventCallbackUrl() { + return eventCallbackUrl; + } + + public void setEventCallbackUrl(@javax.annotation.Nullable URI eventCallbackUrl) { + this.eventCallbackUrl = eventCallbackUrl; + } + + + public CreateEndpointRequestBase eventFallbackUrl(@javax.annotation.Nullable URI eventFallbackUrl) { + this.eventFallbackUrl = eventFallbackUrl; + return this; + } + + /** + * The URL to send event fallbacks to. + * @return eventFallbackUrl + */ + @javax.annotation.Nullable + public URI getEventFallbackUrl() { + return eventFallbackUrl; + } + + public void setEventFallbackUrl(@javax.annotation.Nullable URI eventFallbackUrl) { + this.eventFallbackUrl = eventFallbackUrl; + } + + + public CreateEndpointRequestBase tag(@javax.annotation.Nullable String tag) { + this.tag = tag; + return this; + } + + /** + * A tag for the endpoint. + * @return tag + */ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + public void setTag(@javax.annotation.Nullable String tag) { + this.tag = tag; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateEndpointRequestBase instance itself + */ + public CreateEndpointRequestBase putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateEndpointRequestBase createEndpointRequestBase = (CreateEndpointRequestBase) o; + return Objects.equals(this.type, createEndpointRequestBase.type) && + Objects.equals(this.direction, createEndpointRequestBase.direction) && + Objects.equals(this.eventCallbackUrl, createEndpointRequestBase.eventCallbackUrl) && + Objects.equals(this.eventFallbackUrl, createEndpointRequestBase.eventFallbackUrl) && + Objects.equals(this.tag, createEndpointRequestBase.tag)&& + Objects.equals(this.additionalProperties, createEndpointRequestBase.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(type, direction, eventCallbackUrl, eventFallbackUrl, tag, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateEndpointRequestBase {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" eventCallbackUrl: ").append(toIndentedString(eventCallbackUrl)).append("\n"); + sb.append(" eventFallbackUrl: ").append(toIndentedString(eventFallbackUrl)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("type", "direction", "eventCallbackUrl", "eventFallbackUrl", "tag")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("type", "direction")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateEndpointRequestBase + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateEndpointRequestBase.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in CreateEndpointRequestBase is not found in the empty JSON string", CreateEndpointRequestBase.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateEndpointRequestBase.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `type` + EndpointTypeEnum.validateJsonElement(jsonObj.get("type")); + // validate the required field `direction` + EndpointDirectionEnum.validateJsonElement(jsonObj.get("direction")); + if ((jsonObj.get("eventCallbackUrl") != null && !jsonObj.get("eventCallbackUrl").isJsonNull()) && !jsonObj.get("eventCallbackUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `eventCallbackUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventCallbackUrl").toString())); + } + if ((jsonObj.get("eventFallbackUrl") != null && !jsonObj.get("eventFallbackUrl").isJsonNull()) && !jsonObj.get("eventFallbackUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `eventFallbackUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventFallbackUrl").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateEndpointRequestBase.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateEndpointRequestBase' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateEndpointRequestBase.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateEndpointRequestBase value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CreateEndpointRequestBase read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateEndpointRequestBase instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateEndpointRequestBase given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateEndpointRequestBase + * @throws IOException if the JSON string is invalid with respect to CreateEndpointRequestBase + */ + public static CreateEndpointRequestBase fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateEndpointRequestBase.class); + } + + /** + * Convert an instance of CreateEndpointRequestBase to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/CreateEndpointResponse.java b/src/main/java/com/bandwidth/sdk/model/CreateEndpointResponse.java new file mode 100644 index 00000000..117e9259 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/CreateEndpointResponse.java @@ -0,0 +1,387 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import java.util.Locale; +import com.bandwidth.sdk.model.CreateEndpointResponseData; +import com.bandwidth.sdk.model.Error; +import com.bandwidth.sdk.model.Link; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import com.bandwidth.sdk.JSON; + +/** + * CreateEndpointResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0") +public class CreateEndpointResponse { + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull + private List links = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private CreateEndpointResponseData data; + + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nonnull + private List errors = new ArrayList<>(); + + public CreateEndpointResponse() { + } + + public CreateEndpointResponse links(@javax.annotation.Nonnull List links) { + this.links = links; + return this; + } + + public CreateEndpointResponse addLinksItem(Link linksItem) { + if (this.links == null) { + this.links = new ArrayList<>(); + } + this.links.add(linksItem); + return this; + } + + /** + * Get links + * @return links + */ + @javax.annotation.Nonnull + public List getLinks() { + return links; + } + + public void setLinks(@javax.annotation.Nonnull List links) { + this.links = links; + } + + + public CreateEndpointResponse data(@javax.annotation.Nonnull CreateEndpointResponseData data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public CreateEndpointResponseData getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull CreateEndpointResponseData data) { + this.data = data; + } + + + public CreateEndpointResponse errors(@javax.annotation.Nonnull List errors) { + this.errors = errors; + return this; + } + + public CreateEndpointResponse addErrorsItem(Error errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Get errors + * @return errors + */ + @javax.annotation.Nonnull + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nonnull List errors) { + this.errors = errors; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateEndpointResponse instance itself + */ + public CreateEndpointResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateEndpointResponse createEndpointResponse = (CreateEndpointResponse) o; + return Objects.equals(this.links, createEndpointResponse.links) && + Objects.equals(this.data, createEndpointResponse.data) && + Objects.equals(this.errors, createEndpointResponse.errors)&& + Objects.equals(this.additionalProperties, createEndpointResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(links, data, errors, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateEndpointResponse {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("links", "data", "errors")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("links", "data", "errors")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateEndpointResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateEndpointResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in CreateEndpointResponse is not found in the empty JSON string", CreateEndpointResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateEndpointResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("links").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `links` to be an array in the JSON string but got `%s`", jsonObj.get("links").toString())); + } + + JsonArray jsonArraylinks = jsonObj.getAsJsonArray("links"); + // validate the required field `links` (array) + for (int i = 0; i < jsonArraylinks.size(); i++) { + Link.validateJsonElement(jsonArraylinks.get(i)); + }; + // validate the required field `data` + CreateEndpointResponseData.validateJsonElement(jsonObj.get("data")); + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + // validate the required field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + Error.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateEndpointResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateEndpointResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateEndpointResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateEndpointResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CreateEndpointResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateEndpointResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateEndpointResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateEndpointResponse + * @throws IOException if the JSON string is invalid with respect to CreateEndpointResponse + */ + public static CreateEndpointResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateEndpointResponse.class); + } + + /** + * Convert an instance of CreateEndpointResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/CreateEndpointResponseData.java b/src/main/java/com/bandwidth/sdk/model/CreateEndpointResponseData.java new file mode 100644 index 00000000..d1c80be2 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/CreateEndpointResponseData.java @@ -0,0 +1,515 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import java.util.Locale; +import com.bandwidth.sdk.model.Device; +import com.bandwidth.sdk.model.EndpointStatusEnum; +import com.bandwidth.sdk.model.EndpointTypeEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import com.bandwidth.sdk.JSON; + +/** + * CreateEndpointResponseData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0") +public class CreateEndpointResponseData { + public static final String SERIALIZED_NAME_ENDPOINT_ID = "endpointId"; + @SerializedName(SERIALIZED_NAME_ENDPOINT_ID) + @javax.annotation.Nonnull + private String endpointId; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private EndpointTypeEnum type; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private EndpointStatusEnum status; + + public static final String SERIALIZED_NAME_CREATION_TIMESTAMP = "creationTimestamp"; + @SerializedName(SERIALIZED_NAME_CREATION_TIMESTAMP) + @javax.annotation.Nonnull + private OffsetDateTime creationTimestamp; + + public static final String SERIALIZED_NAME_EXPIRATION_TIMESTAMP = "expirationTimestamp"; + @SerializedName(SERIALIZED_NAME_EXPIRATION_TIMESTAMP) + @javax.annotation.Nonnull + private OffsetDateTime expirationTimestamp; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + @javax.annotation.Nullable + private String tag; + + public static final String SERIALIZED_NAME_DEVICES = "devices"; + @SerializedName(SERIALIZED_NAME_DEVICES) + @javax.annotation.Nullable + private List devices = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TOKEN = "token"; + @SerializedName(SERIALIZED_NAME_TOKEN) + @javax.annotation.Nonnull + private String token; + + public CreateEndpointResponseData() { + } + + public CreateEndpointResponseData endpointId(@javax.annotation.Nonnull String endpointId) { + this.endpointId = endpointId; + return this; + } + + /** + * The unique ID of the endpoint. + * @return endpointId + */ + @javax.annotation.Nonnull + public String getEndpointId() { + return endpointId; + } + + public void setEndpointId(@javax.annotation.Nonnull String endpointId) { + this.endpointId = endpointId; + } + + + public CreateEndpointResponseData type(@javax.annotation.Nonnull EndpointTypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public EndpointTypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull EndpointTypeEnum type) { + this.type = type; + } + + + public CreateEndpointResponseData status(@javax.annotation.Nonnull EndpointStatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public EndpointStatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull EndpointStatusEnum status) { + this.status = status; + } + + + public CreateEndpointResponseData creationTimestamp(@javax.annotation.Nonnull OffsetDateTime creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + /** + * The time the endpoint was created. In ISO-8601 format. + * @return creationTimestamp + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreationTimestamp() { + return creationTimestamp; + } + + public void setCreationTimestamp(@javax.annotation.Nonnull OffsetDateTime creationTimestamp) { + this.creationTimestamp = creationTimestamp; + } + + + public CreateEndpointResponseData expirationTimestamp(@javax.annotation.Nonnull OffsetDateTime expirationTimestamp) { + this.expirationTimestamp = expirationTimestamp; + return this; + } + + /** + * The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. + * @return expirationTimestamp + */ + @javax.annotation.Nonnull + public OffsetDateTime getExpirationTimestamp() { + return expirationTimestamp; + } + + public void setExpirationTimestamp(@javax.annotation.Nonnull OffsetDateTime expirationTimestamp) { + this.expirationTimestamp = expirationTimestamp; + } + + + public CreateEndpointResponseData tag(@javax.annotation.Nullable String tag) { + this.tag = tag; + return this; + } + + /** + * A tag for the endpoint. + * @return tag + */ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + public void setTag(@javax.annotation.Nullable String tag) { + this.tag = tag; + } + + + public CreateEndpointResponseData devices(@javax.annotation.Nullable List devices) { + this.devices = devices; + return this; + } + + public CreateEndpointResponseData addDevicesItem(Device devicesItem) { + if (this.devices == null) { + this.devices = new ArrayList<>(); + } + this.devices.add(devicesItem); + return this; + } + + /** + * Get devices + * @return devices + */ + @javax.annotation.Nullable + public List getDevices() { + return devices; + } + + public void setDevices(@javax.annotation.Nullable List devices) { + this.devices = devices; + } + + + public CreateEndpointResponseData token(@javax.annotation.Nonnull String token) { + this.token = token; + return this; + } + + /** + * The json web token specific to the endpoint. Used to authenticate the client with the media gateway. + * @return token + */ + @javax.annotation.Nonnull + public String getToken() { + return token; + } + + public void setToken(@javax.annotation.Nonnull String token) { + this.token = token; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateEndpointResponseData instance itself + */ + public CreateEndpointResponseData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateEndpointResponseData createEndpointResponseData = (CreateEndpointResponseData) o; + return Objects.equals(this.endpointId, createEndpointResponseData.endpointId) && + Objects.equals(this.type, createEndpointResponseData.type) && + Objects.equals(this.status, createEndpointResponseData.status) && + Objects.equals(this.creationTimestamp, createEndpointResponseData.creationTimestamp) && + Objects.equals(this.expirationTimestamp, createEndpointResponseData.expirationTimestamp) && + Objects.equals(this.tag, createEndpointResponseData.tag) && + Objects.equals(this.devices, createEndpointResponseData.devices) && + Objects.equals(this.token, createEndpointResponseData.token)&& + Objects.equals(this.additionalProperties, createEndpointResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(endpointId, type, status, creationTimestamp, expirationTimestamp, tag, devices, token, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateEndpointResponseData {\n"); + sb.append(" endpointId: ").append(toIndentedString(endpointId)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" creationTimestamp: ").append(toIndentedString(creationTimestamp)).append("\n"); + sb.append(" expirationTimestamp: ").append(toIndentedString(expirationTimestamp)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" devices: ").append(toIndentedString(devices)).append("\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("endpointId", "type", "status", "creationTimestamp", "expirationTimestamp", "tag", "devices", "token")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("endpointId", "type", "status", "creationTimestamp", "expirationTimestamp", "token")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateEndpointResponseData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateEndpointResponseData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in CreateEndpointResponseData is not found in the empty JSON string", CreateEndpointResponseData.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateEndpointResponseData.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("endpointId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `endpointId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("endpointId").toString())); + } + // validate the required field `type` + EndpointTypeEnum.validateJsonElement(jsonObj.get("type")); + // validate the required field `status` + EndpointStatusEnum.validateJsonElement(jsonObj.get("status")); + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + if (jsonObj.get("devices") != null && !jsonObj.get("devices").isJsonNull()) { + JsonArray jsonArraydevices = jsonObj.getAsJsonArray("devices"); + if (jsonArraydevices != null) { + // ensure the json data is an array + if (!jsonObj.get("devices").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `devices` to be an array in the JSON string but got `%s`", jsonObj.get("devices").toString())); + } + + // validate the optional field `devices` (array) + for (int i = 0; i < jsonArraydevices.size(); i++) { + Device.validateJsonElement(jsonArraydevices.get(i)); + }; + } + } + if (!jsonObj.get("token").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("token").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateEndpointResponseData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateEndpointResponseData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateEndpointResponseData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateEndpointResponseData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CreateEndpointResponseData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateEndpointResponseData instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateEndpointResponseData given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateEndpointResponseData + * @throws IOException if the JSON string is invalid with respect to CreateEndpointResponseData + */ + public static CreateEndpointResponseData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateEndpointResponseData.class); + } + + /** + * Convert an instance of CreateEndpointResponseData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/CreateEndpointResponseObject.java b/src/main/java/com/bandwidth/sdk/model/CreateEndpointResponseObject.java new file mode 100644 index 00000000..e951cbac --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/CreateEndpointResponseObject.java @@ -0,0 +1,515 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import java.util.Locale; +import com.bandwidth.sdk.model.Device; +import com.bandwidth.sdk.model.EndpointStatusEnum; +import com.bandwidth.sdk.model.EndpointTypeEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import com.bandwidth.sdk.JSON; + +/** + * CreateEndpointResponseObject + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0") +public class CreateEndpointResponseObject { + public static final String SERIALIZED_NAME_ENDPOINT_ID = "endpointId"; + @SerializedName(SERIALIZED_NAME_ENDPOINT_ID) + @javax.annotation.Nonnull + private String endpointId; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private EndpointTypeEnum type; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private EndpointStatusEnum status; + + public static final String SERIALIZED_NAME_CREATION_TIMESTAMP = "creationTimestamp"; + @SerializedName(SERIALIZED_NAME_CREATION_TIMESTAMP) + @javax.annotation.Nonnull + private OffsetDateTime creationTimestamp; + + public static final String SERIALIZED_NAME_EXPIRATION_TIMESTAMP = "expirationTimestamp"; + @SerializedName(SERIALIZED_NAME_EXPIRATION_TIMESTAMP) + @javax.annotation.Nonnull + private OffsetDateTime expirationTimestamp; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + @javax.annotation.Nullable + private String tag; + + public static final String SERIALIZED_NAME_DEVICES = "devices"; + @SerializedName(SERIALIZED_NAME_DEVICES) + @javax.annotation.Nullable + private List devices = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TOKEN = "token"; + @SerializedName(SERIALIZED_NAME_TOKEN) + @javax.annotation.Nonnull + private String token; + + public CreateEndpointResponseObject() { + } + + public CreateEndpointResponseObject endpointId(@javax.annotation.Nonnull String endpointId) { + this.endpointId = endpointId; + return this; + } + + /** + * The unique ID of the endpoint. + * @return endpointId + */ + @javax.annotation.Nonnull + public String getEndpointId() { + return endpointId; + } + + public void setEndpointId(@javax.annotation.Nonnull String endpointId) { + this.endpointId = endpointId; + } + + + public CreateEndpointResponseObject type(@javax.annotation.Nonnull EndpointTypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public EndpointTypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull EndpointTypeEnum type) { + this.type = type; + } + + + public CreateEndpointResponseObject status(@javax.annotation.Nonnull EndpointStatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public EndpointStatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull EndpointStatusEnum status) { + this.status = status; + } + + + public CreateEndpointResponseObject creationTimestamp(@javax.annotation.Nonnull OffsetDateTime creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + /** + * The time the endpoint was created. In ISO-8601 format. + * @return creationTimestamp + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreationTimestamp() { + return creationTimestamp; + } + + public void setCreationTimestamp(@javax.annotation.Nonnull OffsetDateTime creationTimestamp) { + this.creationTimestamp = creationTimestamp; + } + + + public CreateEndpointResponseObject expirationTimestamp(@javax.annotation.Nonnull OffsetDateTime expirationTimestamp) { + this.expirationTimestamp = expirationTimestamp; + return this; + } + + /** + * The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. + * @return expirationTimestamp + */ + @javax.annotation.Nonnull + public OffsetDateTime getExpirationTimestamp() { + return expirationTimestamp; + } + + public void setExpirationTimestamp(@javax.annotation.Nonnull OffsetDateTime expirationTimestamp) { + this.expirationTimestamp = expirationTimestamp; + } + + + public CreateEndpointResponseObject tag(@javax.annotation.Nullable String tag) { + this.tag = tag; + return this; + } + + /** + * A tag for the endpoint. + * @return tag + */ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + public void setTag(@javax.annotation.Nullable String tag) { + this.tag = tag; + } + + + public CreateEndpointResponseObject devices(@javax.annotation.Nullable List devices) { + this.devices = devices; + return this; + } + + public CreateEndpointResponseObject addDevicesItem(Device devicesItem) { + if (this.devices == null) { + this.devices = new ArrayList<>(); + } + this.devices.add(devicesItem); + return this; + } + + /** + * Get devices + * @return devices + */ + @javax.annotation.Nullable + public List getDevices() { + return devices; + } + + public void setDevices(@javax.annotation.Nullable List devices) { + this.devices = devices; + } + + + public CreateEndpointResponseObject token(@javax.annotation.Nonnull String token) { + this.token = token; + return this; + } + + /** + * The json web token specific to the endpoint. Used to authenticate the client with the media gateway. + * @return token + */ + @javax.annotation.Nonnull + public String getToken() { + return token; + } + + public void setToken(@javax.annotation.Nonnull String token) { + this.token = token; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateEndpointResponseObject instance itself + */ + public CreateEndpointResponseObject putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateEndpointResponseObject createEndpointResponseObject = (CreateEndpointResponseObject) o; + return Objects.equals(this.endpointId, createEndpointResponseObject.endpointId) && + Objects.equals(this.type, createEndpointResponseObject.type) && + Objects.equals(this.status, createEndpointResponseObject.status) && + Objects.equals(this.creationTimestamp, createEndpointResponseObject.creationTimestamp) && + Objects.equals(this.expirationTimestamp, createEndpointResponseObject.expirationTimestamp) && + Objects.equals(this.tag, createEndpointResponseObject.tag) && + Objects.equals(this.devices, createEndpointResponseObject.devices) && + Objects.equals(this.token, createEndpointResponseObject.token)&& + Objects.equals(this.additionalProperties, createEndpointResponseObject.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(endpointId, type, status, creationTimestamp, expirationTimestamp, tag, devices, token, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateEndpointResponseObject {\n"); + sb.append(" endpointId: ").append(toIndentedString(endpointId)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" creationTimestamp: ").append(toIndentedString(creationTimestamp)).append("\n"); + sb.append(" expirationTimestamp: ").append(toIndentedString(expirationTimestamp)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" devices: ").append(toIndentedString(devices)).append("\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("endpointId", "type", "status", "creationTimestamp", "expirationTimestamp", "tag", "devices", "token")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("endpointId", "type", "status", "creationTimestamp", "expirationTimestamp", "token")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateEndpointResponseObject + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateEndpointResponseObject.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in CreateEndpointResponseObject is not found in the empty JSON string", CreateEndpointResponseObject.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateEndpointResponseObject.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("endpointId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `endpointId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("endpointId").toString())); + } + // validate the required field `type` + EndpointTypeEnum.validateJsonElement(jsonObj.get("type")); + // validate the required field `status` + EndpointStatusEnum.validateJsonElement(jsonObj.get("status")); + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + if (jsonObj.get("devices") != null && !jsonObj.get("devices").isJsonNull()) { + JsonArray jsonArraydevices = jsonObj.getAsJsonArray("devices"); + if (jsonArraydevices != null) { + // ensure the json data is an array + if (!jsonObj.get("devices").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `devices` to be an array in the JSON string but got `%s`", jsonObj.get("devices").toString())); + } + + // validate the optional field `devices` (array) + for (int i = 0; i < jsonArraydevices.size(); i++) { + Device.validateJsonElement(jsonArraydevices.get(i)); + }; + } + } + if (!jsonObj.get("token").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("token").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateEndpointResponseObject.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateEndpointResponseObject' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateEndpointResponseObject.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateEndpointResponseObject value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CreateEndpointResponseObject read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateEndpointResponseObject instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateEndpointResponseObject given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateEndpointResponseObject + * @throws IOException if the JSON string is invalid with respect to CreateEndpointResponseObject + */ + public static CreateEndpointResponseObject fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateEndpointResponseObject.class); + } + + /** + * Convert an instance of CreateEndpointResponseObject to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/CreateWebRtcConnectionRequest.java b/src/main/java/com/bandwidth/sdk/model/CreateWebRtcConnectionRequest.java new file mode 100644 index 00000000..bef608e2 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/CreateWebRtcConnectionRequest.java @@ -0,0 +1,438 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import java.util.Locale; +import com.bandwidth.sdk.model.EndpointDirectionEnum; +import com.bandwidth.sdk.model.EndpointTypeEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import com.bandwidth.sdk.JSON; + +/** + * CreateWebRtcConnectionRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0") +public class CreateWebRtcConnectionRequest { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private EndpointTypeEnum type; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + @javax.annotation.Nonnull + private EndpointDirectionEnum direction; + + public static final String SERIALIZED_NAME_EVENT_CALLBACK_URL = "eventCallbackUrl"; + @SerializedName(SERIALIZED_NAME_EVENT_CALLBACK_URL) + @javax.annotation.Nullable + private URI eventCallbackUrl; + + public static final String SERIALIZED_NAME_EVENT_FALLBACK_URL = "eventFallbackUrl"; + @SerializedName(SERIALIZED_NAME_EVENT_FALLBACK_URL) + @javax.annotation.Nullable + private URI eventFallbackUrl; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + @javax.annotation.Nullable + private String tag; + + public static final String SERIALIZED_NAME_CONNECTION_METADATA = "connectionMetadata"; + @SerializedName(SERIALIZED_NAME_CONNECTION_METADATA) + @javax.annotation.Nullable + private Object connectionMetadata; + + public CreateWebRtcConnectionRequest() { + } + + public CreateWebRtcConnectionRequest type(@javax.annotation.Nonnull EndpointTypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public EndpointTypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull EndpointTypeEnum type) { + this.type = type; + } + + + public CreateWebRtcConnectionRequest direction(@javax.annotation.Nonnull EndpointDirectionEnum direction) { + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + */ + @javax.annotation.Nonnull + public EndpointDirectionEnum getDirection() { + return direction; + } + + public void setDirection(@javax.annotation.Nonnull EndpointDirectionEnum direction) { + this.direction = direction; + } + + + public CreateWebRtcConnectionRequest eventCallbackUrl(@javax.annotation.Nullable URI eventCallbackUrl) { + this.eventCallbackUrl = eventCallbackUrl; + return this; + } + + /** + * The URL to send event callbacks to. + * @return eventCallbackUrl + */ + @javax.annotation.Nullable + public URI getEventCallbackUrl() { + return eventCallbackUrl; + } + + public void setEventCallbackUrl(@javax.annotation.Nullable URI eventCallbackUrl) { + this.eventCallbackUrl = eventCallbackUrl; + } + + + public CreateWebRtcConnectionRequest eventFallbackUrl(@javax.annotation.Nullable URI eventFallbackUrl) { + this.eventFallbackUrl = eventFallbackUrl; + return this; + } + + /** + * The URL to send event fallbacks to. + * @return eventFallbackUrl + */ + @javax.annotation.Nullable + public URI getEventFallbackUrl() { + return eventFallbackUrl; + } + + public void setEventFallbackUrl(@javax.annotation.Nullable URI eventFallbackUrl) { + this.eventFallbackUrl = eventFallbackUrl; + } + + + public CreateWebRtcConnectionRequest tag(@javax.annotation.Nullable String tag) { + this.tag = tag; + return this; + } + + /** + * A tag for the endpoint. + * @return tag + */ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + public void setTag(@javax.annotation.Nullable String tag) { + this.tag = tag; + } + + + public CreateWebRtcConnectionRequest connectionMetadata(@javax.annotation.Nullable Object connectionMetadata) { + this.connectionMetadata = connectionMetadata; + return this; + } + + /** + * Get connectionMetadata + * @return connectionMetadata + */ + @javax.annotation.Nullable + public Object getConnectionMetadata() { + return connectionMetadata; + } + + public void setConnectionMetadata(@javax.annotation.Nullable Object connectionMetadata) { + this.connectionMetadata = connectionMetadata; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateWebRtcConnectionRequest instance itself + */ + public CreateWebRtcConnectionRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateWebRtcConnectionRequest createWebRtcConnectionRequest = (CreateWebRtcConnectionRequest) o; + return Objects.equals(this.type, createWebRtcConnectionRequest.type) && + Objects.equals(this.direction, createWebRtcConnectionRequest.direction) && + Objects.equals(this.eventCallbackUrl, createWebRtcConnectionRequest.eventCallbackUrl) && + Objects.equals(this.eventFallbackUrl, createWebRtcConnectionRequest.eventFallbackUrl) && + Objects.equals(this.tag, createWebRtcConnectionRequest.tag) && + Objects.equals(this.connectionMetadata, createWebRtcConnectionRequest.connectionMetadata)&& + Objects.equals(this.additionalProperties, createWebRtcConnectionRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(type, direction, eventCallbackUrl, eventFallbackUrl, tag, connectionMetadata, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateWebRtcConnectionRequest {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" eventCallbackUrl: ").append(toIndentedString(eventCallbackUrl)).append("\n"); + sb.append(" eventFallbackUrl: ").append(toIndentedString(eventFallbackUrl)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" connectionMetadata: ").append(toIndentedString(connectionMetadata)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("type", "direction", "eventCallbackUrl", "eventFallbackUrl", "tag", "connectionMetadata")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("type", "direction")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateWebRtcConnectionRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateWebRtcConnectionRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in CreateWebRtcConnectionRequest is not found in the empty JSON string", CreateWebRtcConnectionRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateWebRtcConnectionRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `type` + EndpointTypeEnum.validateJsonElement(jsonObj.get("type")); + // validate the required field `direction` + EndpointDirectionEnum.validateJsonElement(jsonObj.get("direction")); + if ((jsonObj.get("eventCallbackUrl") != null && !jsonObj.get("eventCallbackUrl").isJsonNull()) && !jsonObj.get("eventCallbackUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `eventCallbackUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventCallbackUrl").toString())); + } + if ((jsonObj.get("eventFallbackUrl") != null && !jsonObj.get("eventFallbackUrl").isJsonNull()) && !jsonObj.get("eventFallbackUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `eventFallbackUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventFallbackUrl").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateWebRtcConnectionRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateWebRtcConnectionRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateWebRtcConnectionRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateWebRtcConnectionRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CreateWebRtcConnectionRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateWebRtcConnectionRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateWebRtcConnectionRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateWebRtcConnectionRequest + * @throws IOException if the JSON string is invalid with respect to CreateWebRtcConnectionRequest + */ + public static CreateWebRtcConnectionRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateWebRtcConnectionRequest.class); + } + + /** + * Convert an instance of CreateWebRtcConnectionRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/Device.java b/src/main/java/com/bandwidth/sdk/model/Device.java new file mode 100644 index 00000000..3b1e46b3 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/Device.java @@ -0,0 +1,380 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import java.util.Locale; +import com.bandwidth.sdk.model.DeviceStatusEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import com.bandwidth.sdk.JSON; + +/** + * Device + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0") +public class Device { + public static final String SERIALIZED_NAME_DEVICE_ID = "deviceId"; + @SerializedName(SERIALIZED_NAME_DEVICE_ID) + @javax.annotation.Nonnull + private String deviceId; + + public static final String SERIALIZED_NAME_DEVICE_NAME = "deviceName"; + @SerializedName(SERIALIZED_NAME_DEVICE_NAME) + @javax.annotation.Nullable + private String deviceName; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private DeviceStatusEnum status; + + public static final String SERIALIZED_NAME_CREATION_TIMESTAMP = "creationTimestamp"; + @SerializedName(SERIALIZED_NAME_CREATION_TIMESTAMP) + @javax.annotation.Nonnull + private OffsetDateTime creationTimestamp; + + public Device() { + } + + public Device deviceId(@javax.annotation.Nonnull String deviceId) { + this.deviceId = deviceId; + return this; + } + + /** + * The unique ID of the device. + * @return deviceId + */ + @javax.annotation.Nonnull + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(@javax.annotation.Nonnull String deviceId) { + this.deviceId = deviceId; + } + + + public Device deviceName(@javax.annotation.Nullable String deviceName) { + this.deviceName = deviceName; + return this; + } + + /** + * The name of the device. + * @return deviceName + */ + @javax.annotation.Nullable + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(@javax.annotation.Nullable String deviceName) { + this.deviceName = deviceName; + } + + + public Device status(@javax.annotation.Nonnull DeviceStatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public DeviceStatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull DeviceStatusEnum status) { + this.status = status; + } + + + public Device creationTimestamp(@javax.annotation.Nonnull OffsetDateTime creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + /** + * The time the device was created. In ISO-8601 format. + * @return creationTimestamp + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreationTimestamp() { + return creationTimestamp; + } + + public void setCreationTimestamp(@javax.annotation.Nonnull OffsetDateTime creationTimestamp) { + this.creationTimestamp = creationTimestamp; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Device instance itself + */ + public Device putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Device device = (Device) o; + return Objects.equals(this.deviceId, device.deviceId) && + Objects.equals(this.deviceName, device.deviceName) && + Objects.equals(this.status, device.status) && + Objects.equals(this.creationTimestamp, device.creationTimestamp)&& + Objects.equals(this.additionalProperties, device.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(deviceId, deviceName, status, creationTimestamp, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Device {\n"); + sb.append(" deviceId: ").append(toIndentedString(deviceId)).append("\n"); + sb.append(" deviceName: ").append(toIndentedString(deviceName)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" creationTimestamp: ").append(toIndentedString(creationTimestamp)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("deviceId", "deviceName", "status", "creationTimestamp")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("deviceId", "status", "creationTimestamp")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Device + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Device.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in Device is not found in the empty JSON string", Device.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Device.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("deviceId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `deviceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("deviceId").toString())); + } + if ((jsonObj.get("deviceName") != null && !jsonObj.get("deviceName").isJsonNull()) && !jsonObj.get("deviceName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `deviceName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("deviceName").toString())); + } + // validate the required field `status` + DeviceStatusEnum.validateJsonElement(jsonObj.get("status")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Device.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Device' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Device.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Device value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Device read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Device instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Device given an JSON string + * + * @param jsonString JSON string + * @return An instance of Device + * @throws IOException if the JSON string is invalid with respect to Device + */ + public static Device fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Device.class); + } + + /** + * Convert an instance of Device to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/DeviceStatusEnum.java b/src/main/java/com/bandwidth/sdk/model/DeviceStatusEnum.java new file mode 100644 index 00000000..8fc6fbca --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/DeviceStatusEnum.java @@ -0,0 +1,80 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets deviceStatusEnum + */ +@JsonAdapter(DeviceStatusEnum.Adapter.class) +public enum DeviceStatusEnum { + + CONNECTED("CONNECTED"), + + DISCONNECTED("DISCONNECTED"); + + private String value; + + DeviceStatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static DeviceStatusEnum fromValue(String value) { + for (DeviceStatusEnum b : DeviceStatusEnum.values()) { + if (b.value.equalsIgnoreCase(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final DeviceStatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public DeviceStatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DeviceStatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + DeviceStatusEnum.fromValue(value); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/Endpoint.java b/src/main/java/com/bandwidth/sdk/model/Endpoint.java new file mode 100644 index 00000000..1a6e1157 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/Endpoint.java @@ -0,0 +1,486 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import java.util.Locale; +import com.bandwidth.sdk.model.Device; +import com.bandwidth.sdk.model.EndpointStatusEnum; +import com.bandwidth.sdk.model.EndpointTypeEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import com.bandwidth.sdk.JSON; + +/** + * Endpoint + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0") +public class Endpoint { + public static final String SERIALIZED_NAME_ENDPOINT_ID = "endpointId"; + @SerializedName(SERIALIZED_NAME_ENDPOINT_ID) + @javax.annotation.Nonnull + private String endpointId; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private EndpointTypeEnum type; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private EndpointStatusEnum status; + + public static final String SERIALIZED_NAME_CREATION_TIMESTAMP = "creationTimestamp"; + @SerializedName(SERIALIZED_NAME_CREATION_TIMESTAMP) + @javax.annotation.Nonnull + private OffsetDateTime creationTimestamp; + + public static final String SERIALIZED_NAME_EXPIRATION_TIMESTAMP = "expirationTimestamp"; + @SerializedName(SERIALIZED_NAME_EXPIRATION_TIMESTAMP) + @javax.annotation.Nonnull + private OffsetDateTime expirationTimestamp; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + @javax.annotation.Nullable + private String tag; + + public static final String SERIALIZED_NAME_DEVICES = "devices"; + @SerializedName(SERIALIZED_NAME_DEVICES) + @javax.annotation.Nullable + private List devices = new ArrayList<>(); + + public Endpoint() { + } + + public Endpoint endpointId(@javax.annotation.Nonnull String endpointId) { + this.endpointId = endpointId; + return this; + } + + /** + * The unique ID of the endpoint. + * @return endpointId + */ + @javax.annotation.Nonnull + public String getEndpointId() { + return endpointId; + } + + public void setEndpointId(@javax.annotation.Nonnull String endpointId) { + this.endpointId = endpointId; + } + + + public Endpoint type(@javax.annotation.Nonnull EndpointTypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public EndpointTypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull EndpointTypeEnum type) { + this.type = type; + } + + + public Endpoint status(@javax.annotation.Nonnull EndpointStatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public EndpointStatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull EndpointStatusEnum status) { + this.status = status; + } + + + public Endpoint creationTimestamp(@javax.annotation.Nonnull OffsetDateTime creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + /** + * The time the endpoint was created. In ISO-8601 format. + * @return creationTimestamp + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreationTimestamp() { + return creationTimestamp; + } + + public void setCreationTimestamp(@javax.annotation.Nonnull OffsetDateTime creationTimestamp) { + this.creationTimestamp = creationTimestamp; + } + + + public Endpoint expirationTimestamp(@javax.annotation.Nonnull OffsetDateTime expirationTimestamp) { + this.expirationTimestamp = expirationTimestamp; + return this; + } + + /** + * The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. + * @return expirationTimestamp + */ + @javax.annotation.Nonnull + public OffsetDateTime getExpirationTimestamp() { + return expirationTimestamp; + } + + public void setExpirationTimestamp(@javax.annotation.Nonnull OffsetDateTime expirationTimestamp) { + this.expirationTimestamp = expirationTimestamp; + } + + + public Endpoint tag(@javax.annotation.Nullable String tag) { + this.tag = tag; + return this; + } + + /** + * A tag for the endpoint. + * @return tag + */ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + public void setTag(@javax.annotation.Nullable String tag) { + this.tag = tag; + } + + + public Endpoint devices(@javax.annotation.Nullable List devices) { + this.devices = devices; + return this; + } + + public Endpoint addDevicesItem(Device devicesItem) { + if (this.devices == null) { + this.devices = new ArrayList<>(); + } + this.devices.add(devicesItem); + return this; + } + + /** + * Get devices + * @return devices + */ + @javax.annotation.Nullable + public List getDevices() { + return devices; + } + + public void setDevices(@javax.annotation.Nullable List devices) { + this.devices = devices; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Endpoint instance itself + */ + public Endpoint putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Endpoint endpoint = (Endpoint) o; + return Objects.equals(this.endpointId, endpoint.endpointId) && + Objects.equals(this.type, endpoint.type) && + Objects.equals(this.status, endpoint.status) && + Objects.equals(this.creationTimestamp, endpoint.creationTimestamp) && + Objects.equals(this.expirationTimestamp, endpoint.expirationTimestamp) && + Objects.equals(this.tag, endpoint.tag) && + Objects.equals(this.devices, endpoint.devices)&& + Objects.equals(this.additionalProperties, endpoint.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(endpointId, type, status, creationTimestamp, expirationTimestamp, tag, devices, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Endpoint {\n"); + sb.append(" endpointId: ").append(toIndentedString(endpointId)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" creationTimestamp: ").append(toIndentedString(creationTimestamp)).append("\n"); + sb.append(" expirationTimestamp: ").append(toIndentedString(expirationTimestamp)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" devices: ").append(toIndentedString(devices)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("endpointId", "type", "status", "creationTimestamp", "expirationTimestamp", "tag", "devices")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("endpointId", "type", "status", "creationTimestamp", "expirationTimestamp")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Endpoint + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Endpoint.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in Endpoint is not found in the empty JSON string", Endpoint.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Endpoint.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("endpointId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `endpointId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("endpointId").toString())); + } + // validate the required field `type` + EndpointTypeEnum.validateJsonElement(jsonObj.get("type")); + // validate the required field `status` + EndpointStatusEnum.validateJsonElement(jsonObj.get("status")); + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + if (jsonObj.get("devices") != null && !jsonObj.get("devices").isJsonNull()) { + JsonArray jsonArraydevices = jsonObj.getAsJsonArray("devices"); + if (jsonArraydevices != null) { + // ensure the json data is an array + if (!jsonObj.get("devices").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `devices` to be an array in the JSON string but got `%s`", jsonObj.get("devices").toString())); + } + + // validate the optional field `devices` (array) + for (int i = 0; i < jsonArraydevices.size(); i++) { + Device.validateJsonElement(jsonArraydevices.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Endpoint.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Endpoint' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Endpoint.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Endpoint value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Endpoint read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Endpoint instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Endpoint given an JSON string + * + * @param jsonString JSON string + * @return An instance of Endpoint + * @throws IOException if the JSON string is invalid with respect to Endpoint + */ + public static Endpoint fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Endpoint.class); + } + + /** + * Convert an instance of Endpoint to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/EndpointDirectionEnum.java b/src/main/java/com/bandwidth/sdk/model/EndpointDirectionEnum.java new file mode 100644 index 00000000..f888df29 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/EndpointDirectionEnum.java @@ -0,0 +1,82 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets endpointDirectionEnum + */ +@JsonAdapter(EndpointDirectionEnum.Adapter.class) +public enum EndpointDirectionEnum { + + INBOUND("INBOUND"), + + OUTBOUND("OUTBOUND"), + + BIDIRECTIONAL("BIDIRECTIONAL"); + + private String value; + + EndpointDirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static EndpointDirectionEnum fromValue(String value) { + for (EndpointDirectionEnum b : EndpointDirectionEnum.values()) { + if (b.value.equalsIgnoreCase(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EndpointDirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EndpointDirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EndpointDirectionEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + EndpointDirectionEnum.fromValue(value); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/EndpointEvent.java b/src/main/java/com/bandwidth/sdk/model/EndpointEvent.java new file mode 100644 index 00000000..3b3a8b25 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/EndpointEvent.java @@ -0,0 +1,521 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import java.util.Locale; +import com.bandwidth.sdk.model.Device; +import com.bandwidth.sdk.model.EndpointEventTypeEnum; +import com.bandwidth.sdk.model.EndpointStatusEnum; +import com.bandwidth.sdk.model.EndpointTypeEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import com.bandwidth.sdk.JSON; + +/** + * An event that occurred on an endpoint. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0") +public class EndpointEvent { + public static final String SERIALIZED_NAME_ENDPOINT_ID = "endpointId"; + @SerializedName(SERIALIZED_NAME_ENDPOINT_ID) + @javax.annotation.Nonnull + private String endpointId; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private EndpointTypeEnum type; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private EndpointStatusEnum status; + + public static final String SERIALIZED_NAME_CREATION_TIMESTAMP = "creationTimestamp"; + @SerializedName(SERIALIZED_NAME_CREATION_TIMESTAMP) + @javax.annotation.Nonnull + private OffsetDateTime creationTimestamp; + + public static final String SERIALIZED_NAME_EXPIRATION_TIMESTAMP = "expirationTimestamp"; + @SerializedName(SERIALIZED_NAME_EXPIRATION_TIMESTAMP) + @javax.annotation.Nonnull + private OffsetDateTime expirationTimestamp; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + @javax.annotation.Nullable + private String tag; + + public static final String SERIALIZED_NAME_EVENT_TIME = "eventTime"; + @SerializedName(SERIALIZED_NAME_EVENT_TIME) + @javax.annotation.Nonnull + private OffsetDateTime eventTime; + + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + @javax.annotation.Nonnull + private EndpointEventTypeEnum eventType; + + public static final String SERIALIZED_NAME_DEVICE = "device"; + @SerializedName(SERIALIZED_NAME_DEVICE) + @javax.annotation.Nullable + private Device device; + + public EndpointEvent() { + } + + public EndpointEvent endpointId(@javax.annotation.Nonnull String endpointId) { + this.endpointId = endpointId; + return this; + } + + /** + * The unique ID of the endpoint. + * @return endpointId + */ + @javax.annotation.Nonnull + public String getEndpointId() { + return endpointId; + } + + public void setEndpointId(@javax.annotation.Nonnull String endpointId) { + this.endpointId = endpointId; + } + + + public EndpointEvent type(@javax.annotation.Nonnull EndpointTypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public EndpointTypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull EndpointTypeEnum type) { + this.type = type; + } + + + public EndpointEvent status(@javax.annotation.Nonnull EndpointStatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public EndpointStatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull EndpointStatusEnum status) { + this.status = status; + } + + + public EndpointEvent creationTimestamp(@javax.annotation.Nonnull OffsetDateTime creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + /** + * The time the endpoint was created. In ISO-8601 format. + * @return creationTimestamp + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreationTimestamp() { + return creationTimestamp; + } + + public void setCreationTimestamp(@javax.annotation.Nonnull OffsetDateTime creationTimestamp) { + this.creationTimestamp = creationTimestamp; + } + + + public EndpointEvent expirationTimestamp(@javax.annotation.Nonnull OffsetDateTime expirationTimestamp) { + this.expirationTimestamp = expirationTimestamp; + return this; + } + + /** + * The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. + * @return expirationTimestamp + */ + @javax.annotation.Nonnull + public OffsetDateTime getExpirationTimestamp() { + return expirationTimestamp; + } + + public void setExpirationTimestamp(@javax.annotation.Nonnull OffsetDateTime expirationTimestamp) { + this.expirationTimestamp = expirationTimestamp; + } + + + public EndpointEvent tag(@javax.annotation.Nullable String tag) { + this.tag = tag; + return this; + } + + /** + * A tag for the endpoint. + * @return tag + */ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + public void setTag(@javax.annotation.Nullable String tag) { + this.tag = tag; + } + + + public EndpointEvent eventTime(@javax.annotation.Nonnull OffsetDateTime eventTime) { + this.eventTime = eventTime; + return this; + } + + /** + * The time the event occurred. In ISO-8601 format. + * @return eventTime + */ + @javax.annotation.Nonnull + public OffsetDateTime getEventTime() { + return eventTime; + } + + public void setEventTime(@javax.annotation.Nonnull OffsetDateTime eventTime) { + this.eventTime = eventTime; + } + + + public EndpointEvent eventType(@javax.annotation.Nonnull EndpointEventTypeEnum eventType) { + this.eventType = eventType; + return this; + } + + /** + * Get eventType + * @return eventType + */ + @javax.annotation.Nonnull + public EndpointEventTypeEnum getEventType() { + return eventType; + } + + public void setEventType(@javax.annotation.Nonnull EndpointEventTypeEnum eventType) { + this.eventType = eventType; + } + + + public EndpointEvent device(@javax.annotation.Nullable Device device) { + this.device = device; + return this; + } + + /** + * Get device + * @return device + */ + @javax.annotation.Nullable + public Device getDevice() { + return device; + } + + public void setDevice(@javax.annotation.Nullable Device device) { + this.device = device; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EndpointEvent instance itself + */ + public EndpointEvent putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EndpointEvent endpointEvent = (EndpointEvent) o; + return Objects.equals(this.endpointId, endpointEvent.endpointId) && + Objects.equals(this.type, endpointEvent.type) && + Objects.equals(this.status, endpointEvent.status) && + Objects.equals(this.creationTimestamp, endpointEvent.creationTimestamp) && + Objects.equals(this.expirationTimestamp, endpointEvent.expirationTimestamp) && + Objects.equals(this.tag, endpointEvent.tag) && + Objects.equals(this.eventTime, endpointEvent.eventTime) && + Objects.equals(this.eventType, endpointEvent.eventType) && + Objects.equals(this.device, endpointEvent.device)&& + Objects.equals(this.additionalProperties, endpointEvent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(endpointId, type, status, creationTimestamp, expirationTimestamp, tag, eventTime, eventType, device, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EndpointEvent {\n"); + sb.append(" endpointId: ").append(toIndentedString(endpointId)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" creationTimestamp: ").append(toIndentedString(creationTimestamp)).append("\n"); + sb.append(" expirationTimestamp: ").append(toIndentedString(expirationTimestamp)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" device: ").append(toIndentedString(device)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("endpointId", "type", "status", "creationTimestamp", "expirationTimestamp", "tag", "eventTime", "eventType", "device")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("endpointId", "type", "status", "creationTimestamp", "expirationTimestamp", "eventTime", "eventType")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EndpointEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EndpointEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in EndpointEvent is not found in the empty JSON string", EndpointEvent.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EndpointEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("endpointId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `endpointId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("endpointId").toString())); + } + // validate the required field `type` + EndpointTypeEnum.validateJsonElement(jsonObj.get("type")); + // validate the required field `status` + EndpointStatusEnum.validateJsonElement(jsonObj.get("status")); + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + // validate the required field `eventType` + EndpointEventTypeEnum.validateJsonElement(jsonObj.get("eventType")); + // validate the optional field `device` + if (jsonObj.get("device") != null && !jsonObj.get("device").isJsonNull()) { + Device.validateJsonElement(jsonObj.get("device")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EndpointEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EndpointEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EndpointEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EndpointEvent value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public EndpointEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EndpointEvent instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EndpointEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of EndpointEvent + * @throws IOException if the JSON string is invalid with respect to EndpointEvent + */ + public static EndpointEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EndpointEvent.class); + } + + /** + * Convert an instance of EndpointEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/EndpointEventTypeEnum.java b/src/main/java/com/bandwidth/sdk/model/EndpointEventTypeEnum.java new file mode 100644 index 00000000..c394e7ac --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/EndpointEventTypeEnum.java @@ -0,0 +1,80 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets endpointEventTypeEnum + */ +@JsonAdapter(EndpointEventTypeEnum.Adapter.class) +public enum EndpointEventTypeEnum { + + DEVICE_CONNECTED("DEVICE_CONNECTED"), + + DEVICE_DISCONNECTED("DEVICE_DISCONNECTED"); + + private String value; + + EndpointEventTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static EndpointEventTypeEnum fromValue(String value) { + for (EndpointEventTypeEnum b : EndpointEventTypeEnum.values()) { + if (b.value.equalsIgnoreCase(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EndpointEventTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EndpointEventTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EndpointEventTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + EndpointEventTypeEnum.fromValue(value); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/EndpointResponse.java b/src/main/java/com/bandwidth/sdk/model/EndpointResponse.java new file mode 100644 index 00000000..1a59b799 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/EndpointResponse.java @@ -0,0 +1,387 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import java.util.Locale; +import com.bandwidth.sdk.model.Endpoint; +import com.bandwidth.sdk.model.Error; +import com.bandwidth.sdk.model.Link; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import com.bandwidth.sdk.JSON; + +/** + * EndpointResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0") +public class EndpointResponse { + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull + private List links = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private Endpoint data; + + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nonnull + private List errors = new ArrayList<>(); + + public EndpointResponse() { + } + + public EndpointResponse links(@javax.annotation.Nonnull List links) { + this.links = links; + return this; + } + + public EndpointResponse addLinksItem(Link linksItem) { + if (this.links == null) { + this.links = new ArrayList<>(); + } + this.links.add(linksItem); + return this; + } + + /** + * Get links + * @return links + */ + @javax.annotation.Nonnull + public List getLinks() { + return links; + } + + public void setLinks(@javax.annotation.Nonnull List links) { + this.links = links; + } + + + public EndpointResponse data(@javax.annotation.Nonnull Endpoint data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public Endpoint getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull Endpoint data) { + this.data = data; + } + + + public EndpointResponse errors(@javax.annotation.Nonnull List errors) { + this.errors = errors; + return this; + } + + public EndpointResponse addErrorsItem(Error errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Get errors + * @return errors + */ + @javax.annotation.Nonnull + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nonnull List errors) { + this.errors = errors; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EndpointResponse instance itself + */ + public EndpointResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EndpointResponse endpointResponse = (EndpointResponse) o; + return Objects.equals(this.links, endpointResponse.links) && + Objects.equals(this.data, endpointResponse.data) && + Objects.equals(this.errors, endpointResponse.errors)&& + Objects.equals(this.additionalProperties, endpointResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(links, data, errors, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EndpointResponse {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("links", "data", "errors")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("links", "data", "errors")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EndpointResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EndpointResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in EndpointResponse is not found in the empty JSON string", EndpointResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EndpointResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("links").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `links` to be an array in the JSON string but got `%s`", jsonObj.get("links").toString())); + } + + JsonArray jsonArraylinks = jsonObj.getAsJsonArray("links"); + // validate the required field `links` (array) + for (int i = 0; i < jsonArraylinks.size(); i++) { + Link.validateJsonElement(jsonArraylinks.get(i)); + }; + // validate the required field `data` + Endpoint.validateJsonElement(jsonObj.get("data")); + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + // validate the required field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + Error.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EndpointResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EndpointResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EndpointResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EndpointResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public EndpointResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EndpointResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EndpointResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of EndpointResponse + * @throws IOException if the JSON string is invalid with respect to EndpointResponse + */ + public static EndpointResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EndpointResponse.class); + } + + /** + * Convert an instance of EndpointResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/EndpointStatusEnum.java b/src/main/java/com/bandwidth/sdk/model/EndpointStatusEnum.java new file mode 100644 index 00000000..29a90e1f --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/EndpointStatusEnum.java @@ -0,0 +1,80 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets endpointStatusEnum + */ +@JsonAdapter(EndpointStatusEnum.Adapter.class) +public enum EndpointStatusEnum { + + CONNECTED("CONNECTED"), + + DISCONNECTED("DISCONNECTED"); + + private String value; + + EndpointStatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static EndpointStatusEnum fromValue(String value) { + for (EndpointStatusEnum b : EndpointStatusEnum.values()) { + if (b.value.equalsIgnoreCase(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EndpointStatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EndpointStatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EndpointStatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + EndpointStatusEnum.fromValue(value); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/EndpointTypeEnum.java b/src/main/java/com/bandwidth/sdk/model/EndpointTypeEnum.java new file mode 100644 index 00000000..08f86bd5 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/EndpointTypeEnum.java @@ -0,0 +1,78 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets endpointTypeEnum + */ +@JsonAdapter(EndpointTypeEnum.Adapter.class) +public enum EndpointTypeEnum { + + WEBRTC("WEBRTC"); + + private String value; + + EndpointTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static EndpointTypeEnum fromValue(String value) { + for (EndpointTypeEnum b : EndpointTypeEnum.values()) { + if (b.value.equalsIgnoreCase(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EndpointTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EndpointTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EndpointTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + EndpointTypeEnum.fromValue(value); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/Endpoints.java b/src/main/java/com/bandwidth/sdk/model/Endpoints.java new file mode 100644 index 00000000..4a04e333 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/Endpoints.java @@ -0,0 +1,435 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import java.util.Locale; +import com.bandwidth.sdk.model.EndpointStatusEnum; +import com.bandwidth.sdk.model.EndpointTypeEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import com.bandwidth.sdk.JSON; + +/** + * Endpoints + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0") +public class Endpoints { + public static final String SERIALIZED_NAME_ENDPOINT_ID = "endpointId"; + @SerializedName(SERIALIZED_NAME_ENDPOINT_ID) + @javax.annotation.Nonnull + private String endpointId; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private EndpointTypeEnum type; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private EndpointStatusEnum status; + + public static final String SERIALIZED_NAME_CREATION_TIMESTAMP = "creationTimestamp"; + @SerializedName(SERIALIZED_NAME_CREATION_TIMESTAMP) + @javax.annotation.Nonnull + private OffsetDateTime creationTimestamp; + + public static final String SERIALIZED_NAME_EXPIRATION_TIMESTAMP = "expirationTimestamp"; + @SerializedName(SERIALIZED_NAME_EXPIRATION_TIMESTAMP) + @javax.annotation.Nonnull + private OffsetDateTime expirationTimestamp; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + @javax.annotation.Nullable + private String tag; + + public Endpoints() { + } + + public Endpoints endpointId(@javax.annotation.Nonnull String endpointId) { + this.endpointId = endpointId; + return this; + } + + /** + * The unique ID of the endpoint. + * @return endpointId + */ + @javax.annotation.Nonnull + public String getEndpointId() { + return endpointId; + } + + public void setEndpointId(@javax.annotation.Nonnull String endpointId) { + this.endpointId = endpointId; + } + + + public Endpoints type(@javax.annotation.Nonnull EndpointTypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public EndpointTypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull EndpointTypeEnum type) { + this.type = type; + } + + + public Endpoints status(@javax.annotation.Nonnull EndpointStatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public EndpointStatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull EndpointStatusEnum status) { + this.status = status; + } + + + public Endpoints creationTimestamp(@javax.annotation.Nonnull OffsetDateTime creationTimestamp) { + this.creationTimestamp = creationTimestamp; + return this; + } + + /** + * The time the endpoint was created. In ISO-8601 format. + * @return creationTimestamp + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreationTimestamp() { + return creationTimestamp; + } + + public void setCreationTimestamp(@javax.annotation.Nonnull OffsetDateTime creationTimestamp) { + this.creationTimestamp = creationTimestamp; + } + + + public Endpoints expirationTimestamp(@javax.annotation.Nonnull OffsetDateTime expirationTimestamp) { + this.expirationTimestamp = expirationTimestamp; + return this; + } + + /** + * The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. + * @return expirationTimestamp + */ + @javax.annotation.Nonnull + public OffsetDateTime getExpirationTimestamp() { + return expirationTimestamp; + } + + public void setExpirationTimestamp(@javax.annotation.Nonnull OffsetDateTime expirationTimestamp) { + this.expirationTimestamp = expirationTimestamp; + } + + + public Endpoints tag(@javax.annotation.Nullable String tag) { + this.tag = tag; + return this; + } + + /** + * A tag for the endpoint. + * @return tag + */ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + public void setTag(@javax.annotation.Nullable String tag) { + this.tag = tag; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Endpoints instance itself + */ + public Endpoints putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Endpoints endpoints = (Endpoints) o; + return Objects.equals(this.endpointId, endpoints.endpointId) && + Objects.equals(this.type, endpoints.type) && + Objects.equals(this.status, endpoints.status) && + Objects.equals(this.creationTimestamp, endpoints.creationTimestamp) && + Objects.equals(this.expirationTimestamp, endpoints.expirationTimestamp) && + Objects.equals(this.tag, endpoints.tag)&& + Objects.equals(this.additionalProperties, endpoints.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(endpointId, type, status, creationTimestamp, expirationTimestamp, tag, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Endpoints {\n"); + sb.append(" endpointId: ").append(toIndentedString(endpointId)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" creationTimestamp: ").append(toIndentedString(creationTimestamp)).append("\n"); + sb.append(" expirationTimestamp: ").append(toIndentedString(expirationTimestamp)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("endpointId", "type", "status", "creationTimestamp", "expirationTimestamp", "tag")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("endpointId", "type", "status", "creationTimestamp", "expirationTimestamp")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Endpoints + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Endpoints.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in Endpoints is not found in the empty JSON string", Endpoints.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Endpoints.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("endpointId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `endpointId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("endpointId").toString())); + } + // validate the required field `type` + EndpointTypeEnum.validateJsonElement(jsonObj.get("type")); + // validate the required field `status` + EndpointStatusEnum.validateJsonElement(jsonObj.get("status")); + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Endpoints.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Endpoints' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Endpoints.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Endpoints value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Endpoints read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Endpoints instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Endpoints given an JSON string + * + * @param jsonString JSON string + * @return An instance of Endpoints + * @throws IOException if the JSON string is invalid with respect to Endpoints + */ + public static Endpoints fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Endpoints.class); + } + + /** + * Convert an instance of Endpoints to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/ErrorResponse.java b/src/main/java/com/bandwidth/sdk/model/ErrorResponse.java new file mode 100644 index 00000000..506e1d91 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/ErrorResponse.java @@ -0,0 +1,384 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import java.util.Locale; +import com.bandwidth.sdk.model.Error; +import com.bandwidth.sdk.model.Link; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import com.bandwidth.sdk.JSON; + +/** + * ErrorResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0") +public class ErrorResponse { + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull + private List links = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nullable + private Object data; + + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nonnull + private List errors = new ArrayList<>(); + + public ErrorResponse() { + } + + public ErrorResponse links(@javax.annotation.Nonnull List links) { + this.links = links; + return this; + } + + public ErrorResponse addLinksItem(Link linksItem) { + if (this.links == null) { + this.links = new ArrayList<>(); + } + this.links.add(linksItem); + return this; + } + + /** + * Get links + * @return links + */ + @javax.annotation.Nonnull + public List getLinks() { + return links; + } + + public void setLinks(@javax.annotation.Nonnull List links) { + this.links = links; + } + + + public ErrorResponse data(@javax.annotation.Nullable Object data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nullable + public Object getData() { + return data; + } + + public void setData(@javax.annotation.Nullable Object data) { + this.data = data; + } + + + public ErrorResponse errors(@javax.annotation.Nonnull List errors) { + this.errors = errors; + return this; + } + + public ErrorResponse addErrorsItem(Error errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Get errors + * @return errors + */ + @javax.annotation.Nonnull + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nonnull List errors) { + this.errors = errors; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ErrorResponse instance itself + */ + public ErrorResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ErrorResponse errorResponse = (ErrorResponse) o; + return Objects.equals(this.links, errorResponse.links) && + Objects.equals(this.data, errorResponse.data) && + Objects.equals(this.errors, errorResponse.errors)&& + Objects.equals(this.additionalProperties, errorResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(links, data, errors, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ErrorResponse {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("links", "data", "errors")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("links", "data", "errors")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ErrorResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ErrorResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in ErrorResponse is not found in the empty JSON string", ErrorResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ErrorResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("links").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `links` to be an array in the JSON string but got `%s`", jsonObj.get("links").toString())); + } + + JsonArray jsonArraylinks = jsonObj.getAsJsonArray("links"); + // validate the required field `links` (array) + for (int i = 0; i < jsonArraylinks.size(); i++) { + Link.validateJsonElement(jsonArraylinks.get(i)); + }; + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + // validate the required field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + Error.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ErrorResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ErrorResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ErrorResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ErrorResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ErrorResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ErrorResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ErrorResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ErrorResponse + * @throws IOException if the JSON string is invalid with respect to ErrorResponse + */ + public static ErrorResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ErrorResponse.class); + } + + /** + * Convert an instance of ErrorResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/InboundCallback.java b/src/main/java/com/bandwidth/sdk/model/InboundCallback.java index bf27d076..17e398fe 100644 --- a/src/main/java/com/bandwidth/sdk/model/InboundCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/InboundCallback.java @@ -132,7 +132,7 @@ public InboundCallback to(@javax.annotation.Nonnull String to) { } /** - * The destination phone number the message was sent to. For inbound callbacks, this is the Bandwidth number or alphanumeric identifier that received the message. + * The destination phone number the message was sent to. For inbound callbacks, this is the Bandwidth number or alphanumeric identifier that received the message. * @return to */ @javax.annotation.Nonnull @@ -189,7 +189,7 @@ public InboundCallback carrierName(@javax.annotation.Nullable String carrierName } /** - * The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled. + * The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled. * @return carrierName */ @javax.annotation.Nullable diff --git a/src/main/java/com/bandwidth/sdk/model/InboundCallbackTypeEnum.java b/src/main/java/com/bandwidth/sdk/model/InboundCallbackTypeEnum.java index cb3a5b64..2c09896b 100644 --- a/src/main/java/com/bandwidth/sdk/model/InboundCallbackTypeEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/InboundCallbackTypeEnum.java @@ -26,7 +26,7 @@ import com.google.gson.stream.JsonWriter; /** - * The possible inbound callback types originating from MO messages or multichannel message client responses: - `message-received` indicates an MO message from a Bandwidth user's client to a Bandwidth number. - `request-location-response` indicates a response to a location request sent by the Bandwidth user's client after receiving an RBM message. - `suggestion-response` indicates a response to a suggestion sent by the Bandwidth user's client after receiving an RBM message. + * The possible inbound callback types originating from MO messages or multichannel message client responses: - `message-received` indicates an MO message from a Bandwidth user's client to a Bandwidth number. - `request-location-response` indicates a response to a location request sent by the Bandwidth user's client after receiving an RBM message. - `suggestion-response` indicates a response to a suggestion sent by the Bandwidth user's client after receiving an RBM message. */ @JsonAdapter(InboundCallbackTypeEnum.Adapter.class) public enum InboundCallbackTypeEnum { diff --git a/src/main/java/com/bandwidth/sdk/model/ListEndpointsResponse.java b/src/main/java/com/bandwidth/sdk/model/ListEndpointsResponse.java new file mode 100644 index 00000000..ceba96e9 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/ListEndpointsResponse.java @@ -0,0 +1,434 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import java.util.Locale; +import com.bandwidth.sdk.model.Endpoints; +import com.bandwidth.sdk.model.Error; +import com.bandwidth.sdk.model.Link; +import com.bandwidth.sdk.model.Page; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import com.bandwidth.sdk.JSON; + +/** + * ListEndpointsResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0") +public class ListEndpointsResponse { + public static final String SERIALIZED_NAME_LINKS = "links"; + @SerializedName(SERIALIZED_NAME_LINKS) + @javax.annotation.Nonnull + private List links = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PAGE = "page"; + @SerializedName(SERIALIZED_NAME_PAGE) + @javax.annotation.Nullable + private Page page; + + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private List data = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + @javax.annotation.Nonnull + private List errors = new ArrayList<>(); + + public ListEndpointsResponse() { + } + + public ListEndpointsResponse links(@javax.annotation.Nonnull List links) { + this.links = links; + return this; + } + + public ListEndpointsResponse addLinksItem(Link linksItem) { + if (this.links == null) { + this.links = new ArrayList<>(); + } + this.links.add(linksItem); + return this; + } + + /** + * Get links + * @return links + */ + @javax.annotation.Nonnull + public List getLinks() { + return links; + } + + public void setLinks(@javax.annotation.Nonnull List links) { + this.links = links; + } + + + public ListEndpointsResponse page(@javax.annotation.Nullable Page page) { + this.page = page; + return this; + } + + /** + * Get page + * @return page + */ + @javax.annotation.Nullable + public Page getPage() { + return page; + } + + public void setPage(@javax.annotation.Nullable Page page) { + this.page = page; + } + + + public ListEndpointsResponse data(@javax.annotation.Nonnull List data) { + this.data = data; + return this; + } + + public ListEndpointsResponse addDataItem(Endpoints dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public List getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull List data) { + this.data = data; + } + + + public ListEndpointsResponse errors(@javax.annotation.Nonnull List errors) { + this.errors = errors; + return this; + } + + public ListEndpointsResponse addErrorsItem(Error errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Get errors + * @return errors + */ + @javax.annotation.Nonnull + public List getErrors() { + return errors; + } + + public void setErrors(@javax.annotation.Nonnull List errors) { + this.errors = errors; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ListEndpointsResponse instance itself + */ + public ListEndpointsResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListEndpointsResponse listEndpointsResponse = (ListEndpointsResponse) o; + return Objects.equals(this.links, listEndpointsResponse.links) && + Objects.equals(this.page, listEndpointsResponse.page) && + Objects.equals(this.data, listEndpointsResponse.data) && + Objects.equals(this.errors, listEndpointsResponse.errors)&& + Objects.equals(this.additionalProperties, listEndpointsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(links, page, data, errors, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListEndpointsResponse {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("links", "page", "data", "errors")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("links", "data", "errors")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ListEndpointsResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListEndpointsResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in ListEndpointsResponse is not found in the empty JSON string", ListEndpointsResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ListEndpointsResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("links").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `links` to be an array in the JSON string but got `%s`", jsonObj.get("links").toString())); + } + + JsonArray jsonArraylinks = jsonObj.getAsJsonArray("links"); + // validate the required field `links` (array) + for (int i = 0; i < jsonArraylinks.size(); i++) { + Link.validateJsonElement(jsonArraylinks.get(i)); + }; + // validate the optional field `page` + if (jsonObj.get("page") != null && !jsonObj.get("page").isJsonNull()) { + Page.validateJsonElement(jsonObj.get("page")); + } + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + // validate the required field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + Endpoints.validateJsonElement(jsonArraydata.get(i)); + }; + // ensure the json data is an array + if (!jsonObj.get("errors").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); + } + + JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); + // validate the required field `errors` (array) + for (int i = 0; i < jsonArrayerrors.size(); i++) { + Error.validateJsonElement(jsonArrayerrors.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListEndpointsResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListEndpointsResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ListEndpointsResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ListEndpointsResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ListEndpointsResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ListEndpointsResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ListEndpointsResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListEndpointsResponse + * @throws IOException if the JSON string is invalid with respect to ListEndpointsResponse + */ + public static ListEndpointsResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListEndpointsResponse.class); + } + + /** + * Convert an instance of ListEndpointsResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/LookupResult.java b/src/main/java/com/bandwidth/sdk/model/LookupResult.java index eaec460e..65fc7a99 100644 --- a/src/main/java/com/bandwidth/sdk/model/LookupResult.java +++ b/src/main/java/com/bandwidth/sdk/model/LookupResult.java @@ -291,7 +291,7 @@ public LookupResult initialMessageDeliveryStatusDate(@javax.annotation.Nullable } /** - * [DNI-Only](#section/DNI-Only). The date the phone number entered the status described in `latestMessageDeliveryStatus`. Think of this as the \"start time\" for that status. Value resets every time the `latestMessageDeliveryStatus` changes. + * [DNI-Only](#section/DNI-Only). The date the phone number entered the status described in `latestMessageDeliveryStatus`. Think of this as the \"start time\" for that status. Value resets every time the `latestMessageDeliveryStatus` changes. * @return initialMessageDeliveryStatusDate */ @javax.annotation.Nullable @@ -310,7 +310,7 @@ public LookupResult latestMessageDeliveryStatusDate(@javax.annotation.Nullable L } /** - * [DNI-Only](#section/DNI-Only). The date bandwidth last received delivery status information for this phone number. Use this field to understand how up-to-date the `latestMessageDeliveryStatus` is. Value resets every time the `latestMessageDeliveryStatus` changes. + * [DNI-Only](#section/DNI-Only). The date bandwidth last received delivery status information for this phone number. Use this field to understand how up-to-date the `latestMessageDeliveryStatus` is. Value resets every time the `latestMessageDeliveryStatus` changes. * @return latestMessageDeliveryStatusDate */ @javax.annotation.Nullable diff --git a/src/main/java/com/bandwidth/sdk/model/MachineDetectionConfiguration.java b/src/main/java/com/bandwidth/sdk/model/MachineDetectionConfiguration.java index 0b46bbae..4adad0ce 100644 --- a/src/main/java/com/bandwidth/sdk/model/MachineDetectionConfiguration.java +++ b/src/main/java/com/bandwidth/sdk/model/MachineDetectionConfiguration.java @@ -235,7 +235,7 @@ public MachineDetectionConfiguration machineSpeechEndThreshold(@javax.annotation } /** - * When an answering machine is detected, the amount of silence (in seconds) before assuming the message has finished playing. If not provided it will default to the speechEndThreshold value. + * When an answering machine is detected, the amount of silence (in seconds) before assuming the message has finished playing. If not provided it will default to the speechEndThreshold value. * @return machineSpeechEndThreshold */ @javax.annotation.Nullable diff --git a/src/main/java/com/bandwidth/sdk/model/MessageRequest.java b/src/main/java/com/bandwidth/sdk/model/MessageRequest.java index 6bdc175a..0ed3c6db 100644 --- a/src/main/java/com/bandwidth/sdk/model/MessageRequest.java +++ b/src/main/java/com/bandwidth/sdk/model/MessageRequest.java @@ -154,7 +154,7 @@ public MessageRequest from(@javax.annotation.Nonnull String from) { } /** - * Either an alphanumeric sender ID or the sender's Bandwidth phone number in E.164 format, which must be hosted within Bandwidth and linked to the account that is generating the message. Alphanumeric Sender IDs can contain up to 11 characters, upper-case letters A-Z, lower-case letters a-z, numbers 0-9, space, hyphen -, plus +, underscore _ and ampersand &. Alphanumeric Sender IDs must contain at least one letter. + * Either an alphanumeric sender ID or the sender's Bandwidth phone number in E.164 format, which must be hosted within Bandwidth and linked to the account that is generating the message. Alphanumeric Sender IDs can contain up to 11 characters, upper-case letters A-Z, lower-case letters a-z, numbers 0-9, space, hyphen -, plus +, underscore _ and ampersand &. Alphanumeric Sender IDs must contain at least one letter. * @return from */ @javax.annotation.Nonnull diff --git a/src/main/java/com/bandwidth/sdk/model/Page.java b/src/main/java/com/bandwidth/sdk/model/Page.java new file mode 100644 index 00000000..659aced4 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/Page.java @@ -0,0 +1,374 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import com.bandwidth.sdk.JSON; + +/** + * Page + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0") +public class Page { + public static final String SERIALIZED_NAME_PAGE_SIZE = "pageSize"; + @SerializedName(SERIALIZED_NAME_PAGE_SIZE) + @javax.annotation.Nonnull + private Integer pageSize; + + public static final String SERIALIZED_NAME_TOTAL_ELEMENTS = "totalElements"; + @SerializedName(SERIALIZED_NAME_TOTAL_ELEMENTS) + @javax.annotation.Nullable + private Integer totalElements; + + public static final String SERIALIZED_NAME_TOTAL_PAGES = "totalPages"; + @SerializedName(SERIALIZED_NAME_TOTAL_PAGES) + @javax.annotation.Nullable + private Integer totalPages; + + public static final String SERIALIZED_NAME_PAGE_NUMBER = "pageNumber"; + @SerializedName(SERIALIZED_NAME_PAGE_NUMBER) + @javax.annotation.Nullable + private Integer pageNumber; + + public Page() { + } + + public Page pageSize(@javax.annotation.Nonnull Integer pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * The number of items per page. + * minimum: 0 + * @return pageSize + */ + @javax.annotation.Nonnull + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(@javax.annotation.Nonnull Integer pageSize) { + this.pageSize = pageSize; + } + + + public Page totalElements(@javax.annotation.Nullable Integer totalElements) { + this.totalElements = totalElements; + return this; + } + + /** + * The total number of items. + * minimum: 0 + * @return totalElements + */ + @javax.annotation.Nullable + public Integer getTotalElements() { + return totalElements; + } + + public void setTotalElements(@javax.annotation.Nullable Integer totalElements) { + this.totalElements = totalElements; + } + + + public Page totalPages(@javax.annotation.Nullable Integer totalPages) { + this.totalPages = totalPages; + return this; + } + + /** + * The total number of pages. + * minimum: 0 + * @return totalPages + */ + @javax.annotation.Nullable + public Integer getTotalPages() { + return totalPages; + } + + public void setTotalPages(@javax.annotation.Nullable Integer totalPages) { + this.totalPages = totalPages; + } + + + public Page pageNumber(@javax.annotation.Nullable Integer pageNumber) { + this.pageNumber = pageNumber; + return this; + } + + /** + * The current page number. + * minimum: 0 + * @return pageNumber + */ + @javax.annotation.Nullable + public Integer getPageNumber() { + return pageNumber; + } + + public void setPageNumber(@javax.annotation.Nullable Integer pageNumber) { + this.pageNumber = pageNumber; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Page instance itself + */ + public Page putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Page page = (Page) o; + return Objects.equals(this.pageSize, page.pageSize) && + Objects.equals(this.totalElements, page.totalElements) && + Objects.equals(this.totalPages, page.totalPages) && + Objects.equals(this.pageNumber, page.pageNumber)&& + Objects.equals(this.additionalProperties, page.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(pageSize, totalElements, totalPages, pageNumber, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Page {\n"); + sb.append(" pageSize: ").append(toIndentedString(pageSize)).append("\n"); + sb.append(" totalElements: ").append(toIndentedString(totalElements)).append("\n"); + sb.append(" totalPages: ").append(toIndentedString(totalPages)).append("\n"); + sb.append(" pageNumber: ").append(toIndentedString(pageNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("pageSize", "totalElements", "totalPages", "pageNumber")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("pageSize")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Page + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Page.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in Page is not found in the empty JSON string", Page.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Page.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Page.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Page' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Page.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Page value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Page read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Page instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Page given an JSON string + * + * @param jsonString JSON string + * @return An instance of Page + * @throws IOException if the JSON string is invalid with respect to Page + */ + public static Page fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Page.class); + } + + /** + * Convert an instance of Page to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/RbmOpenUrlEnum.java b/src/main/java/com/bandwidth/sdk/model/RbmOpenUrlEnum.java index a5749e75..ebad86e5 100644 --- a/src/main/java/com/bandwidth/sdk/model/RbmOpenUrlEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/RbmOpenUrlEnum.java @@ -26,7 +26,7 @@ import com.google.gson.stream.JsonWriter; /** - * Specifies how the URL should be opened on a mobile device. - `BROWSER` Opens the URL in the device's default browser. If application is not set or the device doesn’t support WebView, this option is used by default. - `WEBVIEW` Opens the URL in an in-app WebView. + * Specifies how the URL should be opened on a mobile device. - `BROWSER` Opens the URL in the device's default browser. If application is not set or the device doesn’t support WebView, this option is used by default. - `WEBVIEW` Opens the URL in an in-app WebView. */ @JsonAdapter(RbmOpenUrlEnum.Adapter.class) public enum RbmOpenUrlEnum { diff --git a/src/main/java/com/bandwidth/sdk/model/RbmWebViewEnum.java b/src/main/java/com/bandwidth/sdk/model/RbmWebViewEnum.java index 882b76fd..66d6526a 100644 --- a/src/main/java/com/bandwidth/sdk/model/RbmWebViewEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/RbmWebViewEnum.java @@ -26,7 +26,7 @@ import com.google.gson.stream.JsonWriter; /** - * Defines the layout of the WebView on a mobile device. It must be defined when application is set to `WEBVIEW` - `FULL` WebView takes the full screen. - `HALF` WebView takes half of the screen. - `TALL` WebView takes three-quarters of the screen. + * Defines the layout of the WebView on a mobile device. It must be defined when application is set to `WEBVIEW` - `FULL` WebView takes the full screen. - `HALF` WebView takes half of the screen. - `TALL` WebView takes three-quarters of the screen. */ @JsonAdapter(RbmWebViewEnum.Adapter.class) public enum RbmWebViewEnum { diff --git a/src/main/java/com/bandwidth/sdk/model/SipConnectionMetadata.java b/src/main/java/com/bandwidth/sdk/model/SipConnectionMetadata.java new file mode 100644 index 00000000..c2434be1 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/SipConnectionMetadata.java @@ -0,0 +1,374 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import java.util.Locale; +import com.bandwidth.sdk.model.SipCredentials; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import com.bandwidth.sdk.JSON; + +/** + * SipConnectionMetadata + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0") +public class SipConnectionMetadata { + public static final String SERIALIZED_NAME_IP_ADDRESS = "ipAddress"; + @SerializedName(SERIALIZED_NAME_IP_ADDRESS) + @javax.annotation.Nullable + private String ipAddress; + + public static final String SERIALIZED_NAME_PORT = "port"; + @SerializedName(SERIALIZED_NAME_PORT) + @javax.annotation.Nullable + private Integer port; + + public static final String SERIALIZED_NAME_CREDENTIALS = "credentials"; + @SerializedName(SERIALIZED_NAME_CREDENTIALS) + @javax.annotation.Nullable + private SipCredentials credentials; + + public static final String SERIALIZED_NAME_UUI_HEADER = "uuiHeader"; + @SerializedName(SERIALIZED_NAME_UUI_HEADER) + @javax.annotation.Nullable + private String uuiHeader; + + public SipConnectionMetadata() { + } + + public SipConnectionMetadata ipAddress(@javax.annotation.Nullable String ipAddress) { + this.ipAddress = ipAddress; + return this; + } + + /** + * The IP address of the SIP connection. + * @return ipAddress + */ + @javax.annotation.Nullable + public String getIpAddress() { + return ipAddress; + } + + public void setIpAddress(@javax.annotation.Nullable String ipAddress) { + this.ipAddress = ipAddress; + } + + + public SipConnectionMetadata port(@javax.annotation.Nullable Integer port) { + this.port = port; + return this; + } + + /** + * The port of the SIP connection. + * @return port + */ + @javax.annotation.Nullable + public Integer getPort() { + return port; + } + + public void setPort(@javax.annotation.Nullable Integer port) { + this.port = port; + } + + + public SipConnectionMetadata credentials(@javax.annotation.Nullable SipCredentials credentials) { + this.credentials = credentials; + return this; + } + + /** + * Get credentials + * @return credentials + */ + @javax.annotation.Nullable + public SipCredentials getCredentials() { + return credentials; + } + + public void setCredentials(@javax.annotation.Nullable SipCredentials credentials) { + this.credentials = credentials; + } + + + public SipConnectionMetadata uuiHeader(@javax.annotation.Nullable String uuiHeader) { + this.uuiHeader = uuiHeader; + return this; + } + + /** + * The User-to-User Information header for the SIP connection. + * @return uuiHeader + */ + @javax.annotation.Nullable + public String getUuiHeader() { + return uuiHeader; + } + + public void setUuiHeader(@javax.annotation.Nullable String uuiHeader) { + this.uuiHeader = uuiHeader; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SipConnectionMetadata instance itself + */ + public SipConnectionMetadata putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SipConnectionMetadata sipConnectionMetadata = (SipConnectionMetadata) o; + return Objects.equals(this.ipAddress, sipConnectionMetadata.ipAddress) && + Objects.equals(this.port, sipConnectionMetadata.port) && + Objects.equals(this.credentials, sipConnectionMetadata.credentials) && + Objects.equals(this.uuiHeader, sipConnectionMetadata.uuiHeader)&& + Objects.equals(this.additionalProperties, sipConnectionMetadata.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(ipAddress, port, credentials, uuiHeader, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SipConnectionMetadata {\n"); + sb.append(" ipAddress: ").append(toIndentedString(ipAddress)).append("\n"); + sb.append(" port: ").append(toIndentedString(port)).append("\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" uuiHeader: ").append(toIndentedString(uuiHeader)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("ipAddress", "port", "credentials", "uuiHeader")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SipConnectionMetadata + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SipConnectionMetadata.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in SipConnectionMetadata is not found in the empty JSON string", SipConnectionMetadata.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("ipAddress") != null && !jsonObj.get("ipAddress").isJsonNull()) && !jsonObj.get("ipAddress").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `ipAddress` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ipAddress").toString())); + } + // validate the optional field `credentials` + if (jsonObj.get("credentials") != null && !jsonObj.get("credentials").isJsonNull()) { + SipCredentials.validateJsonElement(jsonObj.get("credentials")); + } + if ((jsonObj.get("uuiHeader") != null && !jsonObj.get("uuiHeader").isJsonNull()) && !jsonObj.get("uuiHeader").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `uuiHeader` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuiHeader").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SipConnectionMetadata.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SipConnectionMetadata' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SipConnectionMetadata.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SipConnectionMetadata value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SipConnectionMetadata read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SipConnectionMetadata instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SipConnectionMetadata given an JSON string + * + * @param jsonString JSON string + * @return An instance of SipConnectionMetadata + * @throws IOException if the JSON string is invalid with respect to SipConnectionMetadata + */ + public static SipConnectionMetadata fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SipConnectionMetadata.class); + } + + /** + * Convert an instance of SipConnectionMetadata to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/SipCredentials.java b/src/main/java/com/bandwidth/sdk/model/SipCredentials.java new file mode 100644 index 00000000..7db8bc71 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/SipCredentials.java @@ -0,0 +1,317 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import com.bandwidth.sdk.JSON; + +/** + * SipCredentials + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0") +public class SipCredentials { + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + @javax.annotation.Nullable + private String username; + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + @javax.annotation.Nullable + private String password; + + public SipCredentials() { + } + + public SipCredentials username(@javax.annotation.Nullable String username) { + this.username = username; + return this; + } + + /** + * The username for the SIP connection. + * @return username + */ + @javax.annotation.Nullable + public String getUsername() { + return username; + } + + public void setUsername(@javax.annotation.Nullable String username) { + this.username = username; + } + + + public SipCredentials password(@javax.annotation.Nullable String password) { + this.password = password; + return this; + } + + /** + * The password for the SIP connection. + * @return password + */ + @javax.annotation.Nullable + public String getPassword() { + return password; + } + + public void setPassword(@javax.annotation.Nullable String password) { + this.password = password; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SipCredentials instance itself + */ + public SipCredentials putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SipCredentials sipCredentials = (SipCredentials) o; + return Objects.equals(this.username, sipCredentials.username) && + Objects.equals(this.password, sipCredentials.password)&& + Objects.equals(this.additionalProperties, sipCredentials.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(username, password, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SipCredentials {\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("username", "password")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SipCredentials + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SipCredentials.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in SipCredentials is not found in the empty JSON string", SipCredentials.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SipCredentials.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SipCredentials' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SipCredentials.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SipCredentials value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SipCredentials read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SipCredentials instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SipCredentials given an JSON string + * + * @param jsonString JSON string + * @return An instance of SipCredentials + * @throws IOException if the JSON string is invalid with respect to SipCredentials + */ + public static SipCredentials fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SipCredentials.class); + } + + /** + * Convert an instance of SipCredentials to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/StatusCallback.java b/src/main/java/com/bandwidth/sdk/model/StatusCallback.java index f0ac27a2..d3c67ac6 100644 --- a/src/main/java/com/bandwidth/sdk/model/StatusCallback.java +++ b/src/main/java/com/bandwidth/sdk/model/StatusCallback.java @@ -237,7 +237,7 @@ public StatusCallback carrierName(@javax.annotation.Nullable String carrierName) } /** - * The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled. + * The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled. * @return carrierName */ @javax.annotation.Nullable diff --git a/src/test/java/com/bandwidth/sdk/smoke/EndpointsApiTest.java b/src/test/java/com/bandwidth/sdk/smoke/EndpointsApiTest.java new file mode 100644 index 00000000..be698170 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/smoke/EndpointsApiTest.java @@ -0,0 +1,154 @@ +package com.bandwidth.sdk.smoke; + +import com.bandwidth.sdk.api.EndpointsApi; +import com.bandwidth.sdk.ApiResponse; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.model.CreateWebRtcConnectionRequest; +import com.bandwidth.sdk.model.CreateEndpointResponse; +import com.bandwidth.sdk.model.EndpointResponse; +import com.bandwidth.sdk.model.Endpoints; +import com.bandwidth.sdk.model.EndpointDirectionEnum; +import com.bandwidth.sdk.model.EndpointTypeEnum; +import com.bandwidth.sdk.model.ListEndpointsResponse; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.api.Assertions; + +import java.util.List; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.notNullValue; +import static org.hamcrest.Matchers.hasSize; +import static org.hamcrest.beans.HasPropertyWithValue.hasProperty; + +import static com.bandwidth.sdk.utils.TestingEnvironmentVariables.*; + +@SuppressWarnings("null") +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +public class EndpointsApiTest { + private static ApiClient oauthClient = new ApiClient(BW_CLIENT_ID, BW_CLIENT_SECRET, null); + public final EndpointsApi api = new EndpointsApi(oauthClient); + + private String endpointId; + + @Test + @Order(1) + public void shouldCreateNewEndpoint() throws ApiException { + CreateWebRtcConnectionRequest endpointBody = new CreateWebRtcConnectionRequest(); + endpointBody.setType(EndpointTypeEnum.WEBRTC); + endpointBody.setDirection(EndpointDirectionEnum.BIDIRECTIONAL); + + ApiResponse response = api.createEndpointWithHttpInfo(BW_ACCOUNT_ID, endpointBody); + + assertThat(response.getStatusCode(), is(201)); + assertThat(response.getData(), notNullValue()); + assertThat(response.getData().getData(), notNullValue()); + assertThat(response.getData().getData(), hasProperty("endpointId", is(instanceOf(String.class)))); + assertThat(response.getData().getData(), hasProperty("token", is(instanceOf(String.class)))); + assertThat(response.getData().getData(), hasProperty("type", is(EndpointTypeEnum.WEBRTC))); + assertThat(response.getData().getData(), hasProperty("status", notNullValue())); + assertThat(response.getData().getData(), hasProperty("creationTimestamp", notNullValue())); + assertThat(response.getData().getData(), hasProperty("expirationTimestamp", notNullValue())); + assertThat(response.getData().getErrors(), instanceOf(List.class)); + assertThat(response.getData().getErrors(), hasSize(0)); + + endpointId = response.getData().getData().getEndpointId(); + } + + @Test + @Order(2) + public void shouldListEndpointsForAccount() throws ApiException { + ApiResponse response = api.listEndpointsWithHttpInfo(BW_ACCOUNT_ID, null, null, null, null); + + assertThat(response.getStatusCode(), is(200)); + assertThat(response.getData(), notNullValue()); + assertThat(response.getData().getData(), instanceOf(List.class)); + assertThat(response.getData().getPage(), notNullValue()); + assertThat(response.getData().getPage().getTotalElements(), notNullValue()); + assertThat(response.getData().getErrors(), instanceOf(List.class)); + + Endpoints createdEndpoint = response.getData().getData().stream() + .filter(item -> item.getEndpointId().equals(endpointId)) + .findFirst() + .orElse(null); + + assertThat(createdEndpoint, notNullValue()); + assertThat(createdEndpoint, hasProperty("type", is(EndpointTypeEnum.WEBRTC))); + assertThat(createdEndpoint, hasProperty("status", notNullValue())); + assertThat(createdEndpoint, hasProperty("creationTimestamp", notNullValue())); + assertThat(createdEndpoint, hasProperty("expirationTimestamp", notNullValue())); + } + + @Test + @Order(3) + public void shouldListEndpointsFilteredByType() throws ApiException { + ApiResponse response = api.listEndpointsWithHttpInfo(BW_ACCOUNT_ID, EndpointTypeEnum.WEBRTC, null, null, null); + + assertThat(response.getStatusCode(), is(200)); + assertThat(response.getData().getData(), instanceOf(List.class)); + assertThat(response.getData().getErrors(), instanceOf(List.class)); + + if (response.getData().getData().size() > 0) { + boolean allWebRtc = response.getData().getData().stream() + .allMatch(item -> item.getType() == EndpointTypeEnum.WEBRTC); + assertThat(allWebRtc, is(true)); + } + } + + @Test + @Order(4) + public void shouldRetrieveDetailsOfSpecificEndpoint() throws ApiException { + ApiResponse response = api.getEndpointWithHttpInfo(BW_ACCOUNT_ID, endpointId); + + assertThat(response.getStatusCode(), is(200)); + assertThat(response.getData(), notNullValue()); + assertThat(response.getData().getErrors(), instanceOf(List.class)); + assertThat(response.getData().getErrors(), hasSize(0)); + assertThat(response.getData().getData(), notNullValue()); + assertThat(response.getData().getData(), hasProperty("endpointId", is(endpointId))); + assertThat(response.getData().getData(), hasProperty("type", is(EndpointTypeEnum.WEBRTC))); + assertThat(response.getData().getData(), hasProperty("status", notNullValue())); + assertThat(response.getData().getData(), hasProperty("creationTimestamp", notNullValue())); + assertThat(response.getData().getData(), hasProperty("expirationTimestamp", notNullValue())); + } + + @Test + @Order(5) + public void shouldDeleteEndpoint() throws ApiException { + ApiResponse response = api.deleteEndpointWithHttpInfo(BW_ACCOUNT_ID, endpointId); + + assertThat(response.getStatusCode(), is(204)); + } + + @Test + public void shouldThrow401UnauthorizedWithInvalidCredentials() { + ApiClient badOauthClient = new ApiClient("invalid-client-id", "invalid-client-secret", null); + EndpointsApi endpointsApiBad = new EndpointsApi(badOauthClient); + + Assertions.assertThrows(ApiException.class, + () -> endpointsApiBad.listEndpointsWithHttpInfo(BW_ACCOUNT_ID, null, null, null, null)); + } + + @Test + public void shouldThrow404NotFoundWithInvalidAccount() throws ApiException { + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.listEndpointsWithHttpInfo("invalid-account-id", null, null, null, null)); + + assertThat(exception.getCode(), is(404)); + } + + @Test + public void shouldThrow404NotFoundForNonExistentEndpoint() throws ApiException { + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.getEndpointWithHttpInfo(BW_ACCOUNT_ID, "does-not-exist")); + + assertThat(exception.getCode(), is(404)); + } +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/CreateEndpointRequestBaseTest.java b/src/test/java/com/bandwidth/sdk/unit/models/CreateEndpointRequestBaseTest.java new file mode 100644 index 00000000..71956995 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/CreateEndpointRequestBaseTest.java @@ -0,0 +1,84 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import java.net.URI; +import com.bandwidth.sdk.model.CreateEndpointRequestBase; +import com.bandwidth.sdk.model.EndpointTypeEnum; +import com.bandwidth.sdk.model.EndpointDirectionEnum; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for CreateEndpointRequestBase + */ +public class CreateEndpointRequestBaseTest { + private final CreateEndpointRequestBase model = new CreateEndpointRequestBase() + .type(EndpointTypeEnum.WEBRTC) + .direction(EndpointDirectionEnum.INBOUND) + .eventCallbackUrl(URI.create("https://example.com/callback")) + .eventFallbackUrl(URI.create("https://example.com/fallback")) + .tag("tag"); + + /** + * Model tests for CreateEndpointRequestBase + */ + @Test + public void testCreateEndpointRequestBase() { + assertThat(model, instanceOf(CreateEndpointRequestBase.class)); + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + assertThat(model.getType(), instanceOf(EndpointTypeEnum.class)); + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + assertThat(model.getDirection(), instanceOf(EndpointDirectionEnum.class)); + } + + /** + * Test the property 'eventCallbackUrl' + */ + @Test + public void eventCallbackUrlTest() { + assertThat(model.getEventCallbackUrl(), instanceOf(URI.class)); + } + + /** + * Test the property 'eventFallbackUrl' + */ + @Test + public void eventFallbackUrlTest() { + assertThat(model.getEventFallbackUrl(), instanceOf(URI.class)); + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + assertThat(model.getTag(), instanceOf(String.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/CreateEndpointResponseDataTest.java b/src/test/java/com/bandwidth/sdk/unit/models/CreateEndpointResponseDataTest.java new file mode 100644 index 00000000..ed05418f --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/CreateEndpointResponseDataTest.java @@ -0,0 +1,115 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Arrays; +import java.util.ArrayList; +import com.bandwidth.sdk.model.CreateEndpointResponseData; +import com.bandwidth.sdk.model.EndpointTypeEnum; +import com.bandwidth.sdk.model.EndpointStatusEnum; +import com.bandwidth.sdk.model.Device; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for CreateEndpointResponseData + */ +public class CreateEndpointResponseDataTest { + private final CreateEndpointResponseData model = new CreateEndpointResponseData() + .endpointId("endpointId") + .type(EndpointTypeEnum.WEBRTC) + .status(EndpointStatusEnum.CONNECTED) + .creationTimestamp(OffsetDateTime.now()) + .expirationTimestamp(OffsetDateTime.now()) + .tag("tag") + .devices(new ArrayList(Arrays.asList(new Device()))) + .token("token"); + + /** + * Model tests for CreateEndpointResponseData + */ + @Test + public void testCreateEndpointResponseData() { + assertThat(model, instanceOf(CreateEndpointResponseData.class)); + } + + /** + * Test the property 'endpointId' + */ + @Test + public void endpointIdTest() { + assertThat(model.getEndpointId(), instanceOf(String.class)); + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + assertThat(model.getType(), instanceOf(EndpointTypeEnum.class)); + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + assertThat(model.getStatus(), instanceOf(EndpointStatusEnum.class)); + } + + /** + * Test the property 'creationTimestamp' + */ + @Test + public void creationTimestampTest() { + assertThat(model.getCreationTimestamp(), instanceOf(OffsetDateTime.class)); + } + + /** + * Test the property 'expirationTimestamp' + */ + @Test + public void expirationTimestampTest() { + assertThat(model.getExpirationTimestamp(), instanceOf(OffsetDateTime.class)); + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + assertThat(model.getTag(), instanceOf(String.class)); + } + + /** + * Test the property 'devices' + */ + @Test + public void devicesTest() { + assertThat(model.getDevices(), instanceOf(List.class)); + } + + /** + * Test the property 'token' + */ + @Test + public void tokenTest() { + assertThat(model.getToken(), instanceOf(String.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/CreateEndpointResponseObjectTest.java b/src/test/java/com/bandwidth/sdk/unit/models/CreateEndpointResponseObjectTest.java new file mode 100644 index 00000000..d3be488f --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/CreateEndpointResponseObjectTest.java @@ -0,0 +1,115 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Arrays; +import java.util.ArrayList; +import com.bandwidth.sdk.model.CreateEndpointResponseObject; +import com.bandwidth.sdk.model.EndpointTypeEnum; +import com.bandwidth.sdk.model.EndpointStatusEnum; +import com.bandwidth.sdk.model.Device; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for CreateEndpointResponseObject + */ +public class CreateEndpointResponseObjectTest { + private final CreateEndpointResponseObject model = new CreateEndpointResponseObject() + .endpointId("endpointId") + .type(EndpointTypeEnum.WEBRTC) + .status(EndpointStatusEnum.CONNECTED) + .creationTimestamp(OffsetDateTime.now()) + .expirationTimestamp(OffsetDateTime.now()) + .tag("tag") + .devices(new ArrayList(Arrays.asList(new Device()))) + .token("token"); + + /** + * Model tests for CreateEndpointResponseObject + */ + @Test + public void testCreateEndpointResponseObject() { + assertThat(model, instanceOf(CreateEndpointResponseObject.class)); + } + + /** + * Test the property 'endpointId' + */ + @Test + public void endpointIdTest() { + assertThat(model.getEndpointId(), instanceOf(String.class)); + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + assertThat(model.getType(), instanceOf(EndpointTypeEnum.class)); + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + assertThat(model.getStatus(), instanceOf(EndpointStatusEnum.class)); + } + + /** + * Test the property 'creationTimestamp' + */ + @Test + public void creationTimestampTest() { + assertThat(model.getCreationTimestamp(), instanceOf(OffsetDateTime.class)); + } + + /** + * Test the property 'expirationTimestamp' + */ + @Test + public void expirationTimestampTest() { + assertThat(model.getExpirationTimestamp(), instanceOf(OffsetDateTime.class)); + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + assertThat(model.getTag(), instanceOf(String.class)); + } + + /** + * Test the property 'devices' + */ + @Test + public void devicesTest() { + assertThat(model.getDevices(), instanceOf(List.class)); + } + + /** + * Test the property 'token' + */ + @Test + public void tokenTest() { + assertThat(model.getToken(), instanceOf(String.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/CreateEndpointResponseTest.java b/src/test/java/com/bandwidth/sdk/unit/models/CreateEndpointResponseTest.java new file mode 100644 index 00000000..22cf38e6 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/CreateEndpointResponseTest.java @@ -0,0 +1,69 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import java.util.List; +import java.util.Arrays; +import java.util.ArrayList; +import com.bandwidth.sdk.model.CreateEndpointResponse; +import com.bandwidth.sdk.model.CreateEndpointResponseData; +import com.bandwidth.sdk.model.Link; +import com.bandwidth.sdk.model.Error; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for CreateEndpointResponse + */ +public class CreateEndpointResponseTest { + private final CreateEndpointResponse model = new CreateEndpointResponse() + .links(new ArrayList(Arrays.asList(new Link()))) + .data(new CreateEndpointResponseData()) + .errors(new ArrayList(Arrays.asList(new Error()))); + + /** + * Model tests for CreateEndpointResponse + */ + @Test + public void testCreateEndpointResponse() { + assertThat(model, instanceOf(CreateEndpointResponse.class)); + } + + /** + * Test the property 'links' + */ + @Test + public void linksTest() { + assertThat(model.getLinks(), instanceOf(List.class)); + } + + /** + * Test the property 'data' + */ + @Test + public void dataTest() { + assertThat(model.getData(), instanceOf(CreateEndpointResponseData.class)); + } + + /** + * Test the property 'errors' + */ + @Test + public void errorsTest() { + assertThat(model.getErrors(), instanceOf(List.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/EndpointDirectionEnumTest.java b/src/test/java/com/bandwidth/sdk/unit/models/EndpointDirectionEnumTest.java new file mode 100644 index 00000000..e6977adb --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/EndpointDirectionEnumTest.java @@ -0,0 +1,36 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.EndpointDirectionEnum; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.equalTo; + +/** + * Model tests for EndpointDirectionEnum + */ +public class EndpointDirectionEnumTest { + /** + * Model tests for EndpointDirectionEnum + */ + @Test + public void testEndpointDirectionEnum() { + assertThat(EndpointDirectionEnum.INBOUND.toString(), equalTo("INBOUND")); + assertThat(EndpointDirectionEnum.OUTBOUND.toString(), equalTo("OUTBOUND")); + assertThat(EndpointDirectionEnum.BIDIRECTIONAL.toString(), equalTo("BIDIRECTIONAL")); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/EndpointEventTest.java b/src/test/java/com/bandwidth/sdk/unit/models/EndpointEventTest.java new file mode 100644 index 00000000..a3ef493d --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/EndpointEventTest.java @@ -0,0 +1,122 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.EndpointEvent; +import com.bandwidth.sdk.model.EndpointTypeEnum; +import com.bandwidth.sdk.model.EndpointStatusEnum; +import com.bandwidth.sdk.model.EndpointEventTypeEnum; +import com.bandwidth.sdk.model.Device; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for EndpointEvent + */ +public class EndpointEventTest { + private final EndpointEvent model = new EndpointEvent() + .endpointId("endpointId") + .type(EndpointTypeEnum.WEBRTC) + .status(EndpointStatusEnum.CONNECTED) + .creationTimestamp(OffsetDateTime.now()) + .expirationTimestamp(OffsetDateTime.now()) + .tag("tag") + .eventTime(OffsetDateTime.now()) + .eventType(EndpointEventTypeEnum.DEVICE_CONNECTED) + .device(new Device()); + + /** + * Model tests for EndpointEvent + */ + @Test + public void testEndpointEvent() { + assertThat(model, instanceOf(EndpointEvent.class)); + } + + /** + * Test the property 'endpointId' + */ + @Test + public void endpointIdTest() { + assertThat(model.getEndpointId(), instanceOf(String.class)); + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + assertThat(model.getType(), instanceOf(EndpointTypeEnum.class)); + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + assertThat(model.getStatus(), instanceOf(EndpointStatusEnum.class)); + } + + /** + * Test the property 'creationTimestamp' + */ + @Test + public void creationTimestampTest() { + assertThat(model.getCreationTimestamp(), instanceOf(OffsetDateTime.class)); + } + + /** + * Test the property 'expirationTimestamp' + */ + @Test + public void expirationTimestampTest() { + assertThat(model.getExpirationTimestamp(), instanceOf(OffsetDateTime.class)); + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + assertThat(model.getTag(), instanceOf(String.class)); + } + + /** + * Test the property 'eventTime' + */ + @Test + public void eventTimeTest() { + assertThat(model.getEventTime(), instanceOf(OffsetDateTime.class)); + } + + /** + * Test the property 'eventType' + */ + @Test + public void eventTypeTest() { + assertThat(model.getEventType(), instanceOf(EndpointEventTypeEnum.class)); + } + + /** + * Test the property 'device' + */ + @Test + public void deviceTest() { + assertThat(model.getDevice(), instanceOf(Device.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/EndpointEventTypeEnumTest.java b/src/test/java/com/bandwidth/sdk/unit/models/EndpointEventTypeEnumTest.java new file mode 100644 index 00000000..813b17e8 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/EndpointEventTypeEnumTest.java @@ -0,0 +1,35 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.EndpointEventTypeEnum; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.equalTo; + +/** + * Model tests for EndpointEventTypeEnum + */ +public class EndpointEventTypeEnumTest { + /** + * Model tests for EndpointEventTypeEnum + */ + @Test + public void testEndpointEventTypeEnum() { + assertThat(EndpointEventTypeEnum.DEVICE_CONNECTED.toString(), equalTo("DEVICE_CONNECTED")); + assertThat(EndpointEventTypeEnum.DEVICE_DISCONNECTED.toString(), equalTo("DEVICE_DISCONNECTED")); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/EndpointResponseTest.java b/src/test/java/com/bandwidth/sdk/unit/models/EndpointResponseTest.java new file mode 100644 index 00000000..a4c268dc --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/EndpointResponseTest.java @@ -0,0 +1,69 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import java.util.List; +import java.util.Arrays; +import java.util.ArrayList; +import com.bandwidth.sdk.model.EndpointResponse; +import com.bandwidth.sdk.model.Endpoint; +import com.bandwidth.sdk.model.Link; +import com.bandwidth.sdk.model.Error; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for EndpointResponse + */ +public class EndpointResponseTest { + private final EndpointResponse model = new EndpointResponse() + .links(new ArrayList(Arrays.asList(new Link()))) + .data(new Endpoint()) + .errors(new ArrayList(Arrays.asList(new Error()))); + + /** + * Model tests for EndpointResponse + */ + @Test + public void testEndpointResponse() { + assertThat(model, instanceOf(EndpointResponse.class)); + } + + /** + * Test the property 'links' + */ + @Test + public void linksTest() { + assertThat(model.getLinks(), instanceOf(List.class)); + } + + /** + * Test the property 'data' + */ + @Test + public void dataTest() { + assertThat(model.getData(), instanceOf(Endpoint.class)); + } + + /** + * Test the property 'errors' + */ + @Test + public void errorsTest() { + assertThat(model.getErrors(), instanceOf(List.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/EndpointStatusEnumTest.java b/src/test/java/com/bandwidth/sdk/unit/models/EndpointStatusEnumTest.java new file mode 100644 index 00000000..5e18b2a6 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/EndpointStatusEnumTest.java @@ -0,0 +1,35 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.EndpointStatusEnum; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.equalTo; + +/** + * Model tests for EndpointStatusEnum + */ +public class EndpointStatusEnumTest { + /** + * Model tests for EndpointStatusEnum + */ + @Test + public void testEndpointStatusEnum() { + assertThat(EndpointStatusEnum.CONNECTED.toString(), equalTo("CONNECTED")); + assertThat(EndpointStatusEnum.DISCONNECTED.toString(), equalTo("DISCONNECTED")); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/EndpointTest.java b/src/test/java/com/bandwidth/sdk/unit/models/EndpointTest.java new file mode 100644 index 00000000..b67f526f --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/EndpointTest.java @@ -0,0 +1,106 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Arrays; +import java.util.ArrayList; +import com.bandwidth.sdk.model.Endpoint; +import com.bandwidth.sdk.model.EndpointTypeEnum; +import com.bandwidth.sdk.model.EndpointStatusEnum; +import com.bandwidth.sdk.model.Device; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for Endpoint + */ +public class EndpointTest { + private final Endpoint model = new Endpoint() + .endpointId("endpointId") + .type(EndpointTypeEnum.WEBRTC) + .status(EndpointStatusEnum.CONNECTED) + .creationTimestamp(OffsetDateTime.now()) + .expirationTimestamp(OffsetDateTime.now()) + .tag("tag") + .devices(new ArrayList(Arrays.asList(new Device()))); + + /** + * Model tests for Endpoint + */ + @Test + public void testEndpoint() { + assertThat(model, instanceOf(Endpoint.class)); + } + + /** + * Test the property 'endpointId' + */ + @Test + public void endpointIdTest() { + assertThat(model.getEndpointId(), instanceOf(String.class)); + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + assertThat(model.getType(), instanceOf(EndpointTypeEnum.class)); + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + assertThat(model.getStatus(), instanceOf(EndpointStatusEnum.class)); + } + + /** + * Test the property 'creationTimestamp' + */ + @Test + public void creationTimestampTest() { + assertThat(model.getCreationTimestamp(), instanceOf(OffsetDateTime.class)); + } + + /** + * Test the property 'expirationTimestamp' + */ + @Test + public void expirationTimestampTest() { + assertThat(model.getExpirationTimestamp(), instanceOf(OffsetDateTime.class)); + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + assertThat(model.getTag(), instanceOf(String.class)); + } + + /** + * Test the property 'devices' + */ + @Test + public void devicesTest() { + assertThat(model.getDevices(), instanceOf(List.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/EndpointTypeEnumTest.java b/src/test/java/com/bandwidth/sdk/unit/models/EndpointTypeEnumTest.java new file mode 100644 index 00000000..4c0c8256 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/EndpointTypeEnumTest.java @@ -0,0 +1,34 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.EndpointTypeEnum; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.equalTo; + +/** + * Model tests for EndpointTypeEnum + */ +public class EndpointTypeEnumTest { + /** + * Model tests for EndpointTypeEnum + */ + @Test + public void testEndpointTypeEnum() { + assertThat(EndpointTypeEnum.WEBRTC.toString(), equalTo("WEBRTC")); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/EndpointsTest.java b/src/test/java/com/bandwidth/sdk/unit/models/EndpointsTest.java new file mode 100644 index 00000000..99dd1f65 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/EndpointsTest.java @@ -0,0 +1,93 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.Endpoints; +import com.bandwidth.sdk.model.EndpointTypeEnum; +import com.bandwidth.sdk.model.EndpointStatusEnum; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for Endpoints + */ +public class EndpointsTest { + private final Endpoints model = new Endpoints() + .endpointId("endpointId") + .type(EndpointTypeEnum.WEBRTC) + .status(EndpointStatusEnum.CONNECTED) + .creationTimestamp(OffsetDateTime.now()) + .expirationTimestamp(OffsetDateTime.now()) + .tag("tag"); + + /** + * Model tests for Endpoints + */ + @Test + public void testEndpoints() { + assertThat(model, instanceOf(Endpoints.class)); + } + + /** + * Test the property 'endpointId' + */ + @Test + public void endpointIdTest() { + assertThat(model.getEndpointId(), instanceOf(String.class)); + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + assertThat(model.getType(), instanceOf(EndpointTypeEnum.class)); + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + assertThat(model.getStatus(), instanceOf(EndpointStatusEnum.class)); + } + + /** + * Test the property 'creationTimestamp' + */ + @Test + public void creationTimestampTest() { + assertThat(model.getCreationTimestamp(), instanceOf(OffsetDateTime.class)); + } + + /** + * Test the property 'expirationTimestamp' + */ + @Test + public void expirationTimestampTest() { + assertThat(model.getExpirationTimestamp(), instanceOf(OffsetDateTime.class)); + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + assertThat(model.getTag(), instanceOf(String.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/ListEndpointsResponseTest.java b/src/test/java/com/bandwidth/sdk/unit/models/ListEndpointsResponseTest.java new file mode 100644 index 00000000..9adc8de8 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/ListEndpointsResponseTest.java @@ -0,0 +1,79 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import java.util.List; +import java.util.Arrays; +import java.util.ArrayList; +import com.bandwidth.sdk.model.ListEndpointsResponse; +import com.bandwidth.sdk.model.Endpoints; +import com.bandwidth.sdk.model.Link; +import com.bandwidth.sdk.model.Error; +import com.bandwidth.sdk.model.Page; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +/** + * Model tests for ListEndpointsResponse + */ +public class ListEndpointsResponseTest { + private final ListEndpointsResponse model = new ListEndpointsResponse() + .links(new ArrayList(Arrays.asList(new Link()))) + .page(new Page()) + .data(new ArrayList(Arrays.asList(new Endpoints()))) + .errors(new ArrayList(Arrays.asList(new Error()))); + + /** + * Model tests for ListEndpointsResponse + */ + @Test + public void testListEndpointsResponse() { + assertThat(model, instanceOf(ListEndpointsResponse.class)); + } + + /** + * Test the property 'links' + */ + @Test + public void linksTest() { + assertThat(model.getLinks(), instanceOf(List.class)); + } + + /** + * Test the property 'page' + */ + @Test + public void pageTest() { + assertThat(model.getPage(), instanceOf(Page.class)); + } + + /** + * Test the property 'data' + */ + @Test + public void dataTest() { + assertThat(model.getData(), instanceOf(List.class)); + } + + /** + * Test the property 'errors' + */ + @Test + public void errorsTest() { + assertThat(model.getErrors(), instanceOf(List.class)); + } + +}