diff --git a/.gitignore b/.gitignore index e7aa7b90..f16616b3 100644 --- a/.gitignore +++ b/.gitignore @@ -77,3 +77,6 @@ target/ # Test Fixtures test/fixtures/ + +.env +temp \ No newline at end of file diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 1380f48c..6ae9ca0f 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -5,6 +5,7 @@ bandwidth/__init__.py bandwidth/api/__init__.py bandwidth/api/calls_api.py bandwidth/api/conferences_api.py +bandwidth/api/endpoints_api.py bandwidth/api/media_api.py bandwidth/api/messages_api.py bandwidth/api/mfa_api.py @@ -58,16 +59,31 @@ bandwidth/models/create_async_bulk_lookup_response.py bandwidth/models/create_async_bulk_lookup_response_data.py bandwidth/models/create_call.py bandwidth/models/create_call_response.py +bandwidth/models/create_endpoint_request_base.py +bandwidth/models/create_endpoint_response.py +bandwidth/models/create_endpoint_response_object.py bandwidth/models/create_message_request_error.py bandwidth/models/create_multi_channel_message_response.py bandwidth/models/create_sync_lookup_response.py bandwidth/models/create_sync_lookup_response_data.py +bandwidth/models/create_web_rtc_connection_request.py bandwidth/models/deactivation_event_enum.py +bandwidth/models/device.py +bandwidth/models/device_status_enum.py bandwidth/models/disconnect_callback.py bandwidth/models/diversion.py bandwidth/models/dtmf_callback.py +bandwidth/models/endpoint.py +bandwidth/models/endpoint_direction_enum.py +bandwidth/models/endpoint_event.py +bandwidth/models/endpoint_event_type_enum.py +bandwidth/models/endpoint_response.py +bandwidth/models/endpoint_status_enum.py +bandwidth/models/endpoint_type_enum.py +bandwidth/models/endpoints.py bandwidth/models/error.py bandwidth/models/error_object.py +bandwidth/models/error_response.py bandwidth/models/error_source.py bandwidth/models/failure_webhook.py bandwidth/models/field_error.py @@ -85,6 +101,7 @@ bandwidth/models/line_type_enum.py bandwidth/models/link.py bandwidth/models/link_schema.py bandwidth/models/links_object.py +bandwidth/models/list_endpoints_response.py bandwidth/models/list_message_direction_enum.py bandwidth/models/list_message_item.py bandwidth/models/lookup_error_response.py @@ -128,6 +145,7 @@ bandwidth/models/multi_channel_message_content.py bandwidth/models/multi_channel_message_request.py bandwidth/models/multi_channel_message_response_data.py bandwidth/models/opt_in_workflow.py +bandwidth/models/page.py bandwidth/models/page_info.py bandwidth/models/priority_enum.py bandwidth/models/product_type_enum.py @@ -156,6 +174,8 @@ bandwidth/models/recording_transcription_metadata.py bandwidth/models/recording_transcriptions.py bandwidth/models/redirect_callback.py bandwidth/models/redirect_method_enum.py +bandwidth/models/sip_connection_metadata.py +bandwidth/models/sip_credentials.py bandwidth/models/sms_message_content.py bandwidth/models/standalone_card_orientation_enum.py bandwidth/models/status_callback.py @@ -238,16 +258,32 @@ docs/CreateAsyncBulkLookupResponse.md docs/CreateAsyncBulkLookupResponseData.md docs/CreateCall.md docs/CreateCallResponse.md +docs/CreateEndpointRequestBase.md +docs/CreateEndpointResponse.md +docs/CreateEndpointResponseObject.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 @@ -265,6 +301,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 @@ -312,6 +349,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 @@ -342,6 +380,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 diff --git a/README.md b/README.md index 1a9d687d..9f44fa9f 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,11 @@ Class | Method | HTTP request | Description *ConferencesApi* | [**update_conference**](docs/ConferencesApi.md#update_conference) | **POST** /accounts/{accountId}/conferences/{conferenceId} | Update Conference *ConferencesApi* | [**update_conference_bxml**](docs/ConferencesApi.md#update_conference_bxml) | **PUT** /accounts/{accountId}/conferences/{conferenceId}/bxml | Update Conference BXML *ConferencesApi* | [**update_conference_member**](docs/ConferencesApi.md#update_conference_member) | **PUT** /accounts/{accountId}/conferences/{conferenceId}/members/{memberId} | Update Conference Member +*EndpointsApi* | [**create_endpoint**](docs/EndpointsApi.md#create_endpoint) | **POST** /accounts/{accountId}/endpoints | Create Endpoint +*EndpointsApi* | [**delete_endpoint**](docs/EndpointsApi.md#delete_endpoint) | **DELETE** /accounts/{accountId}/endpoints/{endpointId} | Delete Endpoint +*EndpointsApi* | [**get_endpoint**](docs/EndpointsApi.md#get_endpoint) | **GET** /accounts/{accountId}/endpoints/{endpointId} | Get Endpoint +*EndpointsApi* | [**list_endpoints**](docs/EndpointsApi.md#list_endpoints) | **GET** /accounts/{accountId}/endpoints | List Endpoints +*EndpointsApi* | [**update_endpoint_bxml**](docs/EndpointsApi.md#update_endpoint_bxml) | **PUT** /accounts/{accountId}/endpoints/{endpointId}/bxml | Update Endpoint BXML *MFAApi* | [**generate_messaging_code**](docs/MFAApi.md#generate_messaging_code) | **POST** /accounts/{accountId}/code/messaging | Messaging Authentication Code *MFAApi* | [**generate_voice_code**](docs/MFAApi.md#generate_voice_code) | **POST** /accounts/{accountId}/code/voice | Voice Authentication Code *MFAApi* | [**verify_code**](docs/MFAApi.md#verify_code) | **POST** /accounts/{accountId}/code/verify | Verify Authentication Code @@ -196,16 +201,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) + - [CreateEndpointResponseObject](docs/CreateEndpointResponseObject.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) @@ -223,6 +243,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) @@ -266,6 +287,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) @@ -294,6 +316,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/bandwidth.yml b/bandwidth.yml index d7c32953..8b9998df 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: @@ -1682,6 +1683,165 @@ 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/accountId2' + - $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' + post: + tags: + - Endpoints + summary: Create Endpoint + description: Creates a new Endpoint for the specified account. + operationId: createEndpoint + parameters: + - $ref: '#/components/parameters/accountId2' + 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' + 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/accountId2' + - $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' + 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/accountId2' + - $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' + 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/accountId2' + - $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' + servers: *ref_5 components: schemas: applicationId: @@ -1976,7 +2136,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. @@ -2063,7 +2223,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 -, @@ -2385,7 +2545,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: @@ -2398,7 +2558,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. @@ -2799,7 +2959,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. @@ -2850,7 +3010,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. @@ -3089,7 +3249,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. @@ -4026,7 +4186,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 @@ -5729,7 +5889,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. @@ -5740,7 +5900,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. @@ -6520,6 +6680,303 @@ components: nullable: true pattern: ^[ -~]{16,64}$ type: string + 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' + createEndpointResponseObject: + 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/createEndpointResponseObject' + 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 @@ -7171,6 +7628,105 @@ components: example: description: Service Unavailable Error. type: Service Unavailable + 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 @@ -7670,6 +8226,53 @@ components: type: string description: Webhook subscription ID example: 7bt57JcsVYJrN9K1OcV1Nu + accountId2: + name: accountId + in: path + required: true + schema: + type: string + example: '5500123' + description: Your Bandwidth Account ID. + 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. @@ -8094,6 +8697,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: @@ -8449,6 +9251,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 @@ -8475,12 +9301,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 @@ -8582,3 +9408,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/bandwidth/__init__.py b/bandwidth/__init__.py index 5d5b6304..013ae746 100644 --- a/bandwidth/__init__.py +++ b/bandwidth/__init__.py @@ -21,6 +21,7 @@ __all__ = [ "CallsApi", "ConferencesApi", + "EndpointsApi", "MFAApi", "MediaApi", "MessagesApi", @@ -78,16 +79,31 @@ "CreateAsyncBulkLookupResponseData", "CreateCall", "CreateCallResponse", + "CreateEndpointRequestBase", + "CreateEndpointResponse", + "CreateEndpointResponseObject", "CreateMessageRequestError", "CreateMultiChannelMessageResponse", "CreateSyncLookupResponse", "CreateSyncLookupResponseData", + "CreateWebRtcConnectionRequest", "DeactivationEventEnum", + "Device", + "DeviceStatusEnum", "DisconnectCallback", "Diversion", "DtmfCallback", + "Endpoint", + "EndpointDirectionEnum", + "EndpointEvent", + "EndpointEventTypeEnum", + "EndpointResponse", + "EndpointStatusEnum", + "EndpointTypeEnum", + "Endpoints", "Error", "ErrorObject", + "ErrorResponse", "ErrorSource", "FailureWebhook", "FieldError", @@ -105,6 +121,7 @@ "Link", "LinkSchema", "LinksObject", + "ListEndpointsResponse", "ListMessageDirectionEnum", "ListMessageItem", "LookupErrorResponse", @@ -148,6 +165,7 @@ "MultiChannelMessageRequest", "MultiChannelMessageResponseData", "OptInWorkflow", + "Page", "PageInfo", "PriorityEnum", "ProductTypeEnum", @@ -176,6 +194,8 @@ "RecordingTranscriptions", "RedirectCallback", "RedirectMethodEnum", + "SipConnectionMetadata", + "SipCredentials", "SmsMessageContent", "StandaloneCardOrientationEnum", "StatusCallback", @@ -220,6 +240,7 @@ # import apis into sdk package from bandwidth.api.calls_api import CallsApi as CallsApi from bandwidth.api.conferences_api import ConferencesApi as ConferencesApi +from bandwidth.api.endpoints_api import EndpointsApi as EndpointsApi from bandwidth.api.mfa_api import MFAApi as MFAApi from bandwidth.api.media_api import MediaApi as MediaApi from bandwidth.api.messages_api import MessagesApi as MessagesApi @@ -281,16 +302,31 @@ from bandwidth.models.create_async_bulk_lookup_response_data import CreateAsyncBulkLookupResponseData as CreateAsyncBulkLookupResponseData from bandwidth.models.create_call import CreateCall as CreateCall from bandwidth.models.create_call_response import CreateCallResponse as CreateCallResponse +from bandwidth.models.create_endpoint_request_base import CreateEndpointRequestBase as CreateEndpointRequestBase +from bandwidth.models.create_endpoint_response import CreateEndpointResponse as CreateEndpointResponse +from bandwidth.models.create_endpoint_response_object import CreateEndpointResponseObject as CreateEndpointResponseObject from bandwidth.models.create_message_request_error import CreateMessageRequestError as CreateMessageRequestError from bandwidth.models.create_multi_channel_message_response import CreateMultiChannelMessageResponse as CreateMultiChannelMessageResponse from bandwidth.models.create_sync_lookup_response import CreateSyncLookupResponse as CreateSyncLookupResponse from bandwidth.models.create_sync_lookup_response_data import CreateSyncLookupResponseData as CreateSyncLookupResponseData +from bandwidth.models.create_web_rtc_connection_request import CreateWebRtcConnectionRequest as CreateWebRtcConnectionRequest from bandwidth.models.deactivation_event_enum import DeactivationEventEnum as DeactivationEventEnum +from bandwidth.models.device import Device as Device +from bandwidth.models.device_status_enum import DeviceStatusEnum as DeviceStatusEnum from bandwidth.models.disconnect_callback import DisconnectCallback as DisconnectCallback from bandwidth.models.diversion import Diversion as Diversion from bandwidth.models.dtmf_callback import DtmfCallback as DtmfCallback +from bandwidth.models.endpoint import Endpoint as Endpoint +from bandwidth.models.endpoint_direction_enum import EndpointDirectionEnum as EndpointDirectionEnum +from bandwidth.models.endpoint_event import EndpointEvent as EndpointEvent +from bandwidth.models.endpoint_event_type_enum import EndpointEventTypeEnum as EndpointEventTypeEnum +from bandwidth.models.endpoint_response import EndpointResponse as EndpointResponse +from bandwidth.models.endpoint_status_enum import EndpointStatusEnum as EndpointStatusEnum +from bandwidth.models.endpoint_type_enum import EndpointTypeEnum as EndpointTypeEnum +from bandwidth.models.endpoints import Endpoints as Endpoints from bandwidth.models.error import Error as Error from bandwidth.models.error_object import ErrorObject as ErrorObject +from bandwidth.models.error_response import ErrorResponse as ErrorResponse from bandwidth.models.error_source import ErrorSource as ErrorSource from bandwidth.models.failure_webhook import FailureWebhook as FailureWebhook from bandwidth.models.field_error import FieldError as FieldError @@ -308,6 +344,7 @@ from bandwidth.models.link import Link as Link from bandwidth.models.link_schema import LinkSchema as LinkSchema from bandwidth.models.links_object import LinksObject as LinksObject +from bandwidth.models.list_endpoints_response import ListEndpointsResponse as ListEndpointsResponse from bandwidth.models.list_message_direction_enum import ListMessageDirectionEnum as ListMessageDirectionEnum from bandwidth.models.list_message_item import ListMessageItem as ListMessageItem from bandwidth.models.lookup_error_response import LookupErrorResponse as LookupErrorResponse @@ -351,6 +388,7 @@ from bandwidth.models.multi_channel_message_request import MultiChannelMessageRequest as MultiChannelMessageRequest from bandwidth.models.multi_channel_message_response_data import MultiChannelMessageResponseData as MultiChannelMessageResponseData from bandwidth.models.opt_in_workflow import OptInWorkflow as OptInWorkflow +from bandwidth.models.page import Page as Page from bandwidth.models.page_info import PageInfo as PageInfo from bandwidth.models.priority_enum import PriorityEnum as PriorityEnum from bandwidth.models.product_type_enum import ProductTypeEnum as ProductTypeEnum @@ -379,6 +417,8 @@ from bandwidth.models.recording_transcriptions import RecordingTranscriptions as RecordingTranscriptions from bandwidth.models.redirect_callback import RedirectCallback as RedirectCallback from bandwidth.models.redirect_method_enum import RedirectMethodEnum as RedirectMethodEnum +from bandwidth.models.sip_connection_metadata import SipConnectionMetadata as SipConnectionMetadata +from bandwidth.models.sip_credentials import SipCredentials as SipCredentials from bandwidth.models.sms_message_content import SmsMessageContent as SmsMessageContent from bandwidth.models.standalone_card_orientation_enum import StandaloneCardOrientationEnum as StandaloneCardOrientationEnum from bandwidth.models.status_callback import StatusCallback as StatusCallback diff --git a/bandwidth/api/__init__.py b/bandwidth/api/__init__.py index feb7cec3..7b0f7dff 100644 --- a/bandwidth/api/__init__.py +++ b/bandwidth/api/__init__.py @@ -3,6 +3,7 @@ # import apis into api package from bandwidth.api.calls_api import CallsApi from bandwidth.api.conferences_api import ConferencesApi +from bandwidth.api.endpoints_api import EndpointsApi from bandwidth.api.mfa_api import MFAApi from bandwidth.api.media_api import MediaApi from bandwidth.api.messages_api import MessagesApi diff --git a/bandwidth/api/endpoints_api.py b/bandwidth/api/endpoints_api.py new file mode 100644 index 00000000..5a6b5dcc --- /dev/null +++ b/bandwidth/api/endpoints_api.py @@ -0,0 +1,1652 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing import Optional +from typing_extensions import Annotated +from bandwidth.models.create_endpoint_response import CreateEndpointResponse +from bandwidth.models.create_web_rtc_connection_request import CreateWebRtcConnectionRequest +from bandwidth.models.endpoint_response import EndpointResponse +from bandwidth.models.endpoint_status_enum import EndpointStatusEnum +from bandwidth.models.endpoint_type_enum import EndpointTypeEnum +from bandwidth.models.list_endpoints_response import ListEndpointsResponse + +from bandwidth.api_client import ApiClient, RequestSerialized +from bandwidth.api_response import ApiResponse +from bandwidth.rest import RESTResponseType + + +class EndpointsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def create_endpoint( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + body: CreateWebRtcConnectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> CreateEndpointResponse: + """Create Endpoint + + Creates a new Endpoint for the specified account. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param body: (required) + :type body: CreateWebRtcConnectionRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_endpoint_serialize( + account_id=account_id, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "CreateEndpointResponse", + '400': "ErrorResponse", + '401': "ErrorResponse", + '403': "ErrorResponse", + '404': "ErrorResponse", + '405': "ErrorResponse", + '415': "ErrorResponse", + '429': "ErrorResponse", + '500': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_endpoint_with_http_info( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + body: CreateWebRtcConnectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> ApiResponse[CreateEndpointResponse]: + """Create Endpoint + + Creates a new Endpoint for the specified account. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param body: (required) + :type body: CreateWebRtcConnectionRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_endpoint_serialize( + account_id=account_id, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "CreateEndpointResponse", + '400': "ErrorResponse", + '401': "ErrorResponse", + '403': "ErrorResponse", + '404': "ErrorResponse", + '405': "ErrorResponse", + '415': "ErrorResponse", + '429': "ErrorResponse", + '500': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_endpoint_without_preload_content( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + body: CreateWebRtcConnectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> RESTResponseType: + """Create Endpoint + + Creates a new Endpoint for the specified account. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param body: (required) + :type body: CreateWebRtcConnectionRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_endpoint_serialize( + account_id=account_id, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "CreateEndpointResponse", + '400': "ErrorResponse", + '401': "ErrorResponse", + '403': "ErrorResponse", + '404': "ErrorResponse", + '405': "ErrorResponse", + '415': "ErrorResponse", + '429': "ErrorResponse", + '500': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_endpoint_serialize( + self, + account_id, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _hosts = [ + 'https://api.bandwidth.com/v2' + ] + _host = _hosts[_host_index] + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if account_id is not None: + _path_params['accountId'] = account_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'Basic', + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/accounts/{accountId}/endpoints', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_endpoint( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + endpoint_id: Annotated[StrictStr, Field(description="BRTC Endpoint ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> None: + """Delete Endpoint + + Deletes the specified endpoint. If the endpoint is actively streaming media, the media stream will be terminated. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param endpoint_id: BRTC Endpoint ID. (required) + :type endpoint_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_endpoint_serialize( + account_id=account_id, + endpoint_id=endpoint_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "ErrorResponse", + '401': "ErrorResponse", + '403': "ErrorResponse", + '404': "ErrorResponse", + '405': "ErrorResponse", + '415': "ErrorResponse", + '429': "ErrorResponse", + '500': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_endpoint_with_http_info( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + endpoint_id: Annotated[StrictStr, Field(description="BRTC Endpoint ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> ApiResponse[None]: + """Delete Endpoint + + Deletes the specified endpoint. If the endpoint is actively streaming media, the media stream will be terminated. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param endpoint_id: BRTC Endpoint ID. (required) + :type endpoint_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_endpoint_serialize( + account_id=account_id, + endpoint_id=endpoint_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "ErrorResponse", + '401': "ErrorResponse", + '403': "ErrorResponse", + '404': "ErrorResponse", + '405': "ErrorResponse", + '415': "ErrorResponse", + '429': "ErrorResponse", + '500': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_endpoint_without_preload_content( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + endpoint_id: Annotated[StrictStr, Field(description="BRTC Endpoint ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> RESTResponseType: + """Delete Endpoint + + Deletes the specified endpoint. If the endpoint is actively streaming media, the media stream will be terminated. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param endpoint_id: BRTC Endpoint ID. (required) + :type endpoint_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_endpoint_serialize( + account_id=account_id, + endpoint_id=endpoint_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "ErrorResponse", + '401': "ErrorResponse", + '403': "ErrorResponse", + '404': "ErrorResponse", + '405': "ErrorResponse", + '415': "ErrorResponse", + '429': "ErrorResponse", + '500': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_endpoint_serialize( + self, + account_id, + endpoint_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _hosts = [ + 'https://api.bandwidth.com/v2' + ] + _host = _hosts[_host_index] + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if account_id is not None: + _path_params['accountId'] = account_id + if endpoint_id is not None: + _path_params['endpointId'] = endpoint_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'Basic', + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/accounts/{accountId}/endpoints/{endpointId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_endpoint( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + endpoint_id: Annotated[StrictStr, Field(description="BRTC Endpoint ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> EndpointResponse: + """Get Endpoint + + Returns information about the specified endpoint. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param endpoint_id: BRTC Endpoint ID. (required) + :type endpoint_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_endpoint_serialize( + account_id=account_id, + endpoint_id=endpoint_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EndpointResponse", + '400': "ErrorResponse", + '401': "ErrorResponse", + '403': "ErrorResponse", + '404': "ErrorResponse", + '405': "ErrorResponse", + '415': "ErrorResponse", + '429': "ErrorResponse", + '500': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_endpoint_with_http_info( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + endpoint_id: Annotated[StrictStr, Field(description="BRTC Endpoint ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> ApiResponse[EndpointResponse]: + """Get Endpoint + + Returns information about the specified endpoint. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param endpoint_id: BRTC Endpoint ID. (required) + :type endpoint_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_endpoint_serialize( + account_id=account_id, + endpoint_id=endpoint_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EndpointResponse", + '400': "ErrorResponse", + '401': "ErrorResponse", + '403': "ErrorResponse", + '404': "ErrorResponse", + '405': "ErrorResponse", + '415': "ErrorResponse", + '429': "ErrorResponse", + '500': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_endpoint_without_preload_content( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + endpoint_id: Annotated[StrictStr, Field(description="BRTC Endpoint ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> RESTResponseType: + """Get Endpoint + + Returns information about the specified endpoint. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param endpoint_id: BRTC Endpoint ID. (required) + :type endpoint_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_endpoint_serialize( + account_id=account_id, + endpoint_id=endpoint_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EndpointResponse", + '400': "ErrorResponse", + '401': "ErrorResponse", + '403': "ErrorResponse", + '404': "ErrorResponse", + '405': "ErrorResponse", + '415': "ErrorResponse", + '429': "ErrorResponse", + '500': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_endpoint_serialize( + self, + account_id, + endpoint_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _hosts = [ + 'https://api.bandwidth.com/v2' + ] + _host = _hosts[_host_index] + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if account_id is not None: + _path_params['accountId'] = account_id + if endpoint_id is not None: + _path_params['endpointId'] = endpoint_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'Basic', + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/accounts/{accountId}/endpoints/{endpointId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_endpoints( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + type: Annotated[Optional[EndpointTypeEnum], Field(description="The type of endpoint.")] = None, + status: Annotated[Optional[EndpointStatusEnum], Field(description="The status of the endpoint.")] = None, + after_cursor: Annotated[Optional[StrictStr], Field(description="The cursor to use for pagination. This is the value of the `next` link in the previous response.")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="The maximum number of endpoints to return in the response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> ListEndpointsResponse: + """List Endpoints + + Returns a list of endpoints associated with the specified account. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param type: The type of endpoint. + :type type: EndpointTypeEnum + :param status: The status of the endpoint. + :type status: EndpointStatusEnum + :param after_cursor: The cursor to use for pagination. This is the value of the `next` link in the previous response. + :type after_cursor: str + :param limit: The maximum number of endpoints to return in the response. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_endpoints_serialize( + account_id=account_id, + type=type, + status=status, + after_cursor=after_cursor, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListEndpointsResponse", + '400': "ErrorResponse", + '401': "ErrorResponse", + '403': "ErrorResponse", + '404': "ErrorResponse", + '405': "ErrorResponse", + '415': "ErrorResponse", + '429': "ErrorResponse", + '500': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_endpoints_with_http_info( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + type: Annotated[Optional[EndpointTypeEnum], Field(description="The type of endpoint.")] = None, + status: Annotated[Optional[EndpointStatusEnum], Field(description="The status of the endpoint.")] = None, + after_cursor: Annotated[Optional[StrictStr], Field(description="The cursor to use for pagination. This is the value of the `next` link in the previous response.")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="The maximum number of endpoints to return in the response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> ApiResponse[ListEndpointsResponse]: + """List Endpoints + + Returns a list of endpoints associated with the specified account. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param type: The type of endpoint. + :type type: EndpointTypeEnum + :param status: The status of the endpoint. + :type status: EndpointStatusEnum + :param after_cursor: The cursor to use for pagination. This is the value of the `next` link in the previous response. + :type after_cursor: str + :param limit: The maximum number of endpoints to return in the response. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_endpoints_serialize( + account_id=account_id, + type=type, + status=status, + after_cursor=after_cursor, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListEndpointsResponse", + '400': "ErrorResponse", + '401': "ErrorResponse", + '403': "ErrorResponse", + '404': "ErrorResponse", + '405': "ErrorResponse", + '415': "ErrorResponse", + '429': "ErrorResponse", + '500': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_endpoints_without_preload_content( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + type: Annotated[Optional[EndpointTypeEnum], Field(description="The type of endpoint.")] = None, + status: Annotated[Optional[EndpointStatusEnum], Field(description="The status of the endpoint.")] = None, + after_cursor: Annotated[Optional[StrictStr], Field(description="The cursor to use for pagination. This is the value of the `next` link in the previous response.")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="The maximum number of endpoints to return in the response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> RESTResponseType: + """List Endpoints + + Returns a list of endpoints associated with the specified account. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param type: The type of endpoint. + :type type: EndpointTypeEnum + :param status: The status of the endpoint. + :type status: EndpointStatusEnum + :param after_cursor: The cursor to use for pagination. This is the value of the `next` link in the previous response. + :type after_cursor: str + :param limit: The maximum number of endpoints to return in the response. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_endpoints_serialize( + account_id=account_id, + type=type, + status=status, + after_cursor=after_cursor, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListEndpointsResponse", + '400': "ErrorResponse", + '401': "ErrorResponse", + '403': "ErrorResponse", + '404': "ErrorResponse", + '405': "ErrorResponse", + '415': "ErrorResponse", + '429': "ErrorResponse", + '500': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_endpoints_serialize( + self, + account_id, + type, + status, + after_cursor, + limit, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _hosts = [ + 'https://api.bandwidth.com/v2' + ] + _host = _hosts[_host_index] + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if account_id is not None: + _path_params['accountId'] = account_id + # process the query parameters + if type is not None: + _query_params.append(('type', type.value)) + if status is not None: + _query_params.append(('status', status.value)) + if after_cursor is not None: + _query_params.append(('afterCursor', after_cursor)) + if limit is not None: + _query_params.append(('limit', limit)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'Basic', + 'OAuth2' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/accounts/{accountId}/endpoints', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + # NOTE: This endpoint is not yet available in the API + # Uncomment when the endpoint becomes available + # @validate_call + # def update_endpoint_bxml( + # self, + # account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + # endpoint_id: Annotated[StrictStr, Field(description="BRTC Endpoint ID.")], + # body: StrictStr, + # _request_timeout: Union[ + # None, + # Annotated[StrictFloat, Field(gt=0)], + # Tuple[ + # Annotated[StrictFloat, Field(gt=0)], + # Annotated[StrictFloat, Field(gt=0)] + # ] + # ] = None, + # _request_auth: Optional[Dict[StrictStr, Any]] = None, + # _content_type: Optional[StrictStr] = None, + # _headers: Optional[Dict[StrictStr, Any]] = None, + # _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + # ) -> None: + # ) -> None: + # """Update Endpoint BXML + # + # Updates the BXML for the specified endpoint. + # + # :param account_id: Your Bandwidth Account ID. (required) + # :type account_id: str + # :param endpoint_id: BRTC Endpoint ID. (required) + # :type endpoint_id: str + # :param body: (required) + # :type body: str + # :param _request_timeout: timeout setting for this request. If one + # number provided, it will be total request + # timeout. It can also be a pair (tuple) of + # (connection, read) timeouts. + # :type _request_timeout: int, tuple(int, int), optional + # :param _request_auth: set to override the auth_settings for an a single + # request; this effectively ignores the + # authentication in the spec for a single request. + # :type _request_auth: dict, optional + # :param _content_type: force content-type for the request. + # :type _content_type: str, Optional + # :param _headers: set to override the headers for a single + # request; this effectively ignores the headers + # in the spec for a single request. + # :type _headers: dict, optional + # :param _host_index: set to override the host_index for a single + # request; this effectively ignores the host_index + # in the spec for a single request. + # :type _host_index: int, optional + # :return: Returns the result object. + # """ # noqa: E501 + # + # _param = self._update_endpoint_bxml_serialize( + # account_id=account_id, + # endpoint_id=endpoint_id, + # body=body, + # _request_auth=_request_auth, + # _content_type=_content_type, + # _headers=_headers, + # _host_index=_host_index + # ) + # + # _response_types_map: Dict[str, Optional[str]] = { + # '204': None, + # '400': "ErrorResponse", + # '401': "ErrorResponse", + # '403': "ErrorResponse", + # '404': "ErrorResponse", + # '405': "ErrorResponse", + # '415': "ErrorResponse", + # '429': "ErrorResponse", + # '500': "ErrorResponse", + # } + # response_data = self.api_client.call_api( + # *_param, + # _request_timeout=_request_timeout + # ) + # response_data.read() + # return self.api_client.response_deserialize( + # response_data=response_data, + # response_types_map=_response_types_map, + # ).data + + + # @validate_call + # def update_endpoint_bxml_with_http_info( + # self, + # account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + # endpoint_id: Annotated[StrictStr, Field(description="BRTC Endpoint ID.")], + # body: StrictStr, + # _request_timeout: Union[ + # None, + # Annotated[StrictFloat, Field(gt=0)], + # Tuple[ + # Annotated[StrictFloat, Field(gt=0)], + # Annotated[StrictFloat, Field(gt=0)] + # ] + # ] = None, + # _request_auth: Optional[Dict[StrictStr, Any]] = None, + # _content_type: Optional[StrictStr] = None, + # _headers: Optional[Dict[StrictStr, Any]] = None, + # _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + # ) -> ApiResponse[None]: + # """Update Endpoint BXML + + # Updates the BXML for the specified endpoint. + + # :param account_id: Your Bandwidth Account ID. (required) + # :type account_id: str + # :param endpoint_id: BRTC Endpoint ID. (required) + # :type endpoint_id: str + # :param body: (required) + # :type body: str + # :param _request_timeout: timeout setting for this request. If one + # number provided, it will be total request + # timeout. It can also be a pair (tuple) of + # (connection, read) timeouts. + # :type _request_timeout: int, tuple(int, int), optional + # :param _request_auth: set to override the auth_settings for an a single + # request; this effectively ignores the + # authentication in the spec for a single request. + # :type _request_auth: dict, optional + # :param _content_type: force content-type for the request. + # :type _content_type: str, Optional + # :param _headers: set to override the headers for a single + # request; this effectively ignores the headers + # in the spec for a single request. + # :type _headers: dict, optional + # :param _host_index: set to override the host_index for a single + # request; this effectively ignores the host_index + # in the spec for a single request. + # :type _host_index: int, optional + # :return: Returns the result object. + # """ # noqa: E501 + + # _param = self._update_endpoint_bxml_serialize( + # account_id=account_id, + # endpoint_id=endpoint_id, + # body=body, + # _request_auth=_request_auth, + # _content_type=_content_type, + # _headers=_headers, + # _host_index=_host_index + # ) + + # _response_types_map: Dict[str, Optional[str]] = { + # '204': None, + # '400': "ErrorResponse", + # '401': "ErrorResponse", + # '403': "ErrorResponse", + # '404': "ErrorResponse", + # '405': "ErrorResponse", + # '415': "ErrorResponse", + # '429': "ErrorResponse", + # '500': "ErrorResponse", + # } + # response_data = self.api_client.call_api( + # *_param, + # _request_timeout=_request_timeout + # ) + # response_data.read() + # return self.api_client.response_deserialize( + # response_data=response_data, + # response_types_map=_response_types_map, + # ) + + +# @validate_call + # def update_endpoint_bxml_without_preload_content( + # self, + # account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + # endpoint_id: Annotated[StrictStr, Field(description="BRTC Endpoint ID.")], + # body: StrictStr, + # _request_timeout: Union[ + # None, + # Annotated[StrictFloat, Field(gt=0)], + # Tuple[ + # Annotated[StrictFloat, Field(gt=0)], + # Annotated[StrictFloat, Field(gt=0)] + # ] + # ] = None, + # _request_auth: Optional[Dict[StrictStr, Any]] = None, + # _content_type: Optional[StrictStr] = None, + # _headers: Optional[Dict[StrictStr, Any]] = None, + # _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + # ) -> RESTResponseType: + # """Update Endpoint BXML + # + # Updates the BXML for the specified endpoint. + # + # :param account_id: Your Bandwidth Account ID. (required) + # :type account_id: str + # :param endpoint_id: BRTC Endpoint ID. (required) + # :type endpoint_id: str + # :param body: (required) + # :type body: str + # :param _request_timeout: timeout setting for this request. If one + # number provided, it will be total request + # timeout. It can also be a pair (tuple) of + # (connection, read) timeouts. + # :type _request_timeout: int, tuple(int, int), optional + # :param _request_auth: set to override the auth_settings for an a single + # request; this effectively ignores the + # authentication in the spec for a single request. + # :type _request_auth: dict, optional + # :param _content_type: force content-type for the request. + # :type _content_type: str, Optional + # :param _headers: set to override the headers for a single + # request; this effectively ignores the headers + # in the spec for a single request. + # :type _headers: dict, optional + # :param _host_index: set to override the host_index for a single + # request; this effectively ignores the host_index + # in the spec for a single request. + # :type _host_index: int, optional + # :return: Returns the result object. + # """ # noqa: E501 + # + # _param = self._update_endpoint_bxml_serialize( + # account_id=account_id, + # endpoint_id=endpoint_id, + # body=body, + # _request_auth=_request_auth, + # _content_type=_content_type, + # _headers=_headers, + # _host_index=_host_index + # ) + # + # _response_types_map: Dict[str, Optional[str]] = { + # '204': None, + # '400': "ErrorResponse", + # '401': "ErrorResponse", + # '403': "ErrorResponse", + # '404': "ErrorResponse", + # '405': "ErrorResponse", + # '415': "ErrorResponse", + # '429': "ErrorResponse", + # '500': "ErrorResponse", + # } + # response_data = self.api_client.call_api( + # *_param, + # _request_timeout=_request_timeout + # ) + # return response_data.response + # + # + # def _update_endpoint_bxml_serialize( + # self, + # account_id, + # endpoint_id, + # body, + # _request_auth, + # _content_type, + # _headers, + # _host_index, + # ) -> RequestSerialized: + # + # _hosts = [ + # 'https://api.bandwidth.com/v2' + # ] + # _host = _hosts[_host_index] + # + # _collection_formats: Dict[str, str] = { + # } + # + # _path_params: Dict[str, str] = {} + # _query_params: List[Tuple[str, str]] = [] + # _header_params: Dict[str, Optional[str]] = _headers or {} + # _form_params: List[Tuple[str, str]] = [] + # _files: Dict[ + # str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + # ] = {} + # _body_params: Optional[bytes] = None + # + # # process the path parameters + # if account_id is not None: + # _path_params['accountId'] = account_id + # if endpoint_id is not None: + # _path_params['endpointId'] = endpoint_id + # # process the query parameters + # # process the header parameters + # # process the form parameters + # # process the body parameter + # if body is not None: + # _body_params = body + # + # + # # set the HTTP header `Accept` + # if 'Accept' not in _header_params: + # _header_params['Accept'] = self.api_client.select_header_accept( + # [ + # 'application/json' + # ] + # ) + # + # # set the HTTP header `Content-Type` + # if _content_type: + # _header_params['Content-Type'] = _content_type + # else: + # _default_content_type = ( + # self.api_client.select_header_content_type( + # [ + # 'application/xml' + # ] + # ) + # ) + # if _default_content_type is not None: + # _header_params['Content-Type'] = _default_content_type + # + # # authentication setting + # _auth_settings: List[str] = [ + # 'Basic', + # 'OAuth2' + # ] + # + # return self.api_client.param_serialize( + # method='PUT', + # resource_path='/accounts/{accountId}/endpoints/{endpointId}/bxml', + # path_params=_path_params, + # query_params=_query_params, + # header_params=_header_params, + # body=_body_params, + # post_params=_form_params, + # files=_files, + # auth_settings=_auth_settings, + # collection_formats=_collection_formats, + # _host=_host, + # _request_auth=_request_auth + # ) diff --git a/bandwidth/models/__init__.py b/bandwidth/models/__init__.py index 58a7cc68..93714014 100644 --- a/bandwidth/models/__init__.py +++ b/bandwidth/models/__init__.py @@ -53,16 +53,31 @@ from bandwidth.models.create_async_bulk_lookup_response_data import CreateAsyncBulkLookupResponseData from bandwidth.models.create_call import CreateCall from bandwidth.models.create_call_response import CreateCallResponse +from bandwidth.models.create_endpoint_request_base import CreateEndpointRequestBase +from bandwidth.models.create_endpoint_response import CreateEndpointResponse +from bandwidth.models.create_endpoint_response_object import CreateEndpointResponseObject from bandwidth.models.create_message_request_error import CreateMessageRequestError from bandwidth.models.create_multi_channel_message_response import CreateMultiChannelMessageResponse from bandwidth.models.create_sync_lookup_response import CreateSyncLookupResponse from bandwidth.models.create_sync_lookup_response_data import CreateSyncLookupResponseData +from bandwidth.models.create_web_rtc_connection_request import CreateWebRtcConnectionRequest from bandwidth.models.deactivation_event_enum import DeactivationEventEnum +from bandwidth.models.device import Device +from bandwidth.models.device_status_enum import DeviceStatusEnum from bandwidth.models.disconnect_callback import DisconnectCallback from bandwidth.models.diversion import Diversion from bandwidth.models.dtmf_callback import DtmfCallback +from bandwidth.models.endpoint import Endpoint +from bandwidth.models.endpoint_direction_enum import EndpointDirectionEnum +from bandwidth.models.endpoint_event import EndpointEvent +from bandwidth.models.endpoint_event_type_enum import EndpointEventTypeEnum +from bandwidth.models.endpoint_response import EndpointResponse +from bandwidth.models.endpoint_status_enum import EndpointStatusEnum +from bandwidth.models.endpoint_type_enum import EndpointTypeEnum +from bandwidth.models.endpoints import Endpoints from bandwidth.models.error import Error from bandwidth.models.error_object import ErrorObject +from bandwidth.models.error_response import ErrorResponse from bandwidth.models.error_source import ErrorSource from bandwidth.models.failure_webhook import FailureWebhook from bandwidth.models.field_error import FieldError @@ -80,6 +95,7 @@ from bandwidth.models.link import Link from bandwidth.models.link_schema import LinkSchema from bandwidth.models.links_object import LinksObject +from bandwidth.models.list_endpoints_response import ListEndpointsResponse from bandwidth.models.list_message_direction_enum import ListMessageDirectionEnum from bandwidth.models.list_message_item import ListMessageItem from bandwidth.models.lookup_error_response import LookupErrorResponse @@ -123,6 +139,7 @@ from bandwidth.models.multi_channel_message_request import MultiChannelMessageRequest from bandwidth.models.multi_channel_message_response_data import MultiChannelMessageResponseData from bandwidth.models.opt_in_workflow import OptInWorkflow +from bandwidth.models.page import Page from bandwidth.models.page_info import PageInfo from bandwidth.models.priority_enum import PriorityEnum from bandwidth.models.product_type_enum import ProductTypeEnum @@ -151,6 +168,8 @@ from bandwidth.models.recording_transcriptions import RecordingTranscriptions from bandwidth.models.redirect_callback import RedirectCallback from bandwidth.models.redirect_method_enum import RedirectMethodEnum +from bandwidth.models.sip_connection_metadata import SipConnectionMetadata +from bandwidth.models.sip_credentials import SipCredentials from bandwidth.models.sms_message_content import SmsMessageContent from bandwidth.models.standalone_card_orientation_enum import StandaloneCardOrientationEnum from bandwidth.models.status_callback import StatusCallback diff --git a/bandwidth/models/create_endpoint_request_base.py b/bandwidth/models/create_endpoint_request_base.py new file mode 100644 index 00000000..1100a9b3 --- /dev/null +++ b/bandwidth/models/create_endpoint_request_base.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from bandwidth.models.endpoint_direction_enum import EndpointDirectionEnum +from bandwidth.models.endpoint_type_enum import EndpointTypeEnum +from typing import Optional, Set +from typing_extensions import Self + +class CreateEndpointRequestBase(BaseModel): + """ + CreateEndpointRequestBase + """ # noqa: E501 + type: EndpointTypeEnum + direction: EndpointDirectionEnum + event_callback_url: Optional[StrictStr] = Field(default=None, description="The URL to send event callbacks to.", alias="eventCallbackUrl") + event_fallback_url: Optional[StrictStr] = Field(default=None, description="The URL to send event fallbacks to.", alias="eventFallbackUrl") + tag: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A tag for the endpoint.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "direction", "eventCallbackUrl", "eventFallbackUrl", "tag"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateEndpointRequestBase from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateEndpointRequestBase from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "direction": obj.get("direction"), + "eventCallbackUrl": obj.get("eventCallbackUrl"), + "eventFallbackUrl": obj.get("eventFallbackUrl"), + "tag": obj.get("tag") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/bandwidth/models/create_endpoint_response.py b/bandwidth/models/create_endpoint_response.py new file mode 100644 index 00000000..6dc0b641 --- /dev/null +++ b/bandwidth/models/create_endpoint_response.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from bandwidth.models.create_endpoint_response_object import CreateEndpointResponseObject +from bandwidth.models.error import Error +from bandwidth.models.link import Link +from typing import Optional, Set +from typing_extensions import Self + +class CreateEndpointResponse(BaseModel): + """ + CreateEndpointResponse + """ # noqa: E501 + links: List[Link] + data: CreateEndpointResponseObject + errors: List[Error] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["links", "data", "errors"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateEndpointResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in links (list) + _items = [] + if self.links: + for _item_links in self.links: + if _item_links: + _items.append(_item_links.to_dict()) + _dict['links'] = _items + # override the default output from pydantic by calling `to_dict()` of data + if self.data: + _dict['data'] = self.data.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in errors (list) + _items = [] + if self.errors: + for _item_errors in self.errors: + if _item_errors: + _items.append(_item_errors.to_dict()) + _dict['errors'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateEndpointResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "links": [Link.from_dict(_item) for _item in obj["links"]] if obj.get("links") is not None else None, + "data": CreateEndpointResponseObject.from_dict(obj["data"]) if obj.get("data") is not None else None, + "errors": [Error.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/bandwidth/models/create_endpoint_response_object.py b/bandwidth/models/create_endpoint_response_object.py new file mode 100644 index 00000000..5f3c9239 --- /dev/null +++ b/bandwidth/models/create_endpoint_response_object.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from bandwidth.models.device import Device +from bandwidth.models.endpoint_status_enum import EndpointStatusEnum +from bandwidth.models.endpoint_type_enum import EndpointTypeEnum +from typing import Optional, Set +from typing_extensions import Self + +class CreateEndpointResponseObject(BaseModel): + """ + CreateEndpointResponseObject + """ # noqa: E501 + endpoint_id: StrictStr = Field(description="The unique ID of the endpoint.", alias="endpointId") + type: Optional[EndpointTypeEnum] = None + status: Optional[EndpointStatusEnum] = None + creation_timestamp: datetime = Field(description="The time the endpoint was created. In ISO-8601 format.", alias="creationTimestamp") + expiration_timestamp: datetime = Field(description="The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours.", alias="expirationTimestamp") + tag: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A tag for the endpoint.") + devices: Optional[List[Device]] = None + token: StrictStr = Field(description="The json web token specific to the endpoint. Used to authenticate the client with the media gateway.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["endpointId", "type", "status", "creationTimestamp", "expirationTimestamp", "tag", "devices", "token"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateEndpointResponseObject from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in devices (list) + _items = [] + if self.devices: + for _item_devices in self.devices: + if _item_devices: + _items.append(_item_devices.to_dict()) + _dict['devices'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateEndpointResponseObject from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _dict = { + "endpointId": obj.get("endpointId"), + "creationTimestamp": obj.get("creationTimestamp"), + "expirationTimestamp": obj.get("expirationTimestamp"), + "token": obj.get("token") + } + # Only add optional fields if they're present + if "type" in obj and obj.get("type") is not None: + _dict["type"] = obj.get("type") + if "status" in obj and obj.get("status") is not None: + _dict["status"] = obj.get("status") + if "tag" in obj: + _dict["tag"] = obj.get("tag") + if "devices" in obj and obj.get("devices") is not None: + _dict["devices"] = [Device.from_dict(_item) for _item in obj["devices"]] + + _obj = cls.model_validate(_dict) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj diff --git a/bandwidth/models/create_web_rtc_connection_request.py b/bandwidth/models/create_web_rtc_connection_request.py new file mode 100644 index 00000000..3b393dbf --- /dev/null +++ b/bandwidth/models/create_web_rtc_connection_request.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from bandwidth.models.endpoint_direction_enum import EndpointDirectionEnum +from bandwidth.models.endpoint_type_enum import EndpointTypeEnum +from typing import Optional, Set +from typing_extensions import Self + +class CreateWebRtcConnectionRequest(BaseModel): + """ + CreateWebRtcConnectionRequest + """ # noqa: E501 + type: EndpointTypeEnum + direction: EndpointDirectionEnum + event_callback_url: Optional[StrictStr] = Field(default=None, description="The URL to send event callbacks to.", alias="eventCallbackUrl") + event_fallback_url: Optional[StrictStr] = Field(default=None, description="The URL to send event fallbacks to.", alias="eventFallbackUrl") + tag: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A tag for the endpoint.") + connection_metadata: Optional[Dict[str, Any]] = Field(default=None, alias="connectionMetadata") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "direction", "eventCallbackUrl", "eventFallbackUrl", "tag", "connectionMetadata"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateWebRtcConnectionRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateWebRtcConnectionRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "direction": obj.get("direction"), + "eventCallbackUrl": obj.get("eventCallbackUrl"), + "eventFallbackUrl": obj.get("eventFallbackUrl"), + "tag": obj.get("tag"), + "connectionMetadata": obj.get("connectionMetadata") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/bandwidth/models/device.py b/bandwidth/models/device.py new file mode 100644 index 00000000..c59ebaea --- /dev/null +++ b/bandwidth/models/device.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from bandwidth.models.device_status_enum import DeviceStatusEnum +from typing import Optional, Set +from typing_extensions import Self + +class Device(BaseModel): + """ + Device + """ # noqa: E501 + device_id: StrictStr = Field(description="The unique ID of the device.", alias="deviceId") + device_name: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="The name of the device.", alias="deviceName") + status: DeviceStatusEnum + creation_timestamp: datetime = Field(description="The time the device was created. In ISO-8601 format.", alias="creationTimestamp") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["deviceId", "deviceName", "status", "creationTimestamp"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Device from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Device from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "deviceId": obj.get("deviceId"), + "deviceName": obj.get("deviceName"), + "status": obj.get("status"), + "creationTimestamp": obj.get("creationTimestamp") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/bandwidth/models/device_status_enum.py b/bandwidth/models/device_status_enum.py new file mode 100644 index 00000000..4234eb05 --- /dev/null +++ b/bandwidth/models/device_status_enum.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class DeviceStatusEnum(str, Enum): + """ + DeviceStatusEnum + """ + + """ + allowed enum values + """ + CONNECTED = 'CONNECTED' + DISCONNECTED = 'DISCONNECTED' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of DeviceStatusEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/bandwidth/models/endpoint.py b/bandwidth/models/endpoint.py new file mode 100644 index 00000000..8eda4199 --- /dev/null +++ b/bandwidth/models/endpoint.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from bandwidth.models.device import Device +from bandwidth.models.endpoint_status_enum import EndpointStatusEnum +from bandwidth.models.endpoint_type_enum import EndpointTypeEnum +from typing import Optional, Set +from typing_extensions import Self + +class Endpoint(BaseModel): + """ + Endpoint + """ # noqa: E501 + endpoint_id: StrictStr = Field(description="The unique ID of the endpoint.", alias="endpointId") + type: Optional[EndpointTypeEnum] = None + status: Optional[EndpointStatusEnum] = None + creation_timestamp: datetime = Field(description="The time the endpoint was created. In ISO-8601 format.", alias="creationTimestamp") + expiration_timestamp: datetime = Field(description="The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours.", alias="expirationTimestamp") + tag: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A tag for the endpoint.") + devices: Optional[List[Device]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["endpointId", "type", "status", "creationTimestamp", "expirationTimestamp", "tag", "devices"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Endpoint from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in devices (list) + _items = [] + if self.devices: + for _item_devices in self.devices: + if _item_devices: + _items.append(_item_devices.to_dict()) + _dict['devices'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Endpoint from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _dict = { + "endpointId": obj.get("endpointId"), + "creationTimestamp": obj.get("creationTimestamp"), + "expirationTimestamp": obj.get("expirationTimestamp") + } + # Only add optional fields if they're present + if "type" in obj and obj.get("type") is not None: + _dict["type"] = obj.get("type") + if "status" in obj and obj.get("status") is not None: + _dict["status"] = obj.get("status") + if "tag" in obj: + _dict["tag"] = obj.get("tag") + if "devices" in obj and obj.get("devices") is not None: + _dict["devices"] = [Device.from_dict(_item) for _item in obj["devices"]] + + _obj = cls.model_validate(_dict) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj diff --git a/bandwidth/models/endpoint_direction_enum.py b/bandwidth/models/endpoint_direction_enum.py new file mode 100644 index 00000000..6a296a26 --- /dev/null +++ b/bandwidth/models/endpoint_direction_enum.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class EndpointDirectionEnum(str, Enum): + """ + EndpointDirectionEnum + """ + + """ + allowed enum values + """ + INBOUND = 'INBOUND' + OUTBOUND = 'OUTBOUND' + BIDIRECTIONAL = 'BIDIRECTIONAL' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of EndpointDirectionEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/bandwidth/models/endpoint_event.py b/bandwidth/models/endpoint_event.py new file mode 100644 index 00000000..273dae78 --- /dev/null +++ b/bandwidth/models/endpoint_event.py @@ -0,0 +1,131 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from bandwidth.models.device import Device +from bandwidth.models.endpoint_event_type_enum import EndpointEventTypeEnum +from bandwidth.models.endpoint_status_enum import EndpointStatusEnum +from bandwidth.models.endpoint_type_enum import EndpointTypeEnum +from typing import Optional, Set +from typing_extensions import Self + +class EndpointEvent(BaseModel): + """ + An event that occurred on an endpoint. + """ # noqa: E501 + endpoint_id: StrictStr = Field(description="The unique ID of the endpoint.", alias="endpointId") + type: Optional[EndpointTypeEnum] = None + status: Optional[EndpointStatusEnum] = None + creation_timestamp: datetime = Field(description="The time the endpoint was created. In ISO-8601 format.", alias="creationTimestamp") + expiration_timestamp: datetime = Field(description="The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours.", alias="expirationTimestamp") + tag: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A tag for the endpoint.") + event_time: datetime = Field(description="The time the event occurred. In ISO-8601 format.", alias="eventTime") + event_type: EndpointEventTypeEnum = Field(alias="eventType") + device: Optional[Device] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["endpointId", "type", "status", "creationTimestamp", "expirationTimestamp", "tag", "eventTime", "eventType", "device"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EndpointEvent from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of device + if self.device: + _dict['device'] = self.device.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EndpointEvent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _dict = { + "endpointId": obj.get("endpointId"), + "creationTimestamp": obj.get("creationTimestamp"), + "expirationTimestamp": obj.get("expirationTimestamp"), + "eventTime": obj.get("eventTime"), + "eventType": obj.get("eventType") + } + # Only add optional fields if they're present + if "type" in obj and obj.get("type") is not None: + _dict["type"] = obj.get("type") + if "status" in obj and obj.get("status") is not None: + _dict["status"] = obj.get("status") + if "tag" in obj: + _dict["tag"] = obj.get("tag") + if "device" in obj and obj.get("device") is not None: + _dict["device"] = Device.from_dict(obj["device"]) + + _obj = cls.model_validate(_dict) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj diff --git a/bandwidth/models/endpoint_event_type_enum.py b/bandwidth/models/endpoint_event_type_enum.py new file mode 100644 index 00000000..6ddeb0ed --- /dev/null +++ b/bandwidth/models/endpoint_event_type_enum.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class EndpointEventTypeEnum(str, Enum): + """ + EndpointEventTypeEnum + """ + + """ + allowed enum values + """ + DEVICE_CONNECTED = 'DEVICE_CONNECTED' + DEVICE_DISCONNECTED = 'DEVICE_DISCONNECTED' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of EndpointEventTypeEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/bandwidth/models/endpoint_response.py b/bandwidth/models/endpoint_response.py new file mode 100644 index 00000000..f2d89d88 --- /dev/null +++ b/bandwidth/models/endpoint_response.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from bandwidth.models.endpoint import Endpoint +from bandwidth.models.error import Error +from bandwidth.models.link import Link +from typing import Optional, Set +from typing_extensions import Self + +class EndpointResponse(BaseModel): + """ + EndpointResponse + """ # noqa: E501 + links: List[Link] + data: Endpoint + errors: List[Error] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["links", "data", "errors"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EndpointResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in links (list) + _items = [] + if self.links: + for _item_links in self.links: + if _item_links: + _items.append(_item_links.to_dict()) + _dict['links'] = _items + # override the default output from pydantic by calling `to_dict()` of data + if self.data: + _dict['data'] = self.data.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in errors (list) + _items = [] + if self.errors: + for _item_errors in self.errors: + if _item_errors: + _items.append(_item_errors.to_dict()) + _dict['errors'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EndpointResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "links": [Link.from_dict(_item) for _item in obj["links"]] if obj.get("links") is not None else None, + "data": Endpoint.from_dict(obj["data"]) if obj.get("data") is not None else None, + "errors": [Error.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/bandwidth/models/endpoint_status_enum.py b/bandwidth/models/endpoint_status_enum.py new file mode 100644 index 00000000..4f7ff564 --- /dev/null +++ b/bandwidth/models/endpoint_status_enum.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class EndpointStatusEnum(str, Enum): + """ + EndpointStatusEnum + """ + + """ + allowed enum values + """ + CONNECTED = 'CONNECTED' + DISCONNECTED = 'DISCONNECTED' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of EndpointStatusEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/bandwidth/models/endpoint_type_enum.py b/bandwidth/models/endpoint_type_enum.py new file mode 100644 index 00000000..7373c2ea --- /dev/null +++ b/bandwidth/models/endpoint_type_enum.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class EndpointTypeEnum(str, Enum): + """ + EndpointTypeEnum + """ + + """ + allowed enum values + """ + WEBRTC = 'WEBRTC' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of EndpointTypeEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/bandwidth/models/endpoints.py b/bandwidth/models/endpoints.py new file mode 100644 index 00000000..a2323888 --- /dev/null +++ b/bandwidth/models/endpoints.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from bandwidth.models.endpoint_status_enum import EndpointStatusEnum +from bandwidth.models.endpoint_type_enum import EndpointTypeEnum +from typing import Optional, Set +from typing_extensions import Self + +class Endpoints(BaseModel): + """ + Endpoints + """ # noqa: E501 + endpoint_id: StrictStr = Field(description="The unique ID of the endpoint.", alias="endpointId") + type: Optional[EndpointTypeEnum] = None + status: Optional[EndpointStatusEnum] = None + creation_timestamp: datetime = Field(description="The time the endpoint was created. In ISO-8601 format.", alias="creationTimestamp") + expiration_timestamp: datetime = Field(description="The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours.", alias="expirationTimestamp") + tag: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A tag for the endpoint.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["endpointId", "type", "status", "creationTimestamp", "expirationTimestamp", "tag"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Endpoints from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Endpoints from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _dict = { + "endpointId": obj.get("endpointId"), + "creationTimestamp": obj.get("creationTimestamp"), + "expirationTimestamp": obj.get("expirationTimestamp") + } + # Only add optional fields if they're present + if "type" in obj and obj.get("type") is not None: + _dict["type"] = obj.get("type") + if "status" in obj and obj.get("status") is not None: + _dict["status"] = obj.get("status") + if "tag" in obj: + _dict["tag"] = obj.get("tag") + + _obj = cls.model_validate(_dict) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj diff --git a/bandwidth/models/error_response.py b/bandwidth/models/error_response.py new file mode 100644 index 00000000..ccabd56f --- /dev/null +++ b/bandwidth/models/error_response.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from bandwidth.models.error import Error +from bandwidth.models.link import Link +from typing import Optional, Set +from typing_extensions import Self + +class ErrorResponse(BaseModel): + """ + ErrorResponse + """ # noqa: E501 + links: Optional[List[Link]] = None + data: Optional[Dict[str, Any]] = None + errors: Optional[List[Error]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["links", "data", "errors"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ErrorResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in links (list) + _items = [] + if self.links: + for _item_links in self.links: + if _item_links: + _items.append(_item_links.to_dict()) + _dict['links'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in errors (list) + _items = [] + if self.errors: + for _item_errors in self.errors: + if _item_errors: + _items.append(_item_errors.to_dict()) + _dict['errors'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ErrorResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _dict = {} + if "links" in obj and obj.get("links") is not None: + _dict["links"] = [Link.from_dict(_item) for _item in obj["links"]] + if "data" in obj: + _dict["data"] = obj.get("data") + if "errors" in obj and obj.get("errors") is not None: + _dict["errors"] = [Error.from_dict(_item) for _item in obj["errors"]] + + _obj = cls.model_validate(_dict) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj diff --git a/bandwidth/models/list_endpoints_response.py b/bandwidth/models/list_endpoints_response.py new file mode 100644 index 00000000..ece66219 --- /dev/null +++ b/bandwidth/models/list_endpoints_response.py @@ -0,0 +1,135 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from bandwidth.models.endpoints import Endpoints +from bandwidth.models.error import Error +from bandwidth.models.link import Link +from bandwidth.models.page import Page +from typing import Optional, Set +from typing_extensions import Self + +class ListEndpointsResponse(BaseModel): + """ + ListEndpointsResponse + """ # noqa: E501 + links: List[Link] + page: Optional[Page] = None + data: List[Endpoints] + errors: List[Error] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["links", "page", "data", "errors"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ListEndpointsResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in links (list) + _items = [] + if self.links: + for _item_links in self.links: + if _item_links: + _items.append(_item_links.to_dict()) + _dict['links'] = _items + # override the default output from pydantic by calling `to_dict()` of page + if self.page: + _dict['page'] = self.page.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in errors (list) + _items = [] + if self.errors: + for _item_errors in self.errors: + if _item_errors: + _items.append(_item_errors.to_dict()) + _dict['errors'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ListEndpointsResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "links": [Link.from_dict(_item) for _item in obj["links"]] if obj.get("links") is not None else None, + "page": Page.from_dict(obj["page"]) if obj.get("page") is not None else None, + "data": [Endpoints.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "errors": [Error.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/bandwidth/models/page.py b/bandwidth/models/page.py new file mode 100644 index 00000000..519fe076 --- /dev/null +++ b/bandwidth/models/page.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class Page(BaseModel): + """ + Page + """ # noqa: E501 + page_size: Annotated[int, Field(strict=True, ge=0)] = Field(description="The number of items per page.", alias="pageSize") + total_elements: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="The total number of items.", alias="totalElements") + total_pages: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="The total number of pages.", alias="totalPages") + page_number: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="The current page number.", alias="pageNumber") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["pageSize", "totalElements", "totalPages", "pageNumber"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Page from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Page from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "pageSize": obj.get("pageSize"), + "totalElements": obj.get("totalElements"), + "totalPages": obj.get("totalPages"), + "pageNumber": obj.get("pageNumber") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/bandwidth/models/sip_connection_metadata.py b/bandwidth/models/sip_connection_metadata.py new file mode 100644 index 00000000..2082adca --- /dev/null +++ b/bandwidth/models/sip_connection_metadata.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from bandwidth.models.sip_credentials import SipCredentials +from typing import Optional, Set +from typing_extensions import Self + +class SipConnectionMetadata(BaseModel): + """ + SipConnectionMetadata + """ # noqa: E501 + ip_address: Optional[StrictStr] = Field(default=None, description="The IP address of the SIP connection.", alias="ipAddress") + port: Optional[StrictInt] = Field(default=None, description="The port of the SIP connection.") + credentials: Optional[SipCredentials] = None + uui_header: Optional[StrictStr] = Field(default=None, description="The User-to-User Information header for the SIP connection.", alias="uuiHeader") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["ipAddress", "port", "credentials", "uuiHeader"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SipConnectionMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of credentials + if self.credentials: + _dict['credentials'] = self.credentials.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SipConnectionMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ipAddress": obj.get("ipAddress"), + "port": obj.get("port"), + "credentials": SipCredentials.from_dict(obj["credentials"]) if obj.get("credentials") is not None else None, + "uuiHeader": obj.get("uuiHeader") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/bandwidth/models/sip_credentials.py b/bandwidth/models/sip_credentials.py new file mode 100644 index 00000000..cce48c9f --- /dev/null +++ b/bandwidth/models/sip_credentials.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class SipCredentials(BaseModel): + """ + SipCredentials + """ # noqa: E501 + username: Optional[StrictStr] = Field(default=None, description="The username for the SIP connection.") + password: Optional[StrictStr] = Field(default=None, description="The password for the SIP connection.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["username", "password"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SipCredentials from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SipCredentials from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "username": obj.get("username"), + "password": obj.get("password") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/Callback.md b/docs/Callback.md index f9923bf8..f9c2822e 100644 --- a/docs/Callback.md +++ b/docs/Callback.md @@ -9,11 +9,11 @@ Name | Type | Description | Notes **time** | **datetime** | | **event_time** | **datetime** | Represents the time at which the message was read, for `message-read` callbacks. | [optional] **type** | [**InboundCallbackTypeEnum**](InboundCallbackTypeEnum.md) | | -**to** | **str** | 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** | **str** | 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** | **str** | A detailed description of the event described by the callback. | **message** | [**InboundCallbackMessage**](InboundCallbackMessage.md) | | **error_code** | **int** | Optional error code, applicable only when type is `message-failed`. | [optional] -**carrier_name** | **str** | 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] +**carrier_name** | **str** | 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] ## Example diff --git a/docs/CreateCall.md b/docs/CreateCall.md index 935ed3ca..d9c18a34 100644 --- a/docs/CreateCall.md +++ b/docs/CreateCall.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes **to** | **str** | The destination to call (must be an E.164 formatted number (e.g. `+15555551212`) or a SIP URI (e.g. `sip:user@server.example`)). | **var_from** | **str** | 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** | **bool** | Hide the calling number. The `displayName` field can be used to customize the displayed name. | [optional] -**display_name** | **str** | 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] +**display_name** | **str** | 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** | **str** | 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] **application_id** | **str** | The id of the application associated with the `from` number. | **answer_url** | **str** | 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..97efed29 --- /dev/null +++ b/docs/CreateEndpointRequestBase.md @@ -0,0 +1,33 @@ +# CreateEndpointRequestBase + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**EndpointTypeEnum**](EndpointTypeEnum.md) | | +**direction** | [**EndpointDirectionEnum**](EndpointDirectionEnum.md) | | +**event_callback_url** | **str** | The URL to send event callbacks to. | [optional] +**event_fallback_url** | **str** | The URL to send event fallbacks to. | [optional] +**tag** | **str** | A tag for the endpoint. | [optional] + +## Example + +```python +from bandwidth.models.create_endpoint_request_base import CreateEndpointRequestBase + +# TODO update the JSON string below +json = "{}" +# create an instance of CreateEndpointRequestBase from a JSON string +create_endpoint_request_base_instance = CreateEndpointRequestBase.from_json(json) +# print the JSON string representation of the object +print(CreateEndpointRequestBase.to_json()) + +# convert the object into a dict +create_endpoint_request_base_dict = create_endpoint_request_base_instance.to_dict() +# create an instance of CreateEndpointRequestBase from a dict +create_endpoint_request_base_from_dict = CreateEndpointRequestBase.from_dict(create_endpoint_request_base_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CreateEndpointResponse.md b/docs/CreateEndpointResponse.md new file mode 100644 index 00000000..016879e6 --- /dev/null +++ b/docs/CreateEndpointResponse.md @@ -0,0 +1,31 @@ +# CreateEndpointResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**List[Link]**](Link.md) | | +**data** | [**CreateEndpointResponseObject**](CreateEndpointResponseObject.md) | | +**errors** | [**List[Error]**](Error.md) | | + +## Example + +```python +from bandwidth.models.create_endpoint_response import CreateEndpointResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of CreateEndpointResponse from a JSON string +create_endpoint_response_instance = CreateEndpointResponse.from_json(json) +# print the JSON string representation of the object +print(CreateEndpointResponse.to_json()) + +# convert the object into a dict +create_endpoint_response_dict = create_endpoint_response_instance.to_dict() +# create an instance of CreateEndpointResponse from a dict +create_endpoint_response_from_dict = CreateEndpointResponse.from_dict(create_endpoint_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CreateEndpointResponseObject.md b/docs/CreateEndpointResponseObject.md new file mode 100644 index 00000000..47383b2c --- /dev/null +++ b/docs/CreateEndpointResponseObject.md @@ -0,0 +1,36 @@ +# CreateEndpointResponseObject + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**endpoint_id** | **str** | The unique ID of the endpoint. | +**type** | [**EndpointTypeEnum**](EndpointTypeEnum.md) | | +**status** | [**EndpointStatusEnum**](EndpointStatusEnum.md) | | +**creation_timestamp** | **datetime** | The time the endpoint was created. In ISO-8601 format. | +**expiration_timestamp** | **datetime** | The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. | +**tag** | **str** | A tag for the endpoint. | [optional] +**devices** | [**List[Device]**](Device.md) | | [optional] +**token** | **str** | The json web token specific to the endpoint. Used to authenticate the client with the media gateway. | + +## Example + +```python +from bandwidth.models.create_endpoint_response_object import CreateEndpointResponseObject + +# TODO update the JSON string below +json = "{}" +# create an instance of CreateEndpointResponseObject from a JSON string +create_endpoint_response_object_instance = CreateEndpointResponseObject.from_json(json) +# print the JSON string representation of the object +print(CreateEndpointResponseObject.to_json()) + +# convert the object into a dict +create_endpoint_response_object_dict = create_endpoint_response_object_instance.to_dict() +# create an instance of CreateEndpointResponseObject from a dict +create_endpoint_response_object_from_dict = CreateEndpointResponseObject.from_dict(create_endpoint_response_object_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CreateWebRtcConnectionRequest.md b/docs/CreateWebRtcConnectionRequest.md new file mode 100644 index 00000000..69307ca6 --- /dev/null +++ b/docs/CreateWebRtcConnectionRequest.md @@ -0,0 +1,34 @@ +# CreateWebRtcConnectionRequest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**EndpointTypeEnum**](EndpointTypeEnum.md) | | +**direction** | [**EndpointDirectionEnum**](EndpointDirectionEnum.md) | | +**event_callback_url** | **str** | The URL to send event callbacks to. | [optional] +**event_fallback_url** | **str** | The URL to send event fallbacks to. | [optional] +**tag** | **str** | A tag for the endpoint. | [optional] +**connection_metadata** | **object** | | [optional] + +## Example + +```python +from bandwidth.models.create_web_rtc_connection_request import CreateWebRtcConnectionRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of CreateWebRtcConnectionRequest from a JSON string +create_web_rtc_connection_request_instance = CreateWebRtcConnectionRequest.from_json(json) +# print the JSON string representation of the object +print(CreateWebRtcConnectionRequest.to_json()) + +# convert the object into a dict +create_web_rtc_connection_request_dict = create_web_rtc_connection_request_instance.to_dict() +# create an instance of CreateWebRtcConnectionRequest from a dict +create_web_rtc_connection_request_from_dict = CreateWebRtcConnectionRequest.from_dict(create_web_rtc_connection_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Device.md b/docs/Device.md new file mode 100644 index 00000000..18908966 --- /dev/null +++ b/docs/Device.md @@ -0,0 +1,32 @@ +# Device + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**device_id** | **str** | The unique ID of the device. | +**device_name** | **str** | The name of the device. | [optional] +**status** | [**DeviceStatusEnum**](DeviceStatusEnum.md) | | +**creation_timestamp** | **datetime** | The time the device was created. In ISO-8601 format. | + +## Example + +```python +from bandwidth.models.device import Device + +# TODO update the JSON string below +json = "{}" +# create an instance of Device from a JSON string +device_instance = Device.from_json(json) +# print the JSON string representation of the object +print(Device.to_json()) + +# convert the object into a dict +device_dict = device_instance.to_dict() +# create an instance of Device from a dict +device_from_dict = Device.from_dict(device_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/DeviceStatusEnum.md b/docs/DeviceStatusEnum.md new file mode 100644 index 00000000..ce2c3a06 --- /dev/null +++ b/docs/DeviceStatusEnum.md @@ -0,0 +1,12 @@ +# DeviceStatusEnum + + +## Enum + +* `CONNECTED` (value: `'CONNECTED'`) + +* `DISCONNECTED` (value: `'DISCONNECTED'`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Endpoint.md b/docs/Endpoint.md new file mode 100644 index 00000000..d32955af --- /dev/null +++ b/docs/Endpoint.md @@ -0,0 +1,35 @@ +# Endpoint + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**endpoint_id** | **str** | The unique ID of the endpoint. | +**type** | [**EndpointTypeEnum**](EndpointTypeEnum.md) | | +**status** | [**EndpointStatusEnum**](EndpointStatusEnum.md) | | +**creation_timestamp** | **datetime** | The time the endpoint was created. In ISO-8601 format. | +**expiration_timestamp** | **datetime** | The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. | +**tag** | **str** | A tag for the endpoint. | [optional] +**devices** | [**List[Device]**](Device.md) | | [optional] + +## Example + +```python +from bandwidth.models.endpoint import Endpoint + +# TODO update the JSON string below +json = "{}" +# create an instance of Endpoint from a JSON string +endpoint_instance = Endpoint.from_json(json) +# print the JSON string representation of the object +print(Endpoint.to_json()) + +# convert the object into a dict +endpoint_dict = endpoint_instance.to_dict() +# create an instance of Endpoint from a dict +endpoint_from_dict = Endpoint.from_dict(endpoint_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/EndpointDirectionEnum.md b/docs/EndpointDirectionEnum.md new file mode 100644 index 00000000..2202cb53 --- /dev/null +++ b/docs/EndpointDirectionEnum.md @@ -0,0 +1,14 @@ +# EndpointDirectionEnum + + +## Enum + +* `INBOUND` (value: `'INBOUND'`) + +* `OUTBOUND` (value: `'OUTBOUND'`) + +* `BIDIRECTIONAL` (value: `'BIDIRECTIONAL'`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/EndpointEvent.md b/docs/EndpointEvent.md new file mode 100644 index 00000000..898bdf6c --- /dev/null +++ b/docs/EndpointEvent.md @@ -0,0 +1,38 @@ +# EndpointEvent + +An event that occurred on an endpoint. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**endpoint_id** | **str** | The unique ID of the endpoint. | +**type** | [**EndpointTypeEnum**](EndpointTypeEnum.md) | | +**status** | [**EndpointStatusEnum**](EndpointStatusEnum.md) | | +**creation_timestamp** | **datetime** | The time the endpoint was created. In ISO-8601 format. | +**expiration_timestamp** | **datetime** | The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. | +**tag** | **str** | A tag for the endpoint. | [optional] +**event_time** | **datetime** | The time the event occurred. In ISO-8601 format. | +**event_type** | [**EndpointEventTypeEnum**](EndpointEventTypeEnum.md) | | +**device** | [**Device**](Device.md) | | [optional] + +## Example + +```python +from bandwidth.models.endpoint_event import EndpointEvent + +# TODO update the JSON string below +json = "{}" +# create an instance of EndpointEvent from a JSON string +endpoint_event_instance = EndpointEvent.from_json(json) +# print the JSON string representation of the object +print(EndpointEvent.to_json()) + +# convert the object into a dict +endpoint_event_dict = endpoint_event_instance.to_dict() +# create an instance of EndpointEvent from a dict +endpoint_event_from_dict = EndpointEvent.from_dict(endpoint_event_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/EndpointEventTypeEnum.md b/docs/EndpointEventTypeEnum.md new file mode 100644 index 00000000..1297cbd5 --- /dev/null +++ b/docs/EndpointEventTypeEnum.md @@ -0,0 +1,12 @@ +# EndpointEventTypeEnum + + +## Enum + +* `DEVICE_CONNECTED` (value: `'DEVICE_CONNECTED'`) + +* `DEVICE_DISCONNECTED` (value: `'DEVICE_DISCONNECTED'`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/EndpointResponse.md b/docs/EndpointResponse.md new file mode 100644 index 00000000..530b77f4 --- /dev/null +++ b/docs/EndpointResponse.md @@ -0,0 +1,31 @@ +# EndpointResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**List[Link]**](Link.md) | | +**data** | [**Endpoint**](Endpoint.md) | | +**errors** | [**List[Error]**](Error.md) | | + +## Example + +```python +from bandwidth.models.endpoint_response import EndpointResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of EndpointResponse from a JSON string +endpoint_response_instance = EndpointResponse.from_json(json) +# print the JSON string representation of the object +print(EndpointResponse.to_json()) + +# convert the object into a dict +endpoint_response_dict = endpoint_response_instance.to_dict() +# create an instance of EndpointResponse from a dict +endpoint_response_from_dict = EndpointResponse.from_dict(endpoint_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/EndpointStatusEnum.md b/docs/EndpointStatusEnum.md new file mode 100644 index 00000000..bef32325 --- /dev/null +++ b/docs/EndpointStatusEnum.md @@ -0,0 +1,12 @@ +# EndpointStatusEnum + + +## Enum + +* `CONNECTED` (value: `'CONNECTED'`) + +* `DISCONNECTED` (value: `'DISCONNECTED'`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/EndpointTypeEnum.md b/docs/EndpointTypeEnum.md new file mode 100644 index 00000000..d87faa67 --- /dev/null +++ b/docs/EndpointTypeEnum.md @@ -0,0 +1,10 @@ +# EndpointTypeEnum + + +## Enum + +* `WEBRTC` (value: `'WEBRTC'`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Endpoints.md b/docs/Endpoints.md new file mode 100644 index 00000000..010e68e2 --- /dev/null +++ b/docs/Endpoints.md @@ -0,0 +1,34 @@ +# Endpoints + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**endpoint_id** | **str** | The unique ID of the endpoint. | +**type** | [**EndpointTypeEnum**](EndpointTypeEnum.md) | | +**status** | [**EndpointStatusEnum**](EndpointStatusEnum.md) | | +**creation_timestamp** | **datetime** | The time the endpoint was created. In ISO-8601 format. | +**expiration_timestamp** | **datetime** | The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. | +**tag** | **str** | A tag for the endpoint. | [optional] + +## Example + +```python +from bandwidth.models.endpoints import Endpoints + +# TODO update the JSON string below +json = "{}" +# create an instance of Endpoints from a JSON string +endpoints_instance = Endpoints.from_json(json) +# print the JSON string representation of the object +print(Endpoints.to_json()) + +# convert the object into a dict +endpoints_dict = endpoints_instance.to_dict() +# create an instance of Endpoints from a dict +endpoints_from_dict = Endpoints.from_dict(endpoints_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/EndpointsApi.md b/docs/EndpointsApi.md new file mode 100644 index 00000000..63e3a31b --- /dev/null +++ b/docs/EndpointsApi.md @@ -0,0 +1,498 @@ +# bandwidth.EndpointsApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_endpoint**](EndpointsApi.md#create_endpoint) | **POST** /accounts/{accountId}/endpoints | Create Endpoint +[**delete_endpoint**](EndpointsApi.md#delete_endpoint) | **DELETE** /accounts/{accountId}/endpoints/{endpointId} | Delete Endpoint +[**get_endpoint**](EndpointsApi.md#get_endpoint) | **GET** /accounts/{accountId}/endpoints/{endpointId} | Get Endpoint +[**list_endpoints**](EndpointsApi.md#list_endpoints) | **GET** /accounts/{accountId}/endpoints | List Endpoints +[**update_endpoint_bxml**](EndpointsApi.md#update_endpoint_bxml) | **PUT** /accounts/{accountId}/endpoints/{endpointId}/bxml | Update Endpoint BXML + + +# **create_endpoint** +> CreateEndpointResponse create_endpoint(account_id, body) + +Create Endpoint + +Creates a new Endpoint for the specified account. + +### Example + +* Basic Authentication (Basic): +* OAuth Authentication (OAuth2): + +```python +import bandwidth +from bandwidth.models.create_endpoint_response import CreateEndpointResponse +from bandwidth.models.create_web_rtc_connection_request import CreateWebRtcConnectionRequest +from bandwidth.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = bandwidth.Configuration( + host = "http://localhost" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure HTTP basic authorization: Basic +configuration = bandwidth.Configuration( + username = os.environ["USERNAME"], + password = os.environ["PASSWORD"] +) + +# Configure your client ID and secret for OAuth +configuration = bandwidth.Configuration( + client_id = os.environ["CLIENT_ID"], + client_secret = os.environ["CLIENT_SECRET"] +) + +# Enter a context with an instance of the API client +with bandwidth.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = bandwidth.EndpointsApi(api_client) + account_id = '5500123' # str | Your Bandwidth Account ID. + body = bandwidth.CreateWebRtcConnectionRequest() # CreateWebRtcConnectionRequest | + + try: + # Create Endpoint + api_response = api_instance.create_endpoint(account_id, body) + print("The response of EndpointsApi->create_endpoint:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EndpointsApi->create_endpoint: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **str**| 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 | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **delete_endpoint** +> delete_endpoint(account_id, endpoint_id) + +Delete Endpoint + +Deletes the specified endpoint. If the endpoint is actively streaming media, the media stream will be terminated. + +### Example + +* Basic Authentication (Basic): +* OAuth Authentication (OAuth2): + +```python +import bandwidth +from bandwidth.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = bandwidth.Configuration( + host = "http://localhost" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure HTTP basic authorization: Basic +configuration = bandwidth.Configuration( + username = os.environ["USERNAME"], + password = os.environ["PASSWORD"] +) + +# Configure your client ID and secret for OAuth +configuration = bandwidth.Configuration( + client_id = os.environ["CLIENT_ID"], + client_secret = os.environ["CLIENT_SECRET"] +) + +# Enter a context with an instance of the API client +with bandwidth.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = bandwidth.EndpointsApi(api_client) + account_id = '5500123' # str | Your Bandwidth Account ID. + endpoint_id = 'e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' # str | BRTC Endpoint ID. + + try: + # Delete Endpoint + api_instance.delete_endpoint(account_id, endpoint_id) + except Exception as e: + print("Exception when calling EndpointsApi->delete_endpoint: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **str**| Your Bandwidth Account ID. | + **endpoint_id** | **str**| BRTC Endpoint ID. | + +### Return type + +void (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 | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_endpoint** +> EndpointResponse get_endpoint(account_id, endpoint_id) + +Get Endpoint + +Returns information about the specified endpoint. + +### Example + +* Basic Authentication (Basic): +* OAuth Authentication (OAuth2): + +```python +import bandwidth +from bandwidth.models.endpoint_response import EndpointResponse +from bandwidth.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = bandwidth.Configuration( + host = "http://localhost" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure HTTP basic authorization: Basic +configuration = bandwidth.Configuration( + username = os.environ["USERNAME"], + password = os.environ["PASSWORD"] +) + +# Configure your client ID and secret for OAuth +configuration = bandwidth.Configuration( + client_id = os.environ["CLIENT_ID"], + client_secret = os.environ["CLIENT_SECRET"] +) + +# Enter a context with an instance of the API client +with bandwidth.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = bandwidth.EndpointsApi(api_client) + account_id = '5500123' # str | Your Bandwidth Account ID. + endpoint_id = 'e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' # str | BRTC Endpoint ID. + + try: + # Get Endpoint + api_response = api_instance.get_endpoint(account_id, endpoint_id) + print("The response of EndpointsApi->get_endpoint:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EndpointsApi->get_endpoint: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **str**| Your Bandwidth Account ID. | + **endpoint_id** | **str**| 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 | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **list_endpoints** +> ListEndpointsResponse list_endpoints(account_id, type=type, status=status, after_cursor=after_cursor, limit=limit) + +List Endpoints + +Returns a list of endpoints associated with the specified account. + +### Example + +* Basic Authentication (Basic): +* OAuth Authentication (OAuth2): + +```python +import bandwidth +from bandwidth.models.endpoint_status_enum import EndpointStatusEnum +from bandwidth.models.endpoint_type_enum import EndpointTypeEnum +from bandwidth.models.list_endpoints_response import ListEndpointsResponse +from bandwidth.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = bandwidth.Configuration( + host = "http://localhost" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure HTTP basic authorization: Basic +configuration = bandwidth.Configuration( + username = os.environ["USERNAME"], + password = os.environ["PASSWORD"] +) + +# Configure your client ID and secret for OAuth +configuration = bandwidth.Configuration( + client_id = os.environ["CLIENT_ID"], + client_secret = os.environ["CLIENT_SECRET"] +) + +# Enter a context with an instance of the API client +with bandwidth.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = bandwidth.EndpointsApi(api_client) + account_id = '5500123' # str | Your Bandwidth Account ID. + type = bandwidth.EndpointTypeEnum() # EndpointTypeEnum | The type of endpoint. (optional) + status = bandwidth.EndpointStatusEnum() # EndpointStatusEnum | The status of the endpoint. (optional) + after_cursor = 'TWF5IHRoZSBmb3JjZSBiZSB3aXRoIHlvdQ==' # str | The cursor to use for pagination. This is the value of the `next` link in the previous response. (optional) + limit = 100 # int | The maximum number of endpoints to return in the response. (optional) (default to 100) + + try: + # List Endpoints + api_response = api_instance.list_endpoints(account_id, type=type, status=status, after_cursor=after_cursor, limit=limit) + print("The response of EndpointsApi->list_endpoints:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EndpointsApi->list_endpoints: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **str**| Your Bandwidth Account ID. | + **type** | [**EndpointTypeEnum**](.md)| The type of endpoint. | [optional] + **status** | [**EndpointStatusEnum**](.md)| The status of the endpoint. | [optional] + **after_cursor** | **str**| The cursor to use for pagination. This is the value of the `next` link in the previous response. | [optional] + **limit** | **int**| 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 | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **update_endpoint_bxml** +> update_endpoint_bxml(account_id, endpoint_id, body) + +Update Endpoint BXML + +Updates the BXML for the specified endpoint. + +### Example + +* Basic Authentication (Basic): +* OAuth Authentication (OAuth2): + +```python +import bandwidth +from bandwidth.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = bandwidth.Configuration( + host = "http://localhost" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure HTTP basic authorization: Basic +configuration = bandwidth.Configuration( + username = os.environ["USERNAME"], + password = os.environ["PASSWORD"] +) + +# Configure your client ID and secret for OAuth +configuration = bandwidth.Configuration( + client_id = os.environ["CLIENT_ID"], + client_secret = os.environ["CLIENT_SECRET"] +) + +# Enter a context with an instance of the API client +with bandwidth.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = bandwidth.EndpointsApi(api_client) + account_id = '5500123' # str | Your Bandwidth Account ID. + endpoint_id = 'e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85' # str | BRTC Endpoint ID. + body = 'body_example' # str | + + try: + # Update Endpoint BXML + api_instance.update_endpoint_bxml(account_id, endpoint_id, body) + except Exception as e: + print("Exception when calling EndpointsApi->update_endpoint_bxml: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **str**| Your Bandwidth Account ID. | + **endpoint_id** | **str**| BRTC Endpoint ID. | + **body** | **str**| | + +### Return type + +void (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 | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/ErrorResponse.md b/docs/ErrorResponse.md new file mode 100644 index 00000000..60910a8b --- /dev/null +++ b/docs/ErrorResponse.md @@ -0,0 +1,31 @@ +# ErrorResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**List[Link]**](Link.md) | | +**data** | **object** | | +**errors** | [**List[Error]**](Error.md) | | + +## Example + +```python +from bandwidth.models.error_response import ErrorResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of ErrorResponse from a JSON string +error_response_instance = ErrorResponse.from_json(json) +# print the JSON string representation of the object +print(ErrorResponse.to_json()) + +# convert the object into a dict +error_response_dict = error_response_instance.to_dict() +# create an instance of ErrorResponse from a dict +error_response_from_dict = ErrorResponse.from_dict(error_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/InboundCallback.md b/docs/InboundCallback.md index ad9e2f47..40163194 100644 --- a/docs/InboundCallback.md +++ b/docs/InboundCallback.md @@ -8,10 +8,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **time** | **datetime** | | **type** | [**InboundCallbackTypeEnum**](InboundCallbackTypeEnum.md) | | -**to** | **str** | 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** | **str** | 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** | **str** | A detailed description of the event described by the callback. | **message** | [**InboundCallbackMessage**](InboundCallbackMessage.md) | | -**carrier_name** | **str** | 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] +**carrier_name** | **str** | 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] ## Example diff --git a/docs/InboundCallbackTypeEnum.md b/docs/InboundCallbackTypeEnum.md index 690a01f6..f1259de4 100644 --- a/docs/InboundCallbackTypeEnum.md +++ b/docs/InboundCallbackTypeEnum.md @@ -1,6 +1,6 @@ # InboundCallbackTypeEnum -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. ## Enum diff --git a/docs/ListEndpointsResponse.md b/docs/ListEndpointsResponse.md new file mode 100644 index 00000000..5fe2c0ec --- /dev/null +++ b/docs/ListEndpointsResponse.md @@ -0,0 +1,32 @@ +# 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) | | + +## Example + +```python +from bandwidth.models.list_endpoints_response import ListEndpointsResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of ListEndpointsResponse from a JSON string +list_endpoints_response_instance = ListEndpointsResponse.from_json(json) +# print the JSON string representation of the object +print(ListEndpointsResponse.to_json()) + +# convert the object into a dict +list_endpoints_response_dict = list_endpoints_response_instance.to_dict() +# create an instance of ListEndpointsResponse from a dict +list_endpoints_response_from_dict = ListEndpointsResponse.from_dict(list_endpoints_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/LookupResult.md b/docs/LookupResult.md index b7758648..187ed115 100644 --- a/docs/LookupResult.md +++ b/docs/LookupResult.md @@ -15,8 +15,8 @@ Name | Type | Description | Notes **deactivation_date** | **str** | [DNI-Only](#section/DNI-Only). The datetime the carrier reported a deactivation event. | [optional] **deactivation_event** | [**DeactivationEventEnum**](DeactivationEventEnum.md) | | [optional] **latest_message_delivery_status** | [**LatestMessageDeliveryStatusEnum**](LatestMessageDeliveryStatusEnum.md) | | [optional] -**initial_message_delivery_status_date** | **date** | [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] -**latest_message_delivery_status_date** | **date** | [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] +**initial_message_delivery_status_date** | **date** | [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] +**latest_message_delivery_status_date** | **date** | [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] ## Example diff --git a/docs/MachineDetectionConfiguration.md b/docs/MachineDetectionConfiguration.md index e3f7a7a7..158dd706 100644 --- a/docs/MachineDetectionConfiguration.md +++ b/docs/MachineDetectionConfiguration.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes **silence_timeout** | **float** | If no speech is detected in this period, a callback with a 'silence' result is sent. | [optional] [default to 10] **speech_threshold** | **float** | When speech has ended and a result couldn't be determined based on the audio content itself, this value is used to determine if the speaker is a machine based on the speech duration. If the length of the speech detected is greater than or equal to this threshold, the result will be 'answering-machine'. If the length of speech detected is below this threshold, the result will be 'human'. | [optional] [default to 10] **speech_end_threshold** | **float** | Amount of silence (in seconds) before assuming the callee has finished speaking. | [optional] [default to 5] -**machine_speech_end_threshold** | **float** | 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. | [optional] +**machine_speech_end_threshold** | **float** | 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. | [optional] **delay_result** | **bool** | If set to 'true' and if an answering machine is detected, the 'answering-machine' callback will be delayed until the machine is done speaking, or an end of message tone is detected, or until the 'detectionTimeout' is exceeded. If false, the 'answering-machine' result is sent immediately. | [optional] [default to False] **callback_url** | **str** | The URL to send the 'machineDetectionComplete' webhook when the detection is completed. Only for 'async' mode. | [optional] **callback_method** | [**CallbackMethodEnum**](CallbackMethodEnum.md) | | [optional] [default to CallbackMethodEnum.POST] diff --git a/docs/MessageRequest.md b/docs/MessageRequest.md index fae515d8..db965980 100644 --- a/docs/MessageRequest.md +++ b/docs/MessageRequest.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **application_id** | **str** | The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. | **to** | **List[str]** | The phone number(s) the message should be sent to in E164 format. | -**var_from** | **str** | 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. | +**var_from** | **str** | 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. | **text** | **str** | The contents of the text message. Must be 2048 characters or less. | [optional] **media** | **List[str]** | A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters. | [optional] **tag** | **str** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional] diff --git a/docs/Page.md b/docs/Page.md new file mode 100644 index 00000000..a33c4655 --- /dev/null +++ b/docs/Page.md @@ -0,0 +1,32 @@ +# Page + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**page_size** | **int** | The number of items per page. | +**total_elements** | **int** | The total number of items. | [optional] +**total_pages** | **int** | The total number of pages. | [optional] +**page_number** | **int** | The current page number. | [optional] + +## Example + +```python +from bandwidth.models.page import Page + +# TODO update the JSON string below +json = "{}" +# create an instance of Page from a JSON string +page_instance = Page.from_json(json) +# print the JSON string representation of the object +print(Page.to_json()) + +# convert the object into a dict +page_dict = page_instance.to_dict() +# create an instance of Page from a dict +page_from_dict = Page.from_dict(page_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SipConnectionMetadata.md b/docs/SipConnectionMetadata.md new file mode 100644 index 00000000..97e0f68b --- /dev/null +++ b/docs/SipConnectionMetadata.md @@ -0,0 +1,32 @@ +# SipConnectionMetadata + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ip_address** | **str** | The IP address of the SIP connection. | [optional] +**port** | **int** | The port of the SIP connection. | [optional] +**credentials** | [**SipCredentials**](SipCredentials.md) | | [optional] +**uui_header** | **str** | The User-to-User Information header for the SIP connection. | [optional] + +## Example + +```python +from bandwidth.models.sip_connection_metadata import SipConnectionMetadata + +# TODO update the JSON string below +json = "{}" +# create an instance of SipConnectionMetadata from a JSON string +sip_connection_metadata_instance = SipConnectionMetadata.from_json(json) +# print the JSON string representation of the object +print(SipConnectionMetadata.to_json()) + +# convert the object into a dict +sip_connection_metadata_dict = sip_connection_metadata_instance.to_dict() +# create an instance of SipConnectionMetadata from a dict +sip_connection_metadata_from_dict = SipConnectionMetadata.from_dict(sip_connection_metadata_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SipCredentials.md b/docs/SipCredentials.md new file mode 100644 index 00000000..20c72ea4 --- /dev/null +++ b/docs/SipCredentials.md @@ -0,0 +1,30 @@ +# SipCredentials + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**username** | **str** | The username for the SIP connection. | [optional] +**password** | **str** | The password for the SIP connection. | [optional] + +## Example + +```python +from bandwidth.models.sip_credentials import SipCredentials + +# TODO update the JSON string below +json = "{}" +# create an instance of SipCredentials from a JSON string +sip_credentials_instance = SipCredentials.from_json(json) +# print the JSON string representation of the object +print(SipCredentials.to_json()) + +# convert the object into a dict +sip_credentials_dict = sip_credentials_instance.to_dict() +# create an instance of SipCredentials from a dict +sip_credentials_from_dict = SipCredentials.from_dict(sip_credentials_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/test/smoke/test_endpoints_api.py b/test/smoke/test_endpoints_api.py new file mode 100644 index 00000000..3e55c99b --- /dev/null +++ b/test/smoke/test_endpoints_api.py @@ -0,0 +1,290 @@ +""" +Integration test for Bandwidth's WebRTC Endpoints API +""" +import unittest +import time + +from hamcrest import assert_that, has_properties, not_none, instance_of, equal_to + +from bandwidth import ApiClient, ApiResponse, Configuration +from bandwidth.api.endpoints_api import EndpointsApi +from bandwidth.models.create_web_rtc_connection_request import CreateWebRtcConnectionRequest +from bandwidth.models.create_endpoint_response import CreateEndpointResponse +from bandwidth.models.endpoint_response import EndpointResponse +from bandwidth.models.list_endpoints_response import ListEndpointsResponse +from bandwidth.models.endpoint_type_enum import EndpointTypeEnum +from bandwidth.models.endpoint_direction_enum import EndpointDirectionEnum +from bandwidth.models.endpoint_status_enum import EndpointStatusEnum +from bandwidth.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException +from test.utils.env_variables import * + + +class TestEndpointsApi(unittest.TestCase): + """EndpointsApi integration Test""" + + @classmethod + def setUpClass(cls) -> None: + configuration = Configuration( + username=BW_USERNAME, + password=BW_PASSWORD + ) + api_client = ApiClient(configuration) + cls.endpoints_api_instance = EndpointsApi(api_client) + + # Unauthorized API Client + unauthorized_configuration = Configuration( + username='bad_username', + password='bad_password' + ) + unauthorized_api_client = ApiClient(unauthorized_configuration) + cls.unauthorized_api_instance = EndpointsApi(unauthorized_api_client) + + # Forbidden API Client + forbidden_configuration = Configuration( + username=FORBIDDEN_USERNAME, + password=FORBIDDEN_PASSWORD + ) + forbidden_api_client = ApiClient(forbidden_configuration) + cls.forbidden_api_instance = EndpointsApi(forbidden_api_client) + + cls.account_id = BW_ACCOUNT_ID + cls.endpoint_id_array = [] + cls.TEST_SLEEP = 2 + + @classmethod + def tearDownClass(cls): + """Clean up endpoints created during tests""" + for endpoint_id in cls.endpoint_id_array: + try: + cls.endpoints_api_instance.delete_endpoint(cls.account_id, endpoint_id) + time.sleep(1) + except Exception as e: + print(f"Failed to cleanup endpoint {endpoint_id}: {e}") + + def test_create_endpoint(self): + """Test creating a new WebRTC endpoint with all parameters""" + time.sleep(self.TEST_SLEEP) + + create_request = CreateWebRtcConnectionRequest( + type=EndpointTypeEnum.WEBRTC, + direction=EndpointDirectionEnum.BIDIRECTIONAL, + event_callback_url=BASE_CALLBACK_URL + "/endpoint/callback", + event_fallback_url=BASE_CALLBACK_URL + "/endpoint/fallback", + tag="python-sdk-test-endpoint" + ) + + response: ApiResponse = self.endpoints_api_instance.create_endpoint_with_http_info( + self.account_id, + create_request + ) + + assert_that(response.status_code, equal_to(201)) + assert_that(response.data, instance_of(CreateEndpointResponse)) + assert_that(response.data.data, has_properties( + 'endpoint_id', instance_of(str), + 'type', EndpointTypeEnum.WEBRTC, + 'status', instance_of(EndpointStatusEnum), + 'token', instance_of(str) + )) + + # Store endpoint ID for cleanup + self.endpoint_id_array.append(response.data.data.endpoint_id) + + def test_create_endpoint_minimal(self): + """Test creating an endpoint with only required parameters""" + time.sleep(self.TEST_SLEEP) + + create_request = CreateWebRtcConnectionRequest( + type=EndpointTypeEnum.WEBRTC, + direction=EndpointDirectionEnum.OUTBOUND + ) + + response: CreateEndpointResponse = self.endpoints_api_instance.create_endpoint( + self.account_id, + create_request + ) + + assert_that(response.data, has_properties( + 'endpoint_id', instance_of(str), + 'type', EndpointTypeEnum.WEBRTC, + 'token', not_none() + )) + + # Store endpoint ID for cleanup + self.endpoint_id_array.append(response.data.endpoint_id) + + def test_get_endpoint(self): + """Test retrieving an endpoint by ID""" + time.sleep(self.TEST_SLEEP) + + # First create an endpoint + create_request = CreateWebRtcConnectionRequest( + type=EndpointTypeEnum.WEBRTC, + direction=EndpointDirectionEnum.INBOUND, + tag="test-get-endpoint" + ) + + create_response: CreateEndpointResponse = self.endpoints_api_instance.create_endpoint( + self.account_id, + create_request + ) + + endpoint_id = create_response.data.endpoint_id + self.endpoint_id_array.append(endpoint_id) + + time.sleep(self.TEST_SLEEP) + + # Now get the endpoint + response: ApiResponse = self.endpoints_api_instance.get_endpoint_with_http_info( + self.account_id, + endpoint_id + ) + + assert_that(response.status_code, equal_to(200)) + assert_that(response.data, instance_of(EndpointResponse)) + assert_that(response.data.data, has_properties( + 'endpoint_id', endpoint_id, + 'type', EndpointTypeEnum.WEBRTC, + 'tag', "test-get-endpoint" + )) + + def test_get_endpoint_not_found(self): + """Test getting a non-existent endpoint returns 404""" + time.sleep(self.TEST_SLEEP) + + with self.assertRaises(ApiException) as context: + self.endpoints_api_instance.get_endpoint( + self.account_id, + "non-existent-endpoint-id" + ) + + assert_that(context.exception.status, equal_to(404)) + + def test_list_endpoints(self): + """Test listing endpoints""" + time.sleep(self.TEST_SLEEP) + + # Create a couple of endpoints first + for i in range(2): + create_request = CreateWebRtcConnectionRequest( + type=EndpointTypeEnum.WEBRTC, + direction=EndpointDirectionEnum.BIDIRECTIONAL, + tag=f"test-list-endpoint-{i}" + ) + create_response = self.endpoints_api_instance.create_endpoint( + self.account_id, + create_request + ) + self.endpoint_id_array.append(create_response.data.endpoint_id) + time.sleep(1) + + time.sleep(self.TEST_SLEEP) + + # List endpoints + response: ApiResponse = self.endpoints_api_instance.list_endpoints_with_http_info( + self.account_id, + limit=10 + ) + + assert_that(response.status_code, equal_to(200)) + assert_that(response.data, instance_of(ListEndpointsResponse)) + assert_that(response.data.data, instance_of(list)) + + def test_list_endpoints_with_filter(self): + """Test listing endpoints with type filter""" + time.sleep(self.TEST_SLEEP) + + response: ListEndpointsResponse = self.endpoints_api_instance.list_endpoints( + self.account_id, + type=EndpointTypeEnum.WEBRTC, + limit=5 + ) + + assert_that(response.data, instance_of(list)) + # Verify all returned endpoints are of type WEBRTC + for endpoint in response.data: + assert_that(endpoint.type, equal_to(EndpointTypeEnum.WEBRTC)) + + def test_delete_endpoint(self): + """Test deleting an endpoint""" + time.sleep(self.TEST_SLEEP) + + # Create an endpoint to delete + create_request = CreateWebRtcConnectionRequest( + type=EndpointTypeEnum.WEBRTC, + direction=EndpointDirectionEnum.BIDIRECTIONAL, + tag="test-delete-endpoint" + ) + + create_response: CreateEndpointResponse = self.endpoints_api_instance.create_endpoint( + self.account_id, + create_request + ) + endpoint_id = create_response.data.endpoint_id + + time.sleep(self.TEST_SLEEP) + + # Delete the endpoint + response: ApiResponse = self.endpoints_api_instance.delete_endpoint_with_http_info( + self.account_id, + endpoint_id + ) + + assert_that(response.status_code, equal_to(204)) + + # Verify endpoint is deleted + time.sleep(self.TEST_SLEEP) + with self.assertRaises(ApiException) as context: + self.endpoints_api_instance.get_endpoint(self.account_id, endpoint_id) + + assert_that(context.exception.status, equal_to(404)) + + def test_delete_endpoint_not_found(self): + """Test deleting a non-existent endpoint returns 404""" + time.sleep(self.TEST_SLEEP) + + with self.assertRaises(ApiException) as context: + self.endpoints_api_instance.delete_endpoint( + self.account_id, + "non-existent-endpoint-id" + ) + + assert_that(context.exception.status, equal_to(404)) + + def test_create_endpoint_unauthorized(self): + """Test creating an endpoint with invalid credentials returns 401""" + time.sleep(self.TEST_SLEEP) + + create_request = CreateWebRtcConnectionRequest( + type=EndpointTypeEnum.WEBRTC, + direction=EndpointDirectionEnum.BIDIRECTIONAL + ) + + with self.assertRaises(ApiException) as context: + self.unauthorized_api_instance.create_endpoint( + self.account_id, + create_request + ) + + assert_that(context.exception.status, equal_to(401)) + + def test_create_endpoint_forbidden(self): + """Test creating an endpoint with forbidden credentials returns 403""" + time.sleep(self.TEST_SLEEP) + + create_request = CreateWebRtcConnectionRequest( + type=EndpointTypeEnum.WEBRTC, + direction=EndpointDirectionEnum.BIDIRECTIONAL + ) + + with self.assertRaises(ApiException) as context: + self.forbidden_api_instance.create_endpoint( + self.account_id, + create_request + ) + + assert_that(context.exception.status, equal_to(403)) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/api/test_endpoints_api.py b/test/unit/api/test_endpoints_api.py new file mode 100644 index 00000000..84829def --- /dev/null +++ b/test/unit/api/test_endpoints_api.py @@ -0,0 +1,207 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +from datetime import datetime + +from hamcrest import * +from test.utils.env_variables import * +from bandwidth import ApiClient, Configuration +from bandwidth.api.endpoints_api import EndpointsApi +from bandwidth.models.create_web_rtc_connection_request import CreateWebRtcConnectionRequest +from bandwidth.models.create_endpoint_response import CreateEndpointResponse +from bandwidth.models.endpoint_response import EndpointResponse +from bandwidth.models.list_endpoints_response import ListEndpointsResponse +from bandwidth.models.endpoint_type_enum import EndpointTypeEnum +from bandwidth.models.endpoint_direction_enum import EndpointDirectionEnum +from bandwidth.models.endpoint_status_enum import EndpointStatusEnum + + +class TestEndpointsApi(unittest.TestCase): + """EndpointsApi unit test stubs""" + + @classmethod + def setUpClass(cls) -> None: + configuration = Configuration( + client_id=BW_CLIENT_ID, + client_secret=BW_CLIENT_SECRET, + host='http://127.0.0.1:4010', + ignore_operation_servers=True + ) + api_client = ApiClient(configuration) + cls.endpoints_api_instance = EndpointsApi(api_client) + + def test_create_endpoint(self) -> None: + """Test case for create_endpoint + + Create Endpoint + """ + endpoint_body = CreateWebRtcConnectionRequest( + type=EndpointTypeEnum.WEBRTC, + direction=EndpointDirectionEnum.INBOUND, + event_callback_url="https://myServer.com/bandwidth/webhooks/endpoint", + event_fallback_url="https://myFallbackServer.com/bandwidth/webhooks/endpoint", + tag="test-endpoint", + connection_metadata={ + "key1": "value1", + "key2": "value2" + } + ) + response = self.endpoints_api_instance.create_endpoint_with_http_info( + BW_ACCOUNT_ID, + endpoint_body + ) + + assert_that(response.status_code, equal_to(201)) + assert_that(response.data, instance_of(CreateEndpointResponse)) + assert_that(response.data.links, instance_of(list)) + assert_that(response.data.data, instance_of(object)) + assert_that(response.data.errors, instance_of(list)) + + def test_delete_endpoint(self) -> None: + """Test case for delete_endpoint + + Delete Endpoint + """ + response = self.endpoints_api_instance.delete_endpoint_with_http_info( + BW_ACCOUNT_ID, + "ep-abc123" + ) + + assert_that(response.status_code, equal_to(204)) + + def test_get_endpoint(self) -> None: + """Test case for get_endpoint + + Get Endpoint + """ + response = self.endpoints_api_instance.get_endpoint_with_http_info( + BW_ACCOUNT_ID, + "ep-abc123" + ) + + assert_that(response.status_code, equal_to(200)) + assert_that(response.data, instance_of(EndpointResponse)) + assert_that(response.data.links, instance_of(list)) + assert_that(response.data.data, instance_of(object)) + assert_that(response.data.errors, instance_of(list)) + + def test_list_endpoints(self) -> None: + """Test case for list_endpoints + + List Endpoints + """ + response = self.endpoints_api_instance.list_endpoints_with_http_info( + BW_ACCOUNT_ID + ) + + assert_that(response.status_code, equal_to(200)) + assert_that(response.data, instance_of(ListEndpointsResponse)) + assert_that(response.data.links, instance_of(list)) + assert_that(response.data.data, instance_of(list)) + assert_that(response.data.errors, instance_of(list)) + + def test_list_endpoints_with_filters(self) -> None: + """Test case for list_endpoints with filters + + List Endpoints with Type and Status Filters + """ + response = self.endpoints_api_instance.list_endpoints_with_http_info( + BW_ACCOUNT_ID, + type=EndpointTypeEnum.WEBRTC, + status=EndpointStatusEnum.CONNECTED, + limit=100 + ) + + assert_that(response.status_code, equal_to(200)) + assert_that(response.data, instance_of(ListEndpointsResponse)) + assert_that(response.data.links, instance_of(list)) + assert_that(response.data.data, instance_of(list)) + assert_that(response.data.errors, instance_of(list)) + if response.data.page: + assert_that(response.data.page, instance_of(object)) + + def test_list_endpoints_with_pagination(self) -> None: + """Test case for list_endpoints with pagination + + List Endpoints with Pagination + """ + response = self.endpoints_api_instance.list_endpoints_with_http_info( + BW_ACCOUNT_ID, + after_cursor="cursor-abc123", + limit=50 + ) + + assert_that(response.status_code, equal_to(200)) + assert_that(response.data, instance_of(ListEndpointsResponse)) + assert_that(response.data.links, instance_of(list)) + assert_that(response.data.data, instance_of(list)) + assert_that(response.data.errors, instance_of(list)) + + # TODO: Endpoint BXML not ready yet - commented out + # def test_update_endpoint_bxml(self) -> None: + # """Test case for update_endpoint_bxml + # + # Update Endpoint BXML + # """ + # update_bxml = 'This is a test bxml response for endpoint' + # + # response = self.endpoints_api_instance.update_endpoint_bxml_with_http_info( + # BW_ACCOUNT_ID, + # "ep-abc123", + # update_bxml + # ) + # + # assert_that(response.status_code, equal_to(204)) + + def test_create_endpoint_minimal(self) -> None: + """Test case for create_endpoint with minimal required fields + + Create Endpoint with Minimal Fields + """ + endpoint_body = CreateWebRtcConnectionRequest( + type=EndpointTypeEnum.WEBRTC, + direction=EndpointDirectionEnum.OUTBOUND + ) + response = self.endpoints_api_instance.create_endpoint_with_http_info( + BW_ACCOUNT_ID, + endpoint_body + ) + + assert_that(response.status_code, equal_to(201)) + assert_that(response.data, instance_of(CreateEndpointResponse)) + + def test_create_endpoint_sip(self) -> None: + """Test case for create_endpoint with SIP type + + Create SIP Endpoint + """ + endpoint_body = CreateWebRtcConnectionRequest( + type=EndpointTypeEnum.WEBRTC, + direction=EndpointDirectionEnum.BIDIRECTIONAL, + event_callback_url="https://myServer.com/bandwidth/webhooks/sip-endpoint", + tag="sip-test-endpoint" + ) + response = self.endpoints_api_instance.create_endpoint_with_http_info( + BW_ACCOUNT_ID, + endpoint_body + ) + + assert_that(response.status_code, equal_to(201)) + assert_that(response.data, instance_of(CreateEndpointResponse)) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_create_endpoint_request_base.py b/test/unit/models/test_create_endpoint_request_base.py new file mode 100644 index 00000000..cbd1c86f --- /dev/null +++ b/test/unit/models/test_create_endpoint_request_base.py @@ -0,0 +1,70 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from bandwidth.models.create_endpoint_request_base import CreateEndpointRequestBase +from bandwidth.models.endpoint_direction_enum import EndpointDirectionEnum +from bandwidth.models.endpoint_type_enum import EndpointTypeEnum + +class TestCreateEndpointRequestBase(unittest.TestCase): + """CreateEndpointRequestBase unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> CreateEndpointRequestBase: + """Test CreateEndpointRequestBase + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + if include_optional: + return CreateEndpointRequestBase( + type=EndpointTypeEnum.WEBRTC, + direction=EndpointDirectionEnum.BIDIRECTIONAL, + event_callback_url='https://example.com/callback', + event_fallback_url='https://example.com/fallback', + tag='test-request' + ) + else: + return CreateEndpointRequestBase( + type=EndpointTypeEnum.WEBRTC, + direction=EndpointDirectionEnum.BIDIRECTIONAL + ) + + def testCreateEndpointRequestBase(self): + """Test CreateEndpointRequestBase""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, CreateEndpointRequestBase) + assert instance.type == EndpointTypeEnum.WEBRTC + assert instance.direction == EndpointDirectionEnum.BIDIRECTIONAL + assert instance.event_callback_url == 'https://example.com/callback' + assert instance.event_fallback_url == 'https://example.com/fallback' + assert instance.tag == 'test-request' + + def testCreateEndpointRequestBaseRequiredOnly(self): + """Test CreateEndpointRequestBase with required fields only""" + instance = self.make_instance(False) + assert instance is not None + assert isinstance(instance, CreateEndpointRequestBase) + assert instance.type == EndpointTypeEnum.WEBRTC + assert instance.direction == EndpointDirectionEnum.BIDIRECTIONAL + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_create_endpoint_response.py b/test/unit/models/test_create_endpoint_response.py new file mode 100644 index 00000000..25f7feca --- /dev/null +++ b/test/unit/models/test_create_endpoint_response.py @@ -0,0 +1,69 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +from datetime import datetime + +from bandwidth.models.create_endpoint_response import CreateEndpointResponse +from bandwidth.models.create_endpoint_response_object import CreateEndpointResponseObject +from bandwidth.models.link import Link +from bandwidth.models.error import Error +from bandwidth.models.endpoint_status_enum import EndpointStatusEnum +from bandwidth.models.endpoint_type_enum import EndpointTypeEnum + +class TestCreateEndpointResponse(unittest.TestCase): + """CreateEndpointResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> CreateEndpointResponse: + """Test CreateEndpointResponse + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + return CreateEndpointResponse( + links=[ + Link(href='https://api.bandwidth.com/endpoint-123', rel='self') + ], + data=CreateEndpointResponseObject( + endpoint_id='endpoint-123', + type=EndpointTypeEnum.WEBRTC, + status=EndpointStatusEnum.CONNECTED, + creation_timestamp=datetime(2026, 1, 15, 10, 0, 0), + expiration_timestamp=datetime(2026, 1, 16, 10, 0, 0), + token='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.test.token' + ), + errors=[] + ) + + def testCreateEndpointResponse(self): + """Test CreateEndpointResponse""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, CreateEndpointResponse) + assert isinstance(instance.links, list) + assert len(instance.links) == 1 + assert isinstance(instance.links[0], Link) + assert isinstance(instance.data, CreateEndpointResponseObject) + assert instance.data.endpoint_id == 'endpoint-123' + assert instance.data.token == 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.test.token' + assert isinstance(instance.errors, list) + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_create_endpoint_response_object.py b/test/unit/models/test_create_endpoint_response_object.py new file mode 100644 index 00000000..674dfe41 --- /dev/null +++ b/test/unit/models/test_create_endpoint_response_object.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +from datetime import datetime + +from bandwidth.models.create_endpoint_response_object import CreateEndpointResponseObject +from bandwidth.models.device import Device +from bandwidth.models.endpoint_status_enum import EndpointStatusEnum +from bandwidth.models.endpoint_type_enum import EndpointTypeEnum +from bandwidth.models.device_status_enum import DeviceStatusEnum + +class TestCreateEndpointResponseObject(unittest.TestCase): + """CreateEndpointResponseObject unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> CreateEndpointResponseObject: + """Test CreateEndpointResponseObject + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + if include_optional: + return CreateEndpointResponseObject( + endpoint_id='endpoint-456', + type=EndpointTypeEnum.WEBRTC, + status=EndpointStatusEnum.CONNECTED, + creation_timestamp=datetime(2026, 1, 15, 10, 0, 0), + expiration_timestamp=datetime(2026, 1, 16, 10, 0, 0), + tag='response-endpoint', + devices=[ + Device( + device_id='device-789', + device_name='Response Device', + status=DeviceStatusEnum.CONNECTED, + creation_timestamp=datetime(2026, 1, 15, 10, 0, 0) + ) + ], + token='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.response.token' + ) + else: + return CreateEndpointResponseObject( + endpoint_id='endpoint-456', + type=EndpointTypeEnum.WEBRTC, + status=EndpointStatusEnum.CONNECTED, + creation_timestamp=datetime(2026, 1, 15, 10, 0, 0), + expiration_timestamp=datetime(2026, 1, 16, 10, 0, 0), + token='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.response.token' + ) + + def testCreateEndpointResponseObject(self): + """Test CreateEndpointResponseObject""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, CreateEndpointResponseObject) + assert instance.endpoint_id == 'endpoint-456' + assert instance.type == EndpointTypeEnum.WEBRTC + assert instance.status == EndpointStatusEnum.CONNECTED + assert isinstance(instance.creation_timestamp, datetime) + assert isinstance(instance.expiration_timestamp, datetime) + assert instance.tag == 'response-endpoint' + assert isinstance(instance.devices, list) + assert len(instance.devices) == 1 + assert instance.token == 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.response.token' + + def testCreateEndpointResponseObjectRequiredOnly(self): + """Test CreateEndpointResponseObject with required fields only""" + instance = self.make_instance(False) + assert instance is not None + assert isinstance(instance, CreateEndpointResponseObject) + assert instance.endpoint_id == 'endpoint-456' + assert instance.token == 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.response.token' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_device.py b/test/unit/models/test_device.py new file mode 100644 index 00000000..0ae818e3 --- /dev/null +++ b/test/unit/models/test_device.py @@ -0,0 +1,69 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +from datetime import datetime + +from bandwidth.models.device import Device +from bandwidth.models.device_status_enum import DeviceStatusEnum + +class TestDevice(unittest.TestCase): + """Device unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Device: + """Test Device + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + if include_optional: + return Device( + device_id='device-abc-123', + device_name='My Test Device', + status=DeviceStatusEnum.CONNECTED, + creation_timestamp=datetime(2026, 1, 15, 10, 0, 0) + ) + else: + return Device( + device_id='device-abc-123', + status=DeviceStatusEnum.CONNECTED, + creation_timestamp=datetime(2026, 1, 15, 10, 0, 0) + ) + + def testDevice(self): + """Test Device""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, Device) + assert instance.device_id == 'device-abc-123' + assert instance.device_name == 'My Test Device' + assert instance.status == DeviceStatusEnum.CONNECTED + assert isinstance(instance.creation_timestamp, datetime) + + def testDeviceRequiredOnly(self): + """Test Device with required fields only""" + instance = self.make_instance(False) + assert instance is not None + assert isinstance(instance, Device) + assert instance.device_id == 'device-abc-123' + assert instance.status == DeviceStatusEnum.CONNECTED + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_device_status_enum.py b/test/unit/models/test_device_status_enum.py new file mode 100644 index 00000000..7e35b479 --- /dev/null +++ b/test/unit/models/test_device_status_enum.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from bandwidth.models.device_status_enum import DeviceStatusEnum + +class TestDeviceStatusEnum(unittest.TestCase): + """DeviceStatusEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testDeviceStatusEnum(self): + """Test DeviceStatusEnum""" + # Test that the enum has the expected values + assert DeviceStatusEnum.CONNECTED == 'CONNECTED' + assert DeviceStatusEnum.DISCONNECTED == 'DISCONNECTED' + + # Test enum instantiation + instance_connected = DeviceStatusEnum.CONNECTED + assert instance_connected is not None + assert isinstance(instance_connected, DeviceStatusEnum) + + instance_disconnected = DeviceStatusEnum.DISCONNECTED + assert instance_disconnected is not None + assert isinstance(instance_disconnected, DeviceStatusEnum) + + # Test from_json + json_str_connected = '"CONNECTED"' + instance_from_json = DeviceStatusEnum.from_json(json_str_connected) + assert instance_from_json == DeviceStatusEnum.CONNECTED + + json_str_disconnected = '"DISCONNECTED"' + instance_from_json = DeviceStatusEnum.from_json(json_str_disconnected) + assert instance_from_json == DeviceStatusEnum.DISCONNECTED + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_endpoint.py b/test/unit/models/test_endpoint.py new file mode 100644 index 00000000..c610d6af --- /dev/null +++ b/test/unit/models/test_endpoint.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +from datetime import datetime + +from bandwidth.models.endpoint import Endpoint +from bandwidth.models.device import Device +from bandwidth.models.endpoint_status_enum import EndpointStatusEnum +from bandwidth.models.endpoint_type_enum import EndpointTypeEnum +from bandwidth.models.device_status_enum import DeviceStatusEnum + +class TestEndpoint(unittest.TestCase): + """Endpoint unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Endpoint: + """Test Endpoint + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + if include_optional: + return Endpoint( + endpoint_id='endpoint-123', + type=EndpointTypeEnum.WEBRTC, + status=EndpointStatusEnum.CONNECTED, + creation_timestamp=datetime(2026, 1, 15, 10, 0, 0), + expiration_timestamp=datetime(2026, 1, 16, 10, 0, 0), + tag='test-endpoint', + devices=[ + Device( + device_id='device-456', + device_name='Test Device', + status=DeviceStatusEnum.CONNECTED, + creation_timestamp=datetime(2026, 1, 15, 10, 0, 0) + ) + ] + ) + else: + return Endpoint( + endpoint_id='endpoint-123', + type=EndpointTypeEnum.WEBRTC, + status=EndpointStatusEnum.CONNECTED, + creation_timestamp=datetime(2026, 1, 15, 10, 0, 0), + expiration_timestamp=datetime(2026, 1, 16, 10, 0, 0) + ) + + def testEndpoint(self): + """Test Endpoint""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, Endpoint) + assert instance.endpoint_id == 'endpoint-123' + assert instance.type == EndpointTypeEnum.WEBRTC + assert instance.status == EndpointStatusEnum.CONNECTED + assert isinstance(instance.creation_timestamp, datetime) + assert isinstance(instance.expiration_timestamp, datetime) + assert instance.tag == 'test-endpoint' + assert isinstance(instance.devices, list) + assert len(instance.devices) == 1 + assert isinstance(instance.devices[0], Device) + + def testEndpointRequiredOnly(self): + """Test Endpoint with required fields only""" + instance = self.make_instance(False) + assert instance is not None + assert isinstance(instance, Endpoint) + assert instance.endpoint_id == 'endpoint-123' + assert instance.type == EndpointTypeEnum.WEBRTC + assert instance.status == EndpointStatusEnum.CONNECTED + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_endpoint_direction_enum.py b/test/unit/models/test_endpoint_direction_enum.py new file mode 100644 index 00000000..8d9246d7 --- /dev/null +++ b/test/unit/models/test_endpoint_direction_enum.py @@ -0,0 +1,63 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from bandwidth.models.endpoint_direction_enum import EndpointDirectionEnum + +class TestEndpointDirectionEnum(unittest.TestCase): + """EndpointDirectionEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEndpointDirectionEnum(self): + """Test EndpointDirectionEnum""" + # Test that the enum has the expected values + assert EndpointDirectionEnum.INBOUND == 'INBOUND' + assert EndpointDirectionEnum.OUTBOUND == 'OUTBOUND' + assert EndpointDirectionEnum.BIDIRECTIONAL == 'BIDIRECTIONAL' + + # Test enum instantiation + instance_inbound = EndpointDirectionEnum.INBOUND + assert instance_inbound is not None + assert isinstance(instance_inbound, EndpointDirectionEnum) + + instance_outbound = EndpointDirectionEnum.OUTBOUND + assert instance_outbound is not None + assert isinstance(instance_outbound, EndpointDirectionEnum) + + instance_bidirectional = EndpointDirectionEnum.BIDIRECTIONAL + assert instance_bidirectional is not None + assert isinstance(instance_bidirectional, EndpointDirectionEnum) + + # Test from_json + json_str_inbound = '"INBOUND"' + instance_from_json = EndpointDirectionEnum.from_json(json_str_inbound) + assert instance_from_json == EndpointDirectionEnum.INBOUND + + json_str_outbound = '"OUTBOUND"' + instance_from_json = EndpointDirectionEnum.from_json(json_str_outbound) + assert instance_from_json == EndpointDirectionEnum.OUTBOUND + + json_str_bidirectional = '"BIDIRECTIONAL"' + instance_from_json = EndpointDirectionEnum.from_json(json_str_bidirectional) + assert instance_from_json == EndpointDirectionEnum.BIDIRECTIONAL + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_endpoint_event.py b/test/unit/models/test_endpoint_event.py new file mode 100644 index 00000000..2311fa26 --- /dev/null +++ b/test/unit/models/test_endpoint_event.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +from datetime import datetime + +from bandwidth.models.endpoint_event import EndpointEvent +from bandwidth.models.device import Device +from bandwidth.models.endpoint_status_enum import EndpointStatusEnum +from bandwidth.models.endpoint_type_enum import EndpointTypeEnum +from bandwidth.models.endpoint_event_type_enum import EndpointEventTypeEnum +from bandwidth.models.device_status_enum import DeviceStatusEnum + +class TestEndpointEvent(unittest.TestCase): + """EndpointEvent unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> EndpointEvent: + """Test EndpointEvent + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + if include_optional: + return EndpointEvent( + endpoint_id='endpoint-event-123', + type=EndpointTypeEnum.WEBRTC, + status=EndpointStatusEnum.CONNECTED, + creation_timestamp=datetime(2026, 1, 15, 10, 0, 0), + expiration_timestamp=datetime(2026, 1, 16, 10, 0, 0), + tag='event-endpoint', + event_time=datetime(2026, 1, 15, 11, 30, 0), + event_type=EndpointEventTypeEnum.DEVICE_CONNECTED, + device=Device( + device_id='device-event-456', + device_name='Event Device', + status=DeviceStatusEnum.CONNECTED, + creation_timestamp=datetime(2026, 1, 15, 11, 30, 0) + ) + ) + else: + return EndpointEvent( + endpoint_id='endpoint-event-123', + type=EndpointTypeEnum.WEBRTC, + status=EndpointStatusEnum.CONNECTED, + creation_timestamp=datetime(2026, 1, 15, 10, 0, 0), + expiration_timestamp=datetime(2026, 1, 16, 10, 0, 0), + event_time=datetime(2026, 1, 15, 11, 30, 0), + event_type=EndpointEventTypeEnum.DEVICE_CONNECTED + ) + + def testEndpointEvent(self): + """Test EndpointEvent""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, EndpointEvent) + assert instance.endpoint_id == 'endpoint-event-123' + assert instance.type == EndpointTypeEnum.WEBRTC + assert instance.status == EndpointStatusEnum.CONNECTED + assert isinstance(instance.creation_timestamp, datetime) + assert isinstance(instance.expiration_timestamp, datetime) + assert isinstance(instance.event_time, datetime) + assert instance.event_type == EndpointEventTypeEnum.DEVICE_CONNECTED + assert instance.tag == 'event-endpoint' + assert isinstance(instance.device, Device) + assert instance.device.device_id == 'device-event-456' + + def testEndpointEventRequiredOnly(self): + """Test EndpointEvent with required fields only""" + instance = self.make_instance(False) + assert instance is not None + assert isinstance(instance, EndpointEvent) + assert instance.endpoint_id == 'endpoint-event-123' + assert isinstance(instance.event_time, datetime) + assert instance.event_type == EndpointEventTypeEnum.DEVICE_CONNECTED + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_endpoint_event_type_enum.py b/test/unit/models/test_endpoint_event_type_enum.py new file mode 100644 index 00000000..042f5a22 --- /dev/null +++ b/test/unit/models/test_endpoint_event_type_enum.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from bandwidth.models.endpoint_event_type_enum import EndpointEventTypeEnum + +class TestEndpointEventTypeEnum(unittest.TestCase): + """EndpointEventTypeEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEndpointEventTypeEnum(self): + """Test EndpointEventTypeEnum""" + # Test that the enum has the expected values + assert EndpointEventTypeEnum.DEVICE_CONNECTED == 'DEVICE_CONNECTED' + assert EndpointEventTypeEnum.DEVICE_DISCONNECTED == 'DEVICE_DISCONNECTED' + + # Test enum instantiation + instance_connected = EndpointEventTypeEnum.DEVICE_CONNECTED + assert instance_connected is not None + assert isinstance(instance_connected, EndpointEventTypeEnum) + + instance_disconnected = EndpointEventTypeEnum.DEVICE_DISCONNECTED + assert instance_disconnected is not None + assert isinstance(instance_disconnected, EndpointEventTypeEnum) + + # Test from_json + json_str_connected = '"DEVICE_CONNECTED"' + instance_from_json = EndpointEventTypeEnum.from_json(json_str_connected) + assert instance_from_json == EndpointEventTypeEnum.DEVICE_CONNECTED + + json_str_disconnected = '"DEVICE_DISCONNECTED"' + instance_from_json = EndpointEventTypeEnum.from_json(json_str_disconnected) + assert instance_from_json == EndpointEventTypeEnum.DEVICE_DISCONNECTED + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_endpoint_response.py b/test/unit/models/test_endpoint_response.py new file mode 100644 index 00000000..e6811a3a --- /dev/null +++ b/test/unit/models/test_endpoint_response.py @@ -0,0 +1,67 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +from datetime import datetime + +from bandwidth.models.endpoint_response import EndpointResponse +from bandwidth.models.endpoint import Endpoint +from bandwidth.models.link import Link +from bandwidth.models.error import Error +from bandwidth.models.endpoint_status_enum import EndpointStatusEnum +from bandwidth.models.endpoint_type_enum import EndpointTypeEnum + +class TestEndpointResponse(unittest.TestCase): + """EndpointResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> EndpointResponse: + """Test EndpointResponse + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + return EndpointResponse( + links=[ + Link(href='https://api.bandwidth.com/endpoint-999', rel='self') + ], + data=Endpoint( + endpoint_id='endpoint-999', + type=EndpointTypeEnum.WEBRTC, + status=EndpointStatusEnum.DISCONNECTED, + creation_timestamp=datetime(2026, 1, 15, 10, 0, 0), + expiration_timestamp=datetime(2026, 1, 16, 10, 0, 0) + ), + errors=[] + ) + + def testEndpointResponse(self): + """Test EndpointResponse""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, EndpointResponse) + assert isinstance(instance.links, list) + assert len(instance.links) == 1 + assert isinstance(instance.links[0], Link) + assert isinstance(instance.data, Endpoint) + assert instance.data.endpoint_id == 'endpoint-999' + assert isinstance(instance.errors, list) + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_endpoint_status_enum.py b/test/unit/models/test_endpoint_status_enum.py new file mode 100644 index 00000000..7487c5e6 --- /dev/null +++ b/test/unit/models/test_endpoint_status_enum.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from bandwidth.models.endpoint_status_enum import EndpointStatusEnum + +class TestEndpointStatusEnum(unittest.TestCase): + """EndpointStatusEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEndpointStatusEnum(self): + """Test EndpointStatusEnum""" + # Test that the enum has the expected values + assert EndpointStatusEnum.CONNECTED == 'CONNECTED' + assert EndpointStatusEnum.DISCONNECTED == 'DISCONNECTED' + + # Test enum instantiation + instance_connected = EndpointStatusEnum.CONNECTED + assert instance_connected is not None + assert isinstance(instance_connected, EndpointStatusEnum) + + instance_disconnected = EndpointStatusEnum.DISCONNECTED + assert instance_disconnected is not None + assert isinstance(instance_disconnected, EndpointStatusEnum) + + # Test from_json + json_str_connected = '"CONNECTED"' + instance_from_json = EndpointStatusEnum.from_json(json_str_connected) + assert instance_from_json == EndpointStatusEnum.CONNECTED + + json_str_disconnected = '"DISCONNECTED"' + instance_from_json = EndpointStatusEnum.from_json(json_str_disconnected) + assert instance_from_json == EndpointStatusEnum.DISCONNECTED + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_endpoint_type_enum.py b/test/unit/models/test_endpoint_type_enum.py new file mode 100644 index 00000000..5b3144e7 --- /dev/null +++ b/test/unit/models/test_endpoint_type_enum.py @@ -0,0 +1,45 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from bandwidth.models.endpoint_type_enum import EndpointTypeEnum + +class TestEndpointTypeEnum(unittest.TestCase): + """EndpointTypeEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEndpointTypeEnum(self): + """Test EndpointTypeEnum""" + # Test that the enum has the expected value + assert EndpointTypeEnum.WEBRTC == 'WEBRTC' + + # Test enum instantiation + instance = EndpointTypeEnum.WEBRTC + assert instance is not None + assert isinstance(instance, EndpointTypeEnum) + + # Test from_json + json_str = '"WEBRTC"' + instance_from_json = EndpointTypeEnum.from_json(json_str) + assert instance_from_json == EndpointTypeEnum.WEBRTC + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_endpoints.py b/test/unit/models/test_endpoints.py new file mode 100644 index 00000000..92b6e16e --- /dev/null +++ b/test/unit/models/test_endpoints.py @@ -0,0 +1,75 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +from datetime import datetime + +from bandwidth.models.endpoints import Endpoints +from bandwidth.models.endpoint_status_enum import EndpointStatusEnum +from bandwidth.models.endpoint_type_enum import EndpointTypeEnum + +class TestEndpoints(unittest.TestCase): + """Endpoints unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Endpoints: + """Test Endpoints + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + if include_optional: + return Endpoints( + endpoint_id='endpoint-789', + type=EndpointTypeEnum.WEBRTC, + status=EndpointStatusEnum.DISCONNECTED, + creation_timestamp=datetime(2026, 1, 15, 10, 0, 0), + expiration_timestamp=datetime(2026, 1, 16, 10, 0, 0), + tag='list-endpoint' + ) + else: + return Endpoints( + endpoint_id='endpoint-789', + type=EndpointTypeEnum.WEBRTC, + status=EndpointStatusEnum.DISCONNECTED, + creation_timestamp=datetime(2026, 1, 15, 10, 0, 0), + expiration_timestamp=datetime(2026, 1, 16, 10, 0, 0) + ) + + def testEndpoints(self): + """Test Endpoints""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, Endpoints) + assert instance.endpoint_id == 'endpoint-789' + assert instance.type == EndpointTypeEnum.WEBRTC + assert instance.status == EndpointStatusEnum.DISCONNECTED + assert isinstance(instance.creation_timestamp, datetime) + assert isinstance(instance.expiration_timestamp, datetime) + assert instance.tag == 'list-endpoint' + + def testEndpointsRequiredOnly(self): + """Test Endpoints with required fields only""" + instance = self.make_instance(False) + assert instance is not None + assert isinstance(instance, Endpoints) + assert instance.endpoint_id == 'endpoint-789' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_list_endpoints_response.py b/test/unit/models/test_list_endpoints_response.py new file mode 100644 index 00000000..b1f38aff --- /dev/null +++ b/test/unit/models/test_list_endpoints_response.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +from datetime import datetime + +from bandwidth.models.list_endpoints_response import ListEndpointsResponse +from bandwidth.models.endpoints import Endpoints +from bandwidth.models.link import Link +from bandwidth.models.error import Error +from bandwidth.models.page import Page +from bandwidth.models.endpoint_status_enum import EndpointStatusEnum +from bandwidth.models.endpoint_type_enum import EndpointTypeEnum + +class TestListEndpointsResponse(unittest.TestCase): + """ListEndpointsResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ListEndpointsResponse: + """Test ListEndpointsResponse + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + if include_optional: + return ListEndpointsResponse( + links=[ + Link(href='https://api.bandwidth.com/endpoints', rel='self'), + Link(href='https://api.bandwidth.com/endpoints?page=2', rel='next') + ], + page=Page( + page_size=10, + total_elements=100, + total_pages=10, + page_number=1 + ), + data=[ + Endpoints( + endpoint_id='endpoint-1', + type=EndpointTypeEnum.WEBRTC, + status=EndpointStatusEnum.CONNECTED, + creation_timestamp=datetime(2026, 1, 15, 10, 0, 0), + expiration_timestamp=datetime(2026, 1, 16, 10, 0, 0), + tag='endpoint-1-tag' + ), + Endpoints( + endpoint_id='endpoint-2', + type=EndpointTypeEnum.WEBRTC, + status=EndpointStatusEnum.DISCONNECTED, + creation_timestamp=datetime(2026, 1, 15, 9, 0, 0), + expiration_timestamp=datetime(2026, 1, 16, 9, 0, 0) + ) + ], + errors=[] + ) + else: + return ListEndpointsResponse( + links=[ + Link(href='https://api.bandwidth.com/endpoints', rel='self') + ], + data=[ + Endpoints( + endpoint_id='endpoint-1', + type=EndpointTypeEnum.WEBRTC, + status=EndpointStatusEnum.CONNECTED, + creation_timestamp=datetime(2026, 1, 15, 10, 0, 0), + expiration_timestamp=datetime(2026, 1, 16, 10, 0, 0) + ) + ], + errors=[] + ) + + def testListEndpointsResponse(self): + """Test ListEndpointsResponse""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, ListEndpointsResponse) + assert isinstance(instance.links, list) + assert len(instance.links) == 2 + assert isinstance(instance.page, Page) + assert instance.page.total_elements == 100 + assert instance.page.page_size == 10 + assert isinstance(instance.data, list) + assert len(instance.data) == 2 + assert isinstance(instance.data[0], Endpoints) + assert instance.data[0].endpoint_id == 'endpoint-1' + assert instance.data[1].endpoint_id == 'endpoint-2' + assert isinstance(instance.errors, list) + + def testListEndpointsResponseRequiredOnly(self): + """Test ListEndpointsResponse with required fields only""" + instance = self.make_instance(False) + assert instance is not None + assert isinstance(instance, ListEndpointsResponse) + assert len(instance.data) == 1 + +if __name__ == '__main__': + unittest.main()