diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml index a9bba712..5062fed4 100644 --- a/.github/workflows/test-pr.yml +++ b/.github/workflows/test-pr.yml @@ -35,7 +35,7 @@ jobs: strategy: matrix: os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-latest] - python-version: [3.8, 3.9, "3.10", "3.11", "3.12"] + python-version: [3.9, '3.10', '3.11', '3.12', '3.13'] fail-fast: false env: PYTHON_VERSION: ${{ matrix.python-version }} diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index a641d920..2d4e02e6 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -31,6 +31,7 @@ bandwidth/models/call_transcription_metadata.py bandwidth/models/call_transcription_response.py bandwidth/models/call_transcription_track_enum.py bandwidth/models/callback_method_enum.py +bandwidth/models/callback_type_enum.py bandwidth/models/code_request.py bandwidth/models/conference.py bandwidth/models/conference_completed_callback.py @@ -53,8 +54,6 @@ bandwidth/models/dtmf_callback.py bandwidth/models/field_error.py bandwidth/models/file_format_enum.py bandwidth/models/gather_callback.py -bandwidth/models/inbound_message_callback.py -bandwidth/models/inbound_message_callback_message.py bandwidth/models/initiate_callback.py bandwidth/models/list_message_direction_enum.py bandwidth/models/list_message_item.py @@ -68,14 +67,10 @@ bandwidth/models/machine_detection_mode_enum.py bandwidth/models/machine_detection_result.py bandwidth/models/media.py bandwidth/models/message.py -bandwidth/models/message_delivered_callback.py -bandwidth/models/message_delivered_callback_message.py +bandwidth/models/message_callback.py +bandwidth/models/message_callback_message.py bandwidth/models/message_direction_enum.py -bandwidth/models/message_failed_callback.py -bandwidth/models/message_failed_callback_message.py bandwidth/models/message_request.py -bandwidth/models/message_sending_callback.py -bandwidth/models/message_sending_callback_message.py bandwidth/models/message_status_enum.py bandwidth/models/message_type_enum.py bandwidth/models/messages_list.py @@ -126,6 +121,7 @@ docs/CallTranscriptionMetadata.md docs/CallTranscriptionResponse.md docs/CallTranscriptionTrackEnum.md docs/CallbackMethodEnum.md +docs/CallbackTypeEnum.md docs/CallsApi.md docs/CodeRequest.md docs/Conference.md @@ -150,8 +146,6 @@ docs/DtmfCallback.md docs/FieldError.md docs/FileFormatEnum.md docs/GatherCallback.md -docs/InboundMessageCallback.md -docs/InboundMessageCallbackMessage.md docs/InitiateCallback.md docs/ListMessageDirectionEnum.md docs/ListMessageItem.md @@ -167,14 +161,10 @@ docs/MachineDetectionResult.md docs/Media.md docs/MediaApi.md docs/Message.md -docs/MessageDeliveredCallback.md -docs/MessageDeliveredCallbackMessage.md +docs/MessageCallback.md +docs/MessageCallbackMessage.md docs/MessageDirectionEnum.md -docs/MessageFailedCallback.md -docs/MessageFailedCallbackMessage.md docs/MessageRequest.md -docs/MessageSendingCallback.md -docs/MessageSendingCallbackMessage.md docs/MessageStatusEnum.md docs/MessageTypeEnum.md docs/MessagesApi.md diff --git a/README.md b/README.md index 5e1ec4a7..e51dac5c 100644 --- a/README.md +++ b/README.md @@ -154,6 +154,7 @@ Class | Method | HTTP request | Description - [CallTranscriptionResponse](docs/CallTranscriptionResponse.md) - [CallTranscriptionTrackEnum](docs/CallTranscriptionTrackEnum.md) - [CallbackMethodEnum](docs/CallbackMethodEnum.md) + - [CallbackTypeEnum](docs/CallbackTypeEnum.md) - [CodeRequest](docs/CodeRequest.md) - [Conference](docs/Conference.md) - [ConferenceCompletedCallback](docs/ConferenceCompletedCallback.md) @@ -176,8 +177,6 @@ Class | Method | HTTP request | Description - [FieldError](docs/FieldError.md) - [FileFormatEnum](docs/FileFormatEnum.md) - [GatherCallback](docs/GatherCallback.md) - - [InboundMessageCallback](docs/InboundMessageCallback.md) - - [InboundMessageCallbackMessage](docs/InboundMessageCallbackMessage.md) - [InitiateCallback](docs/InitiateCallback.md) - [ListMessageDirectionEnum](docs/ListMessageDirectionEnum.md) - [ListMessageItem](docs/ListMessageItem.md) @@ -191,14 +190,10 @@ Class | Method | HTTP request | Description - [MachineDetectionResult](docs/MachineDetectionResult.md) - [Media](docs/Media.md) - [Message](docs/Message.md) - - [MessageDeliveredCallback](docs/MessageDeliveredCallback.md) - - [MessageDeliveredCallbackMessage](docs/MessageDeliveredCallbackMessage.md) + - [MessageCallback](docs/MessageCallback.md) + - [MessageCallbackMessage](docs/MessageCallbackMessage.md) - [MessageDirectionEnum](docs/MessageDirectionEnum.md) - - [MessageFailedCallback](docs/MessageFailedCallback.md) - - [MessageFailedCallbackMessage](docs/MessageFailedCallbackMessage.md) - [MessageRequest](docs/MessageRequest.md) - - [MessageSendingCallback](docs/MessageSendingCallback.md) - - [MessageSendingCallbackMessage](docs/MessageSendingCallbackMessage.md) - [MessageStatusEnum](docs/MessageStatusEnum.md) - [MessageTypeEnum](docs/MessageTypeEnum.md) - [MessagesList](docs/MessagesList.md) diff --git a/bandwidth.yml b/bandwidth.yml index 11c79d23..87921dfa 100644 --- a/bandwidth.yml +++ b/bandwidth.yml @@ -230,8 +230,6 @@ paths: '500': $ref: '#/components/responses/messagingInternalServerError' callbacks: - inboundCallback: - $ref: '#/components/callbacks/inboundCallback' statusCallback: $ref: '#/components/callbacks/statusCallback' servers: *ref_0 @@ -1332,6 +1330,21 @@ paths: servers: *ref_3 components: schemas: + callbackTypeEnum: + type: string + enum: + - message-received + - message-sending + - message-delivered + - message-failed + description: > + Indicates the type of the callback: + + - `message-received` for inbound callbacks. + + - One of `message-sending`, `message-delivered`, `message-failed` for + status callbacks. + example: message-delivered priorityEnum: type: string description: |- @@ -1574,7 +1587,7 @@ components: type: string format: date-time description: The datetime stamp of the message in ISO 8601 - example: 2022-09-14T18:20:16.000Z + example: 2024-12-02T20:15:57.278Z segmentCount: type: integer description: >- @@ -1695,288 +1708,38 @@ components: Not supported on MMS. example: '2021-02-01T11:29:18-05:00' - inboundMessageCallback: - description: Inbound Message Callback - type: object - properties: - time: - type: string - format: date-time - example: 2016-09-14T18:20:16.000Z - type: - type: string - example: message-received - to: - type: string - example: '+15552223333' - description: - type: string - example: Incoming message received - message: - $ref: '#/components/schemas/inboundMessageCallbackMessage' - required: - - time - - type - - to - - description - - message - inboundMessageCallbackMessage: - description: Inbound Message Callback Message Schema - type: object - properties: - id: - type: string - example: 1661365814859loidf7mcwd4qacn7 - owner: - type: string - example: '+15553332222' - applicationId: - type: string - example: 93de2206-9669-4e07-948d-329f4b722ee2 - time: - type: string - format: date-time - example: 2016-09-14T18:20:16.000Z - segmentCount: - type: integer - example: 1 - direction: - $ref: '#/components/schemas/messageDirectionEnum' - to: - uniqueItems: true - type: array - items: - type: string - example: - - '+15552223333' - from: - type: string - example: '+15553332222' - text: - type: string - example: Hello world - tag: - type: string - example: custom string - media: - type: array - items: - type: string - format: uri - example: - - https://dev.bandwidth.com/images/bandwidth-logo.png - - https://dev.bandwidth.com/images/github_logo.png - priority: - $ref: '#/components/schemas/priorityEnum' - required: - - id - - owner - - applicationId - - time - - segmentCount - - direction - - to - - from - - text - messageSendingCallback: - type: object - description: Message Sending Callback - properties: - time: - type: string - format: date-time - example: 2016-09-14T18:20:16.000Z - type: - type: string - example: message-sending - to: - type: string - example: '+15552223333' - description: - type: string - example: Message is sending to carrier - message: - $ref: '#/components/schemas/messageSendingCallbackMessage' - required: - - time - - type - - to - - description - - message - messageSendingCallbackMessage: - description: Message Sending Callback Message Schema - type: object - properties: - id: - type: string - example: 1661365814859loidf7mcwd4qacn7 - owner: - type: string - example: '+15553332222' - applicationId: - type: string - example: 93de2206-9669-4e07-948d-329f4b722ee2 - time: - type: string - format: date-time - example: 2016-09-14T18:20:16.000Z - segmentCount: - type: integer - example: 1 - direction: - $ref: '#/components/schemas/messageDirectionEnum' - to: - uniqueItems: true - type: array - items: - type: string - example: - - '+15552223333' - from: - type: string - example: '+15553332222' - text: - type: string - example: Hello world - tag: - type: string - example: custom string - media: - type: array - items: - type: string - format: uri - example: - - https://dev.bandwidth.com/images/bandwidth-logo.png - - https://dev.bandwidth.com/images/github_logo.png - priority: - $ref: '#/components/schemas/priorityEnum' - required: - - id - - owner - - applicationId - - time - - segmentCount - - direction - - to - - from - - text - - media - messageDeliveredCallback: - description: Message Delivered Callback - type: object - properties: - time: - type: string - format: date-time - example: 2016-09-14T18:20:16.000Z - type: - type: string - example: message-delivered - to: - type: string - example: '+15552223333' - description: - type: string - example: Message delivered to carrier. - message: - $ref: '#/components/schemas/messageDeliveredCallbackMessage' - required: - - time - - type - - to - - description - - message - messageDeliveredCallbackMessage: - description: Message Delivered Callback Message Schema - type: object - properties: - id: - type: string - example: 1661365814859loidf7mcwd4qacn7 - owner: - type: string - example: '+15553332222' - applicationId: - type: string - example: 93de2206-9669-4e07-948d-329f4b722ee2 - time: - type: string - format: date-time - example: 2016-09-14T18:20:16.000Z - segmentCount: - type: integer - example: 1 - direction: - $ref: '#/components/schemas/messageDirectionEnum' - to: - uniqueItems: true - type: array - items: - type: string - example: - - '+15552223333' - from: - type: string - example: '+15553332222' - text: - type: string - example: Hello world - tag: - type: string - example: custom string - media: - type: array - items: - type: string - format: uri - example: - - https://dev.bandwidth.com/images/bandwidth-logo.png - - https://dev.bandwidth.com/images/github_logo.png - priority: - $ref: '#/components/schemas/priorityEnum' - required: - - id - - owner - - applicationId - - time - - segmentCount - - direction - - to - - from - - text - - tag - messageFailedCallback: - description: Message Failed Callback + messageCallback: + description: Message Callback Schema type: object properties: time: type: string format: date-time - example: 2016-09-14T18:20:16.000Z + example: 2024-12-02T20:15:57.278Z type: - type: string - example: message-failed + $ref: '#/components/schemas/callbackTypeEnum' to: type: string example: '+15552223333' description: type: string + description: A detailed description of the event described by the callback. example: rejected-unallocated-from-number message: - $ref: '#/components/schemas/messageFailedCallbackMessage' + $ref: '#/components/schemas/messageCallbackMessage' errorCode: type: integer - example: 9902 + description: Optional error code, applicable only when type is `message-failed`. + nullable: true + example: 4405 required: - time - type - to - description - message - - errorCode - messageFailedCallbackMessage: - description: Message Failed Callback Message Schema + messageCallbackMessage: + description: Message payload schema within a MessageCallback type: object properties: id: @@ -1991,7 +1754,7 @@ components: time: type: string format: date-time - example: 2016-09-14T18:20:16.000Z + example: 2024-12-02T20:15:57.666Z segmentCount: type: integer example: 1 @@ -2015,6 +1778,8 @@ components: example: custom string media: type: array + description: Optional media, applicable only for mms + nullable: true items: type: string format: uri @@ -2033,7 +1798,6 @@ components: - to - from - text - - tag callbackMethodEnum: type: string nullable: true @@ -5463,34 +5227,345 @@ components: type: string description: The phone number lookup request ID from Bandwidth. example: 004223a0-8b17-41b1-bf81-20732adf5590 - requestBodies: - createMessageRequest: - content: - application/json: - schema: - $ref: '#/components/schemas/messageRequest' - required: true - uploadMediaRequest: - content: - application/json: - schema: - type: string - format: binary - application/ogg: - schema: - type: string - format: binary - application/pdf: - schema: - type: string - format: binary - application/rtf: - schema: - type: string - format: binary - application/zip: - schema: - type: string + examples: + smsMessageReceivedCallbackExample: + summary: An example of a sms message-received callback body. + value: + time: '2025-01-06T15:43:35.502180Z' + type: message-received + to: '+12345678902' + description: Incoming message received + message: + id: 14762070468292kw2fuqty55yp2b2 + owner: '+12345678902' + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + time: '2025-01-06T15:43:34.000000Z' + segmentCount: 1 + direction: in + to: + - '+12345678902' + from: '+12345678901' + text: Hey, check out this SMS! + mmsMessageReceivedCallbackExample: + summary: An example of a mms message-received callback body. + value: + time: '2024-09-14T18:20:45.160744Z' + type: message-received + to: '+12345678902' + description: Incoming message received + message: + id: 14762070468292kw2fuqty55yp2b2 + owner: '+12345678902' + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + time: '2024-09-14T18:20:45.160744Z' + segmentCount: 1 + direction: in + to: + - '+12345678902' + - '+12345678903' + from: '+12345678901' + text: Hey, check out the MMS! + media: + - >- + https://messaging.bandwidth.com/api/v2/users/9900902/media/14762070468292kw2fuqty55yp2b2/0/bw.png + messageSendingCallbackExample: + summary: An example of a message-sending callback body. + value: + time: '2024-06-25T18:42:36.979456Z' + type: message-sending + to: '+15554443333' + description: Message is sending to carrier. + message: + id: 1593110555875xo7watq5px6rbe5d + owner: '+15552221111' + applicationId: cfd4fb83-7531-4acc-b471-42d0bb76a65c + time: '2024-06-25T18:42:35.876906Z' + segmentCount: 1 + direction: out + to: + - '+15554443333' + from: '+15552221111' + text: '' + media: + - https://dev.bandwidth.com/images/bandwidth-logo.png + tag: your tag here + smsMessageDeliveredCallbackExample: + summary: An example of a sms message-delivered callback body. + value: + type: message-delivered + time: '2024-09-14T18:20:11.160744Z' + description: Message delivered to carrier. + to: '+12345678902' + message: + id: 14762070468292kw2fuqty55yp2b2 + time: '2024-09-14T18:20:11.160744Z' + to: + - '+12345678902' + from: '+12345678901' + text: '' + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + owner: '+12345678902' + direction: out + segmentCount: 1 + mmsMessageDeliveredCallbackExample: + summary: An example of a mms message-delivered callback body. + value: + type: message-delivered + time: '2024-09-14T18:20:24.160544Z' + description: Message delivered to carrier. + to: '+12345678902' + message: + id: 14762070468292kw2fuqty55yp2b2 + time: '2024-09-14T18:20:24.160544Z' + to: + - '+12345678902' + from: '+12345678901' + text: '' + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + owner: '+12345678902' + direction: out + segmentCount: 1 + media: + - https://dev.bandwidth.com/images/bandwidth-logo.png + groupMmsMessageDeliveredCallbackExample: + summary: An example of a group mms message-delivered callback body. + value: + type: message-delivered + time: '2024-09-14T18:20:17.160544Z' + description: Message delivered to carrier. + to: '+12345678902' + message: + id: 14762070468292kw2fuqty55yp2b2 + time: '2024-09-14T18:20:17.160544Z' + to: + - '+12345678902' + - '+12345678903' + from: '+12345678901' + text: '' + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + owner: '+12345678902' + direction: out + segmentCount: 1 + messageFailedCallbackExample: + summary: An example of a message-failed callback body. + value: + type: message-failed + time: '2024-12-18T16:51:27.704450Z' + description: forbidden to country + to: '+52345678903' + errorCode: 4432 + message: + id: 14762070468292kw2fuqty55yp2b2 + time: '2024-12-18T16:51:27.704450Z' + to: + - '+12345678902' + - '+52345678903' + from: '+12345678901' + text: '' + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + media: + - https://dev.bandwidth.com/images/bandwidth-logo.png + owner: '+12345678901' + direction: out + segmentCount: 1 + createCallResponseExample: + summary: Example of a createCall Response + value: + applicationId: 04e88489-df02-4e34-a0ee-27a91849555f + accountId: '9900000' + callId: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + to: '+19195551234' + from: '+19195554312' + enqueuedTime: '2022-06-16T13:15:07.160Z' + callUrl: >- + https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + callTimeout: 30 + callbackTimeout: 15 + tag: My custom tag value + answerMethod: POST + answerUrl: https://myServer.example/bandwidth/webhooks/answer + answerFallbackMethod: POST + answerFallbackUrl: https://myServer.example/bandwidth/webhooks/answerFallback + disconnectMethod: POST + disconnectUrl: https://myServer.example/bandwidth/webhooks/disconnect + username: mySecretUsername + password: '*****' + fallbackUsername: mySecretUsername + fallbackPassword: '*****' + priority: 5 + listConferencesResponseExample: + summary: Example of a listConferences Response + value: + - id: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + name: my-conference-name + createdTime: '2022-06-17T22:19:40.375Z' + completedTime: '2022-06-17T22:20:00.000Z' + conferenceEventUrl: https://myServer.example/bandwidth/webhooks/conferenceEvent + conferenceEventMethod: POST + tag: my custom tag + voiceBadRequestErrorExample: + summary: Example of a Bad Request (400) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceUnauthorizedErrorExample: + summary: Example of an Unauthorized (401) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceForbiddenErrorExample: + summary: Example of a Forbidden (403) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceNotFoundErrorExample: + summary: Example of a Not Found (404) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceNotAllowedErrorExample: + summary: Example of a Not Allowed (405) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceConflictErrorExample: + summary: Example of a Conflict (409) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceUnsupportedMediaTypeErrorExample: + summary: Example of an Unsupported Media Type (415) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceTooManyRequestsErrorExample: + summary: Example of a Too Many Requests (429) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceInternalServerErrorExample: + summary: Example of an Internal Server (500) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + singleNumberRequestExample: + summary: Example Number Lookup Request for One Number + value: + tns: + - '+19195551234' + multipleNumberRequestExample: + summary: Example Number Lookup Request for Multiple Numbers + value: + tns: + - '+19195551234' + - '+19195554321' + lookupInProgressExample: + summary: Example Lookup In Progress Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: IN_PROGRESS + lookupFailedExample: + summary: Example Lookup Failed Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: FAILED + failedTelephoneNumbers: + - '+191955512345' + lookupSingleNumberCompleteExample: + summary: Example Single Number Lookup Complete Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: COMPLETE + result: + - Response Code: 0 + Message: NOERROR + E.164 Format: '+19195551234' + Formatted: (919) 555-1234 + Country: US + Line Type: Mobile + Line Provider: Verizon Wireless + Mobile Country Code: '310' + Mobile Network Code: '010' + lookupMultipleNumbersCompleteExample: + summary: Example Multiple Numbers Lookup Complete Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: COMPLETE + result: + - Response Code: 0 + Message: NOERROR + E.164 Format: '+19195551234' + Formatted: (919) 555-1234 + Country: US + Line Type: Mobile + Line Provider: Verizon Wireless + Mobile Country Code: '310' + Mobile Network Code: '010' + - Response Code: 0 + Message: NOERROR + E.164 Format: '+19195554321' + Formatted: (919) 555-4321 + Country: US + Line Type: Mobile + Line Provider: T-Mobile USA + Mobile Country Code: '310' + Mobile Network Code: '160' + lookupMultipleNumbersPartialCompleteExample: + summary: Example Multiple Numbers Lookup Partial Complete Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: PARTIAL_COMPLETE + result: + - Response Code: 0 + Message: NOERROR + E.164 Format: '+19195551234' + Formatted: (919) 555-1234 + Country: US + Line Type: Mobile + Line Provider: Verizon Wireless + Mobile Country Code: '310' + Mobile Network Code: '010' + failedTelephoneNumbers: + - '+191955512345' + lookupSingleNumberCompleteNoInfoExample: + summary: Example Single Number Lookup Complete with No Information Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: COMPLETE + result: + - Response Code: 3 + Message: NXDOMAIN + E.164 Format: '+19195550000' + Formatted: (919) 555-0000 + Country: US + requestBodies: + createMessageRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/messageRequest' + required: true + uploadMediaRequest: + content: + application/json: + schema: + type: string + format: binary + application/ogg: + schema: + type: string + format: binary + application/pdf: + schema: + type: string + format: binary + application/rtf: + schema: + type: string + format: binary + application/zip: + schema: + type: string format: binary application/x-tar: schema: @@ -5560,6 +5635,14 @@ components: schema: type: string format: binary + image/heic: + schema: + type: string + format: binary + image/heif: + schema: + type: string + format: binary image/jpeg: schema: type: string @@ -5600,6 +5683,10 @@ components: schema: type: string format: binary + text/html: + schema: + type: string + format: binary text/plain: schema: type: string @@ -5648,6 +5735,10 @@ components: schema: type: string format: binary + video/x-flv: + schema: + type: string + format: binary required: true createCallRequest: description: JSON object containing information to create an outbound call @@ -5770,11 +5861,22 @@ components: post: requestBody: required: true - description: Inbound Message Callback Payload + description: > +
This Inbound Message Webhook is an envelope containing a + received (MO) message to your message-enabled Bandwidth telephone + number. The payload type will always indicate "message-received". + +
Please visit Webhooks
content: application/json: schema: - $ref: '#/components/schemas/inboundMessageCallback' + $ref: '#/components/schemas/messageCallback' + examples: + smsMessageReceivedCallback: + $ref: '#/components/examples/smsMessageReceivedCallbackExample' + mmsMessageReceivedCallback: + $ref: '#/components/examples/mmsMessageReceivedCallbackExample' responses: '200': description: OK @@ -5783,186 +5885,31 @@ components: post: requestBody: required: true - description: Status Callback Payload + description: > +This Outbound Message Webhook is an envelope containing status + information regarding a message sent (MT) from your + message-enabled Bandwidth telephone number. The payload type will + be one of "message-sending", "message-delivered", or + "message-failed". + +
Please visit Webhooks
content: application/json: schema: - type: object - oneOf: - - $ref: '#/components/schemas/messageSendingCallback' - - $ref: '#/components/schemas/messageDeliveredCallback' - - $ref: '#/components/schemas/messageFailedCallback' + $ref: '#/components/schemas/messageCallback' + examples: + messageSendingCallback: + $ref: '#/components/examples/messageSendingCallbackExample' + smsMessageDeliveredCallback: + $ref: '#/components/examples/smsMessageDeliveredCallbackExample' + mmsMessageDeliveredCallback: + $ref: '#/components/examples/mmsMessageDeliveredCallbackExample' + groupMmsMessageDeliveredCallback: + $ref: >- + #/components/examples/groupMmsMessageDeliveredCallbackExample + messageFailedCallback: + $ref: '#/components/examples/messageFailedCallbackExample' responses: '200': description: OK - examples: - createCallResponseExample: - summary: Example of a createCall Response - value: - applicationId: 04e88489-df02-4e34-a0ee-27a91849555f - accountId: '9900000' - callId: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 - to: '+19195551234' - from: '+19195554312' - enqueuedTime: '2022-06-16T13:15:07.160Z' - callUrl: >- - https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 - callTimeout: 30 - callbackTimeout: 15 - tag: My custom tag value - answerMethod: POST - answerUrl: https://myServer.example/bandwidth/webhooks/answer - answerFallbackMethod: POST - answerFallbackUrl: https://myServer.example/bandwidth/webhooks/answerFallback - disconnectMethod: POST - disconnectUrl: https://myServer.example/bandwidth/webhooks/disconnect - username: mySecretUsername - password: '*****' - fallbackUsername: mySecretUsername - fallbackPassword: '*****' - priority: 5 - listConferencesResponseExample: - summary: Example of a listConferences Response - value: - - id: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 - name: my-conference-name - createdTime: '2022-06-17T22:19:40.375Z' - completedTime: '2022-06-17T22:20:00.000Z' - conferenceEventUrl: https://myServer.example/bandwidth/webhooks/conferenceEvent - conferenceEventMethod: POST - tag: my custom tag - voiceBadRequestErrorExample: - summary: Example of a Bad Request (400) Error - value: - type: validation - description: 'Invalid answerUrl: only http and https are allowed.' - voiceUnauthorizedErrorExample: - summary: Example of an Unauthorized (401) Error - value: - type: validation - description: 'Invalid answerUrl: only http and https are allowed.' - voiceForbiddenErrorExample: - summary: Example of a Forbidden (403) Error - value: - type: validation - description: 'Invalid answerUrl: only http and https are allowed.' - voiceNotFoundErrorExample: - summary: Example of a Not Found (404) Error - value: - type: validation - description: 'Invalid answerUrl: only http and https are allowed.' - voiceNotAllowedErrorExample: - summary: Example of a Not Allowed (405) Error - value: - type: validation - description: 'Invalid answerUrl: only http and https are allowed.' - voiceConflictErrorExample: - summary: Example of a Conflict (409) Error - value: - type: validation - description: 'Invalid answerUrl: only http and https are allowed.' - voiceUnsupportedMediaTypeErrorExample: - summary: Example of an Unsupported Media Type (415) Error - value: - type: validation - description: 'Invalid answerUrl: only http and https are allowed.' - voiceTooManyRequestsErrorExample: - summary: Example of a Too Many Requests (429) Error - value: - type: validation - description: 'Invalid answerUrl: only http and https are allowed.' - voiceInternalServerErrorExample: - summary: Example of an Internal Server (500) Error - value: - type: validation - description: 'Invalid answerUrl: only http and https are allowed.' - singleNumberRequestExample: - summary: Example Number Lookup Request for One Number - value: - tns: - - '+19195551234' - multipleNumberRequestExample: - summary: Example Number Lookup Request for Multiple Numbers - value: - tns: - - '+19195551234' - - '+19195554321' - lookupInProgressExample: - summary: Example Lookup In Progress Response - value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: IN_PROGRESS - lookupFailedExample: - summary: Example Lookup Failed Response - value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: FAILED - failedTelephoneNumbers: - - '+191955512345' - lookupSingleNumberCompleteExample: - summary: Example Single Number Lookup Complete Response - value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: COMPLETE - result: - - Response Code: 0 - Message: NOERROR - E.164 Format: '+19195551234' - Formatted: (919) 555-1234 - Country: US - Line Type: Mobile - Line Provider: Verizon Wireless - Mobile Country Code: '310' - Mobile Network Code: '010' - lookupMultipleNumbersCompleteExample: - summary: Example Multiple Numbers Lookup Complete Response - value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: COMPLETE - result: - - Response Code: 0 - Message: NOERROR - E.164 Format: '+19195551234' - Formatted: (919) 555-1234 - Country: US - Line Type: Mobile - Line Provider: Verizon Wireless - Mobile Country Code: '310' - Mobile Network Code: '010' - - Response Code: 0 - Message: NOERROR - E.164 Format: '+19195554321' - Formatted: (919) 555-4321 - Country: US - Line Type: Mobile - Line Provider: T-Mobile USA - Mobile Country Code: '310' - Mobile Network Code: '160' - lookupMultipleNumbersPartialCompleteExample: - summary: Example Multiple Numbers Lookup Partial Complete Response - value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: PARTIAL_COMPLETE - result: - - Response Code: 0 - Message: NOERROR - E.164 Format: '+19195551234' - Formatted: (919) 555-1234 - Country: US - Line Type: Mobile - Line Provider: Verizon Wireless - Mobile Country Code: '310' - Mobile Network Code: '010' - failedTelephoneNumbers: - - '+191955512345' - lookupSingleNumberCompleteNoInfoExample: - summary: Example Single Number Lookup Complete with No Information Response - value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: COMPLETE - result: - - Response Code: 3 - Message: NXDOMAIN - E.164 Format: '+19195550000' - Formatted: (919) 555-0000 - Country: US diff --git a/bandwidth/__init__.py b/bandwidth/__init__.py index 6ba66bc5..fd36416d 100644 --- a/bandwidth/__init__.py +++ b/bandwidth/__init__.py @@ -54,6 +54,7 @@ from bandwidth.models.call_transcription_response import CallTranscriptionResponse from bandwidth.models.call_transcription_track_enum import CallTranscriptionTrackEnum from bandwidth.models.callback_method_enum import CallbackMethodEnum +from bandwidth.models.callback_type_enum import CallbackTypeEnum from bandwidth.models.code_request import CodeRequest from bandwidth.models.conference import Conference from bandwidth.models.conference_completed_callback import ConferenceCompletedCallback @@ -76,8 +77,6 @@ from bandwidth.models.field_error import FieldError from bandwidth.models.file_format_enum import FileFormatEnum from bandwidth.models.gather_callback import GatherCallback -from bandwidth.models.inbound_message_callback import InboundMessageCallback -from bandwidth.models.inbound_message_callback_message import InboundMessageCallbackMessage from bandwidth.models.initiate_callback import InitiateCallback from bandwidth.models.list_message_direction_enum import ListMessageDirectionEnum from bandwidth.models.list_message_item import ListMessageItem @@ -91,14 +90,10 @@ from bandwidth.models.machine_detection_result import MachineDetectionResult from bandwidth.models.media import Media from bandwidth.models.message import Message -from bandwidth.models.message_delivered_callback import MessageDeliveredCallback -from bandwidth.models.message_delivered_callback_message import MessageDeliveredCallbackMessage +from bandwidth.models.message_callback import MessageCallback +from bandwidth.models.message_callback_message import MessageCallbackMessage from bandwidth.models.message_direction_enum import MessageDirectionEnum -from bandwidth.models.message_failed_callback import MessageFailedCallback -from bandwidth.models.message_failed_callback_message import MessageFailedCallbackMessage from bandwidth.models.message_request import MessageRequest -from bandwidth.models.message_sending_callback import MessageSendingCallback -from bandwidth.models.message_sending_callback_message import MessageSendingCallbackMessage from bandwidth.models.message_status_enum import MessageStatusEnum from bandwidth.models.message_type_enum import MessageTypeEnum from bandwidth.models.messages_list import MessagesList diff --git a/bandwidth/api/media_api.py b/bandwidth/api/media_api.py index 8258fce9..38322248 100644 --- a/bandwidth/api/media_api.py +++ b/bandwidth/api/media_api.py @@ -1300,6 +1300,8 @@ def _upload_media_serialize( 'audio/3gpp', 'image/bmp', 'image/gif', + 'image/heic', + 'image/heif', 'image/jpeg', 'image/pjpeg', 'image/png', @@ -1310,6 +1312,7 @@ def _upload_media_serialize( 'text/css', 'text/csv', 'text/calendar', + 'text/html', 'text/plain', 'text/javascript', 'text/vcard', @@ -1321,7 +1324,8 @@ def _upload_media_serialize( 'video/ogg', 'video/quicktime', 'video/webm', - 'video/x-ms-wmv' + 'video/x-ms-wmv', + 'video/x-flv' ] ) ) diff --git a/bandwidth/models/__init__.py b/bandwidth/models/__init__.py index da557bc1..c92ffced 100644 --- a/bandwidth/models/__init__.py +++ b/bandwidth/models/__init__.py @@ -29,6 +29,7 @@ from bandwidth.models.call_transcription_response import CallTranscriptionResponse from bandwidth.models.call_transcription_track_enum import CallTranscriptionTrackEnum from bandwidth.models.callback_method_enum import CallbackMethodEnum +from bandwidth.models.callback_type_enum import CallbackTypeEnum from bandwidth.models.code_request import CodeRequest from bandwidth.models.conference import Conference from bandwidth.models.conference_completed_callback import ConferenceCompletedCallback @@ -51,8 +52,6 @@ from bandwidth.models.field_error import FieldError from bandwidth.models.file_format_enum import FileFormatEnum from bandwidth.models.gather_callback import GatherCallback -from bandwidth.models.inbound_message_callback import InboundMessageCallback -from bandwidth.models.inbound_message_callback_message import InboundMessageCallbackMessage from bandwidth.models.initiate_callback import InitiateCallback from bandwidth.models.list_message_direction_enum import ListMessageDirectionEnum from bandwidth.models.list_message_item import ListMessageItem @@ -66,14 +65,10 @@ from bandwidth.models.machine_detection_result import MachineDetectionResult from bandwidth.models.media import Media from bandwidth.models.message import Message -from bandwidth.models.message_delivered_callback import MessageDeliveredCallback -from bandwidth.models.message_delivered_callback_message import MessageDeliveredCallbackMessage +from bandwidth.models.message_callback import MessageCallback +from bandwidth.models.message_callback_message import MessageCallbackMessage from bandwidth.models.message_direction_enum import MessageDirectionEnum -from bandwidth.models.message_failed_callback import MessageFailedCallback -from bandwidth.models.message_failed_callback_message import MessageFailedCallbackMessage from bandwidth.models.message_request import MessageRequest -from bandwidth.models.message_sending_callback import MessageSendingCallback -from bandwidth.models.message_sending_callback_message import MessageSendingCallbackMessage from bandwidth.models.message_status_enum import MessageStatusEnum from bandwidth.models.message_type_enum import MessageTypeEnum from bandwidth.models.messages_list import MessagesList diff --git a/bandwidth/models/callback_type_enum.py b/bandwidth/models/callback_type_enum.py new file mode 100644 index 00000000..7b1f9919 --- /dev/null +++ b/bandwidth/models/callback_type_enum.py @@ -0,0 +1,40 @@ +# 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 CallbackTypeEnum(str, Enum): + """ + Indicates the type of the callback: - `message-received` for inbound callbacks. - One of `message-sending`, `message-delivered`, `message-failed` for status callbacks. + """ + + """ + allowed enum values + """ + MESSAGE_MINUS_RECEIVED = 'message-received' + MESSAGE_MINUS_SENDING = 'message-sending' + MESSAGE_MINUS_DELIVERED = 'message-delivered' + MESSAGE_MINUS_FAILED = 'message-failed' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of CallbackTypeEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/bandwidth/models/inbound_message_callback.py b/bandwidth/models/inbound_message_callback.py deleted file mode 100644 index 6c7174d0..00000000 --- a/bandwidth/models/inbound_message_callback.py +++ /dev/null @@ -1,114 +0,0 @@ -# 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, StrictStr -from typing import Any, ClassVar, Dict, List -from bandwidth.models.inbound_message_callback_message import InboundMessageCallbackMessage -from typing import Optional, Set -from typing_extensions import Self - -class InboundMessageCallback(BaseModel): - """ - Inbound Message Callback - """ # noqa: E501 - time: datetime - type: StrictStr - to: StrictStr - description: StrictStr - message: InboundMessageCallbackMessage - additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["time", "type", "to", "description", "message"] - - 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 InboundMessageCallback 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 message - if self.message: - _dict['message'] = self.message.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 InboundMessageCallback from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "time": obj.get("time"), - "type": obj.get("type"), - "to": obj.get("to"), - "description": obj.get("description"), - "message": InboundMessageCallbackMessage.from_dict(obj["message"]) if obj.get("message") 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/message_failed_callback.py b/bandwidth/models/message_callback.py similarity index 75% rename from bandwidth/models/message_failed_callback.py rename to bandwidth/models/message_callback.py index b61bca1f..5006aadc 100644 --- a/bandwidth/models/message_failed_callback.py +++ b/bandwidth/models/message_callback.py @@ -20,21 +20,22 @@ from datetime import datetime from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr -from typing import Any, ClassVar, Dict, List -from bandwidth.models.message_failed_callback_message import MessageFailedCallbackMessage +from typing import Any, ClassVar, Dict, List, Optional +from bandwidth.models.callback_type_enum import CallbackTypeEnum +from bandwidth.models.message_callback_message import MessageCallbackMessage from typing import Optional, Set from typing_extensions import Self -class MessageFailedCallback(BaseModel): +class MessageCallback(BaseModel): """ - Message Failed Callback + Message Callback Schema """ # noqa: E501 time: datetime - type: StrictStr + type: CallbackTypeEnum to: StrictStr - description: StrictStr - message: MessageFailedCallbackMessage - error_code: StrictInt = Field(alias="errorCode") + description: StrictStr = Field(description="A detailed description of the event described by the callback.") + message: MessageCallbackMessage + error_code: Optional[StrictInt] = Field(default=None, description="Optional error code, applicable only when type is `message-failed`.", alias="errorCode") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["time", "type", "to", "description", "message", "errorCode"] @@ -56,7 +57,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of MessageFailedCallback from a JSON string""" + """Create an instance of MessageCallback from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -87,11 +88,16 @@ def to_dict(self) -> Dict[str, Any]: for _key, _value in self.additional_properties.items(): _dict[_key] = _value + # set to None if error_code (nullable) is None + # and model_fields_set contains the field + if self.error_code is None and "error_code" in self.model_fields_set: + _dict['errorCode'] = None + return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of MessageFailedCallback from a dict""" + """Create an instance of MessageCallback from a dict""" if obj is None: return None @@ -103,7 +109,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "type": obj.get("type"), "to": obj.get("to"), "description": obj.get("description"), - "message": MessageFailedCallbackMessage.from_dict(obj["message"]) if obj.get("message") is not None else None, + "message": MessageCallbackMessage.from_dict(obj["message"]) if obj.get("message") is not None else None, "errorCode": obj.get("errorCode") }) # store additional fields in additional_properties diff --git a/bandwidth/models/inbound_message_callback_message.py b/bandwidth/models/message_callback_message.py similarity index 87% rename from bandwidth/models/inbound_message_callback_message.py rename to bandwidth/models/message_callback_message.py index 21f633c5..6cdb17b7 100644 --- a/bandwidth/models/inbound_message_callback_message.py +++ b/bandwidth/models/message_callback_message.py @@ -26,9 +26,9 @@ from typing import Optional, Set from typing_extensions import Self -class InboundMessageCallbackMessage(BaseModel): +class MessageCallbackMessage(BaseModel): """ - Inbound Message Callback Message Schema + Message payload schema within a MessageCallback """ # noqa: E501 id: StrictStr owner: StrictStr @@ -40,7 +40,7 @@ class InboundMessageCallbackMessage(BaseModel): var_from: StrictStr = Field(alias="from") text: StrictStr tag: Optional[StrictStr] = None - media: Optional[List[StrictStr]] = None + media: Optional[List[StrictStr]] = Field(default=None, description="Optional media, applicable only for mms") priority: Optional[PriorityEnum] = None additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "owner", "applicationId", "time", "segmentCount", "direction", "to", "from", "text", "tag", "media", "priority"] @@ -63,7 +63,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of InboundMessageCallbackMessage from a JSON string""" + """Create an instance of MessageCallbackMessage from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -91,11 +91,16 @@ def to_dict(self) -> Dict[str, Any]: for _key, _value in self.additional_properties.items(): _dict[_key] = _value + # set to None if media (nullable) is None + # and model_fields_set contains the field + if self.media is None and "media" in self.model_fields_set: + _dict['media'] = None + return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of InboundMessageCallbackMessage from a dict""" + """Create an instance of MessageCallbackMessage from a dict""" if obj is None: return None diff --git a/bandwidth/models/message_delivered_callback.py b/bandwidth/models/message_delivered_callback.py deleted file mode 100644 index cfcbdeb9..00000000 --- a/bandwidth/models/message_delivered_callback.py +++ /dev/null @@ -1,114 +0,0 @@ -# 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, StrictStr -from typing import Any, ClassVar, Dict, List -from bandwidth.models.message_delivered_callback_message import MessageDeliveredCallbackMessage -from typing import Optional, Set -from typing_extensions import Self - -class MessageDeliveredCallback(BaseModel): - """ - Message Delivered Callback - """ # noqa: E501 - time: datetime - type: StrictStr - to: StrictStr - description: StrictStr - message: MessageDeliveredCallbackMessage - additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["time", "type", "to", "description", "message"] - - 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 MessageDeliveredCallback 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 message - if self.message: - _dict['message'] = self.message.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 MessageDeliveredCallback from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "time": obj.get("time"), - "type": obj.get("type"), - "to": obj.get("to"), - "description": obj.get("description"), - "message": MessageDeliveredCallbackMessage.from_dict(obj["message"]) if obj.get("message") 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/message_delivered_callback_message.py b/bandwidth/models/message_delivered_callback_message.py deleted file mode 100644 index 6b004a0f..00000000 --- a/bandwidth/models/message_delivered_callback_message.py +++ /dev/null @@ -1,126 +0,0 @@ -# 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, StrictInt, StrictStr -from typing import Any, ClassVar, Dict, List, Optional -from bandwidth.models.message_direction_enum import MessageDirectionEnum -from bandwidth.models.priority_enum import PriorityEnum -from typing import Optional, Set -from typing_extensions import Self - -class MessageDeliveredCallbackMessage(BaseModel): - """ - Message Delivered Callback Message Schema - """ # noqa: E501 - id: StrictStr - owner: StrictStr - application_id: StrictStr = Field(alias="applicationId") - time: datetime - segment_count: StrictInt = Field(alias="segmentCount") - direction: MessageDirectionEnum - to: List[StrictStr] - var_from: StrictStr = Field(alias="from") - text: StrictStr - tag: StrictStr - media: Optional[List[StrictStr]] = None - priority: Optional[PriorityEnum] = None - additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["id", "owner", "applicationId", "time", "segmentCount", "direction", "to", "from", "text", "tag", "media", "priority"] - - 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 MessageDeliveredCallbackMessage 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 MessageDeliveredCallbackMessage from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "id": obj.get("id"), - "owner": obj.get("owner"), - "applicationId": obj.get("applicationId"), - "time": obj.get("time"), - "segmentCount": obj.get("segmentCount"), - "direction": obj.get("direction"), - "to": obj.get("to"), - "from": obj.get("from"), - "text": obj.get("text"), - "tag": obj.get("tag"), - "media": obj.get("media"), - "priority": obj.get("priority") - }) - # 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/message_failed_callback_message.py b/bandwidth/models/message_failed_callback_message.py deleted file mode 100644 index a58445e4..00000000 --- a/bandwidth/models/message_failed_callback_message.py +++ /dev/null @@ -1,126 +0,0 @@ -# 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, StrictInt, StrictStr -from typing import Any, ClassVar, Dict, List, Optional -from bandwidth.models.message_direction_enum import MessageDirectionEnum -from bandwidth.models.priority_enum import PriorityEnum -from typing import Optional, Set -from typing_extensions import Self - -class MessageFailedCallbackMessage(BaseModel): - """ - Message Failed Callback Message Schema - """ # noqa: E501 - id: StrictStr - owner: StrictStr - application_id: StrictStr = Field(alias="applicationId") - time: datetime - segment_count: StrictInt = Field(alias="segmentCount") - direction: MessageDirectionEnum - to: List[StrictStr] - var_from: StrictStr = Field(alias="from") - text: StrictStr - tag: StrictStr - media: Optional[List[StrictStr]] = None - priority: Optional[PriorityEnum] = None - additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["id", "owner", "applicationId", "time", "segmentCount", "direction", "to", "from", "text", "tag", "media", "priority"] - - 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 MessageFailedCallbackMessage 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 MessageFailedCallbackMessage from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "id": obj.get("id"), - "owner": obj.get("owner"), - "applicationId": obj.get("applicationId"), - "time": obj.get("time"), - "segmentCount": obj.get("segmentCount"), - "direction": obj.get("direction"), - "to": obj.get("to"), - "from": obj.get("from"), - "text": obj.get("text"), - "tag": obj.get("tag"), - "media": obj.get("media"), - "priority": obj.get("priority") - }) - # 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/message_sending_callback.py b/bandwidth/models/message_sending_callback.py deleted file mode 100644 index 4ab6d3d3..00000000 --- a/bandwidth/models/message_sending_callback.py +++ /dev/null @@ -1,114 +0,0 @@ -# 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, StrictStr -from typing import Any, ClassVar, Dict, List -from bandwidth.models.message_sending_callback_message import MessageSendingCallbackMessage -from typing import Optional, Set -from typing_extensions import Self - -class MessageSendingCallback(BaseModel): - """ - Message Sending Callback - """ # noqa: E501 - time: datetime - type: StrictStr - to: StrictStr - description: StrictStr - message: MessageSendingCallbackMessage - additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["time", "type", "to", "description", "message"] - - 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 MessageSendingCallback 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 message - if self.message: - _dict['message'] = self.message.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 MessageSendingCallback from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "time": obj.get("time"), - "type": obj.get("type"), - "to": obj.get("to"), - "description": obj.get("description"), - "message": MessageSendingCallbackMessage.from_dict(obj["message"]) if obj.get("message") 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/message_sending_callback_message.py b/bandwidth/models/message_sending_callback_message.py deleted file mode 100644 index 8387e75c..00000000 --- a/bandwidth/models/message_sending_callback_message.py +++ /dev/null @@ -1,126 +0,0 @@ -# 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, StrictInt, StrictStr -from typing import Any, ClassVar, Dict, List, Optional -from bandwidth.models.message_direction_enum import MessageDirectionEnum -from bandwidth.models.priority_enum import PriorityEnum -from typing import Optional, Set -from typing_extensions import Self - -class MessageSendingCallbackMessage(BaseModel): - """ - Message Sending Callback Message Schema - """ # noqa: E501 - id: StrictStr - owner: StrictStr - application_id: StrictStr = Field(alias="applicationId") - time: datetime - segment_count: StrictInt = Field(alias="segmentCount") - direction: MessageDirectionEnum - to: List[StrictStr] - var_from: StrictStr = Field(alias="from") - text: StrictStr - tag: Optional[StrictStr] = None - media: List[StrictStr] - priority: Optional[PriorityEnum] = None - additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["id", "owner", "applicationId", "time", "segmentCount", "direction", "to", "from", "text", "tag", "media", "priority"] - - 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 MessageSendingCallbackMessage 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 MessageSendingCallbackMessage from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "id": obj.get("id"), - "owner": obj.get("owner"), - "applicationId": obj.get("applicationId"), - "time": obj.get("time"), - "segmentCount": obj.get("segmentCount"), - "direction": obj.get("direction"), - "to": obj.get("to"), - "from": obj.get("from"), - "text": obj.get("text"), - "tag": obj.get("tag"), - "media": obj.get("media"), - "priority": obj.get("priority") - }) - # 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/transcription_list.py b/bandwidth/models/transcription_list.py deleted file mode 100644 index eaa10d13..00000000 --- a/bandwidth/models/transcription_list.py +++ /dev/null @@ -1,109 +0,0 @@ -# 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.transcription import Transcription -from typing import Optional, Set -from typing_extensions import Self - -class TranscriptionList(BaseModel): - """ - TranscriptionList - """ # noqa: E501 - transcripts: Optional[List[Transcription]] = None - additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["transcripts"] - - 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 TranscriptionList 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 transcripts (list) - _items = [] - if self.transcripts: - for _item in self.transcripts: - if _item: - _items.append(_item.to_dict()) - _dict['transcripts'] = _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 TranscriptionList from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "transcripts": [Transcription.from_dict(_item) for _item in obj["transcripts"]] if obj.get("transcripts") 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/docs/CallbackTypeEnum.md b/docs/CallbackTypeEnum.md new file mode 100644 index 00000000..0d071f57 --- /dev/null +++ b/docs/CallbackTypeEnum.md @@ -0,0 +1,17 @@ +# CallbackTypeEnum + +Indicates the type of the callback: - `message-received` for inbound callbacks. - One of `message-sending`, `message-delivered`, `message-failed` for status callbacks. + +## Enum + +* `MESSAGE_MINUS_RECEIVED` (value: `'message-received'`) + +* `MESSAGE_MINUS_SENDING` (value: `'message-sending'`) + +* `MESSAGE_MINUS_DELIVERED` (value: `'message-delivered'`) + +* `MESSAGE_MINUS_FAILED` (value: `'message-failed'`) + +[[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/MediaApi.md b/docs/MediaApi.md index adc790a5..6b25b7ab 100644 --- a/docs/MediaApi.md +++ b/docs/MediaApi.md @@ -346,7 +346,7 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json, application/ogg, application/pdf, application/rtf, application/zip, application/x-tar, application/xml, application/gzip, application/x-bzip2, application/x-gzip, application/smil, application/javascript, audio/mp4, audio/mpeg, audio/ogg, audio/flac, audio/webm, audio/wav, audio/amr, audio/3gpp, image/bmp, image/gif, image/jpeg, image/pjpeg, image/png, image/svg+xml, image/tiff, image/webp, image/x-icon, text/css, text/csv, text/calendar, text/plain, text/javascript, text/vcard, text/vnd.wap.wml, text/xml, video/avi, video/mp4, video/mpeg, video/ogg, video/quicktime, video/webm, video/x-ms-wmv + - **Content-Type**: application/json, application/ogg, application/pdf, application/rtf, application/zip, application/x-tar, application/xml, application/gzip, application/x-bzip2, application/x-gzip, application/smil, application/javascript, audio/mp4, audio/mpeg, audio/ogg, audio/flac, audio/webm, audio/wav, audio/amr, audio/3gpp, image/bmp, image/gif, image/heic, image/heif, image/jpeg, image/pjpeg, image/png, image/svg+xml, image/tiff, image/webp, image/x-icon, text/css, text/csv, text/calendar, text/html, text/plain, text/javascript, text/vcard, text/vnd.wap.wml, text/xml, video/avi, video/mp4, video/mpeg, video/ogg, video/quicktime, video/webm, video/x-ms-wmv, video/x-flv - **Accept**: application/json ### HTTP response details diff --git a/docs/MessageCallback.md b/docs/MessageCallback.md new file mode 100644 index 00000000..1a1d3da1 --- /dev/null +++ b/docs/MessageCallback.md @@ -0,0 +1,35 @@ +# MessageCallback + +Message Callback Schema + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**time** | **datetime** | | +**type** | [**CallbackTypeEnum**](CallbackTypeEnum.md) | | +**to** | **str** | | +**description** | **str** | A detailed description of the event described by the callback. | +**message** | [**MessageCallbackMessage**](MessageCallbackMessage.md) | | +**error_code** | **int** | Optional error code, applicable only when type is `message-failed`. | [optional] + +## Example + +```python +from bandwidth.models.message_callback import MessageCallback + +# TODO update the JSON string below +json = "{}" +# create an instance of MessageCallback from a JSON string +message_callback_instance = MessageCallback.from_json(json) +# print the JSON string representation of the object +print(MessageCallback.to_json()) + +# convert the object into a dict +message_callback_dict = message_callback_instance.to_dict() +# create an instance of MessageCallback from a dict +message_callback_from_dict = MessageCallback.from_dict(message_callback_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/MessageCallbackMessage.md b/docs/MessageCallbackMessage.md new file mode 100644 index 00000000..a0c97fed --- /dev/null +++ b/docs/MessageCallbackMessage.md @@ -0,0 +1,41 @@ +# MessageCallbackMessage + +Message payload schema within a MessageCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | +**owner** | **str** | | +**application_id** | **str** | | +**time** | **datetime** | | +**segment_count** | **int** | | +**direction** | [**MessageDirectionEnum**](MessageDirectionEnum.md) | | +**to** | **List[str]** | | +**var_from** | **str** | | +**text** | **str** | | +**tag** | **str** | | [optional] +**media** | **List[str]** | Optional media, applicable only for mms | [optional] +**priority** | [**PriorityEnum**](PriorityEnum.md) | | [optional] + +## Example + +```python +from bandwidth.models.message_callback_message import MessageCallbackMessage + +# TODO update the JSON string below +json = "{}" +# create an instance of MessageCallbackMessage from a JSON string +message_callback_message_instance = MessageCallbackMessage.from_json(json) +# print the JSON string representation of the object +print(MessageCallbackMessage.to_json()) + +# convert the object into a dict +message_callback_message_dict = message_callback_message_instance.to_dict() +# create an instance of MessageCallbackMessage from a dict +message_callback_message_from_dict = MessageCallbackMessage.from_dict(message_callback_message_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/unit/models/test_callback_type_enum.py b/test/unit/models/test_callback_type_enum.py new file mode 100644 index 00000000..d73d4a90 --- /dev/null +++ b/test/unit/models/test_callback_type_enum.py @@ -0,0 +1,41 @@ +# 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.callback_type_enum import CallbackTypeEnum + +class TestCallbackTypeEnum(unittest.TestCase): + """CallbackTypeEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testCallbackTypeEnum(self): + """Test CallbackTypeEnum""" + received = CallbackTypeEnum('message-received') + sending = CallbackTypeEnum('message-sending') + delivered = CallbackTypeEnum('message-delivered') + failed = CallbackTypeEnum('message-failed') + assert received == 'message-received' + assert sending == 'message-sending' + assert delivered == 'message-delivered' + assert failed == 'message-failed' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_inbound_message_callback.py b/test/unit/models/test_inbound_message_callback.py deleted file mode 100644 index 08e91da8..00000000 --- a/test/unit/models/test_inbound_message_callback.py +++ /dev/null @@ -1,101 +0,0 @@ -# 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.inbound_message_callback import InboundMessageCallback -from bandwidth.models.inbound_message_callback_message import InboundMessageCallbackMessage - -class TestInboundMessageCallback(unittest.TestCase): - """InboundMessageCallback unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> InboundMessageCallback: - """Test InboundMessageCallback - 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 InboundMessageCallback( - time = '2016-09-14T18:20:16Z', - type = 'message-received', - to = '+15552223333', - description = 'Incoming message received', - message = InboundMessageCallbackMessage( - id = '1661365814859loidf7mcwd4qacn7', - owner = '+15553332222', - application_id = '93de2206-9669-4e07-948d-329f4b722ee2', - time = '2016-09-14T18:20:16Z', - segment_count = 1, - direction = 'in', - to = ["+15552223333"], - var_from = '+15553332222', - text = 'Hello world', - tag = 'custom string', - media = ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"], - priority = 'default', ) - ) - else: - return InboundMessageCallback( - time = '2016-09-14T18:20:16Z', - type = 'message-received', - to = '+15552223333', - description = 'Incoming message received', - message = InboundMessageCallbackMessage( - id = '1661365814859loidf7mcwd4qacn7', - owner = '+15553332222', - application_id = '93de2206-9669-4e07-948d-329f4b722ee2', - time = '2016-09-14T18:20:16Z', - segment_count = 1, - direction = 'in', - to = ["+15552223333"], - var_from = '+15553332222', - text = 'Hello world', - tag = 'custom string', - media = ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"], - priority = 'default', ), - ) - - def testInboundMessageCallback(self): - """Test InboundMessageCallback""" - instance = self.make_instance(True) - assert instance is not None - assert isinstance(instance, InboundMessageCallback) - assert isinstance(instance.time, datetime) - assert instance.type == 'message-received' - assert instance.to == '+15552223333' - assert instance.description == 'Incoming message received' - assert isinstance(instance.message, InboundMessageCallbackMessage) - assert instance.message.id == '1661365814859loidf7mcwd4qacn7' - assert instance.message.owner == '+15553332222' - assert instance.message.application_id == '93de2206-9669-4e07-948d-329f4b722ee2' - assert isinstance(instance.message.time, datetime) - assert instance.message.segment_count == 1 - assert instance.message.direction == 'in' - assert instance.message.to == ["+15552223333"] - assert instance.message.var_from == '+15553332222' - assert instance.message.text == 'Hello world' - assert instance.message.tag == 'custom string' - assert instance.message.media == ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"] - assert instance.message.priority == 'default' - -if __name__ == '__main__': - unittest.main() diff --git a/test/unit/models/test_message_failed_callback.py b/test/unit/models/test_message_callback.py similarity index 72% rename from test/unit/models/test_message_failed_callback.py rename to test/unit/models/test_message_callback.py index dd96c182..e2c4ae02 100644 --- a/test/unit/models/test_message_failed_callback.py +++ b/test/unit/models/test_message_callback.py @@ -16,11 +16,11 @@ import unittest from datetime import datetime -from bandwidth.models.message_failed_callback import MessageFailedCallback -from bandwidth.models.message_failed_callback_message import MessageFailedCallbackMessage +from bandwidth.models.message_callback import MessageCallback +from bandwidth.models.message_callback_message import MessageCallbackMessage -class TestMessageFailedCallback(unittest.TestCase): - """MessageFailedCallback unit test stubs""" +class TestMessageCallback(unittest.TestCase): + """MessageCallback unit test stubs""" def setUp(self): pass @@ -28,22 +28,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> MessageFailedCallback: - """Test MessageFailedCallback + def make_instance(self, include_optional) -> MessageCallback: + """Test MessageCallback 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 MessageFailedCallback( - time = '2016-09-14T18:20:16Z', - type = 'message-failed', + return MessageCallback( + time = '2024-12-02T20:15:57.278Z', + type = 'message-delivered', to = '+15552223333', description = 'rejected-unallocated-from-number', - message = MessageFailedCallbackMessage( + message = MessageCallbackMessage( id = '1661365814859loidf7mcwd4qacn7', owner = '+15553332222', application_id = '93de2206-9669-4e07-948d-329f4b722ee2', - time = '2016-09-14T18:20:16Z', + time = '2024-12-02T20:15:57.666Z', segment_count = 1, direction = 'in', to = ["+15552223333"], @@ -52,19 +52,19 @@ def make_instance(self, include_optional) -> MessageFailedCallback: tag = 'custom string', media = ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"], priority = 'default', ), - error_code = 9902 + error_code = 4405 ) else: - return MessageFailedCallback( - time = '2016-09-14T18:20:16Z', - type = 'message-failed', + return MessageCallback( + time = '2024-12-02T20:15:57.278Z', + type = 'message-delivered', to = '+15552223333', description = 'rejected-unallocated-from-number', - message = MessageFailedCallbackMessage( + message = MessageCallbackMessage( id = '1661365814859loidf7mcwd4qacn7', owner = '+15553332222', application_id = '93de2206-9669-4e07-948d-329f4b722ee2', - time = '2016-09-14T18:20:16Z', + time = '2024-12-02T20:15:57.666Z', segment_count = 1, direction = 'in', to = ["+15552223333"], @@ -73,19 +73,18 @@ def make_instance(self, include_optional) -> MessageFailedCallback: tag = 'custom string', media = ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"], priority = 'default', ), - error_code = 9902, ) - def testMessageFailedCallback(self): - """Test MessageFailedCallback""" + def testMessageCallback(self): + """Test MessageCallback""" instance = self.make_instance(True) assert instance is not None - assert isinstance(instance, MessageFailedCallback) + assert isinstance(instance, MessageCallback) assert isinstance(instance.time, datetime) - assert instance.type == 'message-failed' + assert instance.type == 'message-delivered' assert instance.to == '+15552223333' assert instance.description == 'rejected-unallocated-from-number' - assert isinstance(instance.message, MessageFailedCallbackMessage) + assert isinstance(instance.message, MessageCallbackMessage) assert instance.message.id == '1661365814859loidf7mcwd4qacn7' assert instance.message.owner == '+15553332222' assert instance.message.application_id == '93de2206-9669-4e07-948d-329f4b722ee2' @@ -98,7 +97,6 @@ def testMessageFailedCallback(self): assert instance.message.tag == 'custom string' assert instance.message.media == ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"] assert instance.message.priority == 'default' - assert instance.error_code == 9902 if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_inbound_message_callback_message.py b/test/unit/models/test_message_callback_message.py similarity index 77% rename from test/unit/models/test_inbound_message_callback_message.py rename to test/unit/models/test_message_callback_message.py index c592fece..950b7181 100644 --- a/test/unit/models/test_inbound_message_callback_message.py +++ b/test/unit/models/test_message_callback_message.py @@ -16,10 +16,10 @@ import unittest from datetime import datetime -from bandwidth.models.inbound_message_callback_message import InboundMessageCallbackMessage +from bandwidth.models.message_callback_message import MessageCallbackMessage -class TestInboundMessageCallbackMessage(unittest.TestCase): - """InboundMessageCallbackMessage unit test stubs""" +class TestMessageCallbackMessage(unittest.TestCase): + """MessageCallbackMessage unit test stubs""" def setUp(self): pass @@ -27,17 +27,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> InboundMessageCallbackMessage: - """Test InboundMessageCallbackMessage + def make_instance(self, include_optional) -> MessageCallbackMessage: + """Test MessageCallbackMessage 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 InboundMessageCallbackMessage( + return MessageCallbackMessage( id = '1661365814859loidf7mcwd4qacn7', owner = '+15553332222', application_id = '93de2206-9669-4e07-948d-329f4b722ee2', - time = '2016-09-14T18:20:16Z', + time = '2024-12-02T20:15:57.666Z', segment_count = 1, direction = 'in', to = ["+15552223333"], @@ -48,11 +48,11 @@ def make_instance(self, include_optional) -> InboundMessageCallbackMessage: priority = 'default' ) else: - return InboundMessageCallbackMessage( + return MessageCallbackMessage( id = '1661365814859loidf7mcwd4qacn7', owner = '+15553332222', application_id = '93de2206-9669-4e07-948d-329f4b722ee2', - time = '2016-09-14T18:20:16Z', + time = '2024-12-02T20:15:57.666Z', segment_count = 1, direction = 'in', to = ["+15552223333"], @@ -60,11 +60,11 @@ def make_instance(self, include_optional) -> InboundMessageCallbackMessage: text = 'Hello world', ) - def testInboundMessageCallbackMessage(self): - """Test InboundMessageCallbackMessage""" + def testMessageCallbackMessage(self): + """Test MessageCallbackMessage""" instance = self.make_instance(True) assert instance is not None - assert isinstance(instance, InboundMessageCallbackMessage) + assert isinstance(instance, MessageCallbackMessage) assert instance.id == '1661365814859loidf7mcwd4qacn7' assert instance.owner == '+15553332222' assert instance.application_id == '93de2206-9669-4e07-948d-329f4b722ee2' diff --git a/test/unit/models/test_message_delivered_callback.py b/test/unit/models/test_message_delivered_callback.py deleted file mode 100644 index c2b7fafd..00000000 --- a/test/unit/models/test_message_delivered_callback.py +++ /dev/null @@ -1,101 +0,0 @@ -# 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.message_delivered_callback import MessageDeliveredCallback -from bandwidth.models.message_delivered_callback_message import MessageDeliveredCallbackMessage - -class TestMessageDeliveredCallback(unittest.TestCase): - """MessageDeliveredCallback unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> MessageDeliveredCallback: - """Test MessageDeliveredCallback - 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 MessageDeliveredCallback( - time = '2016-09-14T18:20:16Z', - type = 'message-delivered', - to = '+15552223333', - description = 'Message delivered to carrier.', - message = MessageDeliveredCallbackMessage( - id = '1661365814859loidf7mcwd4qacn7', - owner = '+15553332222', - application_id = '93de2206-9669-4e07-948d-329f4b722ee2', - time = '2016-09-14T18:20:16Z', - segment_count = 1, - direction = 'in', - to = ["+15552223333"], - var_from = '+15553332222', - text = 'Hello world', - tag = 'custom string', - media = ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"], - priority = 'default', ) - ) - else: - return MessageDeliveredCallback( - time = '2016-09-14T18:20:16Z', - type = 'message-delivered', - to = '+15552223333', - description = 'Message delivered to carrier.', - message = MessageDeliveredCallbackMessage( - id = '1661365814859loidf7mcwd4qacn7', - owner = '+15553332222', - application_id = '93de2206-9669-4e07-948d-329f4b722ee2', - time = '2016-09-14T18:20:16Z', - segment_count = 1, - direction = 'in', - to = ["+15552223333"], - var_from = '+15553332222', - text = 'Hello world', - tag = 'custom string', - media = ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"], - priority = 'default', ), - ) - - def testMessageDeliveredCallback(self): - """Test MessageDeliveredCallback""" - instance = self.make_instance(True) - assert instance is not None - assert isinstance(instance, MessageDeliveredCallback) - assert isinstance(instance.time, datetime) - assert instance.type == 'message-delivered' - assert instance.to == '+15552223333' - assert instance.description == 'Message delivered to carrier.' - assert isinstance(instance.message, MessageDeliveredCallbackMessage) - assert instance.message.id == '1661365814859loidf7mcwd4qacn7' - assert instance.message.owner == '+15553332222' - assert instance.message.application_id == '93de2206-9669-4e07-948d-329f4b722ee2' - assert isinstance(instance.message.time, datetime) - assert instance.message.segment_count == 1 - assert instance.message.direction == 'in' - assert instance.message.to == ["+15552223333"] - assert instance.message.var_from == '+15553332222' - assert instance.message.text == 'Hello world' - assert instance.message.tag == 'custom string' - assert instance.message.media == ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"] - assert instance.message.priority == 'default' - -if __name__ == '__main__': - unittest.main() diff --git a/test/unit/models/test_message_delivered_callback_message.py b/test/unit/models/test_message_delivered_callback_message.py deleted file mode 100644 index 3f92aede..00000000 --- a/test/unit/models/test_message_delivered_callback_message.py +++ /dev/null @@ -1,83 +0,0 @@ -# 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.message_delivered_callback_message import MessageDeliveredCallbackMessage - -class TestMessageDeliveredCallbackMessage(unittest.TestCase): - """MessageDeliveredCallbackMessage unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> MessageDeliveredCallbackMessage: - """Test MessageDeliveredCallbackMessage - 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 MessageDeliveredCallbackMessage( - id = '1661365814859loidf7mcwd4qacn7', - owner = '+15553332222', - application_id = '93de2206-9669-4e07-948d-329f4b722ee2', - time = '2016-09-14T18:20:16Z', - segment_count = 1, - direction = 'in', - to = ["+15552223333"], - var_from = '+15553332222', - text = 'Hello world', - tag = 'custom string', - media = ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"], - priority = 'default' - ) - else: - return MessageDeliveredCallbackMessage( - id = '1661365814859loidf7mcwd4qacn7', - owner = '+15553332222', - application_id = '93de2206-9669-4e07-948d-329f4b722ee2', - time = '2016-09-14T18:20:16Z', - segment_count = 1, - direction = 'in', - to = ["+15552223333"], - var_from = '+15553332222', - text = 'Hello world', - tag = 'custom string', - ) - - def testMessageDeliveredCallbackMessage(self): - """Test MessageDeliveredCallbackMessage""" - instance = self.make_instance(True) - assert instance is not None - assert isinstance(instance, MessageDeliveredCallbackMessage) - assert instance.id == '1661365814859loidf7mcwd4qacn7' - assert instance.owner == '+15553332222' - assert instance.application_id == '93de2206-9669-4e07-948d-329f4b722ee2' - assert isinstance(instance.time, datetime) - assert instance.segment_count == 1 - assert instance.direction == 'in' - assert instance.to == ["+15552223333"] - assert instance.var_from == '+15553332222' - assert instance.text == 'Hello world' - assert instance.tag == 'custom string' - assert instance.media == ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"] - assert instance.priority == 'default' - -if __name__ == '__main__': - unittest.main() diff --git a/test/unit/models/test_message_failed_callback_message.py b/test/unit/models/test_message_failed_callback_message.py deleted file mode 100644 index 4c16e048..00000000 --- a/test/unit/models/test_message_failed_callback_message.py +++ /dev/null @@ -1,84 +0,0 @@ -# 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.message_failed_callback_message import MessageFailedCallbackMessage - -class TestMessageFailedCallbackMessage(unittest.TestCase): - """MessageFailedCallbackMessage unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> MessageFailedCallbackMessage: - """Test MessageFailedCallbackMessage - 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 MessageFailedCallbackMessage( - id = '1661365814859loidf7mcwd4qacn7', - owner = '+15553332222', - application_id = '93de2206-9669-4e07-948d-329f4b722ee2', - time = '2016-09-14T18:20:16Z', - segment_count = 1, - direction = 'in', - to = ["+15552223333"], - var_from = '+15553332222', - text = 'Hello world', - tag = 'custom string', - media = ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"], - priority = 'default' - ) - else: - return MessageFailedCallbackMessage( - id = '1661365814859loidf7mcwd4qacn7', - owner = '+15553332222', - application_id = '93de2206-9669-4e07-948d-329f4b722ee2', - time = '2016-09-14T18:20:16Z', - segment_count = 1, - direction = 'in', - to = ["+15552223333"], - var_from = '+15553332222', - text = 'Hello world', - tag = 'custom string', - priority = 'default', - ) - - def testMessageFailedCallbackMessage(self): - """Test MessageFailedCallbackMessage""" - instance = self.make_instance(True) - assert instance is not None - assert isinstance(instance, MessageFailedCallbackMessage) - assert instance.id == '1661365814859loidf7mcwd4qacn7' - assert instance.owner == '+15553332222' - assert instance.application_id == '93de2206-9669-4e07-948d-329f4b722ee2' - assert isinstance(instance.time, datetime) - assert instance.segment_count == 1 - assert instance.direction == 'in' - assert instance.to == ["+15552223333"] - assert instance.var_from == '+15553332222' - assert instance.text == 'Hello world' - assert instance.tag == 'custom string' - assert instance.media == ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"] - assert instance.priority == 'default' - -if __name__ == '__main__': - unittest.main() diff --git a/test/unit/models/test_message_sending_callback.py b/test/unit/models/test_message_sending_callback.py deleted file mode 100644 index 958a36d0..00000000 --- a/test/unit/models/test_message_sending_callback.py +++ /dev/null @@ -1,101 +0,0 @@ -# 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.message_sending_callback import MessageSendingCallback -from bandwidth.models.message_sending_callback_message import MessageSendingCallbackMessage - -class TestMessageSendingCallback(unittest.TestCase): - """MessageSendingCallback unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> MessageSendingCallback: - """Test MessageSendingCallback - 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 MessageSendingCallback( - time = '2016-09-14T18:20:16Z', - type = 'message-sending', - to = '+15552223333', - description = 'Message is sending to carrier', - message = MessageSendingCallbackMessage( - id = '1661365814859loidf7mcwd4qacn7', - owner = '+15553332222', - application_id = '93de2206-9669-4e07-948d-329f4b722ee2', - time = '2016-09-14T18:20:16Z', - segment_count = 1, - direction = 'in', - to = ["+15552223333"], - var_from = '+15553332222', - text = 'Hello world', - tag = 'custom string', - media = ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"], - priority = 'default', ) - ) - else: - return MessageSendingCallback( - time = '2016-09-14T18:20:16Z', - type = 'message-sending', - to = '+15552223333', - description = 'Message is sending to carrier', - message = MessageSendingCallbackMessage( - id = '1661365814859loidf7mcwd4qacn7', - owner = '+15553332222', - application_id = '93de2206-9669-4e07-948d-329f4b722ee2', - time = '2016-09-14T18:20:16Z', - segment_count = 1, - direction = 'in', - to = ["+15552223333"], - var_from = '+15553332222', - text = 'Hello world', - tag = 'custom string', - media = ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"], - priority = 'default', ), - ) - - def testMessageSendingCallback(self): - """Test MessageSendingCallback""" - instance = self.make_instance(True) - assert instance is not None - assert isinstance(instance, MessageSendingCallback) - assert isinstance(instance.time, datetime) - assert instance.type == 'message-sending' - assert instance.to == '+15552223333' - assert instance.description == 'Message is sending to carrier' - assert isinstance(instance.message, MessageSendingCallbackMessage) - assert instance.message.id == '1661365814859loidf7mcwd4qacn7' - assert instance.message.owner == '+15553332222' - assert instance.message.application_id == '93de2206-9669-4e07-948d-329f4b722ee2' - assert isinstance(instance.message.time, datetime) - assert instance.message.segment_count == 1 - assert instance.message.direction == 'in' - assert instance.message.to == ["+15552223333"] - assert instance.message.var_from == '+15553332222' - assert instance.message.text == 'Hello world' - assert instance.message.tag == 'custom string' - assert instance.message.media == ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"] - assert instance.message.priority == 'default' - -if __name__ == '__main__': - unittest.main() diff --git a/test/unit/models/test_message_sending_callback_message.py b/test/unit/models/test_message_sending_callback_message.py deleted file mode 100644 index 851e4643..00000000 --- a/test/unit/models/test_message_sending_callback_message.py +++ /dev/null @@ -1,84 +0,0 @@ -# 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.message_sending_callback_message import MessageSendingCallbackMessage - -class TestMessageSendingCallbackMessage(unittest.TestCase): - """MessageSendingCallbackMessage unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> MessageSendingCallbackMessage: - """Test MessageSendingCallbackMessage - 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 MessageSendingCallbackMessage( - id = '1661365814859loidf7mcwd4qacn7', - owner = '+15553332222', - application_id = '93de2206-9669-4e07-948d-329f4b722ee2', - time = '2016-09-14T18:20:16Z', - segment_count = 1, - direction = 'in', - to = ["+15552223333"], - var_from = '+15553332222', - text = 'Hello world', - tag = 'custom string', - media = ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"], - priority = 'default' - ) - else: - return MessageSendingCallbackMessage( - id = '1661365814859loidf7mcwd4qacn7', - owner = '+15553332222', - application_id = '93de2206-9669-4e07-948d-329f4b722ee2', - time = '2016-09-14T18:20:16Z', - segment_count = 1, - direction = 'in', - to = ["+15552223333"], - var_from = '+15553332222', - text = 'Hello world', - media = ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"], - priority = 'default', - ) - - def testMessageSendingCallbackMessage(self): - """Test MessageSendingCallbackMessage""" - instance = self.make_instance(True) - assert instance is not None - assert isinstance(instance, MessageSendingCallbackMessage) - assert instance.id == '1661365814859loidf7mcwd4qacn7' - assert instance.owner == '+15553332222' - assert instance.application_id == '93de2206-9669-4e07-948d-329f4b722ee2' - assert isinstance(instance.time, datetime) - assert instance.segment_count == 1 - assert instance.direction == 'in' - assert instance.to == ["+15552223333"] - assert instance.var_from == '+15553332222' - assert instance.text == 'Hello world' - assert instance.tag == 'custom string' - assert instance.media == ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"] - assert instance.priority == 'default' - -if __name__ == '__main__': - unittest.main()