diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 232d698f..0c639e6c 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -162,6 +162,7 @@ docs/Model/RbmMessageContentRichCard.md docs/Model/RbmMessageContentText.md docs/Model/RbmMessageMedia.md docs/Model/RbmOpenUrlEnum.md +docs/Model/RbmSession.md docs/Model/RbmStandaloneCard.md docs/Model/RbmSuggestionResponse.md docs/Model/RbmWebViewEnum.md @@ -384,6 +385,7 @@ src/Model/RbmMessageContentRichCard.php src/Model/RbmMessageContentText.php src/Model/RbmMessageMedia.php src/Model/RbmOpenUrlEnum.php +src/Model/RbmSession.php src/Model/RbmStandaloneCard.php src/Model/RbmSuggestionResponse.php src/Model/RbmWebViewEnum.php diff --git a/README.md b/README.md index 2ed1c816..55a7a886 100644 --- a/README.md +++ b/README.md @@ -274,6 +274,7 @@ Class | Method | HTTP request | Description - [RbmMessageContentText](docs/Model/RbmMessageContentText.md) - [RbmMessageMedia](docs/Model/RbmMessageMedia.md) - [RbmOpenUrlEnum](docs/Model/RbmOpenUrlEnum.md) +- [RbmSession](docs/Model/RbmSession.md) - [RbmStandaloneCard](docs/Model/RbmStandaloneCard.md) - [RbmSuggestionResponse](docs/Model/RbmSuggestionResponse.md) - [RbmWebViewEnum](docs/Model/RbmWebViewEnum.md) diff --git a/bandwidth.yml b/bandwidth.yml index 350b6217..a33be21b 100644 --- a/bandwidth.yml +++ b/bandwidth.yml @@ -2620,14 +2620,13 @@ components: type: string description: Displayed text for user to click maxLength: 25 - example: Hello world + example: Track my order rbmActionPostbackData: title: Post Back Data type: string - format: byte - description: Base64 payload the customer receives when the reply is clicked. + description: Payload the customer receives when the reply is clicked. maxLength: 2048 - example: SGVsbG8gd29ybGQ= + example: track-order-43654 rbmActionBase: type: object properties: @@ -2916,8 +2915,8 @@ components: properties: text: type: string - description: The text associated with the suggestion response. - example: Yes, I would like to proceed + description: The text of the suggestion the user tapped. + example: Track my order postbackData: $ref: '#/components/schemas/rbmActionPostbackData' pairedMessageId: @@ -2938,6 +2937,70 @@ components: format: double description: The longitude of the client's location. example: '-122.4194' + rbmSession: + type: object + description: >- + RCS interactive session information for the message. + + An interactive session is a 24-hour window covering all Rich and Rich + Media messages exchanged between an + + RCS agent and a specific end user mobile number. It is triggered when at + least 4 messages are exchanged within + + 24 hours, at least 2 of them mobile-originated and at least 1 + mobile-terminated. + + Only present on `message-delivered`, `message-received` and + `session-started` callbacks for RBM messages of + + US agents with the Conversational billing category. Omitted for all + other messages. + properties: + canInitiate: + type: boolean + description: >- + Whether the message can start an interactive session. + + `false` if the message is already part of an active session, or if + the agent is not eligible for + + interactive session billing. + example: false + id: + type: string + nullable: true + description: >- + The unique identifier of the interactive session the message is part + of. This is not a message ID. + + Omitted if the message is not part of a session. + example: 0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d + type: + type: string + nullable: true + description: |- + The type of the interactive session. + Only present on `session-started` callbacks. + example: INTERACTIVE_SESSION + startTime: + type: string + nullable: true + format: date-time + description: >- + The time the 24-hour session window opened. Only present on + `session-started` callbacks. + example: '2026-08-06T09:59:55Z' + endTime: + type: string + nullable: true + format: date-time + description: >- + The time the 24-hour session window closes. Only present on + `session-started` callbacks. + example: '2026-08-07T09:59:55Z' + required: + - canInitiate callback: description: >- Callbacks are divided into two types based on direction of the related @@ -2960,6 +3023,7 @@ components: message-delivered: '#/components/schemas/statusCallback' message-failed: '#/components/schemas/statusCallback' message-read: '#/components/schemas/statusCallback' + session-started: '#/components/schemas/statusCallback' message-received: '#/components/schemas/inboundCallback' requested-location-response: '#/components/schemas/inboundCallback' suggestion-response: '#/components/schemas/inboundCallback' @@ -3060,12 +3124,17 @@ components: - `message-read` indicates that the RBM message was read by the recipient. + + - `session-started` indicates that a previously exchanged RBM message is + now part of an RCS interactive session and is no longer billed + individually. enum: - message-sending - message-sent - message-delivered - message-failed - message-read + - session-started example: message-delivered inboundCallbackTypeEnum: type: string @@ -3143,6 +3212,8 @@ components: $ref: '#/components/schemas/priorityEnum' channel: $ref: '#/components/schemas/multiChannelMessageChannelEnum' + session: + $ref: '#/components/schemas/rbmSession' required: - id - owner @@ -8878,6 +8949,31 @@ components: media: - >- https://messaging.bandwidth.com/api/v2/users/9900902/media/14762070468292kw2fuqty55yp2b2/0/bw.png + rbmMessageReceivedSessionCallbackExample: + summary: >- + An example of a rbm message-received callback body for a message that is + part of an RCS interactive session. + value: + time: '2026-08-06T10:00:05.502180Z' + type: message-received + to: BandwidthRBM + description: Incoming message received + message: + id: 1786010405502l2ntaoajuqjhqnxu + owner: BandwidthRBM + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + time: '2026-08-06T10:00:05.302180Z' + segmentCount: 1 + direction: in + to: + - BandwidthRBM + from: '+12345678902' + channel: RBM + content: + text: Yes, please book it for tomorrow. + session: + canInitiate: false + id: 0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d messageSendingCallbackExample: summary: An example of a message-sending callback body. value: @@ -8977,6 +9073,79 @@ components: owner: '+12345678902' direction: out segmentCount: 1 + rbmMessageDeliveredSessionCallbackExample: + summary: >- + An example of a rbm message-delivered callback body for a message that + is part of an RCS interactive session. + value: + type: message-delivered + time: '2026-08-06T10:01:11.160744Z' + description: Message delivered to handset. + to: '+12345678902' + message: + id: 1786010470868ty55yp2b2kw2fuq + time: '2026-08-06T10:01:10.868292Z' + to: + - '+12345678902' + from: BandwidthRBM + text: '' + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + owner: BandwidthRBM + direction: out + segmentCount: 1 + channel: RBM + session: + canInitiate: false + id: 0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d + rbmMessageDeliveredCanInitiateSessionCallbackExample: + summary: >- + An example of a rbm message-delivered callback body for a message that + is not yet part of an RCS interactive session. + value: + type: message-delivered + time: '2026-08-06T09:59:56.160744Z' + description: Message delivered to handset. + to: '+12345678902' + message: + id: 1786010395000kw2fuqty55yp2b2 + time: '2026-08-06T09:59:55.000000Z' + to: + - '+12345678902' + from: BandwidthRBM + text: '' + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + owner: BandwidthRBM + direction: out + segmentCount: 1 + channel: RBM + session: + canInitiate: true + sessionStartedCallbackExample: + summary: An example of a session-started callback body. + value: + type: session-started + time: '2026-08-06T10:00:00.123000Z' + description: Message is now part of an RCS interactive session. + to: '+12345678902' + message: + id: 1786010395000kw2fuqty55yp2b2 + owner: BandwidthRBM + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + time: '2026-08-06T10:00:00.120000Z' + segmentCount: 1 + direction: out + to: + - '+12345678902' + from: BandwidthRBM + text: '' + tag: '' + channel: RBM + session: + canInitiate: false + id: 0f5a3b9c-2d4e-4f6a-8b1c-7e9d0a2b3c4d + type: INTERACTIVE_SESSION + startTime: '2026-08-06T09:59:55Z' + endTime: '2026-08-07T09:59:55Z' messageFailedCallbackExample: summary: An example of a message-failed callback body. value: @@ -9980,6 +10149,9 @@ components: $ref: '#/components/examples/smsMessageReceivedCallbackExample' mmsMessageReceivedCallback: $ref: '#/components/examples/mmsMessageReceivedCallbackExample' + rbmMessageReceivedSessionCallback: + $ref: >- + #/components/examples/rbmMessageReceivedSessionCallbackExample responses: '200': description: OK @@ -9995,8 +10167,9 @@ components: information regarding a message sent (MT) from your message-enabled Bandwidth telephone number. -

The payload type will be one of message-sending, message-sent, message-delivered, message-failed or message-read. -

Note that message-read callbacks are pertinent only for RBM messages sent from the /messages/multiChannel endpoint. +

The payload type will be one of message-sending, message-sent, message-delivered, message-failed, message-read or session-started. +

Note that message-read and session-started callbacks are pertinent only for RBM messages sent from the /messages/multiChannel endpoint. +

Note that session-started callbacks are pertinent only for RBM messages of agents with the Conversational billing category.

Please visit Webhooks

content: @@ -10015,8 +10188,16 @@ components: groupMmsMessageDeliveredCallback: $ref: >- #/components/examples/groupMmsMessageDeliveredCallbackExample + rbmMessageDeliveredSessionCallback: + $ref: >- + #/components/examples/rbmMessageDeliveredSessionCallbackExample + rbmMessageDeliveredCanInitiateSessionCallback: + $ref: >- + #/components/examples/rbmMessageDeliveredCanInitiateSessionCallbackExample messageFailedCallback: $ref: '#/components/examples/messageFailedCallbackExample' + sessionStartedCallback: + $ref: '#/components/examples/sessionStartedCallbackExample' responses: '200': description: OK diff --git a/docs/Model/InboundCallbackMessage.md b/docs/Model/InboundCallbackMessage.md index b96d8bf7..e6b0770e 100644 --- a/docs/Model/InboundCallbackMessage.md +++ b/docs/Model/InboundCallbackMessage.md @@ -17,6 +17,7 @@ Name | Type | Description | Notes **media** | **string[]** | Optional media, not applicable for sms | [optional] **priority** | [**\Bandwidth\Model\PriorityEnum**](PriorityEnum.md) | | [optional] **channel** | [**\Bandwidth\Model\MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | | [optional] +**session** | [**\Bandwidth\Model\RbmSession**](RbmSession.md) | | [optional] **content** | [**\Bandwidth\Model\MultiChannelMessageContent**](MultiChannelMessageContent.md) | | [optional] **suggestion_response** | [**\Bandwidth\Model\RbmSuggestionResponse**](RbmSuggestionResponse.md) | | [optional] **location_response** | [**\Bandwidth\Model\RbmLocationResponse**](RbmLocationResponse.md) | | [optional] diff --git a/docs/Model/MultiChannelActionCalendarEvent.md b/docs/Model/MultiChannelActionCalendarEvent.md index 7a41991a..00c4cb23 100644 --- a/docs/Model/MultiChannelActionCalendarEvent.md +++ b/docs/Model/MultiChannelActionCalendarEvent.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **type** | [**\Bandwidth\Model\RbmActionTypeEnum**](RbmActionTypeEnum.md) | | **text** | **string** | Displayed text for user to click | -**postback_data** | **string** | Base64 payload the customer receives when the reply is clicked. | +**postback_data** | **string** | Payload the customer receives when the reply is clicked. | **title** | **string** | The title of the event. | **start_time** | **\DateTime** | The start time of the event. Must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. | **end_time** | **\DateTime** | The end time of the event. Must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. | diff --git a/docs/Model/RbmActionBase.md b/docs/Model/RbmActionBase.md index 9e641fe3..c8501ca6 100644 --- a/docs/Model/RbmActionBase.md +++ b/docs/Model/RbmActionBase.md @@ -6,6 +6,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **type** | [**\Bandwidth\Model\RbmActionTypeEnum**](RbmActionTypeEnum.md) | | **text** | **string** | Displayed text for user to click | -**postback_data** | **string** | Base64 payload the customer receives when the reply is clicked. | +**postback_data** | **string** | Payload the customer receives when the reply is clicked. | [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RbmActionDial.md b/docs/Model/RbmActionDial.md index 0744ebd4..aecfcfcf 100644 --- a/docs/Model/RbmActionDial.md +++ b/docs/Model/RbmActionDial.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **type** | [**\Bandwidth\Model\RbmActionTypeEnum**](RbmActionTypeEnum.md) | | **text** | **string** | Displayed text for user to click | -**postback_data** | **string** | Base64 payload the customer receives when the reply is clicked. | +**postback_data** | **string** | Payload the customer receives when the reply is clicked. | **phone_number** | **string** | The phone number to dial. Must be E164 format. | [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RbmActionOpenUrl.md b/docs/Model/RbmActionOpenUrl.md index e3c16313..642bb76a 100644 --- a/docs/Model/RbmActionOpenUrl.md +++ b/docs/Model/RbmActionOpenUrl.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **type** | [**\Bandwidth\Model\RbmActionTypeEnum**](RbmActionTypeEnum.md) | | **text** | **string** | Displayed text for user to click | -**postback_data** | **string** | Base64 payload the customer receives when the reply is clicked. | +**postback_data** | **string** | Payload the customer receives when the reply is clicked. | **url** | **string** | The URL to open in browser. Must use http:// or https:// scheme. | **application** | [**\Bandwidth\Model\RbmOpenUrlEnum**](RbmOpenUrlEnum.md) | | [optional] **webview_view_mode** | [**\Bandwidth\Model\RbmWebViewEnum**](RbmWebViewEnum.md) | | [optional] diff --git a/docs/Model/RbmActionViewLocation.md b/docs/Model/RbmActionViewLocation.md index 2fb12d5b..f659a972 100644 --- a/docs/Model/RbmActionViewLocation.md +++ b/docs/Model/RbmActionViewLocation.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **type** | [**\Bandwidth\Model\RbmActionTypeEnum**](RbmActionTypeEnum.md) | | **text** | **string** | Displayed text for user to click | -**postback_data** | **string** | Base64 payload the customer receives when the reply is clicked. | +**postback_data** | **string** | Payload the customer receives when the reply is clicked. | **latitude** | **float** | The latitude of the location. Must be in range [-90.000000, 90.000000]. | **longitude** | **float** | The longitude of the location. Must be in range [-180.000000, 180.000000]. | **label** | **string** | The label of the location. | [optional] diff --git a/docs/Model/RbmSession.md b/docs/Model/RbmSession.md new file mode 100644 index 00000000..de5e278d --- /dev/null +++ b/docs/Model/RbmSession.md @@ -0,0 +1,13 @@ +# RbmSession + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**can_initiate** | **bool** | Whether the message can start an interactive session. `false` if the message is already part of an active session, or if the agent is not eligible for interactive session billing. | +**id** | **string** | The unique identifier of the interactive session the message is part of. This is not a message ID. Omitted if the message is not part of a session. | [optional] +**type** | **string** | The type of the interactive session. Only present on `session-started` callbacks. | [optional] +**start_time** | **\DateTime** | The time the 24-hour session window opened. Only present on `session-started` callbacks. | [optional] +**end_time** | **\DateTime** | The time the 24-hour session window closes. Only present on `session-started` callbacks. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RbmSuggestionResponse.md b/docs/Model/RbmSuggestionResponse.md index f4463792..e5e81ff7 100644 --- a/docs/Model/RbmSuggestionResponse.md +++ b/docs/Model/RbmSuggestionResponse.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**text** | **string** | The text associated with the suggestion response. | [optional] -**postback_data** | **string** | Base64 payload the customer receives when the reply is clicked. | [optional] +**text** | **string** | The text of the suggestion the user tapped. | [optional] +**postback_data** | **string** | Payload the customer receives when the reply is clicked. | [optional] **paired_message_id** | **string** | Corresponding parent message ID (MT). | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/StatusCallbackMessage.md b/docs/Model/StatusCallbackMessage.md index 286542fa..92f5458e 100644 --- a/docs/Model/StatusCallbackMessage.md +++ b/docs/Model/StatusCallbackMessage.md @@ -17,5 +17,6 @@ Name | Type | Description | Notes **media** | **string[]** | Optional media, not applicable for sms | [optional] **priority** | [**\Bandwidth\Model\PriorityEnum**](PriorityEnum.md) | | [optional] **channel** | [**\Bandwidth\Model\MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | | [optional] +**session** | [**\Bandwidth\Model\RbmSession**](RbmSession.md) | | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/src/Model/Callback.php b/src/Model/Callback.php index 510aab93..f4bf0aae 100644 --- a/src/Model/Callback.php +++ b/src/Model/Callback.php @@ -84,6 +84,7 @@ public static function getOneOfDiscriminatorMappings(): array 'message-sending' => '\Bandwidth\Model\StatusCallback', 'message-sent' => '\Bandwidth\Model\StatusCallback', 'requested-location-response' => '\Bandwidth\Model\InboundCallback', + 'session-started' => '\Bandwidth\Model\StatusCallback', 'suggestion-response' => '\Bandwidth\Model\InboundCallback' ]; } diff --git a/src/Model/InboundCallbackMessage.php b/src/Model/InboundCallbackMessage.php index c45b43e6..d0395321 100644 --- a/src/Model/InboundCallbackMessage.php +++ b/src/Model/InboundCallbackMessage.php @@ -72,6 +72,7 @@ class InboundCallbackMessage implements ModelInterface, ArrayAccess, JsonSeriali 'media' => 'string[]', 'priority' => '\Bandwidth\Model\PriorityEnum', 'channel' => '\Bandwidth\Model\MultiChannelMessageChannelEnum', + 'session' => '\Bandwidth\Model\RbmSession', 'content' => '\Bandwidth\Model\MultiChannelMessageContent', 'suggestion_response' => '\Bandwidth\Model\RbmSuggestionResponse', 'location_response' => '\Bandwidth\Model\RbmLocationResponse' @@ -96,6 +97,7 @@ class InboundCallbackMessage implements ModelInterface, ArrayAccess, JsonSeriali 'media' => 'uri', 'priority' => null, 'channel' => null, + 'session' => null, 'content' => null, 'suggestion_response' => null, 'location_response' => null @@ -120,6 +122,7 @@ class InboundCallbackMessage implements ModelInterface, ArrayAccess, JsonSeriali 'media' => false, 'priority' => false, 'channel' => false, + 'session' => false, 'content' => false, 'suggestion_response' => false, 'location_response' => false @@ -214,6 +217,7 @@ public function isNullableSetToNull(string $property): bool 'media' => 'media', 'priority' => 'priority', 'channel' => 'channel', + 'session' => 'session', 'content' => 'content', 'suggestion_response' => 'suggestionResponse', 'location_response' => 'locationResponse' @@ -238,6 +242,7 @@ public function isNullableSetToNull(string $property): bool 'media' => 'setMedia', 'priority' => 'setPriority', 'channel' => 'setChannel', + 'session' => 'setSession', 'content' => 'setContent', 'suggestion_response' => 'setSuggestionResponse', 'location_response' => 'setLocationResponse' @@ -262,6 +267,7 @@ public function isNullableSetToNull(string $property): bool 'media' => 'getMedia', 'priority' => 'getPriority', 'channel' => 'getChannel', + 'session' => 'getSession', 'content' => 'getContent', 'suggestion_response' => 'getSuggestionResponse', 'location_response' => 'getLocationResponse' @@ -327,6 +333,7 @@ public function __construct(?array $data = null) $this->setIfExists('media', $data ?? [], null); $this->setIfExists('priority', $data ?? [], null); $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('session', $data ?? [], null); $this->setIfExists('content', $data ?? [], null); $this->setIfExists('suggestion_response', $data ?? [], null); $this->setIfExists('location_response', $data ?? [], null); @@ -745,6 +752,33 @@ public function setChannel(?\Bandwidth\Model\MultiChannelMessageChannelEnum $cha return $this; } + /** + * Gets session + * + * @return \Bandwidth\Model\RbmSession|null + */ + public function getSession(): ?\Bandwidth\Model\RbmSession + { + return $this->container['session']; + } + + /** + * Sets session + * + * @param \Bandwidth\Model\RbmSession|null $session session + * + * @return $this + */ + public function setSession(?\Bandwidth\Model\RbmSession $session): static + { + if (is_null($session)) { + throw new InvalidArgumentException('non-nullable session cannot be null'); + } + $this->container['session'] = $session; + + return $this; + } + /** * Gets content * diff --git a/src/Model/MultiChannelActionCalendarEvent.php b/src/Model/MultiChannelActionCalendarEvent.php index fba5f1b7..d6483ea1 100644 --- a/src/Model/MultiChannelActionCalendarEvent.php +++ b/src/Model/MultiChannelActionCalendarEvent.php @@ -76,7 +76,7 @@ class MultiChannelActionCalendarEvent implements ModelInterface, ArrayAccess, Js protected static array $openAPIFormats = [ 'type' => null, 'text' => null, - 'postback_data' => 'byte', + 'postback_data' => null, 'title' => null, 'start_time' => 'date-time', 'end_time' => 'date-time', @@ -307,6 +307,10 @@ public function listInvalidProperties(): array if ($this->container['postback_data'] === null) { $invalidProperties[] = "'postback_data' can't be null"; } + if (!is_null($this->container['postback_data']) && (mb_strlen($this->container['postback_data']) > 2048)) { + $invalidProperties[] = "invalid value for 'postback_data', the character length must be smaller than or equal to 2048."; + } + if ($this->container['title'] === null) { $invalidProperties[] = "'title' can't be null"; } @@ -407,7 +411,7 @@ public function getPostbackData(): string /** * Sets postback_data * - * @param string $postback_data Base64 payload the customer receives when the reply is clicked. + * @param string $postback_data Payload the customer receives when the reply is clicked. * * @return $this */ @@ -416,6 +420,9 @@ public function setPostbackData(string $postback_data): static if (is_null($postback_data)) { throw new InvalidArgumentException('non-nullable postback_data cannot be null'); } + if ((mb_strlen($postback_data) > 2048)) { + throw new InvalidArgumentException('invalid length for $postback_data when calling MultiChannelActionCalendarEvent., must be smaller than or equal to 2048.'); + } $this->container['postback_data'] = $postback_data; diff --git a/src/Model/RbmActionBase.php b/src/Model/RbmActionBase.php index 4efb02c4..d0cae684 100644 --- a/src/Model/RbmActionBase.php +++ b/src/Model/RbmActionBase.php @@ -72,7 +72,7 @@ class RbmActionBase implements ModelInterface, ArrayAccess, JsonSerializable protected static array $openAPIFormats = [ 'type' => null, 'text' => null, - 'postback_data' => 'byte' + 'postback_data' => null ]; /** @@ -279,6 +279,10 @@ public function listInvalidProperties(): array if ($this->container['postback_data'] === null) { $invalidProperties[] = "'postback_data' can't be null"; } + if (!is_null($this->container['postback_data']) && (mb_strlen($this->container['postback_data']) > 2048)) { + $invalidProperties[] = "invalid value for 'postback_data', the character length must be smaller than or equal to 2048."; + } + return $invalidProperties; } @@ -362,7 +366,7 @@ public function getPostbackData(): string /** * Sets postback_data * - * @param string $postback_data Base64 payload the customer receives when the reply is clicked. + * @param string $postback_data Payload the customer receives when the reply is clicked. * * @return $this */ @@ -371,6 +375,9 @@ public function setPostbackData(string $postback_data): static if (is_null($postback_data)) { throw new InvalidArgumentException('non-nullable postback_data cannot be null'); } + if ((mb_strlen($postback_data) > 2048)) { + throw new InvalidArgumentException('invalid length for $postback_data when calling RbmActionBase., must be smaller than or equal to 2048.'); + } $this->container['postback_data'] = $postback_data; diff --git a/src/Model/RbmActionDial.php b/src/Model/RbmActionDial.php index 23fa9998..47967bb5 100644 --- a/src/Model/RbmActionDial.php +++ b/src/Model/RbmActionDial.php @@ -73,7 +73,7 @@ class RbmActionDial implements ModelInterface, ArrayAccess, JsonSerializable protected static array $openAPIFormats = [ 'type' => null, 'text' => null, - 'postback_data' => 'byte', + 'postback_data' => null, 'phone_number' => null ]; @@ -286,6 +286,10 @@ public function listInvalidProperties(): array if ($this->container['postback_data'] === null) { $invalidProperties[] = "'postback_data' can't be null"; } + if (!is_null($this->container['postback_data']) && (mb_strlen($this->container['postback_data']) > 2048)) { + $invalidProperties[] = "invalid value for 'postback_data', the character length must be smaller than or equal to 2048."; + } + if ($this->container['phone_number'] === null) { $invalidProperties[] = "'phone_number' can't be null"; } @@ -372,7 +376,7 @@ public function getPostbackData(): string /** * Sets postback_data * - * @param string $postback_data Base64 payload the customer receives when the reply is clicked. + * @param string $postback_data Payload the customer receives when the reply is clicked. * * @return $this */ @@ -381,6 +385,9 @@ public function setPostbackData(string $postback_data): static if (is_null($postback_data)) { throw new InvalidArgumentException('non-nullable postback_data cannot be null'); } + if ((mb_strlen($postback_data) > 2048)) { + throw new InvalidArgumentException('invalid length for $postback_data when calling RbmActionDial., must be smaller than or equal to 2048.'); + } $this->container['postback_data'] = $postback_data; diff --git a/src/Model/RbmActionOpenUrl.php b/src/Model/RbmActionOpenUrl.php index 66aa7a6b..716fc40f 100644 --- a/src/Model/RbmActionOpenUrl.php +++ b/src/Model/RbmActionOpenUrl.php @@ -75,7 +75,7 @@ class RbmActionOpenUrl implements ModelInterface, ArrayAccess, JsonSerializable protected static array $openAPIFormats = [ 'type' => null, 'text' => null, - 'postback_data' => 'byte', + 'postback_data' => null, 'url' => 'uri', 'application' => null, 'webview_view_mode' => null @@ -300,6 +300,10 @@ public function listInvalidProperties(): array if ($this->container['postback_data'] === null) { $invalidProperties[] = "'postback_data' can't be null"; } + if (!is_null($this->container['postback_data']) && (mb_strlen($this->container['postback_data']) > 2048)) { + $invalidProperties[] = "invalid value for 'postback_data', the character length must be smaller than or equal to 2048."; + } + if ($this->container['url'] === null) { $invalidProperties[] = "'url' can't be null"; } @@ -390,7 +394,7 @@ public function getPostbackData(): string /** * Sets postback_data * - * @param string $postback_data Base64 payload the customer receives when the reply is clicked. + * @param string $postback_data Payload the customer receives when the reply is clicked. * * @return $this */ @@ -399,6 +403,9 @@ public function setPostbackData(string $postback_data): static if (is_null($postback_data)) { throw new InvalidArgumentException('non-nullable postback_data cannot be null'); } + if ((mb_strlen($postback_data) > 2048)) { + throw new InvalidArgumentException('invalid length for $postback_data when calling RbmActionOpenUrl., must be smaller than or equal to 2048.'); + } $this->container['postback_data'] = $postback_data; diff --git a/src/Model/RbmActionViewLocation.php b/src/Model/RbmActionViewLocation.php index 50ced2af..39a95275 100644 --- a/src/Model/RbmActionViewLocation.php +++ b/src/Model/RbmActionViewLocation.php @@ -75,7 +75,7 @@ class RbmActionViewLocation implements ModelInterface, ArrayAccess, JsonSerializ protected static array $openAPIFormats = [ 'type' => null, 'text' => null, - 'postback_data' => 'byte', + 'postback_data' => null, 'latitude' => 'double', 'longitude' => 'double', 'label' => null @@ -300,6 +300,10 @@ public function listInvalidProperties(): array if ($this->container['postback_data'] === null) { $invalidProperties[] = "'postback_data' can't be null"; } + if (!is_null($this->container['postback_data']) && (mb_strlen($this->container['postback_data']) > 2048)) { + $invalidProperties[] = "invalid value for 'postback_data', the character length must be smaller than or equal to 2048."; + } + if ($this->container['latitude'] === null) { $invalidProperties[] = "'latitude' can't be null"; } @@ -393,7 +397,7 @@ public function getPostbackData(): string /** * Sets postback_data * - * @param string $postback_data Base64 payload the customer receives when the reply is clicked. + * @param string $postback_data Payload the customer receives when the reply is clicked. * * @return $this */ @@ -402,6 +406,9 @@ public function setPostbackData(string $postback_data): static if (is_null($postback_data)) { throw new InvalidArgumentException('non-nullable postback_data cannot be null'); } + if ((mb_strlen($postback_data) > 2048)) { + throw new InvalidArgumentException('invalid length for $postback_data when calling RbmActionViewLocation., must be smaller than or equal to 2048.'); + } $this->container['postback_data'] = $postback_data; diff --git a/src/Model/RbmSession.php b/src/Model/RbmSession.php new file mode 100644 index 00000000..bf7e1cb6 --- /dev/null +++ b/src/Model/RbmSession.php @@ -0,0 +1,552 @@ + + */ +class RbmSession implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'rbmSession'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'can_initiate' => 'bool', + 'id' => 'string', + 'type' => 'string', + 'start_time' => '\DateTime', + 'end_time' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'can_initiate' => null, + 'id' => null, + 'type' => null, + 'start_time' => 'date-time', + 'end_time' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'can_initiate' => false, + 'id' => true, + 'type' => true, + 'start_time' => true, + 'end_time' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'can_initiate' => 'canInitiate', + 'id' => 'id', + 'type' => 'type', + 'start_time' => 'startTime', + 'end_time' => 'endTime' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'can_initiate' => 'setCanInitiate', + 'id' => 'setId', + 'type' => 'setType', + 'start_time' => 'setStartTime', + 'end_time' => 'setEndTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'can_initiate' => 'getCanInitiate', + 'id' => 'getId', + 'type' => 'getType', + 'start_time' => 'getStartTime', + 'end_time' => 'getEndTime' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('can_initiate', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['can_initiate'] === null) { + $invalidProperties[] = "'can_initiate' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets can_initiate + * + * @return bool + */ + public function getCanInitiate(): bool + { + return $this->container['can_initiate']; + } + + /** + * Sets can_initiate + * + * @param bool $can_initiate Whether the message can start an interactive session. `false` if the message is already part of an active session, or if the agent is not eligible for interactive session billing. + * + * @return $this + */ + public function setCanInitiate(bool $can_initiate): static + { + if (is_null($can_initiate)) { + throw new InvalidArgumentException('non-nullable can_initiate cannot be null'); + } + $this->container['can_initiate'] = $can_initiate; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The unique identifier of the interactive session the message is part of. This is not a message ID. Omitted if the message is not part of a session. + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType(): ?string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type The type of the interactive session. Only present on `session-started` callbacks. + * + * @return $this + */ + public function setType(?string $type): static + { + if (is_null($type)) { + array_push($this->openAPINullablesSetToNull, 'type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets start_time + * + * @return \DateTime|null + */ + public function getStartTime(): ?\DateTime + { + return $this->container['start_time']; + } + + /** + * Sets start_time + * + * @param \DateTime|null $start_time The time the 24-hour session window opened. Only present on `session-started` callbacks. + * + * @return $this + */ + public function setStartTime(?\DateTime $start_time): static + { + if (is_null($start_time)) { + array_push($this->openAPINullablesSetToNull, 'start_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('start_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['start_time'] = $start_time; + + return $this; + } + + /** + * Gets end_time + * + * @return \DateTime|null + */ + public function getEndTime(): ?\DateTime + { + return $this->container['end_time']; + } + + /** + * Sets end_time + * + * @param \DateTime|null $end_time The time the 24-hour session window closes. Only present on `session-started` callbacks. + * + * @return $this + */ + public function setEndTime(?\DateTime $end_time): static + { + if (is_null($end_time)) { + array_push($this->openAPINullablesSetToNull, 'end_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('end_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['end_time'] = $end_time; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/RbmSuggestionResponse.php b/src/Model/RbmSuggestionResponse.php index 5ab5bd2b..a7d3861e 100644 --- a/src/Model/RbmSuggestionResponse.php +++ b/src/Model/RbmSuggestionResponse.php @@ -71,7 +71,7 @@ class RbmSuggestionResponse implements ModelInterface, ArrayAccess, JsonSerializ */ protected static array $openAPIFormats = [ 'text' => null, - 'postback_data' => 'byte', + 'postback_data' => null, 'paired_message_id' => null ]; @@ -266,6 +266,10 @@ public function listInvalidProperties(): array { $invalidProperties = []; + if (!is_null($this->container['postback_data']) && (mb_strlen($this->container['postback_data']) > 2048)) { + $invalidProperties[] = "invalid value for 'postback_data', the character length must be smaller than or equal to 2048."; + } + return $invalidProperties; } @@ -291,7 +295,7 @@ public function getText(): ?string /** * Sets text * - * @param string|null $text The text associated with the suggestion response. + * @param string|null $text The text of the suggestion the user tapped. * * @return $this */ @@ -318,7 +322,7 @@ public function getPostbackData(): ?string /** * Sets postback_data * - * @param string|null $postback_data Base64 payload the customer receives when the reply is clicked. + * @param string|null $postback_data Payload the customer receives when the reply is clicked. * * @return $this */ @@ -327,6 +331,9 @@ public function setPostbackData(?string $postback_data): static if (is_null($postback_data)) { throw new InvalidArgumentException('non-nullable postback_data cannot be null'); } + if ((mb_strlen($postback_data) > 2048)) { + throw new InvalidArgumentException('invalid length for $postback_data when calling RbmSuggestionResponse., must be smaller than or equal to 2048.'); + } $this->container['postback_data'] = $postback_data; diff --git a/src/Model/StatusCallbackMessage.php b/src/Model/StatusCallbackMessage.php index 4f117172..75a5d1cc 100644 --- a/src/Model/StatusCallbackMessage.php +++ b/src/Model/StatusCallbackMessage.php @@ -72,7 +72,8 @@ class StatusCallbackMessage implements ModelInterface, ArrayAccess, JsonSerializ 'tag' => 'string', 'media' => 'string[]', 'priority' => '\Bandwidth\Model\PriorityEnum', - 'channel' => '\Bandwidth\Model\MultiChannelMessageChannelEnum' + 'channel' => '\Bandwidth\Model\MultiChannelMessageChannelEnum', + 'session' => '\Bandwidth\Model\RbmSession' ]; /** @@ -93,7 +94,8 @@ class StatusCallbackMessage implements ModelInterface, ArrayAccess, JsonSerializ 'tag' => null, 'media' => 'uri', 'priority' => null, - 'channel' => null + 'channel' => null, + 'session' => null ]; /** @@ -114,7 +116,8 @@ class StatusCallbackMessage implements ModelInterface, ArrayAccess, JsonSerializ 'tag' => false, 'media' => false, 'priority' => false, - 'channel' => false + 'channel' => false, + 'session' => false ]; /** @@ -205,7 +208,8 @@ public function isNullableSetToNull(string $property): bool 'tag' => 'tag', 'media' => 'media', 'priority' => 'priority', - 'channel' => 'channel' + 'channel' => 'channel', + 'session' => 'session' ]; /** @@ -226,7 +230,8 @@ public function isNullableSetToNull(string $property): bool 'tag' => 'setTag', 'media' => 'setMedia', 'priority' => 'setPriority', - 'channel' => 'setChannel' + 'channel' => 'setChannel', + 'session' => 'setSession' ]; /** @@ -247,7 +252,8 @@ public function isNullableSetToNull(string $property): bool 'tag' => 'getTag', 'media' => 'getMedia', 'priority' => 'getPriority', - 'channel' => 'getChannel' + 'channel' => 'getChannel', + 'session' => 'getSession' ]; /** @@ -310,6 +316,7 @@ public function __construct(?array $data = null) $this->setIfExists('media', $data ?? [], null); $this->setIfExists('priority', $data ?? [], null); $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('session', $data ?? [], null); } /** @@ -724,6 +731,33 @@ public function setChannel(?\Bandwidth\Model\MultiChannelMessageChannelEnum $cha return $this; } + + /** + * Gets session + * + * @return \Bandwidth\Model\RbmSession|null + */ + public function getSession(): ?\Bandwidth\Model\RbmSession + { + return $this->container['session']; + } + + /** + * Sets session + * + * @param \Bandwidth\Model\RbmSession|null $session session + * + * @return $this + */ + public function setSession(?\Bandwidth\Model\RbmSession $session): static + { + if (is_null($session)) { + throw new InvalidArgumentException('non-nullable session cannot be null'); + } + $this->container['session'] = $session; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/src/Model/StatusCallbackTypeEnum.php b/src/Model/StatusCallbackTypeEnum.php index 8b7d715e..56e7ff6f 100644 --- a/src/Model/StatusCallbackTypeEnum.php +++ b/src/Model/StatusCallbackTypeEnum.php @@ -31,7 +31,7 @@ /** * StatusCallbackTypeEnum Class Doc Comment * - * @description The possible status callbacks when sending an MT SMS or MMS or RBM message: - `message-sending` indicates that Bandwidth is sending the message to the upstream provider. - `message-sent` indicates that the message has left the Bandwidth network and is in transit to the provider. - `message-delivered` indicates that the message was successfully delivered to handset. - `message-failed` indicates that the message could not be sent to the intended recipient. - `message-read` indicates that the RBM message was read by the recipient. + * @description The possible status callbacks when sending an MT SMS or MMS or RBM message: - `message-sending` indicates that Bandwidth is sending the message to the upstream provider. - `message-sent` indicates that the message has left the Bandwidth network and is in transit to the provider. - `message-delivered` indicates that the message was successfully delivered to handset. - `message-failed` indicates that the message could not be sent to the intended recipient. - `message-read` indicates that the RBM message was read by the recipient. - `session-started` indicates that a previously exchanged RBM message is now part of an RCS interactive session and is no longer billed individually. * @package Bandwidth * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -47,6 +47,8 @@ enum StatusCallbackTypeEnum: string case MESSAGE_FAILED = 'message-failed'; case MESSAGE_READ = 'message-read'; + + case SESSION_STARTED = 'session-started'; }